sm6150-common: parts: 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
This commit is contained in:
parent
816fb961ad
commit
3c6513473a
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The CyanogenMod Project
|
* Copyright (C) 2015 The CyanogenMod Project
|
||||||
* 2017-2019 The LineageOS Project
|
* 2017-2023 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -178,28 +178,20 @@ public class DozeSettingsFragment extends PreferenceFragment
|
|||||||
mPocketPreference.setEnabled(isChecked);
|
mPocketPreference.setEnabled(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HelpDialogFragment extends DialogFragment {
|
private void showHelp() {
|
||||||
@Override
|
AlertDialog helpDialog = new AlertDialog.Builder(getActivity())
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
return new AlertDialog.Builder(getActivity())
|
|
||||||
.setTitle(R.string.doze_settings_help_title)
|
.setTitle(R.string.doze_settings_help_title)
|
||||||
.setMessage(R.string.doze_settings_help_text)
|
.setMessage(R.string.doze_settings_help_text)
|
||||||
.setNegativeButton(R.string.dialog_ok, (dialog, which) -> dialog.cancel())
|
.setPositiveButton(R.string.dialog_ok,
|
||||||
.create();
|
(dialog, which) -> {
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
getActivity()
|
getActivity()
|
||||||
.getSharedPreferences("doze_settings", Activity.MODE_PRIVATE)
|
.getSharedPreferences("doze_settings", Activity.MODE_PRIVATE)
|
||||||
.edit()
|
.edit()
|
||||||
.putBoolean("first_help_shown", true)
|
.putBoolean("first_help_shown", true)
|
||||||
.commit();
|
.commit();
|
||||||
}
|
dialog.cancel();
|
||||||
}
|
})
|
||||||
|
.create();
|
||||||
private void showHelp() {
|
helpDialog.show();
|
||||||
HelpDialogFragment fragment = new HelpDialogFragment();
|
|
||||||
fragment.show(getFragmentManager(), "help_dialog");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user