Merge pull request #1436 from toddmck/master

Add Fit Screen option to resolution settings and fixing #1450
This commit is contained in:
Martin Fleisz 2013-09-16 08:18:00 -07:00
commit b973e6a992
7 changed files with 64 additions and 22 deletions

View File

@ -64,9 +64,11 @@
</string-array>
<string name="settings_resolution">Resolucion</string>
<string name="resolution_automatic">Automatico</string>
<string name="resolution_fit">Pantalla</string>
<string name="resolution_custom">Manual</string>
<string-array name="resolutions_array">
<item>Automatico</item>
<item>Ajuste a la pantalla</item>
<item>Manual</item>
<item>640x480</item>
<item>720x480</item>
@ -77,9 +79,12 @@
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<!-- The strings in resolutions_values_array should not be localized -->
<!-- They are used for text comparison and must remain in english -->
<string-array name="resolutions_values_array">
<item>automatico</item>
<item>manual</item>
<item>automatic</item>
<item>fitscreen</item>
<item>custom</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
@ -89,6 +94,7 @@
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<!-- end protected string section -->
<string name="settings_width">Ancho</string>
<string name="settings_height">Altura</string>
<string name="settings_performance">Rendimiento</string>

View File

@ -63,9 +63,11 @@
</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>
@ -76,18 +78,22 @@
<item>"1920x1080"</item>
<item>"1920x1200"</item>
</string-array>
<!-- The strings in resolutions_values_array should not be localized -->
<!-- They are used for text comparison and must remain in english -->
<string-array name="resolutions_values_array">
<item>"Automatique"</item>
<item>"Personalisé"</item>
<item>"640x480"</item>
<item>"720x480"</item>
<item>"800x600"</item>
<item>"1024x768"</item>
<item>"1280x1024"</item>
<item>"1440x900"</item>
<item>"1920x1080"</item>
<item>"1920x1200"</item>
<item>automatic</item>
<item>fitscreen</item>
<item>custom</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
<item>1024x768</item>
<item>1280x1024</item>
<item>1440x900</item>
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<!-- end protected string section -->
<string name="settings_width">"Largeur"</string>
<string name="settings_height">"Hauteur"</string>
<string name="settings_performance">"Performance"</string>

View File

@ -64,9 +64,11 @@
</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>
@ -77,9 +79,12 @@
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<!-- The strings in resolutions_values_array should not be localized -->
<!-- They are used for text comparison and must remain in english -->
<string-array name="resolutions_values_array">
<item>Automatisch</item>
<item>Aangepast</item>
<item>automatic</item>
<item>fitscreen</item>
<item>custom</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
@ -89,6 +94,7 @@
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<!-- end protected string section -->
<string name="settings_width">Breedte</string>
<string name="settings_height">Hoogte</string>
<string name="settings_performance">Prestatie</string>

View File

@ -64,9 +64,11 @@
</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>
@ -79,6 +81,7 @@
</string-array>
<string-array name="resolutions_values_array">
<item>automatic</item>
<item>fitscreen</item>
<item>custom</item>
<item>640x480</item>
<item>720x480</item>

View File

@ -143,6 +143,7 @@ public class BookmarkBase implements Parcelable, Cloneable
// 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;
@ -174,7 +175,7 @@ public class BookmarkBase implements Parcelable, Cloneable
{
this.resolution = resolution;
if (resolution == AUTOMATIC) {
if (resolution == AUTOMATIC || resolution == FITSCREEN) {
width = 0;
height = 0;
}
@ -194,9 +195,14 @@ public class BookmarkBase implements Parcelable, Cloneable
this.height = height;
this.resolution = CUSTOM;
}
else if (resolution.equalsIgnoreCase("fitscreen"))
{
this.width = this.height = 0;
this.resolution = FITSCREEN;
}
else
{
this.width = this.height = 0;
this.width = this.height = 0;
this.resolution = AUTOMATIC;
}
}
@ -210,8 +216,8 @@ public class BookmarkBase implements Parcelable, Cloneable
{
if (isPredefined())
return (width + "x" + height);
return (isAutomatic() ? "automatic" : "custom");
return (isFitScreen() ? "fitscreen" : isAutomatic() ? "automatic" : "custom");
}
public boolean isPredefined() {
@ -221,7 +227,11 @@ public class BookmarkBase implements Parcelable, Cloneable
public boolean isAutomatic() {
return (resolution == AUTOMATIC);
}
public boolean isFitScreen() {
return (resolution == FITSCREEN);
}
public boolean isCustom() {
return (resolution == CUSTOM);
}

View File

@ -343,10 +343,17 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
else if (key.equals("bookmark.resolution") || key.equals("bookmark.colors") || key.equals("bookmark.width") || key.equals("bookmark.height"))
{
String resolution = sharedPreferences.getString("bookmark.resolution", "800x600");
if (resolution.equals("automatic"))
//compare english string from resolutions_values_array array, decode to localized
//text for display
if (resolution.equals("automatic")) {
resolution = getResources().getString(R.string.resolution_automatic);
else if (resolution.equals("custom"))
}
if (resolution.equals("custom")) {
resolution = getResources().getString(R.string.resolution_custom);
}
if (resolution.equals("fitscreen")) {
resolution = getResources().getString(R.string.resolution_fit);
}
resolution += "@" + sharedPreferences.getInt("bookmark.colors", 16);
findPreference("bookmark.screen").setSummary(resolution);
}
@ -451,7 +458,7 @@ public class BookmarkActivity extends PreferenceActivity implements OnSharedPref
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);

View File

@ -624,6 +624,10 @@ public class SessionActivity extends Activity
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());