Java Code Examples for android.view.View.getMeasuredState()

The following are Jave code examples for showing how to use getMeasuredState() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: PageScrollView   File: PageScrollView.java   Source Code and License Vote up 5 votes
protected int measureExtraView(View view, int widthMeasureSpec, int heightMeasureSpec, boolean horizontal) {
    int childState = 0;
    if (isChildNotGone(view)) {
        int mContentWidth = getContentWidth(), mContentHeight = getContentHeight();
        PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) view.getLayoutParams();
        int childMarginHorizontal = params.getMarginHorizontal();
        int childMarginVertical = params.getMarginVertical();
        int extraMeasureWidthSpec = getChildMeasureSpec(widthMeasureSpec, childMarginHorizontal, params.width);
        int extraMeasureHeightSpec = getChildMeasureSpec(heightMeasureSpec, childMarginVertical, params.height);
        if (horizontal) {
            if (params.width == -1) {
                extraMeasureWidthSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(extraMeasureWidthSpec), MeasureSpec.EXACTLY);
            }
            params.measure(view, extraMeasureWidthSpec, extraMeasureHeightSpec);
            int contentHeight = view.getMeasuredHeight() + childMarginVertical;
            mContentWidth = Math.max(mContentWidth, view.getMeasuredWidth() + childMarginHorizontal);
            if (contentHeight > 0) {
                mContentHeight += contentHeight;
            }
        } else {
            if (params.height == -1) {
                extraMeasureHeightSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(extraMeasureHeightSpec), MeasureSpec.EXACTLY);
            }
            params.measure(view, extraMeasureWidthSpec, extraMeasureHeightSpec);
            int contentWidth = view.getMeasuredWidth() + childMarginHorizontal;
            if (contentWidth > 0) {
                mContentWidth += contentWidth;
            }
            mContentHeight = Math.max(mContentHeight, view.getMeasuredHeight() + childMarginVertical);
        }
        setContentSize(mContentWidth, mContentHeight);
        childState = view.getMeasuredState();
    }
    return childState;
}
 
Example 2
Project: PageScrollView   File: PageScrollView.java   Source Code and License Vote up 5 votes
protected int measureMiddleViewVertical(int widthMeasureSpec, int heightMeasureSpec, int childFixedSize, int parentRealSize) {
    final int childCount = getChildCount();
    int childFixedHeightSpec = childFixedSize <= 0 ? 0 : MeasureSpec.makeMeasureSpec(childFixedSize, MeasureSpec.EXACTLY);
    int contentWidth = 0;
    int contentHeight = 0;
    int measuredCount = 0;
    int childState = 0;
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == View.GONE || (child == mPageHeaderView || child == mPageFooterView))
            continue;
        PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) child.getLayoutParams();
        int childMarginHorizontal = params.getMarginHorizontal();
        int childMarginVertical = params.getMarginVertical();
        int childWidthSpec = getMiddleChildMeasureSpec(widthMeasureSpec, 0, childMarginHorizontal, params.width);
        int childHeightSpec = childFixedHeightSpec == 0 ? getMiddleChildMeasureSpec(heightMeasureSpec, parentRealSize, childMarginVertical, params.height) : childFixedHeightSpec;
        params.measure(child, childWidthSpec, childHeightSpec);
        if (mMiddleMargin > 0 && measuredCount > 0) {
            contentHeight += mMiddleMargin;
        }
        contentHeight += (child.getMeasuredHeight() + childMarginVertical);
        int itemWidth = child.getMeasuredWidth() + childMarginHorizontal;
        if (contentWidth < itemWidth) {
            contentWidth = itemWidth;
        }
        childState |= child.getMeasuredState();
        measuredCount++;
    }
    setContentSize(getContentWidth() + contentWidth, Math.max(getContentHeight(), contentHeight));
    return childState;
}
 
Example 3
Project: PageScrollView   File: PageScrollView.java   Source Code and License Vote up 5 votes
protected int measureMiddleViewHorizontal(int widthMeasureSpec, int heightMeasureSpec, int childFixedSize, final int parentRealSize) {
    final int childCount = getChildCount();
    int childFixedWidthSpec = childFixedSize <= 0 ? 0 : MeasureSpec.makeMeasureSpec(childFixedSize, MeasureSpec.EXACTLY);
    int contentWidth = 0;
    int contentHeight = 0;
    int measuredCount = 0;
    int childState = 0;
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == View.GONE || (child == mPageHeaderView || child == mPageFooterView))
            continue;
        PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) child.getLayoutParams();
        int childMarginHorizontal = params.getMarginHorizontal();
        int childMarginVertical = params.getMarginVertical();
        int childWidthSpec = childFixedWidthSpec == 0 ? getMiddleChildMeasureSpec(widthMeasureSpec, parentRealSize, childMarginHorizontal, params.width) : childFixedWidthSpec;
        int childHeightSpec = getMiddleChildMeasureSpec(heightMeasureSpec, 0, childMarginVertical, params.height);
        params.measure(child, childWidthSpec, childHeightSpec);
        if (mMiddleMargin > 0 && measuredCount > 0) {
            contentWidth += mMiddleMargin;
        }
        contentWidth += (child.getMeasuredWidth() + childMarginHorizontal);
        int itemHeight = child.getMeasuredHeight() + childMarginVertical;
        if (contentHeight < itemHeight) {
            contentHeight = itemHeight;
        }
        childState |= child.getMeasuredState();
        measuredCount++;
    }
    setContentSize(Math.max(getContentWidth(), contentWidth), getContentHeight() + contentHeight);
    return childState;
}
 
Example 4
Project: CSipSimple   File: Utility11.java   Source Code and License Vote up 4 votes
@Override
public int getMeasuredState(View child) {
    return child.getMeasuredState();
}
 
Example 5
Project: letv   File: ViewCompatHC.java   Source Code and License Vote up 4 votes
public static int getMeasuredState(View view) {
    return view.getMeasuredState();
}
 
Example 6
Project: boohee_v5.6   File: ViewCompatHC.java   Source Code and License Vote up 4 votes
public static int getMeasuredState(View view) {
    return view.getMeasuredState();
}
 
Example 7
Project: appinventor-extensions   File: HoneycombUtil.java   Source Code and License Vote up 4 votes
public static int getMeasuredState(View view) {
  return view.getMeasuredState();
}