1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-31 20:25:38 +00:00

Added 5 minute poll

This commit is contained in:
M66B 2021-10-08 19:27:27 +02:00
parent 5e7ddaec49
commit d21aa8540f
3 changed files with 22 additions and 1 deletions

View file

@ -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);

View file

@ -164,6 +164,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOptimizeHint" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvPollBattery"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_poll_battery"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spPollInterval" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvPollHint"
android:layout_width="0dp"
@ -175,7 +189,7 @@
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spPollInterval" />
app:layout_constraintTop_toBottomOf="@id/tvPollBattery" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvExempted"

View file

@ -672,6 +672,7 @@
<string name="title_advanced_files" translatable="false">Files &gt;%1$s</string>
<string name="title_advanced_manual_hint">If receiving messages is disabled, it is still possible to manually receive messages by pulling down the message list</string>
<string name="title_advanced_poll_battery">This can cause high battery usage!</string>
<string name="title_advanced_poll_hint">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.</string>
<string name="title_advanced_optimize_hint">This might change the sync frequency to save battery usage depending on the capabilities and behavior of the email servers</string>
<string name="title_advanced_schedule_hint">Tap on a time to set a time</string>
@ -1780,6 +1781,7 @@
<string-array name="pollIntervalNames">
<item>Always</item>
<item>Every 5 minutes</item>
<item>Every 15 minutes</item>
<item>Every 30 minutes</item>
<item>Every hour</item>
@ -1791,6 +1793,7 @@
<integer-array name="pollIntervalValues" translatable="false">
<item>0</item>
<item>5</item>
<item>15</item>
<item>30</item>
<item>60</item>