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

Commit 26e622ce authored by Aaron Liu's avatar Aaron Liu Committed by Automerger Merge Worker
Browse files

Merge "Set gravity to end if we begin clipping subviews." into udc-dev am: 46d3419b

parents 01f72292 46d3419b
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.transition.TransitionManager;
import android.transition.TransitionValues;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -51,11 +52,29 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu
    private int mPosition = 0;
    private final PinShapeAdapter mPinShapeAdapter;
    private ValueAnimator mValueAnimator = ValueAnimator.ofFloat(1f, 0f);
    private Rect mFirstChildVisibleRect = new Rect();
    public PinShapeNonHintingView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mPinShapeAdapter = new PinShapeAdapter(context);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
        if (getChildCount() > 0) {
            View firstChild = getChildAt(0);
            boolean isVisible = firstChild.getLocalVisibleRect(mFirstChildVisibleRect);
            boolean clipped = mFirstChildVisibleRect.left > 0
                    || mFirstChildVisibleRect.right < firstChild.getWidth();
            if (!isVisible || clipped) {
                setGravity(Gravity.END | Gravity.CENTER_VERTICAL);
                return;
            }
        }

        setGravity(Gravity.CENTER);
    }

    @Override
    public void append() {
        int size = getResources().getDimensionPixelSize(R.dimen.password_shape_size);