Loading core/java/android/view/NotificationHeaderView.java +4 −0 Original line number Diff line number Diff line Loading @@ -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<>(); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java +26 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; } Loading @@ -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; } Loading @@ -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; Loading @@ -99,6 +108,9 @@ public class HeaderTransformState extends TransformState { @Override public void recycle() { super.recycle(); if (mWorkProfileState != null) { mWorkProfileState.recycle(); } sInstancePool.release(this); } Loading @@ -106,6 +118,7 @@ public class HeaderTransformState extends TransformState { protected void reset() { super.reset(); mExpandButton = null; mWorkProfileState = null; } public void setVisible(boolean visible) { Loading @@ -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); } } } Loading @@ -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); } } } } packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java +3 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading
core/java/android/view/NotificationHeaderView.java +4 −0 Original line number Diff line number Diff line Loading @@ -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<>(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/HeaderTransformState.java +26 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; } Loading @@ -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; } Loading @@ -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; Loading @@ -99,6 +108,9 @@ public class HeaderTransformState extends TransformState { @Override public void recycle() { super.recycle(); if (mWorkProfileState != null) { mWorkProfileState.recycle(); } sInstancePool.release(this); } Loading @@ -106,6 +118,7 @@ public class HeaderTransformState extends TransformState { protected void reset() { super.reset(); mExpandButton = null; mWorkProfileState = null; } public void setVisible(boolean visible) { Loading @@ -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); } } } Loading @@ -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); } } } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java +3 −0 Original line number Diff line number Diff line Loading @@ -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); Loading