mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-21 03:00:54 -05:00
create basic about page
This commit is contained in:
@@ -464,6 +464,11 @@ class MainActivity : MonetCompatActivity() {
|
|||||||
doSignInPartTwo = deepLink == NavConstants.AUTH_REDIRECT_PAGE
|
doSignInPartTwo = deepLink == NavConstants.AUTH_REDIRECT_PAGE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
composable(
|
||||||
|
route = MainNavItem.AboutView.route
|
||||||
|
) {
|
||||||
|
AboutView(appNavController = appNavController)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
import androidx.compose.foundation.layout.wrapContentHeight
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.outlined.Info
|
||||||
import androidx.compose.material.icons.outlined.Login
|
import androidx.compose.material.icons.outlined.Login
|
||||||
import androidx.compose.material.icons.outlined.Logout
|
import androidx.compose.material.icons.outlined.Logout
|
||||||
import androidx.compose.material.icons.outlined.Person
|
import androidx.compose.material.icons.outlined.Person
|
||||||
@@ -155,6 +156,22 @@ fun ProfileMenuOverlay(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileMenuItem(
|
||||||
|
onClick = {
|
||||||
|
onDismissRequest()
|
||||||
|
appNavController.navigate(MainNavItem.AboutView.route)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Info,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.nav_about_title),
|
||||||
|
fontSize = 16.sp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
MenuDivider()
|
MenuDivider()
|
||||||
|
|
||||||
ProfileMenuItem(
|
ProfileMenuItem(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ sealed class MainNavItem(val route: String) {
|
|||||||
object SettingsView: MainNavItem("settings_route")
|
object SettingsView: MainNavItem("settings_route")
|
||||||
object SearchView: MainNavItem("search_route")
|
object SearchView: MainNavItem("search_route")
|
||||||
object WebLinkView: MainNavItem("web_link_route")
|
object WebLinkView: MainNavItem("web_link_route")
|
||||||
|
|
||||||
object AccountView: MainNavItem("account_route")
|
object AccountView: MainNavItem("account_route")
|
||||||
|
object AboutView: MainNavItem("about_route")
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
package com.owenlejeune.tvtime.ui.screens.main
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.provider.Settings
|
||||||
|
import androidx.compose.animation.rememberSplineBasedDecay
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
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.wrapContentHeight
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
|
import androidx.compose.material.icons.filled.Drafts
|
||||||
|
import androidx.compose.material.icons.outlined.Description
|
||||||
|
import androidx.compose.material.icons.outlined.Drafts
|
||||||
|
import androidx.compose.material.icons.outlined.FileCopy
|
||||||
|
import androidx.compose.material.icons.outlined.Info
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.LargeTopAppBar
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberTopAppBarScrollState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.navigation.NavController
|
||||||
|
import com.owenlejeune.tvtime.BuildConfig
|
||||||
|
import com.owenlejeune.tvtime.R
|
||||||
|
import com.owenlejeune.tvtime.ui.navigation.MainNavItem
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun AboutView(
|
||||||
|
appNavController: NavController
|
||||||
|
) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
val decayAnimationSpec = rememberSplineBasedDecay<Float>()
|
||||||
|
val topAppBarScrollState = rememberTopAppBarScrollState()
|
||||||
|
val scrollBehavior = remember(decayAnimationSpec) {
|
||||||
|
TopAppBarDefaults.exitUntilCollapsedScrollBehavior(decayAnimationSpec, topAppBarScrollState)
|
||||||
|
}
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier.nestedScroll(connection = scrollBehavior.nestedScrollConnection),
|
||||||
|
topBar = {
|
||||||
|
LargeTopAppBar(
|
||||||
|
title = { Text(text = stringResource(id = R.string.nav_about_title)) },
|
||||||
|
navigationIcon = {
|
||||||
|
IconButton(
|
||||||
|
onClick = { appNavController.popBackStack() }
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.ArrowBack,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Box(modifier = Modifier.padding(it)) {
|
||||||
|
Column(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(24.dp),
|
||||||
|
modifier = Modifier.padding(horizontal = 24.dp)
|
||||||
|
) {
|
||||||
|
AboutItem(
|
||||||
|
title = "App Info",
|
||||||
|
subtitle = "v${BuildConfig.VERSION_NAME}",
|
||||||
|
icon = Icons.Outlined.Info,
|
||||||
|
onClick = {
|
||||||
|
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
||||||
|
val uri = Uri.fromParts("package", context.packageName, null)
|
||||||
|
data = uri
|
||||||
|
}
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
AboutItem(
|
||||||
|
title = "Changelog",
|
||||||
|
icon = Icons.Outlined.Description
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AboutItem(
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null,
|
||||||
|
icon: ImageVector,
|
||||||
|
onClick: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.wrapContentHeight()
|
||||||
|
.clickable(
|
||||||
|
onClick = onClick ?: {},
|
||||||
|
enabled = onClick != null
|
||||||
|
),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(24.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = icon,
|
||||||
|
contentDescription = subtitle,
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically),
|
||||||
|
tint = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.CenterVertically)
|
||||||
|
.weight(1f)
|
||||||
|
) {
|
||||||
|
val titleColor = MaterialTheme.colorScheme.onBackground
|
||||||
|
val subtitleColor = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
Text(text = title, style = MaterialTheme.typography.titleLarge, color = titleColor, fontSize = 20.sp)
|
||||||
|
subtitle?.let {
|
||||||
|
Text(text = subtitle, style = MaterialTheme.typography.bodyMedium, color = subtitleColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
app/src/main/res/raw/changelog.md
Normal file
0
app/src/main/res/raw/changelog.md
Normal file
@@ -23,6 +23,7 @@
|
|||||||
<string name="nav_movie_watchlist_title">Movie Watchlist</string>
|
<string name="nav_movie_watchlist_title">Movie Watchlist</string>
|
||||||
<string name="nav_tv_watchlist_title">TV Watchlist</string>
|
<string name="nav_tv_watchlist_title">TV Watchlist</string>
|
||||||
<string name="nav_user_lists_title">Lists</string>
|
<string name="nav_user_lists_title">Lists</string>
|
||||||
|
<string name="nav_about_title">About</string>
|
||||||
|
|
||||||
<!-- Headings -->
|
<!-- Headings -->
|
||||||
<string name="cast_label">Cast</string>
|
<string name="cast_label">Cast</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user