From d21aa8540f403440c54c69d9f7e01858c2cbc3cc Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 8 Oct 2021 19:27:27 +0200 Subject: [PATCH] Added 5 minute poll --- .../email/FragmentOptionsSynchronize.java | 4 ++++ .../res/layout/fragment_options_synchronize.xml | 16 +++++++++++++++- app/src/main/res/values/strings.xml | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index 9b41af1c21..5442f85d95 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -65,6 +65,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr private SwitchCompat swOptimize; private ImageButton ibOptimizeInfo; private Spinner spPollInterval; + private TextView tvPollBattery; private RecyclerView rvExempted; private SwitchCompat swSchedule; private TextView tvSchedulePro; @@ -120,6 +121,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr swOptimize = view.findViewById(R.id.swOptimize); ibOptimizeInfo = view.findViewById(R.id.ibOptimizeInfo); spPollInterval = view.findViewById(R.id.spPollInterval); + tvPollBattery = view.findViewById(R.id.tvPollBattery); swSchedule = view.findViewById(R.id.swSchedule); rvExempted = view.findViewById(R.id.rvExempted); @@ -197,6 +199,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr if (value != current) { adapterView.setTag(value); prefs.edit().putInt("poll_interval", value).apply(); + tvPollBattery.setVisibility(value < 15 ? View.VISIBLE : View.GONE); grpExempted.setVisibility(value == 0 ? View.GONE : View.VISIBLE); } } @@ -458,6 +461,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr break; } + tvPollBattery.setVisibility(pollInterval < 15 ? View.VISIBLE : View.GONE); grpExempted.setVisibility(pollInterval == 0 ? View.GONE : View.VISIBLE); swSchedule.setChecked(prefs.getBoolean("schedule", false) && pro); diff --git a/app/src/main/res/layout/fragment_options_synchronize.xml b/app/src/main/res/layout/fragment_options_synchronize.xml index 465ab5e8ee..d1af959912 100644 --- a/app/src/main/res/layout/fragment_options_synchronize.xml +++ b/app/src/main/res/layout/fragment_options_synchronize.xml @@ -164,6 +164,20 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvOptimizeHint" /> + + + app:layout_constraintTop_toBottomOf="@id/tvPollBattery" /> Files >%1$s If receiving messages is disabled, it is still possible to manually receive messages by pulling down the message list + This can cause high battery usage! Periodically checking for new messages will compare local and remote messages every time, which is an expensive operation that may result in extra battery usage, especially if there are a lot of messages. Always receive will prevent this by continuously following changes. This might change the sync frequency to save battery usage depending on the capabilities and behavior of the email servers Tap on a time to set a time @@ -1780,6 +1781,7 @@ Always + Every 5 minutes Every 15 minutes Every 30 minutes Every hour @@ -1791,6 +1793,7 @@ 0 + 5 15 30 60