public S isUsingDrawingCache() { isNotNull(); assertThat(actual.isDrawingCacheEnabled()) // .overridingErrorMessage("Expected to use drawing cache but was not") // .isTrue(); return myself; }
public S isNotUsingDrawingCache() { isNotNull(); assertThat(actual.isDrawingCacheEnabled()) // .overridingErrorMessage("Expected to not be using drawing cache but was") // .isFalse(); return myself; }
} else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false);
if (mCachingStarted && !child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true);
View view = MuPDFActivity.this.getWindow().getDecorView(); if (false == view.isDrawingCacheEnabled()) { view.setDrawingCacheEnabled(true); } Bitmap bitmap = view.getDrawingCache();
public S isUsingDrawingCache() { isNotNull(); assertThat(actual.isDrawingCacheEnabled()) // .overridingErrorMessage("Expected to use drawing cache but was not") // .isTrue(); return myself; }
public S isNotUsingDrawingCache() { isNotNull(); assertThat(actual.isDrawingCacheEnabled()) // .overridingErrorMessage("Expected to not be using drawing cache but was") // .isFalse(); return myself; }
@Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { boolean result; final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); if (Build.VERSION.SDK_INT >= 11) { result = super.drawChild(canvas, child, drawingTime); } else { if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false); } result = super.drawChild(canvas, child, drawingTime); } canvas.restoreToCount(save); return result; }
public static Bitmap getViewAsBitmap(View view){ Bitmap bitmap = null; if(view.isDrawingCacheEnabled()){ view.buildDrawingCache(); bitmap = view.getDrawingCache(); }else { view.setDrawingCacheEnabled(true); view.buildDrawingCache(); bitmap = view.getDrawingCache(); view.destroyDrawingCache(); view.setDrawingCacheEnabled(false); } return bitmap; }
@Override public void run() { try { boolean wasEnabled = activityContent.isDrawingCacheEnabled(); if (!wasEnabled) { activityContent.setDrawingCacheEnabled(true); } LOG.debug("Will now make screen shot of {}", activityContent); if (activityContent.getMeasuredWidth() == 0 && activityContent.getMeasuredHeight() == 0) { activityContent.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); activityContent.layout(0, 0, activityContent.getMeasuredWidth(), activityContent.getMeasuredHeight()); } activityContent.buildDrawingCache(); Bitmap drawingCache = activityContent.getDrawingCache(); boolean gotBitmap = drawingCache != null; LOG.debug("Got drawing cache from root view {}", gotBitmap); if (gotBitmap) { bitmaps[0] = Bitmap.createBitmap(drawingCache); drawingCache.recycle(); } if (!wasEnabled) { activityContent.setDrawingCacheEnabled(false); } latch.countDown(); } catch (Exception e) { LOG.warn("Failed to take screen shot", e); } } });
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override protected void dispatchDraw(Canvas canvas) { View childView = getChildAt(0); if (childView != null) { // If on honeycomb or newer, cache the view. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (childView.isDirty() && !childView.isDrawingCacheEnabled()) { childView.draw(this.wrappedViewDrawingCanvas); // Edited by @Gorcyn { childView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); childView.setDrawingCacheEnabled(true); } if (this.isReflectionEnabled) { this.createReflectedImages(); } } } else { childView.draw(this.wrappedViewDrawingCanvas); } } canvas.drawBitmap(this.wrappedViewBitmap, (this.getWidth() - childView.getWidth()) / 2, 0, this.paint); }
} else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false);
} else { if (lp.dimWhenOffset && mSlideOffset > 0) { if (!child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(true); if (child.isDrawingCacheEnabled()) { child.setDrawingCacheEnabled(false);
if ( mCachingStarted && !child.isDrawingCacheEnabled() ) { child.setDrawingCacheEnabled( true );
data.put("WindowVisibility", getTranslator().visibility(v.getWindowVisibility())); data.put("HasWindowFocus", v.hasWindowFocus()); data.put("IsDrawingCacheEnabled", v.isDrawingCacheEnabled()); data.put("IsFocused", v.isFocused()); data.put("IsHapticFeedbackEnabled", v.isHapticFeedbackEnabled());