@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (changed && mWrappedView != null) { sTempRect.left = (int) mWrappedView.getPivotX(); sTempRect.top = (int) mWrappedView.getPivotY(); offsetDescendantRectToMyCoords(mWrappedView, sTempRect); setPivotX(sTempRect.left); setPivotY(sTempRect.top); } }
/** Positions the media view using the given offset (on the y axis) */ private void offsetMediaView(boolean viewerVisible, float offset) { if (viewerVisible) { // finally position the viewer viewer.setTranslationY(-offset); viewer.setVisibility(View.VISIBLE); // position the repost badge, if it is visible if (repostHint.getVisibility() == View.VISIBLE) { repostHint.setTranslationY(viewer.getPaddingTop() - repostHint.getPivotY() - offset); } } else { viewer.setVisibility(View.INVISIBLE); } }
public static float getPivotY(View view) { return view.getPivotY(); }
@Override public float getPivotY(View view) { return view.getPivotY(); }