Enabled appear and dissappear animations for the overflow card
Bug: 21651647 Change-Id: I0732cb27ec8f88ae74fcff11340092879ba8bae3
This commit is contained in:
@@ -540,9 +540,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
|
||||
private void startAppearAnimation(boolean isAppearing, float translationDirection, long delay,
|
||||
long duration, final Runnable onFinishedRunnable) {
|
||||
if (mAppearAnimator != null) {
|
||||
mAppearAnimator.cancel();
|
||||
}
|
||||
cancelAppearAnimation();
|
||||
mAnimationTranslationY = translationDirection * getActualHeight();
|
||||
if (mAppearAnimationFraction == -1.0f) {
|
||||
// not initialized yet, we start anew
|
||||
@@ -613,6 +611,17 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
mAppearAnimator.start();
|
||||
}
|
||||
|
||||
private void cancelAppearAnimation() {
|
||||
if (mAppearAnimator != null) {
|
||||
mAppearAnimator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelAppearDrawing() {
|
||||
cancelAppearAnimation();
|
||||
enableAppearDrawing(false);
|
||||
}
|
||||
|
||||
private void updateAppearRect() {
|
||||
float inverseFraction = (1.0f - mAppearAnimationFraction);
|
||||
float translationFraction = mCurrentAppearInterpolator.getInterpolation(inverseFraction);
|
||||
|
||||
@@ -1840,11 +1840,8 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
}
|
||||
|
||||
if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
|
||||
mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mKeyguardIconOverflowContainer.setVisibility(View.GONE);
|
||||
}
|
||||
mStackScroller.updateOverflowContainerVisibility(onKeyguard
|
||||
&& mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0);
|
||||
|
||||
mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
|
||||
mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2);
|
||||
|
||||
@@ -43,6 +43,7 @@ public abstract class ExpandableView extends FrameLayout {
|
||||
private ArrayList<View> mMatchParentViews = new ArrayList<View>();
|
||||
private int mClipTopOptimization;
|
||||
private static Rect mClipRect = new Rect();
|
||||
private boolean mWillBeGone;
|
||||
|
||||
public ExpandableView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -374,6 +375,14 @@ public abstract class ExpandableView extends FrameLayout {
|
||||
updateClipping();
|
||||
}
|
||||
|
||||
public boolean willBeGone() {
|
||||
return mWillBeGone;
|
||||
}
|
||||
|
||||
public void setWillBeGone(boolean willBeGone) {
|
||||
mWillBeGone = willBeGone;
|
||||
}
|
||||
|
||||
/**
|
||||
* A listener notifying when {@link #getActualHeight} changes.
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,6 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
||||
protected View mContent;
|
||||
private boolean mIsVisible;
|
||||
private boolean mAnimating;
|
||||
private boolean mWillBeGone;
|
||||
|
||||
public StackScrollerDecorView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -134,13 +133,5 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
||||
mContent.animate().cancel();
|
||||
}
|
||||
|
||||
public boolean willBeGone() {
|
||||
return mWillBeGone;
|
||||
}
|
||||
|
||||
public void setWillBeGone(boolean willBeGone) {
|
||||
mWillBeGone = willBeGone;
|
||||
}
|
||||
|
||||
protected abstract View findContentView();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
@@ -707,7 +706,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
R.layout.status_bar_notification_keyguard_overflow, mStackScroller, false);
|
||||
mKeyguardIconOverflowContainer.setOnActivatedListener(this);
|
||||
mKeyguardIconOverflowContainer.setOnClickListener(mOverflowClickListener);
|
||||
mStackScroller.addView(mKeyguardIconOverflowContainer);
|
||||
mStackScroller.setOverflowContainer(mKeyguardIconOverflowContainer);
|
||||
|
||||
SpeedBumpView speedBump = (SpeedBumpView) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.status_bar_notification_speed_bump, mStackScroller, false);
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.android.systemui.statusbar.EmptyShadeView;
|
||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.ExpandableView;
|
||||
import com.android.systemui.statusbar.NotificationData;
|
||||
import com.android.systemui.statusbar.NotificationOverflowContainer;
|
||||
import com.android.systemui.statusbar.SpeedBumpView;
|
||||
import com.android.systemui.statusbar.StackScrollerDecorView;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
@@ -226,6 +227,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
private boolean mTrackingHeadsUp;
|
||||
private ScrimController mScrimController;
|
||||
private boolean mForceNoOverlappingRendering;
|
||||
private NotificationOverflowContainer mOverflowContainer;
|
||||
|
||||
public NotificationStackScrollLayout(Context context) {
|
||||
this(context, null);
|
||||
@@ -1368,17 +1370,11 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
int childCount = getChildCount();
|
||||
int count = 0;
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View child = getChildAt(i);
|
||||
if (child.getVisibility() != View.GONE) {
|
||||
ExpandableView child = (ExpandableView) getChildAt(i);
|
||||
if (child.getVisibility() != View.GONE && !child.willBeGone()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (mDismissView.willBeGone()) {
|
||||
count--;
|
||||
}
|
||||
if (mEmptyShadeView.willBeGone()) {
|
||||
count--;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -2470,7 +2466,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mEmptyShadeView.setVisibility(newVisibility);
|
||||
mEmptyShadeView.setWillBeGone(false);
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mDismissView);
|
||||
notifyHeightChangeListener(mEmptyShadeView);
|
||||
} else {
|
||||
Runnable onFinishedRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -2478,7 +2474,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mEmptyShadeView.setVisibility(GONE);
|
||||
mEmptyShadeView.setWillBeGone(false);
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mDismissView);
|
||||
notifyHeightChangeListener(mEmptyShadeView);
|
||||
}
|
||||
};
|
||||
if (mAnimationsEnabled) {
|
||||
@@ -2492,6 +2488,45 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverflowContainer(NotificationOverflowContainer overFlowContainer) {
|
||||
mOverflowContainer = overFlowContainer;
|
||||
addView(mOverflowContainer);
|
||||
}
|
||||
|
||||
public void updateOverflowContainerVisibility(boolean visible) {
|
||||
int oldVisibility = mOverflowContainer.willBeGone() ? GONE
|
||||
: mOverflowContainer.getVisibility();
|
||||
final int newVisibility = visible ? VISIBLE : GONE;
|
||||
if (oldVisibility != newVisibility) {
|
||||
Runnable onFinishedRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mOverflowContainer.setVisibility(newVisibility);
|
||||
mOverflowContainer.setWillBeGone(false);
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mOverflowContainer);
|
||||
}
|
||||
};
|
||||
if (!mAnimationsEnabled || !mIsExpanded) {
|
||||
mOverflowContainer.cancelAppearDrawing();
|
||||
onFinishedRunnable.run();
|
||||
} else if (newVisibility != GONE) {
|
||||
mOverflowContainer.performAddAnimation(0,
|
||||
StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||
mOverflowContainer.setVisibility(newVisibility);
|
||||
mOverflowContainer.setWillBeGone(false);
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mOverflowContainer);
|
||||
} else {
|
||||
mOverflowContainer.performRemoveAnimation(
|
||||
StackStateAnimator.ANIMATION_DURATION_STANDARD,
|
||||
0.0f,
|
||||
onFinishedRunnable);
|
||||
mOverflowContainer.setWillBeGone(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDismissView(boolean visible) {
|
||||
int oldVisibility = mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
|
||||
int newVisibility = visible ? VISIBLE : GONE;
|
||||
|
||||
@@ -210,7 +210,10 @@ public class StackScrollState {
|
||||
int oldVisibility = view.getVisibility();
|
||||
int newVisibility = becomesInvisible ? View.INVISIBLE : View.VISIBLE;
|
||||
if (newVisibility != oldVisibility) {
|
||||
view.setVisibility(newVisibility);
|
||||
if (!(view instanceof ExpandableView) || !((ExpandableView) view).willBeGone()) {
|
||||
// We don't want views to change visibility when they are animating to GONE
|
||||
view.setVisibility(newVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
// apply yTranslation
|
||||
|
||||
@@ -284,6 +284,10 @@ public class StackStateAnimator {
|
||||
boolean scaleChanging = child.getScaleX() != viewState.scale;
|
||||
float childAlpha = child.getVisibility() == View.INVISIBLE ? 0.0f : child.getAlpha();
|
||||
boolean alphaChanging = viewState.alpha != childAlpha;
|
||||
if (child instanceof ExpandableView) {
|
||||
// We don't want views to change visibility when they are animating to GONE
|
||||
alphaChanging &= !((ExpandableView) child).willBeGone();
|
||||
}
|
||||
|
||||
// start translationY animation
|
||||
if (yTranslationChanging) {
|
||||
|
||||
Reference in New Issue
Block a user