InputMethodSettingsImpl.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:AOSP-Kayboard-7.1.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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号