Java Code Examples for android.provider.Settings#ACTION_INPUT_METHOD_SUBTYPE_SETTINGS

The following examples show how to use android.provider.Settings#ACTION_INPUT_METHOD_SUBTYPE_SETTINGS . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Initialize internal states of this object.
 * @param context the context for this application.
 * @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
 * @return true if this application is an IME and has two or more subtypes, false otherwise.
 */
public boolean init(final Context context, final PreferenceScreen prefScreen) {
    mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    mImi = getMyImi(context, mImm);
    if (mImi == null || mImi.getSubtypeCount() <= 1) {
        return false;
    }
    final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
    intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    mSubtypeEnablerPreference = new Preference(context);
    mSubtypeEnablerPreference.setIntent(intent);
    prefScreen.addPreference(mSubtypeEnablerPreference);
    updateSubtypeEnabler();
    return true;
}
 
Example 2
/**
 * Initialize internal states of this object.
 *
 * @param context    the context for this application.
 * @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
 * @return true if this application is an IME and has two or more subtypes, false otherwise.
 */
public boolean init(final Context context, final PreferenceScreen prefScreen) {
    mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    mImi = getMyImi(context, mImm);
    if (mImi == null || mImi.getSubtypeCount() <= 1) {
        return false;
    }
    final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
    intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    mSubtypeEnablerPreference = new Preference(context);
    mSubtypeEnablerPreference.setIntent(intent);
    prefScreen.addPreference(mSubtypeEnablerPreference);
    updateSubtypeEnabler();
    return true;
}
 
Example 3
private void showInputMethodAndSubtypeEnabler(String inputMethodId) {
    Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    if (!TextUtils.isEmpty(inputMethodId)) {
        intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, inputMethodId);
    }
    mContext.startActivityAsUser(intent, null, UserHandle.CURRENT);
}