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

The following examples show how to use android.view.View#getPaddingRight() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: delion   File: ChromeSwitchPreference.java    License: 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 2
Source Project: PlayTogether   File: PaddingLeftAttr.java    License: 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 3
Source Project: Autolayout   File: AutoUtils.java    License: 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 Project: wallpaperboard   File: ViewHelper.java    License: 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 Project: PlayTogether   File: AutoUtils.java    License: 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 Project: 365browser   File: ViewUtils.java    License: 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
@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 Project: Dashchan   File: AnimationUtils.java    License: 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
@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 Project: AutoLayout   File: PaddingTopAttr.java    License: 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 11
@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 12
Source Project: KUtils   File: RotateInUpRightAnimator.java    License: 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 13
Source Project: UltimateAndroid   File: WaveAnimator.java    License: 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 14
Source Project: ViewAnimator   File: AnimationBuilder.java    License: 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 15
Source Project: AutoLayout   File: PaddingLeftAttr.java    License: 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 16
@Override
public Float get(View object) {
    return (float) object.getPaddingRight();
}
 
Example 17
public static int getPaddingEnd(View view) {
    return LocaleController.isRTL ? view.getPaddingLeft() : view.getPaddingRight();
}
 
Example 18
Source Project: letv   File: ViewCompat.java    License: Apache License 2.0 4 votes vote down vote up
public int getPaddingEnd(View view) {
    return view.getPaddingRight();
}
 
Example 19
Source Project: CountdownView   File: BackgroundCountdown.java    License: 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 20
public static int getPaddingEnd(View view) {
    return LocaleController.isRTL ? view.getPaddingLeft() : view.getPaddingRight();
}