Simplification

This commit is contained in:
M66B 2024-02-09 15:59:18 +01:00
parent 77ab2c0450
commit 5c23de7edc
4 changed files with 16 additions and 49 deletions

View File

@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### Next version ### Next version
* Added barcode decoding (requires Android 7+) * Added image barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated [Public Suffix List](https://github.com/publicsuffix/list) * Updated [Public Suffix List](https://github.com/publicsuffix/list)
* Updated [translations](https://crowdin.com/project/open-source-email) * Updated [translations](https://crowdin.com/project/open-source-email)

View File

@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### Next version ### Next version
* Added barcode decoding (requires Android 7+) * Added image barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated [Public Suffix List](https://github.com/publicsuffix/list) * Updated [Public Suffix List](https://github.com/publicsuffix/list)
* Updated [translations](https://crowdin.com/project/open-source-email) * Updated [translations](https://crowdin.com/project/open-source-email)

View File

@ -5410,57 +5410,24 @@ public class FragmentMessages extends FragmentBase
if (canNotify) if (canNotify)
prefs.edit().remove("notifications_reminder").apply(); prefs.edit().remove("notifications_reminder").apply();
boolean notifications_reminder = prefs.getBoolean("notifications_reminder", true); boolean notifications_reminder = prefs.getBoolean("notifications_reminder", true);
grpNotifications.setVisibility(canNotify || !notifications_reminder ? View.GONE : View.VISIBLE); grpNotifications.setVisibility(
!canNotify && notifications_reminder
? View.VISIBLE : View.GONE);
} }
if (grpDataSaver != null && if (grpDataSaver != null &&
("enabled".equals(key) || "datasaver_reminder".equals(key))) ("enabled".equals(key) || "datasaver_reminder".equals(key))) {
new SimpleTask<Boolean>() {
@Override
protected Boolean onExecute(Context context, Bundle args) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean isDataSaving = ConnectionHelper.isDataSaving(getContext()); boolean isDataSaving = ConnectionHelper.isDataSaving(getContext());
if (!isDataSaving) { if (!isDataSaving)
prefs.edit().putBoolean("datasaver_reminder", true).apply(); prefs.edit().remove("datasaver_reminder").apply();
return false;
}
boolean enabled = prefs.getBoolean("enabled", true); boolean enabled = prefs.getBoolean("enabled", true);
boolean reminder = prefs.getBoolean("datasaver_reminder", true); boolean datasaver_reminder = prefs.getBoolean("datasaver_reminder", true);
grpDataSaver.setVisibility(
if (!enabled || !reminder) isDataSaving && enabled && datasaver_reminder
return false; ? View.VISIBLE : View.GONE);
DB db = DB.getInstance(context);
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(null);
if (accounts == null || accounts.size() == 0)
return false;
boolean ondemand = true;
for (EntityAccount account : accounts)
if (!account.ondemand) {
ondemand = false;
break;
} }
if (ondemand)
return false;
return true;
}
@Override
protected void onExecuted(Bundle args, Boolean show) {
grpDataSaver.setVisibility(Boolean.TRUE.equals(show) ? View.VISIBLE : View.GONE);
}
@Override
protected void onException(Bundle args, Throwable ex) {
grpDataSaver.setVisibility(View.GONE);
}
}.serial().execute(this, new Bundle(), "datasaver");
if (grpSupport != null && if (grpSupport != null &&
("pro".equals(key) || "banner_hidden".equals(key))) { ("pro".equals(key) || "banner_hidden".equals(key))) {
boolean pro = ActivityBilling.isPro(getContext()); boolean pro = ActivityBilling.isPro(getContext());

View File

@ -8,7 +8,7 @@ Ypupiara
Next version Next version
* Added barcode decoding (requires Android 7+) * Added image barcode decoding (requires Android 7+)
* Small improvements and minor bug fixes * Small improvements and minor bug fixes
* Updated Public Suffix List * Updated Public Suffix List
* Updated translations * Updated translations