Batch update preferences

This commit is contained in:
M66B
2023-09-09 10:10:27 +02:00
parent 6568345e09
commit 65ca2958c9
11 changed files with 94 additions and 10 deletions

View File

@@ -285,6 +285,15 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
"cloud_activated".equals(key) ||
"cloud_busy".equals(key) ||
"cloud_last_sync".equals(key)) {
getMainHandler().removeCallbacks(update);
getMainHandler().postDelayed(update, FragmentOptions.DELAY_SETOPTIONS);
}
}
private Runnable update = new RunnableEx("backup") {
@Override
protected void delegate() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String user = prefs.getString("cloud_user", null);
String password = prefs.getString("cloud_password", null);
boolean auth = !(TextUtils.isEmpty(user) || TextUtils.isEmpty(password));
@@ -301,8 +310,9 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
grpLogin.setVisibility(auth ? View.GONE : View.VISIBLE);
grpActivate.setVisibility(auth && !activated && !busy ? View.VISIBLE : View.GONE);
grpLogout.setVisibility(auth ? View.VISIBLE : View.GONE);
}
}
};
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {