Java Code Examples for android.support.v4.view.ViewCompat#getMeasuredHeightAndState()

The following examples show how to use android.support.v4.view.ViewCompat#getMeasuredHeightAndState() . 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: DayPickerView.java    From AppCompat-Extension-Library with Apache License 2.0 6 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final ViewPager viewPager = mViewPager;
    measureChild(viewPager, widthMeasureSpec, heightMeasureSpec);

    final int measuredWidthAndState = ViewCompat.getMeasuredWidthAndState(viewPager);
    final int measuredHeightAndState = ViewCompat.getMeasuredHeightAndState(viewPager);
    setMeasuredDimension(measuredWidthAndState, measuredHeightAndState);

    final int pagerWidth = viewPager.getMeasuredWidth();
    final int pagerHeight = viewPager.getMeasuredHeight();
    final int buttonWidthSpec = MeasureSpec.makeMeasureSpec(pagerWidth, MeasureSpec.AT_MOST);
    final int buttonHeightSpec = MeasureSpec.makeMeasureSpec(pagerHeight, MeasureSpec.AT_MOST);
    mPrevButton.measure(buttonWidthSpec, buttonHeightSpec);
    mNextButton.measure(buttonWidthSpec, buttonHeightSpec);
}
 
Example 2
Source File: PercentLayoutHelper.java    From android-percent-support-extend with Apache License 2.0 5 votes vote down vote up
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info)
{
    int state = ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    if (info == null || info.heightPercent == null)
    {
        return false;
    }
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.heightPercent.percent >= 0 &&
            info.mPreservedParams.height == ViewGroup.LayoutParams.WRAP_CONTENT;
}
 
Example 3
Source File: PercentLayoutHelper.java    From FimiX8-RE with MIT License 4 votes vote down vote up
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info) {
    if (info == null || info.heightPercent == null || info.mPreservedParams == null || (ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK) != 16777216 || info.heightPercent.percent < 0.0f || info.mPreservedParams.height != -2) {
        return false;
    }
    return true;
}
 
Example 4
Source File: PercentLayoutHelper.java    From JD-Test with Apache License 2.0 4 votes vote down vote up
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info) {
    int state = ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.heightPercent >= 0 &&
            info.mPreservedParams.height == ViewGroup.LayoutParams.WRAP_CONTENT;
}