List editing (#1104)
* List editing groundwork * Add ability to add/remove accounts from list, delete lists * Rename list, improve lists UI * Add error handling, extract strings * Revert gradle.properties * Apply feedback suggestions * Apply feedback * Update license header
This commit is contained in:
parent
08c1bbd253
commit
520e0d6e7a
23 changed files with 1047 additions and 222 deletions
|
|
@ -27,6 +27,8 @@ sealed class Either<out L, out R> {
|
|||
|
||||
fun isRight() = this is Right
|
||||
|
||||
fun isLeft() = this is Left
|
||||
|
||||
fun asLeftOrNull() = (this as? Left<L, R>)?.value
|
||||
|
||||
fun asRightOrNull() = (this as? Right<L, R>)?.value
|
||||
|
|
@ -34,4 +36,12 @@ sealed class Either<out L, out R> {
|
|||
fun asLeft(): L = (this as Left<L, R>).value
|
||||
|
||||
fun asRight(): R = (this as Right<L, R>).value
|
||||
|
||||
inline fun <N> map(crossinline mapper: (R) -> N): Either<L, N> {
|
||||
return if (this.isLeft()) {
|
||||
Left(this.asLeft())
|
||||
} else {
|
||||
Right(mapper(this.asRight()))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue