From 269c529a29e5d1ef48434950a4761fd7231149f1 Mon Sep 17 00:00:00 2001 From: PetoAdam <61557670+PetoAdam@users.noreply.github.com> Date: Sat, 2 Dec 2023 20:46:40 +0100 Subject: [PATCH 1/5] Fix dark mode --- .idea/deploymentTargetDropDown.xml | 4 +- .idea/kotlinc.xml | 2 +- app/build.gradle | 1 + .../moviedetails/MovieDetailsScreen.kt | 4 ++ .../cinemasurf/movielist/MovieListScreen.kt | 29 ++++++++----- .../com/example/cinemasurf/ui/theme/Color.kt | 16 ++++--- .../com/example/cinemasurf/ui/theme/Theme.kt | 42 ++++++++++--------- 7 files changed, 60 insertions(+), 38 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index bd18c04..bf814a3 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,11 @@ - + - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index ff9696e..c264799 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index fb2b5c2..e073b72 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,6 +75,7 @@ dependencies { implementation 'com.google.firebase:firebase-crashlytics-ktx:18.3.2' implementation 'androidx.core:core-ktx:+' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00') diff --git a/app/src/main/java/com/example/cinemasurf/moviedetails/MovieDetailsScreen.kt b/app/src/main/java/com/example/cinemasurf/moviedetails/MovieDetailsScreen.kt index 2c102ce..2ba1098 100644 --- a/app/src/main/java/com/example/cinemasurf/moviedetails/MovieDetailsScreen.kt +++ b/app/src/main/java/com/example/cinemasurf/moviedetails/MovieDetailsScreen.kt @@ -167,6 +167,7 @@ fun ImageSection( Icon( imageVector = Icons.TwoTone.Star, contentDescription = "Rating", + tint = Color.White, modifier = Modifier .weight(1f) .align(Alignment.CenterVertically) @@ -176,6 +177,7 @@ fun ImageSection( Text( text = roundedRating.toString() ?: "Unknown", style = MaterialTheme.typography.headlineLarge, + color = Color.White, modifier = Modifier .padding(10.dp) .weight(2f), @@ -194,6 +196,7 @@ fun ImageSection( Text( text = movie.first.title.orEmpty(), style = MaterialTheme.typography.headlineLarge, + color = Color.White, modifier = Modifier .padding(8.dp) .width(300.dp) @@ -215,6 +218,7 @@ fun ImageSection( } else { Icons.TwoTone.Favorite }, + tint = Color.White, contentDescription = "Favorite" ) } diff --git a/app/src/main/java/com/example/cinemasurf/movielist/MovieListScreen.kt b/app/src/main/java/com/example/cinemasurf/movielist/MovieListScreen.kt index 51ad234..13641de 100644 --- a/app/src/main/java/com/example/cinemasurf/movielist/MovieListScreen.kt +++ b/app/src/main/java/com/example/cinemasurf/movielist/MovieListScreen.kt @@ -80,7 +80,11 @@ fun MovieListScreenContent( onFavouriteIconClicked: () -> Unit ) { ContentWithBackgroundLoadingIndicator(state = movieListUiState, onRetry = onRetry) { state -> - Column(modifier = Modifier.fillMaxSize()) + Column( + modifier = Modifier + .fillMaxSize() + .background(color = MaterialTheme.colorScheme.background), + ) { MovieListHeader( isFavourite = state.showFavourites, @@ -110,7 +114,8 @@ fun MovieListHeader( modifier = modifier .fillMaxWidth() .height(80.dp) - .padding(horizontal = 16.dp), + .padding(horizontal = 16.dp) + .background(MaterialTheme.colorScheme.background), verticalAlignment = Alignment.CenterVertically ) { val searchWeight = if (searchText == "") 1f else 5f @@ -131,7 +136,8 @@ fun MovieListHeader( text = "Movies", style = MaterialTheme.typography.headlineLarge, modifier = Modifier.weight(3f), - textAlign = TextAlign.Center + textAlign = TextAlign.Center, + color = MaterialTheme.colorScheme.onBackground ) Spacer(modifier = Modifier.width(16.dp)) @@ -165,14 +171,15 @@ fun SearchBar( modifier = modifier .clip(RoundedCornerShape(4.dp)) .padding(horizontal = 8.dp, vertical = 4.dp) - .height(36.dp), + .height(36.dp) + .background(MaterialTheme.colorScheme.background), singleLine = true, textStyle = MaterialTheme.typography.bodyMedium, leadingIcon = { Icon( imageVector = Icons.Filled.Search, contentDescription = "Search Icon", - tint = Color(0.3f, 0.3f, 0.3f, 0.7f) + tint = MaterialTheme.colorScheme.onBackground, ) }, shape = RoundedCornerShape(8.dp) @@ -188,11 +195,12 @@ fun TwoWaySlider( IconButton( onClick = onCheckedChange, modifier = modifier + .background(MaterialTheme.colorScheme.background) ) { Icon( imageVector = if (isChecked) Icons.Filled.Favorite else Icons.TwoTone.Favorite, contentDescription = null, - tint = if (isChecked) Color.Red else LocalContentColor.current // Set red tint for filled version + tint = if (isChecked) Color.Red else MaterialTheme.colorScheme.onBackground // Set red tint for filled version ) } } @@ -207,6 +215,7 @@ fun MovieList( AnimatedVisibility(movieListUiState.searchText != "") { Text( text = "Showing results for: " + movieListUiState.searchText, + color = MaterialTheme.colorScheme.onBackground, modifier = Modifier .fillMaxWidth() .wrapContentHeight() @@ -250,7 +259,7 @@ fun MovieListItem( ) } Divider( - color = Color.Black, + color = MaterialTheme.colorScheme.onBackground, modifier = Modifier.padding(start = 20.dp, end = 20.dp) ) } @@ -294,7 +303,7 @@ fun MovieDetails(movie: Movie, modifier: Modifier) { maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(bottom = 2.dp), - color = Color.Black + color = MaterialTheme.colorScheme.onBackground ) Text( text = @@ -305,14 +314,14 @@ fun MovieDetails(movie: Movie, modifier: Modifier) { maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodyMedium, - color = Color.Black + color = MaterialTheme.colorScheme.onBackground ) Text( text = "Rating: " + movie.vote_average, maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodyMedium, - color = Color.Black + color = MaterialTheme.colorScheme.onBackground ) } } diff --git a/app/src/main/java/com/example/cinemasurf/ui/theme/Color.kt b/app/src/main/java/com/example/cinemasurf/ui/theme/Color.kt index b656fe6..0fdbee3 100644 --- a/app/src/main/java/com/example/cinemasurf/ui/theme/Color.kt +++ b/app/src/main/java/com/example/cinemasurf/ui/theme/Color.kt @@ -2,10 +2,14 @@ package com.example.cinemasurf.ui.theme import androidx.compose.ui.graphics.Color -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) +// Light Color Scheme +val LightGrey = Color(0xFFE5E5E5) +val LightGreyVariant = Color(0xFFD2D2D2) +val White = Color(0xFFFFFFFF) +val DarkGrey = Color(0xFF333333) +val AccentColor = Color(0xFF009688) -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) \ No newline at end of file +// Dark Color Scheme +val DarkGreyBackground = Color(0xFF121212) +val AlmostBlack = Color(0xFF1C1C1C) +val DarkAccentColor = Color(0xFF005850) \ No newline at end of file diff --git a/app/src/main/java/com/example/cinemasurf/ui/theme/Theme.kt b/app/src/main/java/com/example/cinemasurf/ui/theme/Theme.kt index 8511169..ae3d594 100644 --- a/app/src/main/java/com/example/cinemasurf/ui/theme/Theme.kt +++ b/app/src/main/java/com/example/cinemasurf/ui/theme/Theme.kt @@ -15,26 +15,30 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalView import androidx.core.view.WindowCompat -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 +val DarkColorScheme = darkColorScheme( + primary = AlmostBlack, + secondary = DarkGreyBackground, + tertiary = DarkAccentColor, + background = DarkGreyBackground, + surface = AlmostBlack, + onPrimary = White, + onSecondary = White, + onTertiary = White, + onBackground = LightGrey, + onSurface = White, ) -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40 - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ +val LightColorScheme = lightColorScheme( + primary = White, + secondary = LightGrey, + tertiary = AccentColor, + background = White, + surface = White, + onPrimary = DarkGrey, + onSecondary = DarkGrey, + onTertiary = DarkGrey, + onBackground = DarkGrey, + onSurface = DarkGrey, ) @Composable @@ -58,7 +62,7 @@ fun CinemaSurfTheme( SideEffect { val window = (view.context as Activity).window window.statusBarColor = colorScheme.primary.toArgb() - WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme } } From c0a8349fac35104e37dab3fcce3f7164050dfc90 Mon Sep 17 00:00:00 2001 From: PetoAdam <61557670+PetoAdam@users.noreply.github.com> Date: Sat, 2 Dec 2023 21:01:14 +0100 Subject: [PATCH 2/5] Update android.yml --- .github/workflows/android.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index f7600cc..00c65a5 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -25,13 +25,16 @@ jobs: run: ./gradlew build - name: Build Debug APK run: ./gradlew assembleDebug + - name: Get commit hash + id: get:commit_hash + run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)" - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ steps.get-commit-hash.outputs.commit_hash }} + release_name: Release ${{ steps.get-commit-hash.outputs.commit_hash }} draft: false prerelease: false From 139ab3d6ae3f80238d564cfa06b65e827c2579af Mon Sep 17 00:00:00 2001 From: PetoAdam <61557670+PetoAdam@users.noreply.github.com> Date: Sat, 2 Dec 2023 21:02:14 +0100 Subject: [PATCH 3/5] Update android.yml - fix typo --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 00c65a5..bd1abcf 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -26,7 +26,7 @@ jobs: - name: Build Debug APK run: ./gradlew assembleDebug - name: Get commit hash - id: get:commit_hash + id: get_commit_hash run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)" - name: Create Release id: create_release From 85f996bc6b7ff3d1fac0e608f4df06e947f19f18 Mon Sep 17 00:00:00 2001 From: PetoAdam <61557670+PetoAdam@users.noreply.github.com> Date: Sat, 2 Dec 2023 21:08:50 +0100 Subject: [PATCH 4/5] fix typo --- .github/workflows/android.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index bd1abcf..76a21e9 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -34,7 +34,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} with: - tag_name: ${{ steps.get-commit-hash.outputs.commit_hash }} - release_name: Release ${{ steps.get-commit-hash.outputs.commit_hash }} + tag_name: ${{ steps.get_commit_hash.outputs.commit_hash }} + release_name: Release ${{ steps.get_commit_hash.outputs.commit_hash }} draft: false prerelease: false From 9ad164cc8d465bf64fe5bb4b7ed94ffbc4c3a585 Mon Sep 17 00:00:00 2001 From: PetoAdam <61557670+PetoAdam@users.noreply.github.com> Date: Sat, 2 Dec 2023 21:15:05 +0100 Subject: [PATCH 5/5] add v-to tag name to get valid release tag --- .github/workflows/android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 76a21e9..16710be 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -34,7 +34,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} with: - tag_name: ${{ steps.get_commit_hash.outputs.commit_hash }} + tag_name: v${{ steps.get_commit_hash.outputs.commit_hash }} release_name: Release ${{ steps.get_commit_hash.outputs.commit_hash }} draft: false prerelease: false