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

The following examples show how to use android.view.View#getLayerType() . 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: CircularReveal   File: ViewAnimationUtils.java    License: MIT License 6 votes vote down vote up
/**
 * Returns an Animator which can animate a clipping circle.
 * <p>
 * Any shadow cast by the View will respect the circular clip from this animator.
 * <p>
 * Only a single non-rectangular clip can be applied on a View at any time.
 * Views clipped by a circular reveal animation take priority over
 * {@link android.view.View#setClipToOutline(boolean) View Outline clipping}.
 * <p>
 * Note that the animation returned here is a one-shot animation. It cannot
 * be re-used, and once started it cannot be paused or resumed.
 *
 * @param view The View will be clipped to the clip circle.
 * @param centerX The x coordinate of the center of the clip circle.
 * @param centerY The y coordinate of the center of the clip circle.
 * @param startRadius The starting radius of the clip circle.
 * @param endRadius The ending radius of the clip circle.
 * @param layerType View layer type {@link View#LAYER_TYPE_HARDWARE} or {@link
 * View#LAYER_TYPE_SOFTWARE}
 */
public static Animator createCircularReveal(View view, int centerX, int centerY,
    float startRadius, float endRadius, int layerType) {

  if (!(view.getParent() instanceof RevealViewGroup)) {
    throw new IllegalArgumentException("Parent must be instance of RevealViewGroup");
  }

  final RevealViewGroup viewGroup = (RevealViewGroup) view.getParent();
  final ViewRevealManager rm = viewGroup.getViewRevealManager();

  if (!rm.overrideNativeAnimator() && LOLLIPOP_PLUS) {
    return android.view.ViewAnimationUtils.createCircularReveal(view, centerX, centerY,
        startRadius, endRadius);
  }

  final RevealValues viewData = new RevealValues(view, centerX, centerY, startRadius, endRadius);
  final Animator animator = rm.dispatchCreateAnimator(viewData);

  if (layerType != view.getLayerType()) {
    animator.addListener(new ChangeViewLayerTypeAdapter(viewData, layerType));
  }

  return animator;
}
 
Example 2
private void a(View view, boolean flag)
{
    if (p)
    {
        byte byte0;
        if (flag)
        {
            byte0 = 2;
        } else
        {
            byte0 = 0;
        }
        if (byte0 != view.getLayerType())
        {
            view.setLayerType(byte0, null);
            return;
        }
    }
}
 
Example 3
Source Project: JazzyViewPager   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 4
Source Project: android-FlipView   File: FlipView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Enable a hardware layer for the view.
 * 
 * @param v
 * @param drawWithLayer
 */
private void setDrawWithLayer(View v, boolean drawWithLayer) {
	if (isHardwareAccelerated()) {
		if (v.getLayerType() != LAYER_TYPE_HARDWARE && drawWithLayer) {
			v.setLayerType(LAYER_TYPE_HARDWARE, null);
		} else if (v.getLayerType() != LAYER_TYPE_NONE && !drawWithLayer) {
			v.setLayerType(LAYER_TYPE_NONE, null);
		}
	}
}
 
Example 5
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 6
Source Project: ClockView   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 7
Source Project: ClockView   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 8
/**
 * Enable a hardware layer for the view.
 *
 * @param v
 * @param drawWithLayer
 */
private void setDrawWithLayer(View v, boolean drawWithLayer) {
    if (isHardwareAccelerated()) {
        if (v.getLayerType() != LAYER_TYPE_HARDWARE && drawWithLayer) {
            v.setLayerType(LAYER_TYPE_HARDWARE, null);
        } else if (v.getLayerType() != LAYER_TYPE_NONE && !drawWithLayer) {
            v.setLayerType(LAYER_TYPE_NONE, null);
        }
    }
}
 
Example 9
@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 10
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 11
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 12
private void enableHwLayersOnVisiblePages() {
    final int screenCount = getChildCount();

    getVisiblePages(mTempVisiblePagesRange);
    int leftScreen = mTempVisiblePagesRange[0];
    int rightScreen = mTempVisiblePagesRange[1];
    int forceDrawScreen = -1;
    if (leftScreen == rightScreen) {
        // make sure we're caching at least two pages always
        if (rightScreen < screenCount - 1) {
            rightScreen++;
            forceDrawScreen = rightScreen;
        } else if (leftScreen > 0) {
            leftScreen--;
            forceDrawScreen = leftScreen;
        }
    } else {
        forceDrawScreen = leftScreen + 1;
    }

    for (int i = 0; i < screenCount; i++) {
        final View layout = (View) getPageAt(i);
        boolean enableLayer = leftScreen <= i && i <= rightScreen &&
                (i == forceDrawScreen || shouldDrawChild(layout));
        if (layout instanceof CellLayout) {
            ((CellLayout) layout).enableHardwareLayer(enableLayer);
        } else if (enableLayer) {
            if (layout.getLayerType() != LAYER_TYPE_HARDWARE) {
                layout.setLayerType(LAYER_TYPE_HARDWARE, null);
            }
        } else {
            layout.setLayerType(LAYER_TYPE_NONE, null);
        }
    }
}
 
Example 13
Source Project: ListItemFold   File: DetailAnimViewGroup.java    License: MIT License 5 votes vote down vote up
private void updateLayer(@NonNull View view) {
    if (hasFold() && view.getLayerType() != 2) {
        view.setLayerType(2, null);
    } else if (!hasFold() && view.getLayerType() != 0) {
        view.setLayerType(0, null);
    }
}
 
Example 14
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 15
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 16
Source Project: letv   File: ViewCompatHC.java    License: Apache License 2.0 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 17
Source Project: MiBandDecompiled   File: ak.java    License: Apache License 2.0 4 votes vote down vote up
public static int b(View view)
{
    return view.getLayerType();
}
 
Example 18
Source Project: V.FlyoutTest   File: ViewCompatHC.java    License: MIT License 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 19
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 20
public static int getLayerType(View view) {
    return view.getLayerType();
}