Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme rework #62

Merged
merged 21 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e499404
Product detail animation added for portrait size
UmairKhalid786 May 26, 2023
f811674
Basic player integrated from detail screen
UmairKhalid786 May 26, 2023
44b43f8
Controls preview added
UmairKhalid786 May 26, 2023
ef40bf3
Video title and Description added
UmairKhalid786 May 26, 2023
cf13dc8
Controls animation updated expand
UmairKhalid786 May 26, 2023
689f494
Login button migrated to tv material api
UmairKhalid786 Jun 14, 2023
a664fbd
Theme redo colors introduced
UmairKhalid786 Jun 16, 2023
c9b59d7
Theme renamed to correct TV theme
UmairKhalid786 Jun 16, 2023
6200305
Removed all light colors
UmairKhalid786 Jun 16, 2023
e21e325
Removed all unused colors
UmairKhalid786 Jun 16, 2023
e3a41e5
Themes updated using material three guidelines
UmairKhalid786 Jun 16, 2023
793aef4
Corrected theme colors for hero items
UmairKhalid786 Jun 16, 2023
a5fc304
Unused imports removed
UmairKhalid786 Jun 16, 2023
f42b1cd
Shapes introduced in theme
UmairKhalid786 Jun 16, 2023
95132a6
Composition local content provider added
UmairKhalid786 Jun 16, 2023
0ec8791
Fixed some basic login problems
UmairKhalid786 Jun 16, 2023
5fa9a20
Fixed text issues in login screen
UmairKhalid786 Jun 16, 2023
82ba928
Button refactor done in profile screen
UmairKhalid786 Jun 16, 2023
220713f
More buttons refactored to Tv Button
UmairKhalid786 Jun 16, 2023
616be0d
Exit dialog improved
UmairKhalid786 Jun 16, 2023
5fac9f8
Merge branch 'master' of https://github.com/UmairKhalid786/ComposeTv …
UmairKhalid786 Jun 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
android:name=".MainActivity"
android:banner="@drawable/ic_app"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:icon="@drawable/ic_app"
android:logo="@drawable/ic_app"
android:screenOrientation="landscape">
Expand Down
16 changes: 5 additions & 11 deletions app/src/main/java/com/techlads/composetv/CustomDialogUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
Expand All @@ -18,9 +17,6 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.techlads.composetv.theme.Gray20
import com.techlads.composetv.theme.Gray700
import com.techlads.composetv.theme.LightBlue

@Composable
fun CustomDialog(openDialogCustom: MutableState<Boolean>, onExitClick: () -> Unit) {
Expand All @@ -42,15 +38,15 @@ fun CustomDialogUI(
shape = RoundedCornerShape(10.dp),
modifier = Modifier.padding(10.dp, 5.dp, 10.dp, 10.dp),
) {
Column(modifier.background(Color.White)) {
Column(modifier.background(MaterialTheme.colorScheme.surface)) {

//.......................................................................
Image(
painter = painterResource(id = R.drawable.ic_info),
contentDescription = null, // decorative
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(
color = LightBlue
color = MaterialTheme.colorScheme.onSurface
),
modifier = Modifier
.padding(top = 35.dp)
Expand Down Expand Up @@ -84,15 +80,14 @@ fun CustomDialogUI(
Modifier
.fillMaxWidth()
.padding(top = 10.dp)
.background(Gray20.copy(0.2F)),
.background(MaterialTheme.colorScheme.background.copy(0.2F)),
) {
TextButton(onClick = {
openDialogCustom.value = false
}, modifier = Modifier.weight(1F)) {
}, modifier = Modifier.weight(1F), shape = RoundedCornerShape(0.dp)) {
Text(
"No",
fontWeight = FontWeight.Bold,
color = Gray700,
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp)
)
}
Expand All @@ -106,11 +101,10 @@ fun CustomDialogUI(
TextButton(onClick = {
openDialogCustom.value = false
onExitClick()
}, modifier = Modifier.weight(1F)) {
}, modifier = Modifier.weight(1F), shape = RoundedCornerShape(0.dp)) {
Text(
"Yes",
fontWeight = FontWeight.ExtraBold,
color = Color.Black,
modifier = Modifier.padding(top = 5.dp, bottom = 5.dp)
)
}
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/techlads/composetv/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import androidx.navigation.NavHostController
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
import com.techlads.composetv.features.home.HomeViewModel
import com.techlads.composetv.navigation.AppNavigation
import com.techlads.composetv.theme.Material3Theme
import com.techlads.composetv.theme.ComposeTvTheme
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@OptIn(ExperimentalAnimationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val viewModel: HomeViewModel by viewModels()

setContent {
Expand All @@ -44,7 +43,7 @@ class MainActivity : ComponentActivity() {

@Composable
fun App(navController: NavHostController, viewModel: HomeViewModel) {
Material3Theme {
ComposeTvTheme {
AppNavigation(navController, viewModel)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:OptIn(ExperimentalTvMaterial3Api::class)

package com.techlads.composetv.features.details

import androidx.activity.compose.BackHandler
Expand All @@ -21,13 +23,13 @@ import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.LocalContentColor
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.techlads.composetv.R
import com.techlads.composetv.theme.AppTheme
import com.techlads.composetv.theme.Material3Theme
import com.techlads.composetv.widgets.Button
import com.techlads.composetv.theme.ComposeTvTheme
import com.techlads.composetv.widgets.TvButton
import com.techlads.composetv.widgets.ThumbnailImageCard
import kotlinx.coroutines.delay

Expand Down Expand Up @@ -127,18 +129,19 @@ fun ButtonSection(onPlayClick: () -> Unit) {
modifier = Modifier
.fillMaxWidth()
.height(60.dp)
.background(color = AppTheme.surface.copy(alpha = 0.5f)),
.background(color = MaterialTheme.colorScheme.surface.copy(alpha = 0.5f)),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start
) {
Spacer(modifier = Modifier.width(280.dp))

Button(
text = "Play",
TvButton(
modifier = Modifier
.padding(horizontal = 16.dp, vertical = 4.dp)
.focusRequester(focusRequester), onClick = onPlayClick
)
) {
Text("Play")
}
Spacer(modifier = Modifier.size(16.dp))
Text(
color = LocalContentColor.current,
Expand Down Expand Up @@ -241,7 +244,7 @@ fun Rating(rating: String) {
@Preview(device = Devices.TV_1080p)
@Composable
fun DetailsScreenPrev() {
Material3Theme {
ComposeTvTheme {
ProductDetailsScreen(onPlayClick = {}, onBackPressed = {})
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:OptIn(ExperimentalTvMaterial3Api::class)

package com.techlads.composetv.features.home.hero

import androidx.compose.foundation.Image
Expand All @@ -8,14 +10,15 @@ import androidx.compose.material3.CardDefaults
import androidx.tv.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.MaterialTheme
import com.techlads.composetv.R
import com.techlads.composetv.theme.ComposeTvTheme

@Composable
fun HeroItem(modifier: Modifier = Modifier) {
Expand All @@ -36,14 +39,19 @@ fun HeroItem(modifier: Modifier = Modifier) {
Column(
Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.7f))
.background(MaterialTheme.colorScheme.background.copy(alpha = 0.7f))
.padding(32.dp)
) {
Spacer(modifier = Modifier.weight(1f))
Text(text = "Heading", style = MaterialTheme.typography.titleLarge)
Text(
text = "Heading",
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = "Description",
style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.ExtraLight)
style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.ExtraLight),
color = MaterialTheme.colorScheme.onSurface
)
}
}
Expand All @@ -53,5 +61,7 @@ fun HeroItem(modifier: Modifier = Modifier) {
@Preview
@Composable
fun HeroItemPrev() {
HeroItem()
ComposeTvTheme {
HeroItem()
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:OptIn(ExperimentalTvMaterial3Api::class)

package com.techlads.composetv.features.home.leftmenu

import androidx.compose.animation.core.animateDpAsState
Expand All @@ -10,9 +12,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.tv.material3.ExperimentalTvMaterial3Api
import androidx.tv.material3.MaterialTheme
import com.techlads.composetv.features.home.navigation.NestedScreens
import com.techlads.composetv.features.home.leftmenu.model.MenuItem
import com.techlads.composetv.theme.AppTheme
import compose.icons.LineAwesomeIcons
import compose.icons.lineawesomeicons.CogSolid
import compose.icons.lineawesomeicons.Comment
Expand Down Expand Up @@ -43,7 +46,7 @@ fun LeftMenu(

Box(
modifier = modifier
.background(AppTheme.surface.copy(alpha = 0.5f))
.background(MaterialTheme.colorScheme.surface.copy(alpha = 0.5f))
.wrapContentWidth()
) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.techlads.composetv.theme.ComposeTvTheme
import compose.icons.LineAwesomeIcons
import compose.icons.lineawesomeicons.TvSolid

Expand Down Expand Up @@ -51,5 +52,7 @@ fun MenuHeader(expanded: Boolean = true) {
@Preview
@Composable
fun MenuHeaderPrev() {
MenuHeader(true)
ComposeTvTheme {
MenuHeader()
}
}
Original file line number Diff line number Diff line change
@@ -1,43 +0,0 @@
@file:OptIn(ExperimentalTvMaterial3Api::class)

package com.techlads.composetv.features.login.withEmailPassword

import androidx.compose.foundation.layout.*
import androidx.tv.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.tv.material3.Button
import androidx.tv.material3.ExperimentalTvMaterial3Api

@Composable
fun LoginButton(modifier: Modifier = Modifier, onClick: () -> Unit) {
Button(
onClick = onClick,
contentPadding = PaddingValues(16.dp),
modifier = modifier
) {
Text(
modifier = Modifier.fillMaxWidth(),
text = "LOGIN", style = TextStyle(
fontFamily = FontFamily.SansSerif,
fontWeight = FontWeight.Light,
textAlign = TextAlign.Center,
)
)
}
}


@Preview
@Composable
fun LoginButtonPrev() {
LoginButton(Modifier.wrapContentSize()) {

}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
package com.techlads.composetv.features.login.withEmailPassword
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.techlads.composetv.theme.ComposeTvTheme

@Composable
fun LoginScreen(
modifier: Modifier = Modifier,
goToHomeScreen: () -> Unit
) {
Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Box(modifier = modifier
.fillMaxSize()
.padding(bottom = 68.dp), contentAlignment = Alignment.Center) {
LoginPage { _, _ ->
goToHomeScreen()
}
}
}


@Preview(device = Devices.TV_1080p)
@Composable
fun LoginScreenPrev() {
ComposeTvTheme {
LoginScreen(Modifier.fillMaxSize()) {

}
}
}
Loading