Skip to content

Commit

Permalink
Implement hardwarekey mapping for non navigation bar devices (IE DLX/…
Browse files Browse the repository at this point in the history
…DNA)
  • Loading branch information
pio-masaki committed May 29, 2013
1 parent 800efc0 commit d225236
Show file tree
Hide file tree
Showing 6 changed files with 559 additions and 0 deletions.
21 changes: 21 additions & 0 deletions res/values/arrays.xml
Expand Up @@ -1329,4 +1329,25 @@
<item>1</item>
<item>2</item>
</string-array>

<!-- Implement hardware key remappping support for non navigation bar devices with hardware keys ie DLX/DNA -->
<string-array name="hardware_keys_action_entries" translatable="false">
<item>@string/hardware_keys_action_nothing</item>
<item>@string/hardware_keys_action_menu</item>
<item>@string/hardware_keys_action_app_switch</item>
<item>@string/hardware_keys_action_search</item>
<item>@string/hardware_keys_action_voice_search</item>
<item>@string/hardware_keys_action_in_app_search</item>
</string-array>

<string-array name="hardware_keys_action_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>


</resources>
22 changes: 22 additions & 0 deletions res/values/strings.xml
Expand Up @@ -4925,6 +4925,28 @@
<string name="icon_picker_system_icons_title">System icons</string>
<string name="icon_picker_gallery_title">Gallery</string>
<string name="icon_picker_pack_title">Icon pack</string>

<!-- Hardware keys for non navigation bar devices -->
<string name="hardware_keys_title">Hardware keys</string>
<string name="hardware_keys_bindings_title">Key actions</string>
<string name="hardware_keys_enable_custom_title">Enable custom actions</string>
<string name="hardware_keys_home_long_press_title">Home key (long press)</string>
<string name="hardware_keys_menu_press_title">Menu key</string>
<string name="hardware_keys_menu_long_press_title">Menu key (long press)</string>
<string name="hardware_keys_assist_press_title">Search key</string>
<string name="hardware_keys_assist_long_press_title">Search key (long press)</string>
<string name="hardware_keys_app_switch_press_title">App switch key</string>
<string name="hardware_keys_app_switch_long_press_title">App switch key (long press)</string>
<string name="hardware_keys_show_overflow_title">Show action overflow</string>
<string name="hardware_keys_show_overflow_summary">Display the 3-dot overflow menu button within apps</string>
<string name="hardware_keys_show_overflow_toast_enable">The action overflow button may not be visible until apps are restarted</string>
<string name="hardware_keys_show_overflow_toast_disable">The action overflow button may not be hidden until apps are restarted</string>
<string name="hardware_keys_action_nothing">No action</string>
<string name="hardware_keys_action_menu">Open/close menu</string>
<string name="hardware_keys_action_app_switch">Recent apps switcher</string>
<string name="hardware_keys_action_search">Search assistant</string>
<string name="hardware_keys_action_voice_search">Voice search</string>
<string name="hardware_keys_action_in_app_search">In-app search</string>

<!-- Powerwidget -->
<string name="power_widget">Powerwidget</string>
Expand Down
109 changes: 109 additions & 0 deletions res/xml/hardware_keys.xml
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2012 The CyanogenMod 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/hardware_keys_title">

<PreferenceCategory
android:key="hardware_keys_bindings"
android:title="@string/hardware_keys_bindings_title">

<CheckBoxPreference
android:key="hardware_keys_enable_custom"
android:title="@string/hardware_keys_enable_custom_title"
android:defaultValue="false"
android:persistent="false" />

<ListPreference
android:key="hardware_keys_home_long_press"
android:dialogTitle="@string/hardware_keys_home_long_press_title"
android:title="@string/hardware_keys_home_long_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_menu_press"
android:dialogTitle="@string/hardware_keys_menu_press_title"
android:title="@string/hardware_keys_menu_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_menu_long_press"
android:dialogTitle="@string/hardware_keys_menu_long_press_title"
android:title="@string/hardware_keys_menu_long_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_assist_press"
android:dialogTitle="@string/hardware_keys_assist_press_title"
android:title="@string/hardware_keys_assist_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_assist_long_press"
android:dialogTitle="@string/hardware_keys_assist_long_press_title"
android:title="@string/hardware_keys_assist_long_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_app_switch_press"
android:dialogTitle="@string/hardware_keys_app_switch_press_title"
android:title="@string/hardware_keys_app_switch_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

<ListPreference
android:key="hardware_keys_app_switch_long_press"
android:dialogTitle="@string/hardware_keys_app_switch_long_press_title"
android:title="@string/hardware_keys_app_switch_long_press_title"
android:entries="@array/hardware_keys_action_entries"
android:entryValues="@array/hardware_keys_action_values"
android:persistent="false"
android:dependency="hardware_keys_enable_custom" />

</PreferenceCategory>

<PreferenceCategory
android:title="@string/additional_options_title">

<CheckBoxPreference
android:key="hardware_keys_show_overflow"
android:title="@string/hardware_keys_show_overflow_title"
android:summary="@string/hardware_keys_show_overflow_summary"
android:persistent="false"
android:defaultValue="false" />

</PreferenceCategory>

</PreferenceScreen>

28 changes: 28 additions & 0 deletions res/xml/system_settings.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The CyanogenMod 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/system_interface_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">

<PreferenceScreen
android:key="hardware_keys"
android:fragment="com.android.settings.cyanogenmod.HardwareKeys"
android:title="@string/hardware_keys_title" />

</PreferenceScreen>

0 comments on commit d225236

Please sign in to comment.