There may be times where users want to have the desktop resolution match the device resolution
on a small screen. The change adds the option without changing existing functionality of the
automatic resolution setting.
Also included localized text strings for the new option and addressed some issues with string
comparison in non en-US locales.
</string-array>\r
<string name="settings_resolution">Resolucion</string>\r
<string name="resolution_automatic">Automatico</string>\r
+ <string name="resolution_fit">Pantalla</string>\r
<string name="resolution_custom">Manual</string>\r
<string-array name="resolutions_array">\r
<item>Automatico</item>\r
+ <item>Ajuste a la pantalla</item>\r
<item>Manual</item>\r
<item>640x480</item>\r
<item>720x480</item>\r
</string-array>\r
<string-array name="resolutions_values_array">\r
<item>automatico</item>\r
+ <item>pantalla</item>\r
<item>manual</item>\r
<item>640x480</item>\r
<item>720x480</item>\r
</string-array>
<string name="settings_resolution">"Résolution"</string>
<string name="resolution_automatic">"Automatique"</string>
+ <string name="resolution_fit">"Agrandir la fenêtre"</string>
<string name="resolution_custom">"Personalisé"</string>
<string-array name="resolutions_array">
<item>"Automatique"</item>
+ <item>"Agrandir la fenêtre"</item>
<item>"Personalisé"</item>
<item>"640x480"</item>
<item>"720x480"</item>
</string-array>
<string-array name="resolutions_values_array">
<item>"Automatique"</item>
+ <item>"fenêtre"</item>
<item>"Personalisé"</item>
<item>"640x480"</item>
<item>"720x480"</item>
</string-array>
<string name="settings_resolution">Resolutie</string>
<string name="resolution_automatic">Automatisch</string>
+ <string name="resolution_fit">Schermvullend</string>
<string name="resolution_custom">Aangepast</string>
<string-array name="resolutions_array">
<item>Automatisch</item>
+ <item>Schermvullend</item>
<item>Aangepast</item>
<item>640x480</item>
<item>720x480</item>
</string-array>
<string-array name="resolutions_values_array">
<item>Automatisch</item>
+ <item>Schermvullend</item>
<item>Aangepast</item>
<item>640x480</item>
<item>720x480</item>
</string-array>
<string name="settings_resolution">Resolution</string>
<string name="resolution_automatic">Automatic</string>
+ <string name="resolution_fit">Fitscreen</string>
<string name="resolution_custom">Custom</string>
<string-array name="resolutions_array">
<item>Automatic</item>
+ <item>Fit Screen</item>
<item>Custom</item>
<item>640x480</item>
<item>720x480</item>
</string-array>
<string-array name="resolutions_values_array">
<item>automatic</item>
+ <item>fitscreen</item>
<item>custom</item>
<item>640x480</item>
<item>720x480</item>
private static final String PREF_SECURITY_ACCEPTALLCERTIFICATES = "security.accept_certificates";
private static SharedPreferences settings;
+ public static Context initialContext;
public static void init(Context context)
{
+ initialContext = context;
settings = PreferenceManager.getDefaultSharedPreferences(context);
initValues();
}
package com.freerdp.freerdpcore.domain;
import com.freerdp.freerdpcore.application.GlobalApp;
+import com.freerdp.freerdpcore.application.GlobalSettings;
+import com.freerdp.freerdpcore.R;
import android.content.SharedPreferences;
import android.os.Parcel;
// Screen Settings class
public static class ScreenSettings implements Parcelable
{
+ public static final int FITSCREEN = -2;
public static final int AUTOMATIC = -1;
public static final int CUSTOM = 0;
public static final int PREDEFINED = 1;
{
this.resolution = resolution;
- if (resolution == AUTOMATIC) {
+ if (resolution == AUTOMATIC || resolution == FITSCREEN) {
width = 0;
height = 0;
}
this.height = Integer.valueOf(dimensions[1]);
this.resolution = PREDEFINED;
}
- else if (resolution.equalsIgnoreCase("custom"))
+ else if (resolution.equalsIgnoreCase(GlobalSettings.initialContext.getResources().getString(R.string.resolution_custom)))
{
this.width = width;
this.height = height;
this.resolution = CUSTOM;
}
+ else if (resolution.equalsIgnoreCase(GlobalSettings.initialContext.getResources().getString(R.string.resolution_fit)))
+ {
+ this.width = this.height = 0;
+ this.resolution = FITSCREEN;
+ }
else
{
- this.width = this.height = 0;
+ this.width = this.height = 0;
this.resolution = AUTOMATIC;
}
}
{
if (isPredefined())
return (width + "x" + height);
-
- return (isAutomatic() ? "automatic" : "custom");
+
+ return (isFitScreen() ? GlobalSettings.initialContext.getResources().getString(R.string.resolution_fit) :
+ isAutomatic() ? GlobalSettings.initialContext.getResources().getString(R.string.resolution_automatic) :
+ GlobalSettings.initialContext.getResources().getString(R.string.resolution_custom));
}
public boolean isPredefined() {
public boolean isAutomatic() {
return (resolution == AUTOMATIC);
}
-
+
+ public boolean isFitScreen() {
+ return (resolution == FITSCREEN);
+ }
+
public boolean isCustom() {
return (resolution == CUSTOM);
}
ListPreference listPreference = (ListPreference)findPreference(key);
listPreference.setSummary(listPreference.getEntry());
- boolean enabled = listPreference.getValue().equals("custom");
+ boolean enabled = listPreference.getValue().equalsIgnoreCase(getResources().getString(R.string.resolution_custom));
if (key.equals("bookmark.resolution"))
{
findPreference("bookmark.width").setEnabled(enabled);
screenSettings.setWidth((int)((float)screenMax * 1.6f));
}
}
+ if (screenSettings.isFitScreen()) {
+ screenSettings.setHeight(screen_height);
+ screenSettings.setWidth(screen_width);
+ }
progressDialog = new ProgressDialog(this);
progressDialog.setTitle(bookmark.getLabel());