static int getPaddingStart(View v) { if (v == null) { return 0; } return ViewCompat.getPaddingStart(v); }
private void adjustIndicatorPadding() { // Add padding to the error and character counter so that they match the EditText ViewCompat.setPaddingRelative(indicatorArea, ViewCompat.getPaddingStart(editText), 0, ViewCompat.getPaddingEnd(editText), editText.getPaddingBottom()); }
static int getPaddingStart(View v) { if (v == null) { return 0; } return ViewCompat.getPaddingStart(v); }
static int getPaddingStart(View v) { if (v == null) { return 0; } return ViewCompat.getPaddingStart(v); }
private float indicatorStartX(float gap, int page) { return ViewCompat.getPaddingStart(this) + gap * page + indicatorRadius; }
@Override public Integer get(TextView view) { return ViewCompat.getPaddingStart(view); }
private void captureValues(TransitionValues transitionValues) { if (!(transitionValues.view instanceof TextView)) { throw new UnsupportedOperationException("Doesn't work on " + transitionValues.view.getClass().getName()); } TextView view = (TextView) transitionValues.view; transitionValues.values.put(PROPERTY_NAME_TEXT_RESIZE, view.getTextSize()); transitionValues.values.put(PROPERTY_NAME_PADDING_RESIZE, ViewCompat.getPaddingStart(view)); }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } } }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } }
private void updateItemRectF(int i) { float halfLineWidth = ((float) lineWidth) / 2; float left = getScrollX() + ViewCompat.getPaddingStart(this) + i * (otpViewItemSpacing + otpViewItemWidth) + halfLineWidth; if (otpViewItemSpacing == 0 && i > 0) { left = left - (lineWidth) * i; } float right = left + otpViewItemWidth - lineWidth; float top = getScrollY() + getPaddingTop() + halfLineWidth; float bottom = top + otpViewItemHeight - lineWidth; itemBorderRect.set(left, top, right, bottom); }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int width; int height; int boxHeight = otpViewItemHeight; if (widthMode == MeasureSpec.EXACTLY) { width = widthSize; } else { int boxesWidth = (otpViewItemCount - 1) * otpViewItemSpacing + otpViewItemCount * otpViewItemWidth; width = boxesWidth + ViewCompat.getPaddingEnd(this) + ViewCompat.getPaddingStart(this); if (otpViewItemSpacing == 0) { width -= (otpViewItemCount - 1) * lineWidth; } } height = heightMode == MeasureSpec.EXACTLY ? heightSize : boxHeight + getPaddingTop() + getPaddingBottom(); setMeasuredDimension(width, height); }
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; }
text.setWidth(mMainView.getWidth() - ViewCompat.getPaddingStart(mStoreLocallyCheckbox) - ViewCompat.getPaddingEnd(mStoreLocallyTooltipIcon) - MarginLayoutParamsCompat.getMarginStart((RelativeLayout.LayoutParams) ViewCompat.getPaddingStart(mStoreLocallyCheckbox), 0); text.announceForAccessibility(text.getText());
int paddingStart = ViewCompat.getPaddingStart(this); int paddingEnd = ViewCompat.getPaddingEnd(this); int largestHeightInRow = Integer.MIN_VALUE;
/** * Determines if the {@link MotionEvent#ACTION_DOWN} event should be ignored. * This occurs when the event position is outside the bounds of the drag handle or * the track (of the drag handle) when disabled (see {@link #setTrackClicksAllowed(boolean)} * * @param xPos The x coordinate of the event * @param yPos The y coordinate of the event * @return {@code true} if the event should be ignored */ protected boolean ignoreTouchDown(float xPos, float yPos) { //Verifies the event is within the allowed X coordinates if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_LTR) { if (xPos < handle.getX() - ViewCompat.getPaddingStart(handle)) { return true; } } else { if (xPos > handle.getX() + handle.getWidth() + ViewCompat.getPaddingStart(handle)) { return true; } } if (!trackClicksAllowed) { //Enforces selection to only occur on the handle if (yPos < handle.getY() - handle.getPaddingTop() || yPos > handle.getY() + handle.getHeight() + handle.getPaddingBottom()) { return true; } } return false; }
public void setHelperTextEnabled(boolean _enabled) { if (mHelperTextEnabled == _enabled) return; if (_enabled && mErrorEnabled) { setErrorEnabled(false); } if (this.mHelperTextEnabled != _enabled) { if (_enabled) { this.mHelperView = new TextView(this.getContext()); this.mHelperView.setTextAppearance(this.getContext(), this.mHelperTextAppearance); if (mHelperTextColor != null){ this.mHelperView.setTextColor(mHelperTextColor); } this.mHelperView.setVisibility(INVISIBLE); this.addView(this.mHelperView); if (this.mHelperView != null) { ViewCompat.setPaddingRelative( this.mHelperView, ViewCompat.getPaddingStart(getEditText()), 0, ViewCompat.getPaddingEnd(getEditText()), getEditText().getPaddingBottom()); } } else { this.removeView(this.mHelperView); this.mHelperView = null; } this.mHelperTextEnabled = _enabled; } }