Merge "Add haptic effect for the seekbar in Settings 3/n."
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.CLOCK_TICK;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
@@ -37,6 +39,7 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
|
||||
private boolean mRestoredOldState;
|
||||
|
||||
private boolean mTouchInProgress;
|
||||
private int mLastProgress = -1;
|
||||
|
||||
private ContentObserver mSpeedObserver = new ContentObserver(new Handler()) {
|
||||
@Override
|
||||
@@ -76,6 +79,10 @@ public class PointerSpeedPreference extends SeekBarDialogPreference implements
|
||||
if (!mTouchInProgress) {
|
||||
mIm.tryPointerSpeed(progress + InputManager.MIN_POINTER_SPEED);
|
||||
}
|
||||
if (progress != mLastProgress) {
|
||||
seekBar.performHapticFeedback(CLOCK_TICK);
|
||||
mLastProgress = progress;
|
||||
}
|
||||
}
|
||||
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
Reference in New Issue
Block a user