From 495e090ba51c21188cb9ecd2e5aab4d9705eacff Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 23 Sep 2021 22:25:13 +0200 Subject: [PATCH] Added doze info button --- FAQ.md | 15 +++++++++++++++ .../java/eu/faircode/email/FragmentSetup.java | 9 +++++++++ app/src/main/res/layout/fragment_setup.xml | 13 ++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 0f4a94b95c..32e012165d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -313,6 +313,7 @@ Fonts, sizes, colors, etc should be material design whenever possible. * [(172) How can I import contacts?](#user-content-faq172) * [(173) What is the difference between Play store / GitHub / F-Droid version?](#user-content-faq173) * [(174) Is auto discovery supported?](#user-content-faq174) +* [(175) Why should battery optimizations be disabled?](#user-content-faq175) [I have another question.](#user-content-get-support) @@ -3922,6 +3923,20 @@ There is no auto discovery for POP3.
+ +**(175) Why should battery optimizations be disabled?** + +If battery optimizations ([Doze mode](https://developer.android.com/training/monitoring-device-state/doze-standby)) are enabled, +Android might stop the app, which will result in not sending and receiving messages anymore. + +It shouldn't be necessary to disable battery optimizations for Android version 11 or earlier, +but unfortunately modifications by manufacturers often [require it anyway](https://dontkillmyapp.com/). + +For Android 12 or later, battery optimizations need to be disabled to receive push messages +due to [strict foreground restrictions](https://developer.android.com/about/versions/12/foreground-services). +If battery optimizations are enabled, the app will periodically check for messages. + +

Get support

diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index a3a9128e13..30a3f65056 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -94,6 +94,7 @@ public class FragmentSetup extends FragmentBase { private TextView tvDozeDone; private Button btnDoze; private TextView tvDoze12; + private ImageButton ibDoze; private Button btnInexactAlarms; private Button btnBackgroundRestricted; @@ -160,6 +161,7 @@ public class FragmentSetup extends FragmentBase { tvDozeDone = view.findViewById(R.id.tvDozeDone); btnDoze = view.findViewById(R.id.btnDoze); tvDoze12 = view.findViewById(R.id.tvDoze12); + ibDoze = view.findViewById(R.id.ibDoze); btnInexactAlarms = view.findViewById(R.id.btnInexactAlarms); btnBackgroundRestricted = view.findViewById(R.id.btnBackgroundRestricted); @@ -448,6 +450,13 @@ public class FragmentSetup extends FragmentBase { } }); + ibDoze.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Helper.viewFAQ(v.getContext(), 175, true); + } + }); + tvStamina.setPaintFlags(tvStamina.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); tvStamina.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/layout/fragment_setup.xml b/app/src/main/res/layout/fragment_setup.xml index 09fbf4bb73..43f16288e3 100644 --- a/app/src/main/res/layout/fragment_setup.xml +++ b/app/src/main/res/layout/fragment_setup.xml @@ -715,6 +715,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvDozeHint" /> + + + app:layout_constraintTop_toBottomOf="@id/ibDoze" />