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

The following examples show how to use android.support.v4.view.ViewCompat#isOpaque() . 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 static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) {
        return true;
    }
    if (VERSION.SDK_INT >= 18) {
        return false;
    }
    Drawable bg = v.getBackground();
    if (bg == null) {
        return false;
    }
    if (bg.getOpacity() != -1) {
        return false;
    }
    return true;
}
 
Example 2
Source File: SlideFrameLayout.java    From AccountBook with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 判断指定的View是否是不透明
 *
 * @param v
 * @return
 */
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) {
        return true;
    }

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) {
        return false;
    }

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 3
Source File: SlidingPaneLayout.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private static boolean f(View view)
{
    if (!ViewCompat.isOpaque(view))
    {
        if (android.os.Build.VERSION.SDK_INT >= 18)
        {
            return false;
        }
        Drawable drawable = view.getBackground();
        if (drawable != null)
        {
            if (drawable.getOpacity() != -1)
            {
                return false;
            }
        } else
        {
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: SlidingPaneLayout.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 5
Source File: ResideLayout.java    From ResideLayout with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    return bg != null && bg.getOpacity() == PixelFormat.OPAQUE;
}
 
Example 6
Source File: SlidingPaneLayout.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 7
Source File: SlidingPaneLayout.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 8
Source File: SlidingUpPaneLayout.java    From SlidingUpPaneLayout with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 9
Source File: SlidingLayout.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 10
Source File: SlidingPaneLayout.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}
 
Example 11
Source File: SlidingPaneLayout.java    From guideshow with MIT License 5 votes vote down vote up
private static boolean viewIsOpaque(View v) {
    if (ViewCompat.isOpaque(v)) return true;

    // View#isOpaque didn't take all valid opaque scrollbar modes into account
    // before API 18 (JB-MR2). On newer devices rely solely on isOpaque above and return false
    // here. On older devices, check the view's background drawable directly as a fallback.
    if (Build.VERSION.SDK_INT >= 18) return false;

    final Drawable bg = v.getBackground();
    if (bg != null) {
        return bg.getOpacity() == PixelFormat.OPAQUE;
    }
    return false;
}