зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1087673 - Enable tab history menu haptic feedback. r=bnicholson
This commit is contained in:
Родитель
d7fbacd663
Коммит
0ca1738d9a
|
@ -529,6 +529,7 @@ public class BrowserApp extends GeckoApp
|
|||
public void run() {
|
||||
final TabHistoryFragment fragment = TabHistoryFragment.newInstance(historyPageList, toIndex);
|
||||
final FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
GeckoAppShell.vibrateOnHapticFeedbackEnabled(getResources().getInteger(R.integer.long_press_vibrate_msec));
|
||||
fragment.show(R.id.tab_history_panel, fragmentManager.beginTransaction(), TAB_HISTORY_FRAGMENT_TAG);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1415,6 +1415,13 @@ public class GeckoAppShell
|
|||
return (Vibrator) layerView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
}
|
||||
|
||||
// Vibrate only if haptic feedback is enabled.
|
||||
public static void vibrateOnHapticFeedbackEnabled(long milliseconds) {
|
||||
if (Settings.System.getInt(getContext().getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) > 0) {
|
||||
vibrate(milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapElementForJNI(stubName = "Vibrate1")
|
||||
public static void vibrate(long milliseconds) {
|
||||
sVibrationEndTime = System.nanoTime() + milliseconds * 1000000;
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
<integer name="number_of_top_sites">6</integer>
|
||||
<integer name="number_of_top_sites_cols">2</integer>
|
||||
<integer name="max_icon_grid_columns">4</integer>
|
||||
<integer name="long_press_vibrate_msec">100</integer>
|
||||
|
||||
</resources>
|
||||
|
|
Загрузка…
Ссылка в новой задаче