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

The following examples show how to use android.view.View#getLayerType() . 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 File: ParallaxScrollView.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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 2
Source File: ViewAnimationUtils.java    From CircularReveal with 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 3
Source File: JazzyViewPager.java    From android-kernel-tweaker with GNU General Public License v3.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 File: JazzyViewPager.java    From zhangshangwuda with 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 5
Source File: JazzyViewPager.java    From UltimateAndroid with 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 6
Source File: DetailAnimViewGroup.java    From ListItemFold with 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 7
Source File: AppsCustomizePagedView.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
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 8
Source File: JazzyViewPager.java    From UltimateAndroid with 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 9
Source File: InfiniteCycleManager.java    From InfiniteCycleViewPager with Apache License 2.0 5 votes vote down vote up
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 10
Source File: JazzyViewPager.java    From JazzyViewPager with 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 11
Source File: FlipView.java    From AndroidAnimationExercise with 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 12
Source File: JazzyViewPager.java    From ClockView with 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 13
Source File: JazzyViewPager.java    From ClockView with 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 14
Source File: JazzyViewPager.java    From Contacts with 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 15
Source File: FlipView.java    From android-FlipView with 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 16
Source File: ViewCompatHC.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 17
Source File: ak.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static int b(View view)
{
    return view.getLayerType();
}
 
Example 18
Source File: ViewCompatHC.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 19
Source File: ViewCompatHC.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}
 
Example 20
Source File: ViewCompatHC.java    From letv with Apache License 2.0 4 votes vote down vote up
public static int getLayerType(View view) {
    return view.getLayerType();
}