Modify Fit Screen option to not require global context object

This commit is contained in:
Todd McKinney 2013-09-13 14:22:16 -05:00
parent 3a9a41d900
commit 999c571335
6 changed files with 32 additions and 24 deletions

View File

@ -79,10 +79,12 @@
<item>1920x1080</item> <item>1920x1080</item>
<item>1920x1200</item> <item>1920x1200</item>
</string-array> </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"> <string-array name="resolutions_values_array">
<item>automatico</item> <item>automatic</item>
<item>pantalla</item> <item>fitscreen</item>
<item>manual</item> <item>custom</item>
<item>640x480</item> <item>640x480</item>
<item>720x480</item> <item>720x480</item>
<item>800x600</item> <item>800x600</item>
@ -92,6 +94,7 @@
<item>1920x1080</item> <item>1920x1080</item>
<item>1920x1200</item> <item>1920x1200</item>
</string-array> </string-array>
<!-- end protected string section -->
<string name="settings_width">Ancho</string> <string name="settings_width">Ancho</string>
<string name="settings_height">Altura</string> <string name="settings_height">Altura</string>
<string name="settings_performance">Rendimiento</string> <string name="settings_performance">Rendimiento</string>

View File

@ -78,19 +78,22 @@
<item>"1920x1080"</item> <item>"1920x1080"</item>
<item>"1920x1200"</item> <item>"1920x1200"</item>
</string-array> </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"> <string-array name="resolutions_values_array">
<item>"Automatique"</item> <item>automatic</item>
<item>"fenêtre"</item> <item>fitscreen</item>
<item>"Personalisé"</item> <item>custom</item>
<item>"640x480"</item> <item>640x480</item>
<item>"720x480"</item> <item>720x480</item>
<item>"800x600"</item> <item>800x600</item>
<item>"1024x768"</item> <item>1024x768</item>
<item>"1280x1024"</item> <item>1280x1024</item>
<item>"1440x900"</item> <item>1440x900</item>
<item>"1920x1080"</item> <item>1920x1080</item>
<item>"1920x1200"</item> <item>1920x1200</item>
</string-array> </string-array>
<!-- end protected string section -->
<string name="settings_width">"Largeur"</string> <string name="settings_width">"Largeur"</string>
<string name="settings_height">"Hauteur"</string> <string name="settings_height">"Hauteur"</string>
<string name="settings_performance">"Performance"</string> <string name="settings_performance">"Performance"</string>

View File

@ -79,10 +79,12 @@
<item>1920x1080</item> <item>1920x1080</item>
<item>1920x1200</item> <item>1920x1200</item>
</string-array> </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"> <string-array name="resolutions_values_array">
<item>Automatisch</item> <item>automatic</item>
<item>Schermvullend</item> <item>fitscreen</item>
<item>Aangepast</item> <item>custom</item>
<item>640x480</item> <item>640x480</item>
<item>720x480</item> <item>720x480</item>
<item>800x600</item> <item>800x600</item>
@ -92,6 +94,7 @@
<item>1920x1080</item> <item>1920x1080</item>
<item>1920x1200</item> <item>1920x1200</item>
</string-array> </string-array>
<!-- end protected string section -->
<string name="settings_width">Breedte</string> <string name="settings_width">Breedte</string>
<string name="settings_height">Hoogte</string> <string name="settings_height">Hoogte</string>
<string name="settings_performance">Prestatie</string> <string name="settings_performance">Prestatie</string>

View File

@ -12,6 +12,7 @@ package com.freerdp.freerdpcore.application;
import android.app.Application; import android.app.Application;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Resources;
import android.util.Log; import android.util.Log;
import java.util.*; import java.util.*;
@ -50,6 +51,7 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
// timer for disconnecting sessions after the screen was turned off // timer for disconnecting sessions after the screen was turned off
private static Timer disconnectTimer = null; private static Timer disconnectTimer = null;
public static GlobalApp instance = null;
// TimerTask for disconnecting sessions after screen was turned off // TimerTask for disconnecting sessions after screen was turned off
private static class DisconnectTask extends TimerTask private static class DisconnectTask extends TimerTask
@ -88,6 +90,7 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB); quickConnectHistoryGateway = new QuickConnectHistoryGateway(historyDB);
GlobalSettings.init(this); GlobalSettings.init(this);
instance = this;
ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this); ConnectedTo3G = NetworkStateReceiver.isConnectedTo3G(this);
// init screen receiver here (this can't be declared in AndroidManifest - refer to: // init screen receiver here (this can't be declared in AndroidManifest - refer to:

View File

@ -27,11 +27,9 @@ public class GlobalSettings {
private static final String PREF_SECURITY_ACCEPTALLCERTIFICATES = "security.accept_certificates"; private static final String PREF_SECURITY_ACCEPTALLCERTIFICATES = "security.accept_certificates";
private static SharedPreferences settings; private static SharedPreferences settings;
public static Context initialContext;
public static void init(Context context) public static void init(Context context)
{ {
initialContext = context;
settings = PreferenceManager.getDefaultSharedPreferences(context); settings = PreferenceManager.getDefaultSharedPreferences(context);
initValues(); initValues();
} }

View File

@ -191,13 +191,13 @@ public class BookmarkBase implements Parcelable, Cloneable
this.height = Integer.valueOf(dimensions[1]); this.height = Integer.valueOf(dimensions[1]);
this.resolution = PREDEFINED; this.resolution = PREDEFINED;
} }
else if (resolution.equalsIgnoreCase(GlobalSettings.initialContext.getResources().getString(R.string.resolution_custom))) else if (resolution.equalsIgnoreCase("custom"))
{ {
this.width = width; this.width = width;
this.height = height; this.height = height;
this.resolution = CUSTOM; this.resolution = CUSTOM;
} }
else if (resolution.equalsIgnoreCase(GlobalSettings.initialContext.getResources().getString(R.string.resolution_fit))) else if (resolution.equalsIgnoreCase("fitscreen"))
{ {
this.width = this.height = 0; this.width = this.height = 0;
this.resolution = FITSCREEN; this.resolution = FITSCREEN;
@ -219,9 +219,7 @@ public class BookmarkBase implements Parcelable, Cloneable
if (isPredefined()) if (isPredefined())
return (width + "x" + height); return (width + "x" + height);
return (isFitScreen() ? GlobalSettings.initialContext.getResources().getString(R.string.resolution_fit) : return (isFitScreen() ? "fitscreen" : isAutomatic() ? "automatic" : "custom");
isAutomatic() ? GlobalSettings.initialContext.getResources().getString(R.string.resolution_automatic) :
GlobalSettings.initialContext.getResources().getString(R.string.resolution_custom));
} }
public boolean isPredefined() { public boolean isPredefined() {