public static FlexItem fromFlexView(View view, int index) { FlexboxLayout.LayoutParams lp = (FlexboxLayout.LayoutParams) view.getLayoutParams(); FlexItem flexItem = new FlexItem(); flexItem.index = index; flexItem.order = lp.order; flexItem.flexGrow = lp.flexGrow; flexItem.flexShrink = lp.flexShrink; flexItem.alignSelf = lp.alignSelf; flexItem.flexBasisPercent = lp.flexBasisPercent; flexItem.width = Util.pixelToDp(view.getContext(), lp.width); flexItem.height = Util.pixelToDp(view.getContext(), lp.height); flexItem.topMargin = lp.topMargin; flexItem.startMargin = MarginLayoutParamsCompat.getMarginStart(lp); flexItem.endMargin = MarginLayoutParamsCompat.getMarginEnd(lp); flexItem.bottomMargin = lp.bottomMargin; flexItem.paddingTop = view.getPaddingTop(); flexItem.paddingStart = ViewCompat.getPaddingStart(view); flexItem.paddingEnd = ViewCompat.getPaddingEnd(view); flexItem.paddingBottom = view.getPaddingBottom(); return flexItem; }
private void addFloatingActionButton() { final int fabSize = getResources().getDimensionPixelSize(R.dimen.size_fab); int bottomOfQuestionView = findViewById(R.id.question_view).getBottom(); final LayoutParams fabLayoutParams = new LayoutParams(fabSize, fabSize, Gravity.END | Gravity.TOP); final int halfAFab = fabSize / 2; fabLayoutParams.setMargins(0, // left bottomOfQuestionView - halfAFab, //top 0, // right mSpacingDouble); // bottom MarginLayoutParamsCompat.setMarginEnd(fabLayoutParams, mSpacingDouble); if (ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) { // Account for the fab's emulated shadow. fabLayoutParams.topMargin -= (mSubmitAnswer.getPaddingTop() / 2); } addView(mSubmitAnswer, fabLayoutParams); }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (ViewCompat.getLayoutDirection(this) == 0) {} for (boolean bool = true;; bool = false) { int i = getWidth(); ViewGroup.MarginLayoutParams localMarginLayoutParams1 = (ViewGroup.MarginLayoutParams)this.mSubtitle.getLayoutParams(); int j = this.mSubtitle.getMeasuredWidth(); int k = PlayUtils.getViewLeftFromParentStart(i, j, bool, MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams1)); this.mSubtitle.layout(k, 0, k + j, this.mSubtitle.getMeasuredHeight()); ViewGroup.MarginLayoutParams localMarginLayoutParams2 = (ViewGroup.MarginLayoutParams)this.mLabel.getLayoutParams(); int m = this.mSubtitle.getBaseline() - this.mLabel.getBaseline(); int n = this.mLabel.getMeasuredWidth(); int i1 = PlayUtils.getViewLeftFromParentEnd(i, n, bool, MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams2)); this.mLabel.layout(i1, m, i1 + n, m + this.mLabel.getMeasuredHeight()); return; } }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (ViewCompat.getLayoutDirection(this) == 0) {} for (boolean bool = true;; bool = false) { int i = getWidth(); int j = ViewCompat.getPaddingStart(this); int k = MarginLayoutParamsCompat.getMarginStart((ViewGroup.MarginLayoutParams)this.mPromoContentView.getLayoutParams()) + getPaddingLeft(); int m = this.mPromoContentView.getMeasuredWidth(); int n = PlayUtils.getViewLeftFromParentStart(i, m, bool, k); int i1 = getPaddingTop(); int i2 = i1 + this.mPromoContentView.getMeasuredHeight(); int i3 = i2 - this.mDefaultCardInset; int i4 = this.mCardView.getMeasuredWidth(); int i5 = PlayUtils.getViewLeftFromParentStart(i, i4, bool, j); this.mPromoContentView.layout(n, i1, n + m, i2); if (this.mSeparator.getVisibility() == 0) { this.mSeparator.layout(0, i2, getMeasuredWidth(), i2 + this.mSeparator.getMeasuredHeight()); i3 += this.mSeparator.getMeasuredHeight(); } this.mCardView.layout(i5, i3, i5 + i4, i3 + this.mCardView.getMeasuredHeight()); return; } }
static int getMarginStart(View v) { if (v == null) { return 0; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); return MarginLayoutParamsCompat.getMarginStart(lp); }
static int getMarginEnd(View v) { if (v == null) { return 0; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); return MarginLayoutParamsCompat.getMarginEnd(lp); }
static int getMarginHorizontally(View v) { if (v == null) { return 0; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); return MarginLayoutParamsCompat.getMarginStart(lp) + MarginLayoutParamsCompat.getMarginEnd(lp); }
/** * Restores the original dimensions and margins after they were changed for percentage based * values. You should call this method only if you previously called * {@link PercentLayoutHelper.PercentLayoutInfo#fillMarginLayoutParams(View, ViewGroup.MarginLayoutParams, int, int)}. */ public void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params) { restoreLayoutParams(params); params.leftMargin = mPreservedParams.leftMargin; params.topMargin = mPreservedParams.topMargin; params.rightMargin = mPreservedParams.rightMargin; params.bottomMargin = mPreservedParams.bottomMargin; MarginLayoutParamsCompat.setMarginStart(params, MarginLayoutParamsCompat.getMarginStart(mPreservedParams)); MarginLayoutParamsCompat.setMarginEnd(params, MarginLayoutParamsCompat.getMarginEnd(mPreservedParams)); }
public void setTabButtonVisible(boolean visible) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mSendText.getLayoutParams(); if (visible) { MarginLayoutParamsCompat.setMarginStart(layoutParams, 0); mTabIcon.setVisibility(View.VISIBLE); } else { MarginLayoutParamsCompat.setMarginStart(layoutParams, mContext.getResources() .getDimensionPixelSize(R.dimen.message_edit_text_margin_left)); mTabIcon.setVisibility(View.GONE); } mSendText.setLayoutParams(layoutParams); }
static int getMarginHorizontally(View v) { if (v == null) { return 0; } MarginLayoutParams lp = (MarginLayoutParams) v.getLayoutParams(); return MarginLayoutParamsCompat.getMarginStart(lp) + MarginLayoutParamsCompat .getMarginEnd(lp); }
/** * Restores original dimensions and margins after they were changed for percentage based * values. Calling this method only makes sense if you previously called * {@link PercentLayoutInfo#fillMarginLayoutParams}. */ public void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params) { restoreLayoutParams(params); params.leftMargin = mPreservedParams.leftMargin; params.topMargin = mPreservedParams.topMargin; params.rightMargin = mPreservedParams.rightMargin; params.bottomMargin = mPreservedParams.bottomMargin; MarginLayoutParamsCompat.setMarginStart(params, MarginLayoutParamsCompat.getMarginStart(mPreservedParams)); MarginLayoutParamsCompat.setMarginEnd(params, MarginLayoutParamsCompat.getMarginEnd(mPreservedParams)); }
public FlexboxLayout.LayoutParams toLayoutParams(Context context) { FlexboxLayout.LayoutParams lp = new FlexboxLayout.LayoutParams( Util.dpToPixel(context, width), Util.dpToPixel(context, height)); lp.order = order; lp.flexGrow = flexGrow; lp.flexShrink = flexShrink; lp.alignSelf = alignSelf; lp.flexBasisPercent = flexBasisPercent; lp.topMargin = topMargin; MarginLayoutParamsCompat.setMarginStart(lp, startMargin); MarginLayoutParamsCompat.setMarginEnd(lp, endMargin); lp.bottomMargin = bottomMargin; return lp; }
/** * Restores original dimensions and margins after they were changed for percentage based * values. Calling this method only makes sense if you previously called * {@link PercentLayoutHelper.PercentLayoutInfo#fillMarginLayoutParams}. */ public void restoreMarginLayoutParams(ViewGroup.MarginLayoutParams params) { restoreLayoutParams(params); params.leftMargin = mPreservedParams.leftMargin; params.topMargin = mPreservedParams.topMargin; params.rightMargin = mPreservedParams.rightMargin; params.bottomMargin = mPreservedParams.bottomMargin; MarginLayoutParamsCompat.setMarginStart(params, MarginLayoutParamsCompat.getMarginStart(mPreservedParams)); MarginLayoutParamsCompat.setMarginEnd(params, MarginLayoutParamsCompat.getMarginEnd(mPreservedParams)); }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (isCompactMode()) { int i9 = getHeight() - getPaddingBottom(); this.mHeader.layout(0, i9 - this.mHeader.getMeasuredHeight(), this.mHeader.getMeasuredWidth(), i9); return; } int i = getWidth(); if (ViewCompat.getLayoutDirection(this) == 0) {} for (boolean bool = true;; bool = false) { int j = getPaddingTop(); int k = getPaddingTop(); int m = this.mHeader.getMeasuredHeight(); if (this.mSubheader.getVisibility() != 8) { m += this.mSubheader.getMeasuredHeight(); } int n = j + (getHeight() - j - m - k) / 2; int i1 = this.mHeader.getMeasuredWidth(); int i2 = PlayUtils.getViewLeftFromParentStart(i, i1, bool, 0); this.mHeader.layout(i2, n, i2 + i1, n + this.mHeader.getMeasuredHeight()); int i3 = MarginLayoutParamsCompat.getMarginEnd((ViewGroup.MarginLayoutParams)this.mPlaylistControl.getLayoutParams()); int i4 = PlayUtils.getViewLeftFromParentEnd(i, this.mPlaylistControl.getMeasuredWidth(), bool, i3); int i5 = n + this.mHeader.getBaseline() - this.mPlaylistControl.getBaseline(); this.mPlaylistControl.layout(i4, i5, i4 + this.mPlaylistControl.getMeasuredWidth(), i5 + this.mPlaylistControl.getMeasuredHeight()); if (this.mSubheader.getVisibility() == 8) { break; } int i6 = this.mHeader.getBottom(); int i7 = this.mSubheader.getMeasuredWidth(); int i8 = PlayUtils.getViewLeftFromParentStart(i, i7, bool, 0); this.mSubheader.layout(i8, i6, i8 + i7, i6 + this.mSubheader.getMeasuredHeight()); return; } }
protected void onMeasure(int paramInt1, int paramInt2) { int i = getPaddingTop(); int j = getPaddingBottom(); int k = View.MeasureSpec.getSize(paramInt1); if (isCompactMode()) { this.mHeader.measure(paramInt1, 0); int i1 = this.mHeader.getMeasuredHeight(); int i2 = j + (i1 + i); if (i2 > this.mMinFullHeight) {} for (int i3 = i2;; i3 = j + (i + i1 + (this.mMinFullHeight - i1 - i - j) / 2)) { setMeasuredDimension(k, i3); return; } } ViewGroup.MarginLayoutParams localMarginLayoutParams = (ViewGroup.MarginLayoutParams)this.mPlaylistControl.getLayoutParams(); this.mPlaylistControl.measure(0, 0); int m = View.MeasureSpec.makeMeasureSpec(k - this.mPlaylistControl.getMeasuredWidth() - MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams), 1073741824); this.mHeader.measure(m, 0); int n = i + this.mHeader.getMeasuredHeight(); if (this.mSubheader.getVisibility() != 8) { this.mSubheader.measure(m, 0); n += this.mSubheader.getMeasuredHeight(); } setMeasuredDimension(k, Math.max(n + j, this.mMinFullHeight)); }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (ViewCompat.getLayoutDirection(this) == 0) {} for (boolean bool = true;; bool = false) { int i = ViewCompat.getPaddingStart(this); int j = ViewCompat.getPaddingEnd(this); int k = getPaddingTop(); int m = getPaddingBottom(); int n = getWidth(); int i1 = getHeight(); ViewGroup.MarginLayoutParams localMarginLayoutParams1 = (ViewGroup.MarginLayoutParams)this.mThumbnail.getLayoutParams(); int i2 = this.mThumbnail.getMeasuredWidth(); int i3 = this.mThumbnail.getMeasuredHeight(); int i4 = PlayUtils.getViewLeftFromParentStart(n, i2, bool, i + MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams1)); this.mThumbnail.layout(i4, k + localMarginLayoutParams1.topMargin, i4 + i2, i3 + (k + localMarginLayoutParams1.topMargin)); ViewGroup.MarginLayoutParams localMarginLayoutParams2 = (ViewGroup.MarginLayoutParams)this.mTitle.getLayoutParams(); int i5 = k + i3 + localMarginLayoutParams2.topMargin; int i6 = i + MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams2); int i7 = this.mTitle.getMeasuredWidth(); int i8 = this.mTitle.getMeasuredHeight(); int i9 = PlayUtils.getViewLeftFromParentStart(n, i7, bool, i6); this.mTitle.layout(i9, i5, i9 + i7, i5 + i8); int i10 = this.mLoadingIndicator.getMeasuredWidth(); int i11 = this.mLoadingIndicator.getMeasuredHeight(); int i12 = i + (n - i - j - i10) / 2; int i13 = k + (i1 - k - m - i11) / 2; int i14 = PlayUtils.getViewLeftFromParentStart(n, i10, bool, i12); this.mLoadingIndicator.layout(i14, i13, i14 + i10, i13 + this.mLoadingIndicator.getMeasuredHeight()); return; } }
public void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (ViewCompat.getLayoutDirection(this) == 0) {} for (boolean bool = true;; bool = false) { int i = getWidth(); int j = getHeight(); int k = getPaddingTop(); int m = ViewCompat.getPaddingStart(this); if (this.mHeaderImage.getVisibility() != 8) { int i6 = this.mHeaderImage.getMeasuredWidth(); int i7 = this.mHeaderImage.getMeasuredHeight(); int i8 = k + (j - i7 - k) / 2; int i9 = PlayUtils.getViewLeftFromParentStart(i, i6, bool, m); this.mHeaderImage.layout(i9, i8, i9 + i6, i8 + i7); m += i6 + MarginLayoutParamsCompat.getMarginEnd((ViewGroup.MarginLayoutParams)this.mHeaderImage.getLayoutParams()); } int n = this.mTitleGroup.getMeasuredWidth(); int i1 = PlayUtils.getViewLeftFromParentStart(i, n, bool, m); this.mTitleGroup.layout(i1, k, i1 + n, j); if (this.mMoreView.getVisibility() != 8) { int i2 = this.mMoreView.getMeasuredWidth(); int i3 = this.mMoreView.getMeasuredHeight(); int i4 = k + (j - i3 - k) / 2; int i5 = PlayUtils.getViewLeftFromParentEnd(i, i2, bool, ViewCompat.getPaddingEnd(this)); this.mMoreView.layout(i5, i4, i5 + i2, i4 + i3); } return; } }
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { boolean bool; int i; int j; int k; if (ViewCompat.getLayoutDirection(this) == 0) { bool = true; i = ViewCompat.getPaddingStart(this); j = getPaddingTop(); k = getWidth(); if (this.mLinkIcon.getVisibility() != 0) { break label205; } } label205: for (int m = 1;; m = 0) { int n = i; if (m != 0) { ViewGroup.MarginLayoutParams localMarginLayoutParams = (ViewGroup.MarginLayoutParams)this.mLinkIcon.getLayoutParams(); int i3 = this.mLinkIcon.getMeasuredWidth(); int i4 = MarginLayoutParamsCompat.getMarginStart(localMarginLayoutParams); int i5 = MarginLayoutParamsCompat.getMarginEnd(localMarginLayoutParams); int i6 = j + localMarginLayoutParams.topMargin; int i7 = PlayUtils.getViewLeftFromParentStart(k, i3, bool, i + i4); this.mLinkIcon.layout(i7, i6, i7 + i3, i6 + this.mLinkIcon.getMeasuredHeight()); n += i5 + (i4 + i3); } int i1 = this.mLinkText.getMeasuredWidth(); int i2 = PlayUtils.getViewLeftFromParentStart(k, i1, bool, n); this.mLinkText.layout(i2, j, i2 + i1, j + this.mLinkText.getMeasuredHeight()); return; bool = false; break; } }
private ImageView[] loadImages(ImageWithCaptionOuterClass.ImageWithCaption[] paramArrayOfImageWithCaption, int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean1, boolean paramBoolean2) { ArrayList localArrayList = new ArrayList(paramArrayOfImageWithCaption.length); HashSet localHashSet = new HashSet(paramArrayOfImageWithCaption.length); int i = paramInt1; int j = paramArrayOfImageWithCaption.length; for (int k = 0; k < j; k++) { ImageWithCaptionOuterClass.ImageWithCaption localImageWithCaption = paramArrayOfImageWithCaption[k]; if (!localHashSet.contains(localImageWithCaption.imageUri)) { localHashSet.add(localImageWithCaption.imageUri); ImageWithCaptionView localImageWithCaptionView = new ImageWithCaptionView(getContext()); if (Build.VERSION.SDK_INT >= 11) { localImageWithCaptionView.setLayerType(2, null); } localImageWithCaptionView.setId(i); RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(paramInt2, paramInt3); if ((!paramBoolean1) && (!paramBoolean2) && (i > paramInt1)) { MarginLayoutParamsCompat.setMarginStart(localLayoutParams, this.mSpacingBetweenCardImages); localLayoutParams.addRule(WalletUiUtils.sanitizeRelativeLayoutVerb(17), i - 1); } addView(localImageWithCaptionView, localLayoutParams); if ((PaymentUtils.isEmbeddedImageUri(localImageWithCaption.imageUri)) && (PaymentUtils.getEmbeddedImageId(localImageWithCaption.imageUri) == 27)) { throw new IllegalArgumentException("Requesting placeholder network logo when not supported"); } localImageWithCaptionView.setImageWithCaption(localImageWithCaption, PaymentUtils.getImageLoader(getContext().getApplicationContext()), ((Boolean)G.images.useWebPForFife.get()).booleanValue()); localImageWithCaptionView.setFadeIn(true); localImageWithCaptionView.setErrorImageResId(R.drawable.wallet_im_card_resolved_generic); localImageWithCaptionView.setTag(localImageWithCaption); localArrayList.add(localImageWithCaptionView); i++; } } return (ImageView[])localArrayList.toArray(new ImageView[localArrayList.size()]); }
public final void moveIconToStart() { if (this.mUiFieldView == null) { throw new IllegalStateException("This should not be called before setting the contents."); } removeView(this.mTooltipIcon); super.addView(this.mTooltipIcon, 0); LinearLayout.LayoutParams localLayoutParams1 = (LinearLayout.LayoutParams)this.mUiFieldView.getLayoutParams(); LinearLayout.LayoutParams localLayoutParams2 = (LinearLayout.LayoutParams)this.mTooltipIcon.getLayoutParams(); MarginLayoutParamsCompat.setMarginEnd(localLayoutParams1, MarginLayoutParamsCompat.getMarginEnd(localLayoutParams2)); MarginLayoutParamsCompat.setMarginEnd(localLayoutParams2, MarginLayoutParamsCompat.getMarginStart(localLayoutParams2)); MarginLayoutParamsCompat.setMarginStart(localLayoutParams2, MarginLayoutParamsCompat.getMarginStart(localLayoutParams1)); MarginLayoutParamsCompat.setMarginStart(localLayoutParams1, 0); }
public final void setContent(View paramView, TooltipOuterClass.Tooltip paramTooltip, ImageLoader paramImageLoader) { if (this.mUiFieldView != null) { throw new IllegalStateException("setContent should only be called once."); } if (!(paramView instanceof TextView)) { throw new IllegalArgumentException("Tooltips are only supported for text and date UI fields."); } this.mUiFieldView = paramView; super.addView(paramView); LinearLayout.LayoutParams localLayoutParams1 = (LinearLayout.LayoutParams)paramView.getLayoutParams(); localLayoutParams1.width = 0; localLayoutParams1.weight = 1.0F; this.mUiFieldView.setOnFocusChangeListener(this); this.mTooltip = paramTooltip; Context localContext = getContext(); int[] arrayOfInt = new int[2]; arrayOfInt[0] = R.attr.uicFormTooltipIconSize; arrayOfInt[1] = R.attr.uicClickableBackground; TypedArray localTypedArray = localContext.obtainStyledAttributes(arrayOfInt); int i = localTypedArray.getDimensionPixelSize(0, 0); int j = localTypedArray.getResourceId(1, 0); localTypedArray.recycle(); this.mTooltipIcon = new ImageWithCaptionView(getContext()); LinearLayout.LayoutParams localLayoutParams2 = new LinearLayout.LayoutParams(i, i); localLayoutParams2.gravity = 17; MarginLayoutParamsCompat.setMarginStart(localLayoutParams2, getResources().getDimensionPixelSize(R.dimen.wallet_uic_margin_touchable)); MarginLayoutParamsCompat.setMarginEnd(localLayoutParams2, MarginLayoutParamsCompat.getMarginEnd(localLayoutParams1)); MarginLayoutParamsCompat.setMarginEnd(localLayoutParams1, 0); addView(this.mTooltipIcon, localLayoutParams2); this.mTooltipIcon.setImageWithCaption(paramTooltip.icon, paramImageLoader, ((Boolean)G.images.useWebPForFife.get()).booleanValue()); this.mTooltipIcon.setBackgroundResource(j); updateIconVisibility(false); this.mTooltipIcon.setOnClickListener(this); }
/** * Fills {@code ViewGroup.MarginLayoutParams} dimensions and margins based on percentage * values. */ public void fillMarginLayoutParams(ViewGroup.MarginLayoutParams params, int widthHint, int heightHint) { fillLayoutParams(params, widthHint, heightHint); // Preserver the original margins, so we can restore them after the measure step. mPreservedParams.leftMargin = params.leftMargin; mPreservedParams.topMargin = params.topMargin; mPreservedParams.rightMargin = params.rightMargin; mPreservedParams.bottomMargin = params.bottomMargin; MarginLayoutParamsCompat.setMarginStart(mPreservedParams, MarginLayoutParamsCompat.getMarginStart(params)); MarginLayoutParamsCompat.setMarginEnd(mPreservedParams, MarginLayoutParamsCompat.getMarginEnd(params)); if (leftMarginPercent >= 0) { params.leftMargin = (int) (widthHint * leftMarginPercent); } if (topMarginPercent >= 0) { params.topMargin = (int) (heightHint * topMarginPercent); } if (rightMarginPercent >= 0) { params.rightMargin = (int) (widthHint * rightMarginPercent); } if (bottomMarginPercent >= 0) { params.bottomMargin = (int) (heightHint * bottomMarginPercent); } if (startMarginPercent >= 0) { MarginLayoutParamsCompat.setMarginStart(params, (int) (widthHint * startMarginPercent)); } if (endMarginPercent >= 0) { MarginLayoutParamsCompat.setMarginEnd(params, (int) (widthHint * endMarginPercent)); } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "after fillMarginLayoutParams: (" + params.width + ", " + params.height + ")"); } }