Merge changes I7b9e6e7f,I9729cd40 into sc-dev am: 51b35256d2 am: ae054d8584
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14800258 Change-Id: I775c0edcfe403c854a7c87104fa9aba78761f18d
This commit is contained in:
@@ -575,6 +575,14 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
mHotseat.getQsb().setAlpha(1f - visibility);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one handed mode activated and deactivated.
|
||||
* @param activated true if one handed mode activated, false otherwise.
|
||||
*/
|
||||
public void onOneHandedStateChanged(boolean activated) {
|
||||
mDragLayer.onOneHandedModeStateChanged(activated);
|
||||
}
|
||||
|
||||
private void initDeviceProfile(InvariantDeviceProfile idp) {
|
||||
// Load configuration-specific DeviceProfile
|
||||
mDeviceProfile = idp.getDeviceProfile(this);
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.graphics.Scrim;
|
||||
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -519,4 +520,14 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
public Scrim getWorkspaceDragScrim() {
|
||||
return mWorkspaceDragScrim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one handed mode state changed.
|
||||
* @param activated true if one handed mode activated, false otherwise.
|
||||
*/
|
||||
public void onOneHandedModeStateChanged(boolean activated) {
|
||||
for (TouchController controller : mControllers) {
|
||||
controller.onOneHandedModeStateChanged(activated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public class SingleAxisSwipeDetector extends BaseSwipeDetector {
|
||||
|
||||
private int mScrollDirections;
|
||||
|
||||
private float mTouchSlopMultiplier = 1f;
|
||||
|
||||
public SingleAxisSwipeDetector(@NonNull Context context, @NonNull Listener l,
|
||||
@NonNull Direction dir) {
|
||||
this(ViewConfiguration.get(context), l, dir, Utilities.isRtl(context.getResources()));
|
||||
@@ -115,6 +117,19 @@ public class SingleAxisSwipeDetector extends BaseSwipeDetector {
|
||||
mDir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides feasibility to adjust touch slop when visible window size changed. When visible
|
||||
* bounds translate become smaller, multiply a larger multiplier could ensure the UX
|
||||
* more consistent.
|
||||
*
|
||||
* @see #shouldScrollStart(PointF)
|
||||
*
|
||||
* @param touchSlopMultiplier the value to multiply original touch slop.
|
||||
*/
|
||||
public void setTouchSlopMultiplier(float touchSlopMultiplier) {
|
||||
mTouchSlopMultiplier = touchSlopMultiplier;
|
||||
}
|
||||
|
||||
public void setDetectableScrollConditions(int scrollDirectionFlags, boolean ignoreSlop) {
|
||||
mScrollDirections = scrollDirectionFlags;
|
||||
mIgnoreSlopWhenSettling = ignoreSlop;
|
||||
@@ -133,7 +148,7 @@ public class SingleAxisSwipeDetector extends BaseSwipeDetector {
|
||||
@Override
|
||||
protected boolean shouldScrollStart(PointF displacement) {
|
||||
// Reject cases where the angle or slop condition is not met.
|
||||
float minDisplacement = Math.max(mTouchSlop,
|
||||
float minDisplacement = Math.max(mTouchSlop * mTouchSlopMultiplier,
|
||||
Math.abs(mDir.extractOrthogonalDirection(displacement)));
|
||||
if (Math.abs(mDir.extractDirection(displacement)) < minDisplacement) {
|
||||
return false;
|
||||
|
||||
@@ -32,5 +32,10 @@ public interface TouchController {
|
||||
*/
|
||||
boolean onControllerInterceptTouchEvent(MotionEvent ev);
|
||||
|
||||
/**
|
||||
* Called when one handed mode state changed
|
||||
*/
|
||||
default void onOneHandedModeStateChanged(boolean activated) { }
|
||||
|
||||
default void dump(String prefix, PrintWriter writer) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user