From b315490e8d99f3bd3c659e7ae1f751635beb5482 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Tue, 8 Aug 2017 11:19:26 -0400 Subject: [PATCH] Fade in rounded corners to avoid abrupt change Test: visual Change-Id: Ie19b732cc09b87f0d0387e249c772c9986ed0aaf Fixes: 64384961 --- .../com/android/systemui/RoundedCorners.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/RoundedCorners.java b/packages/SystemUI/src/com/android/systemui/RoundedCorners.java index 2bec2c7850ec9..58119f5a9334e 100644 --- a/packages/SystemUI/src/com/android/systemui/RoundedCorners.java +++ b/packages/SystemUI/src/com/android/systemui/RoundedCorners.java @@ -24,6 +24,7 @@ import android.util.DisplayMetrics; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnLayoutChangeListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; @@ -69,12 +70,14 @@ public class RoundedCorners extends SystemUI implements Tunable { mOverlay = LayoutInflater.from(mContext) .inflate(R.layout.rounded_corners, null); mOverlay.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + mOverlay.setAlpha(0); mOverlay.findViewById(R.id.right).setRotation(90); mContext.getSystemService(WindowManager.class) .addView(mOverlay, getWindowLayoutParams()); mBottomOverlay = LayoutInflater.from(mContext) .inflate(R.layout.rounded_corners, null); + mBottomOverlay.setAlpha(0); mBottomOverlay.findViewById(R.id.right).setRotation(180); mBottomOverlay.findViewById(R.id.left).setRotation(270); WindowManager.LayoutParams layoutParams = getWindowLayoutParams(); @@ -88,6 +91,23 @@ public class RoundedCorners extends SystemUI implements Tunable { mDensity = metrics.density; Dependency.get(TunerService.class).addTunable(this, SIZE); + + mOverlay.addOnLayoutChangeListener(new OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, + int oldTop, int oldRight, int oldBottom) { + mOverlay.removeOnLayoutChangeListener(this); + mOverlay.animate() + .alpha(1) + .setDuration(1000) + .start(); + mBottomOverlay.animate() + .alpha(1) + .setDuration(1000) + .start(); + } + }); } private void setupPadding(int padding) {