updated locale handling to stop flashing

This commit is contained in:
n8fr8 2013-02-07 15:24:01 +07:00
parent e2bbe4cae6
commit 8023d16ce8
2 changed files with 16 additions and 8 deletions

View File

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android" package="org.torproject.android"
android:versionName="0.2.3.23-rc-1.0.11-RC6" android:versionName="0.2.3.25-1.0.12-alpha-1"
android:versionCode="52" android:versionCode="53"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="15"/> <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17"/>
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher" <application android:name=".OrbotApp" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="locale|orientation|screenSize" android:configChanges="locale|orientation|screenSize"
android:theme="@style/Theme.Sherlock" android:theme="@style/Theme.Sherlock"
> >
<activity android:name=".Orbot" android:configChanges="locale|orientation|screenSize"> <activity android:name=".Orbot" android:configChanges="orientation|screenSize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />

View File

@ -35,10 +35,14 @@ public class OrbotApp extends Application implements TorConstants
locale = new Locale(lang); locale = new Locale(lang);
Locale.setDefault(locale); Locale.setDefault(locale);
config.locale = locale;
getResources().updateConfiguration(config, getResources().getDisplayMetrics()); Configuration myConfig = new Configuration(config);
myConfig.locale = locale;
getResources().updateConfiguration(myConfig, getResources().getDisplayMetrics());
} }
} }
@Override @Override
@ -51,9 +55,12 @@ public class OrbotApp extends Application implements TorConstants
if (! "".equals(lang) && ! newConfig.locale.getLanguage().equals(lang)) if (! "".equals(lang) && ! newConfig.locale.getLanguage().equals(lang))
{ {
locale = new Locale(lang); locale = new Locale(lang);
newConfig.locale = locale;
Locale.setDefault(locale); Locale.setDefault(locale);
getResources().updateConfiguration(newConfig, getResources().getDisplayMetrics());
Configuration myConfig = new Configuration(newConfig);
myConfig.locale = locale;
getResources().updateConfiguration(myConfig, getResources().getDisplayMetrics());
} }
} }
} }