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

The following examples show how to use android.support.v4.view.ViewCompat#MEASURED_SIZE_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: SlidingPaneLayout.java    From letv with Apache License 2.0 6 votes vote down vote up
private void dimChildView(View v, float mag, int fadeColor) {
    LayoutParams lp = (LayoutParams) v.getLayoutParams();
    if (mag > 0.0f && fadeColor != 0) {
        int color = (((int) (((float) ((-16777216 & fadeColor) >>> 24)) * mag)) << 24) | (ViewCompat.MEASURED_SIZE_MASK & fadeColor);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != 2) {
            ViewCompat.setLayerType(v, 2, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != 0) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        this.mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
Example 2
Source File: ScrollUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static int mixColors(int fromColor, int toColor, float toAlpha) {
    float[] fromCmyk = cmykFromRgb(fromColor);
    float[] toCmyk = cmykFromRgb(toColor);
    float[] result = new float[4];
    for (int i = 0; i < 4; i++) {
        result[i] = Math.min(1.0f, (fromCmyk[i] * (1.0f - toAlpha)) + (toCmyk[i] * toAlpha));
    }
    return -16777216 + (ViewCompat.MEASURED_SIZE_MASK & rgbFromCmyk(result));
}
 
Example 3
Source File: ColorUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
@ColorInt
public static int setAlphaComponent(@ColorInt int color, @IntRange(from = 0, to = 255) int alpha) {
    if (alpha >= 0 && alpha <= 255) {
        return (ViewCompat.MEASURED_SIZE_MASK & color) | (alpha << 24);
    }
    throw new IllegalArgumentException("alpha must be between 0 and 255.");
}
 
Example 4
Source File: ScrollUtils.java    From letv with Apache License 2.0 4 votes vote down vote up
public static int getColorWithAlpha(float alpha, int baseColor) {
    return (Math.min(255, Math.max(0, (int) (255.0f * alpha))) << 24) + (ViewCompat.MEASURED_SIZE_MASK & baseColor);
}