Search in sources :

Example 11 with Insets

use of android.graphics.Insets in project platform_frameworks_base by android.

the class Switch method getThumbScrollRange.

private int getThumbScrollRange() {
    if (mTrackDrawable != null) {
        final Rect padding = mTempRect;
        mTrackDrawable.getPadding(padding);
        final Insets insets;
        if (mThumbDrawable != null) {
            insets = mThumbDrawable.getOpticalInsets();
        } else {
            insets = Insets.NONE;
        }
        return mSwitchWidth - mThumbWidth - padding.left - padding.right - insets.left - insets.right;
    } else {
        return 0;
    }
}
Also used : Rect(android.graphics.Rect) Insets(android.graphics.Insets)

Example 12 with Insets

use of android.graphics.Insets in project platform_frameworks_base by android.

the class TextView method getBoxHeight.

/////////////////////////////////////////////////////////////////////////
private int getBoxHeight(Layout l) {
    Insets opticalInsets = isLayoutModeOptical(mParent) ? getOpticalInsets() : Insets.NONE;
    int padding = (l == mHintLayout) ? getCompoundPaddingTop() + getCompoundPaddingBottom() : getExtendedPaddingTop() + getExtendedPaddingBottom();
    return getMeasuredHeight() - padding + opticalInsets.top + opticalInsets.bottom;
}
Also used : Insets(android.graphics.Insets) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 13 with Insets

use of android.graphics.Insets in project platform_frameworks_base by android.

the class ViewGroup method computeOpticalInsets.

@Override
Insets computeOpticalInsets() {
    if (isLayoutModeOptical()) {
        int left = 0;
        int top = 0;
        int right = 0;
        int bottom = 0;
        for (int i = 0; i < mChildrenCount; i++) {
            View child = getChildAt(i);
            if (child.getVisibility() == VISIBLE) {
                Insets insets = child.getOpticalInsets();
                left = Math.max(left, insets.left);
                top = Math.max(top, insets.top);
                right = Math.max(right, insets.right);
                bottom = Math.max(bottom, insets.bottom);
            }
        }
        return Insets.of(left, top, right, bottom);
    } else {
        return Insets.NONE;
    }
}
Also used : Insets(android.graphics.Insets) Paint(android.graphics.Paint)

Example 14 with Insets

use of android.graphics.Insets in project android_frameworks_base by DirtyUnicorns.

the class ViewGroup method computeOpticalInsets.

@Override
Insets computeOpticalInsets() {
    if (isLayoutModeOptical()) {
        int left = 0;
        int top = 0;
        int right = 0;
        int bottom = 0;
        for (int i = 0; i < mChildrenCount; i++) {
            View child = getChildAt(i);
            if (child.getVisibility() == VISIBLE) {
                Insets insets = child.getOpticalInsets();
                left = Math.max(left, insets.left);
                top = Math.max(top, insets.top);
                right = Math.max(right, insets.right);
                bottom = Math.max(bottom, insets.bottom);
            }
        }
        return Insets.of(left, top, right, bottom);
    } else {
        return Insets.NONE;
    }
}
Also used : Insets(android.graphics.Insets) Paint(android.graphics.Paint)

Example 15 with Insets

use of android.graphics.Insets in project android_frameworks_base by DirtyUnicorns.

the class View method setOpticalFrame.

private boolean setOpticalFrame(int left, int top, int right, int bottom) {
    Insets parentInsets = mParent instanceof View ? ((View) mParent).getOpticalInsets() : Insets.NONE;
    Insets childInsets = getOpticalInsets();
    return setFrame(left + parentInsets.left - childInsets.left, top + parentInsets.top - childInsets.top, right + parentInsets.left + childInsets.right, bottom + parentInsets.top + childInsets.bottom);
}
Also used : Insets(android.graphics.Insets)

Aggregations

Insets (android.graphics.Insets)73 Paint (android.graphics.Paint)53 Rect (android.graphics.Rect)35 TextPaint (android.text.TextPaint)26 Drawable (android.graphics.drawable.Drawable)15 Point (android.graphics.Point)10 NinePatch (android.graphics.NinePatch)5 Layout (android.text.Layout)5 StaticLayout (android.text.StaticLayout)5 LongSparseLongArray (android.util.LongSparseLongArray)4