Java Code Examples for android.view.View#getPaddingRight()

The following examples show how to use android.view.View#getPaddingRight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaddingLeftAttr.java    From PlayTogether with Apache License 2.0 5 votes vote down vote up
@Override
protected void execute(View view, int val)
{
    int l = val;
    int t = view.getPaddingTop();
    int r = view.getPaddingRight();
    int b = view.getPaddingBottom();
    view.setPadding(l, t, r, b);

}
 
Example 2
Source File: ChromeSwitchPreference.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    if (mDrawDivider) {
        int left = view.getPaddingLeft();
        int right = view.getPaddingRight();
        int top = view.getPaddingTop();
        int bottom = view.getPaddingBottom();
        view.setBackground(DividerDrawable.create(getContext()));
        view.setPadding(left, top, right, bottom);
    }

    SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.switch_widget);
    // On BLU Life Play devices SwitchPreference.setWidgetLayoutResource() does nothing. As a
    // result, the user will see a non-material Switch and switchView will be null, hence the
    // null check below. http://crbug.com/451447
    if (switchView != null) {
        switchView.setChecked(isChecked());
    }

    TextView title = (TextView) view.findViewById(android.R.id.title);
    title.setSingleLine(false);
    if (!mDontUseSummaryAsTitle && TextUtils.isEmpty(getTitle())) {
        TextView summary = (TextView) view.findViewById(android.R.id.summary);
        title.setText(summary.getText());
        title.setVisibility(View.VISIBLE);
        summary.setVisibility(View.GONE);
    }

    if (mManagedPrefDelegate != null) mManagedPrefDelegate.onBindViewToPreference(this, view);
}
 
Example 3
Source File: AutoUtils.java    From Autolayout with Apache License 2.0 5 votes vote down vote up
public static void autoPadding(View view) {

        int l = view.getPaddingLeft();
        int t = view.getPaddingTop();
        int r = view.getPaddingRight();
        int b = view.getPaddingBottom();


        l = getDisplayWidthValue(l);
        t = getDisplayHeightValue(t);
        r = getDisplayWidthValue(r);
        b = getDisplayHeightValue(b);

        view.setPadding(l, t, r, b);
    }
 
Example 4
Source File: ViewHelper.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
public static void resetViewBottomPadding(@Nullable View view, boolean scroll) {
    if (view == null) return;

    Context context = ContextHelper.getBaseContext(view);
    int orientation = context.getResources().getConfiguration().orientation;

    int left = view.getPaddingLeft();
    int right = view.getPaddingRight();
    int bottom = view.getPaddingTop();
    int top = view.getPaddingTop();
    int navBar = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        boolean tabletMode = context.getResources().getBoolean(R.bool.android_helpers_tablet_mode);
        if (tabletMode || orientation == Configuration.ORIENTATION_PORTRAIT) {
            navBar = getNavigationBarHeight(context);
        }

        if (!scroll) {
            navBar += getStatusBarHeight(context);
        }
    }

    if (!scroll) {
        navBar += getToolbarHeight(context);
    }
    view.setPadding(left, top, right, (bottom + navBar));
}
 
Example 5
Source File: AutoUtils.java    From PlayTogether with Apache License 2.0 5 votes vote down vote up
public static void autoPadding(View view)
{
	Object tag = view.getTag(R.id.id_tag_autolayout_padding);
	if (tag != null) return;
	view.setTag(R.id.id_tag_autolayout_padding, "Just Identify");
	int l = view.getPaddingLeft();
	int t = view.getPaddingTop();
	int r = view.getPaddingRight();
	int b = view.getPaddingBottom();
	l = getPercentWidthSize(l);
	t = getPercentHeightSize(t);
	r = getPercentWidthSize(r);
	b = getPercentHeightSize(b);
	view.setPadding(l, t, r, b);
}
 
Example 6
Source File: ViewUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the background of a view to the given 9-patch resource and restores its padding. This
 * works around a bug in Android where the padding is lost when a 9-patch resource is applied
 * programmatically.
 */
public static void setNinePatchBackgroundResource(View view, @DrawableRes int resource) {
    int left = view.getPaddingLeft();
    int top = view.getPaddingTop();
    int right = view.getPaddingRight();
    int bottom = view.getPaddingBottom();
    view.setBackgroundResource(resource);
    view.setPadding(left, top, right, bottom);
}
 
Example 7
Source File: RotateOutDownRightAnimator.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(View target) {
    float x = target.getWidth() - target.getPaddingRight();
    float y = target.getHeight() - target.getPaddingBottom();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 1, 0),
            ObjectAnimator.ofFloat(target,"rotation",0,-90),
            ObjectAnimator.ofFloat(target,"pivotX",x,x),
            ObjectAnimator.ofFloat(target,"pivotY",y,y)
    );
}
 
Example 8
Source File: AnimationUtils.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
public static void measureDynamicHeight(View view) {
	int width = view.getWidth();
	if (width <= 0) {
		View parent = (View) view.getParent();
		width = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight();
	}
	int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);
	int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
	view.measure(widthMeasureSpec, heightMeasureSpec);
}
 
Example 9
Source File: RotateOutDownRightAnimator.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(View target) {
    float x = target.getWidth() - target.getPaddingRight();
    float y = target.getHeight() - target.getPaddingBottom();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 1, 0),
            ObjectAnimator.ofFloat(target,"rotation",0,-90),
            ObjectAnimator.ofFloat(target,"pivotX",x,x),
            ObjectAnimator.ofFloat(target,"pivotY",y,y)
    );
}
 
Example 10
Source File: PaddingLeftAttr.java    From AutoLayout with Apache License 2.0 5 votes vote down vote up
@Override
protected void execute(View view, int val)
{
    int l = val;
    int t = view.getPaddingTop();
    int r = view.getPaddingRight();
    int b = view.getPaddingBottom();
    view.setPadding(l, t, r, b);

}
 
Example 11
Source File: PaddingTopAttr.java    From AutoLayout with Apache License 2.0 5 votes vote down vote up
@Override
protected void execute(View view, int val)
{
    int l = view.getPaddingLeft();
    int t = val;
    int r = view.getPaddingRight();
    int b = view.getPaddingBottom();
    view.setPadding(l, t, r, b);

}
 
Example 12
Source File: ChromeSwitchPreference.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    if (mDrawDivider) {
        int left = view.getPaddingLeft();
        int right = view.getPaddingRight();
        int top = view.getPaddingTop();
        int bottom = view.getPaddingBottom();
        view.setBackground(DividerDrawable.create(getContext()));
        view.setPadding(left, top, right, bottom);
    }

    SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.switch_widget);
    // On BLU Life Play devices SwitchPreference.setWidgetLayoutResource() does nothing. As a
    // result, the user will see a non-material Switch and switchView will be null, hence the
    // null check below. http://crbug.com/451447
    if (switchView != null) {
        switchView.setChecked(isChecked());
    }

    TextView title = (TextView) view.findViewById(android.R.id.title);
    title.setSingleLine(false);
    if (!mDontUseSummaryAsTitle && TextUtils.isEmpty(getTitle())) {
        TextView summary = (TextView) view.findViewById(android.R.id.summary);
        title.setText(summary.getText());
        title.setVisibility(View.VISIBLE);
        summary.setVisibility(View.GONE);
    }

    if (mManagedPrefDelegate != null) mManagedPrefDelegate.onBindViewToPreference(this, view);
}
 
Example 13
Source File: RotateInUpRightAnimator.java    From KUtils with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(View target) {
    float x = target.getWidth() - target.getPaddingRight();
    float y = target.getHeight() - target.getPaddingBottom();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "rotation", -90, 0),
            ObjectAnimator.ofFloat(target, "alpha", 0, 1),
            ObjectAnimator.ofFloat(target, "pivotX", x, x),
            ObjectAnimator.ofFloat(target, "pivotY", y, y)
    );
}
 
Example 14
Source File: WaveAnimator.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(View target) {
    float x = (target.getWidth() - target.getPaddingLeft() - target.getPaddingRight())/2
            + target.getPaddingLeft();
    float y = target.getHeight() - target.getPaddingBottom();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "rotation", 12,-12,3,-3,0),
            ObjectAnimator.ofFloat(target, "pivotX", x, x,x,x,x),
            ObjectAnimator.ofFloat(target, "pivotY", y, y,y,y,y)
    );
}
 
Example 15
Source File: AnimationBuilder.java    From ViewAnimator with Apache License 2.0 5 votes vote down vote up
public AnimationBuilder standUp() {
    for (View view : views) {
        float x = (view.getWidth() - view.getPaddingLeft() - view.getPaddingRight()) / 2
                + view.getPaddingLeft();
        float y = view.getHeight() - view.getPaddingBottom();
        pivotX(x, x, x, x, x);
        pivotY(y, y, y, y, y);
        rotationX(55, -30, 15, -15, 0);
    }
    return this;
}
 
Example 16
Source File: ViewHelper.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static int getPaddingEnd(View view) {
    return LocaleController.isRTL ? view.getPaddingLeft() : view.getPaddingRight();
}
 
Example 17
Source File: BackgroundCountdown.java    From CountdownView with MIT License 4 votes vote down vote up
@Override
public void onMeasure(View v, int viewWidth, int viewHeight, int allContentWidth, int allContentHeight) {
    float retTopPaddingSize = initTimeTextBaselineAndTimeBgTopPadding(viewHeight, v.getPaddingTop(), v.getPaddingBottom(), allContentHeight);
    mLeftPaddingSize = v.getPaddingLeft() == v.getPaddingRight() ?  (viewWidth - allContentWidth) / 2 : v.getPaddingLeft();
    initTimeBgRect(retTopPaddingSize);
}
 
Example 18
Source File: ViewCompat.java    From letv with Apache License 2.0 4 votes vote down vote up
public int getPaddingEnd(View view) {
    return view.getPaddingRight();
}
 
Example 19
Source File: ViewHelper.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static int getPaddingEnd(View view) {
    return LocaleController.isRTL ? view.getPaddingLeft() : view.getPaddingRight();
}
 
Example 20
Source File: PaddingProperties.java    From android_additive_animations with Apache License 2.0 4 votes vote down vote up
@Override
public Float get(View object) {
    return (float) object.getPaddingRight();
}