am 2d64f7c0: am f63a044c: am a484dc84: Merge "Use fragment for gesture typing preference screen" into lmp-dev

* commit '2d64f7c097bb0246e8c1ac1a1f82c175c40c4e41':
  Use fragment for gesture typing preference screen
main
Tadashi G. Takaoka 2014-07-28 12:18:10 +00:00 committed by Android Git Automerger
commit 4ed4d4fc46
5 changed files with 96 additions and 32 deletions

View File

@ -33,35 +33,9 @@
android:title="@string/settings_screen_multi_lingual" android:title="@string/settings_screen_multi_lingual"
android:key="screen_multi_lingual" /> android:key="screen_multi_lingual" />
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.inputmethod.latin.settings.GestureSettingsFragment"
android:title="@string/settings_screen_gesture" android:title="@string/settings_screen_gesture"
android:key="screen_gesture"> android:key="screen_gesture" />
<CheckBoxPreference
android:key="gesture_input"
android:title="@string/gesture_input"
android:summary="@string/gesture_input_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_floating_preview_text"
android:dependency="gesture_input"
android:title="@string/gesture_floating_preview_text"
android:summary="@string/gesture_floating_preview_text_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_preview_trail"
android:dependency="gesture_input"
android:title="@string/gesture_preview_trail"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_space_aware"
android:dependency="gesture_input"
android:title="@string/gesture_space_aware"
android:summary="@string/gesture_space_aware_summary"
android:defaultValue="true"
android:persistent="true" />
</PreferenceScreen>
<PreferenceScreen <PreferenceScreen
android:title="@string/settings_screen_correction" android:title="@string/settings_screen_correction"
android:key="screen_correction"> android:key="screen_correction">

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/settings_screen_gesture"
android:key="screen_gesture">
<CheckBoxPreference
android:key="gesture_input"
android:title="@string/gesture_input"
android:summary="@string/gesture_input_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_floating_preview_text"
android:dependency="gesture_input"
android:title="@string/gesture_floating_preview_text"
android:summary="@string/gesture_floating_preview_text_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_preview_trail"
android:dependency="gesture_input"
android:title="@string/gesture_preview_trail"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_gesture_space_aware"
android:dependency="gesture_input"
android:title="@string/gesture_space_aware"
android:summary="@string/gesture_space_aware_summary"
android:defaultValue="true"
android:persistent="true" />
</PreferenceScreen>

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2014 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.inputmethod.latin.settings;
import android.content.SharedPreferences;
import android.os.Bundle;
import com.android.inputmethod.latin.R;
/**
* "Gesture typing preferences" settings sub screen.
*
* This settings sub screen handles the following gesture typing preferences.
* - Enable gesture typing
* - Dynamic floating preview
* - Show gesture trail
* - Phrase gesture
*/
public final class GestureSettingsFragment extends SubScreenFragment {
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_gesture);
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
// Nothing to do here.
}
}

View File

@ -117,8 +117,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
ensureConsistencyOfAutoCorrectionSettings(); ensureConsistencyOfAutoCorrectionSettings();
final PreferenceScreen gestureScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_GESTURE);
final PreferenceScreen correctionScreen = final PreferenceScreen correctionScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION); (PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
final PreferenceScreen advancedScreen = final PreferenceScreen advancedScreen =
@ -196,7 +194,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
} }
if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) { if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) {
getPreferenceScreen().removePreference(gestureScreen); getPreferenceScreen().removePreference(findPreference(Settings.SCREEN_GESTURE));
} }
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this); AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
@ -210,7 +208,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
final Resources res = getResources();
final TwoStatePreference showSetupWizardIcon = final TwoStatePreference showSetupWizardIcon =
(TwoStatePreference)findPreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON); (TwoStatePreference)findPreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
if (showSetupWizardIcon != null) { if (showSetupWizardIcon != null) {

View File

@ -20,6 +20,7 @@ import com.android.inputmethod.dictionarypack.DictionarySettingsFragment;
import com.android.inputmethod.latin.about.AboutPreferences; import com.android.inputmethod.latin.about.AboutPreferences;
import com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment; import com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment;
import com.android.inputmethod.latin.settings.DebugSettings; import com.android.inputmethod.latin.settings.DebugSettings;
import com.android.inputmethod.latin.settings.GestureSettingsFragment;
import com.android.inputmethod.latin.settings.InputSettingsFragment; import com.android.inputmethod.latin.settings.InputSettingsFragment;
import com.android.inputmethod.latin.settings.MultiLingualSettingsFragment; import com.android.inputmethod.latin.settings.MultiLingualSettingsFragment;
import com.android.inputmethod.latin.settings.SettingsFragment; import com.android.inputmethod.latin.settings.SettingsFragment;
@ -39,6 +40,7 @@ public class FragmentUtils {
sLatinImeFragments.add(InputSettingsFragment.class.getName()); sLatinImeFragments.add(InputSettingsFragment.class.getName());
sLatinImeFragments.add(MultiLingualSettingsFragment.class.getName()); sLatinImeFragments.add(MultiLingualSettingsFragment.class.getName());
sLatinImeFragments.add(CustomInputStyleSettingsFragment.class.getName()); sLatinImeFragments.add(CustomInputStyleSettingsFragment.class.getName());
sLatinImeFragments.add(GestureSettingsFragment.class.getName());
sLatinImeFragments.add(DebugSettings.class.getName()); sLatinImeFragments.add(DebugSettings.class.getName());
sLatinImeFragments.add(SettingsFragment.class.getName()); sLatinImeFragments.add(SettingsFragment.class.getName());
sLatinImeFragments.add(SpellCheckerSettingsFragment.class.getName()); sLatinImeFragments.add(SpellCheckerSettingsFragment.class.getName());