Loading core/res/res/layout/input_method_switch_dialog_title.xml +7 −14 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,7 @@ <com.android.internal.widget.DialogTitle <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" android:id="@+id/alertTitle" style="@android:style/DialogWindowTitle.Holo" style="@android:style/DialogWindowTitle.DeviceDefault" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:ellipsize="end" Loading @@ -49,11 +49,6 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:color/holo_blue_light" /> <LinearLayout <LinearLayout android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading Loading @@ -97,12 +92,10 @@ android:layout_gravity="center_vertical" android:layout_gravity="center_vertical" android:layout_marginEnd="12dip" /> android:layout_marginEnd="12dip" /> </LinearLayout> </LinearLayout> </LinearLayout> <View <View android:id="@+id/titleDivider" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="2dip" android:layout_height="1dp" android:background="@android:drawable/divider_horizontal_dark" /> android:background="?android:attr/listDividerAlertDialog" /> </LinearLayout> </LinearLayout> </LinearLayout> core/res/res/layout/input_method_switch_item.xml 0 → 100644 +63 −0 Original line number Original line 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 Original line Diff line number Diff line Loading @@ -1195,6 +1195,7 @@ <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method_extract_view" /> <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="input_method_switch_dialog_title" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="list_content_simple" /> <java-symbol type="layout" name="list_content_simple" /> Loading services/core/java/com/android/server/InputMethodManagerService.java +61 −61 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.ServiceConnection; Loading Loading @@ -91,6 +92,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Printer; import android.util.Slog; import android.util.Slog; import android.util.Xml; import android.util.Xml; import android.view.ContextThemeWrapper; import android.view.IWindowManager; import android.view.IWindowManager; import android.view.InputChannel; import android.view.InputChannel; import android.view.LayoutInflater; import android.view.LayoutInflater; Loading Loading @@ -2728,6 +2730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mKeyguardManager != null return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); } } private void showInputMethodMenuInternal(boolean showSubtypes) { private void showInputMethodMenuInternal(boolean showSubtypes) { if (DEBUG) Slog.v(TAG, "Show switching menu"); 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.styleable.DialogPreference, com.android.internal.R.attr.alertDialogStyle, 0); com.android.internal.R.attr.alertDialogStyle, 0); mDialogBuilder = new AlertDialog.Builder(context) mDialogBuilder.setIcon(a.getDrawable( .setOnCancelListener(new OnCancelListener() { com.android.internal.R.styleable.DialogPreference_dialogIcon)); a.recycle(); mDialogBuilder.setOnCancelListener(new OnCancelListener() { @Override @Override public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); hideInputMethodMenu(); } } }) }); .setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogTitle)); a.recycle(); final LayoutInflater inflater = final LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater)themedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View tv = inflater.inflate( final View tv = inflater.inflate( com.android.internal.R.layout.input_method_switch_dialog_title, null); com.android.internal.R.layout.input_method_switch_dialog_title, null); mDialogBuilder.setCustomTitle(tv); mDialogBuilder.setCustomTitle(tv); // Setup layout for a toggle switch of the hardware keyboard // Setup layout for a toggle switch of the hardware keyboard mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView.findViewById( mSwitchingDialogTitleView com.android.internal.R.id.hard_keyboard_section).setVisibility( .findViewById(com.android.internal.R.id.hard_keyboard_section) mWindowManagerService.isHardKeyboardAvailable() ? .setVisibility(mWindowManagerService.isHardKeyboardAvailable() View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = ((Switch)mSwitchingDialogTitleView.findViewById( final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch)); com.android.internal.R.id.hard_keyboard_switch); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setOnCheckedChangeListener( hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { new OnCheckedChangeListener() { @Override @Override public void onCheckedChanged( public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { CompoundButton buttonView, boolean isChecked) { mWindowManagerService.setHardKeyboardEnabled(isChecked); mWindowManagerService.setHardKeyboardEnabled(isChecked); // Ensure that the input method dialog is dismissed when changing // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. // the hardware keyboard state. Loading @@ -2818,44 +2821,41 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } }); }); final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(context, final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(themedContext, com.android.internal.R.layout.simple_list_item_2_single_choice, imList, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem); checkedItem); final OnClickListener choiceListener = new OnClickListener() { mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, new AlertDialog.OnClickListener() { @Override @Override public void onClick(DialogInterface dialog, int which) { public void onClick(final DialogInterface dialog, final int which) { synchronized (mMethodMap) { synchronized (mMethodMap) { if (mIms == null || mIms.length <= which if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds == null || mSubtypeIds.length <= which) { || mSubtypeIds.length <= which) { return; return; } } InputMethodInfo im = mIms[which]; final InputMethodInfo im = mIms[which]; int subtypeId = mSubtypeIds[which]; int subtypeId = mSubtypeIds[which]; adapter.mCheckedItem = which; adapter.mCheckedItem = which; adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged(); hideInputMethodMenu(); hideInputMethodMenu(); if (im != null) { if (im != null) { if ((subtypeId < 0) if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) { || (subtypeId >= im.getSubtypeCount())) { subtypeId = NOT_A_SUBTYPE_ID; subtypeId = NOT_A_SUBTYPE_ID; } } setInputMethodLocked(im.getId(), subtypeId); setInputMethodLocked(im.getId(), subtypeId); } } } } } } }); }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); if (showSubtypes && !isScreenLocked) { if (showSubtypes && !isScreenLocked) { mDialogBuilder.setPositiveButton( final OnClickListener positiveListener = new OnClickListener() { com.android.internal.R.string.configure_input_methods, new DialogInterface.OnClickListener() { @Override @Override public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) { showConfigureInputMethods(); showConfigureInputMethods(); } } }); }; mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, positiveListener); } } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.setCanceledOnTouchOutside(true); mSwitchingDialog.setCanceledOnTouchOutside(true); Loading Loading
core/res/res/layout/input_method_switch_dialog_title.xml +7 −14 Original line number Original line Diff line number Diff line Loading @@ -33,7 +33,7 @@ <com.android.internal.widget.DialogTitle <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle" android:id="@+id/alertTitle" style="@android:style/DialogWindowTitle.Holo" style="@android:style/DialogWindowTitle.DeviceDefault" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:ellipsize="end" Loading @@ -49,11 +49,6 @@ android:layout_height="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="2dip" android:background="@android:color/holo_blue_light" /> <LinearLayout <LinearLayout android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="wrap_content" Loading Loading @@ -97,12 +92,10 @@ android:layout_gravity="center_vertical" android:layout_gravity="center_vertical" android:layout_marginEnd="12dip" /> android:layout_marginEnd="12dip" /> </LinearLayout> </LinearLayout> </LinearLayout> <View <View android:id="@+id/titleDivider" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="2dip" android:layout_height="1dp" android:background="@android:drawable/divider_horizontal_dark" /> android:background="?android:attr/listDividerAlertDialog" /> </LinearLayout> </LinearLayout> </LinearLayout>
core/res/res/layout/input_method_switch_item.xml 0 → 100644 +63 −0 Original line number Original line 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 Original line Diff line number Diff line Loading @@ -1195,6 +1195,7 @@ <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="icon_menu_layout" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method" /> <java-symbol type="layout" name="input_method_extract_view" /> <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="input_method_switch_dialog_title" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="js_prompt" /> <java-symbol type="layout" name="list_content_simple" /> <java-symbol type="layout" name="list_content_simple" /> Loading
services/core/java/com/android/server/InputMethodManagerService.java +61 −61 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.ServiceConnection; Loading Loading @@ -91,6 +92,7 @@ import android.util.PrintWriterPrinter; import android.util.Printer; import android.util.Printer; import android.util.Slog; import android.util.Slog; import android.util.Xml; import android.util.Xml; import android.view.ContextThemeWrapper; import android.view.IWindowManager; import android.view.IWindowManager; import android.view.InputChannel; import android.view.InputChannel; import android.view.LayoutInflater; import android.view.LayoutInflater; Loading Loading @@ -2728,6 +2730,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mKeyguardManager != null return mKeyguardManager != null && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); && mKeyguardManager.isKeyguardLocked() && mKeyguardManager.isKeyguardSecure(); } } private void showInputMethodMenuInternal(boolean showSubtypes) { private void showInputMethodMenuInternal(boolean showSubtypes) { if (DEBUG) Slog.v(TAG, "Show switching menu"); 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.styleable.DialogPreference, com.android.internal.R.attr.alertDialogStyle, 0); com.android.internal.R.attr.alertDialogStyle, 0); mDialogBuilder = new AlertDialog.Builder(context) mDialogBuilder.setIcon(a.getDrawable( .setOnCancelListener(new OnCancelListener() { com.android.internal.R.styleable.DialogPreference_dialogIcon)); a.recycle(); mDialogBuilder.setOnCancelListener(new OnCancelListener() { @Override @Override public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) { hideInputMethodMenu(); hideInputMethodMenu(); } } }) }); .setIcon(a.getDrawable( com.android.internal.R.styleable.DialogPreference_dialogTitle)); a.recycle(); final LayoutInflater inflater = final LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); (LayoutInflater)themedContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View tv = inflater.inflate( final View tv = inflater.inflate( com.android.internal.R.layout.input_method_switch_dialog_title, null); com.android.internal.R.layout.input_method_switch_dialog_title, null); mDialogBuilder.setCustomTitle(tv); mDialogBuilder.setCustomTitle(tv); // Setup layout for a toggle switch of the hardware keyboard // Setup layout for a toggle switch of the hardware keyboard mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView = tv; mSwitchingDialogTitleView.findViewById( mSwitchingDialogTitleView com.android.internal.R.id.hard_keyboard_section).setVisibility( .findViewById(com.android.internal.R.id.hard_keyboard_section) mWindowManagerService.isHardKeyboardAvailable() ? .setVisibility(mWindowManagerService.isHardKeyboardAvailable() View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = ((Switch)mSwitchingDialogTitleView.findViewById( final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch)); com.android.internal.R.id.hard_keyboard_switch); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); hardKeySwitch.setOnCheckedChangeListener( hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { new OnCheckedChangeListener() { @Override @Override public void onCheckedChanged( public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { CompoundButton buttonView, boolean isChecked) { mWindowManagerService.setHardKeyboardEnabled(isChecked); mWindowManagerService.setHardKeyboardEnabled(isChecked); // Ensure that the input method dialog is dismissed when changing // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. // the hardware keyboard state. Loading @@ -2818,44 +2821,41 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } }); }); final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(context, final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(themedContext, com.android.internal.R.layout.simple_list_item_2_single_choice, imList, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem); checkedItem); final OnClickListener choiceListener = new OnClickListener() { mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, new AlertDialog.OnClickListener() { @Override @Override public void onClick(DialogInterface dialog, int which) { public void onClick(final DialogInterface dialog, final int which) { synchronized (mMethodMap) { synchronized (mMethodMap) { if (mIms == null || mIms.length <= which if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds == null || mSubtypeIds.length <= which) { || mSubtypeIds.length <= which) { return; return; } } InputMethodInfo im = mIms[which]; final InputMethodInfo im = mIms[which]; int subtypeId = mSubtypeIds[which]; int subtypeId = mSubtypeIds[which]; adapter.mCheckedItem = which; adapter.mCheckedItem = which; adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged(); hideInputMethodMenu(); hideInputMethodMenu(); if (im != null) { if (im != null) { if ((subtypeId < 0) if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) { || (subtypeId >= im.getSubtypeCount())) { subtypeId = NOT_A_SUBTYPE_ID; subtypeId = NOT_A_SUBTYPE_ID; } } setInputMethodLocked(im.getId(), subtypeId); setInputMethodLocked(im.getId(), subtypeId); } } } } } } }); }; mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener); if (showSubtypes && !isScreenLocked) { if (showSubtypes && !isScreenLocked) { mDialogBuilder.setPositiveButton( final OnClickListener positiveListener = new OnClickListener() { com.android.internal.R.string.configure_input_methods, new DialogInterface.OnClickListener() { @Override @Override public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) { showConfigureInputMethods(); showConfigureInputMethods(); } } }); }; mDialogBuilder.setPositiveButton( com.android.internal.R.string.configure_input_methods, positiveListener); } } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.setCanceledOnTouchOutside(true); mSwitchingDialog.setCanceledOnTouchOutside(true); Loading