Java Code Examples for androidx.core.view.ViewCompat#getZ()

The following examples show how to use androidx.core.view.ViewCompat#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: BaseSwitchButton.java    From switchbutton with MIT License 5 votes vote down vote up
private void layoutInternal()
{
    final boolean isViewIdle = isViewIdle();

    if (mIsDebug)
        Log.i(getDebugTag(), "layoutInternal isViewIdle:" + isViewIdle);

    mViewNormal.layout(0, 0, mViewNormal.getMeasuredWidth(), mViewNormal.getMeasuredHeight());
    mViewChecked.layout(0, 0, mViewChecked.getMeasuredWidth(), mViewChecked.getMeasuredHeight());

    int left = 0;
    int top = mAttrModel.getMarginTop();
    if (isViewIdle)
    {
        left = mIsChecked ? getLeftChecked() : getLeftNormal();
    } else
    {
        left = mViewThumb.getLeft();
    }
    mViewThumb.layout(left, top,
            left + mViewThumb.getMeasuredWidth(), top + mViewThumb.getMeasuredHeight());

    final float backZ = Math.max(ViewCompat.getZ(mViewNormal), ViewCompat.getZ(mViewChecked));
    if (ViewCompat.getZ(mViewThumb) <= backZ)
        ViewCompat.setZ(mViewThumb, backZ + 1);

    dealViewIdle();
}
 
Example 2
Source File: TestUtilsMatchers.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a matcher that matches views which have a z-value greater than 0. Also matches if the
 * platform we're running on does not support z-values.
 */
public static Matcher<View> hasZ() {
  return new TypeSafeMatcher<View>() {
    @Override
    public void describeTo(Description description) {
      description.appendText("has a z value greater than 0");
    }

    @Override
    public boolean matchesSafely(View view) {
      return Build.VERSION.SDK_INT < 21 || ViewCompat.getZ(view) > 0f;
    }
  };
}
 
Example 3
Source File: Animer.java    From Animer with Apache License 2.0 4 votes vote down vote up
@Override
public float getValue(View view) {
    return ViewCompat.getZ(view);
}