only force index update when the locale actually changes
This was forcing an index update on any config change, even just a simple screen rotation. Now it actually checks whether its needed. closes #1325
This commit is contained in:
parent
30b00156db
commit
5c2e9305a8
@ -285,8 +285,22 @@ public class FDroidApp extends Application {
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
Languages.setLanguage(this);
|
||||
|
||||
// update the descriptions based on the new language preferences
|
||||
SharedPreferences atStartTime = getAtStartTimeSharedPreferences();
|
||||
final String lastLocaleKey = "lastLocale";
|
||||
String lastLocale = atStartTime.getString(lastLocaleKey, null);
|
||||
String currentLocale;
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
currentLocale = newConfig.locale.toString();
|
||||
} else {
|
||||
currentLocale = newConfig.getLocales().toString();
|
||||
}
|
||||
if (!TextUtils.equals(lastLocale, currentLocale)) {
|
||||
UpdateService.forceUpdateRepo(this);
|
||||
}
|
||||
atStartTime.edit().putString(lastLocaleKey, currentLocale).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@ -435,7 +449,7 @@ public class FDroidApp extends Application {
|
||||
Provisioner.scanAndProcess(getApplicationContext());
|
||||
|
||||
// if the underlying OS version has changed, then fully rebuild the database
|
||||
SharedPreferences atStartTime = getSharedPreferences("at-start-time", Context.MODE_PRIVATE);
|
||||
SharedPreferences atStartTime = getAtStartTimeSharedPreferences();
|
||||
if (Build.VERSION.SDK_INT != atStartTime.getInt("build-version", Build.VERSION.SDK_INT)) {
|
||||
UpdateService.forceUpdateRepo(this);
|
||||
}
|
||||
@ -483,6 +497,10 @@ public class FDroidApp extends Application {
|
||||
return ((BluetoothManager) getSystemService(BLUETOOTH_SERVICE)).getAdapter();
|
||||
}
|
||||
|
||||
private SharedPreferences getAtStartTimeSharedPreferences() {
|
||||
return getSharedPreferences("at-start-time", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public void sendViaBluetooth(Activity activity, int resultCode, String packageName) {
|
||||
if (resultCode == Activity.RESULT_CANCELED) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user