Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23190,6 +23190,7 @@ package android.view.inputmethod { public final class InputMethodSubtype implements android.os.Parcelable { method public boolean containsExtraValueKey(java.lang.String); method public int describeContents(); method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo); method public java.lang.String getExtraValue(); method public java.lang.String getExtraValueOf(java.lang.String); method public int getIconResId(); core/java/android/view/inputmethod/InputMethodInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,9 @@ public final class InputMethodInfo implements Parcelable { a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeMode), a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeExtraValue)); .InputMethod_Subtype_imeSubtypeExtraValue), a.getBoolean(com.android.internal.R.styleable .InputMethod_Subtype_isAuxiliary, false)); mSubtypes.add(subtype); } } Loading core/java/android/view/inputmethod/InputMethodSubtype.java +27 −0 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package android.view.inputmethod; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Slog; import java.util.ArrayList; Loading Loading @@ -137,6 +139,31 @@ public final class InputMethodSubtype implements Parcelable { return mIsAuxiliary; } /** * @param context Context will be used for getting Locale and PackageManager. * @param packageName The package name of the IME * @param appInfo The application info of the IME * @return a display name for this subtype. The string resource of the label (mSubtypeNameResId) * can have only one %s in it. If there is, the %s part will be replaced with the locale's * display name by the formatter. If there is not, this method simply returns the string * specified by mSubtypeNameResId. If mSubtypeNameResId is not specified (== 0), it's up to the * framework to generate an appropriate display name. */ public CharSequence getDisplayName( Context context, String packageName, ApplicationInfo appInfo) { final String locale = context.getResources().getConfiguration().locale.getDisplayName(); if (mSubtypeNameResId == 0) { return locale; } final String subtypeName = context.getPackageManager().getText( packageName, mSubtypeNameResId, appInfo).toString(); if (!TextUtils.isEmpty(subtypeName)) { return String.format(subtypeName, locale); } else { return locale; } } private HashMap<String, String> getExtraValueHashMap() { if (mExtraValueHashMapCache == null) { mExtraValueHashMapCache = new HashMap<String, String>(); Loading packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java +2 −3 Original line number Diff line number Diff line Loading @@ -422,9 +422,8 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId() + imi.getServiceInfo().applicationInfo); } // TODO: Change the language of subtype name according to subtype's locale. return mPackageManager.getText( imi.getPackageName(), subtype.getNameResId(), imi.getServiceInfo().applicationInfo); return subtype.getDisplayName( mContext, imi.getPackageName(), imi.getServiceInfo().applicationInfo); } private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) { Loading services/java/com/android/server/InputMethodManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1885,8 +1885,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int nameResId = subtype.getNameResId(); String mode = subtype.getMode(); if (nameResId != 0) { title = TextUtils.concat(pm.getText(imi.getPackageName(), nameResId, imi.getServiceInfo().applicationInfo), title = TextUtils.concat(subtype.getDisplayName(context, imi.getPackageName(), imi.getServiceInfo().applicationInfo), (TextUtils.isEmpty(label) ? "" : " (" + label + ")")); } else { CharSequence language = subtype.getLocale(); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23190,6 +23190,7 @@ package android.view.inputmethod { public final class InputMethodSubtype implements android.os.Parcelable { method public boolean containsExtraValueKey(java.lang.String); method public int describeContents(); method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo); method public java.lang.String getExtraValue(); method public java.lang.String getExtraValueOf(java.lang.String); method public int getIconResId();
core/java/android/view/inputmethod/InputMethodInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,9 @@ public final class InputMethodInfo implements Parcelable { a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeMode), a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeExtraValue)); .InputMethod_Subtype_imeSubtypeExtraValue), a.getBoolean(com.android.internal.R.styleable .InputMethod_Subtype_isAuxiliary, false)); mSubtypes.add(subtype); } } Loading
core/java/android/view/inputmethod/InputMethodSubtype.java +27 −0 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package android.view.inputmethod; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Slog; import java.util.ArrayList; Loading Loading @@ -137,6 +139,31 @@ public final class InputMethodSubtype implements Parcelable { return mIsAuxiliary; } /** * @param context Context will be used for getting Locale and PackageManager. * @param packageName The package name of the IME * @param appInfo The application info of the IME * @return a display name for this subtype. The string resource of the label (mSubtypeNameResId) * can have only one %s in it. If there is, the %s part will be replaced with the locale's * display name by the formatter. If there is not, this method simply returns the string * specified by mSubtypeNameResId. If mSubtypeNameResId is not specified (== 0), it's up to the * framework to generate an appropriate display name. */ public CharSequence getDisplayName( Context context, String packageName, ApplicationInfo appInfo) { final String locale = context.getResources().getConfiguration().locale.getDisplayName(); if (mSubtypeNameResId == 0) { return locale; } final String subtypeName = context.getPackageManager().getText( packageName, mSubtypeNameResId, appInfo).toString(); if (!TextUtils.isEmpty(subtypeName)) { return String.format(subtypeName, locale); } else { return locale; } } private HashMap<String, String> getExtraValueHashMap() { if (mExtraValueHashMapCache == null) { mExtraValueHashMapCache = new HashMap<String, String>(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java +2 −3 Original line number Diff line number Diff line Loading @@ -422,9 +422,8 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId() + imi.getServiceInfo().applicationInfo); } // TODO: Change the language of subtype name according to subtype's locale. return mPackageManager.getText( imi.getPackageName(), subtype.getNameResId(), imi.getServiceInfo().applicationInfo); return subtype.getDisplayName( mContext, imi.getPackageName(), imi.getServiceInfo().applicationInfo); } private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) { Loading
services/java/com/android/server/InputMethodManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1885,8 +1885,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int nameResId = subtype.getNameResId(); String mode = subtype.getMode(); if (nameResId != 0) { title = TextUtils.concat(pm.getText(imi.getPackageName(), nameResId, imi.getServiceInfo().applicationInfo), title = TextUtils.concat(subtype.getDisplayName(context, imi.getPackageName(), imi.getServiceInfo().applicationInfo), (TextUtils.isEmpty(label) ? "" : " (" + label + ")")); } else { CharSequence language = subtype.getLocale(); Loading