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

The following examples show how to use android.view.View#getTranslationZ() . 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: RenderNodeAnimatorWrapper.java    From scene with Apache License 2.0 5 votes vote down vote up
private float getValue(int propertyConstant) {
    final View node = mView;
    switch (propertyConstant) {
        case ViewPropertyAnimatorConstant.TRANSLATION_X:
            return node.getTranslationX();
        case ViewPropertyAnimatorConstant.TRANSLATION_Y:
            return node.getTranslationY();
        case ViewPropertyAnimatorConstant.TRANSLATION_Z:
            return node.getTranslationZ();
        case ViewPropertyAnimatorConstant.ROTATION:
            return node.getRotation();
        case ViewPropertyAnimatorConstant.ROTATION_X:
            return node.getRotationX();
        case ViewPropertyAnimatorConstant.ROTATION_Y:
            return node.getRotationY();
        case ViewPropertyAnimatorConstant.SCALE_X:
            return node.getScaleX();
        case ViewPropertyAnimatorConstant.SCALE_Y:
            return node.getScaleY();
        case ViewPropertyAnimatorConstant.X:
            return mView.getLeft() + node.getTranslationX();
        case ViewPropertyAnimatorConstant.Y:
            return mView.getTop() + node.getTranslationY();
        case ViewPropertyAnimatorConstant.Z:
            return node.getElevation() + node.getTranslationZ();
        case ViewPropertyAnimatorConstant.ALPHA:
            return mView.getAlpha();
    }
    return 0;
}
 
Example 2
Source File: ChangeTransform.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public Transforms(View view) {
    translationX = view.getTranslationX();
    translationY = view.getTranslationY();
    translationZ = view.getTranslationZ();
    scaleX = view.getScaleX();
    scaleY = view.getScaleY();
    rotationX = view.getRotationX();
    rotationY = view.getRotationY();
    rotationZ = view.getRotation();
}
 
Example 3
Source File: ActivityTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static SharedElementOriginalState getOldSharedElementState(View view, String name,
        Bundle transitionArgs) {

    SharedElementOriginalState state = new SharedElementOriginalState();
    state.mLeft = view.getLeft();
    state.mTop = view.getTop();
    state.mRight = view.getRight();
    state.mBottom = view.getBottom();
    state.mMeasuredWidth = view.getMeasuredWidth();
    state.mMeasuredHeight = view.getMeasuredHeight();
    state.mTranslationZ = view.getTranslationZ();
    state.mElevation = view.getElevation();
    if (!(view instanceof ImageView)) {
        return state;
    }
    Bundle bundle = transitionArgs.getBundle(name);
    if (bundle == null) {
        return state;
    }
    int scaleTypeInt = bundle.getInt(KEY_SCALE_TYPE, -1);
    if (scaleTypeInt < 0) {
        return state;
    }

    ImageView imageView = (ImageView) view;
    state.mScaleType = imageView.getScaleType();
    if (state.mScaleType == ImageView.ScaleType.MATRIX) {
        state.mMatrix = new Matrix(imageView.getImageMatrix());
    }
    return state;
}
 
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.getTranslationZ();
  } 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 getTranslationZ(View view) {
    return view.getTranslationZ();
}
 
Example 6
Source File: ViewCompatApi21.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static float getTranslationZ(View view) {
    return view.getTranslationZ();
}
 
Example 7
Source File: ViewUtilsLollipop.java    From Transitions-Everywhere with Apache License 2.0 4 votes vote down vote up
@Override
public float getTranslationZ(@NonNull View view) {
    return view.getTranslationZ();
}