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

Commit c42a2696 authored by shaoweishen's avatar shaoweishen Committed by Automerger Merge Worker
Browse files

DO NOT MERGE: Downbranch merge conflict [Output Switcher] Refine seekbar...

DO NOT MERGE: Downbranch merge conflict [Output Switcher] Refine seekbar control am: 11a776a9 am: 4b4504dd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17686878



Change-Id: Id50c7546fadc6a47cfc4f894652f0d2d474082e0
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2abadaa7 4b4504dd
Loading
Loading
Loading
Loading
+10 −21
Original line number Original line Diff line number Diff line
@@ -26,8 +26,7 @@ import android.widget.SeekBar;
 * otherwise performs click.
 * otherwise performs click.
 */
 */
public class MediaOutputSeekbar extends SeekBar {
public class MediaOutputSeekbar extends SeekBar {
    private static final int DRAGGING_THRESHOLD = 20;
    private int mLastDownPosition = -1;
    private boolean mIsDragging = false;


    public MediaOutputSeekbar(Context context) {
    public MediaOutputSeekbar(Context context) {
        super(context);
        super(context);
@@ -39,27 +38,17 @@ public class MediaOutputSeekbar extends SeekBar {


    @Override
    @Override
    public boolean onTouchEvent(MotionEvent event) {
    public boolean onTouchEvent(MotionEvent event) {
        int width = getWidth()
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
                - getPaddingLeft()
            mLastDownPosition = Math.round(event.getX());
                - getPaddingRight();
        } else if (event.getAction() == MotionEvent.ACTION_UP) {
        int thumbPos = getPaddingLeft()
            if (mLastDownPosition == event.getX()) {
                + width
                * getProgress()
                / getMax();
        if (event.getAction() == MotionEvent.ACTION_DOWN
                && Math.abs(event.getX() - thumbPos) < DRAGGING_THRESHOLD) {
            mIsDragging = true;
            super.onTouchEvent(event);
        } else if (event.getAction() == MotionEvent.ACTION_MOVE && mIsDragging) {
            super.onTouchEvent(event);
        } else if (event.getAction() == MotionEvent.ACTION_UP && mIsDragging) {
            mIsDragging = false;
            super.onTouchEvent(event);
        } else if (event.getAction() == MotionEvent.ACTION_UP && !mIsDragging) {
                performClick();
                performClick();
        }
                return true;
                return true;
            }
            }
            mLastDownPosition = -1;
        }
        return super.onTouchEvent(event);
    }


    @Override
    @Override
    public boolean performClick() {
    public boolean performClick() {