mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-24 11:52:13 +00:00
Update: Clean up and reorder composable components
This commit is contained in:
parent
7008dd91e7
commit
680c533228
@ -5,10 +5,10 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import com.machiav3lli.fdroid.R
|
import com.machiav3lli.fdroid.R
|
||||||
import com.machiav3lli.fdroid.entity.LinkType
|
import com.machiav3lli.fdroid.entity.LinkType
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.AntiFeaturesGrid
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.AntiFeaturesGrid
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.LinkItem
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.LinkItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.PermissionGrid
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.PermissionGrid
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.ReleaseItem
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.ReleaseItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
||||||
import com.machiav3lli.fdroid.ui.compose.utils.CustomChip
|
import com.machiav3lli.fdroid.ui.compose.utils.CustomChip
|
||||||
import com.machiav3lli.fdroid.utility.SampleData
|
import com.machiav3lli.fdroid.utility.SampleData
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.home.components
|
package com.machiav3lli.fdroid.ui.compose.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.animateColor
|
import androidx.compose.animation.animateColor
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import androidx.compose.foundation.horizontalScroll
|
import androidx.compose.foundation.horizontalScroll
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
@ -1,4 +1,4 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail.components
|
package com.machiav3lli.fdroid.ui.compose.components.appsheet
|
||||||
|
|
||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.animation.core.animateIntAsState
|
import androidx.compose.animation.core.animateIntAsState
|
@ -1,2 +0,0 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.app_detail
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.settings.components
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Slider
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun PreferenceSlider(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String,
|
|
||||||
steps: Int = 20,
|
|
||||||
valueRange: ClosedFloatingPointRange<Float> = 10f..200f,
|
|
||||||
value: () -> Float,
|
|
||||||
onChange: (Float) -> Unit
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.extraLarge)
|
|
||||||
.padding(16.dp),
|
|
||||||
verticalArrangement = Arrangement.SpaceBetween,
|
|
||||||
horizontalAlignment = Alignment.Start
|
|
||||||
) {
|
|
||||||
Text(text = title, style = MaterialTheme.typography.titleMedium)
|
|
||||||
Slider(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
value = value(),
|
|
||||||
valueRange = valueRange,
|
|
||||||
steps = steps,
|
|
||||||
onValueChange = onChange
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.settings.components
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Switch
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun PreferenceSwitch(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
switchTitle: String,
|
|
||||||
switchDescription: String,
|
|
||||||
checkedState: () -> Boolean,
|
|
||||||
onCheck: (Boolean) -> Unit
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.extraLarge)
|
|
||||||
.padding(16.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
horizontalAlignment = Alignment.Start,
|
|
||||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
|
||||||
) {
|
|
||||||
Text(text = switchTitle, style = MaterialTheme.typography.titleSmall)
|
|
||||||
Text(text = switchDescription, style = MaterialTheme.typography.bodyMedium)
|
|
||||||
}
|
|
||||||
Switch(checked = checkedState(), onCheckedChange = onCheck)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package com.machiav3lli.fdroid.ui.compose.pages.settings.components
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun PreferenceWithData(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String,
|
|
||||||
description: String,
|
|
||||||
onClick: () -> Unit
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.extraLarge)
|
|
||||||
.padding(16.dp),
|
|
||||||
verticalArrangement = Arrangement.SpaceBetween,
|
|
||||||
horizontalAlignment = Alignment.Start
|
|
||||||
) {
|
|
||||||
Text(text = title, style = MaterialTheme.typography.titleSmall)
|
|
||||||
Text(text = description, style = MaterialTheme.typography.bodyMedium)
|
|
||||||
}
|
|
||||||
}
|
|
@ -66,12 +66,12 @@ import com.machiav3lli.fdroid.ui.compose.components.ExpandableBlock
|
|||||||
import com.machiav3lli.fdroid.ui.compose.components.ScreenshotItem
|
import com.machiav3lli.fdroid.ui.compose.components.ScreenshotItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.components.ScreenshotList
|
import com.machiav3lli.fdroid.ui.compose.components.ScreenshotList
|
||||||
import com.machiav3lli.fdroid.ui.compose.components.SwitchPreference
|
import com.machiav3lli.fdroid.ui.compose.components.SwitchPreference
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.AppInfoHeader
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.AppInfoHeader
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.HtmlTextBlock
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.HtmlTextBlock
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.LinkItem
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.LinkItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.PermissionsItem
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.PermissionsItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.ReleaseItem
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.ReleaseItem
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.app_detail.components.TopBarHeader
|
import com.machiav3lli.fdroid.ui.compose.components.appsheet.TopBarHeader
|
||||||
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
||||||
import com.machiav3lli.fdroid.ui.compose.utils.Callbacks
|
import com.machiav3lli.fdroid.ui.compose.utils.Callbacks
|
||||||
import com.machiav3lli.fdroid.ui.viewmodels.AppViewModelX
|
import com.machiav3lli.fdroid.ui.viewmodels.AppViewModelX
|
||||||
|
@ -33,7 +33,7 @@ import com.machiav3lli.fdroid.ui.compose.ProductsVerticalRecycler
|
|||||||
import com.machiav3lli.fdroid.ui.compose.components.ExpandableSearchAction
|
import com.machiav3lli.fdroid.ui.compose.components.ExpandableSearchAction
|
||||||
import com.machiav3lli.fdroid.ui.compose.components.TopBar
|
import com.machiav3lli.fdroid.ui.compose.components.TopBar
|
||||||
import com.machiav3lli.fdroid.ui.compose.components.TopBarAction
|
import com.machiav3lli.fdroid.ui.compose.components.TopBarAction
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.home.components.CategoryChipList
|
import com.machiav3lli.fdroid.ui.compose.components.CategoryChipList
|
||||||
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
||||||
import com.machiav3lli.fdroid.utility.isDarkTheme
|
import com.machiav3lli.fdroid.utility.isDarkTheme
|
||||||
import com.machiav3lli.fdroid.utility.onLaunchClick
|
import com.machiav3lli.fdroid.utility.onLaunchClick
|
||||||
|
@ -19,7 +19,7 @@ import com.machiav3lli.fdroid.content.Preferences
|
|||||||
import com.machiav3lli.fdroid.entity.Section
|
import com.machiav3lli.fdroid.entity.Section
|
||||||
import com.machiav3lli.fdroid.ui.activities.MainActivityX
|
import com.machiav3lli.fdroid.ui.activities.MainActivityX
|
||||||
import com.machiav3lli.fdroid.ui.compose.ProductsVerticalRecycler
|
import com.machiav3lli.fdroid.ui.compose.ProductsVerticalRecycler
|
||||||
import com.machiav3lli.fdroid.ui.compose.pages.home.components.CategoryChipList
|
import com.machiav3lli.fdroid.ui.compose.components.CategoryChipList
|
||||||
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
import com.machiav3lli.fdroid.ui.compose.theme.AppTheme
|
||||||
import com.machiav3lli.fdroid.ui.viewmodels.MainNavFragmentViewModelX
|
import com.machiav3lli.fdroid.ui.viewmodels.MainNavFragmentViewModelX
|
||||||
import com.machiav3lli.fdroid.utility.isDarkTheme
|
import com.machiav3lli.fdroid.utility.isDarkTheme
|
||||||
|
Loading…
x
Reference in New Issue
Block a user