compose: Drop unused composables
We will re-import them as we migrate those from epoxy to compose Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.Button
|
|
||||||
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.res.dimensionResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.aurora.store.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to display sticky header in list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param title Title to display
|
|
||||||
* @param actionTitle Title for the action button
|
|
||||||
* @param onAction Callback when action button is clicked
|
|
||||||
* @see TextDividerComposable
|
|
||||||
* @see HeaderComposable
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun ActionHeaderComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String,
|
|
||||||
actionTitle: String,
|
|
||||||
onAction: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(
|
|
||||||
horizontal = dimensionResource(R.dimen.padding_medium),
|
|
||||||
vertical = dimensionResource(R.dimen.padding_xsmall)
|
|
||||||
),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Button(onClick = onAction) {
|
|
||||||
Text(
|
|
||||||
text = actionTitle,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun ActionHeaderComposablePreview() {
|
|
||||||
ActionHeaderComposable(
|
|
||||||
title = stringResource(R.string.updates_available),
|
|
||||||
actionTitle = stringResource(R.string.action_update_all)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.requiredSize
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.layout.ContentScale
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import coil3.compose.AsyncImage
|
|
||||||
import coil3.compose.LocalAsyncImagePreviewHandler
|
|
||||||
import coil3.request.ImageRequest
|
|
||||||
import coil3.request.crossfade
|
|
||||||
import com.aurora.gplayapi.data.models.Category
|
|
||||||
import com.aurora.store.R
|
|
||||||
import com.aurora.store.compose.preview.coilPreviewProvider
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to show a category in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param category [Category] details to display
|
|
||||||
* @param onClick Callback when this composable is clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun CategoryComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
category: Category,
|
|
||||||
onClick: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
|
||||||
) {
|
|
||||||
AsyncImage(
|
|
||||||
model = ImageRequest.Builder(LocalContext.current)
|
|
||||||
.data(category.imageUrl)
|
|
||||||
.crossfade(true)
|
|
||||||
.build(),
|
|
||||||
contentDescription = null,
|
|
||||||
contentScale = ContentScale.Crop,
|
|
||||||
modifier = Modifier.requiredSize(dimensionResource(R.dimen.icon_size_default))
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = category.title,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun CategoryComposablePreview() {
|
|
||||||
CompositionLocalProvider(LocalAsyncImagePreviewHandler provides coilPreviewProvider) {
|
|
||||||
CategoryComposable(category = Category(title = "Art & Design"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
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.Checkbox
|
|
||||||
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.platform.LocalContext
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.aurora.store.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to display device details for spoofing in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param userReadableName Name of the device, obtained through `UserReadableName` property
|
|
||||||
* @param manufacturer Name of the device manufacturer, obtained through `Build.MANUFACTURER` property
|
|
||||||
* @param androidVersionSdk Android version on the device, obtained through `Build.VERSION.SDK_INT` property
|
|
||||||
* @param platforms Platforms supported on the device, obtained through `Platforms` property
|
|
||||||
* @param isChecked If the device is selected
|
|
||||||
* @param onClick Callback when the composable is clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun DeviceComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
userReadableName: String,
|
|
||||||
manufacturer: String,
|
|
||||||
androidVersionSdk: String,
|
|
||||||
platforms: String,
|
|
||||||
isChecked: Boolean = false,
|
|
||||||
onClick: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Column(modifier = Modifier.weight(1F)) {
|
|
||||||
Text(
|
|
||||||
text = userReadableName,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = LocalContext.current.getString(
|
|
||||||
R.string.spoof_property,
|
|
||||||
manufacturer,
|
|
||||||
androidVersionSdk
|
|
||||||
),
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = platforms,
|
|
||||||
style = MaterialTheme.typography.bodySmall
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Checkbox(checked = isChecked, enabled = !isChecked, onCheckedChange = { onClick() })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun DeviceComposablePreview() {
|
|
||||||
DeviceComposable(
|
|
||||||
userReadableName = "Google Pixel 7a",
|
|
||||||
manufacturer = "Google",
|
|
||||||
androidVersionSdk = "33",
|
|
||||||
platforms = "arm64-v8a",
|
|
||||||
isChecked = true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextButton
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.aurora.store.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to display dispenser URL in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param url URL of the dispenser
|
|
||||||
* @param onClick Callback when this URL is clicked
|
|
||||||
* @param onClear Callback when the clear button is clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun DispenserComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
url: String,
|
|
||||||
onClick: () -> Unit = {},
|
|
||||||
onClear: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.weight(1F),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_small))
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(R.drawable.ic_server),
|
|
||||||
contentDescription = null
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = url,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
TextButton(onClick = onClear) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.remove),
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun DispenserComposablePreview() {
|
|
||||||
DispenserComposable(url = "https://auroraoss.com/api/auth")
|
|
||||||
}
|
|
||||||
@@ -33,7 +33,6 @@ import com.aurora.store.R
|
|||||||
* @param subtitle Optional subtitle to display
|
* @param subtitle Optional subtitle to display
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
* @see TextDividerComposable
|
* @see TextDividerComposable
|
||||||
* @see ActionHeaderComposable
|
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun HeaderComposable(
|
fun HeaderComposable(
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.graphics.Color
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.combinedClickable
|
|
||||||
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.foundation.layout.requiredSize
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
|
||||||
import androidx.core.graphics.drawable.toDrawable
|
|
||||||
import com.aurora.store.BuildConfig
|
|
||||||
import com.aurora.store.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable for displaying installed package details in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param icon Icon for the package
|
|
||||||
* @param displayName User-readable name of the package
|
|
||||||
* @param packageName Name of the package
|
|
||||||
* @param versionName versionName of the package
|
|
||||||
* @param versionCode versionCode of the package
|
|
||||||
* @param onClick Callback when the composable is clicked
|
|
||||||
* @param onLongClick Callback whe composable is long clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun InstalledAppComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
icon: Bitmap,
|
|
||||||
displayName: String,
|
|
||||||
packageName: String,
|
|
||||||
versionName: String,
|
|
||||||
versionCode: Long,
|
|
||||||
onClick: () -> Unit = {},
|
|
||||||
onLongClick: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.combinedClickable(onClick = onClick, onLongClick = onLongClick)
|
|
||||||
.padding(
|
|
||||||
horizontal = dimensionResource(R.dimen.padding_medium),
|
|
||||||
vertical = dimensionResource(R.dimen.padding_xsmall)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Row {
|
|
||||||
Image(
|
|
||||||
bitmap = icon.asImageBitmap(),
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier.requiredSize(dimensionResource(R.dimen.icon_size_medium))
|
|
||||||
)
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small)),
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = displayName,
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = packageName,
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.version, versionName, versionCode),
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun InstalledAppComposablePreview() {
|
|
||||||
InstalledAppComposable(
|
|
||||||
icon = Color.GRAY.toDrawable().toBitmap(56, 56),
|
|
||||||
displayName = LocalContext.current.getString(R.string.app_name),
|
|
||||||
packageName = BuildConfig.APPLICATION_ID,
|
|
||||||
versionName = BuildConfig.VERSION_NAME,
|
|
||||||
versionCode = BuildConfig.VERSION_CODE.toLong()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
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.RadioButton
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.aurora.store.R
|
|
||||||
import com.aurora.store.data.installer.SessionInstaller
|
|
||||||
import com.aurora.store.data.model.InstallerInfo
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to display installer details in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param installerInfo A [InstallerInfo] object to display details
|
|
||||||
* @param isSelected Whether this installer is selected
|
|
||||||
* @param onClick Callback when this composable is clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun InstallerComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
installerInfo: InstallerInfo,
|
|
||||||
isSelected: Boolean = false,
|
|
||||||
onClick: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Column(modifier = Modifier.weight(1F)) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(installerInfo.title),
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = stringResource(installerInfo.subtitle),
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = stringResource(installerInfo.description),
|
|
||||||
style = MaterialTheme.typography.bodySmall
|
|
||||||
)
|
|
||||||
}
|
|
||||||
RadioButton(selected = isSelected, onClick = onClick)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun InstallerComposablePreview() {
|
|
||||||
InstallerComposable(installerInfo = SessionInstaller.installerInfo, isSelected = true)
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.aurora.store.compose.composables
|
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
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.Checkbox
|
|
||||||
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.res.dimensionResource
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import com.aurora.store.R
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Composable to display locale details in a list
|
|
||||||
* @param modifier The modifier to be applied to the composable
|
|
||||||
* @param displayName Display name of the locale
|
|
||||||
* @param displayLanguage Display name of the language in the locale
|
|
||||||
* @param isChecked Whether the locale is checked/selected
|
|
||||||
* @param onClick Callback when the composable is clicked
|
|
||||||
*/
|
|
||||||
@Composable
|
|
||||||
fun LocaleComposable(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
displayName: String,
|
|
||||||
displayLanguage: String,
|
|
||||||
isChecked: Boolean = false,
|
|
||||||
onClick: () -> Unit = {}
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable(onClick = onClick)
|
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Column(modifier = Modifier.weight(1F)) {
|
|
||||||
Text(
|
|
||||||
text = displayName,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = displayLanguage,
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Checkbox(checked = isChecked, enabled = !isChecked, onCheckedChange = { onClick() })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
private fun LocaleComposablePreview() {
|
|
||||||
LocaleComposable(
|
|
||||||
displayName = Locale.JAPANESE.displayName,
|
|
||||||
displayLanguage = Locale.JAPAN.getDisplayLanguage(Locale.JAPAN),
|
|
||||||
isChecked = true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@ import com.aurora.store.R
|
|||||||
* @param modifier The modifier to be applied to the composable
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param title Title to display
|
* @param title Title to display
|
||||||
* @see HeaderComposable
|
* @see HeaderComposable
|
||||||
* @see ActionHeaderComposable
|
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun TextDividerComposable(modifier: Modifier = Modifier, title: String) {
|
fun TextDividerComposable(modifier: Modifier = Modifier, title: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user