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;
}
}
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;
}
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;
}
}
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;
}
}
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);
}
Aggregations