Skip to content

Commit b84184d

Browse files
committed
Add search page progress & hide on empty list
1 parent 9d6077a commit b84184d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/src/main/java/com/paulcoding/hviewer/ui/page/post/PostPage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ fun PostPage(siteConfig: SiteConfig, postUrl: String, goBack: () -> Unit) {
101101
},
102102
title = {},
103103
actions = {
104-
HPageProgress(uiState.postPage, uiState.postTotalPage)
104+
if (uiState.images.isNotEmpty())
105+
HPageProgress(uiState.postPage, uiState.postTotalPage)
105106
}
106107
)
107108
}

app/src/main/java/com/paulcoding/hviewer/ui/page/posts/PostsPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ fun PostsPage(
6363
TopAppBar(title = { Text(currentPage.toCapital()) }, navigationIcon = {
6464
HBackIcon { goBack() }
6565
}, actions = {
66-
HIcon(imageVector = Search) { navToSearch() }
6766
HPageProgress(pageProgress.first, pageProgress.second)
67+
HIcon(imageVector = Search) { navToSearch() }
6868
})
6969
}) { paddings ->
7070
Column(modifier = Modifier.padding(paddings)) {

app/src/main/java/com/paulcoding/hviewer/ui/page/search/SearchPage.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import com.paulcoding.hviewer.model.SiteConfig
3838
import com.paulcoding.hviewer.ui.component.HBackIcon
3939
import com.paulcoding.hviewer.ui.component.HEmpty
4040
import com.paulcoding.hviewer.ui.component.HLoading
41+
import com.paulcoding.hviewer.ui.component.HPageProgress
4142
import com.paulcoding.hviewer.ui.icon.EditIcon
4243
import com.paulcoding.hviewer.ui.page.posts.PostItemView
4344

@@ -52,6 +53,7 @@ fun SearchPage(
5253
val viewModel: SearchViewModel = viewModel(
5354
factory = SearchViewModelFactory(siteConfig),
5455
)
56+
val uiState by viewModel.stateFlow.collectAsState()
5557
var query by remember { mutableStateOf(viewModel.stateFlow.value.query) }
5658
val focusRequester = remember { androidx.compose.ui.focus.FocusRequester() }
5759
val focusManager = LocalFocusManager.current
@@ -69,7 +71,11 @@ fun SearchPage(
6971
Scaffold(topBar = {
7072
TopAppBar(title = { Text("Search") }, navigationIcon = {
7173
HBackIcon { goBack() }
72-
})
74+
},
75+
actions = {
76+
if (uiState.postItems.isNotEmpty())
77+
HPageProgress(uiState.postsPage, uiState.postsTotalPage)
78+
})
7379
}) { paddings ->
7480
Column(modifier = Modifier.padding(paddings)) {
7581
Row(

0 commit comments

Comments
 (0)