Java Code Examples for android.support.v4.view.ViewCompat#MEASURED_STATE_MASK

The following examples show how to use android.support.v4.view.ViewCompat#MEASURED_STATE_MASK . 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: ImageUtils.java    From FimiX8-RE with MIT License 6 votes vote down vote up
private static int YUV2RGB(int y, int u, int v) {
    u -= 128;
    v -= 128;
    int y1192 = (y + -16 < 0 ? 0 : y - 16) * 1192;
    int r = y1192 + (v * 1634);
    int g = (y1192 - (v * 833)) - (u * 400);
    int b = y1192 + (u * 2066);
    if (r > kMaxChannelValue) {
        r = kMaxChannelValue;
    } else if (r < 0) {
        r = 0;
    }
    if (g > kMaxChannelValue) {
        g = kMaxChannelValue;
    } else if (g < 0) {
        g = 0;
    }
    if (b > kMaxChannelValue) {
        b = kMaxChannelValue;
    } else if (b < 0) {
        b = 0;
    }
    return ((ViewCompat.MEASURED_STATE_MASK | ((r << 6) & 16711680)) | ((g >> 2) & MotionEventCompat.ACTION_POINTER_INDEX_MASK)) | ((b >> 10) & 255);
}
 
Example 2
Source File: H264ToBitmap.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public static int[] convertByteToColor(byte[] data) {
    int size = data.length;
    if (size == 0) {
        return null;
    }
    int[] color = new int[(size / 4)];
    int colorLen = color.length;
    for (int i = 0; i < colorLen; i++) {
        int blue = data[(i * 4) + 2] & 255;
        color[i] = ((((data[i * 4] & 255) << 16) | ((data[(i * 4) + 1] & 255) << 8)) | blue) | ViewCompat.MEASURED_STATE_MASK;
    }
    return color;
}
 
Example 3
Source File: PercentLayoutHelper.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private static boolean shouldHandleMeasuredWidthTooSmall(View view, PercentLayoutInfo info) {
    int state = ViewCompat.getMeasuredWidthAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    if (info == null || info.widthPercent == null || info.mPreservedParams == null || state != 16777216 || info.widthPercent.percent < 0.0f || info.mPreservedParams.width != -2) {
        return false;
    }
    return true;
}
 
Example 4
Source File: PercentLayoutHelper.java    From android-percent-support-extend with Apache License 2.0 5 votes vote down vote up
private static boolean shouldHandleMeasuredWidthTooSmall(View view, PercentLayoutInfo info)
{
    int state = ViewCompat.getMeasuredWidthAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    if (info == null || info.widthPercent == null)
    {
        return false;
    }
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.widthPercent.percent >= 0 &&
            info.mPreservedParams.width == ViewGroup.LayoutParams.WRAP_CONTENT;
}
 
Example 5
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 6
Source File: TestJava.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public static byte[] getBytes(float data) {
    int intBits = Float.floatToIntBits(data);
    return new byte[]{(byte) (intBits & 255), (byte) ((MotionEventCompat.ACTION_POINTER_INDEX_MASK & intBits) >> 8), (byte) ((16711680 & intBits) >> 16), (byte) ((ViewCompat.MEASURED_STATE_MASK & intBits) >> 24)};
}
 
Example 7
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 4 votes vote down vote up
private static int calculateStatusColor(@ColorInt int color, int alpha) {
    float a = 1.0f - (((float) alpha) / 255.0f);
    return ((ViewCompat.MEASURED_STATE_MASK | (((int) (((double) (((float) ((color >> 16) & 255)) * a)) + 0.5d)) << 16)) | (((int) (((double) (((float) ((color >> 8) & 255)) * a)) + 0.5d)) << 8)) | ((int) (((double) (((float) (color & 255)) * a)) + 0.5d));
}
 
Example 8
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 9
Source File: StatusBarCompat.java    From FimiX8-RE with MIT License 4 votes vote down vote up
private static int calculateStatusBarColor(int color, int alpha) {
    float a = 1.0f - (((float) alpha) / 255.0f);
    return ((ViewCompat.MEASURED_STATE_MASK | (((int) (((double) (((float) ((color >> 16) & 255)) * a)) + 0.5d)) << 16)) | (((int) (((double) (((float) ((color >> 8) & 255)) * a)) + 0.5d)) << 8)) | ((int) (((double) (((float) (color & 255)) * a)) + 0.5d));
}
 
Example 10
Source File: PercentLayoutHelper.java    From JD-Test with Apache License 2.0 4 votes vote down vote up
private static boolean shouldHandleMeasuredWidthTooSmall(View view, PercentLayoutInfo info) {
    int state = ViewCompat.getMeasuredWidthAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.widthPercent >= 0 &&
            info.mPreservedParams.width == ViewGroup.LayoutParams.WRAP_CONTENT;
}
 
Example 11
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;
}