本文整理汇总了Java中android.support.v7.internal.widget.ViewUtils类的典型用法代码示例。如果您正苦于以下问题:Java ViewUtils类的具体用法?Java ViewUtils怎么用?Java ViewUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewUtils类属于android.support.v7.internal.widget包,在下文中一共展示了ViewUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCompoundPaddingLeft
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
public int getCompoundPaddingLeft()
{
int i;
if (!ViewUtils.isLayoutRtl(this))
{
i = super.getCompoundPaddingLeft();
} else
{
int j = super.getCompoundPaddingLeft() + mSwitchWidth;
i = j;
if (!TextUtils.isEmpty(getText()))
{
return j + mSwitchPadding;
}
}
return i;
}
示例2: getCompoundPaddingRight
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
public int getCompoundPaddingRight()
{
int i;
if (ViewUtils.isLayoutRtl(this))
{
i = super.getCompoundPaddingRight();
} else
{
int j = super.getCompoundPaddingRight() + mSwitchWidth;
i = j;
if (!TextUtils.isEmpty(getText()))
{
return j + mSwitchPadding;
}
}
return i;
}
示例3: computeContentWidth
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
void computeContentWidth() {
final Drawable background = getBackground();
int hOffset = 0;
if (background != null) {
background.getPadding(mTempRect);
hOffset = ViewUtils.isLayoutRtl(Spinner.this) ? mTempRect.right : -mTempRect.left;
} else
mTempRect.left = mTempRect.right = 0;
final int spinnerPaddingLeft = Spinner.this.getPaddingLeft();
final int spinnerPaddingRight = Spinner.this.getPaddingRight();
final int spinnerWidth = Spinner.this.getWidth();
if (mDropDownWidth == WRAP_CONTENT) {
int contentWidth = measureContentWidth((SpinnerAdapter) mAdapter, getBackground());
final int contentWidthLimit = getContext().getResources().getDisplayMetrics().widthPixels - mTempRect.left - mTempRect.right;
if (contentWidth > contentWidthLimit)
contentWidth = contentWidthLimit;
setContentWidth(Math.max(contentWidth, spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight));
} else if (mDropDownWidth == MATCH_PARENT)
setContentWidth(spinnerWidth - spinnerPaddingLeft - spinnerPaddingRight);
else
setContentWidth(mDropDownWidth);
if (ViewUtils.isLayoutRtl(Spinner.this))
hOffset += spinnerWidth - spinnerPaddingRight - getWidth();
else
hOffset += spinnerPaddingLeft;
setHorizontalOffset(hOffset);
}
示例4: adjustDropDownSizeAndPosition
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
private void adjustDropDownSizeAndPosition()
{
int i;
Rect localRect;
int j;
if (this.mDropDownAnchor.getWidth() > 1)
{
Resources localResources = getContext().getResources();
i = this.mSearchPlate.getPaddingLeft();
localRect = new Rect();
boolean bool = ViewUtils.isLayoutRtl(this);
if (!this.mIconifiedByDefault) {
break label132;
}
j = localResources.getDimensionPixelSize(R.dimen.abc_dropdownitem_icon_width) + localResources.getDimensionPixelSize(R.dimen.abc_dropdownitem_text_padding_left);
this.mSearchSrcTextView.getDropDownBackground().getPadding(localRect);
if (!bool) {
break label138;
}
}
label132:
label138:
for (int k = -localRect.left;; k = i - (j + localRect.left))
{
this.mSearchSrcTextView.setDropDownHorizontalOffset(k);
int m = j + (this.mDropDownAnchor.getWidth() + localRect.left + localRect.right) - i;
this.mSearchSrcTextView.setDropDownWidth(m);
return;
j = 0;
break;
}
}
示例5: getThumbOffset
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
private int getThumbOffset()
{
if (ViewUtils.isLayoutRtl(this)) {}
for (float f = 1.0F - this.mThumbPosition;; f = this.mThumbPosition) {
return (int)(0.5F + f * getThumbScrollRange());
}
}
示例6: getCompoundPaddingLeft
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
public int getCompoundPaddingLeft()
{
int i;
if (!ViewUtils.isLayoutRtl(this)) {
i = super.getCompoundPaddingLeft();
}
do
{
return i;
i = super.getCompoundPaddingLeft() + this.mSwitchWidth;
} while (TextUtils.isEmpty(getText()));
return i + this.mSwitchPadding;
}
示例7: getCompoundPaddingRight
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
public int getCompoundPaddingRight()
{
int i;
if (ViewUtils.isLayoutRtl(this)) {
i = super.getCompoundPaddingRight();
}
do
{
return i;
i = super.getCompoundPaddingRight() + this.mSwitchWidth;
} while (TextUtils.isEmpty(getText()));
return i + this.mSwitchPadding;
}
示例8: adjustDropDownSizeAndPosition
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
private void adjustDropDownSizeAndPosition()
{
if (mDropDownAnchor.getWidth() > 1)
{
Resources resources = getContext().getResources();
int k = mSearchPlate.getPaddingLeft();
Rect rect = new Rect();
boolean flag = ViewUtils.isLayoutRtl(this);
int i;
int j;
int l;
int i1;
if (mIconifiedByDefault)
{
i = resources.getDimensionPixelSize(android.support.v7.appcompat.R.dimen.abc_dropdownitem_icon_width) + resources.getDimensionPixelSize(android.support.v7.appcompat.R.dimen.abc_dropdownitem_text_padding_left);
} else
{
i = 0;
}
mSearchSrcTextView.getDropDownBackground().getPadding(rect);
if (flag)
{
j = -rect.left;
} else
{
j = k - (rect.left + i);
}
mSearchSrcTextView.setDropDownHorizontalOffset(j);
j = mDropDownAnchor.getWidth();
l = rect.left;
i1 = rect.right;
mSearchSrcTextView.setDropDownWidth((j + l + i1 + i) - k);
}
}
示例9: getThumbOffset
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
private int getThumbOffset()
{
float f;
if (ViewUtils.isLayoutRtl(this))
{
f = 1.0F - mThumbPosition;
} else
{
f = mThumbPosition;
}
return (int)((float)getThumbScrollRange() * f + 0.5F);
}
示例10: computeContentWidth
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
final void computeContentWidth()
{
Drawable localDrawable = this.mPopup.getBackground();
int i;
int j;
int k;
int m;
if (localDrawable != null)
{
localDrawable.getPadding(AppCompatSpinner.this.mTempRect);
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i = AppCompatSpinner.this.mTempRect.right;
j = AppCompatSpinner.this.getPaddingLeft();
k = AppCompatSpinner.this.getPaddingRight();
m = AppCompatSpinner.this.getWidth();
if (AppCompatSpinner.this.mDropDownWidth != -2) {
break label250;
}
int i1 = AppCompatSpinner.this.compatMeasureContentWidth((SpinnerAdapter)this.mAdapter, this.mPopup.getBackground());
int i2 = AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.this.mTempRect.left - AppCompatSpinner.this.mTempRect.right;
if (i1 > i2) {
i1 = i2;
}
setContentWidth(Math.max(i1, m - j - k));
label175:
if (!ViewUtils.isLayoutRtl(AppCompatSpinner.this)) {
break label290;
}
}
}
label290:
for (int n = i + (m - k - this.mDropDownWidth);; n = i + j)
{
this.mDropDownHorizontalOffset = n;
return;
i = -AppCompatSpinner.this.mTempRect.left;
break;
Rect localRect = AppCompatSpinner.this.mTempRect;
AppCompatSpinner.this.mTempRect.right = 0;
localRect.left = 0;
i = 0;
break;
label250:
if (AppCompatSpinner.this.mDropDownWidth == -1)
{
setContentWidth(m - j - k);
break label175;
}
setContentWidth(AppCompatSpinner.this.mDropDownWidth);
break label175;
}
}
示例11: computeContentWidth
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
void computeContentWidth()
{
Drawable drawable = getBackground();
int i = 0;
int i1;
int j1;
int k1;
if (drawable != null)
{
drawable.getPadding(mTempRect);
int j;
int k;
int l;
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i = mTempRect.right;
} else
{
i = -mTempRect.left;
}
} else
{
Rect rect = mTempRect;
mTempRect.right = 0;
rect.left = 0;
}
i1 = getPaddingLeft();
j1 = getPaddingRight();
k1 = getWidth();
if (mDropDownWidth == -2)
{
k = compatMeasureContentWidth((SpinnerAdapter)mAdapter, getBackground());
l = getContext().getResources().getDisplayMetrics().widthPixels - mTempRect.left - mTempRect.right;
j = k;
if (k > l)
{
j = l;
}
setContentWidth(Math.max(j, k1 - i1 - j1));
} else
if (mDropDownWidth == -1)
{
setContentWidth(k1 - i1 - j1);
} else
{
setContentWidth(mDropDownWidth);
}
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i += k1 - j1 - getWidth();
} else
{
i += i1;
}
setHorizontalOffset(i);
}
示例12: drawDividersHorizontal
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
void drawDividersHorizontal(Canvas canvas)
{
int l = getVirtualChildCount();
boolean flag = ViewUtils.isLayoutRtl(this);
int i = 0;
while (i < l)
{
View view = getVirtualChildAt(i);
if (view != null && view.getVisibility() != 8 && hasDividerBeforeChildAt(i))
{
LayoutParams layoutparams = (LayoutParams)view.getLayoutParams();
int k;
if (flag)
{
k = view.getRight() + layoutparams.rightMargin;
} else
{
k = view.getLeft() - layoutparams.leftMargin - mDividerWidth;
}
drawVerticalDivider(canvas, k);
}
i++;
}
if (hasDividerBeforeChildAt(l))
{
View view1 = getVirtualChildAt(l - 1);
int j;
if (view1 == null)
{
if (flag)
{
j = getPaddingLeft();
} else
{
j = getWidth() - getPaddingRight() - mDividerWidth;
}
} else
{
LayoutParams layoutparams1 = (LayoutParams)view1.getLayoutParams();
if (flag)
{
j = view1.getLeft() - layoutparams1.leftMargin - mDividerWidth;
} else
{
j = view1.getRight() + layoutparams1.rightMargin;
}
}
drawVerticalDivider(canvas, j);
}
}
示例13: stopDrag
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
private void stopDrag(MotionEvent motionevent)
{
mTouchMode = 0;
boolean flag;
boolean flag1;
boolean flag2;
if (motionevent.getAction() == 1 && isEnabled())
{
flag = true;
} else
{
flag = false;
}
flag2 = isChecked();
if (flag)
{
mVelocityTracker.computeCurrentVelocity(1000);
float f = mVelocityTracker.getXVelocity();
if (Math.abs(f) > (float)mMinFlingVelocity)
{
if (ViewUtils.isLayoutRtl(this))
{
if (f < 0.0F)
{
flag1 = true;
} else
{
flag1 = false;
}
} else
if (f > 0.0F)
{
flag1 = true;
} else
{
flag1 = false;
}
} else
{
flag1 = getTargetCheckedState();
}
} else
{
flag1 = flag2;
}
if (flag1 != flag2)
{
playSoundEffect(0);
setChecked(flag1);
}
cancelSuperTouch(motionevent);
}
示例14: computeContentWidth
import android.support.v7.internal.widget.ViewUtils; //导入依赖的package包/类
void computeContentWidth()
{
Drawable drawable = getBackground();
int i = 0;
int i1;
int j1;
int k1;
if (drawable != null)
{
drawable.getPadding(AppCompatSpinner.access$300(AppCompatSpinner.this));
int j;
int k;
int l;
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i = AppCompatSpinner.access$300(AppCompatSpinner.this).right;
} else
{
i = -AppCompatSpinner.access$300(AppCompatSpinner.this).left;
}
} else
{
Rect rect = AppCompatSpinner.access$300(AppCompatSpinner.this);
AppCompatSpinner.access$300(AppCompatSpinner.this).right = 0;
rect.left = 0;
}
i1 = getPaddingLeft();
j1 = getPaddingRight();
k1 = getWidth();
if (AppCompatSpinner.access$400(AppCompatSpinner.this) == -2)
{
k = AppCompatSpinner.access$500(AppCompatSpinner.this, (SpinnerAdapter)mAdapter, getBackground());
l = getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.access$300(AppCompatSpinner.this).left - AppCompatSpinner.access$300(AppCompatSpinner.this).right;
j = k;
if (k > l)
{
j = l;
}
setContentWidth(Math.max(j, k1 - i1 - j1));
} else
if (AppCompatSpinner.access$400(AppCompatSpinner.this) == -1)
{
setContentWidth(k1 - i1 - j1);
} else
{
setContentWidth(AppCompatSpinner.access$400(AppCompatSpinner.this));
}
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
{
i += k1 - j1 - getWidth();
} else
{
i += i1;
}
setHorizontalOffset(i);
}