mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 11:22:12 +00:00
Update: Replace source code text with icon (closes #318)
This commit is contained in:
parent
4973c1d2aa
commit
9fdc297407
@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ShapeDefaults
|
||||
@ -25,13 +26,17 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import com.google.accompanist.flowlayout.MainAxisAlignment
|
||||
import com.machiav3lli.fdroid.R
|
||||
import com.machiav3lli.fdroid.entity.ActionState
|
||||
import com.machiav3lli.fdroid.entity.DownloadState
|
||||
import com.machiav3lli.fdroid.ui.compose.components.MainActionButton
|
||||
import com.machiav3lli.fdroid.ui.compose.components.SecondaryActionButton
|
||||
import com.machiav3lli.fdroid.ui.compose.icons.Phosphor
|
||||
import com.machiav3lli.fdroid.ui.compose.icons.phosphor.Code
|
||||
import com.machiav3lli.fdroid.ui.compose.utils.NetworkImage
|
||||
import com.machiav3lli.fdroid.utility.extension.text.formatSize
|
||||
|
||||
@ -137,8 +142,6 @@ fun TopBarHeader(
|
||||
@Composable
|
||||
fun SourceCodeCard(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
text: String,
|
||||
onClick: () -> Unit = {},
|
||||
onLongClick: () -> Unit = {}
|
||||
) {
|
||||
@ -150,23 +153,12 @@ fun SourceCodeCard(
|
||||
.padding(vertical = 18.dp, horizontal = 12.dp),
|
||||
color = Color.Transparent
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.SpaceEvenly,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1
|
||||
Icon(
|
||||
modifier = Modifier.size(32.dp),
|
||||
imageVector = Phosphor.Code,
|
||||
contentDescription = stringResource(id = R.string.source_code),
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
Text(
|
||||
text = text,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
maxLines = 1
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,6 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
|
||||
// TODO clean up and replace dropped functions from AppDetailFragment
|
||||
class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
|
||||
@ -410,7 +408,6 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
|
||||
|
||||
suggestedProductRepo?.let { (product, repo) ->
|
||||
Scaffold(
|
||||
// TODO add the topBar to the activity instead of the fragments
|
||||
topBar = {
|
||||
Column() {
|
||||
TopBarHeader(
|
||||
@ -421,16 +418,6 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
|
||||
actions = {
|
||||
SourceCodeCard(
|
||||
modifier = Modifier.padding(vertical = 4.dp),
|
||||
title = stringResource(id = R.string.source_code),
|
||||
text = "@${
|
||||
(URI(product.source).host ?: stringResource(id = R.string.unknown))
|
||||
.removePrefix("www.")
|
||||
.replaceFirstChar {
|
||||
if (it.isLowerCase()) it.titlecase(
|
||||
Locale.getDefault()
|
||||
) else it.toString()
|
||||
}
|
||||
}",
|
||||
onClick = {
|
||||
product.source.let { link ->
|
||||
if (link.isNotEmpty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user