Allow disabling setup reminder

This commit is contained in:
M66B
2020-04-07 08:28:44 +02:00
parent 62b1924033
commit f720ffe3ac
3 changed files with 28 additions and 2 deletions

View File

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

View File

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