Java Code Examples for android.view.ViewGroup#offsetDescendantRectToMyCoords()
The following examples show how to use
android.view.ViewGroup#offsetDescendantRectToMyCoords() .
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: MoonDialog.java From SuntimesWidget with GNU General Public License v3.0 | 6 votes |
private void initPeekHeight(DialogInterface dialog) { if (dialog == null) { return; } BottomSheetDialog bottomSheet = (BottomSheetDialog) dialog; FrameLayout layout = (FrameLayout) bottomSheet.findViewById(android.support.design.R.id.design_bottom_sheet); // for AndroidX, resource is renamed to com.google.android.material.R.id.design_bottom_sheet if (layout != null) { BottomSheetBehavior behavior = BottomSheetBehavior.from(layout); ViewGroup dialogLayout = (LinearLayout) bottomSheet.findViewById(R.id.moondialog_layout); View divider1 = bottomSheet.findViewById(R.id.divider1); if (dialogLayout != null && divider1 != null) { Rect headerBounds = new Rect(); divider1.getDrawingRect(headerBounds); dialogLayout.offsetDescendantRectToMyCoords(divider1, headerBounds); behavior.setPeekHeight(headerBounds.top); } else { behavior.setPeekHeight(-1); } } }
Example 2
Source File: BaseEffectBridgeWrapper.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
public Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup)getMainUpView().getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 3
Source File: ViewGroupUtils.java From UIWidget with Apache License 2.0 | 5 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); // View#offsetDescendantRectToMyCoords includes scroll offsets of the last child. // We need to reverse it here so that we get the rect of the view itself rather // than its content. rect.offset(child.getScrollX(), child.getScrollY()); }
Example 4
Source File: ViewGroupUtils.java From GpCollapsingToolbar with Apache License 2.0 | 5 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); // View#offsetDescendantRectToMyCoords includes scroll offsets of the last child. // We need to reverse it here so that we get the rect of the view itself rather // than its content. rect.offset(child.getScrollX(), child.getScrollY()); }
Example 5
Source File: ViewOtherAnimationBuilder.java From scene with Apache License 2.0 | 5 votes |
@Override public Rect get(View object) { ViewGroup viewGroup = (ViewGroup) object.getParent(); Rect rect = new Rect(); viewGroup.offsetDescendantRectToMyCoords(viewGroup, rect); return rect; }
Example 6
Source File: MainActivity.java From CircularReveal with MIT License | 4 votes |
@OnClick(R.id.reset) void resetUi(View resetCard) { cardsLine.setVisibility(View.INVISIBLE); final View target = ButterKnife.findById(this, R.id.activator); // Coordinates of circle initial point final ViewGroup parent = (ViewGroup) activatorMask.getParent(); final Rect bounds = new Rect(); final Rect maskBounds = new Rect(); target.getDrawingRect(bounds); activatorMask.getDrawingRect(maskBounds); parent.offsetDescendantRectToMyCoords(target, bounds); parent.offsetDescendantRectToMyCoords(activatorMask, maskBounds); maskElevation = activatorMask.getCardElevation(); activatorMask.setCardElevation(0); final int cX = maskBounds.centerX(); final int cY = maskBounds.centerY(); final Animator circularReveal = ViewAnimationUtils.createCircularReveal(activatorMask, cX, cY, (float) Math.hypot(maskBounds.width() * .5f, maskBounds.height() * .5f), target.getWidth() / 2f, View.LAYER_TYPE_HARDWARE); final float c0X = bounds.centerX() - maskBounds.centerX(); final float c0Y = bounds.centerY() - maskBounds.centerY(); AnimatorPath path = new AnimatorPath(); path.moveTo(0, 0); path.curveTo(0, 0, 0, c0Y, c0X, c0Y); ObjectAnimator pathAnimator = ObjectAnimator.ofObject(this, "maskLocation", new PathEvaluator(), path.getPoints().toArray()); AnimatorSet set = new AnimatorSet(); set.playTogether(circularReveal, pathAnimator); set.setInterpolator(new FastOutSlowInInterpolator()); set.setDuration(SLOW_DURATION); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { activatorMask.setCardElevation(maskElevation); activatorMask.setVisibility(View.INVISIBLE); circlesLine.setVisibility(View.VISIBLE); executeCirclesDropDown(); target.setEnabled(true); } }); set.start(); }
Example 7
Source File: UIUtils.java From hipda with GNU General Public License v2.0 | 4 votes |
public static int getRelativeTop(View myView, ViewGroup parentView) { Rect offsetViewBounds = new Rect(); myView.getDrawingRect(offsetViewBounds); parentView.offsetDescendantRectToMyCoords(myView, offsetViewBounds); return offsetViewBounds.top; }
Example 8
Source File: ViewGroupUtils.java From AppCompat-Extension-Library with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 9
Source File: BaseEffectBridgeWrapper.java From Android-tv-widget with Apache License 2.0 | 4 votes |
public Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup) getMainUpView().getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 10
Source File: BaseEffect.java From TvRecyclerView with Apache License 2.0 | 4 votes |
protected Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup) view.getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 11
Source File: FlyBorderView.java From TvLauncher with Apache License 2.0 | 4 votes |
public Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup) this.getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 12
Source File: DemoViewflipperActivity.java From AndroidTVWidget with Apache License 2.0 | 4 votes |
public Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup) vf.getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 13
Source File: BaseEffectBridgeWrapper.java From AndroidTVWidget with Apache License 2.0 | 4 votes |
public Rect findLocationWithView(View view) { ViewGroup root = (ViewGroup) getMainUpView().getParent(); Rect rect = new Rect(); root.offsetDescendantRectToMyCoords(view, rect); return rect; }
Example 14
Source File: ViewGroupUtils.java From fab-speed-dial with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 15
Source File: ViewGroupUtils.java From ticdesign with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 16
Source File: CircularRevealTransition.java From magellan with Apache License 2.0 | 4 votes |
private int[] getCenterClickedView(ViewGroup from) { Rect clickedViewRect = new Rect(); clickedView.getDrawingRect(clickedViewRect); from.offsetDescendantRectToMyCoords(clickedView, clickedViewRect); return new int[] {(int) clickedViewRect.exactCenterX(), (int) clickedViewRect.exactCenterY()}; }
Example 17
Source File: ViewGroupUtils.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 18
Source File: ViewGroupUtils.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 19
Source File: ViewGroupUtils.java From FireFiles with Apache License 2.0 | 4 votes |
@Override public void offsetDescendantRect(ViewGroup parent, View child, Rect rect) { parent.offsetDescendantRectToMyCoords(child, rect); }
Example 20
Source File: ViewOtherAnimationBuilder.java From scene with Apache License 2.0 | 4 votes |
public T bounds(Rect toValue) { ViewGroup viewGroup = (ViewGroup) mView.getParent(); Rect rect = new Rect(); viewGroup.offsetDescendantRectToMyCoords(viewGroup, rect); return bounds(rect, toValue); }