Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
LDRAlighieri committed Sep 22, 2019
2 parents ac31e8c + 564a57b commit 1925b7c
Showing 118 changed files with 5,294 additions and 503 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,43 @@
# ChangeLog


## Version 1.2.0-RC

* New: Bindings list:
* Platform bindings:
* `corbind`:
* `DatePickerDialog`:
* `dateSetEvents`
* `CalendarView`:
* `dateChangeEvents`
* `DatePicker`:
* `dateChangeEvents`
* `NumberPicker`:
* `scrollStateChanges`
* `valueChangeEvents`
* `TimePicker`:
* `timeChangeEvents`
* Google "material" library bindings:
* `corbind-material`:
* `BottomNavigationView`:
* `itemReselections`
* `MaterialButton`:
* `checkedChanges`
* `MaterialButtonToggleGroup`:
* `buttonCheckedChangeEvents` (only *not* in single selection mode)
* `buttonCheckedChanges` (only in single selection mode)
* `MaterialCardView`:
* `checkedChanges`
* `TextInputLayout`:
* `endIconChanges`
* `endIconClicks`
* `endIconLongClicks`
* `startIconClicks`
* `startIconLongClicks`
* Update: Material components dependency to v1.1.0-alpha10
* Update: ViewPager2 dependency to v1.0.0-beta04


## Version 1.1.2

* Update: Kotlin coroutines modules dependency to v1.3.1
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -22,25 +22,25 @@ This library is for Android applications only. Help you to transform Android UI

Platform bindings:
```groovy
implementation 'ru.ldralighieri.corbind:corbind:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind:1.2.0-RC'
```

AndroidX library bindings:
```groovy
implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-core:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-leanback:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-core:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-leanback:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.2.0-RC'
implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.2.0-RC'
```

Google 'material' library bindings:
```groovy
implementation 'ru.ldralighieri.corbind:corbind-material:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-material:1.2.0-RC'
```


@@ -105,6 +105,8 @@ combine(
.launchIn(scope)
```

More examples in module descriptions and in source code


## Missed or forgot something?

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -31,8 +31,8 @@ buildscript {
'slidingpane_layout' : '1.0.0',
'swiperefresh_layout' : '1.0.0',
'viewpager' : '1.0.0',
'viewpager2' : '1.0.0-beta03',
'material' : '1.0.0'
'viewpager2' : '1.0.0-beta04',
'material' : '1.1.0-alpha10'
],
'ktlint': '0.33.0',
'dokka': '0.9.18'
4 changes: 3 additions & 1 deletion corbind-appcompat/README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
To add androidx appcompat bindings, import `corbind-appcompat` module:

```groovy
implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.1.2'
implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.2.0-RC'
```

## List of extensions
@@ -27,3 +27,5 @@ toolbar.itemClicks() // Flow<MenuItem>
.onEach { /* handle menu item clicks events */ }
.launchIn(scope)
```

More examples in source code
Original file line number Diff line number Diff line change
@@ -30,11 +30,14 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.isActive
import ru.ldralighieri.corbind.corbindReceiveChannel
import ru.ldralighieri.corbind.offerElement
import ru.ldralighieri.corbind.safeOffer

/**
* Perform an action on clicked menu item in [ActionMenuView].
*
* *Warning:* The created actor uses [ActionMenuView.setOnMenuItemClickListener]. Only one actor can
* be used at a time.
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
* @param action An action to perform
@@ -55,6 +58,9 @@ fun ActionMenuView.itemClicks(
/**
* Perform an action on clicked menu item in [ActionMenuView], inside new [CoroutineScope].
*
* *Warning:* The created actor uses [ActionMenuView.setOnMenuItemClickListener]. Only one actor can
* be used at a time.
*
* @param capacity Capacity of the channel's buffer (no buffer by default)
* @param action An action to perform
*/
@@ -68,6 +74,18 @@ suspend fun ActionMenuView.itemClicks(
/**
* Create a channel which emits the clicked menu item in [ActionMenuView].
*
* *Warning:* The created channel uses [ActionMenuView.setOnMenuItemClickListener]. Only one channel
* can be used at a time.
*
* Example:
*
* ```
* launch {
* actionMenuView.itemClicks(scope)
* .consumeEach { /* handle menu item */ }
* }
* ```
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
*/
@@ -76,12 +94,23 @@ fun ActionMenuView.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
): ReceiveChannel<MenuItem> = corbindReceiveChannel(capacity) {
setOnMenuItemClickListener(listener(scope, ::offerElement))
setOnMenuItemClickListener(listener(scope, ::safeOffer))
invokeOnClose { setOnMenuItemClickListener(null) }
}

/**
* Create a flow which emits the clicked menu item in [ActionMenuView].
*
* *Warning:* The created flow uses [ActionMenuView.setOnMenuItemClickListener]. Only one flow can
* be used at a time.
*
* Example:
*
* ```
* actionMenuView.itemClicks()
* .onEach { /* handle menu item */ }
* .launchIn(scope)
* ```
*/
@CheckResult
fun ActionMenuView.itemClicks(): Flow<MenuItem> = channelFlow {
Original file line number Diff line number Diff line change
@@ -29,13 +29,13 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.isActive
import ru.ldralighieri.corbind.corbindReceiveChannel
import ru.ldralighieri.corbind.offerElement
import ru.ldralighieri.corbind.safeOffer

/**
* Perform an action on [PopupMenu] dismiss events.
*
* *Warning:* The created actor uses [PopupMenu.setOnDismissListener] to emit dismiss change.
* Only one actor can be used for a view at a time.
* *Warning:* The created actor uses [PopupMenu.setOnDismissListener]. Only one actor can be used
* at a time.
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
@@ -57,8 +57,8 @@ fun PopupMenu.dismisses(
/**
* Perform an action on [PopupMenu] dismiss events, inside new [CoroutineScope].
*
* *Warning:* The created actor uses [PopupMenu.setOnDismissListener] to emit dismiss change.
* Only one actor can be used for a view at a time.
* *Warning:* The created actor uses [PopupMenu.setOnDismissListener]. Only one actor can be used
* for a view at a time.
*
* @param capacity Capacity of the channel's buffer (no buffer by default)
* @param action An action to perform
@@ -73,8 +73,17 @@ suspend fun PopupMenu.dismisses(
/**
* Create a channel which emits on [PopupMenu] dismiss events.
*
* *Warning:* The created channel uses [PopupMenu.setOnDismissListener] to emit dismiss change.
* Only one channel can be used for a view at a time.
* *Warning:* The created channel uses [PopupMenu.setOnDismissListener]. Only one channel can be
* used at a time.
*
* Example:
*
* ```
* launch {
* popupMenu.dismisses(scope)
* .consumeEach { /* handle popup menu dismiss */ }
* }
* ```
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
@@ -84,15 +93,23 @@ fun PopupMenu.dismisses(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
): ReceiveChannel<Unit> = corbindReceiveChannel(capacity) {
setOnDismissListener(listener(scope, ::offerElement))
setOnDismissListener(listener(scope, ::safeOffer))
invokeOnClose { setOnMenuItemClickListener(null) }
}

/**
* Create a flow which emits on [PopupMenu] dismiss events.
*
* *Warning:* The created flow uses [PopupMenu.setOnDismissListener] to emit dismiss change.
* Only one flow can be used for a view at a time.
* *Warning:* The created flow uses [PopupMenu.setOnDismissListener]. Only one flow can be used at a
* time.
*
* Example:
*
* ```
* popupMenu.dismisses()
* .onEach { /* handle popup menu dismiss */ }
* .launchIn(scope)
* ```
*/
@CheckResult
fun PopupMenu.dismisses(): Flow<Unit> = channelFlow {
Original file line number Diff line number Diff line change
@@ -30,13 +30,13 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.isActive
import ru.ldralighieri.corbind.corbindReceiveChannel
import ru.ldralighieri.corbind.offerElement
import ru.ldralighieri.corbind.safeOffer

/**
* Perform an action on clicked item in [PopupMenu].
*
* *Warning:* The created actor uses [PopupMenu.setOnMenuItemClickListener] to emit dismiss
* change. Only one actor can be used for a view at a time.
* *Warning:* The created actor uses [PopupMenu.setOnMenuItemClickListener]. Only one actor can be
* used at a time.
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
@@ -58,8 +58,8 @@ fun PopupMenu.itemClicks(
/**
* Perform an action on clicked item in [PopupMenu], inside new [CoroutineScope].
*
* *Warning:* The created actor uses [PopupMenu.setOnMenuItemClickListener] to emit dismiss
* change. Only one actor can be used for a view at a time.
* *Warning:* The created actor uses [PopupMenu.setOnMenuItemClickListener]. Only one actor can be
* used at a time.
*
* @param capacity Capacity of the channel's buffer (no buffer by default)
* @param action An action to perform
@@ -74,8 +74,17 @@ suspend fun PopupMenu.itemClicks(
/**
* Create a channel which emits the clicked item in [PopupMenu].
*
* *Warning:* The created channel uses [PopupMenu.setOnMenuItemClickListener] to emit dismiss
* change. Only one channel can be used for a view at a time.
* *Warning:* The created channel uses [PopupMenu.setOnMenuItemClickListener]. Only one channel can
* be used at a time.
*
* Example:
*
* ```
* launch {
* popupMenu.itemClicks(scope)
* .consumeEach { /* handle menu item */ }
* }
* ```
*
* @param scope Root coroutine scope
* @param capacity Capacity of the channel's buffer (no buffer by default)
@@ -85,15 +94,23 @@ fun PopupMenu.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
): ReceiveChannel<MenuItem> = corbindReceiveChannel(capacity) {
setOnMenuItemClickListener(listener(scope, ::offerElement))
setOnMenuItemClickListener(listener(scope, ::safeOffer))
invokeOnClose { setOnMenuItemClickListener(null) }
}

/**
* Create a flow which emits the clicked item in [PopupMenu].
*
* *Warning:* The created flow uses [PopupMenu.setOnMenuItemClickListener] to emit dismiss
* change. Only one flow can be used for a view at a time.
* *Warning:* The created flow uses [PopupMenu.setOnMenuItemClickListener]. Only one flow can be
* used at a time.
*
* Example:
*
* ```
* popupMenu.itemClicks()
* .onEach { /* handle menu item */ }
* .launchIn(scope)
* ```
*/
@CheckResult
fun PopupMenu.itemClicks(): Flow<MenuItem> = channelFlow {
Loading

0 comments on commit 1925b7c

Please sign in to comment.