mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
update to material3 for compose
This commit is contained in:
parent
74c283eb8a
commit
01a156c4b0
41 changed files with 183 additions and 174 deletions
|
|
@ -105,19 +105,17 @@ dependencies {
|
|||
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
|
||||
implementation "androidx.fragment:fragment-ktx:1.6.2"
|
||||
implementation "androidx.fragment:fragment-ktx:1.7.0"
|
||||
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
|
||||
implementation "androidx.paging:paging-compose:$paging_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
implementation "com.google.accompanist:accompanist-themeadapter-material:$accompanist_version"
|
||||
implementation "androidx.compose.material3:material3:1.2.1"
|
||||
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
|
||||
implementation 'com.google.android.play:core:1.10.3'
|
||||
|
||||
implementation 'androidx.activity:activity-compose:1.9.0'
|
||||
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
|
||||
implementation "androidx.compose.material:material:$compose_version"
|
||||
implementation "androidx.compose.animation:animation:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-text-google-fonts:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ import com.habitrpg.common.habitica.helpers.launchCatching
|
|||
import kotlinx.coroutines.MainScope
|
||||
import java.util.Date
|
||||
|
||||
class AppConfigManager(contentRepository: ContentRepository?) :
|
||||
class AppConfigManager(contentRepository: ContentRepository) :
|
||||
com.habitrpg.common.habitica.helpers.AppConfigManager() {
|
||||
private var worldState: WorldState? = null
|
||||
|
||||
init {
|
||||
try {
|
||||
MainScope().launchCatching {
|
||||
contentRepository?.getWorldState()?.collect {
|
||||
contentRepository.getWorldState().collect {
|
||||
worldState = it
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ class AppConfigManager(contentRepository: ContentRepository?) :
|
|||
}
|
||||
|
||||
fun enableCustomizationShop(): Boolean {
|
||||
if (BuildConfig.DEBUG) return false
|
||||
if (BuildConfig.DEBUG) return true
|
||||
return remoteConfig.getBoolean("enableCustomizationShop")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class AppModule {
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun providesRemoteConfigManager(contentRepository: ContentRepository?): AppConfigManager {
|
||||
fun providesRemoteConfigManager(contentRepository: ContentRepository): AppConfigManager {
|
||||
return AppConfigManager(contentRepository)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,16 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.DrawerState
|
||||
import androidx.compose.material.DrawerValue
|
||||
import androidx.compose.material.Scaffold
|
||||
import androidx.compose.material.ScaffoldState
|
||||
import androidx.compose.material.SnackbarHostState
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.rememberScaffoldState
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DrawerState
|
||||
import androidx.compose.material3.DrawerValue
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.ScaffoldState
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.rememberScaffoldState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
|
|
|
|||
|
|
@ -273,6 +273,16 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
|
||||
val shop = getItemWithIdentifier(SIDEBAR_SHOPS_SEASONAL) ?: return
|
||||
shop.subtitle = gearEvent?.end?.getRemainingString(requireContext().resources)
|
||||
if (!configManager.enableCustomizationShop()) {
|
||||
shop.pillText = context?.getString(R.string.open)
|
||||
if (gearEvent?.isCurrentlyActive == true) {
|
||||
shop.isVisible = true
|
||||
shop.subtitle =
|
||||
context?.getString(R.string.open_for, gearEvent.end?.getShortRemainingString())
|
||||
} else {
|
||||
shop.isVisible = false
|
||||
}
|
||||
}
|
||||
adapter.updateItem(shop)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Switch
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextField
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.pullrefresh.pullRefresh
|
||||
import androidx.compose.material.pullrefresh.rememberPullRefreshState
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterialApi
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.pullrefresh.pullRefresh
|
||||
import androidx.compose.material3.pullrefresh.rememberPullRefreshState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import androidx.compose.foundation.layout.requiredSize
|
|||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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
|
||||
|
|
@ -49,6 +49,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.os.bundleOf
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.data.ContentRepository
|
||||
import com.habitrpg.android.habitica.helpers.AppConfigManager
|
||||
import com.habitrpg.android.habitica.models.TeamPlan
|
||||
import com.habitrpg.android.habitica.models.auth.LocalAuthentication
|
||||
|
|
@ -116,7 +117,7 @@ fun AppHeaderView(
|
|||
onAvatarClicked: (() -> Unit)? = null,
|
||||
onMemberRowClicked: () -> Unit,
|
||||
onClassSelectionClicked: () -> Unit,
|
||||
configManager: AppConfigManager,
|
||||
configManager: AppConfigManager? = null,
|
||||
) {
|
||||
val isPlayerOptedOutOfClass = user?.preferences?.disableClasses ?: false
|
||||
Column(modifier) {
|
||||
|
|
@ -191,7 +192,7 @@ fun AppHeaderView(
|
|||
} else if (user?.hasClass == false && isMyProfile && !isPlayerOptedOutOfClass) {
|
||||
HabiticaButton(
|
||||
background = HabiticaTheme.colors.basicButtonColor(),
|
||||
color = MaterialTheme.colors.onPrimary,
|
||||
color = MaterialTheme.colorScheme.onPrimary,
|
||||
onClick = {
|
||||
onClassSelectionClicked()
|
||||
},
|
||||
|
|
@ -431,8 +432,7 @@ private fun Preview(
|
|||
.background(HabiticaTheme.colors.contentBackground)
|
||||
.padding(8.dp),
|
||||
onMemberRowClicked = { },
|
||||
onClassSelectionClicked = { },
|
||||
configManager = AppConfigManager(null),
|
||||
onClassSelectionClicked = { }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.ModalBottomSheetLayout
|
||||
import androidx.compose.material.ModalBottomSheetValue
|
||||
import androidx.compose.material.rememberModalBottomSheetState
|
||||
import androidx.compose.material3.BottomSheetScaffoldState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.SheetState
|
||||
import androidx.compose.material3.SheetValue
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
|
|
@ -37,13 +39,13 @@ import kotlinx.coroutines.launch
|
|||
|
||||
// Extension for Activity
|
||||
fun Activity.showAsBottomSheet(content: @Composable (() -> Unit) -> Unit) {
|
||||
val viewGroup = this.findViewById(android.R.id.content) as ViewGroup
|
||||
val viewGroup: ViewGroup = this.findViewById(android.R.id.content)
|
||||
addContentToView(viewGroup, content)
|
||||
}
|
||||
|
||||
// Extension for Fragment
|
||||
fun Fragment.showAsBottomSheet(content: @Composable (() -> Unit) -> Unit) {
|
||||
val viewGroup = requireActivity().findViewById(android.R.id.content) as ViewGroup
|
||||
val viewGroup: ViewGroup = requireActivity().findViewById(android.R.id.content)
|
||||
addContentToView(viewGroup, content)
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +65,7 @@ private fun addContentToView(
|
|||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun BottomSheetWrapper(
|
||||
parent: ViewGroup,
|
||||
|
|
@ -72,7 +74,7 @@ private fun BottomSheetWrapper(
|
|||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val modalBottomSheetState =
|
||||
rememberModalBottomSheetState(ModalBottomSheetValue.Hidden, skipHalfExpanded = true)
|
||||
rememberModalBottomSheetState(skipPartiallyExpanded = true)
|
||||
var isSheetOpened by remember { mutableStateOf(false) }
|
||||
|
||||
val systemUiController = rememberSystemUiController()
|
||||
|
|
@ -83,12 +85,13 @@ private fun BottomSheetWrapper(
|
|||
}
|
||||
|
||||
val radius = 20.dp
|
||||
ModalBottomSheetLayout(
|
||||
sheetBackgroundColor = Color.Transparent,
|
||||
ModalBottomSheet(
|
||||
{},
|
||||
containerColor = Color.Transparent,
|
||||
scrimColor = colorResource(R.color.content_background).copy(alpha = 0.5f),
|
||||
sheetState = modalBottomSheetState,
|
||||
sheetShape = RoundedCornerShape(topStart = radius, topEnd = radius),
|
||||
sheetContent = {
|
||||
shape = RoundedCornerShape(topStart = radius, topEnd = radius),
|
||||
content = {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier =
|
||||
|
|
@ -115,7 +118,7 @@ private fun BottomSheetWrapper(
|
|||
}
|
||||
}
|
||||
},
|
||||
) {}
|
||||
)
|
||||
|
||||
BackHandler {
|
||||
coroutineScope.launch {
|
||||
|
|
@ -126,7 +129,7 @@ private fun BottomSheetWrapper(
|
|||
// Take action based on hidden state
|
||||
LaunchedEffect(modalBottomSheetState.currentValue) {
|
||||
when (modalBottomSheetState.currentValue) {
|
||||
ModalBottomSheetValue.Hidden -> {
|
||||
SheetValue.Hidden -> {
|
||||
when {
|
||||
isSheetOpened -> {
|
||||
systemUiController.setStatusBarColor(statusBarColor, darkIcons = false)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.habitrpg.android.habitica.ui.views
|
|||
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import android.text.format.DateUtils
|
|||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import androidx.compose.animation.core.animateFloatAsState
|
|||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.ProgressIndicatorDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.ProgressIndicatorDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.height
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -77,7 +77,7 @@ fun GroupPlanMemberList(
|
|||
member,
|
||||
role,
|
||||
onMemberClicked,
|
||||
configManager,
|
||||
configManager = configManager,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp),
|
||||
)
|
||||
}
|
||||
|
|
@ -90,8 +90,8 @@ fun MemberItem(
|
|||
member: Member,
|
||||
role: String,
|
||||
onMemberClicked: (String) -> Unit,
|
||||
configManager: AppConfigManager,
|
||||
modifier: Modifier = Modifier,
|
||||
configManager: AppConfigManager? = null,
|
||||
) {
|
||||
Box(
|
||||
modifier
|
||||
|
|
@ -232,5 +232,5 @@ private class MemberProvider : PreviewParameterProvider<Member> {
|
|||
private fun Preview(
|
||||
@PreviewParameter(MemberProvider::class) member: Member,
|
||||
) {
|
||||
MemberItem(member = member, role = "Manager", onMemberClicked = {}, AppConfigManager(null))
|
||||
MemberItem(member = member, role = "Manager", onMemberClicked = {})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import androidx.compose.foundation.layout.Box
|
|||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.ProvideTextStyle
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import androidx.compose.foundation.layout.height
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.LinearProgressIndicator
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonColors
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.ButtonElevation
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.ProvideTextStyle
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ButtonElevation
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
|
@ -76,7 +76,7 @@ fun LoadingButton(
|
|||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
type: LoadingButtonType = LoadingButtonType.NORMAL,
|
||||
elevation: ButtonElevation? = ButtonDefaults.elevation(0.dp),
|
||||
elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
|
||||
shape: Shape = MaterialTheme.shapes.medium,
|
||||
border: BorderStroke? = null,
|
||||
colors: ButtonColors? = null,
|
||||
|
|
@ -88,16 +88,16 @@ fun LoadingButton(
|
|||
val colorStyle =
|
||||
if (type == LoadingButtonType.DESTRUCTIVE) {
|
||||
ButtonDefaults.buttonColors(
|
||||
backgroundColor = HabiticaTheme.colors.errorBackground,
|
||||
containerColor = HabiticaTheme.colors.errorBackground,
|
||||
contentColor = Color.White,
|
||||
disabledBackgroundColor = HabiticaTheme.colors.offsetBackground,
|
||||
disabledContainerColor = HabiticaTheme.colors.offsetBackground,
|
||||
disabledContentColor = HabiticaTheme.colors.textQuad,
|
||||
)
|
||||
} else {
|
||||
ButtonDefaults.buttonColors(
|
||||
backgroundColor = HabiticaTheme.colors.tintedUiSub,
|
||||
containerColor = HabiticaTheme.colors.tintedUiSub,
|
||||
contentColor = Color.White,
|
||||
disabledBackgroundColor = HabiticaTheme.colors.offsetBackground,
|
||||
disabledContainerColor = HabiticaTheme.colors.offsetBackground,
|
||||
disabledContentColor = HabiticaTheme.colors.textQuad,
|
||||
)
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ fun LoadingButton(
|
|||
when (state) {
|
||||
LoadingButtonState.FAILED -> HabiticaTheme.colors.errorBackground
|
||||
LoadingButtonState.SUCCESS -> Color.Transparent
|
||||
else -> colorStyle.backgroundColor(enabled = state != LoadingButtonState.DISABLED).value
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.disabledContainerColor else colorStyle.containerColor
|
||||
},
|
||||
animationSpec = colorSpec,
|
||||
)
|
||||
|
|
@ -118,7 +118,7 @@ fun LoadingButton(
|
|||
when (state) {
|
||||
LoadingButtonState.FAILED -> Color.White
|
||||
LoadingButtonState.SUCCESS -> if (type == LoadingButtonType.DESTRUCTIVE) HabiticaTheme.colors.errorColor else HabiticaTheme.colors.successColor
|
||||
else -> colorStyle.contentColor(enabled = state != LoadingButtonState.DISABLED).value
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.disabledContentColor else colorStyle.disabledContainerColor
|
||||
},
|
||||
animationSpec = colorSpec,
|
||||
)
|
||||
|
|
@ -134,9 +134,9 @@ fun LoadingButton(
|
|||
|
||||
val buttonColors =
|
||||
ButtonDefaults.buttonColors(
|
||||
backgroundColor = backgroundColor.value,
|
||||
containerColor = backgroundColor.value,
|
||||
contentColor = contentColor.value,
|
||||
disabledBackgroundColor = backgroundColor.value,
|
||||
disabledContainerColor = backgroundColor.value,
|
||||
disabledContentColor = contentColor.value,
|
||||
)
|
||||
Button(
|
||||
|
|
@ -235,9 +235,9 @@ private fun Preview() {
|
|||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier =
|
||||
Modifier
|
||||
.width(200.dp)
|
||||
.padding(8.dp),
|
||||
Modifier
|
||||
.width(200.dp)
|
||||
.padding(8.dp),
|
||||
) {
|
||||
LoadingButton(state, {
|
||||
scope.launch {
|
||||
|
|
@ -263,7 +263,7 @@ private fun Preview() {
|
|||
{},
|
||||
colors =
|
||||
ButtonDefaults.buttonColors(
|
||||
backgroundColor = HabiticaTheme.colors.successBackground,
|
||||
containerColor = HabiticaTheme.colors.successBackground,
|
||||
contentColor = Color.White,
|
||||
),
|
||||
content = {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import androidx.compose.foundation.layout.offset
|
|||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
@ -39,7 +39,7 @@ fun SegmentedControl(
|
|||
onItemSelection: (selectedItemIndex: Int) -> Unit,
|
||||
) {
|
||||
val selectedIndex = remember { mutableIntStateOf(defaultSelectedItemIndex) }
|
||||
val color = MaterialTheme.colors.primary
|
||||
val color = MaterialTheme.colorScheme.primary
|
||||
Row(
|
||||
modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -52,12 +52,12 @@ fun SegmentedControl(
|
|||
Modifier
|
||||
.width(itemWidth)
|
||||
.offset(0.dp, 0.dp)
|
||||
.zIndex(if (selectedIndex.value == 0) 1f else 0f)
|
||||
.zIndex(if (selectedIndex.intValue == 0) 1f else 0f)
|
||||
} else {
|
||||
Modifier
|
||||
.wrapContentSize()
|
||||
.offset(0.dp, 0.dp)
|
||||
.zIndex(if (selectedIndex.value == 0) 1f else 0f)
|
||||
.zIndex(if (selectedIndex.intValue == 0) 1f else 0f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,18 +66,18 @@ fun SegmentedControl(
|
|||
Modifier
|
||||
.width(itemWidth)
|
||||
.offset((-1 * index).dp, 0.dp)
|
||||
.zIndex(if (selectedIndex.value == index) 1f else 0f)
|
||||
.zIndex(if (selectedIndex.intValue == index) 1f else 0f)
|
||||
} else {
|
||||
Modifier
|
||||
.wrapContentSize()
|
||||
.offset((-1 * index).dp, 0.dp)
|
||||
.zIndex(if (selectedIndex.value == index) 1f else 0f)
|
||||
.zIndex(if (selectedIndex.intValue == index) 1f else 0f)
|
||||
}
|
||||
}
|
||||
},
|
||||
onClick = {
|
||||
selectedIndex.value = index
|
||||
onItemSelection(selectedIndex.value)
|
||||
selectedIndex.intValue = index
|
||||
onItemSelection(selectedIndex.intValue)
|
||||
},
|
||||
shape =
|
||||
when (index) {
|
||||
|
|
@ -115,32 +115,32 @@ fun SegmentedControl(
|
|||
border =
|
||||
BorderStroke(
|
||||
1.dp,
|
||||
if (selectedIndex.value == index) {
|
||||
if (selectedIndex.intValue == index) {
|
||||
color
|
||||
} else {
|
||||
color.copy(alpha = 0.75f)
|
||||
},
|
||||
),
|
||||
colors =
|
||||
if (selectedIndex.value == index) {
|
||||
if (selectedIndex.intValue == index) {
|
||||
/**
|
||||
* selected colors
|
||||
*/
|
||||
ButtonDefaults.outlinedButtonColors(
|
||||
backgroundColor = color,
|
||||
containerColor = color,
|
||||
)
|
||||
} else {
|
||||
/**
|
||||
* not selected colors
|
||||
*/
|
||||
ButtonDefaults.outlinedButtonColors(backgroundColor = Color.Transparent)
|
||||
ButtonDefaults.outlinedButtonColors(containerColor = Color.Transparent)
|
||||
},
|
||||
) {
|
||||
Text(
|
||||
text = item,
|
||||
fontWeight = FontWeight.Normal,
|
||||
color =
|
||||
if (selectedIndex.value == index) {
|
||||
if (selectedIndex.intValue == index) {
|
||||
Color.White
|
||||
} else {
|
||||
color.copy(alpha = 0.9f)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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
|
||||
|
|
@ -62,7 +62,7 @@ fun UserRow(
|
|||
"@$username",
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = color ?: MaterialTheme.colors.primary,
|
||||
color = color ?: MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
if (extraContent != null) {
|
||||
extraContent()
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import android.widget.TextView
|
|||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material.ProvideTextStyle
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.habitrpg.android.habitica.ui.views.preferences
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.material.pullrefresh.PullRefreshState
|
||||
import androidx.compose.material.pullrefresh.pullRefresh
|
||||
import androidx.compose.material.pullrefresh.pullRefreshIndicatorTransform
|
||||
import androidx.compose.material.pullrefresh.rememberPullRefreshState
|
||||
import androidx.compose.material3.ExperimentalMaterialApi
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.pullrefresh.PullRefreshState
|
||||
import androidx.compose.material3.pullrefresh.pullRefresh
|
||||
import androidx.compose.material3.pullrefresh.pullRefreshIndicatorTransform
|
||||
import androidx.compose.material3.pullrefresh.rememberPullRefreshState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import androidx.compose.foundation.layout.height
|
|||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ class PurchaseDialog(
|
|||
private var purchaseCardAction: ((ShopItem) -> Unit)? = null
|
||||
var onShopNeedsRefresh: ((ShopItem) -> Unit)? = null
|
||||
|
||||
private var gemsLeft = 0
|
||||
|
||||
private var shopItem: ShopItem = item
|
||||
set(value) {
|
||||
field = value
|
||||
|
|
@ -307,7 +309,7 @@ class PurchaseDialog(
|
|||
|
||||
if ("gems" == shopItem.purchaseType) {
|
||||
val maxGems = user.purchased?.plan?.totalNumberOfGems ?: 0
|
||||
val gemsLeft = user.purchased?.plan?.numberOfGemsLeft
|
||||
gemsLeft = user.purchased?.plan?.numberOfGemsLeft ?: 0
|
||||
if (maxGems > 0) {
|
||||
limitedTextView.text = context.getString(R.string.gems_left_max, gemsLeft, maxGems)
|
||||
} else {
|
||||
|
|
@ -347,8 +349,7 @@ class PurchaseDialog(
|
|||
|
||||
private fun onBuyButtonClicked() {
|
||||
if (shopItem.isValid && !shopItem.locked) {
|
||||
val gemsLeft = if (shopItem.limitedNumberLeft != null) shopItem.limitedNumberLeft else 0
|
||||
if ((gemsLeft == 0 && shopItem.purchaseType == "gems") || shopItem.canAfford(user, purchaseQuantity)) {
|
||||
if ((gemsLeft > 0 && shopItem.purchaseType == "gems") || shopItem.canAfford(user, purchaseQuantity)) {
|
||||
MainScope().launch(Dispatchers.Main) {
|
||||
remainingPurchaseQuantity { quantity ->
|
||||
if (quantity >= 0) {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.material.ProvideTextStyle
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -54,7 +54,7 @@ fun PartySeekingListItem(
|
|||
isInvited: Boolean = false,
|
||||
showHeader: Boolean = false,
|
||||
showExtendedInfo: Boolean = true,
|
||||
configManager: AppConfigManager,
|
||||
configManager: AppConfigManager? = null,
|
||||
onInvite: (Member) -> Unit,
|
||||
) {
|
||||
Column(
|
||||
|
|
@ -214,5 +214,5 @@ private class MemberProvider : PreviewParameterProvider<Member> {
|
|||
private fun Preview(
|
||||
@PreviewParameter(MemberProvider::class) data: Member,
|
||||
) {
|
||||
PartySeekingListItem(user = data, onInvite = {}, configManager = AppConfigManager(null))
|
||||
PartySeekingListItem(user = data, onInvite = {})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import androidx.compose.foundation.layout.height
|
|||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ import androidx.compose.foundation.layout.offset
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.LinearProgressIndicator
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
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
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ import androidx.compose.foundation.layout.heightIn
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import androidx.compose.foundation.layout.heightIn
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
|
|||
10
build.gradle
10
build.gradle
|
|
@ -10,18 +10,18 @@ buildscript {
|
|||
app_version_name = ''
|
||||
app_version_code = 0
|
||||
|
||||
accompanist_version = '0.28.0'
|
||||
accompanist_version = '0.30.0'
|
||||
amplitude_version = '1.6.1'
|
||||
appcompat_version = '1.6.1'
|
||||
coil_version = '2.4.0'
|
||||
compose_version = '1.6.6'
|
||||
compose_version = '1.6.7'
|
||||
compose_compiler = '1.5.12'
|
||||
core_ktx_version = '1.13.0'
|
||||
core_ktx_version = '1.13.1'
|
||||
coroutines_version = '1.7.3'
|
||||
daggerhilt_version = '2.51.1'
|
||||
firebase_bom = '31.3.0'
|
||||
kotest_version = '5.6.2'
|
||||
kotlin_version = '1.9.23'
|
||||
kotlin_version = '1.9.24'
|
||||
ktlint_version = '1.2.1'
|
||||
lifecycle_version = '2.7.0'
|
||||
markwon_version = '4.6.2'
|
||||
|
|
@ -47,7 +47,7 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:4.4.1'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.1'
|
||||
classpath "io.realm:realm-gradle-plugin:10.13.2-transformer-api"
|
||||
classpath("io.realm.kotlin:gradle-plugin:$realm_version")
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ dependencies {
|
|||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation("androidx.navigation:navigation-common-ktx:$navigation_version")
|
||||
implementation("androidx.navigation:navigation-runtime-ktx:$navigation_version")
|
||||
implementation("com.google.android.material:material:1.11.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
|
||||
testImplementation("io.mockk:mockk:$mockk_version")
|
||||
testImplementation("io.mockk:mockk-android:$mockk_version")
|
||||
|
|
@ -134,14 +134,13 @@ dependencies {
|
|||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
|
||||
|
||||
implementation("androidx.activity:activity-compose:1.8.2")
|
||||
implementation("androidx.activity:activity-compose:1.9.0")
|
||||
implementation("androidx.compose.runtime:runtime-livedata:$compose_version")
|
||||
implementation("androidx.compose.material:material:$compose_version")
|
||||
implementation("androidx.compose.animation:animation:$compose_version")
|
||||
implementation("androidx.compose.ui:ui-text-google-fonts:$compose_version")
|
||||
implementation("androidx.compose.ui:ui-tooling:$compose_version")
|
||||
implementation("androidx.compose.material3:material3:1.2.0")
|
||||
implementation("com.google.accompanist:accompanist-themeadapter-material:$accompanist_version")
|
||||
implementation("androidx.compose.material3:material3:1.2.1")
|
||||
implementation("com.google.accompanist:accompanist-themeadapter-material3:$accompanist_version")
|
||||
|
||||
implementation(project(":shared"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
package com.habitrpg.common.habitica.theme
|
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Shapes
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Shapes
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.google.accompanist.themeadapter.material.createMdcTheme
|
||||
import com.google.accompanist.themeadapter.material3.createMdc3Theme
|
||||
|
||||
@Composable
|
||||
fun HabiticaTheme(
|
||||
|
|
@ -22,65 +21,64 @@ fun HabiticaTheme(
|
|||
val context = LocalContext.current
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
val (colors, _, _) =
|
||||
createMdcTheme(
|
||||
createMdc3Theme(
|
||||
context = context,
|
||||
layoutDirection = layoutDirection,
|
||||
setTextColors = true,
|
||||
)
|
||||
MaterialTheme(
|
||||
colors = colors ?: MaterialTheme.colors,
|
||||
colorScheme = colors ?: MaterialTheme.colorScheme,
|
||||
typography =
|
||||
Typography(
|
||||
defaultFontFamily = FontFamily.Default,
|
||||
h1 =
|
||||
displayLarge =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 20.sp,
|
||||
letterSpacing = (0.05).sp,
|
||||
),
|
||||
h2 =
|
||||
displayMedium =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
letterSpacing = (0.05).sp,
|
||||
),
|
||||
subtitle1 =
|
||||
titleLarge =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 16.sp,
|
||||
),
|
||||
subtitle2 =
|
||||
titleMedium =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
body1 =
|
||||
bodyLarge =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 0.35.sp,
|
||||
lineHeight = 16.sp,
|
||||
),
|
||||
body2 =
|
||||
bodyMedium =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 0.2.sp,
|
||||
lineHeight = 16.sp,
|
||||
),
|
||||
button =
|
||||
labelMedium =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 1.25.sp,
|
||||
),
|
||||
caption =
|
||||
labelSmall =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 12.sp,
|
||||
),
|
||||
overline =
|
||||
titleSmall =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 10.sp,
|
||||
|
|
@ -98,7 +96,7 @@ fun HabiticaTheme(
|
|||
}
|
||||
|
||||
val Typography.caption1
|
||||
get() = caption
|
||||
get() = labelMedium
|
||||
val Typography.caption2
|
||||
get() =
|
||||
TextStyle(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.habitrpg.shared.habitica.models.Avatar
|
|||
@Composable
|
||||
fun ComposableAvatarView(
|
||||
avatar: Avatar?,
|
||||
configManager: AppConfigManager,
|
||||
configManager: AppConfigManager?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
AndroidView(
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
NAME=4.3.7
|
||||
CODE=7671
|
||||
CODE=7701
|
||||
Loading…
Reference in a new issue