mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-17 21:39:49 -04:00
small improvements after feedback
This commit is contained in:
@@ -77,7 +77,7 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {
|
||||
|
||||
private val _onlyInstalledApps = MutableStateFlow(false)
|
||||
val onlyInstalledApps = _onlyInstalledApps.asStateFlow<Boolean>()
|
||||
private val _sortBy = MutableStateFlow<Sort>(Sort.NAME)
|
||||
private val _sortBy = MutableStateFlow<Sort>(Sort.LATEST)
|
||||
val sortBy = _sortBy.asStateFlow<Sort>()
|
||||
private val _addedCategories = MutableStateFlow<List<String>>(emptyList())
|
||||
val addedCategories = _addedCategories.asStateFlow<List<String>>()
|
||||
|
||||
@@ -63,7 +63,7 @@ fun Apps(
|
||||
Column(
|
||||
modifier.fillMaxSize()
|
||||
) {
|
||||
var filterExpanded by rememberSaveable { mutableStateOf(false) }
|
||||
var filterExpanded by rememberSaveable { mutableStateOf(true) }
|
||||
val addedRepos = remember { mutableStateListOf<String>() }
|
||||
val showFilterBadge = addedRepos.isNotEmpty() ||
|
||||
filterInfo.model.addedCategories.isNotEmpty() ||
|
||||
@@ -95,9 +95,7 @@ fun Apps(
|
||||
detailPane = {
|
||||
AnimatedPane {
|
||||
navigator.currentDestination?.contentKey?.let {
|
||||
AppDetails(
|
||||
appItem = it,
|
||||
)
|
||||
AppDetails(appItem = it)
|
||||
} ?: Text("No app selected", modifier = Modifier.padding(16.dp))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Apps
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.Update
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.BadgedBox
|
||||
@@ -16,6 +17,7 @@ import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -51,6 +53,7 @@ fun Main(numUpdates: Int, updates: List<UpdatableApp>, filterInfo: FilterInfo) {
|
||||
else -> NavigationSuiteType.NavigationRail
|
||||
}
|
||||
}
|
||||
var menuExpanded by remember { mutableStateOf(false) }
|
||||
NavigationSuiteScaffold(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
layoutType = customNavSuiteType,
|
||||
@@ -81,6 +84,18 @@ fun Main(numUpdates: Int, updates: List<UpdatableApp>, filterInfo: FilterInfo) {
|
||||
onClick = { currentDestination = dest }
|
||||
)
|
||||
}
|
||||
item(
|
||||
icon = {
|
||||
Icon(
|
||||
Icons.Default.MoreVert,
|
||||
contentDescription = null,
|
||||
)
|
||||
MainOverFlowMenu(menuExpanded) { menuExpanded = false }
|
||||
},
|
||||
label = { Text("More") },
|
||||
selected = false,
|
||||
onClick = { menuExpanded = true }
|
||||
)
|
||||
}
|
||||
) {
|
||||
if (currentDestination == AppDestinations.APPS) Apps(
|
||||
|
||||
@@ -7,7 +7,6 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Clear
|
||||
import androidx.compose.material.icons.filled.FilterList
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.BadgedBox
|
||||
@@ -20,14 +19,9 @@ import androidx.compose.material3.SearchBarState
|
||||
import androidx.compose.material3.SearchBarValue
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import kotlinx.coroutines.launch
|
||||
import org.fdroid.basic.ui.main.MainOverFlowMenu
|
||||
|
||||
@Composable
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@@ -38,7 +32,6 @@ fun AppSearchInputField(
|
||||
showFilterBadge: Boolean
|
||||
) {
|
||||
val scope = rememberCoroutineScope()
|
||||
var menuExpanded by remember { mutableStateOf(false) }
|
||||
SearchBarDefaults.InputField(
|
||||
modifier = Modifier,
|
||||
searchBarState = searchBarState,
|
||||
@@ -77,13 +70,6 @@ fun AppSearchInputField(
|
||||
)
|
||||
}
|
||||
}
|
||||
IconButton(onClick = { menuExpanded = true }) {
|
||||
Icon(
|
||||
Icons.Default.MoreVert,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
MainOverFlowMenu(menuExpanded) { menuExpanded = false }
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -54,42 +54,6 @@ fun ColumnScope.AppsFilter(
|
||||
var sortByMenuExpanded by remember { mutableStateOf(false) }
|
||||
var repoMenuExpanded by remember { mutableStateOf(false) }
|
||||
var categoryMenuExpanded by remember { mutableStateOf(false) }
|
||||
filter.model.addedCategories.forEach { category ->
|
||||
FilterChip(
|
||||
selected = true,
|
||||
trailingIcon = {
|
||||
Icon(
|
||||
Icons.Filled.Clear,
|
||||
null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(category)
|
||||
},
|
||||
onClick = {
|
||||
filter.removeCategory(category)
|
||||
}
|
||||
)
|
||||
}
|
||||
addedRepos.forEach { repo ->
|
||||
FilterChip(
|
||||
selected = true,
|
||||
trailingIcon = {
|
||||
Icon(
|
||||
Icons.Filled.Clear,
|
||||
null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(repo)
|
||||
},
|
||||
onClick = {
|
||||
addedRepos.remove(repo)
|
||||
}
|
||||
)
|
||||
}
|
||||
FilterChip(
|
||||
selected = false,
|
||||
leadingIcon = {
|
||||
@@ -156,7 +120,7 @@ fun ColumnScope.AppsFilter(
|
||||
Icon(
|
||||
Icons.Filled.Add,
|
||||
null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize)
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize),
|
||||
)
|
||||
},
|
||||
label = {
|
||||
@@ -182,9 +146,9 @@ fun ColumnScope.AppsFilter(
|
||||
selected = false,
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Filled.Add,
|
||||
null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize)
|
||||
imageVector = Icons.Filled.Add,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize),
|
||||
)
|
||||
},
|
||||
label = {
|
||||
@@ -211,6 +175,34 @@ fun ColumnScope.AppsFilter(
|
||||
},
|
||||
onClick = { repoMenuExpanded = !repoMenuExpanded },
|
||||
)
|
||||
filter.model.addedCategories.forEach { category ->
|
||||
FilterChip(
|
||||
selected = true,
|
||||
trailingIcon = {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Clear,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize),
|
||||
)
|
||||
},
|
||||
label = { Text(category) },
|
||||
onClick = { filter.removeCategory(category) }
|
||||
)
|
||||
}
|
||||
addedRepos.forEach { repo ->
|
||||
FilterChip(
|
||||
selected = true,
|
||||
trailingIcon = {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Clear,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(FilterChipDefaults.IconSize),
|
||||
)
|
||||
},
|
||||
label = { Text(repo) },
|
||||
onClick = { addedRepos.remove(repo) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user