mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Tune AllApps bottom sheet VisD and motion
- Make AllApps bottom sheet solid and appears from bottom - Teleport AllApps bottom sheet as user drag to reduce drag range - Consider teleport interpolation for state transition sdetection - Tuned workspace motions for AllApps bottom sheet (no translate, shrink) - Add portrait vertical translate for tablet portrait including taskbar AllApps - Updated bottom sheet handle and created common variables for other bottom sheets Bug: 208599118 Test: manual on tablet AllApps, taskbar Allapps and handheld AllApps Change-Id: I69dba5f155914cd012cc8ef3be1ef71fb2be5a40
This commit is contained in:
@@ -113,9 +113,16 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the range in height that the slide in view can be dragged.
|
||||
*/
|
||||
protected float getShiftRange() {
|
||||
return mContent.getHeight();
|
||||
}
|
||||
|
||||
protected void setTranslationShift(float translationShift) {
|
||||
mTranslationShift = translationShift;
|
||||
mContent.setTranslationY(mTranslationShift * mContent.getHeight());
|
||||
mContent.setTranslationY(mTranslationShift * getShiftRange());
|
||||
if (mColorScrim != null) {
|
||||
mColorScrim.setAlpha(1 - mTranslationShift);
|
||||
}
|
||||
@@ -132,8 +139,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
||||
mSwipeDetector.setDetectableScrollConditions(
|
||||
directionsToDetectScroll, false);
|
||||
mSwipeDetector.onTouchEvent(ev);
|
||||
return mSwipeDetector.isDraggingOrSettling()
|
||||
|| !getPopupContainer().isEventOverView(mContent, ev);
|
||||
return mSwipeDetector.isDraggingOrSettling() || !isEventOverContent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,13 +148,23 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
||||
if (ev.getAction() == MotionEvent.ACTION_UP && mSwipeDetector.isIdleState()
|
||||
&& !isOpeningAnimationRunning()) {
|
||||
// If we got ACTION_UP without ever starting swipe, close the panel.
|
||||
if (!getPopupContainer().isEventOverView(mContent, ev)) {
|
||||
if (!isEventOverContent(ev)) {
|
||||
close(true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the touch event is over the visible area of the bottom sheet.
|
||||
*
|
||||
* By default will check if the touch event is over {@code mContent}, subclasses should override
|
||||
* this method if the visible area of the bottom sheet is different from {@code mContent}.
|
||||
*/
|
||||
protected boolean isEventOverContent(MotionEvent ev) {
|
||||
return getPopupContainer().isEventOverView(mContent, ev);
|
||||
}
|
||||
|
||||
private boolean isOpeningAnimationRunning() {
|
||||
return mIsOpen && mOpenCloseAnimator.isRunning();
|
||||
}
|
||||
@@ -160,7 +176,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
||||
|
||||
@Override
|
||||
public boolean onDrag(float displacement) {
|
||||
float range = mContent.getHeight();
|
||||
float range = getShiftRange();
|
||||
displacement = Utilities.boundToRange(displacement, 0, range);
|
||||
setTranslationShift(displacement / range);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user