Adding system wide long press timeout configurability under accessibility.
bug:3505096 Added an option in the accessibility set Change-Id: Ie36240229ca15a252d5f34051bfe8ac77a101da9
This commit is contained in:
@@ -511,4 +511,22 @@
|
|||||||
<item>silent</item>
|
<item>silent</item>
|
||||||
<item>notsilent</item>
|
<item>notsilent</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Titles for the list of long press timeout options. -->
|
||||||
|
<string-array name="long_press_timeout_selector_titles">
|
||||||
|
<!-- A title for the option for short long-press timeout [CHAR LIMIT=25] -->
|
||||||
|
<item>Short</item>
|
||||||
|
<!-- A title for the option for medium long-press timeout [CHAR LIMIT=25] -->
|
||||||
|
<item>Medium</item>
|
||||||
|
<!-- A title for the option for long long-press timeout [CHAR LIMIT=25] -->
|
||||||
|
<item>Long</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Valeus for the list of long press timeout options. -->
|
||||||
|
<string-array name="long_press_timeout_selector_values" translatable="false">
|
||||||
|
<item>500</item>
|
||||||
|
<item>1000</item>
|
||||||
|
<item>1500</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -33,4 +33,5 @@
|
|||||||
<item>@string/input_method_selector_always_show_value</item>
|
<item>@string/input_method_selector_always_show_value</item>
|
||||||
<item>@string/input_method_selector_always_hide_value</item>
|
<item>@string/input_method_selector_always_hide_value</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -2551,6 +2551,13 @@ found in the list of installed applications.</string>
|
|||||||
<!-- Accessibility settings: power button behavior summary text -->
|
<!-- Accessibility settings: power button behavior summary text -->
|
||||||
<string name="accessibility_power_button_ends_call_summary">During a call, pressing Power ends call instead of turning off screen</string>
|
<string name="accessibility_power_button_ends_call_summary">During a call, pressing Power ends call instead of turning off screen</string>
|
||||||
|
|
||||||
|
<!-- Setting interaction category [CHAR LIMIT=25] -->
|
||||||
|
<string name="accessibility_interaction_category">Interaction</string>
|
||||||
|
<!-- Title for setting the long-press timeout [CHAR LIMIT=35] -->
|
||||||
|
<string name="long_press_timeout_selector">Long press timeout</string>
|
||||||
|
<!-- The default value for the long press timeout. -->
|
||||||
|
<string name="long_press_timeout_selector_default_value" translatable="false">500</string>
|
||||||
|
|
||||||
<!-- App Fuel Gauge strings -->
|
<!-- App Fuel Gauge strings -->
|
||||||
<skip />
|
<skip />
|
||||||
|
|
||||||
|
@@ -44,4 +44,14 @@
|
|||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory android:key="accessibility_interaction_category"
|
||||||
|
android:title="@string/accessibility_interaction_category">
|
||||||
|
<ListPreference android:key="long_press_timeout_list_preference"
|
||||||
|
android:title="@string/long_press_timeout_selector"
|
||||||
|
android:persistent="true"
|
||||||
|
android:entries="@array/long_press_timeout_selector_titles"
|
||||||
|
android:entryValues="@array/long_press_timeout_selector_values"
|
||||||
|
android:defaultValue="@string/long_press_timeout_selector_default_value"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -26,6 +26,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
@@ -44,7 +45,8 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Activity with the accessibility settings.
|
* Activity with the accessibility settings.
|
||||||
*/
|
*/
|
||||||
public class AccessibilitySettings extends SettingsPreferenceFragment implements DialogCreatable {
|
public class AccessibilitySettings extends SettingsPreferenceFragment implements DialogCreatable,
|
||||||
|
Preference.OnPreferenceChangeListener {
|
||||||
private static final String DEFAULT_SCREENREADER_MARKET_LINK =
|
private static final String DEFAULT_SCREENREADER_MARKET_LINK =
|
||||||
"market://search?q=pname:com.google.android.marvin.talkback";
|
"market://search?q=pname:com.google.android.marvin.talkback";
|
||||||
|
|
||||||
@@ -66,6 +68,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
private final String KEY_TOGGLE_ACCESSIBILITY_SERVICE_CHECKBOX =
|
private final String KEY_TOGGLE_ACCESSIBILITY_SERVICE_CHECKBOX =
|
||||||
"key_toggle_accessibility_service_checkbox";
|
"key_toggle_accessibility_service_checkbox";
|
||||||
|
|
||||||
|
private final String KEY_LONG_PRESS_TIMEOUT_LIST_PREFERENCE =
|
||||||
|
"long_press_timeout_list_preference";
|
||||||
|
|
||||||
private static final int DIALOG_ID_DISABLE_ACCESSIBILITY = 1;
|
private static final int DIALOG_ID_DISABLE_ACCESSIBILITY = 1;
|
||||||
private static final int DIALOG_ID_ENABLE_SCRIPT_INJECTION = 2;
|
private static final int DIALOG_ID_ENABLE_SCRIPT_INJECTION = 2;
|
||||||
private static final int DIALOG_ID_ENABLE_ACCESSIBILITY_SERVICE = 3;
|
private static final int DIALOG_ID_ENABLE_ACCESSIBILITY_SERVICE = 3;
|
||||||
@@ -80,6 +85,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private PreferenceGroup mAccessibilityServicesCategory;
|
private PreferenceGroup mAccessibilityServicesCategory;
|
||||||
|
|
||||||
|
private ListPreference mLongPressTimeoutListPreference;
|
||||||
|
|
||||||
private Map<String, ServiceInfo> mAccessibilityServices =
|
private Map<String, ServiceInfo> mAccessibilityServices =
|
||||||
new LinkedHashMap<String, ServiceInfo>();
|
new LinkedHashMap<String, ServiceInfo>();
|
||||||
|
|
||||||
@@ -105,6 +112,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
mPowerButtonEndsCallCheckBox = (CheckBoxPreference) findPreference(
|
mPowerButtonEndsCallCheckBox = (CheckBoxPreference) findPreference(
|
||||||
POWER_BUTTON_ENDS_CALL_CHECKBOX);
|
POWER_BUTTON_ENDS_CALL_CHECKBOX);
|
||||||
|
|
||||||
|
mLongPressTimeoutListPreference = (ListPreference) findPreference(
|
||||||
|
KEY_LONG_PRESS_TIMEOUT_LIST_PREFERENCE);
|
||||||
|
|
||||||
// set the accessibility script injection category
|
// set the accessibility script injection category
|
||||||
boolean scriptInjectionEnabled = (Settings.Secure.getInt(getContentResolver(),
|
boolean scriptInjectionEnabled = (Settings.Secure.getInt(getContentResolver(),
|
||||||
Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION, 0) == 1);
|
Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION, 0) == 1);
|
||||||
@@ -128,6 +138,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
// this entire category is irrelevant.
|
// this entire category is irrelevant.
|
||||||
getPreferenceScreen().removePreference(mPowerButtonCategory);
|
getPreferenceScreen().removePreference(mPowerButtonCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mLongPressTimeoutListPreference.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -197,6 +209,16 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
if (preference == mLongPressTimeoutListPreference) {
|
||||||
|
int intValue = Integer.parseInt((String) newValue);
|
||||||
|
Settings.Secure.putInt(getContentResolver(),
|
||||||
|
Settings.Secure.LONG_PRESS_TIMEOUT, intValue);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores the instance state from <code>savedInstanceState</code>.
|
* Restores the instance state from <code>savedInstanceState</code>.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user