diff options
author | Arian <arian.kulmer@web.de> | 2023-11-07 14:58:06 +0100 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2024-12-19 09:32:12 +0530 |
commit | dbb8ab5411da1dadb38046a4a19c13231dd98978 (patch) | |
tree | 81df099148c1ddd9ec03dae6c25c95d6d55f4369 /doze/src | |
parent | 50e52112dace2dc2be7adcb5afc00901d62fbd5b (diff) |
msm8996-common: doze: Get rid of HelpDialogFragment class
As preparation to upgrade the sdk get rid of this private class.
Fragments must be a public static class to be properly recreated from instance state.
Also change the behaviour to only hide the dialog when confirmed instead of also when it is cancelled.
Change-Id: I171aa2345058edae7520c37942c3c11b3cdfdfdc
Diffstat (limited to 'doze/src')
-rw-r--r-- | doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java index 146e1ff..851d8ff 100644 --- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2015 The CyanogenMod Project - * 2017-2022 The LineageOS Project + * 2017-2023 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,27 +103,20 @@ public class DozeSettingsFragment extends PreferenceFragment implements mPocketPreference.setEnabled(isChecked); } - private static class HelpDialogFragment extends DialogFragment { - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - return new AlertDialog.Builder(getActivity()) - .setTitle(R.string.doze_settings_help_title) - .setMessage(R.string.doze_settings_help_text) - .setNegativeButton(R.string.dialog_ok, (dialog, which) -> dialog.cancel()) - .create(); - } - - @Override - public void onCancel(DialogInterface dialog) { - getActivity().getSharedPreferences("doze_settings", Activity.MODE_PRIVATE) - .edit() - .putBoolean("first_help_shown", true) - .commit(); - } - } - private void showHelp() { - HelpDialogFragment fragment = new HelpDialogFragment(); - fragment.show(getFragmentManager(), "help_dialog"); + AlertDialog helpDialog = new AlertDialog.Builder(getActivity()) + .setTitle(R.string.doze_settings_help_title) + .setMessage(R.string.doze_settings_help_text) + .setPositiveButton(R.string.dialog_ok, + (dialog, which) -> { + getActivity() + .getSharedPreferences("doze_settings", Activity.MODE_PRIVATE) + .edit() + .putBoolean("first_help_shown", true) + .commit(); + dialog.cancel(); + }) + .create(); + helpDialog.show(); } } |