void getSize(SizeReadyCallback cb) { int currentWidth = getViewWidthOrParam(); int currentHeight = getViewHeightOrParam(); if (isSizeValid(currentWidth) && isSizeValid(currentHeight)) { int paddingAdjustedWidth = currentWidth == WindowManager.LayoutParams.WRAP_CONTENT ? currentWidth : currentWidth - ViewCompat.getPaddingStart(view) - ViewCompat.getPaddingEnd(view); int paddingAdjustedHeight = currentHeight == LayoutParams.WRAP_CONTENT ? currentHeight : currentHeight - view.getPaddingTop() - view.getPaddingBottom(); cb.onSizeReady(paddingAdjustedWidth, paddingAdjustedHeight); } else { // We want to notify callbacks in the order they were added and we only expect one or two // callbacks to // be added a time, so a List is a reasonable choice. if (!cbs.contains(cb)) { cbs.add(cb); } if (layoutListener == null) { final ViewTreeObserver observer = view.getViewTreeObserver(); layoutListener = new SizeDeterminerLayoutListener(this); observer.addOnPreDrawListener(layoutListener); } } }
@Override public void setBackgroundDrawable(Drawable drawable) { if (getBackground() == null || drawable == null) { super.setBackgroundDrawable(drawable); return; } int[] padding = new int[] { ViewCompat.getPaddingStart(this), getPaddingTop(), ViewCompat.getPaddingEnd(this), getPaddingBottom() }; drawable.setLevel(getBackground().getLevel()); super.setBackgroundDrawable(drawable); ViewCompat.setPaddingRelative(this, padding[0], padding[1], padding[2], padding[3]); }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { boolean bool; int i; int k; int n; int i16; label100: int i3; int i4; int i5; label171: int i7; int i8; int i9; if (ViewCompat.getLayoutDirection(this) == 0) { bool = true; i = getWidth(); int j = ViewCompat.getPaddingStart(this); k = ViewCompat.getPaddingEnd(this); int m = getHeight(); n = getPaddingTop(); int i1 = getPaddingBottom(); int i2 = m - n - i1; if (isLogoVisible()) { int i14 = this.mLogo.getMeasuredWidth(); int i15 = this.mLogo.getMeasuredHeight(); if (this.mContentFormat != 0) { break label352; } i16 = n + (i2 - i15) / 2; int i17 = PlayUtils.getViewLeftFromParentStart(i, i14, bool, j); this.mLogo.layout(i17, i16, i17 + i14, i16 + i15); } i3 = this.mContinueButtonFrame.getMeasuredWidth(); i4 = this.mContinueButtonFrame.getMeasuredHeight(); if (this.mContentFormat != 0) { break label359; } i5 = n + (i2 - i4) / 2; int i6 = PlayUtils.getViewLeftFromParentEnd(i, i3, bool, k); this.mContinueButtonFrame.layout(i6, i5, i6 + i3, i5 + i4); if (isSecondaryButtonVisible()) { i7 = this.mSecondaryButtonFrame.getMeasuredWidth(); i8 = this.mSecondaryButtonFrame.getMeasuredHeight(); if (this.mContentFormat != 0) { break label394; } i9 = n + (i2 - i8) / 2; } } for (int i10 = i3 + (i7 + this.mHorizontalItemGap);; i10 = i7) { int i11 = PlayUtils.getViewLeftFromParentEnd(i, i10, bool, k); View localView = this.mSecondaryButtonFrame; int i12 = i11 + i7; int i13 = i9 + i8; localView.layout(i11, i9, i12, i13); UiUtils.ensureMinimumTouchTargetSize(this.mContinueButton, this.mContinueArea, this.mOldContinueArea, this.mMinimumTouchTargetSize); UiUtils.ensureMinimumTouchTargetSize(this.mSecondaryButton, this.mSecondaryArea, this.mOldSecondaryArea, this.mMinimumTouchTargetSize); return; bool = false; break; label352: i16 = n; break label100; label359: if (this.mContentFormat == 1) { i5 = n + this.mLogo.getMeasuredHeight() + this.mVerticalItemGap; break label171; } i5 = n; break label171; label394: i9 = i5 + i4 + this.mVerticalItemGap; } }
protected void onMeasure(int paramInt1, int paramInt2) { this.mContinueButtonFrame.setVisibility(this.mContinueButton.getVisibility()); int i; int j; int m; int k; if ((this.mSecondaryButtonFrame != null) && (this.mSecondaryButton != null)) { this.mSecondaryButtonFrame.setVisibility(this.mSecondaryButton.getVisibility()); if ((this.mContinueButton.getVisibility() == 0) && (this.mSecondaryButton.getVisibility() == 0)) { this.mLogo.setVisibility(8); } } else { i = View.MeasureSpec.getSize(paramInt1); j = i - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this); if (!isLogoVisible()) { break label358; } this.mLogo.measure(0, 0); m = this.mLogo.getMeasuredWidth() + this.mHorizontalItemGap; k = this.mLogo.getMeasuredHeight(); } for (;;) { this.mContinueButtonFrame.measure(0, 0); int n = this.mContinueButtonFrame.getMeasuredWidth(); int i1 = this.mContinueButtonFrame.getMeasuredHeight(); if (isSecondaryButtonVisible()) { this.mSecondaryButtonFrame.measure(0, 0); int i3 = this.mSecondaryButtonFrame.getMeasuredWidth(); i1 = Math.max(i1, this.mSecondaryButtonFrame.getMeasuredHeight()); n += i3 + this.mHorizontalItemGap; } int i2; if (m + n <= j) { this.mContentFormat = 0; i2 = Math.max(k, i1); } for (;;) { setMeasuredDimension(i, i2 + getPaddingTop() + getPaddingBottom()); return; this.mLogo.setVisibility(0); break; if (!isSecondaryButtonVisible()) { this.mContinueButtonFrame.measure(View.MeasureSpec.makeMeasureSpec(j, -2147483648), 0); this.mContentFormat = 0; i2 = this.mContinueButtonFrame.getMeasuredHeight(); } else { this.mContinueButtonFrame.measure(View.MeasureSpec.makeMeasureSpec(j, -2147483648), 0); this.mSecondaryButtonFrame.measure(View.MeasureSpec.makeMeasureSpec(j, -2147483648), 0); this.mContentFormat = 2; i2 = this.mContinueButtonFrame.getMeasuredHeight() + this.mVerticalItemGap + this.mSecondaryButtonFrame.getMeasuredHeight(); } } label358: k = 0; m = 0; } }