Java Code Examples for android.support.v4.view.ViewCompat#setY()

The following examples show how to use android.support.v4.view.ViewCompat#setY() . 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: FabSheetWindow.java    From android-md-core with Apache License 2.0 6 votes vote down vote up
public void reset() {
  if (!mIsCreated) {
    return;
  }
  mShowing = false;
  if (mFabAnimation != null) {
    mFabAnimation.cancel();
  }
  if (mSheetAnimation != null) {
    mSheetAnimation.cancel();
  }
  if (mOverlayAnimation != null) {
    mOverlayAnimation.cancel();
  }
  vFab.setVisibility(View.VISIBLE);
  ViewCompat.setX(vFab, mFabInfo.relativeTopLeft.x);
  ViewCompat.setY(vFab, mFabInfo.relativeTopLeft.y);
  vSheetContainer.setVisibility(View.GONE);
  vOverlay.setVisibility(View.GONE);
}
 
Example 2
Source File: ViewUtil.java    From Tok-Android with GNU General Public License v3.0 5 votes vote down vote up
public static void setY(final @NonNull View v, final int y) {
    if (Build.VERSION.SDK_INT >= 11) {
        ViewCompat.setY(v, y);
    } else {
        ViewGroup.MarginLayoutParams params =
            (ViewGroup.MarginLayoutParams) v.getLayoutParams();
        params.topMargin = y;
        v.setLayoutParams(params);
    }
}
 
Example 3
Source File: ViewUtil.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
public static void setY(final @NonNull View v, final int y) {
  if (VERSION.SDK_INT >= 11) {
    ViewCompat.setY(v, y);
  } else {
    ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)v.getLayoutParams();
    params.topMargin = y;
    v.setLayoutParams(params);
  }
}
 
Example 4
Source File: FabSheetWindow.java    From android-md-core with Apache License 2.0 5 votes vote down vote up
public void invalidate() {
  if (mIsCreated) {
    vOverlay.invalidate();
    vContent.invalidate();
    ViewCompat.setX(vSheetContainer, mFabInfo.bottomRight.x - vSheetContainer.getMeasuredWidth());
    ViewCompat.setY(vSheetContainer, mFabInfo.bottomRight.y - vSheetContainer.getMeasuredHeight());
  }
}
 
Example 5
Source File: ArcAnimator.java    From android-md-core with Apache License 2.0 5 votes vote down vote up
@Override
public void onAnimationUpdate(ValueAnimator animation) {
  View target = mTarget.get();
  if (target != null) {
    float degree = (float) animation.getAnimatedValue();
    float x = mArcMetric.getAxisPoint().x + mArcMetric.mRadius * Utils.cos(degree);
    float y = mArcMetric.getAxisPoint().y - mArcMetric.mRadius * Utils.sin(degree);
    ViewCompat.setX(target, x - target.getMeasuredWidth() / 2);
    ViewCompat.setY(target, y - target.getMeasuredHeight() / 2);
  }
}