diff --git a/core/res/res/layout/input_method_switch_dialog_title.xml b/core/res/res/layout/input_method_switch_dialog_title.xml index 37bceb6acc44a..856a7af5e8610 100644 --- a/core/res/res/layout/input_method_switch_dialog_title.xml +++ b/core/res/res/layout/input_method_switch_dialog_title.xml @@ -24,21 +24,26 @@ - - + + android:orientation="horizontal" + android:gravity="center_vertical|start" + android:paddingStart="?attr/dialogPreferredPadding" + android:paddingEnd="?attr/dialogPreferredPadding" + android:paddingTop="@dimen/dialog_padding_top_material"> + + + @@ -55,34 +60,34 @@ android:orientation="horizontal" > + android:paddingBottom="5dp" + android:paddingStart="?attr/listPreferredItemPaddingStart" + android:paddingEnd="0dp" + android:paddingTop="5dp" > + android:textAppearance="?attr/textAppearanceMedium" + android:textColor="?attr/textColorAlertDialogListItem" /> + android:textAppearance="?attr/textAppearanceSmall" + android:textColor="?attr/textColorAlertDialogListItem" /> + android:layout_marginEnd="?attr/listPreferredItemPaddingEnd" /> + android:background="?attr/listDividerAlertDialog" /> diff --git a/core/res/res/layout/input_method_switch_item.xml b/core/res/res/layout/input_method_switch_item.xml index cfa8b315be61c..6185ed6258007 100644 --- a/core/res/res/layout/input_method_switch_item.xml +++ b/core/res/res/layout/input_method_switch_item.xml @@ -17,44 +17,38 @@ + android:paddingStart="?attr/listPreferredItemPaddingStart" + android:paddingEnd="?attr/listPreferredItemPaddingEnd"> - - - diff --git a/core/res/res/layout/simple_list_item_2.xml b/core/res/res/layout/simple_list_item_2.xml index b47a34650bbde..bcbc6fc8e616b 100644 --- a/core/res/res/layout/simple_list_item_2.xml +++ b/core/res/res/layout/simple_list_item_2.xml @@ -17,22 +17,22 @@ + android:paddingStart="?attr/listPreferredItemPaddingStart" + android:paddingEnd="?attr/listPreferredItemPaddingEnd"> - + - + diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index edea274c155f5..4d0868a4ed019 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -66,6 +66,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; +import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; import android.net.Uri; import android.os.Binder; @@ -2830,23 +2831,30 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - final Context themedContext = new ContextThemeWrapper(context, - android.R.style.Theme_DeviceDefault_Settings); - mDialogBuilder = new AlertDialog.Builder(themedContext); - final TypedArray a = themedContext.obtainStyledAttributes(null, - com.android.internal.R.styleable.DialogPreference, - com.android.internal.R.attr.alertDialogStyle, 0); - mDialogBuilder.setIcon(a.getDrawable( - com.android.internal.R.styleable.DialogPreference_dialogIcon)); - a.recycle(); + + final Context settingsContext = new ContextThemeWrapper(context, + com.android.internal.R.style.Theme_DeviceDefault_Settings); + + mDialogBuilder = new AlertDialog.Builder(settingsContext); mDialogBuilder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); } }); - final LayoutInflater inflater = - (LayoutInflater)themedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + final Context dialogContext = mDialogBuilder.getContext(); + final TypedArray a = dialogContext.obtainStyledAttributes(null, + com.android.internal.R.styleable.DialogPreference, + com.android.internal.R.attr.alertDialogStyle, 0); + final Drawable dialogIcon = a.getDrawable( + com.android.internal.R.styleable.DialogPreference_dialogIcon); + a.recycle(); + + mDialogBuilder.setIcon(dialogIcon); + + final LayoutInflater inflater = (LayoutInflater) dialogContext.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); final View tv = inflater.inflate( com.android.internal.R.layout.input_method_switch_dialog_title, null); mDialogBuilder.setCustomTitle(tv); @@ -2857,7 +2865,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub .findViewById(com.android.internal.R.id.hard_keyboard_section) .setVisibility(mWindowManagerService.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE); - final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( + final Switch hardKeySwitch = (Switch) mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch); hardKeySwitch.setChecked(mShowImeWithHardKeyboard); hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @@ -2870,7 +2878,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } }); - final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(themedContext, + final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(dialogContext, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem); final OnClickListener choiceListener = new OnClickListener() { @Override @@ -2926,10 +2934,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub public ImeSubtypeListAdapter(Context context, int textViewResourceId, List itemsList, int checkedItem) { super(context, textViewResourceId, itemsList); + mTextViewResourceId = textViewResourceId; mItemsList = itemsList; mCheckedItem = checkedItem; - mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override