|
| 1 | +# FlowBinding Android |
| 2 | + |
| 3 | +This module provides bindings for the Android platform APIs. |
| 4 | + |
| 5 | +## Download |
| 6 | + |
| 7 | +```groovy |
| 8 | +implementation "io.github.reactivecircus.flowbinding:flowbinding-android:${flowbinding_version}" |
| 9 | +``` |
| 10 | + |
| 11 | +## Available Bindings |
| 12 | + |
| 13 | +```kotlin |
| 14 | +// MenuItem |
| 15 | +fun MenuItem.actionViewEvents(handled: (MenuItemActionViewEvent) -> Boolean): Flow<MenuItemActionViewEvent> |
| 16 | +fun MenuItem.clicks(handled: (MenuItem) -> Boolean): Flow<Unit> |
| 17 | + |
| 18 | +// View |
| 19 | +fun View.attachEvents(): Flow<ViewAttachEvent> |
| 20 | +fun View.clicks(): Flow<Unit> |
| 21 | +fun View.drags(handled: (DragEvent) -> Boolean = { true }): Flow<DragEvent> |
| 22 | +fun View.draws(): Flow<Unit> |
| 23 | +fun View.focusChanges(emitImmediately: Boolean = false): Flow<Boolean> |
| 24 | +fun View.globalLayouts(): Flow<Unit> |
| 25 | +fun ViewGroup.hierarchyChangeEvents(): Flow<HierarchyChangeEvent> |
| 26 | +fun View.hovers(handled: (MotionEvent) -> Boolean = { true }): Flow<MotionEvent> |
| 27 | +fun View.keys(handled: (KeyEvent) -> Boolean = { true }): Flow<KeyEvent> |
| 28 | +fun View.layoutChangeEvents(): Flow<LayoutChangeEvent> |
| 29 | +fun View.layoutChanges(): Flow<Unit> |
| 30 | +fun View.longClicks(): Flow<Unit> |
| 31 | +fun View.preDraws(proceedDrawingPass: () -> Boolean): Flow<Unit> |
| 32 | +fun View.scrollChangeEvents(): Flow<ScrollChangeEvent> |
| 33 | +fun View.systemUiVisibilityChanges(): Flow<Int> |
| 34 | +fun View.touches(handled: (MotionEvent) -> Boolean = { true }): Flow<MotionEvent> |
| 35 | + |
| 36 | +// AbsListView |
| 37 | +fun AbsListView.scrollEvents(): Flow<ScrollEvent> |
| 38 | + |
| 39 | +// Adapter |
| 40 | +fun Adapter.dataChanges(emitImmediately: Boolean = false): Flow<Adapter> |
| 41 | + |
| 42 | +// AdapterView |
| 43 | +fun <T : Adapter> AdapterView<T>.itemClickEvents(): Flow<AdapterViewItemClickEvent> |
| 44 | +fun <T : Adapter> AdapterView<T>.itemClicks(): Flow<Int> |
| 45 | +fun <T : Adapter> AdapterView<T>.itemLongClickEvents(handled: (AdapterViewItemLongClickEvent) -> Boolean = { true }): Flow<AdapterViewItemLongClickEvent> |
| 46 | +fun <T : Adapter> AdapterView<T>.itemLongClicks(handled: () -> Boolean = { true }): Flow<Int> |
| 47 | +fun <T : Adapter> AdapterView<T>.itemSelections(emitImmediately: Boolean = false): Flow<Int> |
| 48 | +fun <T : Adapter> AdapterView<T>.selectionEvents(emitImmediately: Boolean = false): Flow<AdapterViewSelectionEvent> |
| 49 | + |
| 50 | +// AutoCompleteTextView |
| 51 | +fun AutoCompleteTextView.dismisses(): Flow<Unit> |
| 52 | +fun AutoCompleteTextView.itemClickEvents(): Flow<AdapterViewItemClickEvent> |
| 53 | + |
| 54 | +// CompoundButton |
| 55 | +fun CompoundButton.checkedChanges(emitImmediately: Boolean = false): Flow<Boolean> |
| 56 | + |
| 57 | +// PopupMenu |
| 58 | +fun PopupMenu.dismisses(): Flow<Unit> |
| 59 | +fun PopupMenu.itemClicks(): Flow<MenuItem> |
| 60 | + |
| 61 | +// RadioGroup |
| 62 | +fun RadioGroup.checkedChanges(emitImmediately: Boolean = false): Flow<Int> |
| 63 | + |
| 64 | +// RatingBar |
| 65 | +fun RatingBar.ratingChangeEvents(emitImmediately: Boolean = false): Flow<RatingChangeEvent> |
| 66 | +fun RatingBar.ratingChanges(emitImmediately: Boolean = false): Flow<Float> |
| 67 | + |
| 68 | +// SearchView |
| 69 | +fun SearchView.queryTextChanges(emitImmediately: Boolean = false): Flow<CharSequence> |
| 70 | +fun SearchView.queryTextEvents(emitImmediately: Boolean = false): Flow<QueryTextEvent> |
| 71 | + |
| 72 | +// SeekBar |
| 73 | +fun SeekBar.changeEvents(emitImmediately: Boolean = false): Flow<SeekBarChangeEvent> |
| 74 | +fun SeekBar.progressChanges(emitImmediately: Boolean = false): Flow<Int> |
| 75 | + |
| 76 | +// TextView |
| 77 | +fun TextView.afterTextChanges(emitImmediately: Boolean = false): Flow<AfterTextChangeEvent> |
| 78 | +fun TextView.beforeTextChanges(emitImmediately: Boolean = false): Flow<BeforeTextChangeEvent> |
| 79 | +fun TextView.editorActionEvents(handled: (EditorActionEvent) -> Boolean = { true }): Flow<EditorActionEvent> |
| 80 | +fun TextView.textChangeEvents(emitImmediately: Boolean = false): Flow<TextChangeEvent> |
| 81 | +fun TextView.textChanges(emitImmediately: Boolean = false): Flow<CharSequence> |
| 82 | +``` |
0 commit comments