Exposing some private methods to easily customize widgets popup

Change-Id: Ie7bd879200b1f14d472ff03fd64429930651a39f
This commit is contained in:
Sunny Goyal
2018-07-13 11:03:04 -07:00
parent 0b74a7fe5e
commit db6cdb07e8
7 changed files with 29 additions and 19 deletions

View File

@@ -30,7 +30,6 @@ import android.view.animation.Interpolator;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.touch.SwipeDetector;
@@ -76,7 +75,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
mScrollInterpolator = Interpolators.SCROLL_CUBIC;
mSwipeDetector = new SwipeDetector(context, this, SwipeDetector.VERTICAL);
mOpenCloseAnimator = LauncherAnimUtils.ofPropertyValuesHolder(this);
mOpenCloseAnimator = ObjectAnimator.ofPropertyValuesHolder(this);
mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -103,7 +102,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
directionsToDetectScroll, false);
mSwipeDetector.onTouchEvent(ev);
return mSwipeDetector.isDraggingOrSettling()
|| !mLauncher.getDragLayer().isEventOverView(mContent, ev);
|| !getPopupContainer().isEventOverView(mContent, ev);
}
@Override
@@ -111,7 +110,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
mSwipeDetector.onTouchEvent(ev);
if (ev.getAction() == MotionEvent.ACTION_UP && mSwipeDetector.isIdleState()) {
// If we got ACTION_UP without ever starting swipe, close the panel.
if (!mLauncher.getDragLayer().isEventOverView(mContent, ev)) {
if (!getPopupContainer().isEventOverView(mContent, ev)) {
close(true);
}
}
@@ -178,6 +177,10 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
protected void onCloseComplete() {
mIsOpen = false;
mLauncher.getDragLayer().removeView(this);
getPopupContainer().removeView(this);
}
protected BaseDragLayer getPopupContainer() {
return mLauncher.getDragLayer();
}
}