Skip to content

Commit

Permalink
Implement transactions loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed Jan 19, 2024
1 parent 44316c1 commit 3a0c457
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
Expand All @@ -12,6 +13,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import java.text.NumberFormat
import java.time.Instant
Expand All @@ -20,6 +22,8 @@ import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import net.primal.android.R
import net.primal.android.core.compose.ListLoading
import net.primal.android.core.compose.isEmpty
import net.primal.android.theme.AppTheme

@ExperimentalFoundationApi
Expand Down Expand Up @@ -82,6 +86,21 @@ fun TransactionsLazyColumn(
}
}

if (pagingItems.isEmpty()) {
when (pagingItems.loadState.refresh) {
LoadState.Loading -> {
item(contentType = "LoadingRefresh") {
ListLoading(
modifier = Modifier
.fillParentMaxSize()
.padding(bottom = 80.dp),
)
}
}
else -> Unit
}
}

if (footer != null) {
item(
contentType = { "Footer" },
Expand Down

0 comments on commit 3a0c457

Please sign in to comment.