Merge "Revert "Temporary fix for Folders in battery saver mode."" into ub-launcher3-dorval
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 5e08c2a..b388d28 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/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 39c466d..1acc3b8 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -334,6 +334,12 @@
// This can hold unnecessary references to views.
cleanupAnimation();
pCb.onTransitionComplete();
+
+ revealView.setAlpha(1f);
+ revealView.setTranslationX(0f);
+ revealView.setTranslationY(0f);
+ contentView.setAlpha(1f);
+ contentView.setTranslationY(0f);
}
});
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;