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

* commit 'a484dc84d92839e821e7aa7de03c12495d566229':
  Use fragment for gesture typing preference screen
This commit is contained in:
Tadashi G. Takaoka 2014-07-28 12:09:06 +00:00 committed by Android Git Automerger
commit f63a044c66
5 changed files with 96 additions and 32 deletions

View file

@ -33,35 +33,9 @@
android:title="@string/settings_screen_multi_lingual"
android:key="screen_multi_lingual" />
<PreferenceScreen
android:fragment="com.android.inputmethod.latin.settings.GestureSettingsFragment"
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>
android:key="screen_gesture" />
<PreferenceScreen
android:title="@string/settings_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();
final PreferenceScreen gestureScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_GESTURE);
final PreferenceScreen correctionScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
final PreferenceScreen advancedScreen =
@ -196,7 +194,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
}
if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) {
getPreferenceScreen().removePreference(gestureScreen);
getPreferenceScreen().removePreference(findPreference(Settings.SCREEN_GESTURE));
}
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
@ -210,7 +208,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
public void onResume() {
super.onResume();
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
final Resources res = getResources();
final TwoStatePreference showSetupWizardIcon =
(TwoStatePreference)findPreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
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.settings.CustomInputStyleSettingsFragment;
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.MultiLingualSettingsFragment;
import com.android.inputmethod.latin.settings.SettingsFragment;
@ -39,6 +40,7 @@ public class FragmentUtils {
sLatinImeFragments.add(InputSettingsFragment.class.getName());
sLatinImeFragments.add(MultiLingualSettingsFragment.class.getName());
sLatinImeFragments.add(CustomInputStyleSettingsFragment.class.getName());
sLatinImeFragments.add(GestureSettingsFragment.class.getName());
sLatinImeFragments.add(DebugSettings.class.getName());
sLatinImeFragments.add(SettingsFragment.class.getName());
sLatinImeFragments.add(SpellCheckerSettingsFragment.class.getName());