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

The following examples show how to use android.view.View#isHardwareAccelerated() . 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: SlidingDrawer.java    From flickr-uploader with GNU General Public License v2.0 6 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()) {
		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 File: ShortcutAndWidgetContainer.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: MySlidingDrawer.java    From slidingtabs with GNU General Public License v2.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 = 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 4
Source File: ShortcutAndWidgetContainer.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@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 File: PagedViewCellLayoutChildren.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: SlidingDrawer.java    From android_9.0.0_r45 with 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 7
Source File: PagedViewCellLayoutChildren.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: ViewUtil.java    From sa-sdk-android with 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 9
Source File: ShortcutAndWidgetContainer.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: DisplayManager.java    From TigerVideo with 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 11
Source File: SeekBarCompatDontCrash.java    From FuAgoraDemoDroid with MIT License 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 12
Source File: SeekBarCompatDontCrash.java    From SwipeBack with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 13
Source File: SeekBarCompatDontCrash.java    From Sky31Radio with Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 14
Source File: SeekBarCompatDontCrash.java    From Panoramic-Screenshot with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 15
Source File: SeekBarCompatDontCrash.java    From IdealMedia with Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 16
Source File: SeekBarCompatDontCrash.java    From Musicoco with Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 17
Source File: SeekBarCompatDontCrash.java    From discreteSeekBar with Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 18
Source File: KlyphSlidingDrawer.java    From Klyph with MIT License 4 votes vote down vote up
@TargetApi(11)
private void checkHardwareAccelerated(View view)
{
	if (!view.isHardwareAccelerated()) view.buildDrawingCache();
}
 
Example 19
Source File: SeekBarCompatDontCrash.java    From PLDroidShortVideo with Apache License 2.0 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}
 
Example 20
Source File: SeekBarCompatDontCrash.java    From sealrtc-android with MIT License 4 votes vote down vote up
public static boolean isHardwareAccelerated(View view) {
    return view.isHardwareAccelerated();
}