Java Code Examples for android.view.View#LAYER_TYPE_HARDWARE
The following examples show how to use
android.view.View#LAYER_TYPE_HARDWARE .
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 check out the related API usage on the sidebar.
Example 1
Source Project: Study_Android_Demo File: SlidingMenu.java License: Apache License 2.0 | 6 votes |
@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); } } }); } }
Example 2
Source Project: Camera2 File: CameraAppUI.java License: Apache License 2.0 | 6 votes |
@Override public void onModeListClosed() { // Convert hardware layers back to default layer types when animation stops // to prevent accidental artifacting. if (mModeOptionsToggle.getLayerType() == View.LAYER_TYPE_HARDWARE || mShutterButton.getLayerType() == View.LAYER_TYPE_HARDWARE) { Log.v(TAG, "Disabling hardware layer for the Mode Options Toggle Button."); mModeOptionsToggle.setLayerType(View.LAYER_TYPE_NONE, null); Log.v(TAG, "Disabling hardware layer for the Shutter Button."); mShutterButton.setLayerType(View.LAYER_TYPE_NONE, null); } // Make sure the alpha on mode options ellipse is reset when mode drawer // is closed. mModeOptionsToggle.setAlpha(1f); mShutterButton.setAlpha(ShutterButton.ALPHA_WHEN_ENABLED); }
Example 3
Source Project: react-native-GPay File: ReactViewGroup.java License: MIT License | 6 votes |
public void setBorderRadius(float borderRadius, int position) { ReactViewBackgroundDrawable backgroundDrawable = getOrCreateReactViewBackground(); backgroundDrawable.setRadius(borderRadius, position); if (Build.VERSION_CODES.HONEYCOMB < Build.VERSION.SDK_INT && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { final int UPDATED_LAYER_TYPE = backgroundDrawable.hasRoundedBorders() ? View.LAYER_TYPE_SOFTWARE : View.LAYER_TYPE_HARDWARE; if (UPDATED_LAYER_TYPE != getLayerType()) { setLayerType(UPDATED_LAYER_TYPE, null); } } }
Example 4
Source Project: wakao-app File: SlidingMenu.java License: MIT License | 6 votes |
@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); } } }); } }
Example 5
Source Project: appcan-android File: SlidingMenu.java License: GNU Lesser General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void manageLayers(float percentOpen) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && !isHardwareAccelerated()) { boolean layer = percentOpen > 0.0f && percentOpen < 1.0f; final int layerType = layer ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_SOFTWARE; 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); } } }); } } }
Example 6
Source Project: android_additive_animations File: RunningAnimationsManager.java License: Apache License 2.0 | 6 votes |
void onAnimationAccumulatorStart(AdditiveAnimationAccumulator accumulator) { Collection<AdditiveAnimation> animations = accumulator.getAnimations(mAnimationTarget); for (AdditiveAnimation animation : animations) { if (animation.getAssociatedAnimationState() == null) { continue; } if (animation.getAssociatedAnimationState().shouldRun(mCurrentState)) { if (animation.getAssociatedAnimationState().getAnimationStartAction() != null) { animation.getAssociatedAnimationState().getAnimationStartAction().onStart(mAnimationTarget); } } else { accumulator.removeAnimation(animation.getTag(), animation.getTarget()); } } if (accumulator.getAnimations().isEmpty()) { mAdditiveAnimationAccumulators.remove(accumulator); removeStateManagerIfAccumulatorSetIsEmpty(); } else { // only now are we expecting updates from this applier if (mUseHardwareLayer && mAnimationTarget instanceof View) { if (((View) mAnimationTarget).getLayerType() != View.LAYER_TYPE_HARDWARE) { ((View) mAnimationTarget).setLayerType(View.LAYER_TYPE_HARDWARE, null); } } } }
Example 7
Source Project: zen4android File: SlidingMenu.java License: MIT License | 6 votes |
@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); } } }); } }
Example 8
Source Project: Moring-Alarm File: SlidingMenu.java License: Apache License 2.0 | 6 votes |
@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); } } }); } }
Example 9
Source Project: Animer File: Animer.java License: Apache License 2.0 | 5 votes |
private void setHardwareAcceleration(boolean bool){ if(HARDWAREACCELERATION_IS_ENABLED && mTarget !=null){ if(bool){ if(((View)mTarget).getLayerType() == View.LAYER_TYPE_NONE){ ((View)mTarget).setLayerType(View.LAYER_TYPE_HARDWARE,null); } } else{ if(((View)mTarget).getLayerType() == View.LAYER_TYPE_HARDWARE){ ((View)mTarget).setLayerType(View.LAYER_TYPE_NONE,null); } } } }
Example 10
Source Project: JazzyViewPager File: JazzyViewPager.java License: Apache License 2.0 | 5 votes |
@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); }
Example 11
Source Project: android-kernel-tweaker File: JazzyViewPager.java License: GNU General Public License v3.0 | 5 votes |
@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); }
Example 12
Source Project: Contacts File: JazzyViewPager.java License: MIT License | 5 votes |
@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); }
Example 13
Source Project: android-movies-demo File: MovieRowView.java License: MIT License | 5 votes |
@Override public void setUseHardwareLayers(boolean useHardwareLayers) { // TODO: While this helps performance, it does result in a spike when you first start sliding // Maybe there's some solution where some of the Views remain in a HW layer throughout? int toLayerType = useHardwareLayers ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; if (mPosterView.getLayerType() != toLayerType) { mPosterView.setLayerType(toLayerType, null); mTitleView.setLayerType(toLayerType, null); mSubtitleView.setLayerType(toLayerType, null); mContentContainer.setLayerType(toLayerType, null); } }
Example 14
Source Project: UltimateAndroid File: JazzyViewPager.java License: Apache License 2.0 | 5 votes |
@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); }
Example 15
Source Project: android-movies-demo File: SlidingRevealViewGroup.java License: MIT License | 5 votes |
public void setUseHardwareLayers(boolean useHardwareLayers) { // For subclasses to initialize hardware layers during animations int toLayerType = useHardwareLayers ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; mSlideOverlayLeft.setLayerType(toLayerType, null); mSlideOverlayMiddle.setLayerType(toLayerType, null); mSlideOverlayRight.setLayerType(toLayerType, null); }
Example 16
Source Project: Android-SDK-Demo File: SdkCenteredViewPager.java License: MIT License | 5 votes |
private void enableLayers(boolean enable) { final int childCount = getChildCount(); for ( int i = 0; i < childCount; i++ ) { final int layerType = enable ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; getChildAt( i ).setLayerType( layerType, null ); } }
Example 17
Source Project: Android-SDK-Demo File: SdkCenteredViewPager.java License: MIT License | 5 votes |
private void enableLayers(boolean enable) { final int childCount = getChildCount(); for ( int i = 0; i < childCount; i++ ) { final int layerType = enable ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE; getChildAt( i ).setLayerType( layerType, null ); } }
Example 18
Source Project: fab-transformation File: RevealAnimator.java License: MIT License | 4 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) RevealFinishedJellyBeanMr2(RevealAnimator target) { super(target); mFeaturedLayerType = View.LAYER_TYPE_HARDWARE; }
Example 19
Source Project: Nibo File: CircularRevealAnimator.java License: MIT License | 4 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) RevealFinishedJellyBeanMr2(CircularRevealAnimator target) { super(target); mFeaturedLayerType = View.LAYER_TYPE_HARDWARE; }
Example 20
Source Project: material-sheet-fab File: RevealAnimator.java License: MIT License | 4 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) RevealFinishedJellyBeanMr2(RevealAnimator target) { super(target); mFeaturedLayerType = View.LAYER_TYPE_HARDWARE; }