Commits

Anonymous committed 7e44cbb

Fix InputMethodSettingsFragment

Bug: 4979539

Change-Id: I99a2e64e67b961429145df7fd45a30f11976d04a

Comments (0)

Files changed (1)

java/InputMethodSettingsFragment.java

 package com.android.inputmethodcommon;
 
 import android.content.Context;
+import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.preference.Preference;
         final InputMethodManager imm =
                 (InputMethodManager) context.getSystemService(
                         Context.INPUT_METHOD_SERVICE);
-
         final InputMethodInfo imi = getMyImi(imm);
         if (imi != null && imi.getSubtypeCount() > 1) {
             mInputMethodSettingsCategory = new PreferenceCategory(context);
-            mSubtypeEnablerPreference =
-                    getPreferenceManager().createPreferenceScreen(context);
+            mSubtypeEnablerPreference = new Preference(context);
             mSubtypeEnablerPreference
                     .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                         @Override
                         public boolean onPreferenceClick(Preference preference) {
-                            final Bundle bundle = new Bundle();
-                            bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imi.getId());
+                            final Intent intent = new Intent(
+                                    Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
+                            intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, imi.getId());
+                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                                    | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+                                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                            startActivity(intent);
                             return true;
                         }
                     });
-            mInputMethodSettingsCategory.addPreference(mSubtypeEnablerPreference);
+            setPreferenceScreen(getPreferenceManager().createPreferenceScreen(context));
             getPreferenceScreen().addPreference(mInputMethodSettingsCategory);
+            mInputMethodSettingsCategory.addPreference(mSubtypeEnablerPreference);
         }
         updateSubtypeEnabler();
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.