diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 5c8a03c346..c2d416c62e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -93,7 +93,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "reply_hint", "html_always_images", "print_html_confirmed", "selected_folders", "move_1_confirmed", "move_n_confirmed", "identities_asked", "cc_bcc", "inline_image_hint", "compose_reference", "send_dialog", - "setup_advanced" + "setup_reminder", "setup_advanced" }; @Override diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index ede89fb1a9..a4e09bfb22 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -42,6 +42,8 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; @@ -456,9 +458,14 @@ public class FragmentSetup extends FragmentBase { } private void onExit() { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + boolean setup_reminder = prefs.getBoolean("setup_reminder", true); + boolean hasPermissions = hasPermission(Manifest.permission.READ_CONTACTS); Boolean isIgnoring = Helper.isIgnoringOptimizations(getContext()); - if (hasPermissions && (isIgnoring == null || isIgnoring)) + + if (!setup_reminder || + (hasPermissions && (isIgnoring == null || isIgnoring))) ((FragmentBase) getParentFragment()).finish(); else { FragmentDialogStill fragment = new FragmentDialogStill(); @@ -543,9 +550,18 @@ public class FragmentSetup extends FragmentBase { @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_setup, null); + CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain); Group grp3 = dview.findViewById(R.id.grp3); Group grp4 = dview.findViewById(R.id.grp4); + cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + prefs.edit().putBoolean("setup_reminder", !isChecked).apply(); + } + }); + boolean hasPermissions = Helper.hasPermission(getContext(), Manifest.permission.READ_CONTACTS); Boolean isIgnoring = Helper.isIgnoringOptimizations(getContext()); diff --git a/app/src/main/res/layout/dialog_setup.xml b/app/src/main/res/layout/dialog_setup.xml index 5c91a981b0..b620fb26a9 100644 --- a/app/src/main/res/layout/dialog_setup.xml +++ b/app/src/main/res/layout/dialog_setup.xml @@ -68,6 +68,16 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/four" /> + +