diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45f3a288b..cd1f299db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: echo -e "\TRAKT_REDIRECT_URI=$TRAKT_REDIRECT_URI" >> ./local.properties - name: Check lint - run: ./gradlew lintDemoDebug + run: ./gradlew lint - name: Build with gradle run: ./gradlew assemble diff --git a/README.md b/README.md index db7b45a09..3abeebcc8 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ You need to add API keys from [Trakt.tv](https://trakt.docs.apiary.io) & [TMDb]( ### Android - [Zulu Java 17](https://www.azul.com/downloads-new/?package=jdk#zulu) -- You require the latest [Android Studio Dolphin](https://developer.android.com/studio/preview) release to be able to build the app. +- You require the latest [Android Studio](https://developer.android.com/studio/preview) release to be able to build the app. - Install Kmm Plugin. Checkout [this setup guide](https://kotlinlang.org/docs/kmm-setup.html). @@ -115,33 +115,34 @@ https://user-images.githubusercontent.com/841885/223576880-c7391d14-63b8-47cd-a7 ## Libraries Used ### Android +* [Accompanist](https://github.com/google/accompanist) + * [Insets](https://google.github.io/accompanist/insets/) + * [Pager Layouts](https://google.github.io/accompanist/pager/) +* [Android-youtube-player](https://github.com/PierfrancescoSoffritti/android-youtube-player) - Youtube Player +* [AppAuth](https://openid.github.io/AppAuth-Android/) - AppAuth for Android is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers. +* [Compose Lints](https://slackhq.github.io/compose-lints/) - Custom lint checks for Jetpack Compose. +* [Dagger Hilt](https://dagger.dev/hilt) - dependency injection. * [Jetpack Compose](https://developer.android.com/jetpack/compose) * [Coil](https://coil-kt.github.io/coil/compose/) - Image loading * [Navigation](https://developer.android.com/jetpack/compose/navigation) - Navigation +* [KenBurnsView](https://github.com/flavioarfaria/KenBurnsView) - Immersive image. +* [Leakcanary](https://github.com/square/leakcanary) - Memory leak detection. * [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) UI related data holder, lifecycle aware. * [WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager?gclsrc=ds&gclsrc=ds) Handle persistent work -* [Accompanist](https://github.com/google/accompanist) - * [Insets](https://google.github.io/accompanist/insets/) - * [Pager Layouts](https://google.github.io/accompanist/pager/) -* [Dagger Hilt](https://dagger.dev/hilt) - dependency injection. -* [KenBurnsView](https://github.com/flavioarfaria/KenBurnsView) - Immersive image. -* [Leakcanary](https://github.com/square/leakcanary) - Memory leak detection. -* [Android-youtube-player](https://github.com/PierfrancescoSoffritti/android-youtube-player) - Youtube Player -* [AppAuth](https://openid.github.io/AppAuth-Android/) - AppAuth for Android is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers. ### Kmp - Common -* [Ktor](https://ktor.io/) - Networking * [Kotlinx Serialization](https://ktor.io/docs/kotlin-serialization.html) - De/Serializing JSON * [Coroutines](https://github.com/Kotlin/kotlinx.coroutines#multiplatform) - Concurrency & Threading +* [DataStore Preferences](https://android-developers.googleblog.com/2022/10/announcing-experimental-preview-of-jetpack-multiplatform-libraries.html) - Data storage * [DateTime](https://github.com/Kotlin/kotlinx-datetime) - Date & Time +* [Flow-Redux](https://github.com/freeletics/FlowRedux) +* [Kermit](https://kermit.touchlab.co/) - Logging +* [koin](https://github.com/mockk/mockk) - Injection library. +* [Ktor](https://ktor.io/) - Networking +* [Kotest Assertions](https://kotest.io/docs/assertions/assertions.html) - Testing * [SQLDelight](https://github.com/cashapp/sqldelight/) - Local storage - [Coroutines Extensions](https://cashapp.github.io/sqldelight/js_sqlite/coroutines/) Consume queries as Flow -* [Napier](https://github.com/AAkira/Napier) - Logging -* [Mockk](https://github.com/mockk/mockk) - mocking library for Kotlin. -* [koin](https://github.com/mockk/mockk) - Injection library. -* [DataStore Preferences](https://android-developers.googleblog.com/2022/10/announcing-experimental-preview-of-jetpack-multiplatform-libraries.html) - Data storage -* [Flow-Redux](https://github.com/freeletics/FlowRedux) ### iOS * [Kingfisher](https://github.com/onevcat/Kingfisher) - Image library. @@ -191,11 +192,12 @@ Shared - [Design Inspiration](https://dribbble.com/shots/7591814-HBO-Max-Companion-App-Animation) - [Code Snippets](https://github.com/android/compose-samples) - [Touchlab KaMPKit project](https://github.com/touchlab/KaMPKit) +- [Tivi](https://github.com/chrisbanes/tivi) ## License ``` -Copyright 2022 Thomas Kioko +Copyright 2021 Thomas Kioko Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 86f90766e..70116fc78 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -20,7 +20,7 @@ android { dependencies { - implementation(projects.android.core.compose) + implementation(projects.android.core.designsystem) implementation(projects.android.core.navigation) implementation(projects.android.features.discover) implementation(projects.android.features.home) diff --git a/android/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt b/android/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt index 0e3a2955a..a68f05f2a 100644 --- a/android/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt +++ b/android/app/src/main/kotlin/com/thomaskioko/tvmaniac/ui/MainActivity.kt @@ -7,29 +7,25 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.expandVertically import androidx.compose.animation.shrinkVertically -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.SideEffect import androidx.compose.runtime.State import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.produceState import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.compositeOver import androidx.core.view.WindowCompat import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.thomaskioko.tvmaniac.compose.components.ConnectionStatus -import com.thomaskioko.tvmaniac.compose.theme.DarkColors -import com.thomaskioko.tvmaniac.compose.theme.LightColors import com.thomaskioko.tvmaniac.compose.theme.TvManiacTheme import com.thomaskioko.tvmaniac.core.util.network.ConnectionState import com.thomaskioko.tvmaniac.core.util.network.ObserveConnectionState +import com.thomaskioko.tvmaniac.datastore.api.DatastoreRepository import com.thomaskioko.tvmaniac.home.HomeScreen import com.thomaskioko.tvmaniac.navigation.ComposeNavigationFactory -import com.thomaskioko.tvmaniac.datastore.api.DatastoreRepository import com.thomaskioko.tvmaniac.settings.shouldUseDarkColors import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -37,6 +33,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.distinctUntilChanged import javax.inject.Inject +@OptIn(ExperimentalAnimationApi::class) @AndroidEntryPoint class MainActivity : ComponentActivity() { @Inject @@ -48,50 +45,29 @@ class MainActivity : ComponentActivity() { @Inject lateinit var observeNetwork: ObserveConnectionState - @OptIn(ExperimentalAnimationApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) WindowCompat.setDecorFitsSystemWindows(window, false) setContent { - TvManiacTheme(darkTheme = datastoreRepository.shouldUseDarkColors()) { - SetupTheme() - HomeScreen(composeNavigationFactories) + val systemUiController = rememberSystemUiController() + val darkTheme = datastoreRepository.shouldUseDarkColors() + + DisposableEffect(systemUiController, darkTheme) { + systemUiController.systemBarsDarkContentEnabled = !darkTheme + onDispose {} + } + + TvManiacTheme(darkTheme = darkTheme) { + Surface { + HomeScreen(composeNavigationFactories) + } } ConnectivityStatus(observeNetwork) } } - @Composable - private fun SetupTheme() { - val systemUiController = rememberSystemUiController() - val isLightTheme = !datastoreRepository.shouldUseDarkColors() - - val systemBarColor = MaterialTheme.colors.surface.copy(alpha = 0.0f) - val transparentColor: (Color) -> Color = { original -> - systemBarColor.compositeOver(original) - } - SideEffect { - systemUiController.setSystemBarsColor( - color = Color.Transparent, - darkIcons = isLightTheme - ) - - systemUiController.setStatusBarColor( - color = Color.Transparent, - darkIcons = isLightTheme, - transformColorForLightContent = transparentColor - ) - - systemUiController.setNavigationBarColor( - color = if (isLightTheme) LightColors.surface else DarkColors.primary, - darkIcons = isLightTheme, - navigationBarContrastEnforced = false, - transformColorForLightContent = transparentColor - ) - } - } @ExperimentalAnimationApi @ExperimentalCoroutinesApi diff --git a/android/app/src/main/res/drawable/ic_app_launcher.xml b/android/app/src/main/res/drawable/ic_app_launcher.xml index e26c14a47..a394ded6b 100644 --- a/android/app/src/main/res/drawable/ic_app_launcher.xml +++ b/android/app/src/main/res/drawable/ic_app_launcher.xml @@ -1,8 +1,10 @@ + android:viewportHeight="512" + tools:ignore="VectorRaster"> diff --git a/android/app/src/main/res/values-night/themes.xml b/android/app/src/main/res/values-night/themes.xml new file mode 100644 index 000000000..2b2fe32c2 --- /dev/null +++ b/android/app/src/main/res/values-night/themes.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/android/app/src/main/res/values-v27/themes.xml b/android/app/src/main/res/values-v27/themes.xml new file mode 100644 index 000000000..ca00b3f35 --- /dev/null +++ b/android/app/src/main/res/values-v27/themes.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index f55507c82..de4263daa 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,6 +1,4 @@ - #FFBE0B - #FFFFFF - #FF131313 + #FF131313 \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml deleted file mode 100644 index e69550730..000000000 --- a/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - Tv Maniac - \ No newline at end of file diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml index 050b215d6..19a144cfc 100644 --- a/android/app/src/main/res/values/themes.xml +++ b/android/app/src/main/res/values/themes.xml @@ -1,5 +1,15 @@ - + + + + + + +