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

The following examples show how to use android.view.View#getElevation() . 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: 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 3
Source File: AnimUtils.java    From pandroid with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static float getElevationRelativeTo(@NotNull View view, View root) {
    if (root == null) {
        return view.getElevation();
    }
    if (view == root) {
        return view.getElevation();
    } else {
        return view.getElevation() + getElevationRelativeTo((View) view.getParent(), root);
    }
}
 
Example 4
Source File: ViewCompatLollipop.java    From letv with Apache License 2.0 4 votes vote down vote up
public static float getElevation(View view) {
    return view.getElevation();
}
 
Example 5
Source File: ElevationProperties.java    From android_additive_animations with Apache License 2.0 4 votes vote down vote up
@Override
public Float get(View object) {
    return object.getElevation();
}
 
Example 6
Source File: ViewCompatApi21.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static float getElevation(View view) {
    return view.getElevation();
}