Merge "Use a custom media file for media volume sample." into honeycomb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e94dfcb..e559325 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -353,7 +353,7 @@
android:resource="@id/language_settings" />
</activity>
- <activity android:name="Settings$InputMethodAndSubtypeEnablerActivity"
+ <activity android:name=".inputmethod.InputMethodAndSubtypeEnablerActivity"
android:theme="@android:style/Theme.Holo"
android:label="@string/input_methods_and_subtype_enabler_title"
android:clearTaskOnLaunch="true">
@@ -364,14 +364,6 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.inputmethod.InputMethodAndSubtypeEnabler" />
- <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
- android:resource="@id/language_settings" />
- <meta-data android:name="com.android.settings.PARENT_FRAGMENT_TITLE"
- android:resource="@string/language_keyboard_settings_title" />
- <meta-data android:name="com.android.settings.PARENT_FRAGMENT_CLASS"
- android:value="com.android.settings.Settings$InputMethodAndLanguageSettingsActivity" />
</activity>
<activity android:name="Settings$InputMethodConfigActivity"
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 @@
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.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 @@
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);