am 6d7065f5: Merge "Fixed a bug that the notifications were not animating when reset" into lmp-mr1-dev
* commit '6d7065f50d1e65707f7decc3f56042f808d5488f': Fixed a bug that the notifications were not animating when reset
This commit is contained in:
@@ -59,7 +59,6 @@ import android.service.notification.NotificationListenerService.RankingMap;
|
|||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.graphics.drawable.AnimationDrawable;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
@@ -68,6 +69,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
private NotificationGuts mGuts;
|
private NotificationGuts mGuts;
|
||||||
|
|
||||||
private StatusBarNotification mStatusBarNotification;
|
private StatusBarNotification mStatusBarNotification;
|
||||||
|
private boolean mIsHeadsUp;
|
||||||
|
|
||||||
public void setIconAnimationRunning(boolean running) {
|
public void setIconAnimationRunning(boolean running) {
|
||||||
setIconAnimationRunning(running, mPublicLayout);
|
setIconAnimationRunning(running, mPublicLayout);
|
||||||
@@ -122,6 +124,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
return mStatusBarNotification;
|
return mStatusBarNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHeadsUp(boolean isHeadsUp) {
|
||||||
|
mIsHeadsUp = isHeadsUp;
|
||||||
|
}
|
||||||
|
|
||||||
public interface ExpansionLogger {
|
public interface ExpansionLogger {
|
||||||
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
|
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
|
||||||
}
|
}
|
||||||
@@ -147,20 +153,27 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
|||||||
mShowingPublicInitialized = false;
|
mShowingPublicInitialized = false;
|
||||||
mIsSystemExpanded = false;
|
mIsSystemExpanded = false;
|
||||||
mExpansionDisabled = false;
|
mExpansionDisabled = false;
|
||||||
mPublicLayout.reset();
|
mPublicLayout.reset(mIsHeadsUp);
|
||||||
mPrivateLayout.reset();
|
mPrivateLayout.reset(mIsHeadsUp);
|
||||||
resetHeight();
|
resetHeight();
|
||||||
logExpansionEvent(false, wasExpanded);
|
logExpansionEvent(false, wasExpanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetHeight() {
|
public void resetHeight() {
|
||||||
super.resetHeight();
|
if (mIsHeadsUp) {
|
||||||
|
resetActualHeight();
|
||||||
|
}
|
||||||
mMaxExpandHeight = 0;
|
mMaxExpandHeight = 0;
|
||||||
mWasReset = true;
|
mWasReset = true;
|
||||||
onHeightReset();
|
onHeightReset();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean filterMotionEvent(MotionEvent event) {
|
||||||
|
return mIsHeadsUp || super.filterMotionEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
|
|||||||
@@ -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;
|
mActualHeight = 0;
|
||||||
mActualHeightInitialized = false;
|
mActualHeightInitialized = false;
|
||||||
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getInitialHeight() {
|
protected int getInitialHeight() {
|
||||||
@@ -120,7 +124,7 @@ public abstract class ExpandableView extends FrameLayout {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean filterMotionEvent(MotionEvent event) {
|
protected boolean filterMotionEvent(MotionEvent event) {
|
||||||
return event.getActionMasked() != MotionEvent.ACTION_DOWN
|
return event.getActionMasked() != MotionEvent.ACTION_DOWN
|
||||||
|| event.getY() > mClipTopAmount && event.getY() < mActualHeight;
|
|| event.getY() > mClipTopAmount && event.getY() < mActualHeight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class NotificationContentView extends FrameLayout {
|
|||||||
public NotificationContentView(Context context, AttributeSet attrs) {
|
public NotificationContentView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
|
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
|
||||||
reset();
|
reset(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -89,7 +89,7 @@ public class NotificationContentView extends FrameLayout {
|
|||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset(boolean resetActualHeight) {
|
||||||
if (mContractedChild != null) {
|
if (mContractedChild != null) {
|
||||||
mContractedChild.animate().cancel();
|
mContractedChild.animate().cancel();
|
||||||
}
|
}
|
||||||
@@ -100,8 +100,10 @@ public class NotificationContentView extends FrameLayout {
|
|||||||
mContractedChild = null;
|
mContractedChild = null;
|
||||||
mExpandedChild = null;
|
mExpandedChild = null;
|
||||||
mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
|
mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
|
||||||
mActualHeight = mSmallHeight;
|
|
||||||
mContractedVisible = true;
|
mContractedVisible = true;
|
||||||
|
if (resetActualHeight) {
|
||||||
|
mActualHeight = mSmallHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getContractedChild() {
|
public View getContractedChild() {
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
|
|||||||
if (mHeadsUp != null) {
|
if (mHeadsUp != null) {
|
||||||
mHeadsUp.row.setSystemExpanded(true);
|
mHeadsUp.row.setSystemExpanded(true);
|
||||||
mHeadsUp.row.setSensitive(false);
|
mHeadsUp.row.setSensitive(false);
|
||||||
|
mHeadsUp.row.setHeadsUp(true);
|
||||||
mHeadsUp.row.setHideSensitive(
|
mHeadsUp.row.setHideSensitive(
|
||||||
false, false /* animated */, 0 /* delay */, 0 /* duration */);
|
false, false /* animated */, 0 /* delay */, 0 /* duration */);
|
||||||
if (mContentHolder == null) {
|
if (mContentHolder == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user