summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-07-13 11:03:04 -0700
committerSunny Goyal <sunnygoyal@google.com>2018-08-02 14:41:08 -0700
commitdb6cdb07e859e64edaee4d92dccfe1d0af5b232a (patch)
tree8f808d72852a5db8b115320e8c95e0718f3b8767
parent0b74a7fe5e132cb647b767b1ec2ada89a7a0c611 (diff)
downloadandroid_packages_apps_Trebuchet-db6cdb07e859e64edaee4d92dccfe1d0af5b232a.tar.gz
android_packages_apps_Trebuchet-db6cdb07e859e64edaee4d92dccfe1d0af5b232a.tar.bz2
android_packages_apps_Trebuchet-db6cdb07e859e64edaee4d92dccfe1d0af5b232a.zip
Exposing some private methods to easily customize widgets popup
Change-Id: Ie7bd879200b1f14d472ff03fd64429930651a39f
-rw-r--r--src/com/android/launcher3/notification/NotificationFooterLayout.java2
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java2
-rw-r--r--src/com/android/launcher3/shortcuts/DeepShortcutView.java4
-rw-r--r--src/com/android/launcher3/views/AbstractSlideInView.java13
-rw-r--r--src/com/android/launcher3/widget/BaseWidgetSheet.java13
-rw-r--r--src/com/android/launcher3/widget/WidgetsBottomSheet.java4
-rw-r--r--src/com/android/launcher3/widget/WidgetsFullSheet.java10
7 files changed, 29 insertions, 19 deletions
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java
index 1216a27be..66f525cb4 100644
--- a/src/com/android/launcher3/notification/NotificationFooterLayout.java
+++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java
@@ -157,7 +157,7 @@ public class NotificationFooterLayout extends FrameLayout {
Rect fromBounds = sTempRect;
firstNotification.getGlobalVisibleRect(fromBounds);
float scale = (float) toBounds.height() / fromBounds.height();
- Animator moveAndScaleIcon = LauncherAnimUtils.ofPropertyValuesHolder(firstNotification,
+ Animator moveAndScaleIcon = ObjectAnimator.ofPropertyValuesHolder(firstNotification,
new PropertyListBuilder().scale(scale).translationY(toBounds.top - fromBounds.top
+ (fromBounds.height() * scale - fromBounds.height()) / 2).build());
moveAndScaleIcon.addListener(new AnimatorListenerAdapter() {
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 635e04371..10be92551 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -84,7 +84,7 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource,
private final List<DeepShortcutView> mShortcuts = new ArrayList<>();
private final PointF mInterceptTouchDown = new PointF();
- private final Point mIconLastTouchPos = new Point();
+ protected final Point mIconLastTouchPos = new Point();
private final int mStartDragThreshold;
private final LauncherAccessibilityDelegate mAccessibilityDelegate;
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutView.java b/src/com/android/launcher3/shortcuts/DeepShortcutView.java
index 7d0ea7bb9..c856cdbe5 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutView.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutView.java
@@ -141,4 +141,8 @@ public class DeepShortcutView extends FrameLayout {
public View getIconView() {
return mIconView;
}
+
+ public ShortcutInfoCompat getDetail() {
+ return mDetail;
+ }
}
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index c8d14572e..59bea48c8 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -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();
}
}
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 10708d600..20c8876d2 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -71,7 +71,7 @@ abstract class BaseWidgetSheet extends AbstractSlideInView
}
@Override
- public final boolean onLongClick(View v) {
+ public boolean onLongClick(View v) {
if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
if (v instanceof WidgetCell) {
@@ -96,7 +96,7 @@ abstract class BaseWidgetSheet extends AbstractSlideInView
}
int[] loc = new int[2];
- mLauncher.getDragLayer().getLocationInDragLayer(image, loc);
+ getPopupContainer().getLocationInDragLayer(image, loc);
new PendingItemDragHelper(v).startDrag(
image.getBitmapBounds(), image.getBitmap().getWidth(), image.getWidth(),
@@ -119,13 +119,13 @@ abstract class BaseWidgetSheet extends AbstractSlideInView
}
protected void clearNavBarColor() {
- mLauncher.getSystemUiController().updateUiState(
+ getSystemUiController().updateUiState(
SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET, 0);
}
protected void setupNavBarColor() {
- boolean isSheetDark = Themes.getAttrBoolean(mLauncher, R.attr.isMainColorDark);
- mLauncher.getSystemUiController().updateUiState(
+ boolean isSheetDark = Themes.getAttrBoolean(getContext(), R.attr.isMainColorDark);
+ getSystemUiController().updateUiState(
SystemUiController.UI_STATE_WIDGET_BOTTOM_SHEET,
isSheetDark ? SystemUiController.FLAG_DARK_NAV : SystemUiController.FLAG_LIGHT_NAV);
}
@@ -145,4 +145,7 @@ abstract class BaseWidgetSheet extends AbstractSlideInView
protected abstract int getElementsRowCount();
+ protected SystemUiController getSystemUiController() {
+ return mLauncher.getSystemUiController();
+ }
}
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 5ce7e0453..4ba6b5b12 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -71,7 +71,7 @@ public class WidgetsBottomSheet extends BaseWidgetSheet implements Insettable {
onWidgetsBound();
- mLauncher.getDragLayer().addView(this);
+ getPopupContainer().addView(this);
mIsOpen = false;
animateOpen();
}
@@ -118,7 +118,7 @@ public class WidgetsBottomSheet extends BaseWidgetSheet implements Insettable {
LayoutInflater.from(getContext()).inflate(R.layout.widget_list_divider, parent, true);
}
- private WidgetCell addItemCell(ViewGroup parent) {
+ protected WidgetCell addItemCell(ViewGroup parent) {
WidgetCell widget = (WidgetCell) LayoutInflater.from(getContext()).inflate(
R.layout.widget_cell, parent, false);
diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java
index b49322832..2a7bb03aa 100644
--- a/src/com/android/launcher3/widget/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java
@@ -160,7 +160,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
private void open(boolean animate) {
if (animate) {
- if (mLauncher.getDragLayer().getInsets().bottom > 0) {
+ if (getPopupContainer().getInsets().bottom > 0) {
mContent.setAlpha(0);
setTranslationShift(VERTICAL_START_POSITION);
}
@@ -207,10 +207,10 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mNoIntercept = false;
RecyclerViewFastScroller scroller = mRecyclerView.getScrollbar();
if (scroller.getThumbOffsetY() >= 0 &&
- mLauncher.getDragLayer().isEventOverView(scroller, ev)) {
+ getPopupContainer().isEventOverView(scroller, ev)) {
mNoIntercept = true;
- } else if (mLauncher.getDragLayer().isEventOverView(mContent, ev)) {
- mNoIntercept = !mRecyclerView.shouldContainerScroll(ev, mLauncher.getDragLayer());
+ } else if (getPopupContainer().isEventOverView(mContent, ev)) {
+ mNoIntercept = !mRecyclerView.shouldContainerScroll(ev, getPopupContainer());
}
}
return super.onControllerInterceptTouchEvent(ev);
@@ -220,7 +220,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
WidgetsFullSheet sheet = (WidgetsFullSheet) launcher.getLayoutInflater()
.inflate(R.layout.widgets_full_sheet, launcher.getDragLayer(), false);
sheet.mIsOpen = true;
- launcher.getDragLayer().addView(sheet);
+ sheet.getPopupContainer().addView(sheet);
sheet.open(animate);
return sheet;
}