diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 17bf544b..06263c57 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -96,7 +96,6 @@ dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.serialization.core) implementation(libs.kotlinx.serialization.json) - implementation(libs.material3.pulltorefresh) implementation(libs.napier) implementation(libs.okhttp.core) implementation(libs.okhttp.loggingInterceptor) diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt index 486664e4..c22a0fd4 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt @@ -7,8 +7,6 @@ package dev.msfjarvis.claw.android.ui.lists import androidx.activity.compose.ReportDrawnWhen -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentWidth @@ -17,6 +15,7 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.pulltorefresh.PullToRefreshBox import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -35,9 +34,6 @@ import dev.msfjarvis.claw.common.ui.NetworkError import dev.msfjarvis.claw.common.ui.ProgressBar import dev.msfjarvis.claw.common.ui.preview.DevicePreviews import dev.msfjarvis.claw.model.UIPost -import eu.bambooapps.material3.pullrefresh.PullRefreshIndicator -import eu.bambooapps.material3.pullrefresh.pullRefresh -import eu.bambooapps.material3.pullrefresh.rememberPullRefreshState import kotlinx.coroutines.flow.MutableStateFlow @OptIn(ExperimentalMaterial3Api::class) @@ -51,8 +47,11 @@ fun NetworkPosts( ReportDrawnWhen { lazyPagingItems.itemCount > 0 } val refreshLoadState = lazyPagingItems.loadState.refresh val isRefreshing = refreshLoadState == LoadState.Loading && lazyPagingItems.itemCount == 0 - val pullRefreshState = rememberPullRefreshState(isRefreshing, lazyPagingItems::refresh) - Box(modifier = modifier.fillMaxSize().pullRefresh(pullRefreshState)) { + PullToRefreshBox( + isRefreshing = isRefreshing, + onRefresh = { lazyPagingItems.refresh() }, + modifier = modifier, + ) { if (lazyPagingItems.itemCount == 0 && refreshLoadState is LoadState.Error) { NetworkError( label = "Failed to load posts", @@ -88,12 +87,6 @@ fun NetworkPosts( } } } - PullRefreshIndicator( - refreshing = isRefreshing, - state = pullRefreshState, - modifier = Modifier.align(Alignment.TopCenter), - shadowElevation = 6.dp, // From M2 implementation - ) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b1e1df5b..868891eb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -89,7 +89,6 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } -material3-pulltorefresh = "eu.bambooapps:compose-material3-pullrefresh:1.1.1" napier = "io.github.aakira:napier:2.7.1" okhttp-bom = "com.squareup.okhttp3:okhttp-bom:4.12.0" okhttp-core = { module = "com.squareup.okhttp3:okhttp" }