compose: Expose modifier for root composables
This will allow adapting them as needed from different screens Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package com.aurora.store.compose.composables
|
package com.aurora.store.compose.composables
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -24,6 +23,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display sticky header in list
|
* Composable to display sticky header in list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param title Title to display
|
* @param title Title to display
|
||||||
* @param actionTitle Title for the action button
|
* @param actionTitle Title for the action button
|
||||||
* @param onAction Callback when action button is clicked
|
* @param onAction Callback when action button is clicked
|
||||||
@@ -32,12 +32,13 @@ import com.aurora.store.R
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ActionHeaderComposable(
|
fun ActionHeaderComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
title: String,
|
title: String,
|
||||||
actionTitle: String,
|
actionTitle: String,
|
||||||
onAction: () -> Unit = {}
|
onAction: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = dimensionResource(R.dimen.padding_medium),
|
horizontal = dimensionResource(R.dimen.padding_medium),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for displaying package details in a list for blacklisting
|
* Composable for displaying package details in a list for blacklisting
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param icon Icon for the package
|
* @param icon Icon for the package
|
||||||
* @param displayName User-readable name of the package
|
* @param displayName User-readable name of the package
|
||||||
* @param packageName Name of the package
|
* @param packageName Name of the package
|
||||||
@@ -46,6 +47,7 @@ import com.aurora.store.R
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun BlackListComposable(
|
fun BlackListComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
icon: Bitmap,
|
icon: Bitmap,
|
||||||
displayName: String,
|
displayName: String,
|
||||||
packageName: String,
|
packageName: String,
|
||||||
@@ -56,7 +58,7 @@ fun BlackListComposable(
|
|||||||
onClick: () -> Unit = {}
|
onClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(enabled = isEnabled, onClick = onClick)
|
.clickable(enabled = isEnabled, onClick = onClick)
|
||||||
.padding(
|
.padding(
|
||||||
|
|||||||
@@ -32,13 +32,18 @@ import com.aurora.store.compose.composables.preview.coilPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show a category in a list
|
* 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 category [Category] details to display
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun CategoryComposable(category: Category, onClick: () -> Unit = {}) {
|
fun CategoryComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
category: Category,
|
||||||
|
onClick: () -> Unit = {}
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display device details for spoofing in a list
|
* 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 userReadableName Name of the device, obtained through `UserReadableName` property
|
||||||
* @param manufacturer Name of the device manufacturer, obtained through `Build.MANUFACTURER` 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 androidVersionSdk Android version on the device, obtained through `Build.VERSION.SDK_INT` property
|
||||||
@@ -34,6 +35,7 @@ import com.aurora.store.R
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun DeviceComposable(
|
fun DeviceComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
userReadableName: String,
|
userReadableName: String,
|
||||||
manufacturer: String,
|
manufacturer: String,
|
||||||
androidVersionSdk: String,
|
androidVersionSdk: String,
|
||||||
@@ -42,7 +44,7 @@ fun DeviceComposable(
|
|||||||
onClick: () -> Unit = {}
|
onClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -26,14 +26,20 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display dispenser URL in a list
|
* 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 url URL of the dispenser
|
||||||
* @param onClick Callback when this URL is clicked
|
* @param onClick Callback when this URL is clicked
|
||||||
* @param onClear Callback when the clear button is clicked
|
* @param onClear Callback when the clear button is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun DispenserComposable(url: String, onClick: () -> Unit = {}, onClear: () -> Unit = {}) {
|
fun DispenserComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
url: String,
|
||||||
|
onClick: () -> Unit = {},
|
||||||
|
onClear: () -> Unit = {}
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package com.aurora.store.compose.composables
|
package com.aurora.store.compose.composables
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -44,19 +43,20 @@ import com.aurora.store.util.CommonUtil.getETAString
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display details of a download in a list
|
* Composable to display details of a download in a list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param download [Download] to display
|
* @param download [Download] to display
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
* @param onLongClick Callback when this composable is long clicked
|
* @param onLongClick Callback when this composable is long clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
fun DownloadComposable(
|
fun DownloadComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
download: Download,
|
download: Download,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
onLongClick: (() -> Unit) = {}
|
onLongClick: (() -> Unit) = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.combinedClickable(onClick = onClick, onLongClick = onLongClick)
|
.combinedClickable(onClick = onClick, onLongClick = onLongClick)
|
||||||
.padding(
|
.padding(
|
||||||
|
|||||||
@@ -45,18 +45,20 @@ import com.aurora.store.data.room.favourite.Favourite
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display a favourite app in a list
|
* Composable to display a favourite app in a list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param favourite A [Favourite] app to display
|
* @param favourite A [Favourite] app to display
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
* @param onClear Callback when the favourite button is clicked to remove the app from favourites
|
* @param onClear Callback when the favourite button is clicked to remove the app from favourites
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun FavouriteComposable(
|
fun FavouriteComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
favourite: Favourite,
|
favourite: Favourite,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
onClear: () -> Unit = {}
|
onClear: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(
|
.padding(
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display sticky header in list
|
* Composable to display sticky header in list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param title Title to display
|
* @param title Title to display
|
||||||
* @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
|
||||||
@@ -35,9 +36,14 @@ import com.aurora.store.R
|
|||||||
* @see ActionHeaderComposable
|
* @see ActionHeaderComposable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun HeaderComposable(title: String, subtitle: String? = null, onClick: (() -> Unit)? = null) {
|
fun HeaderComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null,
|
||||||
|
onClick: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(RoundedCornerShape(dimensionResource(R.dimen.radius_small)))
|
.clip(RoundedCornerShape(dimensionResource(R.dimen.radius_small)))
|
||||||
.clickable(onClick = { if (onClick != null) onClick() }, enabled = onClick != null)
|
.clickable(onClick = { if (onClick != null) onClick() }, enabled = onClick != null)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import com.aurora.store.compose.composables.preview.AppPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show some information
|
* Composable to show some information
|
||||||
* @param modifier Modifier to change the composable
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param title Title of the information
|
* @param title Title of the information
|
||||||
* @param description Information to show
|
* @param description Information to show
|
||||||
* @param icon Optional icon representing the information
|
* @param icon Optional icon representing the information
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ package com.aurora.store.compose.composables
|
|||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -33,6 +32,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for displaying installed package details in a list
|
* 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 icon Icon for the package
|
||||||
* @param displayName User-readable name of the package
|
* @param displayName User-readable name of the package
|
||||||
* @param packageName Name of the package
|
* @param packageName Name of the package
|
||||||
@@ -42,8 +42,8 @@ import com.aurora.store.R
|
|||||||
* @param onLongClick Callback whe composable is long clicked
|
* @param onLongClick Callback whe composable is long clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
fun InstalledAppComposable(
|
fun InstalledAppComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
icon: Bitmap,
|
icon: Bitmap,
|
||||||
displayName: String,
|
displayName: String,
|
||||||
packageName: String,
|
packageName: String,
|
||||||
@@ -53,7 +53,7 @@ fun InstalledAppComposable(
|
|||||||
onLongClick: () -> Unit = {}
|
onLongClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.combinedClickable(onClick = onClick, onLongClick = onLongClick)
|
.combinedClickable(onClick = onClick, onLongClick = onLongClick)
|
||||||
.padding(
|
.padding(
|
||||||
|
|||||||
@@ -27,18 +27,20 @@ import com.aurora.store.data.model.InstallerInfo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display installer details in a list
|
* 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 installerInfo A [InstallerInfo] object to display details
|
||||||
* @param isSelected Whether this installer is selected
|
* @param isSelected Whether this installer is selected
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun InstallerComposable(
|
fun InstallerComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
installerInfo: InstallerInfo,
|
installerInfo: InstallerInfo,
|
||||||
isSelected: Boolean = false,
|
isSelected: Boolean = false,
|
||||||
onClick: () -> Unit = {}
|
onClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ import com.aurora.store.data.model.Link
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show link details in a list
|
* Composable to show link details in a list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param link [Link] to show details
|
* @param link [Link] to show details
|
||||||
* @param onClick Callback when the composable is clicked
|
* @param onClick Callback when the composable is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun LinkComposable(link: Link, onClick: () -> Unit = {}) {
|
fun LinkComposable(modifier: Modifier = Modifier, link: Link, onClick: () -> Unit = {}) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.Locale
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display locale details in a list
|
* 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 displayName Display name of the locale
|
||||||
* @param displayLanguage Display name of the language in the locale
|
* @param displayLanguage Display name of the language in the locale
|
||||||
* @param isChecked Whether the locale is checked/selected
|
* @param isChecked Whether the locale is checked/selected
|
||||||
@@ -32,13 +33,14 @@ import java.util.Locale
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun LocaleComposable(
|
fun LocaleComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
displayName: String,
|
displayName: String,
|
||||||
displayLanguage: String,
|
displayLanguage: String,
|
||||||
isChecked: Boolean = false,
|
isChecked: Boolean = false,
|
||||||
onClick: () -> Unit = {}
|
onClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
|
|||||||
@@ -27,18 +27,20 @@ import com.aurora.store.data.model.PermissionType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display permission details in a list
|
* Composable to display permission details in a list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param permission [Permission] to display
|
* @param permission [Permission] to display
|
||||||
* @param isGranted If the permission has been granted
|
* @param isGranted If the permission has been granted
|
||||||
* @param onAction Callback when the user clicks the action button
|
* @param onAction Callback when the user clicks the action button
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun PermissionComposable(
|
fun PermissionComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
permission: Permission,
|
permission: Permission,
|
||||||
isGranted: Boolean = false,
|
isGranted: Boolean = false,
|
||||||
onAction: () -> Unit = {}
|
onAction: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(dimensionResource(R.dimen.padding_small)),
|
.padding(dimensionResource(R.dimen.padding_small)),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A top app bar composable to be used with Scaffold in different Screen
|
* A top app bar composable to be used with Scaffold in different Screen
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param searchHint Hint to show to the user in search bar
|
* @param searchHint Hint to show to the user in search bar
|
||||||
* @param onNavigateUp Action when user clicks the navigation icon
|
* @param onNavigateUp Action when user clicks the navigation icon
|
||||||
* @param onSearch Callback for a search
|
* @param onSearch Callback for a search
|
||||||
@@ -43,6 +44,7 @@ import com.aurora.store.R
|
|||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
fun SearchAppBarComposable(
|
fun SearchAppBarComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
@StringRes searchHint: Int? = null,
|
@StringRes searchHint: Int? = null,
|
||||||
onNavigateUp: () -> Unit,
|
onNavigateUp: () -> Unit,
|
||||||
onSearch: (query: String) -> Unit,
|
onSearch: (query: String) -> Unit,
|
||||||
@@ -52,6 +54,7 @@ fun SearchAppBarComposable(
|
|||||||
var query by rememberSaveable { mutableStateOf("") }
|
var query by rememberSaveable { mutableStateOf("") }
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
modifier = modifier,
|
||||||
title = {
|
title = {
|
||||||
TextField(
|
TextField(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
|||||||
@@ -32,18 +32,20 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for displaying search suggestions in a list
|
* Composable for displaying search suggestions in a list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param searchSuggestEntry A [SearchSuggestEntry] to display search suggestion
|
* @param searchSuggestEntry A [SearchSuggestEntry] to display search suggestion
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
* @param onAction Callback when action button is clicked
|
* @param onAction Callback when action button is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchSuggestionComposable(
|
fun SearchSuggestionComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
searchSuggestEntry: SearchSuggestEntry,
|
searchSuggestEntry: SearchSuggestEntry,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
onAction: () -> Unit = {}
|
onAction: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_medium)),
|
.padding(dimensionResource(R.dimen.padding_medium)),
|
||||||
|
|||||||
@@ -21,14 +21,15 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display a sticky header in a list
|
* Composable to display a sticky header in a list
|
||||||
|
* @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
|
* @see ActionHeaderComposable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun TextDividerComposable(@StringRes title: Int) {
|
fun TextDividerComposable(modifier: Modifier = Modifier, @StringRes title: Int) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(dimensionResource(R.dimen.padding_small))
|
.padding(dimensionResource(R.dimen.padding_small))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
@@ -21,6 +22,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A top app bar composable to be used with Scaffold in different Screen
|
* A top app bar composable to be used with Scaffold in different Screen
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param title Title of the screen
|
* @param title Title of the screen
|
||||||
* @param navigationIcon Icon for the navigation button
|
* @param navigationIcon Icon for the navigation button
|
||||||
* @param onNavigateUp Action when user clicks the navigation icon
|
* @param onNavigateUp Action when user clicks the navigation icon
|
||||||
@@ -29,12 +31,14 @@ import com.aurora.store.R
|
|||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
fun TopAppBarComposable(
|
fun TopAppBarComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
navigationIcon: ImageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
navigationIcon: ImageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||||
onNavigateUp: (() -> Unit)? = null,
|
onNavigateUp: (() -> Unit)? = null,
|
||||||
actions: @Composable (RowScope.() -> Unit) = {}
|
actions: @Composable (RowScope.() -> Unit) = {}
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
modifier = modifier,
|
||||||
title = { if (title != null) Text(text = title) },
|
title = { if (title != null) Text(text = title) },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (onNavigateUp != null) {
|
if (onNavigateUp != null) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package com.aurora.store.compose.composables
|
|||||||
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
@@ -16,10 +17,12 @@ import com.aurora.store.R
|
|||||||
*
|
*
|
||||||
* This is useful for occupying spaces in composable where alignment is not respected such as
|
* This is useful for occupying spaces in composable where alignment is not respected such as
|
||||||
* DropDownMenu.
|
* DropDownMenu.
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun TransparentIconComposable() {
|
fun TransparentIconComposable(modifier: Modifier = Modifier) {
|
||||||
Icon(
|
Icon(
|
||||||
|
modifier = modifier,
|
||||||
painter = painterResource(R.drawable.ic_transparent),
|
painter = painterResource(R.drawable.ic_transparent),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import com.aurora.store.compose.composables.preview.coilPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show icon for an app that can be animated to also show install progress
|
* Composable to show icon for an app that can be animated to also show install progress
|
||||||
* @param modifier Modifier to alter the composable
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param iconUrl URL of the app icon
|
* @param iconUrl URL of the app icon
|
||||||
* @param progress Progress to show, for e.g. download or install
|
* @param progress Progress to show, for e.g. download or install
|
||||||
* @param inProgress Whether to show indeterminate or determinate progress bar
|
* @param inProgress Whether to show indeterminate or determinate progress bar
|
||||||
|
|||||||
@@ -37,16 +37,17 @@ import com.aurora.store.compose.composables.preview.coilPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for displaying minimal app details in a horizontal-scrollable list
|
* Composable for displaying minimal app details in a horizontal-scrollable list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param app [App] to display
|
* @param app [App] to display
|
||||||
* @param onClick Callback when the composable is clicked
|
* @param onClick Callback when the composable is clicked
|
||||||
* @see AppListComposable
|
* @see AppListComposable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun AppComposable(app: App, onClick: () -> Unit = {}) {
|
fun AppComposable(modifier: Modifier = Modifier, app: App, onClick: () -> Unit = {}) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.width(dimensionResource(R.dimen.icon_size_cluster))
|
.width(dimensionResource(R.dimen.icon_size_cluster))
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(dimensionResource(R.dimen.padding_xsmall))
|
.padding(dimensionResource(R.dimen.padding_xsmall))
|
||||||
|
|||||||
@@ -40,14 +40,15 @@ import com.aurora.store.util.CommonUtil
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for displaying minimal app details in a vertical-scrollable list
|
* Composable for displaying minimal app details in a vertical-scrollable list
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param app [App] to display
|
* @param app [App] to display
|
||||||
* @param onClick Callback when the composable is clicked
|
* @param onClick Callback when the composable is clicked
|
||||||
* @see AppComposable
|
* @see AppComposable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun AppListComposable(app: App, onClick: () -> Unit = {}) {
|
fun AppListComposable(modifier: Modifier = Modifier, app: App, onClick: () -> Unit = {}) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(
|
.padding(
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display an indeterminate circular progress indicator
|
* Composable to display an indeterminate circular progress indicator
|
||||||
* @param modifier Modifier for the composable
|
* @param modifier The modifier to be applied to the composable
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun AppProgressComposable(modifier: Modifier = Modifier) {
|
fun AppProgressComposable(modifier: Modifier = Modifier) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import androidx.compose.material3.Icon
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
@@ -21,13 +22,20 @@ import com.aurora.store.compose.composables.preview.AppPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show a tag related to an app
|
* Composable to show a tag related to an app
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param label Label of the tag
|
* @param label Label of the tag
|
||||||
* @param icon Icon of the tag
|
* @param icon Icon of the tag
|
||||||
* @param onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun AppTagComposable(label: String, @DrawableRes icon: Int, onClick: () -> Unit = {}) {
|
fun AppTagComposable(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
label: String,
|
||||||
|
@DrawableRes icon: Int,
|
||||||
|
onClick: () -> Unit = {}
|
||||||
|
) {
|
||||||
FilterChip(
|
FilterChip(
|
||||||
|
modifier = modifier,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
label = { Text(text = label, style = MaterialTheme.typography.bodySmall) },
|
label = { Text(text = label, style = MaterialTheme.typography.bodySmall) },
|
||||||
leadingIcon = { Icon(painter = painterResource(icon), contentDescription = label) },
|
leadingIcon = { Icon(painter = painterResource(icon), contentDescription = label) },
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show error message when no apps are available for a request
|
* Composable to show error message when no apps are available for a request
|
||||||
* @param modifier Modifier for the composable
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param icon Drawable for error
|
* @param icon Drawable for error
|
||||||
* @param message Message for error
|
* @param message Message for error
|
||||||
* @param actionMessage Message to show on action button; defaults to null with button not visible
|
* @param actionMessage Message to show on action button; defaults to null with button not visible
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ import com.aurora.store.data.model.ExodusTracker
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display details about a tracker reported by Exodus Privacy
|
* Composable to display details about a tracker reported by Exodus Privacy
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param tracker Tracker to display details about
|
* @param tracker Tracker to display details about
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ExodusComposable(tracker: ExodusTracker) {
|
fun ExodusComposable(modifier: Modifier = Modifier, tracker: ExodusTracker) {
|
||||||
Column(modifier = Modifier.padding(dimensionResource(R.dimen.padding_small))) {
|
Column(modifier = modifier.padding(dimensionResource(R.dimen.padding_small))) {
|
||||||
Text(
|
Text(
|
||||||
text = tracker.name,
|
text = tracker.name,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
|||||||
@@ -23,13 +23,14 @@ import com.aurora.store.R
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to show a progress bar with rating for an app
|
* Composable to show a progress bar with rating for an app
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param label Label of the rating, for e.g. 5
|
* @param label Label of the rating, for e.g. 5
|
||||||
* @param rating Current rating, for e.g. 0.3
|
* @param rating Current rating, for e.g. 0.3
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun RatingComposable(label: String, rating: Float) {
|
fun RatingComposable(modifier: Modifier = Modifier, label: String, rating: Float) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = dimensionResource(R.dimen.padding_small)),
|
.padding(horizontal = dimensionResource(R.dimen.padding_small)),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|||||||
@@ -37,12 +37,13 @@ import com.aurora.store.compose.composables.preview.coilPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for viewing a review about an app
|
* Composable for viewing a review about an app
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param review [Review] about an app
|
* @param review [Review] about an app
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ReviewComposable(review: Review) {
|
fun ReviewComposable(modifier: Modifier = Modifier, review: Review) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = dimensionResource(R.dimen.padding_medium),
|
horizontal = dimensionResource(R.dimen.padding_medium),
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import com.aurora.store.compose.composables.preview.coilPreviewProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable to display a screenshot of an app
|
* Composable to display a screenshot of an app
|
||||||
|
* @param modifier The modifier to be applied to the composable
|
||||||
* @param url URL of the screenshot
|
* @param url URL of the screenshot
|
||||||
* @param modifier Modifier for the composable
|
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ScreenshotComposable(modifier: Modifier = Modifier, url: String) {
|
fun ScreenshotComposable(modifier: Modifier = Modifier, url: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user