Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be56a66a authored by Jason Monk's avatar Jason Monk Committed by android-build-merger
Browse files

Merge "Fade in rounded corners to avoid abrupt change" into oc-dr1-dev

am: 127a4c90

Change-Id: I20ff3c4d2386eaede56a62ea344c701111d58d05
parents 591e96c1 127a4c90
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.view.WindowManager;
@@ -69,12 +70,14 @@ public class RoundedCorners extends SystemUI implements Tunable {
        mOverlay = LayoutInflater.from(mContext)
        mOverlay = LayoutInflater.from(mContext)
                .inflate(R.layout.rounded_corners, null);
                .inflate(R.layout.rounded_corners, null);
        mOverlay.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        mOverlay.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        mOverlay.setAlpha(0);
        mOverlay.findViewById(R.id.right).setRotation(90);
        mOverlay.findViewById(R.id.right).setRotation(90);


        mContext.getSystemService(WindowManager.class)
        mContext.getSystemService(WindowManager.class)
                .addView(mOverlay, getWindowLayoutParams());
                .addView(mOverlay, getWindowLayoutParams());
        mBottomOverlay = LayoutInflater.from(mContext)
        mBottomOverlay = LayoutInflater.from(mContext)
                .inflate(R.layout.rounded_corners, null);
                .inflate(R.layout.rounded_corners, null);
        mBottomOverlay.setAlpha(0);
        mBottomOverlay.findViewById(R.id.right).setRotation(180);
        mBottomOverlay.findViewById(R.id.right).setRotation(180);
        mBottomOverlay.findViewById(R.id.left).setRotation(270);
        mBottomOverlay.findViewById(R.id.left).setRotation(270);
        WindowManager.LayoutParams layoutParams = getWindowLayoutParams();
        WindowManager.LayoutParams layoutParams = getWindowLayoutParams();
@@ -88,6 +91,23 @@ public class RoundedCorners extends SystemUI implements Tunable {
        mDensity = metrics.density;
        mDensity = metrics.density;


        Dependency.get(TunerService.class).addTunable(this, SIZE);
        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) {
    private void setupPadding(int padding) {