Merge "Show promise app icon in All Apps while installation process." into ub-launcher3-master
diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml
index 5c2e230..4067503 100644
--- a/res/layout/widgets_list_row_view.xml
+++ b/res/layout/widgets_list_row_view.xml
@@ -34,7 +34,6 @@
android:ellipsize="end"
android:focusable="true"
android:gravity="start|center_vertical"
- android:importantForAccessibility="no"
android:paddingBottom="@dimen/widget_section_vertical_padding"
android:paddingLeft="@dimen/widget_section_horizontal_padding"
android:paddingRight="@dimen/widget_section_horizontal_padding"
diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/AppInfo.java
index 0ddde73..2a62037 100644
--- a/src/com/android/launcher3/AppInfo.java
+++ b/src/com/android/launcher3/AppInfo.java
@@ -44,7 +44,7 @@
public int isDisabled = ShortcutInfo.DEFAULT;
public AppInfo() {
- itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT;
+ itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
}
@Override
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a69f501..d5baabf 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -176,11 +176,9 @@
protected static final int REQUEST_LAST = 100;
private static final int SOFT_INPUT_MODE_DEFAULT =
- WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
- | WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;
+ WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
private static final int SOFT_INPUT_MODE_ALL_APPS =
- WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
- | WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;
+ WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
// The Intent extra that defines whether to ignore the launch animation
static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 15bdea9..bce13bc 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -135,7 +135,7 @@
@Thunk final ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
- private FolderAnimationManager mFolderAnimationManager;
+ private AnimatorSet mCurrentAnimator;
private final int mExpandDuration;
public final int mMaterialExpandDuration;
@@ -479,8 +479,6 @@
}
}
});
-
- mFolderAnimationManager = new FolderAnimationManager(this);
}
/**
@@ -516,7 +514,30 @@
mState = STATE_SMALL;
}
- private AnimatorSet getOpeningAnimatorSet() {
+ private void startAnimation(final AnimatorSet a) {
+ long startTime = 0;
+ if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
+ // This allows a nice transition when closing a Folder while it is still animating open.
+ startTime = mCurrentAnimator.getDuration() - mCurrentAnimator.getCurrentPlayTime();
+ mCurrentAnimator.cancel();
+ }
+ a.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ mState = STATE_ANIMATING;
+ mCurrentAnimator = a;
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mCurrentAnimator = null;
+ }
+ });
+ a.setCurrentPlayTime(startTime);
+ a.start();
+ }
+
+ private AnimatorSet getOpeningAnimator() {
prepareReveal();
mFolderIcon.growAndFadeOut();
@@ -613,8 +634,8 @@
centerAboutIcon();
AnimatorSet anim = FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION
- ? mFolderAnimationManager.getOpeningAnimator()
- : getOpeningAnimatorSet();
+ ? new FolderAnimationManager(this, true /* isOpening */).getAnimator()
+ : getOpeningAnimator();
onCompleteRunnable = new Runnable() {
@Override
public void run() {
@@ -624,11 +645,14 @@
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
+ if (FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION) {
+ mFolderIcon.setVisibility(INVISIBLE);
+ }
+
Utilities.sendCustomAccessibilityEvent(
Folder.this,
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
mContent.getAccessibilityDescription());
- mState = STATE_ANIMATING;
}
@Override
public void onAnimationEnd(Animator animation) {
@@ -674,7 +698,7 @@
}
mPageIndicator.stopAllAnimations();
- anim.start();
+ startAnimation(anim);
// Make sure the folder picks up the last drag move even if the finger doesn't move.
if (mDragController.isDragging()) {
@@ -730,7 +754,7 @@
parent.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
}
- private AnimatorSet getClosingAnimatorSet() {
+ private AnimatorSet getClosingAnimator() {
AnimatorSet animatorSet = LauncherAnimUtils.createAnimatorSet();
animatorSet.play(LauncherAnimUtils.ofViewAlphaAndScale(this, 0, 0.9f, 0.9f));
@@ -743,8 +767,8 @@
private void animateClosed() {
AnimatorSet a = FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION
- ? mFolderAnimationManager.getClosingAnimator()
- : getClosingAnimatorSet();
+ ? new FolderAnimationManager(this, false /* isOpening */).getAnimator()
+ : getClosingAnimator();
a.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -756,10 +780,9 @@
Folder.this,
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
getContext().getString(R.string.folder_closed));
- mState = STATE_ANIMATING;
}
});
- a.start();
+ startAnimation(a);
}
private void closeComplete(boolean wasAnimated) {
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 6ce572d..c1c974c 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -62,7 +62,8 @@
private Context mContext;
private Launcher mLauncher;
- private Animator mRevealAnimator;
+ private final boolean mIsOpening;
+
private final TimeInterpolator mOpeningInterpolator;
private final TimeInterpolator mClosingInterpolator;
private final TimeInterpolator mPreviewItemOpeningInterpolator;
@@ -102,7 +103,7 @@
}
};
- public FolderAnimationManager(Folder folder) {
+ public FolderAnimationManager(Folder folder, boolean isOpening) {
mFolder = folder;
mContent = folder.mContent;
mFolderBackground = (GradientDrawable) mFolder.getBackground();
@@ -113,6 +114,8 @@
mContext = folder.getContext();
mLauncher = folder.mLauncher;
+ mIsOpening = isOpening;
+
mOpeningInterpolator = AnimationUtils.loadInterpolator(mContext,
R.interpolator.folder_opening_interpolator);
mClosingInterpolator = AnimationUtils.loadInterpolator(mContext,
@@ -123,31 +126,11 @@
R.interpolator.folder_preview_item_closing_interpolator);
}
- public AnimatorSet getOpeningAnimator() {
- mFolder.setPivotX(0);
- mFolder.setPivotY(0);
-
- AnimatorSet a = getAnimatorSet(true /* isOpening */);
- a.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mFolderIcon.setVisibility(View.INVISIBLE);
- }
- });
- return a;
- }
-
- public AnimatorSet getClosingAnimator() {
- AnimatorSet a = getAnimatorSet(false /* isOpening */);
- return a;
- }
/**
* Prepares the Folder for animating between open / closed states.
- *
- * @param isOpening If true, return the animator set for the opening animation.
*/
- private AnimatorSet getAnimatorSet(final boolean isOpening) {
+ public AnimatorSet getAnimator() {
final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) mFolder.getLayoutParams();
FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule();
final List<BubbleTextView> itemsInPreview = mFolderIcon.getItemsToDisplay();
@@ -159,9 +142,11 @@
final float initialScale = folderScale;
final float finalScale = 1f;
- float scale = isOpening ? initialScale : finalScale;
+ float scale = mIsOpening ? initialScale : finalScale;
mFolder.setScaleX(scale);
mFolder.setScaleY(scale);
+ mFolder.setPivotX(0);
+ mFolder.setPivotY(0);
// Match position of the FolderIcon
final Rect folderIconPos = new Rect();
@@ -189,45 +174,14 @@
final int finalColor = Themes.getAttrColor(mContext, android.R.attr.colorPrimary);
final int initialColor =
ColorUtils.setAlphaComponent(finalColor, mPreviewBackground.getBackgroundAlpha());
- mFolderBackground.setColor(isOpening ? initialColor : finalColor);
+ mFolderBackground.setColor(mIsOpening ? initialColor : finalColor);
// Initialize the Folder items' text.
- final List<BubbleTextView> itemsOnCurrentPage = mFolder.getItemsOnCurrentPage();
+ final List<BubbleTextView> items = mFolder.getItemsOnCurrentPage();
final int finalTextColor = Themes.getAttrColor(mContext, android.R.attr.textColorSecondary);
- ITEMS_TEXT_COLOR_PROPERTY.set(itemsOnCurrentPage, isOpening ? Color.TRANSPARENT
+ ITEMS_TEXT_COLOR_PROPERTY.set(items, mIsOpening ? Color.TRANSPARENT
: finalTextColor);
- // Create the animators.
- AnimatorSet a = LauncherAnimUtils.createAnimatorSet();
- a.setDuration(mFolder.mMaterialExpandDuration);
-
- ObjectAnimator translationX = isOpening
- ? ObjectAnimator.ofFloat(mFolder, View.TRANSLATION_X, xDistance, 0)
- : ObjectAnimator.ofFloat(mFolder, View.TRANSLATION_X, 0, xDistance);
- a.play(translationX);
-
- ObjectAnimator translationY = isOpening
- ? ObjectAnimator.ofFloat(mFolder, View.TRANSLATION_Y, yDistance, 0)
- : ObjectAnimator.ofFloat(mFolder, View.TRANSLATION_Y, 0, yDistance);
- a.play(translationY);
-
- ObjectAnimator scaleAnimator = isOpening
- ? ObjectAnimator.ofFloat(mFolder, SCALE_PROPERTY, initialScale, finalScale)
- : ObjectAnimator.ofFloat(mFolder, SCALE_PROPERTY, finalScale, initialScale);
- a.play(scaleAnimator);
-
- ObjectAnimator itemsTextColor = isOpening
- ? ObjectAnimator.ofArgb(itemsOnCurrentPage, ITEMS_TEXT_COLOR_PROPERTY,
- Color.TRANSPARENT, finalTextColor)
- : ObjectAnimator.ofArgb(itemsOnCurrentPage, ITEMS_TEXT_COLOR_PROPERTY,
- finalTextColor, Color.TRANSPARENT);
- a.play(itemsTextColor);
-
- ObjectAnimator backgroundColor = isOpening
- ? ObjectAnimator.ofArgb(mFolderBackground, "color", initialColor, finalColor)
- : ObjectAnimator.ofArgb(mFolderBackground, "color", finalColor, initialColor);
- a.play(backgroundColor);
-
// Set up the reveal animation that clips the Folder.
float stroke = mPreviewBackground.getStrokeWidth();
int initialSize = (int) ((mFolderIcon.mBackground.getRadius() * 2 + stroke) / folderScale);
@@ -236,50 +190,52 @@
Rect startRect = new Rect(totalOffsetX + unscaledStroke, unscaledStroke,
totalOffsetX + initialSize, initialSize);
Rect endRect = new Rect(0, 0, lp.width, lp.height);
- a.play(getRevealAnimator(isOpening, initialSize / 2f, startRect, endRect));
+ float finalRadius = Utilities.pxFromDp(2, mContext.getResources().getDisplayMetrics());
+
+ // Create the animators.
+ AnimatorSet a = LauncherAnimUtils.createAnimatorSet();
+ a.setDuration(mFolder.mMaterialExpandDuration);
+
+ a.play(getAnimator(mFolder, View.TRANSLATION_X, xDistance, 0f));
+ a.play(getAnimator(mFolder, View.TRANSLATION_Y, yDistance, 0f));
+ a.play(getAnimator(mFolder, SCALE_PROPERTY, initialScale, finalScale));
+ a.play(getAnimator(items, ITEMS_TEXT_COLOR_PROPERTY, Color.TRANSPARENT, finalTextColor));
+ a.play(getAnimator(mFolderBackground, "color", initialColor, finalColor));
+ a.play(new RoundedRectRevealOutlineProvider(initialSize / 2f, finalRadius, startRect,
+ endRect).createRevealAnimator(mFolder, !mIsOpening));
a.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- ITEMS_TEXT_COLOR_PROPERTY.set(itemsOnCurrentPage, finalTextColor);
+ ITEMS_TEXT_COLOR_PROPERTY.set(items, finalTextColor);
+ mFolder.setTranslationX(0.0f);
+ mFolder.setTranslationY(0.0f);
+ mFolder.setScaleX(1f);
+ mFolder.setScaleY(1f);
}
});
// We set the interpolator on all current child animators here, because the preview item
// animators may use a different interpolator.
for (Animator animator : a.getChildAnimations()) {
- animator.setInterpolator(isOpening ? mOpeningInterpolator : mClosingInterpolator);
+ animator.setInterpolator(mIsOpening ? mOpeningInterpolator : mClosingInterpolator);
}
- addPreviewItemAnimatorsToSet(a, isOpening, folderScale, nudgeOffsetX);
+ addPreviewItemAnimatorsToSet(a, folderScale, nudgeOffsetX);
return a;
}
- private Animator getRevealAnimator(boolean isOpening, float circleRadius, Rect start,
- Rect end) {
- boolean revealIsRunning = mRevealAnimator != null && mRevealAnimator.isRunning();
- final float finalRadius = revealIsRunning
- ? ((RoundedRectRevealOutlineProvider) mFolder.getOutlineProvider()).getRadius()
- : Utilities.pxFromDp(2, mContext.getResources().getDisplayMetrics());
- if (revealIsRunning) {
- mRevealAnimator.cancel();
- }
- mRevealAnimator = new RoundedRectRevealOutlineProvider(circleRadius, finalRadius,
- start, end).createRevealAnimator(mFolder, !isOpening);
- return mRevealAnimator;
- }
-
/**
* Animate the items that are displayed in the preview.
*/
- private void addPreviewItemAnimatorsToSet(AnimatorSet animatorSet, boolean isOpening,
- final float folderScale, int nudgeOffsetX) {
+ private void addPreviewItemAnimatorsToSet(AnimatorSet animatorSet, final float folderScale,
+ int nudgeOffsetX) {
FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule();
final List<BubbleTextView> itemsInPreview = mFolderIcon.getItemsToDisplay();
final int numItemsInPreview = itemsInPreview.size();
- TimeInterpolator previewItemInterpolator = getPreviewItemInterpolator(isOpening);
+ TimeInterpolator previewItemInterpolator = getPreviewItemInterpolator();
ShortcutAndWidgetContainer cwc = mContent.getPageAt(0).getShortcutsAndWidgets();
for (int i = 0; i < numItemsInPreview; ++i) {
@@ -297,7 +253,7 @@
final float initialScale = iconScale / folderScale;
final float finalScale = 1f;
- float scale = isOpening ? initialScale : finalScale;
+ float scale = mIsOpening ? initialScale : finalScale;
btv.setScaleX(scale);
btv.setScaleY(scale);
@@ -314,21 +270,15 @@
final float xDistance = previewPosX - btvLp.x;
final float yDistance = previewPosY - btvLp.y;
- ObjectAnimator translationX = isOpening
- ? ObjectAnimator.ofFloat(btv, View.TRANSLATION_X, xDistance, 0)
- : ObjectAnimator.ofFloat(btv, View.TRANSLATION_X, 0, xDistance);
+ Animator translationX = getAnimator(btv, View.TRANSLATION_X, xDistance, 0f);
translationX.setInterpolator(previewItemInterpolator);
animatorSet.play(translationX);
- ObjectAnimator translationY = isOpening
- ? ObjectAnimator.ofFloat(btv, View.TRANSLATION_Y, yDistance, 0)
- : ObjectAnimator.ofFloat(btv, View.TRANSLATION_Y, 0, yDistance);
+ Animator translationY = getAnimator(btv, View.TRANSLATION_Y, yDistance, 0f);
translationY.setInterpolator(previewItemInterpolator);
animatorSet.play(translationY);
- ObjectAnimator scaleAnimator = isOpening
- ? ObjectAnimator.ofFloat(btv, SCALE_PROPERTY, initialScale, finalScale)
- : ObjectAnimator.ofFloat(btv, SCALE_PROPERTY, finalScale, initialScale);
+ Animator scaleAnimator = getAnimator(btv, SCALE_PROPERTY, initialScale, finalScale);
scaleAnimator.setInterpolator(previewItemInterpolator);
animatorSet.play(scaleAnimator);
@@ -345,13 +295,31 @@
}
}
- private TimeInterpolator getPreviewItemInterpolator(boolean isOpening) {
+ private TimeInterpolator getPreviewItemInterpolator() {
if (mFolder.getItemCount() > FolderIcon.NUM_ITEMS_IN_PREVIEW) {
// With larger folders, we want the preview items to reach their final positions faster
// (when opening) and later (when closing) so that they appear aligned with the rest of
// the folder items when they are both visible.
- return isOpening ? mPreviewItemOpeningInterpolator : mPreviewItemClosingInterpolator;
+ return mIsOpening ? mPreviewItemOpeningInterpolator : mPreviewItemClosingInterpolator;
}
- return isOpening ? mOpeningInterpolator : mClosingInterpolator;
+ return mIsOpening ? mOpeningInterpolator : mClosingInterpolator;
+ }
+
+ private Animator getAnimator(View view, Property property, float v1, float v2) {
+ return mIsOpening
+ ? ObjectAnimator.ofFloat(view, property, v1, v2)
+ : ObjectAnimator.ofFloat(view, property, v2, v1);
+ }
+
+ private Animator getAnimator(List<BubbleTextView> items, Property property, int v1, int v2) {
+ return mIsOpening
+ ? ObjectAnimator.ofArgb(items, property, v1, v2)
+ : ObjectAnimator.ofArgb(items, property, v2, v1);
+ }
+
+ private Animator getAnimator(GradientDrawable drawable, String property, int v1, int v2) {
+ return mIsOpening
+ ? ObjectAnimator.ofArgb(drawable, property, v1, v2)
+ : ObjectAnimator.ofArgb(drawable, property, v2, v1);
}
}
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java
index 2e80341..1eef743 100644
--- a/src/com/android/launcher3/notification/NotificationFooterLayout.java
+++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java
@@ -198,15 +198,17 @@
// There are no more icons in the footer, so hide it.
PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(
Launcher.getLauncher(getContext()));
- Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight(),
- getResources().getInteger(R.integer.config_removeNotificationViewDuration));
- collapseFooter.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- ((ViewGroup) getParent()).removeView(NotificationFooterLayout.this);
- }
- });
- collapseFooter.start();
+ if (popup != null) {
+ Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight(),
+ getResources().getInteger(R.integer.config_removeNotificationViewDuration));
+ collapseFooter.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ ((ViewGroup) getParent()).removeView(NotificationFooterLayout.this);
+ }
+ });
+ collapseFooter.start();
+ }
}
}
diff --git a/src/com/android/launcher3/notification/NotificationInfo.java b/src/com/android/launcher3/notification/NotificationInfo.java
index 77a18c7..58e2e03 100644
--- a/src/com/android/launcher3/notification/NotificationInfo.java
+++ b/src/com/android/launcher3/notification/NotificationInfo.java
@@ -20,6 +20,7 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
@@ -27,6 +28,7 @@
import android.view.View;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAppState;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.util.PackageUserKey;
@@ -53,8 +55,8 @@
public final boolean autoCancel;
public final boolean dismissable;
- private final int mBadgeIcon;
- private final Drawable mIconDrawable;
+ private int mBadgeIcon;
+ private Drawable mIconDrawable;
private int mIconColor;
private boolean mIsIconLarge;
@@ -82,6 +84,12 @@
mIconDrawable = icon.loadDrawable(context);
mIsIconLarge = true;
}
+ if (mIconDrawable == null) {
+ mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState
+ .getInstance(context).getIconCache()
+ .getDefaultIcon(statusBarNotification.getUser()));
+ mBadgeIcon = BADGE_ICON_NONE;
+ }
intent = notification.contentIntent;
autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0;
dismissable = (notification.flags & Notification.FLAG_ONGOING_EVENT) == 0;
diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java
index a340742..c6268e2 100644
--- a/src/com/android/launcher3/notification/NotificationItemView.java
+++ b/src/com/android/launcher3/notification/NotificationItemView.java
@@ -23,7 +23,6 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.android.launcher3.ItemInfo;
@@ -85,8 +84,6 @@
MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY));
initializeBackgroundClipping(true /* force */);
invalidate();
- } else {
- ((ViewGroup) getParent()).removeView(NotificationItemView.this);
}
}
});
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index b8d38f5..1eac076 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -568,7 +568,7 @@
R.integer.config_removeNotificationViewDuration);
final int spacing = getResources().getDimensionPixelSize(R.dimen.popup_items_spacing);
removeNotification.play(reduceNotificationViewHeight(
- mNotificationItemView.getHeight() + spacing, duration, mNotificationItemView));
+ mNotificationItemView.getHeight() + spacing, duration));
final View removeMarginView = mIsAboveIcon ? getItemViewAt(getItemCount() - 2)
: mNotificationItemView;
if (removeMarginView != null) {
@@ -588,6 +588,7 @@
@Override
public void onAnimationEnd(Animator animation) {
removeView(mNotificationItemView);
+ mNotificationItemView = null;
if (getItemCount() == 0) {
close(false);
return;
@@ -612,19 +613,19 @@
return LauncherAnimUtils.ofPropertyValuesHolder(
mArrow, new PropertyListBuilder().scale(scale).build());
}
+
/**
* Animates the height of the notification item and the translationY of other items accordingly.
*/
- public Animator reduceNotificationViewHeight(int heightToRemove, int duration,
- NotificationItemView notificationItem) {
+ public Animator reduceNotificationViewHeight(int heightToRemove, int duration) {
final int translateYBy = mIsAboveIcon ? heightToRemove : -heightToRemove;
AnimatorSet animatorSet = LauncherAnimUtils.createAnimatorSet();
- animatorSet.play(notificationItem.animateHeightRemoval(heightToRemove));
+ animatorSet.play(mNotificationItemView.animateHeightRemoval(heightToRemove));
PropertyResetListener<View, Float> resetTranslationYListener
= new PropertyResetListener<>(TRANSLATION_Y, 0f);
for (int i = 0; i < getItemCount(); i++) {
final PopupItemView itemView = getItemViewAt(i);
- if (!mIsAboveIcon && itemView == notificationItem) {
+ if (!mIsAboveIcon && itemView == mNotificationItemView) {
// The notification view is already in the right place when container is below icon.
continue;
}
@@ -647,10 +648,6 @@
return animatorSet;
}
- public Animator reduceNotificationViewHeight(int heightToRemove, int duration) {
- return reduceNotificationViewHeight(heightToRemove, duration, mNotificationItemView);
- }
-
@Override
public boolean supportsAppInfoDropTarget() {
return true;