Merge "Fixed a bug that the notifications were not animating when reset" into lmp-mr1-dev

This commit is contained in:
Selim Cinek
2014-11-06 16:12:00 +00:00
committed by Android (Google) Code Review
5 changed files with 28 additions and 9 deletions

View File

@@ -59,7 +59,6 @@ import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Display;

View File

@@ -22,6 +22,7 @@ import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
@@ -68,6 +69,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
private NotificationGuts mGuts;
private StatusBarNotification mStatusBarNotification;
private boolean mIsHeadsUp;
public void setIconAnimationRunning(boolean running) {
setIconAnimationRunning(running, mPublicLayout);
@@ -122,6 +124,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
return mStatusBarNotification;
}
public void setHeadsUp(boolean isHeadsUp) {
mIsHeadsUp = isHeadsUp;
}
public interface ExpansionLogger {
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
}
@@ -147,20 +153,27 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mShowingPublicInitialized = false;
mIsSystemExpanded = false;
mExpansionDisabled = false;
mPublicLayout.reset();
mPrivateLayout.reset();
mPublicLayout.reset(mIsHeadsUp);
mPrivateLayout.reset(mIsHeadsUp);
resetHeight();
logExpansionEvent(false, wasExpanded);
}
public void resetHeight() {
super.resetHeight();
if (mIsHeadsUp) {
resetActualHeight();
}
mMaxExpandHeight = 0;
mWasReset = true;
onHeightReset();
requestLayout();
}
@Override
protected boolean filterMotionEvent(MotionEvent event) {
return mIsHeadsUp || super.filterMotionEvent(event);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();

View File

@@ -103,9 +103,13 @@ public abstract class ExpandableView extends FrameLayout {
}
}
protected void resetHeight() {
/**
* Resets the height of the view on the next layout pass
*/
protected void resetActualHeight() {
mActualHeight = 0;
mActualHeightInitialized = false;
requestLayout();
}
protected int getInitialHeight() {
@@ -120,7 +124,7 @@ public abstract class ExpandableView extends FrameLayout {
return false;
}
private boolean filterMotionEvent(MotionEvent event) {
protected boolean filterMotionEvent(MotionEvent event) {
return event.getActionMasked() != MotionEvent.ACTION_DOWN
|| event.getY() > mClipTopAmount && event.getY() < mActualHeight;
}

View File

@@ -74,7 +74,7 @@ public class NotificationContentView extends FrameLayout {
public NotificationContentView(Context context, AttributeSet attrs) {
super(context, attrs);
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
reset();
reset(true);
}
@Override
@@ -89,7 +89,7 @@ public class NotificationContentView extends FrameLayout {
updateVisibility();
}
public void reset() {
public void reset(boolean resetActualHeight) {
if (mContractedChild != null) {
mContractedChild.animate().cancel();
}
@@ -100,8 +100,10 @@ public class NotificationContentView extends FrameLayout {
mContractedChild = null;
mExpandedChild = null;
mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
mActualHeight = mSmallHeight;
mContractedVisible = true;
if (resetActualHeight) {
mActualHeight = mSmallHeight;
}
}
public View getContractedChild() {

View File

@@ -102,6 +102,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
if (mHeadsUp != null) {
mHeadsUp.row.setSystemExpanded(true);
mHeadsUp.row.setSensitive(false);
mHeadsUp.row.setHeadsUp(true);
mHeadsUp.row.setHideSensitive(
false, false /* animated */, 0 /* delay */, 0 /* duration */);
if (mContentHolder == null) {