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

The following examples show how to use android.view.View#getRotationX() . 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: SimpleViewBehavior.java    From simple-view-behavior with MIT License 5 votes vote down vote up
@Override
void prepare(CoordinatorLayout parent, View child, View dependency) {
    super.prepare(parent, child, dependency);

    mStartX = (int) child.getX();
    mStartY = (int) child.getY();
    mStartWidth = child.getWidth();
    mStartHeight = child.getHeight();
    mStartAlpha = child.getAlpha();
    mStartRotateX = child.getRotationX();
    mStartRotateY = child.getRotationY();

    // only set the start background color when the background is color drawable
    Drawable background = child.getBackground();
    if (background instanceof ColorDrawable) {
        mStartBackgroundColor = ((ColorDrawable) background).getColor();
    }

    // if parent fitsSystemWindows is true, add status bar height to target y if specified
    if (Build.VERSION.SDK_INT > 16 && parent.getFitsSystemWindows() && targetY != UNSPECIFIED_INT) {
        int result = 0;
        Resources resources = parent.getContext().getResources();
        int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = resources.getDimensionPixelSize(resourceId);
        }
        targetY += result;
    }
}
 
Example 3
Source File: SimpleViewBehavior.java    From simple-view-behavior with MIT License 5 votes vote down vote up
@Override
void prepare(CoordinatorLayout parent, View child, View dependency) {
    super.prepare(parent, child, dependency);

    mStartX = (int) child.getX();
    mStartY = (int) child.getY();
    mStartWidth = child.getWidth();
    mStartHeight = child.getHeight();
    mStartAlpha = child.getAlpha();
    mStartRotateX = child.getRotationX();
    mStartRotateY = child.getRotationY();

    // only set the start background color when the background is color drawable
    Drawable background = child.getBackground();
    if (background instanceof ColorDrawable) {
        mStartBackgroundColor = ((ColorDrawable) background).getColor();
    }

    // if parent fitsSystemWindows is true, add status bar height to target y if specified
    if (Build.VERSION.SDK_INT > 16 && parent.getFitsSystemWindows() && targetY != UNSPECIFIED_INT) {
        int result = 0;
        Resources resources = parent.getContext().getResources();
        int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = resources.getDimensionPixelSize(resourceId);
        }
        targetY += result;
    }
}
 
Example 4
Source File: SimpleViewBehavior.java    From okhttp-OkGo with Apache License 2.0 5 votes vote down vote up
/** 初始化数据 */
private void prepare(CoordinatorLayout parent, View child, View dependency) {
    mDependStartX = (int) dependency.getX();
    mDependStartY = (int) dependency.getY();
    mDependStartWidth = dependency.getWidth();
    mDependStartHeight = dependency.getHeight();
    mStartX = (int) child.getX();
    mStartY = (int) child.getY();
    mStartWidth = child.getWidth();
    mStartHeight = child.getHeight();
    mStartAlpha = child.getAlpha();
    mStartRotateX = child.getRotationX();
    mStartRotateY = child.getRotationY();

    //特殊处理y方向变化
    if (mDependTargetY == UNSPECIFIED_INT && dependency instanceof AppBarLayout) {
        mDependTargetY = ((AppBarLayout) dependency).getTotalScrollRange();
    }
    // 背景颜色渐变
    if (child.getBackground() instanceof ColorDrawable) mStartBackgroundColor = ((ColorDrawable) child.getBackground()).getColor();
    // 自定义动画
    if (mAnimationId != 0) {
        mAnimation = AnimationUtils.loadAnimation(child.getContext(), mAnimationId);
        mAnimation.initialize(child.getWidth(), child.getHeight(), parent.getWidth(), parent.getHeight());
    }
    // 兼容5.0以上的沉浸模式
    if (Build.VERSION.SDK_INT > 16 && parent.getFitsSystemWindows() && targetY != UNSPECIFIED_INT) {
        targetY += getStatusBarHeight(parent.getContext());
    }
    isPrepared = true;
}
 
Example 5
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 6
Source File: PhoneArithmetics.java    From ChromeLikeTabSwitcher with Apache License 2.0 5 votes vote down vote up
@Override
public final float getRotation(@NonNull final Axis axis, @NonNull final AbstractItem item) {
    Condition.INSTANCE.ensureNotNull(axis, "The axis may not be null");
    Condition.INSTANCE.ensureNotNull(item, "The view may not be null");
    View view = item.getView();

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        return view.getRotationY();
    } else {
        return view.getRotationX();
    }
}
 
Example 7
Source File: FlipX.java    From Flubber with Apache License 2.0 5 votes vote down vote up
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {

    final float startRotation = view.getRotationX();
    final float endRotation = startRotation + 180f;

    final PropertyValuesHolder rotationPVH =
            PropertyValuesHolder.ofFloat(View.ROTATION_X, startRotation, endRotation);

    final ObjectAnimator animation =
            ObjectAnimator.ofPropertyValuesHolder(view, rotationPVH);

    return animation;
}
 
Example 8
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 9
Source File: AnimatorUtility.java    From scene with Apache License 2.0 5 votes vote down vote up
@NonNull
public static AnimatorInfo captureViewStatus(@NonNull View view) {
    return new AnimatorInfo(view.getTranslationX(),
            view.getTranslationY(),
            view.getScaleX(),
            view.getScaleY(),
            view.getRotation(),
            view.getRotationX(),
            view.getRotationY(),
            view.getAlpha());
}
 
Example 10
Source File: ChangeTransform.java    From scene with Apache License 2.0 5 votes vote down vote up
Transforms(View view) {
    mTranslationX = view.getTranslationX();
    mTranslationY = view.getTranslationY();
    mTranslationZ = ViewCompat.getTranslationZ(view);
    mScaleX = view.getScaleX();
    mScaleY = view.getScaleY();
    mRotationX = view.getRotationX();
    mRotationY = view.getRotationY();
    mRotationZ = view.getRotation();
}
 
Example 11
Source File: ViewHelper.java    From Mover with Apache License 2.0 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 12
Source File: ViewHelper.java    From timecat with Apache License 2.0 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 13
Source File: MountState.java    From litho with Apache License 2.0 4 votes vote down vote up
private static void unsetRotationX(View view, NodeInfo nodeInfo) {
  if (nodeInfo.isRotationXSet() && view.getRotationX() != 0) {
    view.setRotationX(0);
  }
}
 
Example 14
Source File: ViewCompatHC.java    From letv with Apache License 2.0 4 votes vote down vote up
public static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 15
Source File: ViewHelper.java    From imsdk-android with MIT License 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 16
Source File: ViewHelper.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 17
Source File: ViewHelper.java    From KJFrameForAndroid with Apache License 2.0 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 18
Source File: ViewHelper.java    From XDroidAnimation with Apache License 2.0 4 votes vote down vote up
public static float getRotationX(View view) {
	return view.getRotationX();
}
 
Example 19
Source File: ViewHelper.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
static float getRotationX(View view) {
    return view.getRotationX();
}
 
Example 20
Source File: ViewCompatHC.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static float getRotationX(View view) {
    return view.getRotationX();
}