Skip to content

Commit

Permalink
Merge pull request #229 from JakeWharton/jw/da-docs
Browse files Browse the repository at this point in the history
Document items which are mutable and not safe to delay usage of.
  • Loading branch information
JakeWharton committed Feb 19, 2016
2 parents 0929dac + 4ac57a1 commit 60850da
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
24 changes: 24 additions & 0 deletions rxbinding/src/main/java/com/jakewharton/rxbinding/view/RxView.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ public static Observable<Void> globalLayouts(@NonNull View view) {
/**
* Create an observable of hover events for {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable are <b>mutable</b> and part of a shared
* object pool and thus are <b>not safe</b> to cache or delay reading (such as by observing
* on a different thread). If you want to cache or delay reading the items emitted then you must
* map values through a function which calls {@link MotionEvent#obtain(MotionEvent)} or
* {@link MotionEvent#obtainNoHistory(MotionEvent)} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand All @@ -180,6 +186,12 @@ public static Observable<MotionEvent> hovers(@NonNull View view) {
/**
* Create an observable of hover events for {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable are <b>mutable</b> and part of a shared
* object pool and thus are <b>not safe</b> to cache or delay reading (such as by observing
* on a different thread). If you want to cache or delay reading the items emitted then you must
* map values through a function which calls {@link MotionEvent#obtain(MotionEvent)} or
* {@link MotionEvent#obtainNoHistory(MotionEvent)} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand Down Expand Up @@ -307,6 +319,12 @@ public static Observable<Integer> systemUiVisibilityChanges(@NonNull View view)
/**
* Create an observable of touch events for {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable are <b>mutable</b> and part of a shared
* object pool and thus are <b>not safe</b> to cache or delay reading (such as by observing
* on a different thread). If you want to cache or delay reading the items emitted then you must
* map values through a function which calls {@link MotionEvent#obtain(MotionEvent)} or
* {@link MotionEvent#obtainNoHistory(MotionEvent)} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand All @@ -322,6 +340,12 @@ public static Observable<MotionEvent> touches(@NonNull View view) {
/**
* Create an observable of touch events for {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable are <b>mutable</b> and part of a shared
* object pool and thus are <b>not safe</b> to cache or delay reading (such as by observing
* on a different thread). If you want to cache or delay reading the items emitted then you must
* map values through a function which calls {@link MotionEvent#obtain(MotionEvent)} or
* {@link MotionEvent#obtainNoHistory(MotionEvent)} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ public static Observable<TextViewEditorActionEvent> editorActionEvents(@NonNull
/**
* Create an observable of character sequences for text changes on {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable are <b>mutable</b> and owned by the host
* {@code TextView} and thus are <b>not safe</b> to cache or delay reading (such as by observing
* on a different thread). If you want to cache or delay reading the items emitted then you must
* map values through a function which calls {@link String#valueOf} or
* {@link CharSequence#toString() .toString()} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand All @@ -104,6 +110,12 @@ public static Observable<CharSequence> textChanges(@NonNull TextView view) {
/**
* Create an observable of text change events for {@code view}.
* <p>
* <em>Warning:</em> Values emitted by this observable contain a <b>mutable</b>
* {@link CharSequence} owned by the host {@code TextView} and thus are <b>not safe</b> to cache
* or delay reading (such as by observing on a different thread). If you want to cache or delay
* reading the items emitted then you must map values through a function which calls
* {@link String#valueOf} or {@link CharSequence#toString() .toString()} to create a copy.
* <p>
* <em>Warning:</em> The created observable keeps a strong reference to {@code view}. Unsubscribe
* to free this reference.
* <p>
Expand Down

0 comments on commit 60850da

Please sign in to comment.