am 662039c6: Merge "Update IME selection dialog layout for Material" into lmp-mr1-dev
* commit '662039c68768890d4f5a818067542be51e89255c': Update IME selection dialog layout for Material
This commit is contained in:
@@ -24,21 +24,26 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="9dip"
|
||||
android:layout_marginStart="20dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.android.internal.widget.DialogTitle
|
||||
android:id="@+id/alertTitle"
|
||||
style="@android:style/DialogWindowTitle.DeviceDefault"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/select_input_method" />
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical|start"
|
||||
android:paddingStart="?attr/dialogPreferredPadding"
|
||||
android:paddingEnd="?attr/dialogPreferredPadding"
|
||||
android:paddingTop="@dimen/dialog_padding_top_material">
|
||||
|
||||
<com.android.internal.widget.DialogTitle
|
||||
android:id="@+id/alertTitle"
|
||||
style="?attr/windowTitleStyle"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:text="@string/select_input_method" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Hard keyboard switch -->
|
||||
@@ -55,34 +60,34 @@
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="5dip"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="0dip"
|
||||
android:paddingTop="5dip" >
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingStart="?attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingTop="5dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/hardware"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem" />
|
||||
android:textAppearance="?attr/textAppearanceMedium"
|
||||
android:textColor="?attr/textColorAlertDialogListItem" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/show_ime"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem" />
|
||||
android:textAppearance="?attr/textAppearanceSmall"
|
||||
android:textColor="?attr/textColorAlertDialogListItem" />
|
||||
</LinearLayout>
|
||||
|
||||
<Switch
|
||||
@@ -90,12 +95,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="12dip" />
|
||||
android:layout_marginEnd="?attr/listPreferredItemPaddingEnd" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDividerAlertDialog" />
|
||||
android:background="?attr/listDividerAlertDialog" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -17,44 +17,38 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="12dip"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:background="@color/transparent">
|
||||
android:paddingStart="?attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio"
|
||||
android:layout_width="35dip"
|
||||
<RadioButton android:id="@+id/radio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="12dip"
|
||||
android:paddingEnd="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:clickable="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView android:id="@android:id/text1"
|
||||
<TextView android:id="@id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceListItem"
|
||||
android:textColor="?attr/textColorAlertDialogListItem"
|
||||
android:gravity="center_vertical|start"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee" />
|
||||
|
||||
<TextView android:id="@android:id/text2"
|
||||
<TextView android:id="@id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceListItemSecondary"
|
||||
android:textColor="?attr/textColorAlertDialogListItem"
|
||||
android:gravity="center_vertical|start"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee" />
|
||||
|
||||
|
||||
@@ -17,22 +17,22 @@
|
||||
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:minHeight="?attr/listPreferredItemHeight"
|
||||
android:mode="twoLine"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
android:paddingStart="?attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<TextView android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem" />
|
||||
<TextView android:id="@id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAppearance="?attr/textAppearanceListItem" />
|
||||
|
||||
<TextView android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/text1"
|
||||
android:layout_alignStart="@android:id/text1"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary" />
|
||||
<TextView android:id="@id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/text1"
|
||||
android:layout_alignStart="@id/text1"
|
||||
android:textAppearance="?attr/textAppearanceListItemSecondary" />
|
||||
|
||||
</TwoLineListItem>
|
||||
|
||||
@@ -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<ImeSubtypeListItem> 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
|
||||
|
||||
Reference in New Issue
Block a user