Merge "Ignore drag action on the switch button of MasterSwitchPreference"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e337835c19
@@ -18,6 +18,7 @@ package com.android.settings.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Switch;
|
||||
@@ -81,6 +82,11 @@ public class MasterSwitchPreference extends RestrictedPreference {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Consumes move events to ignore drag actions.
|
||||
switchWidget.setOnTouchListener((v, event) -> {
|
||||
return event.getActionMasked() == MotionEvent.ACTION_MOVE;
|
||||
});
|
||||
}
|
||||
|
||||
mSwitch = (Switch) holder.findViewById(R.id.switchWidget);
|
||||
|
Reference in New Issue
Block a user