Java Code Examples for android.view.View#isHardwareAccelerated()

The following examples show how to use android.view.View#isHardwareAccelerated() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
private void prepareContent() {
	if (mAnimating) {
		return;
	}

	// Something changed in the content, we need to honor the layout request
	// before creating the cached bitmap
	final View content = mContent;
	if (content.isLayoutRequested()) {
		final int childHeight = mHandleHeight;
		int height = getBottom() - getTop() - childHeight - mTopOffset;
		content.measure(MeasureSpec.makeMeasureSpec(getRight() - getLeft(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
		content.layout(0, mTopOffset + childHeight, content.getMeasuredWidth(), mTopOffset + childHeight + content.getMeasuredHeight());
	}
	// Try only onceā€¦ we should really loop but it's not a big deal
	// if the draw was cancelled, it will only be temporary anyway
	content.getViewTreeObserver().dispatchOnPreDraw();
	if (!content.isHardwareAccelerated())
		content.buildDrawingCache();

	content.setVisibility(View.GONE);
}
 
Example 2
Source Project: android_9.0.0_r45   File: SlidingDrawer.java    License: Apache License 2.0 5 votes vote down vote up
private void prepareContent() {
    if (mAnimating) {
        return;
    }

    // Something changed in the content, we need to honor the layout request
    // before creating the cached bitmap
    final View content = mContent;
    if (content.isLayoutRequested()) {
        if (mVertical) {
            final int childHeight = mHandleHeight;
            int height = mBottom - mTop - childHeight - mTopOffset;
            content.measure(MeasureSpec.makeMeasureSpec(mRight - mLeft, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
            content.layout(0, mTopOffset + childHeight, content.getMeasuredWidth(),
                    mTopOffset + childHeight + content.getMeasuredHeight());
        } else {
            final int childWidth = mHandle.getWidth();
            int width = mRight - mLeft - childWidth - mTopOffset;
            content.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(mBottom - mTop, MeasureSpec.EXACTLY));
            content.layout(childWidth + mTopOffset, 0,
                    mTopOffset + childWidth + content.getMeasuredWidth(),
                    content.getMeasuredHeight());
        }
    }
    // Try only once... we should really loop but it's not a big deal
    // if the draw was cancelled, it will only be temporary anyway
    content.getViewTreeObserver().dispatchOnPreDraw();
    if (!content.isHardwareAccelerated()) content.buildDrawingCache();

    content.setVisibility(View.GONE);        
}
 
Example 3
Source Project: TigerVideo   File: DisplayManager.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isHardwareAccelerated(final View v) {
    if (Build.VERSION.SDK_INT >= 11) {
        try {
            return v.isHardwareAccelerated();
        } catch (Exception e) {
        }
    }
    return false;
}
 
Example 4
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View view = getChildAt(i);
        view.setDrawingCacheEnabled(enabled);
        // Update the drawing caches
        if (!view.isHardwareAccelerated() && enabled) {
            view.buildDrawingCache(true);
        }
    }
}
 
Example 5
Source Project: sa-sdk-android   File: ViewUtil.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
public static void invalidateLayerTypeView(View[] views) {
    for (View view : views) {
        if (ViewUtil.viewVisibilityInParents(view) && view.isHardwareAccelerated()) {
            checkAndInvalidate(view);
            if (view instanceof ViewGroup) {
                invalidateViewGroup((ViewGroup) view);
            }
        }
    }
}
 
Example 6
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View view = getChildAt(i);
        view.setDrawingCacheEnabled(enabled);
        // Update the drawing caches
        if (!view.isHardwareAccelerated()) {
            view.buildDrawingCache(true);
        }
    }
}
 
Example 7
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View view = getChildAt(i);
        view.setDrawingCacheEnabled(enabled);
        // Update the drawing caches
        if (!view.isHardwareAccelerated() && enabled) {
            view.buildDrawingCache(true);
        }
    }
}
 
Example 8
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View view = getChildAt(i);
        view.setDrawingCacheEnabled(enabled);
        // Update the drawing caches
        if (!view.isHardwareAccelerated()) {
            view.buildDrawingCache(true);
        }
    }
}
 
Example 9
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View view = getChildAt(i);
        view.setDrawingCacheEnabled(enabled);
        // Update the drawing caches
        if (!view.isHardwareAccelerated() && enabled) {
            view.buildDrawingCache(true);
        }
    }
}
 
Example 10
private void prepareContent() {
    if (mAnimating) {
        return;
    }

    // Something changed in the content, we need to honor the layout request
    // before creating the cached bitmap
    final View content = mContent;
    if (content.isLayoutRequested()) {
        if (mVertical) {
            final int childHeight = mHandleHeight;
            int height = getBottom() - getTop() - childHeight - mTopOffset;
            content.measure(MeasureSpec.makeMeasureSpec(getRight() - getLeft(), MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
            content.layout(0, mTopOffset + childHeight, content.getMeasuredWidth(),
                    mTopOffset + childHeight + content.getMeasuredHeight());
        } else {
            final int childWidth = mHandle.getWidth();
            int width = getRight() - getLeft() - childWidth - mTopOffset;
            content.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(getBottom() - getTop() , MeasureSpec.EXACTLY));
            content.layout(childWidth + mTopOffset, 0,
                    mTopOffset + childWidth + content.getMeasuredWidth(),
                    content.getMeasuredHeight());
        }
    }
    // Try only once... we should really loop but it's not a big deal
    // if the draw was cancelled, it will only be temporary anyway
    content.getViewTreeObserver().dispatchOnPreDraw();
    if (!content.isHardwareAccelerated()) content.buildDrawingCache();

    content.setVisibility(View.GONE);        
}
 
Example 11
Source Project: sealrtc-android   File: SeekBarCompatDontCrash.java    License: MIT License 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 12
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 13
Source Project: Musicoco   File: SeekBarCompatDontCrash.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 14
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 15
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 16
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 17
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 18
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 19
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 20
Source Project: Klyph   File: KlyphSlidingDrawer.java    License: MIT License 4 votes vote down vote up
@TargetApi(11)
private void checkHardwareAccelerated(View view)
{
	if (!view.isHardwareAccelerated()) view.buildDrawingCache();
}