summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewGroupOverlay.java
diff options
context:
space:
mode:
authorKirill Grouchnikov <kirillg@google.com>2016-03-08 10:37:06 -0500
committerKirill Grouchnikov <kirillg@google.com>2016-03-09 16:34:49 -0500
commitb4b939cf1af397cd223ac7ebb12e1d2d61e2a83e (patch)
treea6c5c78a6d440b3d78f926122b34d71b2048038d /core/java/android/view/ViewGroupOverlay.java
parent99f1215607daf3939f06a71ce098e80be8603b9e (diff)
Tweaks to ViewOverlay.
* Clarify Javadocs for add / remove when called with the same Drawable. * Add @NonNull annotation to all add / remove APIs and throw IllegalArgumentException when null value is passed. Bug: 27528798 Change-Id: Ied8f28c70775309e4fa85aff6a7202c1a0eb6aa3
Diffstat (limited to 'core/java/android/view/ViewGroupOverlay.java')
-rw-r--r--core/java/android/view/ViewGroupOverlay.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/core/java/android/view/ViewGroupOverlay.java b/core/java/android/view/ViewGroupOverlay.java
index 16afc5df31ae..c2807babdff2 100644
--- a/core/java/android/view/ViewGroupOverlay.java
+++ b/core/java/android/view/ViewGroupOverlay.java
@@ -15,6 +15,7 @@
*/
package android.view;
+import android.annotation.NonNull;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -37,7 +38,7 @@ public class ViewGroupOverlay extends ViewOverlay {
}
/**
- * Adds a View to the overlay. The bounds of the added view should be
+ * Adds a {@code View} to the overlay. The bounds of the added view should be
* relative to the host view. Any view added to the overlay should be
* removed when it is no longer needed or no longer visible.
*
@@ -54,23 +55,32 @@ public class ViewGroupOverlay extends ViewOverlay {
* and 200 pixels down from the origin of the overlay's
* host view, then the view will be offset by (100, 200).</p>
*
- * @param view The View to be added to the overlay. The added view will be
+ * <p>{@code View}s added with this API will be drawn in the order they were
+ * added. Drawing of the overlay views will happen before drawing of any of the
+ * {@code Drawable}s added with {@link #add(Drawable)} API even if a call to
+ * this API happened after the call to {@link #add(Drawable)}.</p>
+ *
+ * <p>Passing <code>null</code> parameter will result in an
+ * {@link IllegalArgumentException} being thrown.</p>
+ *
+ * @param view The {@code View} to be added to the overlay. The added view will be
* drawn when the overlay is drawn.
* @see #remove(View)
* @see ViewOverlay#add(Drawable)
*/
- public void add(View view) {
+ public void add(@NonNull View view) {
mOverlayViewGroup.add(view);
}
/**
- * Removes the specified View from the overlay.
+ * Removes the specified {@code View} from the overlay. Passing <code>null</code> parameter
+ * will result in an {@link IllegalArgumentException} being thrown.
*
- * @param view The View to be removed from the overlay.
+ * @param view The {@code View} to be removed from the overlay.
* @see #add(View)
* @see ViewOverlay#remove(Drawable)
*/
- public void remove(View view) {
+ public void remove(@NonNull View view) {
mOverlayViewGroup.remove(view);
}
}