summaryrefslogtreecommitdiff
path: root/core/java/android/widget/CalendarView.java
diff options
context:
space:
mode:
authorKirill Grouchnikov <kirillg@google.com>2016-04-11 17:16:52 -0400
committerKirill Grouchnikov <kirillg@google.com>2016-04-14 08:47:05 -0400
commit698b751dc78f8a325c5b513cacd3335151f807ea (patch)
tree3cb4a9d19c25041fd7566a477d2dea9d0e5b7e0c /core/java/android/widget/CalendarView.java
parentdb976a28c401579f42e8d252c6f02b41aa94772d (diff)
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
Diffstat (limited to 'core/java/android/widget/CalendarView.java')
-rw-r--r--core/java/android/widget/CalendarView.java17
1 files changed, 17 insertions, 0 deletions
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);