Loading core/res/res/layout/input_method_switch_dialog_title.xml +7 −14 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" style="@android:style/DialogWindowTitle.Holo" style="@android:style/DialogWindowTitle.DeviceDefault" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="end" Loading @@ -49,11 +49,6 @@ android:layout_height="wrap_content" android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:color/holo_blue_light" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" Loading Loading @@ -97,12 +92,10 @@ android:layout_gravity="center_vertical" android:layout_marginEnd="12dip" /> </LinearLayout> </LinearLayout> <View android:id="@+id/titleDivider" android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:drawable/divider_horizontal_dark" /> android:layout_height="1dp" android:background="?android:attr/listDividerAlertDialog" /> </LinearLayout> </LinearLayout> core/res/res/layout/input_method_switch_item.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" android:paddingStart="16dip" android:paddingEnd="12dip" android:minHeight="?attr/listPreferredItemHeightSmall" android:background="@color/transparent"> <RadioButton android:id="@+id/radio" android:layout_width="35dip" android:layout_height="wrap_content" android:paddingEnd="12dip" android:gravity="center_vertical" android:focusable="false" android:clickable="false" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" android:gravity="center_vertical"> <TextView android:id="@android: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" 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" /> </LinearLayout> </LinearLayout> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1195,6 +1195,7 @@ <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method_extract_view" /> <java-symbol type="layout" name="input_method_switch_item" /> <java-symbol type="layout" name="input_method_switch_dialog_title" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="list_content_simple" /> Loading services/core/java/com/android/server/InputMethodManagerService.java +61 −61 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; Loading Loading @@ -91,6 +92,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.Xml; import android.view.ContextThemeWrapper; import android.view.IWindowManager; import android.view.InputChannel; import android.view.LayoutInflater; Loading Loading @@ -2728,6 +2730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); } private void showInputMethodMenuInternal(boolean showSubtypes) { if (DEBUG) Slog.v(TAG, "Show switching menu"); Loading Loading @@ -2778,39 +2781,39 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } final TypedArray a = context.obtainStyledAttributes(null, 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 = new AlertDialog.Builder(context) .setOnCancelListener(new OnCancelListener() { mDialogBuilder.setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogIcon)); a.recycle(); mDialogBuilder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); } }) .setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogTitle)); a.recycle(); }); final LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater)themedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View tv = inflater.inflate( com.android.internal.R.layout.input_method_switch_dialog_title, null); mDialogBuilder.setCustomTitle(tv); // Setup layout for a toggle switch of the hardware keyboard mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_section).setVisibility( mWindowManagerService.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = ((Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch)); mSwitchingDialogTitleView .findViewById(com.android.internal.R.id.hard_keyboard_section) .setVisibility(mWindowManagerService.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setOnCheckedChangeListener( new OnCheckedChangeListener() { hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mWindowManagerService.setHardKeyboardEnabled(isChecked); // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. Loading @@ -2818,44 +2821,41 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } }); final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(context, com.android.internal.R.layout.simple_list_item_2_single_choice, imList, checkedItem); mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, new AlertDialog.OnClickListener() { final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(themedContext, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem); final OnClickListener choiceListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { public void onClick(final DialogInterface dialog, final int which) { synchronized (mMethodMap) { if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds.length <= which) { if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds.length <= which) { return; } InputMethodInfo im = mIms[which]; final InputMethodInfo im = mIms[which]; int subtypeId = mSubtypeIds[which]; adapter.mCheckedItem = which; adapter.notifyDataSetChanged(); hideInputMethodMenu(); if (im != null) { if ((subtypeId < 0) || (subtypeId >= im.getSubtypeCount())) { if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) { subtypeId = NOT_A_SUBTYPE_ID; } setInputMethodLocked(im.getId(), subtypeId); } } } }); }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); if (showSubtypes && !isScreenLocked) { mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, new DialogInterface.OnClickListener() { final OnClickListener positiveListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { showConfigureInputMethods(); } }); }; mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, positiveListener); } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.setCanceledOnTouchOutside(true); Loading Loading
core/res/res/layout/input_method_switch_dialog_title.xml +7 −14 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" style="@android:style/DialogWindowTitle.Holo" style="@android:style/DialogWindowTitle.DeviceDefault" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="end" Loading @@ -49,11 +49,6 @@ android:layout_height="wrap_content" android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:color/holo_blue_light" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" Loading Loading @@ -97,12 +92,10 @@ android:layout_gravity="center_vertical" android:layout_marginEnd="12dip" /> </LinearLayout> </LinearLayout> <View android:id="@+id/titleDivider" android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:drawable/divider_horizontal_dark" /> android:layout_height="1dp" android:background="?android:attr/listDividerAlertDialog" /> </LinearLayout> </LinearLayout>
core/res/res/layout/input_method_switch_item.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" android:paddingStart="16dip" android:paddingEnd="12dip" android:minHeight="?attr/listPreferredItemHeightSmall" android:background="@color/transparent"> <RadioButton android:id="@+id/radio" android:layout_width="35dip" android:layout_height="wrap_content" android:paddingEnd="12dip" android:gravity="center_vertical" android:focusable="false" android:clickable="false" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" android:gravity="center_vertical"> <TextView android:id="@android: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" 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" /> </LinearLayout> </LinearLayout>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1195,6 +1195,7 @@ <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method_extract_view" /> <java-symbol type="layout" name="input_method_switch_item" /> <java-symbol type="layout" name="input_method_switch_dialog_title" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="list_content_simple" /> Loading
services/core/java/com/android/server/InputMethodManagerService.java +61 −61 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; Loading Loading @@ -91,6 +92,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Slog; import android.util.Xml; import android.view.ContextThemeWrapper; import android.view.IWindowManager; import android.view.InputChannel; import android.view.LayoutInflater; Loading Loading @@ -2728,6 +2730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); } private void showInputMethodMenuInternal(boolean showSubtypes) { if (DEBUG) Slog.v(TAG, "Show switching menu"); Loading Loading @@ -2778,39 +2781,39 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } final TypedArray a = context.obtainStyledAttributes(null, 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 = new AlertDialog.Builder(context) .setOnCancelListener(new OnCancelListener() { mDialogBuilder.setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogIcon)); a.recycle(); mDialogBuilder.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); } }) .setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogTitle)); a.recycle(); }); final LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater)themedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View tv = inflater.inflate( com.android.internal.R.layout.input_method_switch_dialog_title, null); mDialogBuilder.setCustomTitle(tv); // Setup layout for a toggle switch of the hardware keyboard mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_section).setVisibility( mWindowManagerService.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = ((Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch)); mSwitchingDialogTitleView .findViewById(com.android.internal.R.id.hard_keyboard_section) .setVisibility(mWindowManagerService.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setOnCheckedChangeListener( new OnCheckedChangeListener() { hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged( CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mWindowManagerService.setHardKeyboardEnabled(isChecked); // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. Loading @@ -2818,44 +2821,41 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } }); final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(context, com.android.internal.R.layout.simple_list_item_2_single_choice, imList, checkedItem); mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, new AlertDialog.OnClickListener() { final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(themedContext, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem); final OnClickListener choiceListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { public void onClick(final DialogInterface dialog, final int which) { synchronized (mMethodMap) { if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds.length <= which) { if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds.length <= which) { return; } InputMethodInfo im = mIms[which]; final InputMethodInfo im = mIms[which]; int subtypeId = mSubtypeIds[which]; adapter.mCheckedItem = which; adapter.notifyDataSetChanged(); hideInputMethodMenu(); if (im != null) { if ((subtypeId < 0) || (subtypeId >= im.getSubtypeCount())) { if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) { subtypeId = NOT_A_SUBTYPE_ID; } setInputMethodLocked(im.getId(), subtypeId); } } } }); }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); if (showSubtypes && !isScreenLocked) { mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, new DialogInterface.OnClickListener() { final OnClickListener positiveListener = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { showConfigureInputMethods(); } }); }; mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, positiveListener); } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.setCanceledOnTouchOutside(true); Loading