Loading src/com/android/settings/CustomListPreference.java +22 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.os.Bundle; import android.support.v14.preference.ListPreferenceDialogFragment; import android.support.v7.preference.ListPreference; import android.util.AttributeSet; import android.view.View; public class CustomListPreference extends ListPreference { Loading @@ -51,8 +50,14 @@ public class CustomListPreference extends ListPreference { return true; } protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) { } public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment { private static final java.lang.String KEY_CLICKED_ENTRY_INDEX = "settings.CustomListPrefDialog.KEY_CLICKED_ENTRY_INDEX"; private int mClickedDialogEntryIndex; public static ListPreferenceDialogFragment newInstance(String key) { Loading Loading @@ -88,10 +93,26 @@ public class CustomListPreference extends ListPreference { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); if (savedInstanceState != null) { mClickedDialogEntryIndex = savedInstanceState.getInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex); } getCustomizablePreference().onDialogCreated(dialog); return dialog; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getCustomizablePreference().onDialogStateRestored(getDialog(), savedInstanceState); } protected DialogInterface.OnClickListener getOnItemClickListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Loading src/com/android/settings/notification/NotificationLockscreenPreference.java +12 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; Loading @@ -37,7 +38,6 @@ import android.widget.ListView; public class NotificationLockscreenPreference extends RestrictedListPreference { private boolean mAllowRemoteInput; private int mInitialIndex; private Listener mListener; private boolean mShowRemoteInput; private boolean mRemoteInputCheckBoxEnabled = true; Loading Loading @@ -69,10 +69,8 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { protected void onPrepareDialogBuilder(AlertDialog.Builder builder, DialogInterface.OnClickListener innerListener) { final String selectedValue = getValue(); mInitialIndex = (selectedValue == null) ? -1 : findIndexOfValue(selectedValue); mListener = new Listener(innerListener); builder.setSingleChoiceItems(createListAdapter(), mInitialIndex, mListener); builder.setSingleChoiceItems(createListAdapter(), getSelectedValuePos(), mListener); mShowRemoteInput = getEntryValues().length == 3; mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0; Loading @@ -86,8 +84,17 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { CheckBox view = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input); view.setChecked(!mAllowRemoteInput); view.setOnCheckedChangeListener(mListener); } @Override protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) { super.onDialogStateRestored(dialog, savedInstanceState); ListView listView = ((AlertDialog) dialog).getListView(); int selectedPosition = listView.getCheckedItemPosition(); View panel = dialog.findViewById(com.android.internal.R.id.customPanel); panel.setVisibility(checkboxVisibilityForSelectedIndex(mInitialIndex, mShowRemoteInput)); panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition, mShowRemoteInput)); mListener.setView(panel); } Loading Loading
src/com/android/settings/CustomListPreference.java +22 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.os.Bundle; import android.support.v14.preference.ListPreferenceDialogFragment; import android.support.v7.preference.ListPreference; import android.util.AttributeSet; import android.view.View; public class CustomListPreference extends ListPreference { Loading @@ -51,8 +50,14 @@ public class CustomListPreference extends ListPreference { return true; } protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) { } public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment { private static final java.lang.String KEY_CLICKED_ENTRY_INDEX = "settings.CustomListPrefDialog.KEY_CLICKED_ENTRY_INDEX"; private int mClickedDialogEntryIndex; public static ListPreferenceDialogFragment newInstance(String key) { Loading Loading @@ -88,10 +93,26 @@ public class CustomListPreference extends ListPreference { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); if (savedInstanceState != null) { mClickedDialogEntryIndex = savedInstanceState.getInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex); } getCustomizablePreference().onDialogCreated(dialog); return dialog; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getCustomizablePreference().onDialogStateRestored(getDialog(), savedInstanceState); } protected DialogInterface.OnClickListener getOnItemClickListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Loading
src/com/android/settings/notification/NotificationLockscreenPreference.java +12 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; Loading @@ -37,7 +38,6 @@ import android.widget.ListView; public class NotificationLockscreenPreference extends RestrictedListPreference { private boolean mAllowRemoteInput; private int mInitialIndex; private Listener mListener; private boolean mShowRemoteInput; private boolean mRemoteInputCheckBoxEnabled = true; Loading Loading @@ -69,10 +69,8 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { protected void onPrepareDialogBuilder(AlertDialog.Builder builder, DialogInterface.OnClickListener innerListener) { final String selectedValue = getValue(); mInitialIndex = (selectedValue == null) ? -1 : findIndexOfValue(selectedValue); mListener = new Listener(innerListener); builder.setSingleChoiceItems(createListAdapter(), mInitialIndex, mListener); builder.setSingleChoiceItems(createListAdapter(), getSelectedValuePos(), mListener); mShowRemoteInput = getEntryValues().length == 3; mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(), Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0; Loading @@ -86,8 +84,17 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { CheckBox view = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input); view.setChecked(!mAllowRemoteInput); view.setOnCheckedChangeListener(mListener); } @Override protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) { super.onDialogStateRestored(dialog, savedInstanceState); ListView listView = ((AlertDialog) dialog).getListView(); int selectedPosition = listView.getCheckedItemPosition(); View panel = dialog.findViewById(com.android.internal.R.id.customPanel); panel.setVisibility(checkboxVisibilityForSelectedIndex(mInitialIndex, mShowRemoteInput)); panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition, mShowRemoteInput)); mListener.setView(panel); } Loading