Merge "Set gravity to end if we begin clipping subviews." into udc-dev am: 46d3419bc4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23591235 Change-Id: Ib44f3998f185422253bcf8bcb8c14636e1e9ebe8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import android.transition.TransitionManager;
|
|||||||
import android.transition.TransitionValues;
|
import android.transition.TransitionValues;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -51,11 +52,29 @@ public class PinShapeNonHintingView extends LinearLayout implements PinShapeInpu
|
|||||||
private int mPosition = 0;
|
private int mPosition = 0;
|
||||||
private final PinShapeAdapter mPinShapeAdapter;
|
private final PinShapeAdapter mPinShapeAdapter;
|
||||||
private ValueAnimator mValueAnimator = ValueAnimator.ofFloat(1f, 0f);
|
private ValueAnimator mValueAnimator = ValueAnimator.ofFloat(1f, 0f);
|
||||||
|
private Rect mFirstChildVisibleRect = new Rect();
|
||||||
public PinShapeNonHintingView(Context context, AttributeSet attrs) {
|
public PinShapeNonHintingView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mPinShapeAdapter = new PinShapeAdapter(context);
|
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
|
@Override
|
||||||
public void append() {
|
public void append() {
|
||||||
int size = getResources().getDimensionPixelSize(R.dimen.password_shape_size);
|
int size = getResources().getDimensionPixelSize(R.dimen.password_shape_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user