This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val dummyData = arrayOfNulls<DemoData>(DUMMY_ENTRY_COUNT) | |
val items: LiveData<Resource<List<DemoData?>?>> = repository.getDemoData().map { | |
if (it.loading) { | |
Resource.Loading(dummyData.toList()) | |
} else it | |
} | |
val itemBinding: ItemBinding<DemoData> = { data, position -> | |
when (data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:bones="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable | |
name="viewModel" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Immutable | |
sealed class Item<T> { | |
class Unavailable<T>: Item<T>() | |
data class Available<T>( | |
val data: T, | |
private var onVisible: (() -> Unit)? | |
): Item<T>() { | |
fun notifyVisible() { | |
this.onVisible?.invoke() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.animation.* | |
import androidx.compose.foundation.gestures.FlingBehavior | |
import androidx.compose.foundation.gestures.ScrollableDefaults | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.PaddingValues | |
import androidx.compose.foundation.layout.Spacer | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.lazy.* | |
import androidx.compose.runtime.* |
OlderNewer