Skip to content

Commit

Permalink
update: show app version
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Jul 22, 2024
1 parent e32d568 commit 70764f2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.muedsa.jcytv.ui.features.home.main

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -15,12 +21,17 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.muedsa.compose.tv.model.ContentModel
import com.muedsa.compose.tv.theme.ImageCardRowCardPadding
import com.muedsa.compose.tv.theme.ScreenPaddingLeft
Expand All @@ -33,6 +44,7 @@ import com.muedsa.compose.tv.widget.ImmersiveList
import com.muedsa.compose.tv.widget.LoadingScreen
import com.muedsa.compose.tv.widget.ScreenBackgroundType
import com.muedsa.compose.tv.widget.StandardImageCardsRow
import com.muedsa.jcytv.BuildConfig
import com.muedsa.jcytv.ui.VideoPosterSize
import com.muedsa.jcytv.ui.features.home.useLocalHomeScreenBackgroundState
import com.muedsa.jcytv.ui.nav.NavigationItems
Expand Down Expand Up @@ -76,8 +88,7 @@ fun MainScreen(
val homeRows = homeRowsLD.data!!
LazyColumn(
modifier = Modifier
.offset(x = ScreenPaddingLeft - ImageCardRowCardPadding),
contentPadding = PaddingValues(bottom = 100.dp)
.padding(start = ScreenPaddingLeft - ImageCardRowCardPadding)
) {
item {
var title by remember { mutableStateOf("") }
Expand Down Expand Up @@ -166,6 +177,23 @@ fun MainScreen(
)
}
}

item {
Box(modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
) {
Text(
modifier = Modifier
.padding(top = 16.dp)
.align(Alignment.CenterEnd)
.graphicsLayer { alpha = 0.6f },
text = "APP版本: ${BuildConfig.BUILD_TYPE}-${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})",
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.labelSmall
)
}
}
}
} else if (homeRowsLD.type == LazyType.LOADING) {
LoadingScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Add
import androidx.compose.material.icons.outlined.Remove
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
Expand All @@ -31,6 +32,7 @@ import androidx.tv.material3.Text
import com.muedsa.compose.tv.theme.surfaceContainer
import com.muedsa.compose.tv.useLocalErrorMsgBoxController
import com.muedsa.compose.tv.widget.FocusScaleSwitch
import com.muedsa.jcytv.BuildConfig
import com.muedsa.jcytv.viewmodel.AppSettingViewModel
import com.muedsa.model.LazyType

Expand Down Expand Up @@ -244,6 +246,28 @@ fun AppSettingScreen(
}
)
}

HorizontalDivider()

Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 20.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "APP版本",
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium
)
Text(
text = "${BuildConfig.VERSION_NAME}(${BuildConfig.VERSION_CODE})",
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.titleMedium
)
}

}
}
}
Expand Down

0 comments on commit 70764f2

Please sign in to comment.