use one prefs instance
This commit is contained in:
parent
2ce9ea92f1
commit
c0f7d754dd
|
@ -86,6 +86,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
//should move this up with all the other class variables
|
//should move this up with all the other class variables
|
||||||
private boolean mIsBound = false;
|
private boolean mIsBound = false;
|
||||||
|
|
||||||
|
private SharedPreferences mPrefs = null;
|
||||||
|
|
||||||
private boolean autoStartFromIntent = false;
|
private boolean autoStartFromIntent = false;
|
||||||
|
|
||||||
|
@ -93,8 +94,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
TorServiceUtils.getSharedPrefs(getApplicationContext()).registerOnSharedPreferenceChangeListener(this);
|
mPrefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
setLocale();
|
setLocale();
|
||||||
|
|
||||||
|
@ -490,7 +491,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
private void enableHiddenServicePort (int hsPort)
|
private void enableHiddenServicePort (int hsPort)
|
||||||
{
|
{
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
|
|
||||||
Editor pEdit = mPrefs.edit();
|
Editor pEdit = mPrefs.edit();
|
||||||
|
|
||||||
|
@ -609,7 +609,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
newBridgeValue = URLDecoder.decode(newBridgeValue); //decode the value here
|
newBridgeValue = URLDecoder.decode(newBridgeValue); //decode the value here
|
||||||
|
|
||||||
showAlert("Bridges Updated","Restart Orbot to use this bridge: " + newBridgeValue,false);
|
showAlert("Bridges Updated","Restart Orbot to use this bridge: " + newBridgeValue,false);
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
|
|
||||||
String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
|
String bridges = mPrefs.getString(TorConstants.PREF_BRIDGES_LIST, null);
|
||||||
|
|
||||||
|
@ -635,8 +634,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
showWizard = mPrefs.getBoolean("show_wizard",showWizard);
|
showWizard = mPrefs.getBoolean("show_wizard",showWizard);
|
||||||
|
|
||||||
if (showWizard)
|
if (showWizard)
|
||||||
|
@ -683,7 +680,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
*/
|
*/
|
||||||
private void openBrowser(final String browserLaunchUrl)
|
private void openBrowser(final String browserLaunchUrl)
|
||||||
{
|
{
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
boolean isOrwebInstalled = appInstalledOrNot("info.guardianproject.browser");
|
boolean isOrwebInstalled = appInstalledOrNot("info.guardianproject.browser");
|
||||||
boolean isTransProxy = mPrefs.getBoolean("pref_transparent", false);
|
boolean isTransProxy = mPrefs.getBoolean("pref_transparent", false);
|
||||||
|
|
||||||
|
@ -904,7 +900,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
appendLogTextAndScroll(mTorServiceMsg);
|
appendLogTextAndScroll(mTorServiceMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
|
boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
|
||||||
|
|
||||||
if (showFirstTime)
|
if (showFirstTime)
|
||||||
|
@ -1282,7 +1277,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
|
|
||||||
Configuration config = getResources().getConfiguration();
|
Configuration config = getResources().getConfiguration();
|
||||||
SharedPreferences mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
String lang = mPrefs.getString(PREF_DEFAULT_LOCALE, "");
|
String lang = mPrefs.getString(PREF_DEFAULT_LOCALE, "");
|
||||||
|
|
||||||
if (! "".equals(lang) && ! config.locale.getLanguage().equals(lang))
|
if (! "".equals(lang) && ! config.locale.getLanguage().equals(lang))
|
||||||
|
|
Loading…
Reference in New Issue