summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/NotificationHeaderView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java3
3 files changed, 33 insertions, 5 deletions
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java
index b3d16763d0d7..34713ad487fe 100644
--- a/core/java/android/view/NotificationHeaderView.java
+++ b/core/java/android/view/NotificationHeaderView.java
@@ -237,6 +237,10 @@ public class NotificationHeaderView extends LinearLayout {
}
}
+ public View getWorkProfileIcon() {
+ return mProfileBadge;
+ }
+
public class HeaderTouchListener implements View.OnTouchListener {
private final ArrayList<Rect> mTouchRects = new ArrayList<>();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java
index bf291d348162..81483c67fd8a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java
@@ -30,6 +30,8 @@ public class HeaderTransformState extends TransformState {
private static Pools.SimplePool<HeaderTransformState> sInstancePool
= new Pools.SimplePool<>(40);
private View mExpandButton;
+ private View mWorkProfileIcon;
+ private TransformState mWorkProfileState;
@Override
public void initFrom(View view) {
@@ -37,13 +39,16 @@ public class HeaderTransformState extends TransformState {
if (view instanceof NotificationHeaderView) {
NotificationHeaderView header = (NotificationHeaderView) view;
mExpandButton = header.getExpandButton();
+ mWorkProfileState = TransformState.obtain();
+ mWorkProfileIcon = header.getWorkProfileIcon();
+ mWorkProfileState.initFrom(mWorkProfileIcon);
}
}
@Override
public boolean transformViewTo(TransformState otherState, Runnable endRunnable) {
// if the transforming notification has a header, we have ensured that it looks the same
- // but the expand button, so lets fade just that one.
+ // but the expand button, so lets fade just that one and transform the work profile icon.
if (!(mTransformedView instanceof NotificationHeaderView)) {
return false;
}
@@ -66,7 +71,7 @@ public class HeaderTransformState extends TransformState {
@Override
public void transformViewFrom(TransformState otherState) {
// if the transforming notification has a header, we have ensured that it looks the same
- // but the expand button, so lets fade just that one.
+ // but the expand button, so lets fade just that one and transform the work profile icon.
if (!(mTransformedView instanceof NotificationHeaderView)) {
return;
}
@@ -79,10 +84,14 @@ public class HeaderTransformState extends TransformState {
if (headerChild.getVisibility() == View.GONE) {
continue;
}
- if (headerChild != mExpandButton) {
- headerChild.setVisibility(View.VISIBLE);
- } else {
+ if (headerChild == mExpandButton) {
CrossFadeHelper.fadeIn(mExpandButton);
+ } else {
+ headerChild.setVisibility(View.VISIBLE);
+ if (headerChild == mWorkProfileIcon) {
+ mWorkProfileState.animateViewFrom(
+ ((HeaderTransformState) otherState).mWorkProfileState);
+ }
}
}
return;
@@ -99,6 +108,9 @@ public class HeaderTransformState extends TransformState {
@Override
public void recycle() {
super.recycle();
+ if (mWorkProfileState != null) {
+ mWorkProfileState.recycle();
+ }
sInstancePool.release(this);
}
@@ -106,6 +118,7 @@ public class HeaderTransformState extends TransformState {
protected void reset() {
super.reset();
mExpandButton = null;
+ mWorkProfileState = null;
}
public void setVisible(boolean visible) {
@@ -125,6 +138,10 @@ public class HeaderTransformState extends TransformState {
if (headerChild == mExpandButton) {
headerChild.setAlpha(visible ? 1.0f : 0.0f);
}
+ if (headerChild == mWorkProfileIcon) {
+ headerChild.setTranslationX(0);
+ headerChild.setTranslationY(0);
+ }
}
}
@@ -144,6 +161,10 @@ public class HeaderTransformState extends TransformState {
headerChild.animate().cancel();
headerChild.setVisibility(View.VISIBLE);
headerChild.setAlpha(1.0f);
+ if (headerChild == mWorkProfileIcon) {
+ headerChild.setTranslationX(0);
+ headerChild.setTranslationY(0);
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
index 3e1c40aa847d..870abb7c9cc9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
@@ -286,6 +286,9 @@ public class TransformState {
}
public void setVisible(boolean visible) {
+ if (mTransformedView.getVisibility() == View.GONE) {
+ return;
+ }
mTransformedView.animate().cancel();
mTransformedView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
mTransformedView.setAlpha(visible ? 1.0f : 0.0f);