From 5c23de7edc11b1baecf8c1e97e21d3f689a30a0d Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 9 Feb 2024 15:59:18 +0100 Subject: [PATCH] Simplification --- CHANGELOG.md | 2 +- app/src/main/assets/CHANGELOG.md | 2 +- .../eu/faircode/email/FragmentMessages.java | 59 ++++--------------- metadata/en-US/changelogs/2157.txt | 2 +- 4 files changed, 16 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de37a4cd0d..84082110a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product= ### Next version -* Added barcode decoding (requires Android 7+) +* Added image barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated [Public Suffix List](https://github.com/publicsuffix/list) * Updated [translations](https://crowdin.com/project/open-source-email) diff --git a/app/src/main/assets/CHANGELOG.md b/app/src/main/assets/CHANGELOG.md index de37a4cd0d..84082110a3 100644 --- a/app/src/main/assets/CHANGELOG.md +++ b/app/src/main/assets/CHANGELOG.md @@ -8,7 +8,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product= ### Next version -* Added barcode decoding (requires Android 7+) +* Added image barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated [Public Suffix List](https://github.com/publicsuffix/list) * Updated [translations](https://crowdin.com/project/open-source-email) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 6e0381980d..9549bdbd8a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -5410,56 +5410,23 @@ public class FragmentMessages extends FragmentBase if (canNotify) prefs.edit().remove("notifications_reminder").apply(); 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 && - ("enabled".equals(key) || "datasaver_reminder".equals(key))) - new SimpleTask() { - @Override - protected Boolean onExecute(Context context, Bundle args) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + ("enabled".equals(key) || "datasaver_reminder".equals(key))) { + boolean isDataSaving = ConnectionHelper.isDataSaving(getContext()); + if (!isDataSaving) + prefs.edit().remove("datasaver_reminder").apply(); - boolean isDataSaving = ConnectionHelper.isDataSaving(getContext()); - if (!isDataSaving) { - prefs.edit().putBoolean("datasaver_reminder", true).apply(); - return false; - } - - boolean enabled = prefs.getBoolean("enabled", true); - boolean reminder = prefs.getBoolean("datasaver_reminder", true); - - if (!enabled || !reminder) - return false; - - DB db = DB.getInstance(context); - List 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"); + boolean enabled = prefs.getBoolean("enabled", true); + boolean datasaver_reminder = prefs.getBoolean("datasaver_reminder", true); + grpDataSaver.setVisibility( + isDataSaving && enabled && datasaver_reminder + ? View.VISIBLE : View.GONE); + } if (grpSupport != null && ("pro".equals(key) || "banner_hidden".equals(key))) { diff --git a/metadata/en-US/changelogs/2157.txt b/metadata/en-US/changelogs/2157.txt index 59ccfb8123..8bcb9e72c7 100644 --- a/metadata/en-US/changelogs/2157.txt +++ b/metadata/en-US/changelogs/2157.txt @@ -8,7 +8,7 @@ Ypupiara Next version -* Added barcode decoding (requires Android 7+) +* Added image barcode decoding (requires Android 7+) * Small improvements and minor bug fixes * Updated Public Suffix List * Updated translations