Merge "Set gravity to end if we begin clipping subviews." into udc-dev
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user