Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39b2b7c8 authored by masiullah's avatar masiullah Committed by Steve Kondik
Browse files

Stylus gestures features (2/2)

Forward-port to CM-11.0

Change-Id: I0ab78f1129d2d04b0af21e9b38da027dfe3d1295
parent 7beab9d5
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -474,4 +474,23 @@
        <item>2</item>
        <item>2</item>
        <item>4</item>
        <item>4</item>
    </string-array>
    </string-array>

    <!-- Stylus Gestures -->
    <string-array name="gestures_entries" translatable="false">
        <item>@string/gestures_action_empty</item>
        <item>@string/gestures_action_home</item>
        <item>@string/gestures_action_back</item>
        <item>@string/gestures_action_menu</item>
        <item>@string/gestures_action_search</item>
        <item>@string/gestures_action_recent</item>
    </string-array>

    <string-array name="gestures_values" translatable="false">
        <item>1000</item>
        <item>1001</item>
        <item>1002</item>
        <item>1003</item>
        <item>1004</item>
        <item>1005</item>
    </string-array>
</resources>
</resources>
+25 −0
Original line number Original line Diff line number Diff line
@@ -895,4 +895,29 @@ two in order to insert additional control points. \'Remove\' deletes the selecte
    <!-- Stylus Icon -->
    <!-- Stylus Icon -->
    <string name="stylus_icon_enabled_title">Show icon when using stylus</string>
    <string name="stylus_icon_enabled_title">Show icon when using stylus</string>
    <string name="stylus_icon_enabled_summary">Show the pointer icon when hovering or drawing with the stylus</string>
    <string name="stylus_icon_enabled_summary">Show the pointer icon when hovering or drawing with the stylus</string>

    <!-- Stylus Gestures -->
    <string name="gestures_settings_title">Stylus gestures</string>
    <string name="category_spen_title">Stylus gestures</string>
    <string name="enable_subcat_title">Stylus</string>
    <string name="enable_spen_title_head">Enable gestures</string>
    <string name="enable_spen_summary_head">Use swipe gestures by holding down the stylus button</string>
    <string name="gestures_subcat_title">Gestures</string>
    <string name="gestures_left_spen_title_head">Left swipe</string>
    <string name="gestures_right_spen_title_head">Right swipe</string>
    <string name="gestures_up_spen_title_head">Up swipe</string>
    <string name="gestures_down_spen_title_head">Down swipe</string>
    <string name="gestures_long_spen_title_head">Long press</string>
    <string name="gestures_double_spen_title_head">Double tap</string>

    <!-- Gestures Options -->
    <string name="gestures_action_empty">No action</string>
    <string name="gestures_action_home">Home</string>
    <string name="gestures_action_back">Back</string>
    <string name="gestures_action_menu">Menu</string>
    <string name="gestures_action_search">Invoke search</string>
    <string name="gestures_action_recent">Recent apps</string>

    <!-- Stylus gestures -->
    <string name="stylus_app_not_installed">%s is not installed</string>
</resources>
</resources>
+74 −0
Original line number Original line Diff line number Diff line
<?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" >

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

        <!-- Enable -->
        <com.android.settings.cyanogenmod.SystemSettingCheckBoxPreference
            android:key="enable_stylus_gestures"
            android:summary="@string/enable_spen_summary_head"
            android:title="@string/enable_spen_title_head" />

    </PreferenceCategory>

    <!-- Gesture Actions -->
    <PreferenceCategory android:title="@string/gestures_subcat_title" >
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_left"
            android:persistent="false"
            android:title="@string/gestures_left_spen_title_head" />
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_right"
            android:persistent="false"
            android:title="@string/gestures_right_spen_title_head" />
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_up"
            android:persistent="false"
            android:title="@string/gestures_up_spen_title_head" />
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_down"
            android:persistent="false"
            android:title="@string/gestures_down_spen_title_head" />
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_long"
            android:persistent="false"
            android:title="@string/gestures_long_spen_title_head" />
        <ListPreference
            android:dependency="enable_stylus_gestures"
            android:entries="@array/gestures_entries"
            android:entryValues="@array/gestures_values"
            android:key="gestures_double"
            android:persistent="false"
            android:title="@string/gestures_double_spen_title_head" />
    </PreferenceCategory>

</PreferenceScreen>
+5 −0
Original line number Original line Diff line number Diff line
@@ -93,6 +93,11 @@
                android:title="@string/pointer_speed"
                android:title="@string/pointer_speed"
                android:dialogTitle="@string/pointer_speed" />
                android:dialogTitle="@string/pointer_speed" />


        <PreferenceScreen
                android:fragment="com.android.settings.inputmethod.StylusGestures"
                android:key="stylus_gestures"
                android:title="@string/gestures_settings_title" />

        <CheckBoxPreference android:key="stylus_icon_enabled"
        <CheckBoxPreference android:key="stylus_icon_enabled"
                android:title="@string/stylus_icon_enabled_title"
                android:title="@string/stylus_icon_enabled_title"
                android:summary="@string/stylus_icon_enabled_summary"
                android:summary="@string/stylus_icon_enabled_summary"
+7 −1
Original line number Original line Diff line number Diff line
@@ -68,6 +68,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private static final String KEY_POINTER_SETTINGS_CATEGORY = "pointer_settings_category";
    private static final String KEY_POINTER_SETTINGS_CATEGORY = "pointer_settings_category";
    private static final String KEY_TRACKPAD_SETTINGS = "gesture_pad_settings";
    private static final String KEY_TRACKPAD_SETTINGS = "gesture_pad_settings";
    private static final String KEY_STYLUS_ICON_ENABLED = "stylus_icon_enabled";
    private static final String KEY_STYLUS_ICON_ENABLED = "stylus_icon_enabled";
    private static final String KEY_STYLUS_GESTURES = "stylus_gestures";


    // false: on ICS or later
    // false: on ICS or later
    private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;
    private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;
@@ -87,6 +88,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private PreferenceCategory mHardKeyboardCategory;
    private PreferenceCategory mHardKeyboardCategory;
    private PreferenceCategory mGameControllerCategory;
    private PreferenceCategory mGameControllerCategory;
    private Preference mLanguagePref;
    private Preference mLanguagePref;
    private PreferenceScreen mStylusGestures;
    private final ArrayList<InputMethodPreference> mInputMethodPreferenceList =
    private final ArrayList<InputMethodPreference> mInputMethodPreferenceList =
            new ArrayList<InputMethodPreference>();
            new ArrayList<InputMethodPreference>();
    private final ArrayList<PreferenceScreen> mHardKeyboardPreferenceList =
    private final ArrayList<PreferenceScreen> mHardKeyboardPreferenceList =
@@ -175,11 +177,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
        mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE);
        mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE);
        updateInputDevices();
        updateInputDevices();


        mStylusGestures = (PreferenceScreen) findPreference(KEY_STYLUS_GESTURES);
        mStylusIconEnabled = (CheckBoxPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
        mStylusIconEnabled = (CheckBoxPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
        // remove stylus preference for non stylus devices
        if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
        if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
            PreferenceCategory pointerSettingsCategory = (PreferenceCategory)
            PreferenceCategory pointerSettingsCategory = (PreferenceCategory)
                    findPreference(KEY_POINTER_SETTINGS_CATEGORY);
                    findPreference(KEY_POINTER_SETTINGS_CATEGORY);
            if (pointerSettingsCategory != null) {
            if (pointerSettingsCategory != null) {
                pointerSettingsCategory.removePreference(mStylusGestures);
                pointerSettingsCategory.removePreference(mStylusIconEnabled);
                Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(getActivity(),
                Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(getActivity(),
                        pointerSettingsCategory, KEY_TRACKPAD_SETTINGS);
                        pointerSettingsCategory, KEY_TRACKPAD_SETTINGS);
            }
            }
Loading