Java Code Examples for android.view.View#LAYER_TYPE_NONE

The following examples show how to use android.view.View#LAYER_TYPE_NONE . 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
Source Project: LiuAGeAndroid   File: SlidingMenu.java    License: MIT License 6 votes vote down vote up
@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: WeatherStream   File: SlidingMenu.java    License: Apache License 2.0 6 votes vote down vote up
@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 3
@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 4
Source Project: android_9.0.0_r45   File: Fade.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onAnimationStart(Animator animator) {
    if (mView.hasOverlappingRendering() && mView.getLayerType() == View.LAYER_TYPE_NONE) {
        mLayerTypeChanged = true;
        mView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
}
 
Example 5
static boolean shouldRunOnHWLayer(View v, Animator anim) {
    if (v == null || anim == null) {
        return false;
    }
    return v.getLayerType() == View.LAYER_TYPE_NONE
            && v.hasOverlappingRendering()
            && modifiesAlpha(anim);
}
 
Example 6
@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 7
Source Project: CoolViewPager   File: CoolViewPager.java    License: Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable
                ? mPageTransformerLayerType : View.LAYER_TYPE_NONE;
        getChildAt(i).setLayerType(layerType, null);
    }
}
 
Example 8
Source Project: UltimateAndroid   File: JazzyViewPager.java    License: Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 9
Source Project: react-native-GPay   File: OpacityAnimation.java    License: MIT License 5 votes vote down vote up
@Override
public void onAnimationStart(Animation animation) {
  if (mView.hasOverlappingRendering() &&
      mView.getLayerType() == View.LAYER_TYPE_NONE) {
    mLayerTypeChanged = true;
    mView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  }
}
 
Example 10
Source Project: react-native-screens   File: Screen.java    License: MIT License 5 votes vote down vote up
/**
 * While transitioning this property allows to optimize rendering behavior on Android and provide
 * a correct blending options for the animated screen. It is turned on automatically by the container
 * when transitioning is detected and turned off immediately after
 */
public void setTransitioning(boolean transitioning) {
  if (mTransitioning == transitioning) {
    return;
  }
  mTransitioning = transitioning;
  super.setLayerType(transitioning ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
}
 
Example 11
@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: school_shop   File: JazzyViewPager.java    License: MIT License 5 votes vote down vote up
@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);
	}
}
 
Example 13
Source Project: Contacts   File: JazzyViewPager.java    License: MIT License 5 votes vote down vote up
@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 14
Source Project: zhangshangwuda   File: JazzyViewPager.java    License: Apache License 2.0 5 votes vote down vote up
@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);
	}
}
 
Example 15
Source Project: Android-SDK-Demo   File: SdkCenteredViewPager.java    License: MIT License 5 votes vote down vote up
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 16
Source Project: android-movies-demo   File: MovieRowView.java    License: MIT License 5 votes vote down vote up
@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 17
private void disableHardwareLayers() {
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) return;
    for (int i = 0; i < mViewPageable.getChildCount(); i++) {
        final View child = mViewPageable.getChildAt(i);
        if (child.getLayerType() != View.LAYER_TYPE_NONE)
            child.setLayerType(View.LAYER_TYPE_NONE, null);
    }
}
 
Example 18
Source Project: UltimateAndroid   File: JazzyViewPager.java    License: Apache License 2.0 5 votes vote down vote up
@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 19
Source Project: JazzyViewPager   File: JazzyViewPager.java    License: Apache License 2.0 5 votes vote down vote up
@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 20
Source Project: Conquer   File: JellyViewPager.java    License: Apache License 2.0 4 votes vote down vote up
@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);
}