mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-17 12:19:52 -04:00
Merge branch 'hints-3.1.0' into 'master'
ComposeHints 3.1.0 See merge request fdroid/fdroidclient!1681
This commit is contained in:
@@ -9,11 +9,11 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.navigation3.runtime.NavEntry
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import androidx.navigation3.ui.NavDisplay
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import org.fdroid.ui.navigation.BottomBar
|
||||
import org.fdroid.ui.navigation.MainNavKey
|
||||
import org.fdroid.ui.navigation.NavigationRail
|
||||
import org.fdroid.ui.navigation.rememberResponsiveNavigationSceneDecoratorStrategy
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
|
||||
@Composable
|
||||
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
|
||||
@@ -30,7 +30,7 @@ fun MainContent(
|
||||
FDroidContent(dynamicColors = model.dynamicColors) {
|
||||
val listDetailStrategy = rememberListDetailSceneStrategy<NavKey>(directive = directive)
|
||||
SharedTransitionLayout {
|
||||
HintHost {
|
||||
HintOverlayContainer {
|
||||
val responsiveNavigationSceneDecoratorStrategy =
|
||||
rememberResponsiveNavigationSceneDecoratorStrategy<NavKey>(
|
||||
isBigScreen = isBigScreen,
|
||||
|
||||
@@ -70,7 +70,6 @@ import androidx.compose.ui.unit.IntSize
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import com.viktormykhailiv.compose.hints.HintProperties
|
||||
import com.viktormykhailiv.compose.hints.rememberHint
|
||||
import com.viktormykhailiv.compose.hints.rememberHintAnchorState
|
||||
@@ -86,8 +85,8 @@ import org.fdroid.ui.lists.AppListType
|
||||
import org.fdroid.ui.navigation.NavigationKey
|
||||
import org.fdroid.ui.utils.BigLoadingIndicator
|
||||
import org.fdroid.ui.utils.ExpandableSection
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
import org.fdroid.ui.utils.OnboardingPopupCard
|
||||
import org.fdroid.ui.utils.getHintOverlayColor
|
||||
import org.fdroid.ui.utils.testApp
|
||||
|
||||
@Composable
|
||||
@@ -128,7 +127,7 @@ fun AppDetails(
|
||||
}
|
||||
}
|
||||
// onboarding hint plumbing
|
||||
val hintController = rememberHintController(overlay = getHintOverlayColor())
|
||||
val hintController = rememberHintController()
|
||||
val hint =
|
||||
rememberHint(HintProperties(dismissOnClickOutside = false)) {
|
||||
OnboardingPopupCard(
|
||||
@@ -471,5 +470,5 @@ fun AppDetailsNotFoundPreview() {
|
||||
@Preview
|
||||
@Composable
|
||||
fun AppDetailsPreview() {
|
||||
HintHost { FDroidContent { AppDetails(testApp, {}, {}) } }
|
||||
HintOverlayContainer { FDroidContent { AppDetails(testApp, {}, {}) } }
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import com.viktormykhailiv.compose.hints.HintProperties
|
||||
import com.viktormykhailiv.compose.hints.hintAnchor
|
||||
import com.viktormykhailiv.compose.hints.rememberHint
|
||||
@@ -62,11 +61,11 @@ import org.fdroid.ui.FDroidContent
|
||||
import org.fdroid.ui.search.TopSearchBar
|
||||
import org.fdroid.ui.utils.BackButton
|
||||
import org.fdroid.ui.utils.BigLoadingIndicator
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
import org.fdroid.ui.utils.OnboardingPopupCard
|
||||
import org.fdroid.ui.utils.TopAppBarButton
|
||||
import org.fdroid.ui.utils.appListItems
|
||||
import org.fdroid.ui.utils.getAppListInfo
|
||||
import org.fdroid.ui.utils.getHintOverlayColor
|
||||
|
||||
@Composable
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@@ -80,7 +79,7 @@ fun AppList(
|
||||
var searchActive by rememberSaveable { mutableStateOf(false) }
|
||||
val scrollBehavior = enterAlwaysScrollBehavior(rememberTopAppBarState())
|
||||
|
||||
val hintController = rememberHintController(overlay = getHintOverlayColor())
|
||||
val hintController = rememberHintController()
|
||||
val hint =
|
||||
rememberHint(HintProperties(dismissOnClickOutside = false)) {
|
||||
OnboardingPopupCard(
|
||||
@@ -229,7 +228,7 @@ private fun FilterButton(
|
||||
@Preview
|
||||
@Composable
|
||||
private fun Preview() {
|
||||
HintHost {
|
||||
HintOverlayContainer {
|
||||
FDroidContent {
|
||||
val model =
|
||||
AppListModel(
|
||||
@@ -253,7 +252,7 @@ private fun Preview() {
|
||||
@Preview
|
||||
@Composable
|
||||
private fun PreviewLoading() {
|
||||
HintHost {
|
||||
HintOverlayContainer {
|
||||
FDroidContent {
|
||||
val model =
|
||||
AppListModel(
|
||||
@@ -277,7 +276,7 @@ private fun PreviewLoading() {
|
||||
@Preview
|
||||
@Composable
|
||||
private fun PreviewEmpty() {
|
||||
HintHost {
|
||||
HintOverlayContainer {
|
||||
FDroidContent {
|
||||
val model =
|
||||
AppListModel(
|
||||
|
||||
@@ -36,8 +36,8 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import com.viktormykhailiv.compose.hints.HintProperties
|
||||
import com.viktormykhailiv.compose.hints.hintAnchor
|
||||
import com.viktormykhailiv.compose.hints.rememberHint
|
||||
import com.viktormykhailiv.compose.hints.rememberHintAnchorState
|
||||
import com.viktormykhailiv.compose.hints.rememberHintController
|
||||
@@ -45,15 +45,15 @@ import org.fdroid.R
|
||||
import org.fdroid.download.NetworkState
|
||||
import org.fdroid.ui.FDroidContent
|
||||
import org.fdroid.ui.utils.BigLoadingIndicator
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
import org.fdroid.ui.utils.OnboardingPopupCard
|
||||
import org.fdroid.ui.utils.getHintOverlayColor
|
||||
import org.fdroid.ui.utils.getRepositoriesInfo
|
||||
import org.fdroid.ui.utils.repoItems
|
||||
|
||||
@Composable
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||
fun Repositories(info: RepositoryInfo, isBigScreen: Boolean, onBackClicked: () -> Unit) {
|
||||
val hintController = rememberHintController(overlay = getHintOverlayColor())
|
||||
val hintController = rememberHintController()
|
||||
val hint =
|
||||
rememberHint(HintProperties(dismissOnClickOutside = false)) {
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
|
||||
@@ -118,7 +118,9 @@ fun Repositories(info: RepositoryInfo, isBigScreen: Boolean, onBackClicked: () -
|
||||
}
|
||||
}
|
||||
},
|
||||
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
|
||||
modifier = Modifier
|
||||
.hintAnchor(hintAnchor, fullScreen = true)
|
||||
.nestedScroll(scrollBehavior.nestedScrollConnection),
|
||||
) { paddingValues ->
|
||||
if (info.model.repositories == null) BigLoadingIndicator()
|
||||
else
|
||||
@@ -139,8 +141,8 @@ fun Repositories(info: RepositoryInfo, isBigScreen: Boolean, onBackClicked: () -
|
||||
|
||||
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES or UI_MODE_TYPE_NORMAL)
|
||||
@Composable
|
||||
fun RepositoriesScaffoldLoadingPreview() {
|
||||
HintHost {
|
||||
private fun RepositoriesScaffoldLoadingPreview() {
|
||||
HintOverlayContainer {
|
||||
FDroidContent {
|
||||
val model =
|
||||
RepositoryModel(
|
||||
@@ -158,7 +160,7 @@ fun RepositoriesScaffoldLoadingPreview() {
|
||||
@Composable
|
||||
@PreviewLightDark
|
||||
private fun RepositoriesScaffoldPreview() {
|
||||
HintHost {
|
||||
HintOverlayContainer {
|
||||
FDroidContent {
|
||||
val model =
|
||||
RepositoryModel(
|
||||
|
||||
@@ -29,8 +29,8 @@ import androidx.compose.ui.semantics.hideFromAccessibility
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import com.viktormykhailiv.compose.hints.HintProperties
|
||||
import com.viktormykhailiv.compose.hints.hintAnchor
|
||||
import com.viktormykhailiv.compose.hints.rememberHint
|
||||
import com.viktormykhailiv.compose.hints.rememberHintAnchorState
|
||||
import com.viktormykhailiv.compose.hints.rememberHintController
|
||||
@@ -39,11 +39,11 @@ import org.fdroid.repo.RepoUpdateWorker
|
||||
import org.fdroid.ui.FDroidContent
|
||||
import org.fdroid.ui.utils.BackButton
|
||||
import org.fdroid.ui.utils.BigLoadingIndicator
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
import org.fdroid.ui.utils.MeteredConnectionDialog
|
||||
import org.fdroid.ui.utils.OnboardingPopupCard
|
||||
import org.fdroid.ui.utils.TopAppBarButton
|
||||
import org.fdroid.ui.utils.TopAppBarOverflowButton
|
||||
import org.fdroid.ui.utils.getHintOverlayColor
|
||||
import org.fdroid.ui.utils.getRepoDetailsInfo
|
||||
|
||||
@Composable
|
||||
@@ -56,7 +56,7 @@ fun RepoDetails(
|
||||
val context = LocalContext.current
|
||||
val repo = info.model.repo
|
||||
|
||||
val hintController = rememberHintController(overlay = getHintOverlayColor())
|
||||
val hintController = rememberHintController()
|
||||
val hint =
|
||||
rememberHint(HintProperties(dismissOnClickOutside = false)) {
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
|
||||
@@ -147,7 +147,8 @@ fun RepoDetails(
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.hintAnchor(hintAnchor, fullScreen = true),
|
||||
) { paddingValues ->
|
||||
if (repo == null) BigLoadingIndicator()
|
||||
else
|
||||
@@ -161,6 +162,6 @@ fun RepoDetails(
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun RepoDetailsScreenPreview() {
|
||||
HintHost { FDroidContent { RepoDetails(getRepoDetailsInfo(), { _, _ -> }, {}) } }
|
||||
private fun RepoDetailsScreenPreview() {
|
||||
HintOverlayContainer { FDroidContent { RepoDetails(getRepoDetailsInfo(), { _, _ -> }, {}) } }
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import org.fdroid.R
|
||||
import org.fdroid.database.Repository
|
||||
import org.fdroid.repo.RepoUpdateProgress
|
||||
import org.fdroid.ui.FDroidContent
|
||||
import org.fdroid.ui.utils.ExpandableSection
|
||||
import org.fdroid.ui.utils.HintOverlayContainer
|
||||
import org.fdroid.ui.utils.getRepoDetailsInfo
|
||||
|
||||
@Composable
|
||||
@@ -105,5 +105,5 @@ private fun FingerprintExpandable(fingerprint: String) {
|
||||
@Composable
|
||||
@Preview
|
||||
private fun Preview() {
|
||||
HintHost { FDroidContent { RepoDetails(getRepoDetailsInfo(), { _, _ -> }, {}) } }
|
||||
HintOverlayContainer { FDroidContent { RepoDetails(getRepoDetailsInfo(), { _, _ -> }, {}) } }
|
||||
}
|
||||
|
||||
@@ -18,12 +18,20 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.createBitmap
|
||||
import com.google.zxing.BarcodeFormat
|
||||
import com.google.zxing.qrcode.QRCodeWriter
|
||||
import com.viktormykhailiv.compose.hints.HintHost
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.fdroid.database.Repository
|
||||
|
||||
@Composable
|
||||
fun getHintOverlayColor() = MaterialTheme.colorScheme.primary.copy(alpha = 0.8f)
|
||||
fun HintOverlayContainer(
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
HintHost(
|
||||
overlay = MaterialTheme.colorScheme.primary.copy(alpha = 0.8f),
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
||||
fun Context.startActivitySafe(i: Intent?) {
|
||||
if (i == null) return
|
||||
|
||||
@@ -22,7 +22,7 @@ glide = "5.0.7"
|
||||
glideCompose = "1.0.0-beta09"
|
||||
coilCompose = "3.4.0"
|
||||
molecule = "2.2.0"
|
||||
hints = "3.0.1"
|
||||
hints = "3.1.1"
|
||||
composePreference = "2.2.0"
|
||||
|
||||
androidxCoreKtx = "1.19.0"
|
||||
|
||||
@@ -4508,6 +4508,11 @@
|
||||
<sha256 value="529113a17684928edc2c56f60ebe9468241bd18133b45b53339f796c6ac63083" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.viktormykhailiv" name="compose-hints-android" version="3.1.1">
|
||||
<artifact name="hints-release.aar">
|
||||
<sha256 value="ee53af4c8ca2ef18779dcd5b4b59b2ccc389282f6212fc18bc21acf243ebd98e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="commons-beanutils" name="commons-beanutils" version="1.9.4">
|
||||
<artifact name="commons-beanutils-1.9.4.jar">
|
||||
<sha256 value="7d938c81789028045c08c065e94be75fc280527620d5bd62b519d5838532368a" origin="Generated by Gradle"/>
|
||||
|
||||
Reference in New Issue
Block a user