RevealFinishedIceCreamSandwich(RevealAnimator target) { super(target); mLayerType = ((View) target).getLayerType(); mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE; }
@Override public void onAnimationStart(Animator animator) { if (AnimatorUtils.hasOverlappingRendering(mView) && mView.getLayerType() == View.LAYER_TYPE_NONE) { mLayerTypeChanged = true; mView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } }
static boolean shouldRunOnHWLayer(View v, Animation anim) { return v.getLayerType() == View.LAYER_TYPE_NONE && ViewCompat.hasOverlappingRendering(v) && modifiesAlpha(anim); }
@TargetApi(HONEYCOMB) public S hasLayerType(@ViewLayerType int type) { isNotNull(); int actualType = actual.getLayerType(); //noinspection ResourceType assertThat(actualType) // .overridingErrorMessage("Expected layer type <%s> but was <%s>", layerTypeToString(type), layerTypeToString(actualType)) // .isEqualTo(type); return myself; }
@Test public void layerType() throws Exception { assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_NONE); view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); assertThat(view.getLayerType()).isEqualTo(View.LAYER_TYPE_SOFTWARE); }
/******************************** * end hook Activity life cycle callback ********************************************************/ public void destroy() { if (WXEnvironment.isApkDebugable() && !WXUtils.isUiThread()) { throw new WXRuntimeException("[WXComponent] destroy can only be called in main thread"); } if(mHost!= null && mHost.getLayerType()==View.LAYER_TYPE_HARDWARE) { mHost.setLayerType(View.LAYER_TYPE_NONE, null); } removeAllEvent(); removeStickyStyle(); if (mDomObj != null) { mDomObj = null; } }
RevealFinishedIceCreamSandwich(CircularRevealAnimator target) { super(target); mLayerType = ((View) target).getLayerType(); mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE; }
public static int getLayerType(View view) { return view.getLayerType(); }
RevealFinishedIceCreamSandwich(RevealAnimator target, int layerType) { mReference = new WeakReference<>(target); mLayerType = ((View) target).getLayerType(); mFeaturedLayerType = layerType; }
public void addView(View v) { mViewsToLayerTypeMap.put(v, v.getLayerType()); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) RevealFinishedJellyBeanMr1(RevealAnimator target, Rect bounds) { mReference = new WeakReference<>(target); mInvalidateBounds = bounds; mLayerType = ((View) target).getLayerType(); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) RevealFinishedIceCreamSandwich(RevealAnimator target, Rect bounds) { mReference = new WeakReference<>(target); mInvalidateBounds = bounds; mLayerType = ((View) target).getLayerType(); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void manageLayer(View v, boolean enableHardware) { if (!API_11) return; int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (layerType != v.getLayerType()) v.setLayerType(layerType, null); }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void manageLayers(float percentOpen) { if (Build.VERSION.SDK_INT < 11) return; boolean layer = percentOpen > 0.0f && percentOpen < 1.0f; final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (layerType != getContent().getLayerType()) { mHandler.post(new Runnable() { public void run() { Log.v(TAG, "changing layerType. hardware? " + (layerType == View.LAYER_TYPE_HARDWARE)); getContent().setLayerType(layerType, null); getMenu().setLayerType(layerType, null); if (getSecondaryMenu() != null) { getSecondaryMenu().setLayerType(layerType, null); } } }); } }
@Override public void onAnimationStart(Animator animation) { // Enable all necessary layers Iterator<Map.Entry<View, Integer>> itr = mViewsToLayerTypeMap.entrySet().iterator(); while (itr.hasNext()) { Map.Entry<View, Integer> entry = itr.next(); View v = entry.getKey(); entry.setValue(v.getLayerType()); v.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (v.isAttachedToWindow() && v.getVisibility() == View.VISIBLE) { v.buildLayer(); } } }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void manageLayers(float percentOpen) { if (Build.VERSION.SDK_INT < 11) return; boolean layer = percentOpen > 0.0f && percentOpen < 1.0f; final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (layerType != getContent().getLayerType()) { getHandler().post(new Runnable() { public void run() { Log.v(TAG, "changing layerType. hardware? " + (layerType == View.LAYER_TYPE_HARDWARE)); getContent().setLayerType(layerType, null); getMenu().setLayerType(layerType, null); if (getSecondaryMenu() != null) { getSecondaryMenu().setLayerType(layerType, null); } } }); } }
@TargetApi(HONEYCOMB) public S hasLayerType(@ViewLayerType int type) { isNotNull(); int actualType = actual.getLayerType(); //noinspection ResourceType assertThat(actualType) // .overridingErrorMessage("Expected layer type <%s> but was <%s>", layerTypeToString(type), layerTypeToString(actualType)) // .isEqualTo(type); return myself; }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void disableHardwareLayer() { if (!API_11) return; View v; for (int i = 0; i < getChildCount(); i++) { v = getChildAt(i); if (v.getLayerType() != View.LAYER_TYPE_NONE) v.setLayerType(View.LAYER_TYPE_NONE, null); } }
@Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); if (mAdapter != null) { mAdapter.onAnimationStart(animation); } mLayerType = mTargetView.getLayerType(); mTargetView.setLayerType(View.LAYER_TYPE_HARDWARE, null); // AppLogger.d("View animation is started, enable hardware accelerated"); }
@Override public void onPageScrollStateChanged(int scrollState) { if (scrollState != ViewPager.SCROLL_STATE_IDLE && finalDisableHardwareLayerType) { final int childCount = mViewPager.getChildCount(); for (int i = 0; i < childCount; i++) { View child = mViewPager.getChildAt(i); if (child.getLayerType() != View.LAYER_TYPE_NONE) { child.setLayerType(View.LAYER_TYPE_NONE, null); } } } } });