Merge "Add haptic effect for the seekbar in Settings 4/n."
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.widget;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.CLOCK_TICK;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
@@ -48,6 +50,8 @@ public class LabeledSeekBar extends SeekBar {
|
||||
/** Labels for discrete progress values. */
|
||||
private String[] mLabels;
|
||||
|
||||
private int mLastProgress = -1;
|
||||
|
||||
public LabeledSeekBar(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, com.android.internal.R.attr.seekBarStyle);
|
||||
}
|
||||
@@ -118,6 +122,10 @@ public class LabeledSeekBar extends SeekBar {
|
||||
mOnSeekBarChangeListener.onProgressChanged(seekBar, progress, fromUser);
|
||||
sendClickEventForAccessibility(progress);
|
||||
}
|
||||
if (progress != mLastProgress) {
|
||||
seekBar.performHapticFeedback(CLOCK_TICK);
|
||||
mLastProgress = progress;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user