summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2011-01-30 19:43:08 -0800
committerDaisuke Miyakawa <dmiyakawa@google.com>2011-01-31 22:12:01 -0800
commit649b9f19e1193547f339239afa32d569f43358fc (patch)
tree10e6c0ae05ea5af69d3109dcabe45438a395da5b /src/com/android/settings/inputmethod
parent13d62049f7c96c47356f23eaee7f0997612fdf9f (diff)
downloadpackages_apps_Settings-649b9f19e1193547f339239afa32d569f43358fc.zip
packages_apps_Settings-649b9f19e1193547f339239afa32d569f43358fc.tar.gz
packages_apps_Settings-649b9f19e1193547f339239afa32d569f43358fc.tar.bz2
Disable left pane of "Input languages" conditionally.
The screen is available from LatinIME's setting button, in which we don't want the left pane, while we want the left pane when launched as part of Settings app. Bug: 3383738 Change-Id: I62e901e7cc14053742ae35829d82c20e432a358f
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java13
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndSubtypeEnablerActivity.java31
-rw-r--r--src/com/android/settings/inputmethod/InputMethodConfig.java18
3 files changed, 56 insertions, 6 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
index 0e5be20..6e1d4d1 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
@@ -55,8 +55,21 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Configuration config = getResources().getConfiguration();
mHaveHardKeyboard = (config.keyboard == Configuration.KEYBOARD_QWERTY);
+
+ // Input method id should be available from an Intent when this preference is launched as a
+ // single Activity (see InputMethodAndSubtypeEnablerActivity). It should be available
+ // from a preference argument when the preference is launched as a part of the other
+ // Activity (like a right pane of 2-pane Settings app)
mInputMethodId = getActivity().getIntent().getStringExtra(
android.provider.Settings.EXTRA_INPUT_METHOD_ID);
+ if (mInputMethodId == null && (getArguments() != null)) {
+ final String inputMethodId =
+ getArguments().getString(android.provider.Settings.EXTRA_INPUT_METHOD_ID);
+ if (inputMethodId != null) {
+ mInputMethodId = inputMethodId;
+ }
+ }
+
onCreateIMM();
setPreferenceScreen(createPreferenceHierarchy());
}
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnablerActivity.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnablerActivity.java
new file mode 100644
index 0000000..d70d5e4
--- /dev/null
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnablerActivity.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+package com.android.settings.inputmethod;
+
+import android.content.Intent;
+import android.preference.PreferenceActivity;
+
+public class InputMethodAndSubtypeEnablerActivity extends PreferenceActivity {
+ @Override
+ public Intent getIntent() {
+ final Intent modIntent = new Intent(super.getIntent());
+ if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, InputMethodAndSubtypeEnabler.class.getName());
+ modIntent.putExtra(EXTRA_NO_HEADERS, true);
+ }
+ return modIntent;
+ }
+}
diff --git a/src/com/android/settings/inputmethod/InputMethodConfig.java b/src/com/android/settings/inputmethod/InputMethodConfig.java
index 3e77ba1..f2bdafd 100644
--- a/src/com/android/settings/inputmethod/InputMethodConfig.java
+++ b/src/com/android/settings/inputmethod/InputMethodConfig.java
@@ -29,6 +29,7 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.provider.Settings;
@@ -219,12 +220,17 @@ public class InputMethodConfig extends SettingsPreferenceFragment {
PreferenceScreen prefScreen = new PreferenceScreen(getActivity(), null);
prefScreen.setTitle(R.string.active_input_method_subtypes);
if (imi.getSubtypeCount() > 1) {
- 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);
- intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, imiId);
- prefScreen.setIntent(intent);
+ prefScreen.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference){
+ final Bundle bundle = new Bundle();
+ bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
+ startFragment(InputMethodConfig.this,
+ InputMethodAndSubtypeEnabler.class.getName(),
+ 0, bundle);
+ return true;
+ }
+ });
keyboardSettingsCategory.addPreference(prefScreen);
mActiveInputMethodsPrefMap.put(imi, prefScreen);
mInputMethodPrefsMap.get(imiId).add(prefScreen);