am fc12c0a7: Merge "Add a user preference for split layout within Appearance & Layouts"

* commit 'fc12c0a7fdb68b0c44a7fdefb67b15c099526f59':
  Add a user preference for split layout within Appearance & Layouts
main
Jatin Matani 2014-09-17 17:10:51 +00:00 committed by Android Git Automerger
commit f41c5eccad
5 changed files with 27 additions and 1 deletions

View File

@ -51,6 +51,9 @@
<!-- Settings screen title for keyboard theme settings [CHAR LIMIT=33] -->
<string name="settings_screen_theme">Theme</string>
<!-- Option for enabling or disabling the split keyboard layout. [CHAR LIMIT=65]-->
<string name="enable_split_keyboard">Enable split keyboard</string>
<!-- Option name for including other IMEs in the language switch list [CHAR LIMIT=30] -->
<string name="include_other_imes_in_language_switch_list">Switch to other input methods</string>
<!-- Option summary for including other IMEs in the language switch list [CHAR LIMIT=65] -->

View File

@ -26,4 +26,9 @@
android:fragment="com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment"
android:key="custom_input_styles"
android:title="@string/custom_input_styles_title" />
<CheckBoxPreference
android:key="pref_split_keyboard"
android:title="@string/enable_split_keyboard"
android:persistent="true"
android:defaultValue="false" />
</PreferenceScreen>

View File

@ -19,6 +19,7 @@ package com.android.inputmethod.latin.settings;
import android.os.Bundle;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.define.ProductionFlags;
/**
@ -29,6 +30,10 @@ public final class AppearanceSettingsFragment extends SubScreenFragment {
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_appearance);
if (!ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED
|| !Settings.getInstance().getCurrent().isTablet()) {
removePreference(Settings.PREF_ENABLE_SPLIT_KEYBOARD);
}
}
@Override
@ -38,4 +43,4 @@ public final class AppearanceSettingsFragment extends SubScreenFragment {
findPreference(Settings.PREF_CUSTOM_INPUT_STYLES));
ThemeSettingsFragment.updateKeyboardThemeSummary(findPreference(Settings.SCREEN_THEME));
}
}
}

View File

@ -83,6 +83,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
"pref_include_other_imes_in_language_switch_list";
public static final String PREF_KEYBOARD_THEME = "pref_keyboard_theme";
public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles";
public static final String PREF_ENABLE_SPLIT_KEYBOARD = "pref_split_keyboard";
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY =
"pref_key_preview_popup_dismiss_delay";

View File

@ -25,6 +25,7 @@ import android.util.Log;
import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.compat.AppWorkaroundsUtils;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
@ -79,6 +80,9 @@ public class SettingsValues {
public final int mKeyLongpressTimeout;
public final boolean mEnableMetricsLogging;
public final boolean mShouldShowUiToAcceptTypedWord;
// Use split layout for keyboard.
public final boolean mIsSplitKeyboardEnabled;
public final int mScreenMetrics;
// From the input box
public final InputAttributes mInputAttributes;
@ -157,6 +161,9 @@ public class SettingsValues {
mDoubleSpacePeriodTimeout = res.getInteger(R.integer.config_double_space_period_timeout);
mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
mEnableMetricsLogging = prefs.getBoolean(Settings.PREF_ENABLE_METRICS_LOGGING, true);
mIsSplitKeyboardEnabled = prefs.getBoolean(Settings.PREF_ENABLE_SPLIT_KEYBOARD, false);
mScreenMetrics = res.getInteger(R.integer.config_screen_metrics);
mShouldShowUiToAcceptTypedWord = Settings.HAS_UI_TO_ACCEPT_TYPED_WORD
&& prefs.getBoolean(DebugSettings.PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD, true);
// Compute other readable settings
@ -225,6 +232,11 @@ public class SettingsValues {
return mEnableMetricsLogging;
}
public boolean isTablet() {
return mScreenMetrics == Constants.SCREEN_METRICS_SMALL_TABLET
|| mScreenMetrics == Constants.SCREEN_METRICS_LARGE_TABLET;
}
public boolean isApplicationSpecifiedCompletionsOn() {
return mInputAttributes.mApplicationSpecifiedCompletionOn;
}