am 649b9f19
: Disable left pane of "Input languages" conditionally.
* commit '649b9f19e1193547f339239afa32d569f43358fc': Disable left pane of "Input languages" conditionally.
This commit is contained in:
@@ -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"
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user