Change dialog text styles

Fixes: 126890487
Test: visual
Change-Id: I21b4264fd6b5c7f5fb79c3669bae366513c1ec65
This commit is contained in:
Raff Tsai
2019-03-05 12:07:50 +08:00
parent 0fa2651d3f
commit 953e39004f
4 changed files with 14 additions and 12 deletions

View File

@@ -303,6 +303,11 @@
<item name="android:textSize">16sp</item> <item name="android:textSize">16sp</item>
</style> </style>
<style name="TextAppearance.DialogMessage"
parent="@*android:style/TextAppearance.DeviceDefault.Body1">
<item name="android:textSize">16sp</item>
</style>
<style name="SuggestionCardText"> <style name="SuggestionCardText">
<item name="android:textAlignment">viewStart</item> <item name="android:textAlignment">viewStart</item>
</style> </style>

View File

@@ -128,8 +128,11 @@
<!-- Redefine the ActionBar style for contentInsetStart --> <!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Widget.ActionBar</item> <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
<!-- copied from Theme.DeviceDefault.Light.Dialog.Alert --> <!-- copied from Theme.DeviceDefault.Dialog.Alert -->
<item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item> <item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
<item name="android:windowTitleStyle">@*android:style/DialogWindowTitle.DeviceDefault</item>
<item name="android:textAppearanceMedium">@style/TextAppearance.DialogMessage</item>
<item name="buttonBarButtonStyle">@*android:style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
</style> </style>
<style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings"> <style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings">

View File

@@ -157,8 +157,8 @@ public class RestrictedListPreference extends CustomListPreference {
return null; return null;
} }
protected ListAdapter createListAdapter() { protected ListAdapter createListAdapter(Context context) {
return new RestrictedArrayAdapter(getContext(), getEntries(), return new RestrictedArrayAdapter(context, getEntries(),
getSelectedValuePos()); getSelectedValuePos());
} }
@@ -172,10 +172,9 @@ public class RestrictedListPreference extends CustomListPreference {
@Override @Override
protected void onPrepareDialogBuilder(Builder builder, protected void onPrepareDialogBuilder(Builder builder,
DialogInterface.OnClickListener listener) { DialogInterface.OnClickListener listener) {
builder.setAdapter(createListAdapter(), listener); builder.setAdapter(createListAdapter(builder.getContext()), listener);
} }
public class RestrictedArrayAdapter extends ArrayAdapter<CharSequence> { public class RestrictedArrayAdapter extends ArrayAdapter<CharSequence> {
private final int mSelectedIndex; private final int mSelectedIndex;
public RestrictedArrayAdapter(Context context, CharSequence[] objects, int selectedIndex) { public RestrictedArrayAdapter(Context context, CharSequence[] objects, int selectedIndex) {

View File

@@ -27,7 +27,6 @@ import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ListAdapter;
import android.widget.ListView; import android.widget.ListView;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@@ -78,7 +77,8 @@ public class NotificationLockscreenPreference extends RestrictedListPreference {
DialogInterface.OnClickListener innerListener) { DialogInterface.OnClickListener innerListener) {
mListener = new Listener(innerListener); mListener = new Listener(innerListener);
builder.setSingleChoiceItems(createListAdapter(), getSelectedValuePos(), mListener); builder.setSingleChoiceItems(createListAdapter(builder.getContext()), getSelectedValuePos(),
mListener);
mShowRemoteInput = getEntryValues().length == 3; mShowRemoteInput = getEntryValues().length == 3;
mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(), mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0; Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0;
@@ -116,11 +116,6 @@ public class NotificationLockscreenPreference extends RestrictedListPreference {
mListener.setView(panel); mListener.setView(panel);
} }
@Override
protected ListAdapter createListAdapter() {
return new RestrictedArrayAdapter(getContext(), getEntries(), -1);
}
@Override @Override
protected void onDialogClosed(boolean positiveResult) { protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult); super.onDialogClosed(positiveResult);