Add version on the landing screen.
This commit is contained in:
parent
395f54d086
commit
aaf4968be3
1 changed files with 17 additions and 4 deletions
|
|
@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.systemBarsPadding
|
import androidx.compose.foundation.layout.systemBarsPadding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
|
@ -34,6 +33,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.composed
|
import androidx.compose.ui.composed
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
|
@ -60,6 +60,7 @@ import com.pixelized.rplexicon.ui.navigation.screens.navigateToLocation
|
||||||
import com.pixelized.rplexicon.ui.navigation.screens.navigateToQuestList
|
import com.pixelized.rplexicon.ui.navigation.screens.navigateToQuestList
|
||||||
import com.pixelized.rplexicon.ui.navigation.screens.navigateToSearch
|
import com.pixelized.rplexicon.ui.navigation.screens.navigateToSearch
|
||||||
import com.pixelized.rplexicon.ui.navigation.screens.navigateToSummary
|
import com.pixelized.rplexicon.ui.navigation.screens.navigateToSummary
|
||||||
|
import com.pixelized.rplexicon.ui.screens.authentication.VersionViewModel
|
||||||
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.ADVENTURE
|
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.ADVENTURE
|
||||||
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.CHARACTER
|
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.CHARACTER
|
||||||
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.GAME_MASTER
|
import com.pixelized.rplexicon.ui.screens.landing.LandingItemUio.Feature.GAME_MASTER
|
||||||
|
|
@ -74,6 +75,7 @@ import com.pixelized.rplexicon.utilitary.extentions.modifier.scrollOffset
|
||||||
@Composable
|
@Composable
|
||||||
fun LandingScreen(
|
fun LandingScreen(
|
||||||
viewModel: LandingViewModel = hiltViewModel(),
|
viewModel: LandingViewModel = hiltViewModel(),
|
||||||
|
versionVM: VersionViewModel = hiltViewModel(),
|
||||||
) {
|
) {
|
||||||
val screen = LocalScreenNavHost.current
|
val screen = LocalScreenNavHost.current
|
||||||
|
|
||||||
|
|
@ -93,6 +95,7 @@ fun LandingScreen(
|
||||||
characters = viewModel.characterSheets,
|
characters = viewModel.characterSheets,
|
||||||
tools = viewModel.toolFeatures,
|
tools = viewModel.toolFeatures,
|
||||||
encyclopedia = viewModel.lexiconFeatures,
|
encyclopedia = viewModel.lexiconFeatures,
|
||||||
|
version = versionVM.version,
|
||||||
onFeature = {
|
onFeature = {
|
||||||
when (it.feature) {
|
when (it.feature) {
|
||||||
CHARACTER -> it.title?.let { name ->
|
CHARACTER -> it.title?.let { name ->
|
||||||
|
|
@ -133,7 +136,6 @@ fun LandingScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun LandingContent(
|
private fun LandingContent(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|
@ -148,6 +150,7 @@ private fun LandingContent(
|
||||||
characters: State<List<List<LandingItemUio>>>,
|
characters: State<List<List<LandingItemUio>>>,
|
||||||
tools: State<List<List<LandingItemUio>>>,
|
tools: State<List<List<LandingItemUio>>>,
|
||||||
encyclopedia: State<List<List<LandingItemUio>>>,
|
encyclopedia: State<List<List<LandingItemUio>>>,
|
||||||
|
version: VersionViewModel.Version,
|
||||||
onFeature: (LandingItemUio) -> Unit,
|
onFeature: (LandingItemUio) -> Unit,
|
||||||
) {
|
) {
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
|
|
@ -330,6 +333,15 @@ private fun LandingContent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(alignment = Alignment.End)
|
||||||
|
.padding(top = 32.dp),
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
fontStyle = FontStyle.Italic,
|
||||||
|
text = version.toText(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -371,8 +383,8 @@ private fun Modifier.magic(): Modifier = composed {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Preview(uiMode = UI_MODE_NIGHT_NO, heightDp = 1300)
|
@Preview(uiMode = UI_MODE_NIGHT_NO, heightDp = 1332)
|
||||||
@Preview(uiMode = UI_MODE_NIGHT_YES, heightDp = 1300)
|
@Preview(uiMode = UI_MODE_NIGHT_YES, heightDp = 1332)
|
||||||
private fun LandingPreview() {
|
private fun LandingPreview() {
|
||||||
LexiconTheme {
|
LexiconTheme {
|
||||||
Surface {
|
Surface {
|
||||||
|
|
@ -472,6 +484,7 @@ private fun LandingPreview() {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
version = VersionViewModel.Version(R.string.app_name, "0.0.0", "0", true),
|
||||||
onFeature = { },
|
onFeature = { },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue