From 2e9275c7bddb21e9315817c3db700837ab74d22c Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 23 Apr 2022 14:09:58 +0200 Subject: [PATCH] Added hint text --- .../email/FragmentOptionsSynchronize.java | 12 ++++++++++++ app/src/main/java/eu/faircode/email/Log.java | 3 +++ .../res/layout/fragment_options_synchronize.xml | 15 +++++++++++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 31 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index 83dc0c826c..fb265ddd59 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -22,6 +22,7 @@ package eu.faircode.email; import android.app.Dialog; import android.app.TimePickerDialog; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; @@ -48,6 +49,7 @@ import androidx.fragment.app.DialogFragment; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.Observer; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.LinearLayoutManager; @@ -72,6 +74,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr private TextView tvScheduleStart; private TextView tvScheduleEnd; private CheckBox[] cbDay; + private TextView tvScheduleIgnore; private ImageButton ibSchedules; private SwitchCompat swQuickSyncImap; @@ -146,6 +149,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr view.findViewById(R.id.cbDay5), view.findViewById(R.id.cbDay6) }; + tvScheduleIgnore = view.findViewById(R.id.tvScheduleIgnore); ibSchedules = view.findViewById(R.id.ibSchedules); swQuickSyncImap = view.findViewById(R.id.swQuickSyncImap); @@ -278,6 +282,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr }); } + tvScheduleIgnore.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext()); + lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_VIEW_ACCOUNTS)); + } + }); + ibSchedules.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 7fc7645ce9..848c19b615 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2128,10 +2128,12 @@ public class Log { } boolean unmetered = false; + boolean ignore_schedule = false; try { if (account.conditions != null) { JSONObject jconditions = new JSONObject(account.conditions); unmetered = jconditions.optBoolean("unmetered"); + ignore_schedule = jconditions.optBoolean("ignore_schedule"); } } catch (Throwable ignored) { } @@ -2145,6 +2147,7 @@ public class Log { " ondemand=" + account.ondemand + " msgs=" + content + "/" + messages + " ops=" + db.operation().getOperationCount(account.id) + + " ischedule=" + ignore_schedule + (ignore_schedule ? " !!!" : "") + " unmetered=" + unmetered + (unmetered ? " !!!" : "") + " " + account.state + (account.last_connected == null ? "" : " " + dtf.format(account.last_connected)) + diff --git a/app/src/main/res/layout/fragment_options_synchronize.xml b/app/src/main/res/layout/fragment_options_synchronize.xml index c9eec23775..c97073dce5 100644 --- a/app/src/main/res/layout/fragment_options_synchronize.xml +++ b/app/src/main/res/layout/fragment_options_synchronize.xml @@ -337,6 +337,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbDay5" /> + + 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 + Schedules can be disabled in the advanced account settings This reduces data usage, but new messages might be missed if the email server doesn\'t follow the standards Some providers store messages with an unknown, invalid or future date as messages without date Some providers don\'t support this properly, which may cause synchronizing none or all messages