From 698b751dc78f8a325c5b513cacd3335151f807ea Mon Sep 17 00:00:00 2001 From: Kirill Grouchnikov Date: Mon, 11 Apr 2016 17:16:52 -0400 Subject: Add @TestApi-guarded way to get bounds of specific day in CalendarView Two separate implementation paths, one for Material look / layout, and one for legacy / pre-Material one. Bug: 28037149 Change-Id: Id1946802c0a93218d9eb0b73c81ad76dc027763c --- core/java/android/widget/CalendarView.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/java/android/widget/CalendarView.java') diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index 66896ab70e45..ef0eca38517f 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -22,10 +22,12 @@ import android.annotation.DrawableRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StyleRes; +import android.annotation.TestApi; import android.annotation.Widget; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; @@ -544,6 +546,19 @@ public class CalendarView extends FrameLayout { mDelegate.setDate(date, animate, center); } + /** + * Retrieves the screen bounds for the specific date in the coordinate system of this + * view. If the passed date is being currently displayed, this method returns true and + * the caller can query the fields of the passed {@link Rect} object. Otherwise the + * method returns false and does not touch the passed {@link Rect} object. + * + * @hide + */ + @TestApi + public boolean getBoundsForDate(long date, Rect outBounds) { + return mDelegate.getBoundsForDate(date, outBounds); + } + @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); @@ -605,6 +620,8 @@ public class CalendarView extends FrameLayout { void setDate(long date, boolean animate, boolean center); long getDate(); + boolean getBoundsForDate(long date, Rect outBounds); + void setOnDateChangeListener(OnDateChangeListener listener); void onConfigurationChanged(Configuration newConfig); -- cgit v1.2.3