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

The following examples show how to use android.view.View#getZ() . 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: TouchEventHandler.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
public int compare(View lhs, View rhs) {
    final float lz;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        lz = lhs.getZ();
    }else {
        lz = 0;
    }
    final float rz;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        rz = rhs.getZ();
    }else {
        rz = 0;
    }
    if (lz > rz) {
        return -1;
    } else if (lz < rz) {
        return 1;
    }
    return 0;
}
 
Example 2
Source File: FTouchHelper.java    From switchbutton with MIT License 6 votes vote down vote up
/**
 * 找到parent中处于指定坐标下最顶部的child(Z值最大,最后面添加)
 *
 * @param parent
 * @param x
 * @param y
 * @return
 */
public static View findTopChildUnder(ViewGroup parent, int x, int y)
{
    if (Build.VERSION.SDK_INT < 21)
        return parent.getChildAt(parent.getChildCount() - 1);

    final List<View> list = findChildrenUnder(parent, x, y);
    if (list.isEmpty())
        return null;

    View target = list.remove(0);
    for (View item : list)
    {
        if (item.getZ() > target.getZ())
            target = item;
    }

    return target;
}
 
Example 3
Source File: ViewDefault.java    From morphos with Apache License 2.0 5 votes vote down vote up
public void updateView(View v) {
    if (v != null) {
        this.alpha = v.getAlpha();
        this.x = v.getX();
        this.y = v.getY();
        this.z = atLeastLollipop ? v.getZ() : 0;
        this.width = v.getWidth();
        this.height = v.getHeight();
        this.expansionScaleX = v.getScaleX();
        this.expansionScaleY = v.getScaleY();
        this.dispositionAngle = v.getRotation();
        this.dispositionAngleX = v.getRotationX();
        this.dispositionAngleY = v.getRotationY();
    }
}
 
Example 4
Source File: DynamicAnimation.java    From CircularReveal with MIT License 5 votes vote down vote up
@Override
public float getValue(View view) {
  if (isZSupported()) {
    return view.getZ();
  } else {
    return 0;
  }
}
 
Example 5
Source File: ViewCompatLollipop.java    From letv with Apache License 2.0 4 votes vote down vote up
public static float getZ(View view) {
    return view.getZ();
}