mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
remove refresh buttin from library nav bar
This commit is contained in:
parent
bc7f2885b0
commit
497461e7f1
4 changed files with 6 additions and 26 deletions
|
|
@ -17,8 +17,8 @@ android {
|
|||
applicationId "app.omnivore.omnivore"
|
||||
minSdk 26
|
||||
targetSdk 33
|
||||
versionCode 23
|
||||
versionName "0.0.23"
|
||||
versionCode 24
|
||||
versionName "0.0.24"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
|
|
|||
|
|
@ -34,17 +34,13 @@ fun LibraryView(
|
|||
navController: NavHostController
|
||||
) {
|
||||
val searchText: String by libraryViewModel.searchTextLiveData.observeAsState("")
|
||||
val isRefreshing: Boolean by libraryViewModel.isRefreshingLiveData.observeAsState(false)
|
||||
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
SearchBar(
|
||||
searchText = searchText,
|
||||
onSearchTextChanged = { libraryViewModel.updateSearchText(it) },
|
||||
onSettingsIconClick = { navController.navigate(Routes.Settings.route) },
|
||||
onRefreshButtonTap = { libraryViewModel.refresh() },
|
||||
isRefreshing = isRefreshing
|
||||
onSettingsIconClick = { navController.navigate(Routes.Settings.route) }
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class LibraryViewModel @Inject constructor(
|
|||
val itemsLiveData = dataService.db.savedItemDao().getLibraryLiveDataWithLabels()
|
||||
|
||||
var isRefreshing by mutableStateOf(false)
|
||||
val isRefreshingLiveData = MutableLiveData(false)
|
||||
|
||||
fun updateSearchText(text: String) {
|
||||
searchTextLiveData.value = text
|
||||
|
|
@ -49,7 +48,6 @@ class LibraryViewModel @Inject constructor(
|
|||
|
||||
fun refresh() {
|
||||
isRefreshing = true
|
||||
isRefreshingLiveData.postValue(true)
|
||||
load(true)
|
||||
}
|
||||
|
||||
|
|
@ -74,14 +72,13 @@ class LibraryViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun syncItems() {
|
||||
val syncStart = java.time.Instant.now()
|
||||
val lastSyncDate = getLastSyncTime() ?: java.time.Instant.MIN
|
||||
val syncStart = Instant.now()
|
||||
val lastSyncDate = getLastSyncTime() ?: Instant.MIN
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
performItemSync(cursor = null, since = lastSyncDate.toString(), count = 0, startTime = syncStart.toString())
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
isRefreshing = false
|
||||
isRefreshingLiveData.postValue(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@ import androidx.compose.foundation.text.KeyboardActions
|
|||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
|
|
@ -31,9 +29,7 @@ import androidx.compose.ui.unit.dp
|
|||
fun SearchBar(
|
||||
searchText: String,
|
||||
onSearchTextChanged: (String) -> Unit,
|
||||
onSettingsIconClick: () -> Unit,
|
||||
onRefreshButtonTap: () -> Unit,
|
||||
isRefreshing: Boolean
|
||||
onSettingsIconClick: () -> Unit
|
||||
) {
|
||||
var showSearchField by remember { mutableStateOf(searchText != "") }
|
||||
|
||||
|
|
@ -60,15 +56,6 @@ fun SearchBar(
|
|||
.padding(horizontal = 6.dp)
|
||||
)
|
||||
} else {
|
||||
IconButton(onClick = { onRefreshButtonTap() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Refresh,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.alpha(if (isRefreshing) 0.3f else 1.0f)
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(onClick = { showSearchField = true }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Search,
|
||||
|
|
|
|||
Loading…
Reference in a new issue