Merge "Add Keyboard Shortcuts Helper entry in Settings" into nyc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cb3b81e..210ed5e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3636,6 +3636,10 @@
<string name="show_ime">Show virtual keyboard</string>
<!-- Summary text for the 'add virtual keyboard' preference sub-screen. [CHAR LIMIT=100] -->
<string name="show_ime_summary">Keep it on screen while physical keyboard is active</string>
+ <!-- Title for the button to trigger the 'keyboard shortcuts helper' dialog. [CHAR LIMIT=35] -->
+ <string name="keyboard_shortcuts_helper">Keyboard shortcuts helper</string>
+ <!-- Summary text for the 'keyboard shortcuts helper' dialog. [CHAR LIMIT=100] -->
+ <string name="keyboard_shortcuts_helper_summary">Display available shortcuts</string>
<!--
Format string for a physical device in the form: InputMethodSubtype - InputMethodEditor.
e.g. English (US) - X Keyboard -->
diff --git a/res/xml/physical_keyboard_settings.xml b/res/xml/physical_keyboard_settings.xml
index 4de2672..974ba98 100644
--- a/res/xml/physical_keyboard_settings.xml
+++ b/res/xml/physical_keyboard_settings.xml
@@ -25,5 +25,10 @@
android:title="@string/show_ime"
android:summary="@string/show_ime_summary"
android:defaultValue="false" />
+
+ <Preference
+ android:key="keyboard_shortcuts_helper"
+ android:title="@string/keyboard_shortcuts_helper"
+ android:summary="@string/keyboard_shortcuts_helper_summary" />
</PreferenceCategory>
</PreferenceScreen>
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
index 7f590a1..fb44a3d 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
@@ -61,6 +61,7 @@
private static final int USER_SYSTEM = 0;
private static final String KEYBOARD_ASSISTANCE_CATEGORY = "keyboard_assistance_category";
private static final String SHOW_VIRTUAL_KEYBOARD_SWITCH = "show_virtual_keyboard_switch";
+ private static final String KEYBOARD_SHORTCUTS_HELPER = "keyboard_shortcuts_helper";
private static final String IM_SUBTYPE_MODE_KEYBOARD = "keyboard";
@NonNull
@@ -95,6 +96,14 @@
mShowVirtualKeyboardSwitch = Preconditions.checkNotNull(
(SwitchPreference) mKeyboardAssistanceCategory.findPreference(
SHOW_VIRTUAL_KEYBOARD_SWITCH));
+ findPreference(KEYBOARD_SHORTCUTS_HELPER).setOnPreferenceClickListener(
+ new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ toggleKeyboardShortcutsMenu();
+ return true;
+ }
+ });
}
@Override
@@ -245,6 +254,10 @@
mShowVirtualKeyboardSwitch.setChecked(mSettings.isShowImeWithHardKeyboardEnabled());
}
+ private void toggleKeyboardShortcutsMenu() {
+ getActivity().requestKeyboardShortcutsHelper();
+ }
+
private final OnPreferenceChangeListener mShowVirtualKeyboardSwitchPreferenceChangeListener =
new OnPreferenceChangeListener() {
@Override