├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── ic_bruce.jpg │ │ │ │ ├── ic_daniel.jpg │ │ │ │ ├── ic_error.png │ │ │ │ ├── ic_default.png │ │ │ │ ├── ic_loading.jpg │ │ │ │ ├── ic_profile_image.webp │ │ │ │ ├── ic_profile_image_tm.png │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── ic_splash.xml │ │ │ │ ├── ic_like.xml │ │ │ │ └── ic_movie.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── themes.xml │ │ │ │ └── strings.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ └── activity_movie.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── ellison │ │ │ │ └── composemovie │ │ │ │ ├── ComposeMovieApplication.kt │ │ │ │ ├── bean │ │ │ │ ├── MovieResponse.kt │ │ │ │ ├── Cast.kt │ │ │ │ ├── Account.kt │ │ │ │ ├── Movie.kt │ │ │ │ └── MoviePro.kt │ │ │ │ ├── constant │ │ │ │ └── Constants.kt │ │ │ │ ├── ui │ │ │ │ ├── theme │ │ │ │ │ ├── Type.kt │ │ │ │ │ ├── Shape.kt │ │ │ │ │ ├── Theme.kt │ │ │ │ │ └── Color.kt │ │ │ │ ├── Dialog.kt │ │ │ │ ├── LoadImage.kt │ │ │ │ ├── Favourite.kt │ │ │ │ ├── Store.kt │ │ │ │ ├── Profile.kt │ │ │ │ ├── Find.kt │ │ │ │ ├── Detail.kt │ │ │ │ └── Navigation.kt │ │ │ │ ├── model │ │ │ │ ├── MovieService.kt │ │ │ │ └── RemoteMovieData.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── util │ │ │ │ └── Utils.kt │ │ │ │ └── viewmodel │ │ │ │ └── MovieViewModel.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── ellison │ │ │ └── composemovie │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── ellison │ │ └── composemovie │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── results ├── capture-1-new-round.png └── capture-2-new-round.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── gradle.properties ├── gradlew.bat ├── gradlew └── .gitignore /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "ComposeMovie" -------------------------------------------------------------------------------- /results/capture-1-new-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/results/capture-1-new-round.png -------------------------------------------------------------------------------- /results/capture-2-new-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/results/capture-2-new-round.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_bruce.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_bruce.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_daniel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_daniel.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_default.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_loading.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_loading.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile_image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_profile_image.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile_image_tm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellisonchan/ComposeMovie/HEAD/app/src/main/res/drawable/ic_profile_image_tm.png -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ComposeMovieApplication.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie 2 | 3 | import android.app.Application 4 | 5 | class ComposeMovieApplication: Application() { 6 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 09 23:34:02 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/bean/MovieResponse.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.bean 2 | 3 | data class MovieResponse( 4 | var TotalResults: String = "0", 5 | var Response: String = "false", 6 | var Error: String = "null", 7 | var Search: T 8 | ) { 9 | override fun toString(): String { 10 | return "MovieSearchResponse(TotalResults=$TotalResults, Response=$Response, Error=$Error, Search=$Search)" 11 | } 12 | } -------------------------------------------------------------------------------- /app/src/test/java/com/ellison/composemovie/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/bean/Cast.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.bean 2 | 3 | import com.ellison.composemovie.R 4 | 5 | data class Cast ( 6 | var Icon: Int, 7 | var Name: String, 8 | var movies: List 9 | ) 10 | 11 | val testCast1: Cast = Cast( 12 | R.drawable.ic_bruce, 13 | "Bruce Lee", 14 | testMovies 15 | ) 16 | 17 | val testCast2: Cast = Cast( 18 | R.drawable.ic_daniel, 19 | "Daniel Jacob", 20 | testMovies2 21 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/bean/Account.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.bean 2 | 3 | import com.ellison.composemovie.R 4 | 5 | data class Account ( 6 | var Post: Int, 7 | var FullName: Int, 8 | var About: Int, 9 | var NickName: Int, 10 | var Status: Int, 11 | var Sns: Int 12 | ) 13 | 14 | val myAccount: Account = Account( 15 | R.drawable.ic_profile_image, 16 | R.string.full_name, 17 | R.string.about_content, 18 | R.string.nick_name, 19 | R.string.status_mine, 20 | R.string.sns_mine 21 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/constant/Constants.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.constant 2 | 3 | object Constants { 4 | const val OMDB_URL = "http://omdbapi.com/" 5 | const val OMDB_API_KEY = "9a5d98e2" 6 | 7 | const val ROUTE_FIND = "find" 8 | const val ROUTE_DETAIL = "info/{movieId}" 9 | const val ROUTE_DETAIL_PRE = "info/" 10 | const val ROUTE_DETAIL_KEY = "movieId" 11 | const val ROUTE_STORE = "store" 12 | const val ROUTE_FAVOURITE = "favourite" 13 | const val ROUTE_PROFILE = "profile" 14 | 15 | 16 | 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui.theme 2 | 3 | import androidx.compose.material.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | // Set of Material typography styles to start with 10 | val typography = Typography( 11 | body1 = TextStyle( 12 | fontFamily = FontFamily.Default, 13 | fontWeight = FontWeight.Normal, 14 | fontSize = 16.sp 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/model/MovieService.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.model 2 | 3 | import com.ellison.composemovie.bean.* 4 | import retrofit2.http.GET 5 | import retrofit2.http.Query 6 | 7 | interface MovieService { 8 | @GET("http://omdbapi.com/") 9 | suspend fun requestSearchByCoroutines( 10 | @Query("s") keywords: String, 11 | @Query("apikey") apikey: String 12 | ): MovieResponse> 13 | 14 | @GET("http://omdbapi.com/") 15 | suspend fun requestDetailByCoroutines( 16 | @Query("i") id: String, 17 | @Query("apikey") apikey: String 18 | ): MoviePro 19 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.material.Shapes 5 | import androidx.compose.ui.unit.dp 6 | 7 | val shapes = Shapes( 8 | // small = RoundedCornerShape(8.dp), 9 | small = RoundedCornerShape(8.dp), 10 | medium = RoundedCornerShape(38.dp, 38.dp, 38.dp, 38.dp), 11 | large = RoundedCornerShape(6.dp) 12 | ) 13 | 14 | val editShapes = Shapes( 15 | // small = RoundedCornerShape(8.dp), 16 | small = RoundedCornerShape(18.dp, 4.dp, 4.dp, 4.dp), 17 | medium = RoundedCornerShape(38.dp, 4.dp, 4.dp, 4.dp), 18 | large = RoundedCornerShape(6.dp, 6.dp, 0.dp, 0.dp) 19 | ) 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #FFFBDE4B 11 | #FF411445 12 | #212E54 13 | #071C74 14 | @color/pink900 15 | #FFF1F1 16 | #3f2c2c 17 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/ellison/composemovie/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.ellison.composemovie", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://ftp.bmp.ovh/imgs/2021/03/e37e5997f735b29a.png) 2 | # Compose movie 3 | 4 | ## :scroll: Description 5 | You can search movies from [OMDB](http://omdbapi.com). And app would show recommend movies to you.Besides, you can star the movie and see them in favourite screen. 6 | 7 | ## :bulb: Motivation and Context 8 | * All UI were built with [Jetpack Compose](https://developer.android.com/jetpack/compose?hl=zh-cn) tool. 9 | * Request data by [Retrofit](https://github.com/square/retrofit) library. 10 | * Load image data by [coil](https://github.com/coil-kt/coil) library. 11 | 12 | ## :camera_flash: Screenshots 13 | ![Search movie and check detail](https://ftp.bmp.ovh/imgs/2021/03/b7a715cd82b9e431.png) 14 | 15 | ![Store, favourite and profile](https://ftp.bmp.ovh/imgs/2021/03/fa80378f7871ea03.png) 16 | 17 | ## :memo:Blog 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_like.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui.theme 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.darkColors 6 | import androidx.compose.material.lightColors 7 | import androidx.compose.runtime.Composable 8 | 9 | private val DarkColorPalette = darkColors( 10 | primary = black, 11 | primaryVariant = purple700, 12 | secondary = teal200 13 | ) 14 | 15 | private val LightColorPalette = lightColors( 16 | primary = pink100, 17 | primaryVariant = purple700, 18 | secondary = pink900, 19 | background = white, 20 | surface = whit850, 21 | onPrimary = gray, 22 | onSecondary = white, 23 | onBackground = gray, 24 | onSurface = gray 25 | ) 26 | 27 | @Composable 28 | fun MyTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) { 29 | val colors = if (darkTheme) { 30 | DarkColorPalette 31 | } else { 32 | LightColorPalette 33 | } 34 | 35 | MaterialTheme( 36 | colors = colors, 37 | typography = typography, 38 | shapes = shapes, 39 | content = content 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_movie.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui.theme 2 | 3 | import androidx.compose.material.Colors 4 | import androidx.compose.runtime.Composable 5 | import androidx.compose.ui.graphics.Color 6 | import androidx.compose.ui.graphics.compositeOver 7 | 8 | @Composable 9 | fun Colors.compositedOnSurface(alpha: Float): Color { 10 | return onSurface.copy(alpha = alpha).compositeOver(surface) 11 | } 12 | 13 | val purple200 = Color(0xFFBB86FC) 14 | val purple500 = Color(0xFF6200EE) 15 | val purple700 = Color(0xFF3700B3) 16 | val teal200 = Color(0xFF03DAC5) 17 | 18 | val toolBarColor = Color(0xFFFBDE4B) 19 | // Color(0xFFcbc547) 20 | val nameColor = Color(0xFF411445) 21 | val itemCardColor = Color(0xFFf2eada) 22 | val infoCardColor = itemCardColor 23 | // Color(0xFFffce7b) 24 | val infoButtonColor = nameColor 25 | val infoColor = nameColor 26 | // Color(0xFF72777b) 27 | val likeColor = Color(0xFF888888) 28 | val likedColor = nameColor 29 | // Color(0xFFd4237a) 30 | val likeColorBg = Color(0xFFf2eada) 31 | 32 | //Color.kt 33 | val pink100 = Color(0xFFFFF1F1) 34 | val pink900 = Color(0xFF3f2c2c) 35 | val gray = Color(0xFF232323) 36 | val whit850 = Color.White.copy(alpha = .85f) 37 | val whit150 = Color.White.copy(alpha = .15f) 38 | val green900 = Color(0xFF2d3b2d) 39 | val green300 = Color(0xFFb8c9b8) 40 | 41 | val black = Color(0x1C1E28) 42 | val darkBlue = Color(0x212E54) 43 | val blue = Color(0x071C74) 44 | val white = Color.White 45 | val screenBGColor = darkBlue -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.activity.compose.setContent 6 | import androidx.compose.foundation.ExperimentalFoundationApi 7 | import androidx.compose.foundation.layout.Spacer 8 | import androidx.compose.foundation.layout.sizeIn 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.Modifier 11 | import androidx.compose.ui.tooling.preview.Preview 12 | import androidx.compose.ui.unit.dp 13 | import com.ellison.composemovie.ui.Navigation 14 | import com.ellison.composemovie.ui.theme.MyTheme 15 | 16 | class MainActivity : AppCompatActivity() { 17 | @ExperimentalFoundationApi 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContent { 21 | MyTheme { 22 | InitSearchBox() 23 | } 24 | } 25 | } 26 | } 27 | 28 | @ExperimentalFoundationApi 29 | @Preview("Light Theme", widthDp = 360, heightDp = 640) 30 | @Composable 31 | fun InitSearchBox() { 32 | Spacer(Modifier.sizeIn(8.dp)) 33 | Navigation() 34 | } 35 | 36 | @ExperimentalFoundationApi 37 | @Preview("Light Theme", widthDp = 360, heightDp = 640) 38 | @Composable 39 | fun LightPreview() { 40 | MyTheme { 41 | Navigation() 42 | } 43 | } 44 | 45 | @ExperimentalFoundationApi 46 | @Preview("Dark Theme", widthDp = 360, heightDp = 640) 47 | @Composable 48 | fun DarkPreview() { 49 | MyTheme(darkTheme = true) { 50 | Navigation() 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Dialog.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.material.AlertDialog 4 | import androidx.compose.material.Text 5 | import androidx.compose.material.TextButton 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.runtime.mutableStateOf 8 | import androidx.compose.runtime.remember 9 | import androidx.compose.ui.graphics.Color 10 | import androidx.compose.ui.res.stringResource 11 | import com.ellison.composemovie.R 12 | import com.ellison.composemovie.ui.theme.nameColor 13 | import com.ellison.composemovie.ui.theme.shapes 14 | 15 | @Composable 16 | fun ShowDialog( 17 | title: Int, 18 | message: Int 19 | ) { 20 | val openDialog = remember { mutableStateOf(true) } 21 | 22 | if (openDialog.value) 23 | AlertDialog( 24 | onDismissRequest = { openDialog.value = false }, 25 | title = { 26 | Text( 27 | text = stringResource(id = title), 28 | color = nameColor 29 | ) 30 | }, 31 | text = { 32 | Text( 33 | text = stringResource(id = message), 34 | color = nameColor 35 | ) 36 | }, 37 | confirmButton = { 38 | TextButton(onClick = { openDialog.value = false }) { 39 | Text( 40 | text = stringResource(id = R.string.search_dialog_ok), 41 | color = Color.White 42 | ) 43 | } 44 | }, 45 | shape = shapes.large, 46 | ) 47 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/util/Utils.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.util 2 | 3 | import android.content.Context 4 | import android.util.Log 5 | import android.net.NetworkInfo 6 | 7 | import android.net.ConnectivityManager 8 | import android.widget.Toast 9 | import com.ellison.composemovie.R 10 | 11 | 12 | object Utils { 13 | private val TAG: String = Utils::class.java.getSimpleName() 14 | 15 | // adb shell setprop log.tag.ComposeMovie.Debug D 16 | const val TAG_DEBUG = "ComposeMovie.Debug" 17 | const val TAG_LAUNCH = "ComposeMovie.Launch" 18 | const val TAG_SEARCH = "ComposeMovie.Search" 19 | const val TAG_NETWORK = "ComposeMovie.Network" 20 | 21 | fun logError(tag: String?, message: String?, throwable: Throwable? = null) { 22 | Log.e(tag, message, throwable) 23 | } 24 | 25 | fun logDebug(tag: String, message: String, throwable: Throwable? = null) { 26 | if (Log.isLoggable(TAG_DEBUG, Log.DEBUG)) { 27 | if (throwable != null) 28 | Log.d(tag, message, throwable) 29 | else 30 | Log.d(tag, message) 31 | } 32 | } 33 | 34 | private fun isNetworkAvailable(context: Context): Int { 35 | val connectivityManager = 36 | context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager 37 | val networkInfo = connectivityManager.allNetworkInfo 38 | if (networkInfo.isNotEmpty()) { 39 | for (i in networkInfo.indices) { 40 | if (networkInfo[i].state == NetworkInfo.State.CONNECTED) { 41 | return 1 42 | } 43 | } 44 | } 45 | return 0 46 | } 47 | 48 | fun ensureNetworkAvailable(context: Context, needToast: Boolean = true): Boolean { 49 | val isAvailable = isNetworkAvailable(context) == 1 50 | if (!isAvailable && needToast) Toast.makeText(context, R.string.search_failure, Toast.LENGTH_SHORT) 51 | .show() 52 | return isAvailable 53 | } 54 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/viewmodel/MovieViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.viewmodel 2 | 3 | import android.app.Application 4 | import android.widget.Toast 5 | import androidx.lifecycle.* 6 | import com.ellison.composemovie.R 7 | import com.ellison.composemovie.bean.* 8 | import com.ellison.composemovie.model.RemoteMovieData 9 | import com.ellison.composemovie.util.Utils 10 | 11 | class MovieViewModel(application: Application) : AndroidViewModel(application) { 12 | private val remoteMovieData = RemoteMovieData.getInstance(application.applicationContext) 13 | 14 | private var movieLiveData = MutableLiveData>() 15 | private var movieProLiveData = MutableLiveData() 16 | 17 | val movies: LiveData> = movieLiveData 18 | val moviePro: LiveData = movieProLiveData 19 | 20 | suspend fun searchMoviesComposeCoroutines(keyWorld: String) { 21 | Utils.logDebug(Utils.TAG_SEARCH, "MovieModel searchMoviesComposeCoroutines with keyWord:$keyWorld") 22 | if (!Utils.ensureNetworkAvailable(getApplication())) return 23 | 24 | val gotMovies = remoteMovieData?.searchMoviesByCoroutines(keyWorld)?.Search 25 | Utils.logDebug( 26 | Utils.TAG_SEARCH, 27 | "MovieModel searchMoviesCoroutines gotMovies:$gotMovies" 28 | ) 29 | 30 | if (gotMovies != null) 31 | movieLiveData.value = gotMovies 32 | else 33 | Toast.makeText(getApplication(), R.string.search_none, Toast.LENGTH_SHORT) 34 | .show() 35 | } 36 | 37 | suspend fun getMovieComposeCoroutines(id: String) { 38 | Utils.logDebug(Utils.TAG_SEARCH, "MovieModel getMovieComposeCoroutines with id:$id") 39 | if (!Utils.ensureNetworkAvailable(getApplication())) return 40 | 41 | val gotMovie = remoteMovieData?.getMovieByCoroutines(id) 42 | Utils.logDebug(Utils.TAG_SEARCH, "MovieModel getMovieComposeCoroutines movie:$gotMovie") 43 | 44 | if (gotMovie != null) 45 | movieProLiveData.value = gotMovie 46 | else 47 | Toast.makeText(getApplication(), R.string.search_none, Toast.LENGTH_SHORT) 48 | .show() 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/model/RemoteMovieData.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.model 2 | 3 | import android.content.Context 4 | import com.ellison.composemovie.bean.* 5 | import com.ellison.composemovie.constant.Constants 6 | import com.ellison.composemovie.util.Utils 7 | import kotlin.jvm.Volatile 8 | import retrofit2.Retrofit 9 | import retrofit2.converter.gson.GsonConverterFactory 10 | import okhttp3.OkHttpClient 11 | import okhttp3.logging.HttpLoggingInterceptor 12 | 13 | 14 | class RemoteMovieData private constructor(context: Context) { 15 | private val movieInterface: MovieService 16 | private val context: Context 17 | 18 | suspend fun searchMoviesByCoroutines(keyWorld: String): MovieResponse> { 19 | Utils.logDebug(Utils.TAG_NETWORK, "searchMoviesByCoroutines:$keyWorld") 20 | return movieInterface?.requestSearchByCoroutines(keyWorld, Constants.OMDB_API_KEY) 21 | } 22 | 23 | suspend fun getMovieByCoroutines(movieID: String): MoviePro { 24 | Utils.logDebug(Utils.TAG_NETWORK, "getMovieByCoroutines:$movieID") 25 | return movieInterface?.requestDetailByCoroutines(movieID, Constants.OMDB_API_KEY) 26 | } 27 | 28 | companion object { 29 | @Volatile 30 | private var sInstance: RemoteMovieData? = null 31 | 32 | fun getInstance(context: Context): RemoteMovieData? { 33 | if (sInstance == null) { 34 | synchronized(RemoteMovieData::class.java) { 35 | if (sInstance == null) { 36 | sInstance = RemoteMovieData(context) 37 | } 38 | } 39 | } 40 | return sInstance 41 | } 42 | } 43 | 44 | init { 45 | val logging = HttpLoggingInterceptor() 46 | logging.setLevel(HttpLoggingInterceptor.Level.BASIC) 47 | val httpClient = OkHttpClient.Builder() 48 | httpClient.addInterceptor(logging) 49 | 50 | val retrofit = Retrofit.Builder() 51 | .baseUrl(Constants.OMDB_URL) 52 | .addConverterFactory(GsonConverterFactory.create()) 53 | .build() 54 | movieInterface = retrofit.create(MovieService::class.java) 55 | this.context = context 56 | } 57 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ComposeMovie 3 | 4 | Search movie 5 | Movie store 6 | Favourite movies 7 | My Profile 8 | 9 | OK 10 | Warning 11 | Got no movie or too large result. 12 | Check network please. 13 | 14 | Movie list 15 | 16 | Keyword 17 | Input something 18 | Input keyword please 19 | 20 | Buy 21 | Rent 22 | 23 | King of comedy 24 | Stephen Chow, Ng Man Tat 25 | https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2579932167.webp 26 | 1999 27 | 28 | Kung fu 29 | Stephen Chow, Danny Chan 30 | https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2219011938.webp 31 | 2004 32 | 33 | Tech Merger 34 | Stay hungry, stay foolish. 35 | TM 36 | Online 37 | "https://blog.csdn.net/allisonchen" 38 | 39 | Nick name 40 | Status 41 | SNS 42 | Edit 43 | 44 | Find 45 | Store 46 | Recommend movies 47 | Favourite 48 | Profile 49 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/LoadImage.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.animation.Crossfade 4 | import androidx.compose.foundation.Image 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.layout.Spacer 7 | import androidx.compose.foundation.layout.fillMaxSize 8 | import androidx.compose.material.MaterialTheme 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.Modifier 11 | import androidx.compose.ui.graphics.Color 12 | import androidx.compose.ui.layout.ContentScale 13 | import androidx.compose.ui.res.painterResource 14 | import com.ellison.composemovie.R 15 | import com.ellison.composemovie.ui.theme.compositedOnSurface 16 | import com.ellison.composemovie.util.Utils 17 | import com.google.accompanist.coil.rememberCoilPainter 18 | import com.google.accompanist.imageloading.ImageLoadState 19 | 20 | @Composable 21 | fun LoadImage( 22 | url: String, 23 | contentDescription: String?, 24 | modifier: Modifier = Modifier, 25 | contentScale: ContentScale = ContentScale.Crop, 26 | placeholderColor: Color? = MaterialTheme.colors.compositedOnSurface(0.2f) 27 | ) { 28 | val coilPainter = rememberCoilPainter(request = url ) 29 | Image( 30 | painter = coilPainter, 31 | modifier = modifier, 32 | contentDescription = contentDescription, 33 | contentScale = contentScale, 34 | // fadeIn = true, 35 | ) 36 | Crossfade(coilPainter.loadState) { state -> 37 | when (state) { 38 | is ImageLoadState.Loading -> { 39 | Utils.logDebug(Utils.TAG_NETWORK, "Image loading") 40 | if (placeholderColor != null) { 41 | Spacer( 42 | modifier = Modifier 43 | .fillMaxSize() 44 | .background(placeholderColor) 45 | ) 46 | } 47 | } 48 | is ImageLoadState.Error -> { 49 | Utils.logDebug( 50 | Utils.TAG_NETWORK, 51 | "Image error msg: "/*, it.throwable*/ 52 | ) 53 | Image(painterResource(R.drawable.ic_error), contentDescription = "Error") 54 | } 55 | is ImageLoadState.Success -> { 56 | Utils.logDebug( 57 | Utils.TAG_NETWORK, 58 | "Image succeed with source:${coilPainter }" 59 | ) 60 | } 61 | ImageLoadState.Empty -> Utils.logDebug(Utils.TAG_NETWORK, "Image empty") 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/bean/Movie.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.bean 2 | 3 | data class Movie ( 4 | var Title: String, 5 | var Year: String, 6 | var imdbID: String, 7 | var Type: String = "", 8 | var Poster: String 9 | ) 10 | 11 | val recommendedMovies = listOf( 12 | Movie( 13 | "Nomadland", 14 | "2020", 15 | "tt9770150", 16 | "movie", 17 | "https://img9.doubanio.com/view/photo/l/public/p2632272094.webp" 18 | // "https://m.media-amazon.com/images/M/MV5BMDRiZWUxNmItNDU5Yy00ODNmLTk0M2ItZjQzZTA5OTJkZjkyXkEyXkFqcGdeQXVyMTkxNjUyNQ@@._V1_SX300.jpg" 19 | ), 20 | Movie( 21 | "Soul", 22 | "2020", 23 | "tt2948372", 24 | "movie", 25 | "https://img2.doubanio.com/view/photo/l/public/p2623266612.webp" 26 | // "https://m.media-amazon.com/images/M/MV5BZGE1MDg5M2MtNTkyZS00MTY5LTg1YzUtZTlhZmM1Y2EwNmFmXkEyXkFqcGdeQXVyNjA3OTI0MDc@._V1_SX300.jpg" 27 | ),Movie( 28 | "Spider-Man: Into the Spider-Verse", 29 | "2018", 30 | "tt4633694", 31 | "movie", 32 | "https://m.media-amazon.com/images/M/MV5BMjMwNDkxMTgzOF5BMl5BanBnXkFtZTgwNTkwNTQ3NjM@._V1_SX300.jpg" 33 | ) 34 | ) 35 | 36 | val testMovies = listOf( 37 | Movie( 38 | "Bruce Lee: A Warrior's Journey", 39 | "2000", 40 | "tt0297814", 41 | "movie", 42 | "https://m.media-amazon.com/images/M/MV5BMTI4MDYzMTAxNF5BMl5BanBnXkFtZTcwMTE4MjAyMQ@@._V1_SX300.jpg" 43 | ),Movie( 44 | "Dragon: The Bruce Lee Story", 45 | "1993", 46 | "tt0106770", 47 | "movie", 48 | "https://m.media-amazon.com/images/M/MV5BMjA1MTQxNzAtM2MyOC00NDBhLWFlNmEtOWZlM2E5MjNlODU2XkEyXkFqcGdeQXVyNDAxNjkxNjQ@._V1_SX300.jpg" 49 | ), 50 | 51 | Movie( 52 | "I Am Bruce Lee", 53 | "2012", 54 | "tt1954299", 55 | "movie", 56 | "https://m.media-amazon.com/images/M/MV5BMTcyNTgzMzUwNl5BMl5BanBnXkFtZTcwMDU1MTkyNw@@._V1_SX300.jpg" 57 | ) 58 | ) 59 | 60 | val testMovies2 = listOf( 61 | Movie( 62 | "Harry Potter and the Deathly Hallows: Part 2", 63 | "2011", 64 | "tt1201607", 65 | "movie", 66 | "https://m.media-amazon.com/images/M/MV5BMGVmMWNiMDktYjQ0Mi00MWIxLTk0N2UtN2ZlYTdkN2IzNDNlXkEyXkFqcGdeQXVyODE5NzE3OTE@._V1_SX300.jpg" 67 | ),Movie( 68 | "Harry Potter and the Sorcerer's Stone", 69 | "2001", 70 | "tt0241527", 71 | "movie", 72 | "https://m.media-amazon.com/images/M/MV5BNjQ3NWNlNmQtMTE5ZS00MDdmLTlkZjUtZTBlM2UxMGFiMTU3XkEyXkFqcGdeQXVyNjUwNzk3NDc@._V1_SX300.jpg" 73 | ), 74 | 75 | Movie( 76 | "Harry Potter and the Chamber of Secrets", 77 | "2002", 78 | "tt0295297", 79 | "movie", 80 | "https://m.media-amazon.com/images/M/MV5BMTcxODgwMDkxNV5BMl5BanBnXkFtZTYwMDk2MDg3._V1_SX300.jpg" 81 | ) 82 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Favourite.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.foundation.border 4 | import androidx.compose.foundation.clickable 5 | import androidx.compose.foundation.layout.* 6 | import androidx.compose.foundation.lazy.LazyColumn 7 | import androidx.compose.material.Card 8 | import androidx.compose.material.MaterialTheme 9 | import androidx.compose.material.Text 10 | import androidx.compose.runtime.Composable 11 | import androidx.compose.ui.Alignment 12 | import androidx.compose.ui.Modifier 13 | import androidx.compose.ui.draw.shadow 14 | import androidx.compose.ui.graphics.Color 15 | import androidx.compose.ui.layout.ContentScale 16 | import androidx.compose.ui.tooling.preview.Preview 17 | import androidx.compose.ui.unit.dp 18 | import com.ellison.composemovie.bean.* 19 | import com.ellison.composemovie.ui.theme.* 20 | 21 | @Preview(showBackground = true) 22 | @Composable 23 | fun FavouritePreview() { 24 | Favourite(moviePros = favouriteMovies, onClick = { }) 25 | } 26 | 27 | @Composable 28 | fun Favourite(moviePros: List, onClick: () -> Unit) { 29 | LazyColumn(modifier = Modifier.padding(top = 2.dp)) { 30 | items(moviePros.size) { 31 | LikeItem( 32 | moviePro = moviePros[it], 33 | onClick 34 | ) 35 | } 36 | } 37 | 38 | } 39 | 40 | @Composable 41 | fun LikeItem(moviePro: MoviePro, onClick: () -> Unit) { 42 | Box( 43 | modifier = Modifier 44 | .wrapContentSize() 45 | .padding(8.dp) 46 | ) { 47 | Card( 48 | modifier = Modifier 49 | .border(1.dp, Color.Gray, shape = MaterialTheme.shapes.small) 50 | .shadow(4.dp), 51 | shape = shapes.small, 52 | elevation = 8.dp, 53 | backgroundColor = itemCardColor 54 | ) { 55 | // Horizontal layout 56 | Row( 57 | modifier = Modifier 58 | .clickable(onClick = onClick) 59 | .fillMaxWidth() 60 | .height(100.dp), 61 | verticalAlignment = Alignment.CenterVertically 62 | ) { 63 | LoadImage( 64 | url = moviePro.Poster, 65 | modifier = Modifier 66 | .width(80.dp) 67 | .height(100.dp), 68 | contentScale = ContentScale.FillBounds, 69 | contentDescription = moviePro.Title 70 | ) 71 | 72 | Spacer(Modifier.sizeIn(16.dp)) 73 | 74 | Column(modifier = Modifier.padding(8.dp)) { 75 | Text( 76 | text = moviePro.Title, 77 | style = MaterialTheme.typography.h6, 78 | color = nameColor, 79 | ) 80 | 81 | Text( 82 | text = moviePro.Type, 83 | style = MaterialTheme.typography.caption, 84 | color = nameColor, 85 | ) 86 | 87 | Text( 88 | text = moviePro.Year, 89 | style = MaterialTheme.typography.caption, 90 | color = nameColor, 91 | ) 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/bean/MoviePro.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.bean 2 | 3 | data class MoviePro ( 4 | var Title: String, 5 | var Year: String = "", 6 | var Rated: String = "", 7 | var Released: String = "", 8 | var Runtime: String = "", 9 | var Genre: String = "", 10 | var Director: String = "", 11 | var Writer: String = "", 12 | var Actors: String = "", 13 | var Plot: String = "", 14 | var Language: String = "", 15 | var Country: String = "", 16 | var Poster: String = "", 17 | var Metascore: String = "", 18 | var imdbRating: String = "", 19 | var imdbVotes: String = "", 20 | var imdbID: String = "", 21 | var Type: String = "", 22 | var DVD: String = "", 23 | var BoxOffice: String = "", 24 | var Production: String = "", 25 | var Website: String = "", 26 | var Response: String = "" 27 | ) { 28 | override fun toString(): String { 29 | return "MovieProResponse{" + 30 | "Title='" + Title + '\'' + 31 | ", Year='" + Year + '\'' + 32 | ", Rated='" + Rated + '\'' + 33 | ", Released='" + Released + '\'' + 34 | ", Runtime='" + Runtime + '\'' + 35 | ", Genre='" + Genre + '\'' + 36 | ", Director='" + Director + '\'' + 37 | ", Writer='" + Writer + '\'' + 38 | ", Actors='" + Actors + '\'' + 39 | ", Plot='" + Plot + '\'' + 40 | ", Language='" + Language + '\'' + 41 | ", Country='" + Country + '\'' + 42 | ", Poster='" + Poster + '\'' + 43 | ", Metascore='" + Metascore + '\'' + 44 | ", imdbRating='" + imdbRating + '\'' + 45 | ", imdbVotes='" + imdbVotes + '\'' + 46 | ", imdbID='" + imdbID + '\'' + 47 | ", Type='" + Type + '\'' + 48 | ", DVD='" + DVD + '\'' + 49 | ", BoxOffice='" + BoxOffice + '\'' + 50 | ", Production='" + Production + '\'' + 51 | ", Website='" + Website + '\'' + 52 | ", Response='" + Response + '\'' + 53 | '}' 54 | } 55 | } 56 | 57 | val testMoviePro = 58 | MoviePro( 59 | "Harry Potter Part 2", 60 | "2011", 61 | "PG-13", 62 | "15 Jul 2011", 63 | "130 min", 64 | "Adventure, Drama, Fantasy, Mystery", 65 | "David Yates", 66 | "Steve Kloves (screenplay), J.K. Rowling (novel)", 67 | "Ralph Fiennes, Michael Gambon, Alan Rickman, Daniel Radcliffe", 68 | "Harry, Ron, and Hermione search for Voldemort's remaining Horcruxes in their effort to destroy the Dark Lord as the final battle rages on at Hogwarts.", 69 | "English", 70 | "UK", 71 | // "Nominated for 3 Oscars. Another 46 wins & 91 nominations.", 72 | "https://m.media-amazon.com/images/M/MV5BMGVmMWNiMDktYjQ0Mi00MWIxLTk0N2UtN2ZlYTdkN2IzNDNlXkEyXkFqcGdeQXVyODE5NzE3OTE@._V1_SX300.jpg", 73 | "85", 74 | "8.1", 75 | "766,594", 76 | "tt1201607", 77 | "movie", 78 | "24 Jul 2014", 79 | "$381,409,310", 80 | "Heyday Films, Moving Picture Company, Warner Bros.", 81 | "N/A", 82 | "true" 83 | ) 84 | 85 | val favouriteMovies = listOf( 86 | MoviePro( 87 | "Harry Potter Part 2", 88 | "2011", 89 | "PG-13", 90 | "15 Jul 2011", 91 | "130 min", 92 | "Adventure, Drama, Fantasy, Mystery", 93 | "David Yates", 94 | "Steve Kloves (screenplay), J.K. Rowling (novel)", 95 | "Ralph Fiennes, Michael Gambon, Alan Rickman, Daniel Radcliffe", 96 | "Harry, Ron, and Hermione search for Voldemort's remaining Horcruxes in their effort to destroy the Dark Lord as the final battle rages on at Hogwarts.", 97 | "English", 98 | "UK", 99 | // "Nominated for 3 Oscars. Another 46 wins & 91 nominations.", 100 | "https://m.media-amazon.com/images/M/MV5BMGVmMWNiMDktYjQ0Mi00MWIxLTk0N2UtN2ZlYTdkN2IzNDNlXkEyXkFqcGdeQXVyODE5NzE3OTE@._V1_SX300.jpg", 101 | "85", 102 | "8.1", 103 | "766,594", 104 | "tt1201607", 105 | "movie", 106 | "24 Jul 2014", 107 | "$381,409,310", 108 | "Heyday Films, Moving Picture Company, Warner Bros.", 109 | "N/A", 110 | "true" 111 | ), 112 | MoviePro( 113 | "Spider-Man: Into the Spider-Verse", 114 | "2018", 115 | imdbID = "tt4633694", 116 | Type = "movie", 117 | Poster = "https://m.media-amazon.com/images/M/MV5BMjMwNDkxMTgzOF5BMl5BanBnXkFtZTgwNTkwNTQ3NjM@._V1_SX300.jpg" 118 | ), 119 | MoviePro( 120 | "Soul", 121 | "2020", 122 | imdbID = "tt2948372", 123 | Type = "movie", 124 | Poster = "https://img2.doubanio.com/view/photo/l/public/p2623266612.webp" 125 | ) 126 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Store.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.foundation.layout.Box 4 | import androidx.compose.foundation.layout.Column 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.Image 7 | import androidx.compose.foundation.layout.fillMaxWidth 8 | import androidx.compose.foundation.layout.width 9 | import androidx.compose.foundation.layout.height 10 | import androidx.compose.foundation.border 11 | import androidx.compose.foundation.layout.wrapContentSize 12 | import androidx.compose.foundation.layout.wrapContentWidth 13 | import androidx.compose.foundation.rememberScrollState 14 | import androidx.compose.foundation.verticalScroll 15 | import androidx.compose.foundation.layout.sizeIn 16 | import androidx.compose.foundation.layout.padding 17 | import androidx.compose.foundation.layout.Row 18 | import androidx.compose.foundation.layout.Spacer 19 | 20 | import androidx.compose.material.Card 21 | import androidx.compose.ui.draw.shadow 22 | import androidx.compose.material.Text 23 | import androidx.compose.material.MaterialTheme 24 | import androidx.compose.runtime.Composable 25 | import androidx.compose.foundation.lazy.LazyRow 26 | import androidx.compose.foundation.shape.RoundedCornerShape 27 | import androidx.compose.ui.Alignment 28 | import androidx.compose.ui.graphics.Color 29 | import androidx.compose.ui.Modifier 30 | import androidx.compose.ui.layout.ContentScale 31 | import androidx.compose.ui.res.painterResource 32 | import androidx.compose.ui.tooling.preview.Preview 33 | import androidx.compose.ui.res.stringResource 34 | import androidx.compose.ui.text.style.TextOverflow 35 | import androidx.compose.ui.unit.Dp 36 | import androidx.compose.ui.unit.dp 37 | import androidx.compose.ui.unit.sp 38 | import com.ellison.composemovie.R 39 | import com.ellison.composemovie.bean.* 40 | 41 | @Preview(showBackground = true) 42 | @Composable 43 | fun StorePreview() { 44 | Store() 45 | } 46 | 47 | @Composable 48 | fun Store() { 49 | Column(Modifier.verticalScroll(rememberScrollState())) { 50 | Spacer(Modifier.sizeIn(16.dp)) 51 | Text( 52 | modifier = Modifier.padding(6.dp), 53 | style = MaterialTheme.typography.h6, 54 | text = stringResource(id = R.string.tab_store_recommend) 55 | ) 56 | 57 | Spacer(Modifier.sizeIn(16.dp)) 58 | MovieGallery(recommendedMovies, width = 220.dp, height = 190.dp) 59 | 60 | CastGroup(cast = testCast1) 61 | CastGroup(cast = testCast2) 62 | 63 | // Ensure list is totally seen. 64 | Spacer(Modifier.sizeIn(64.dp)) 65 | } 66 | } 67 | 68 | @Composable 69 | fun CastGroup(cast: Cast) { 70 | Column { 71 | Spacer(Modifier.sizeIn(32.dp)) 72 | CastCategory(cast) 73 | Spacer(Modifier.sizeIn(6.dp)) 74 | MovieGallery(cast.movies) 75 | } 76 | } 77 | 78 | @Composable 79 | fun CastCategory(cast: Cast) { 80 | Row( 81 | modifier = Modifier 82 | .height(40.dp) 83 | .padding(16.dp, 2.dp, 2.dp, 16.dp) 84 | ) { 85 | Card( 86 | modifier = Modifier.wrapContentSize(), 87 | shape = RoundedCornerShape(50), 88 | elevation = 8.dp 89 | ) { 90 | Image( 91 | painterResource(id = cast.Icon), 92 | contentDescription = cast.Name, 93 | ) 94 | } 95 | 96 | Spacer(Modifier.sizeIn(4.dp)) 97 | 98 | Text( 99 | cast.Name, 100 | style = MaterialTheme.typography.h6, 101 | modifier = Modifier.wrapContentWidth() 102 | ) 103 | } 104 | } 105 | 106 | @Composable 107 | fun MovieGallery(movies: List, width: Dp = 130.dp, height: Dp = 136.dp) { 108 | LazyRow(modifier = Modifier.padding(top = 2.dp)) { 109 | items(movies.size) { 110 | RowItem( 111 | modifier = Modifier.padding(start = 8.dp), 112 | width, 113 | height, 114 | movie = movies[it] 115 | ) 116 | } 117 | } 118 | } 119 | 120 | @Composable 121 | fun RowItem(modifier: Modifier, width: Dp = 130.dp, height: Dp = 1306.dp, movie: Movie) { 122 | Card( 123 | modifier = modifier 124 | .padding(4.dp) 125 | .width(width) 126 | .height(height + 6.dp) 127 | .border(0.5.dp, Color.Gray, shape = MaterialTheme.shapes.small) 128 | .shadow(4.dp), 129 | shape = MaterialTheme.shapes.small, 130 | ) { 131 | 132 | Box { 133 | LoadImage( 134 | url = movie.Poster, 135 | modifier = Modifier 136 | .width(width) 137 | .height(height), 138 | contentScale = ContentScale.FillBounds, 139 | contentDescription = movie.Title 140 | ) 141 | Text( 142 | text = movie.Title, 143 | fontSize = 8.sp, 144 | style = MaterialTheme.typography.caption, 145 | modifier = Modifier 146 | .background(MaterialTheme.colors.background) 147 | .fillMaxWidth() 148 | .align(Alignment.BottomStart) 149 | .padding(4.dp), 150 | overflow = TextOverflow.Ellipsis, 151 | maxLines = 1 152 | ) 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | def android_builder_version = "4.0.1" 6 | 7 | ext { 8 | android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0]) 9 | android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1]) 10 | } 11 | 12 | android { 13 | this.rootProject.buildscript.configurations.classpath 14 | .resolvedConfiguration 15 | .firstLevelModuleDependencies. 16 | each { 17 | def name = it.name 18 | if (name.contains('com.android.tools.build:gradle')) { 19 | def moduleVersion = it.moduleVersion 20 | if (moduleVersion.contains("-")) { 21 | def alphaversionArray = moduleVersion.split("-")[0] 22 | def versionArray = alphaversionArray.toString().split("\\.") 23 | ext.android_builder_main_version = Integer.parseInt(versionArray[0]) 24 | ext.android_builder_mid_version = Integer.parseInt(versionArray[1]) 25 | } else { 26 | version = moduleVersion 27 | android_builder_version = moduleVersion 28 | ext.android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0]) 29 | ext.android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1]) 30 | } 31 | } 32 | } 33 | compileSdkVersion 30 34 | buildToolsVersion "30.0.3" 35 | 36 | defaultConfig { 37 | applicationId "com.ellison.composemovie" 38 | minSdkVersion 27 39 | targetSdkVersion 30 40 | versionCode 1 41 | versionName "1.0" 42 | 43 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 44 | } 45 | 46 | buildTypes { 47 | release { 48 | minifyEnabled false 49 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 50 | } 51 | } 52 | compileOptions { 53 | sourceCompatibility JavaVersion.VERSION_1_8 54 | targetCompatibility JavaVersion.VERSION_1_8 55 | } 56 | kotlinOptions { 57 | jvmTarget = '1.8' 58 | } 59 | 60 | buildFeatures { 61 | viewBinding true 62 | dataBinding true 63 | if (android_builder_main_version >= 7 || (android_builder_main_version > 4 && android_builder_mid_version > 1)) { 64 | compose true 65 | } 66 | // Disable unused AGP features 67 | buildConfig false 68 | aidl false 69 | renderScript false 70 | resValues false 71 | shaders false 72 | } 73 | 74 | composeOptions { 75 | kotlinCompilerExtensionVersion compose_version 76 | kotlinCompilerVersion kotlin_version 77 | } 78 | 79 | packagingOptions { 80 | // Multiple dependency bring these files in. Exclude them to enable 81 | // our test APK to build (has no effect on our AARs) 82 | excludes += "/META-INF/AL2.0" 83 | excludes += "/META-INF/LGPL2.1" 84 | } 85 | } 86 | 87 | dependencies { 88 | testImplementation 'junit:junit:4.+' 89 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 90 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 91 | 92 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 93 | implementation 'androidx.core:core-ktx:1.3.2' 94 | 95 | implementation 'com.google.android.material:material:1.2.1' 96 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 97 | 98 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" 99 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" 100 | 101 | implementation 'com.squareup.retrofit2:retrofit:2.9.0' 102 | implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2' 103 | 104 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 105 | 106 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0' 107 | implementation "androidx.lifecycle:lifecycle-livedata:2.1.0" 108 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0' 109 | implementation "androidx.lifecycle:lifecycle-extensions:2.1.0" 110 | 111 | //Compose 112 | if (android_builder_main_version < 7) { 113 | add("kotlinCompilerPluginClasspath", "androidx.compose.compiler:compiler:$compose_version") 114 | } 115 | 116 | implementation "androidx.appcompat:appcompat:$compose_appcompat_version" 117 | implementation "androidx.activity:activity-compose:$compose_activity_version" 118 | implementation "androidx.compose.ui:ui:$compose_version" 119 | implementation "androidx.compose.material:material:$compose_version" 120 | implementation "androidx.compose.material:material-icons-extended:$compose_version" 121 | implementation "androidx.compose.ui:ui-tooling:$compose_version" 122 | 123 | implementation "androidx.navigation:navigation-compose:$compose_navigation_version" 124 | 125 | implementation "androidx.compose.runtime:runtime:$compose_version" 126 | implementation "androidx.compose.runtime:runtime-livedata:$compose_version" 127 | 128 | 129 | // google.accompanist replace chrisbanes.accompanist !!! 130 | // implementation "dev.chrisbanes.accompanist:accompanist-coil:$compose_utils_chrisbanes_coil" 131 | 132 | implementation "com.google.accompanist:accompanist-coil:$compose_accompanist_version" 133 | // implementation "com.google.accompanist:accompanist-insets:$compose_accompanist_version" 134 | // implementation "com.google.accompanist:accompanist-insets-ui:$compose_accompanist_version" 135 | // implementation "com.google.accompanist:accompanist-pager:$compose_accompanist_version" 136 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Profile.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.foundation.Image 5 | import androidx.compose.foundation.layout.paddingFromBaseline 6 | import androidx.compose.foundation.layout.BoxWithConstraints 7 | import androidx.compose.foundation.layout.fillMaxWidth 8 | import androidx.compose.foundation.layout.fillMaxSize 9 | import androidx.compose.foundation.layout.height 10 | import androidx.compose.foundation.rememberScrollState 11 | import androidx.compose.foundation.verticalScroll 12 | import androidx.compose.foundation.layout.padding 13 | import androidx.compose.foundation.layout.Spacer 14 | 15 | import androidx.compose.material.Text 16 | import androidx.compose.ui.graphics.Color 17 | import androidx.compose.ui.res.painterResource 18 | import androidx.compose.ui.res.stringResource 19 | import androidx.compose.ui.unit.dp 20 | import androidx.compose.foundation.ScrollState 21 | 22 | import androidx.compose.foundation.layout.heightIn 23 | 24 | import androidx.compose.material.Button 25 | import androidx.compose.material.ContentAlpha 26 | import androidx.compose.material.Divider 27 | 28 | 29 | import androidx.compose.material.LocalContentAlpha 30 | import androidx.compose.material.MaterialTheme 31 | import androidx.compose.material.Surface 32 | import androidx.compose.runtime.Composable 33 | import androidx.compose.runtime.CompositionLocalProvider 34 | import androidx.compose.ui.Modifier 35 | import androidx.compose.ui.layout.ContentScale 36 | import androidx.compose.ui.platform.LocalDensity 37 | import androidx.compose.ui.tooling.preview.Preview 38 | import androidx.compose.ui.unit.Dp 39 | 40 | import com.ellison.composemovie.R 41 | import com.ellison.composemovie.bean.Account 42 | import com.ellison.composemovie.bean.myAccount 43 | import com.ellison.composemovie.ui.theme.shapes 44 | 45 | @Preview(showBackground = true) 46 | @Composable 47 | fun ProfilePreview() { 48 | Profile(myAccount) 49 | } 50 | 51 | @Composable 52 | fun Profile(account: Account) { 53 | val scrollState = rememberScrollState() 54 | 55 | Column(modifier = Modifier.fillMaxSize()) { 56 | BoxWithConstraints(modifier = Modifier.weight(1f)) { 57 | Surface { 58 | Column( 59 | modifier = Modifier 60 | .fillMaxSize() 61 | .verticalScroll(scrollState), 62 | ) { 63 | ProfileHeader( 64 | scrollState, 65 | this@BoxWithConstraints.maxHeight, 66 | account.Post 67 | ) 68 | // Spacer(modifier = Modifier.height(2.dp)) 69 | 70 | NameAndPosition( 71 | stringResource(id = account.FullName), 72 | stringResource(id = account.About) 73 | ) 74 | 75 | ProfileProperty( 76 | stringResource(R.string.display_name), 77 | stringResource(id = account.NickName) 78 | ) 79 | 80 | // ProfileProperty( 81 | // stringResource(R.string.status), 82 | // stringResource(id = account.Status) 83 | // ) 84 | 85 | ProfileProperty( 86 | stringResource(R.string.sns), 87 | stringResource(id = account.Sns), 88 | isLink = true 89 | ) 90 | 91 | EditProfile() 92 | } 93 | } 94 | } 95 | } 96 | } 97 | 98 | @Composable 99 | private fun ProfileHeader( 100 | scrollState: ScrollState, 101 | containerHeight: Dp, 102 | post: Int 103 | ) { 104 | val offset = (scrollState.value / 2) 105 | val offsetDp = with(LocalDensity.current) { offset.toDp() } 106 | 107 | Image( 108 | modifier = Modifier 109 | .heightIn(max = containerHeight / 2) 110 | .fillMaxWidth() 111 | .padding(top = offsetDp), 112 | painter = painterResource(id = post), 113 | contentScale = ContentScale.Crop, 114 | contentDescription = null 115 | ) 116 | } 117 | 118 | @Composable 119 | private fun NameAndPosition(name: String, position: String) { 120 | Column(modifier = Modifier.padding(horizontal = 16.dp)) { 121 | Name( 122 | name, 123 | modifier = Modifier.paddingFromBaseline(32.dp) 124 | ) 125 | Position( 126 | position, 127 | modifier = Modifier 128 | .padding(bottom = 20.dp) 129 | .paddingFromBaseline(24.dp) 130 | ) 131 | } 132 | } 133 | 134 | @Composable 135 | private fun Name(name: String, modifier: Modifier = Modifier) { 136 | Text( 137 | text = name, 138 | modifier = modifier, 139 | style = MaterialTheme.typography.h5 140 | ) 141 | } 142 | 143 | @Composable 144 | private fun Position(position: String, modifier: Modifier = Modifier) { 145 | CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { 146 | Text( 147 | text = position, 148 | modifier = modifier, 149 | style = MaterialTheme.typography.body1 150 | ) 151 | } 152 | } 153 | 154 | @Composable 155 | fun ProfileProperty(label: String, value: String, isLink: Boolean = false) { 156 | Column(modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp)) { 157 | Divider() 158 | CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { 159 | Text( 160 | text = label, 161 | modifier = Modifier.paddingFromBaseline(24.dp), 162 | style = MaterialTheme.typography.caption 163 | ) 164 | } 165 | val style = if (isLink) { 166 | MaterialTheme.typography.body1.copy(color = Color.Blue) 167 | } else { 168 | MaterialTheme.typography.body1 169 | } 170 | Text( 171 | text = value, 172 | modifier = Modifier.paddingFromBaseline(24.dp), 173 | style = style 174 | ) 175 | } 176 | } 177 | 178 | @Composable 179 | private fun EditProfile() { 180 | Spacer(modifier = Modifier.height(16.dp)) 181 | Button( 182 | modifier = Modifier 183 | .fillMaxWidth() 184 | .padding(horizontal = 24.dp), 185 | onClick = {}, 186 | shape = shapes.large 187 | ) { 188 | Text( 189 | text = stringResource(id = R.string.btn_edit), 190 | ) 191 | } 192 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Find.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import android.util.Log 4 | import android.widget.Toast 5 | import androidx.compose.foundation.ExperimentalFoundationApi 6 | import androidx.compose.foundation.border 7 | import androidx.compose.foundation.clickable 8 | import androidx.compose.foundation.layout.* 9 | import androidx.compose.foundation.lazy.* 10 | import androidx.compose.material.* 11 | import androidx.compose.material.icons.Icons 12 | import androidx.compose.material.icons.outlined.Search 13 | import androidx.compose.runtime.* 14 | import androidx.compose.runtime.livedata.observeAsState 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.draw.shadow 17 | import androidx.compose.ui.graphics.Color 18 | import androidx.compose.ui.layout.ContentScale 19 | import androidx.compose.ui.platform.LocalContext 20 | import androidx.compose.ui.res.stringResource 21 | import androidx.compose.ui.text.TextStyle 22 | import androidx.compose.ui.text.font.FontFamily 23 | import androidx.compose.ui.text.input.TextFieldValue 24 | import androidx.compose.ui.text.style.TextOverflow 25 | import androidx.compose.ui.tooling.preview.Preview 26 | import androidx.compose.ui.unit.dp 27 | import androidx.compose.ui.unit.sp 28 | import com.ellison.composemovie.bean.Movie 29 | import com.ellison.composemovie.R 30 | import com.ellison.composemovie.bean.testMovies 31 | import com.ellison.composemovie.viewmodel.MovieViewModel 32 | import com.ellison.composemovie.ui.theme.editShapes 33 | import com.ellison.composemovie.ui.theme.itemCardColor 34 | import com.ellison.composemovie.ui.theme.nameColor 35 | import com.ellison.composemovie.ui.theme.pink900 36 | import com.ellison.composemovie.ui.theme.shapes 37 | import com.ellison.composemovie.util.Utils 38 | 39 | @ExperimentalFoundationApi 40 | @Composable 41 | fun Find(movieViewModel: MovieViewModel, onClick: (Movie) -> Unit) { 42 | val context = LocalContext.current.applicationContext 43 | val warningTip = stringResource(id = R.string.input_search_warning) 44 | var textFieldValue by remember { mutableStateOf(TextFieldValue("")) } 45 | var searchQuery by remember { mutableStateOf("") } 46 | 47 | if (!Utils.ensureNetworkAvailable(context, false)) 48 | ShowDialog(R.string.search_dialog_tip, R.string.search_failure) 49 | 50 | Column { 51 | Row() { 52 | TextField( 53 | value = textFieldValue, 54 | 55 | onValueChange = { 56 | textFieldValue = it 57 | Utils.logDebug(Utils.TAG_SEARCH, "input:$textFieldValue") 58 | }, 59 | 60 | modifier = Modifier 61 | // .fillMaxWidth(0.9f) 62 | .fillMaxWidth() 63 | // .fillMaxHeight(0.15f) 64 | .wrapContentHeight() 65 | .padding(6.dp), 66 | 67 | textStyle = TextStyle( 68 | fontSize = 24.sp, 69 | fontFamily = FontFamily.Monospace 70 | ), 71 | 72 | label = { 73 | Text(stringResource(id = R.string.input_label_search)) 74 | }, 75 | 76 | trailingIcon = { 77 | IconButton( 78 | onClick = { 79 | // Todo search by http 80 | Utils.logDebug( 81 | Utils.TAG_SEARCH, 82 | "search click with keyWord:$textFieldValue" 83 | ) 84 | 85 | if (textFieldValue.text.length > 1) { 86 | searchQuery = textFieldValue.text 87 | } else Toast.makeText( 88 | context, 89 | warningTip, 90 | Toast.LENGTH_SHORT 91 | ).show() 92 | } 93 | ) { 94 | Icon(Icons.Outlined.Search, "search", tint = Color.White) 95 | } 96 | }, 97 | singleLine = true, 98 | 99 | shape = editShapes.large, 100 | 101 | colors = TextFieldDefaults.textFieldColors( 102 | focusedIndicatorColor = Color.Blue, 103 | focusedLabelColor = Color.Blue, 104 | backgroundColor = pink900, 105 | cursorColor = Color.White, 106 | textColor = Color.White, 107 | unfocusedLabelColor = Color.LightGray 108 | ) 109 | ) 110 | } 111 | 112 | LaunchedEffect(searchQuery) { 113 | Utils.logDebug(Utils.TAG_SEARCH, "searchQuery updated:$searchQuery") 114 | if (searchQuery.length > 0) { 115 | movieViewModel.searchMoviesComposeCoroutines(searchQuery) 116 | } 117 | } 118 | val moviesData: State> = movieViewModel.movies.observeAsState(emptyList()) 119 | val movies = moviesData.value 120 | val scrollState = rememberLazyListState() 121 | 122 | LazyVerticalGrid( 123 | modifier = Modifier 124 | .fillMaxWidth() 125 | .padding(2.dp), 126 | // cells = GridCells.Adaptive(minSize = 128.dp), 127 | cells = GridCells.Fixed(3), 128 | state = scrollState, 129 | contentPadding = PaddingValues(2.dp) 130 | ) { 131 | items(movies) { movie -> 132 | MovieThumbnail(movie, onClick = { onClick(movie) }) 133 | } 134 | } 135 | 136 | } 137 | } 138 | 139 | @Preview(showBackground = true) 140 | @Composable 141 | fun MovieThumbnailPreview() { 142 | MovieThumbnail(movie = testMovies.last(), onClick = {}) 143 | } 144 | 145 | @Composable 146 | fun MovieThumbnail(movie: Movie, onClick: () -> Unit) { 147 | Log.d("Compose", "id:${movie.imdbID}") 148 | Box( 149 | modifier = Modifier 150 | .wrapContentSize() 151 | .padding(8.dp) 152 | ) { 153 | Card( 154 | modifier = Modifier 155 | .border(0.5.dp, Color.Gray, shape = MaterialTheme.shapes.small) 156 | .shadow(4.dp), 157 | shape = shapes.small, 158 | elevation = 8.dp, 159 | backgroundColor = itemCardColor 160 | ) { 161 | // Vertical layout 162 | Column( 163 | modifier = Modifier 164 | .clickable(onClick = onClick) 165 | .wrapContentSize() 166 | ) { 167 | val contentWidth = 100.dp 168 | val contentHeight = 141.dp 169 | 170 | LoadImage( 171 | url = movie.Poster, 172 | modifier = Modifier 173 | .width(contentWidth) 174 | .height(contentHeight), 175 | contentScale = ContentScale.FillWidth, 176 | contentDescription = movie.Title 177 | ) 178 | 179 | // Spacer(Modifier.sizeIn(2.dp)) 180 | 181 | Text( 182 | // text = stringResource(id = movie.name), 183 | text = movie.Title, 184 | fontSize = 11.sp, 185 | modifier = Modifier 186 | .width(contentWidth) 187 | .padding(3.dp), 188 | // textAlign = TextAlign.Center, 189 | style = MaterialTheme.typography.h6, 190 | color = nameColor, 191 | overflow = TextOverflow.Ellipsis, 192 | maxLines = 1 193 | ) 194 | } 195 | } 196 | } 197 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Detail.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.compose.foundation.layout.* 4 | import androidx.compose.foundation.rememberScrollState 5 | import androidx.compose.foundation.shape.RoundedCornerShape 6 | import androidx.compose.foundation.verticalScroll 7 | import androidx.compose.material.Button 8 | import androidx.compose.material.ButtonDefaults 9 | import androidx.compose.material.Card 10 | import androidx.compose.material.Icon 11 | import androidx.compose.material.IconToggleButton 12 | import androidx.compose.material.MaterialTheme 13 | import androidx.compose.material.Text 14 | import androidx.compose.runtime.Composable 15 | import androidx.compose.runtime.mutableStateOf 16 | import androidx.compose.runtime.remember 17 | import androidx.compose.ui.Alignment 18 | import androidx.compose.ui.Modifier 19 | import androidx.compose.ui.graphics.Color 20 | import androidx.compose.ui.layout.ContentScale 21 | import androidx.compose.ui.res.painterResource 22 | import androidx.compose.ui.res.stringResource 23 | import androidx.compose.ui.text.style.TextOverflow 24 | import androidx.compose.ui.tooling.preview.Preview 25 | import androidx.compose.ui.unit.dp 26 | import com.ellison.composemovie.R 27 | import com.ellison.composemovie.bean.* 28 | import com.ellison.composemovie.ui.theme.* 29 | 30 | @Preview(showBackground = true) 31 | @Composable 32 | fun MovieDetailPreview() { 33 | Detail(moviePro = testMoviePro) 34 | } 35 | 36 | @Composable 37 | fun Detail(moviePro: MoviePro) { 38 | Box( 39 | modifier = Modifier 40 | .fillMaxHeight(), 41 | ) { 42 | Column( 43 | modifier = Modifier 44 | .fillMaxWidth() 45 | .verticalScroll(rememberScrollState()), 46 | verticalArrangement = Arrangement.Center 47 | ) { 48 | Box( 49 | modifier = Modifier 50 | .fillMaxHeight(), 51 | //.padding(12.dp), 52 | contentAlignment = Alignment.TopEnd 53 | ) { 54 | LoadImage( 55 | url = moviePro.Poster, 56 | modifier = Modifier 57 | .fillMaxWidth() 58 | .height(380.dp), 59 | contentScale = ContentScale.FillBounds, 60 | contentDescription = moviePro.Title 61 | ) 62 | 63 | val checkedState = remember { mutableStateOf(false) } 64 | Card( 65 | modifier = Modifier.padding(6.dp), 66 | shape = RoundedCornerShape(50), 67 | // elevation = 8.dp, 68 | backgroundColor = likeColorBg 69 | ) { 70 | IconToggleButton( 71 | modifier = Modifier 72 | .padding(6.dp) 73 | .size(32.dp), 74 | checked = checkedState.value, 75 | onCheckedChange = { 76 | checkedState.value = it 77 | } 78 | ) { 79 | Icon( 80 | painterResource(id = R.drawable.ic_like), 81 | contentDescription = "like", 82 | tint = if (checkedState.value) Color.Blue else Color.White 83 | ) 84 | } 85 | } 86 | } 87 | 88 | Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) { 89 | Row( 90 | modifier = Modifier.fillMaxWidth(), 91 | verticalAlignment = Alignment.CenterVertically 92 | ) { 93 | Text( 94 | modifier = Modifier 95 | .weight(0.9f) 96 | .align(Alignment.CenterVertically), 97 | text = moviePro.Title, 98 | style = MaterialTheme.typography.h6, 99 | color = nameColor, 100 | overflow = TextOverflow.Ellipsis, 101 | maxLines = 1 102 | ) 103 | 104 | Text( 105 | modifier = Modifier 106 | .align(Alignment.CenterVertically), 107 | text = "Ratings:", 108 | style = MaterialTheme.typography.caption, 109 | color = nameColor, 110 | ) 111 | 112 | Text( 113 | modifier = Modifier 114 | .align(Alignment.CenterVertically), 115 | text = moviePro.imdbRating, 116 | style = MaterialTheme.typography.h6, 117 | color = nameColor, 118 | ) 119 | } 120 | 121 | Spacer(modifier = Modifier.height(2.dp)) 122 | 123 | Text( 124 | text = moviePro.Director, 125 | style = MaterialTheme.typography.subtitle2, 126 | overflow = TextOverflow.Ellipsis, 127 | maxLines = 1 128 | ) 129 | 130 | Spacer(modifier = Modifier.height(2.dp)) 131 | 132 | Text( 133 | text = moviePro.Actors, 134 | style = MaterialTheme.typography.subtitle2, 135 | overflow = TextOverflow.Ellipsis, 136 | maxLines = 1 137 | ) 138 | 139 | Spacer(modifier = Modifier.height(8.dp)) 140 | 141 | Text( 142 | text = moviePro.Plot, 143 | style = MaterialTheme.typography.caption, 144 | overflow = TextOverflow.Ellipsis, 145 | maxLines = 3 146 | ) 147 | 148 | Spacer(modifier = Modifier.height(8.dp)) 149 | Row( 150 | modifier = Modifier 151 | .fillMaxWidth() 152 | .padding(horizontal = 16.dp), 153 | verticalAlignment = Alignment.CenterVertically 154 | ) { 155 | Button( 156 | modifier = Modifier 157 | .width(250.dp) 158 | .weight(0.5f), 159 | onClick = {}, 160 | shape = shapes.large, 161 | colors = ButtonDefaults.buttonColors(backgroundColor = infoButtonColor) 162 | ) { 163 | Text( 164 | text = stringResource(id = R.string.movie_info_rent), 165 | color = Color.White 166 | ) 167 | } 168 | 169 | Spacer(modifier = Modifier.width(8.dp)) 170 | 171 | Button( 172 | modifier = Modifier 173 | .width(250.dp) 174 | .weight(0.5f), 175 | onClick = {}, 176 | shape = shapes.large, 177 | colors = ButtonDefaults.buttonColors(backgroundColor = Color.Blue) 178 | ) { 179 | Text( 180 | text = stringResource(id = R.string.movie_info_buy), 181 | color = Color.White 182 | ) 183 | } 184 | } 185 | 186 | Spacer(modifier = Modifier.height(4.dp)) 187 | Row( 188 | modifier = Modifier.fillMaxWidth(), 189 | verticalAlignment = Alignment.CenterVertically, 190 | horizontalArrangement = Arrangement.Center 191 | ) { 192 | Text( 193 | text = moviePro.Type + "・", 194 | style = MaterialTheme.typography.caption, 195 | ) 196 | 197 | Text( 198 | text = moviePro.Year + "・", 199 | style = MaterialTheme.typography.caption, 200 | ) 201 | 202 | Text( 203 | text = moviePro.Runtime, 204 | style = MaterialTheme.typography.caption, 205 | ) 206 | } 207 | } 208 | } 209 | } 210 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ellison/composemovie/ui/Navigation.kt: -------------------------------------------------------------------------------- 1 | package com.ellison.composemovie.ui 2 | 3 | import androidx.annotation.StringRes 4 | import androidx.compose.foundation.ExperimentalFoundationApi 5 | import androidx.compose.material.* 6 | import androidx.compose.material.icons.Icons 7 | import androidx.compose.material.icons.filled.* 8 | import androidx.compose.material.icons.outlined.ArrowBack 9 | import androidx.compose.runtime.* 10 | import androidx.compose.runtime.livedata.observeAsState 11 | import androidx.compose.ui.graphics.Color 12 | import androidx.compose.ui.graphics.vector.ImageVector 13 | import androidx.compose.ui.res.stringResource 14 | import androidx.compose.ui.tooling.preview.Preview 15 | import androidx.lifecycle.viewmodel.compose.viewModel 16 | import androidx.navigation.NavController 17 | import androidx.navigation.NavType 18 | import androidx.navigation.compose.* 19 | import com.ellison.composemovie.R 20 | import com.ellison.composemovie.bean.Movie 21 | import com.ellison.composemovie.bean.favouriteMovies 22 | import com.ellison.composemovie.bean.MoviePro 23 | import com.ellison.composemovie.bean.myAccount 24 | import com.ellison.composemovie.constant.Constants 25 | import com.ellison.composemovie.viewmodel.MovieViewModel 26 | import com.ellison.composemovie.util.Utils 27 | 28 | @ExperimentalFoundationApi 29 | @Preview 30 | @Composable 31 | fun Navigation() { 32 | val movieViewModel: MovieViewModel = viewModel() 33 | 34 | val baseTitle = stringResource(id = R.string.app_name) 35 | val (title, setTitle) = remember { mutableStateOf(baseTitle) } 36 | val (canPop, setCanPop) = remember { mutableStateOf(false) } 37 | 38 | val navController = rememberNavController() 39 | navController.addOnDestinationChangedListener { controller, _, _ -> 40 | setCanPop(controller.previousBackStackEntry != null) 41 | } 42 | 43 | // Used for check if is movie detail screen. 44 | val isCurrentMovieDetail = remember { mutableStateOf(false) } 45 | 46 | // Used for get current tab icon to tool bar 47 | val toolBarIcon = remember { mutableStateOf(Icons.Default.Search) } 48 | 49 | Scaffold( 50 | topBar = { 51 | TopAppBar( 52 | title = { 53 | Text( 54 | text = title, 55 | color = Color.Blue 56 | ) 57 | }, 58 | // Only show back icon when movie detail screen. 59 | navigationIcon = if (canPop && isCurrentMovieDetail.value) { 60 | { 61 | IconButton( 62 | onClick = { 63 | navController.popBackStack() 64 | } 65 | ) { 66 | Icon(Icons.Outlined.ArrowBack, "back", tint = Color.Blue) 67 | } 68 | } 69 | } else { 70 | { 71 | IconButton( 72 | onClick = {} 73 | ) { 74 | Icon( 75 | toolBarIcon.value, 76 | "main", 77 | tint = Color.Blue 78 | ) 79 | } 80 | } 81 | }, 82 | ) 83 | }, 84 | 85 | bottomBar = { 86 | // Not show bottom navigation if go to movie detail screen. 87 | if (!isCurrentMovieDetail.value) { 88 | BottomNavigation { 89 | val navBackStackEntry by navController.currentBackStackEntryAsState() 90 | val currentRoute = navBackStackEntry?.arguments?.getString("KEY_ROUTE")//FIXME 91 | 92 | items.forEach { screen -> 93 | BottomNavigationItem( 94 | icon = { Icon(screen.icon, screen.route) }, 95 | label = { Text(stringResource(screen.resourceId)) }, 96 | selected = currentRoute == screen.route, 97 | onClick = { 98 | navController.navigate(screen.route) { 99 | // Pop up to the start destination of the graph to 100 | // avoid building up a large stack of destinations 101 | // on the back stack as users select items 102 | // popUpTo = navController.graph.startDestination //FIXME 103 | popUpTo = navController.graph.startDestinationId 104 | // Avoid multiple copies of the same destination when 105 | // reselecting the same item 106 | launchSingleTop = true 107 | 108 | toolBarIcon.value = screen.icon 109 | 110 | Utils.logDebug( 111 | Utils.TAG_LAUNCH, "BottomNavigation Item click " 112 | + "toolBarIcon:${toolBarIcon.value.name}" 113 | ) 114 | } 115 | }, 116 | selectedContentColor = Color.Blue, 117 | unselectedContentColor = Color.Gray 118 | ) 119 | } 120 | } 121 | } 122 | } 123 | ) { 124 | NavHost(navController, startDestination = Screen.Find.route) { 125 | composable(Screen.Find.route) { 126 | FindScreen(navController, setTitle, movieViewModel) 127 | isCurrentMovieDetail.value = false 128 | } 129 | composable( 130 | route = Constants.ROUTE_DETAIL, 131 | arguments = listOf(navArgument(Constants.ROUTE_DETAIL_KEY) { 132 | type = NavType.StringType 133 | }) 134 | ) { backStackEntry -> 135 | DetailScreen( 136 | backStackEntry.arguments?.getString(Constants.ROUTE_DETAIL_KEY)!!, 137 | setTitle, 138 | movieViewModel 139 | ) 140 | Utils.logDebug( 141 | Utils.TAG_LAUNCH, 142 | "Navigate to MovieDetail movieDetail:${isCurrentMovieDetail.value}" 143 | ) 144 | isCurrentMovieDetail.value = true 145 | } 146 | composable(Screen.Store.route) { 147 | StoreScreen(setTitle) 148 | isCurrentMovieDetail.value = false 149 | } 150 | composable(Screen.Favourite.route) { 151 | FavouriteScreen(setTitle) 152 | isCurrentMovieDetail.value = false 153 | } 154 | composable(Screen.Profile.route) { 155 | ProfileScreen(setTitle) 156 | isCurrentMovieDetail.value = false 157 | } 158 | } 159 | } 160 | } 161 | 162 | @ExperimentalFoundationApi 163 | @Composable 164 | fun FindScreen( 165 | navController: NavController, 166 | setTitle: (String) -> Unit, 167 | movieViewModel: MovieViewModel 168 | ) { 169 | setTitle(stringResource(id = R.string.screen_find)) 170 | Find( 171 | movieViewModel, 172 | onClick = { movie -> 173 | setTitle("") 174 | navController.navigate(Constants.ROUTE_DETAIL_PRE + movie.imdbID) 175 | } 176 | ) 177 | } 178 | 179 | @Composable 180 | fun DetailScreen( 181 | movieId: String, 182 | setTitle: (String) -> Unit, 183 | movieViewModel: MovieViewModel 184 | ) { 185 | val movies: State> = movieViewModel.movies.observeAsState(emptyList()) 186 | movies.value.firstOrNull { it.imdbID == movieId }?.let { 187 | setTitle(it.Title) 188 | LaunchedEffect(it.imdbID) { 189 | movieViewModel.getMovieComposeCoroutines(it.imdbID) 190 | } 191 | val moviePro: State = movieViewModel.moviePro.observeAsState(MoviePro(it.Title)) 192 | Detail(moviePro.value) 193 | } 194 | } 195 | 196 | @ExperimentalFoundationApi 197 | @Composable 198 | fun StoreScreen( 199 | setTitle: (String) -> Unit 200 | ) { 201 | setTitle(stringResource(id = R.string.screen_store)) 202 | Store() 203 | } 204 | 205 | @ExperimentalFoundationApi 206 | @Composable 207 | fun FavouriteScreen( 208 | setTitle: (String) -> Unit 209 | ) { 210 | setTitle(stringResource(id = R.string.screen_favourite)) 211 | // Favourite(testMoviePro, onClick = { /*TODO*/ }) 212 | Favourite(favouriteMovies, onClick = { /*TODO*/ }) 213 | } 214 | 215 | @ExperimentalFoundationApi 216 | @Composable 217 | fun ProfileScreen( 218 | setTitle: (String) -> Unit 219 | ) { 220 | setTitle(stringResource(id = R.string.screen_profile)) 221 | Profile(myAccount) 222 | } 223 | 224 | val items = listOf( 225 | Screen.Find, 226 | Screen.Store, 227 | Screen.Favourite, 228 | Screen.Profile 229 | ) 230 | 231 | sealed class Screen(val route: String, val icon: ImageVector, @StringRes val resourceId: Int) { 232 | object Find : Screen(Constants.ROUTE_FIND, Icons.Default.Search, R.string.tab_find) 233 | object Store : Screen(Constants.ROUTE_STORE, Icons.Default.Store, R.string.tab_store) 234 | object Favourite : 235 | Screen(Constants.ROUTE_FAVOURITE, Icons.Default.Favorite, R.string.tab_favourite) 236 | 237 | object Profile : 238 | Screen(Constants.ROUTE_PROFILE, Icons.Default.AccountCircle, R.string.tab_profile) 239 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | # Created by .ignore support plugin (hsz.mobi) 3 | ### NotepadPP ### 4 | # Notepad++ backups # 5 | *.bak 6 | 7 | 8 | ### Eclipse ### 9 | 10 | .metadata 11 | bin/ 12 | tmp/ 13 | *.tmp 14 | *.bak 15 | *.swp 16 | *~.nib 17 | local.properties 18 | .settings/ 19 | .loadpath 20 | .recommenders 21 | 22 | # Eclipse Core 23 | .project 24 | 25 | # External tool builders 26 | .externalToolBuilders/ 27 | 28 | # Locally stored "Eclipse launch configurations" 29 | *.launch 30 | 31 | # PyDev specific (Python IDE for Eclipse) 32 | *.pydevproject 33 | 34 | # CDT-specific (C/C++ Development Tooling) 35 | .cproject 36 | 37 | # JDT-specific (Eclipse Java Development Tools) 38 | .classpath 39 | 40 | # Java annotation processor (APT) 41 | .factorypath 42 | 43 | # PDT-specific (PHP Development Tools) 44 | .buildpath 45 | 46 | # sbteclipse plugin 47 | .target 48 | 49 | # Tern plugin 50 | .tern-project 51 | 52 | # TeXlipse plugin 53 | .texlipse 54 | 55 | # STS (Spring Tool Suite) 56 | .springBeans 57 | 58 | # Code Recommenders 59 | .recommenders/ 60 | 61 | 62 | ### Git ### 63 | *.orig 64 | 65 | 66 | ### Windows ### 67 | # Windows image file caches 68 | Thumbs.db 69 | ehthumbs.db 70 | 71 | # Folder config file 72 | Desktop.ini 73 | 74 | # Recycle Bin used on file shares 75 | $RECYCLE.BIN/ 76 | 77 | # Windows Installer files 78 | *.cab 79 | *.msi 80 | *.msm 81 | *.msp 82 | 83 | # Windows shortcuts 84 | *.lnk 85 | 86 | 87 | ### VisualStudioCode ### 88 | .vscode/* 89 | !.vscode/settings.json 90 | !.vscode/tasks.json 91 | !.vscode/launch.json 92 | 93 | 94 | ### Linux ### 95 | *~ 96 | 97 | # temporary files which can be created if a process still has a handle open of a deleted file 98 | .fuse_hidden* 99 | 100 | # KDE directory preferences 101 | .directory 102 | 103 | # Linux trash folder which might appear on any partition or disk 104 | .Trash-* 105 | 106 | # .nfs files are created when an open file is removed but is still being accessed 107 | .nfs* 108 | 109 | 110 | ### macOS ### 111 | *.DS_Store 112 | .AppleDouble 113 | .LSOverride 114 | 115 | # Icon must end with two \r 116 | Icon 117 | # Thumbnails 118 | ._* 119 | # Files that might appear in the root of a volume 120 | .DocumentRevisions-V100 121 | .fseventsd 122 | .Spotlight-V100 123 | .TemporaryItems 124 | .Trashes 125 | .VolumeIcon.icns 126 | .com.apple.timemachine.donotpresent 127 | # Directories potentially created on remote AFP share 128 | .AppleDB 129 | .AppleDesktop 130 | Network Trash Folder 131 | Temporary Items 132 | .apdisk 133 | 134 | 135 | ### Emacs ### 136 | # -*- mode: gitignore; -*- 137 | \#*\# 138 | /.emacs.desktop 139 | /.emacs.desktop.lock 140 | *.elc 141 | auto-save-list 142 | tramp 143 | .\#* 144 | 145 | # Org-mode 146 | .org-id-locations 147 | *_archive 148 | 149 | # flymake-mode 150 | *_flymake.* 151 | 152 | # eshell files 153 | /eshell/history 154 | /eshell/lastdir 155 | 156 | # elpa packages 157 | /elpa/ 158 | 159 | # reftex files 160 | *.rel 161 | 162 | # AUCTeX auto folder 163 | /auto/ 164 | 165 | # cask packages 166 | .cask/ 167 | dist/ 168 | 169 | # Flycheck 170 | flycheck_*.el 171 | 172 | # server auth directory 173 | /server/ 174 | 175 | # projectiles files 176 | .projectile 177 | 178 | # directory configuration 179 | .dir-locals.el 180 | 181 | 182 | ### SublimeText ### 183 | # cache files for sublime text 184 | *.tmlanguage.cache 185 | *.tmPreferences.cache 186 | *.stTheme.cache 187 | 188 | # workspace files are user-specific 189 | *.sublime-workspace 190 | 191 | # project files should be checked into the repository, unless a significant 192 | # proportion of contributors will probably not be using SublimeText 193 | # *.sublime-project 194 | 195 | # sftp configuration file 196 | sftp-config.json 197 | 198 | # Package control specific files 199 | Package Control.last-run 200 | Package Control.ca-list 201 | Package Control.ca-bundle 202 | Package Control.system-ca-bundle 203 | Package Control.cache/ 204 | Package Control.ca-certs/ 205 | bh_unicode_properties.cache 206 | 207 | # Sublime-github package stores a github token in this file 208 | # https://packagecontrol.io/packages/sublime-github 209 | GitHub.sublime-settings 210 | 211 | 212 | ### Vim ### 213 | # swap 214 | [._]*.s[a-w][a-z] 215 | [._]s[a-w][a-z] 216 | # session 217 | Session.vim 218 | # temporary 219 | .netrwhist 220 | # auto-generated tag files 221 | tags 222 | 223 | 224 | ### Intellij+iml ### 225 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 226 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 227 | 228 | # User-specific stuff: 229 | .idea/workspace.xml 230 | .idea/tasks.xml 231 | 232 | # Sensitive or high-churn files: 233 | .idea/dataSources/ 234 | .idea/dataSources.ids 235 | .idea/dataSources.xml 236 | .idea/dataSources.local.xml 237 | .idea/sqlDataSources.xml 238 | .idea/dynamic.xml 239 | .idea/uiDesigner.xml 240 | 241 | # Gradle: 242 | .idea/gradle.xml 243 | .idea/libraries 244 | 245 | # Mongo Explorer plugin: 246 | .idea/mongoSettings.xml 247 | 248 | ## File-based project format: 249 | *.iws 250 | 251 | ## Plugin-specific files: 252 | 253 | # IntelliJ 254 | /out/ 255 | 256 | # mpeltonen/sbt-idea plugin 257 | .idea_modules/ 258 | 259 | # JIRA plugin 260 | atlassian-ide-plugin.xml 261 | 262 | # Crashlytics plugin (for Android Studio and IntelliJ) 263 | com_crashlytics_export_strings.xml 264 | crashlytics.properties 265 | crashlytics-build.properties 266 | fabric.properties 267 | 268 | ### Intellij+iml Patch ### 269 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 270 | 271 | *.iml 272 | modules.xml 273 | .idea/misc.xml 274 | *.ipr 275 | 276 | 277 | ### Java ### 278 | *.class 279 | 280 | # Mobile Tools for Java (J2ME) 281 | .mtj.tmp/ 282 | 283 | # Package Files # 284 | *.war 285 | *.ear 286 | 287 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 288 | hs_err_pid* 289 | 290 | 291 | ### Gradle ### 292 | .gradle 293 | /build/ 294 | 295 | # Ignore Gradle GUI config 296 | gradle-app.setting 297 | 298 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 299 | !gradle-wrapper.jar 300 | 301 | # Cache of project 302 | .gradletasknamecache 303 | 304 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 305 | # gradle/wrapper/gradle-wrapper.properties 306 | 307 | 308 | ### VisualStudio ### 309 | ## Ignore Visual Studio temporary files, build results, and 310 | ## files generated by popular Visual Studio add-ons. 311 | ## 312 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 313 | 314 | # User-specific files 315 | *.suo 316 | *.user 317 | *.userosscache 318 | *.sln.docstates 319 | *.vcxproj.filters 320 | 321 | # User-specific files (MonoDevelop/Xamarin Studio) 322 | *.userprefs 323 | 324 | # Build results 325 | [Dd]ebug/ 326 | [Dd]ebugPublic/ 327 | [Rr]elease/ 328 | [Rr]eleases/ 329 | x64/ 330 | x86/ 331 | bld/ 332 | [Bb]in/ 333 | [Oo]bj/ 334 | [Ll]og/ 335 | 336 | # Visual Studio 2015 cache/options directory 337 | .vs/ 338 | # Uncomment if you have tasks that create the project's static files in wwwroot 339 | #wwwroot/ 340 | 341 | # MSTest test Results 342 | [Tt]est[Rr]esult*/ 343 | [Bb]uild[Ll]og.* 344 | 345 | # NUNIT 346 | *.VisualState.xml 347 | TestResult.xml 348 | 349 | # Build Results of an ATL Project 350 | [Dd]ebugPS/ 351 | [Rr]eleasePS/ 352 | dlldata.c 353 | 354 | # DNX 355 | project.lock.json 356 | project.fragment.lock.json 357 | artifacts/ 358 | Properties/launchSettings.json 359 | 360 | *_i.c 361 | *_p.c 362 | *_i.h 363 | *.ilk 364 | *.meta 365 | *.obj 366 | *.pch 367 | *.pdb 368 | *.pgc 369 | *.pgd 370 | *.rsp 371 | *.sbr 372 | *.tlb 373 | *.tli 374 | *.tlh 375 | *.tmp_proj 376 | *.log 377 | *.vspscc 378 | *.vssscc 379 | .builds 380 | *.pidb 381 | *.svclog 382 | *.scc 383 | 384 | # Chutzpah Test files 385 | _Chutzpah* 386 | 387 | # Visual C++ cache files 388 | ipch/ 389 | *.aps 390 | *.ncb 391 | *.opendb 392 | *.opensdf 393 | *.sdf 394 | *.cachefile 395 | *.VC.db 396 | *.VC.VC.opendb 397 | 398 | # Visual Studio profiler 399 | *.psess 400 | *.vsp 401 | *.vspx 402 | *.sap 403 | 404 | # TFS 2012 Local Workspace 405 | $tf/ 406 | 407 | # Guidance Automation Toolkit 408 | *.gpState 409 | 410 | # ReSharper is a .NET coding add-in 411 | _ReSharper*/ 412 | *.[Rr]e[Ss]harper 413 | *.DotSettings.user 414 | 415 | # JustCode is a .NET coding add-in 416 | .JustCode 417 | 418 | # TeamCity is a build add-in 419 | _TeamCity* 420 | 421 | # DotCover is a Code Coverage Tool 422 | *.dotCover 423 | 424 | # Visual Studio code coverage results 425 | *.coverage 426 | *.coveragexml 427 | 428 | # NCrunch 429 | _NCrunch_* 430 | .*crunch*.local.xml 431 | nCrunchTemp_* 432 | 433 | # MightyMoose 434 | *.mm.* 435 | AutoTest.Net/ 436 | 437 | # Web workbench (sass) 438 | .sass-cache/ 439 | 440 | # Installshield output folder 441 | [Ee]xpress/ 442 | 443 | # DocProject is a documentation generator add-in 444 | DocProject/buildhelp/ 445 | DocProject/Help/*.HxT 446 | DocProject/Help/*.HxC 447 | DocProject/Help/*.hhc 448 | DocProject/Help/*.hhk 449 | DocProject/Help/*.hhp 450 | DocProject/Help/Html2 451 | DocProject/Help/html 452 | 453 | # Click-Once directory 454 | publish/ 455 | 456 | # Publish Web Output 457 | *.[Pp]ublish.xml 458 | *.azurePubxml 459 | # TODO: Comment the next line if you want to checkin your web deploy settings 460 | # but database connection strings (with potential passwords) will be unencrypted 461 | *.pubxml 462 | *.publishproj 463 | 464 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 465 | # checkin your Azure Web App publish settings, but sensitive information contained 466 | # in these scripts will be unencrypted 467 | PublishScripts/ 468 | 469 | # NuGet Packages 470 | *.nupkg 471 | # The packages folder can be ignored because of Package Restore 472 | **/packages/* 473 | # except build/, which is used as an MSBuild target. 474 | !**/packages/build/ 475 | # Uncomment if necessary however generally it will be regenerated when needed 476 | #!**/packages/repositories.config 477 | # NuGet v3's project.json files produces more ignoreable files 478 | *.nuget.props 479 | *.nuget.targets 480 | 481 | # Microsoft Azure Build Output 482 | csx/ 483 | *.build.csdef 484 | 485 | # Microsoft Azure Emulator 486 | ecf/ 487 | rcf/ 488 | 489 | # Windows Store app package directories and files 490 | AppPackages/ 491 | BundleArtifacts/ 492 | Package.StoreAssociation.xml 493 | _pkginfo.txt 494 | 495 | # Visual Studio cache files 496 | # files ending in .cache can be ignored 497 | *.[Cc]ache 498 | # but keep track of directories ending in .cache 499 | !*.[Cc]ache/ 500 | 501 | # Others 502 | ClientBin/ 503 | ~$* 504 | *.dbmdl 505 | *.dbproj.schemaview 506 | *.jfm 507 | *.pfx 508 | *.publishsettings 509 | node_modules/ 510 | orleans.codegen.cs 511 | 512 | # Since there are multiple workflows, uncomment next line to ignore bower_components 513 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 514 | #bower_components/ 515 | 516 | # RIA/Silverlight projects 517 | Generated_Code/ 518 | 519 | # Backup & report files from converting an old project file 520 | # to a newer Visual Studio version. Backup files are not needed, 521 | # because we have git ;-) 522 | _UpgradeReport_Files/ 523 | Backup*/ 524 | UpgradeLog*.XML 525 | UpgradeLog*.htm 526 | 527 | # SQL Server files 528 | *.mdf 529 | *.ldf 530 | 531 | # Business Intelligence projects 532 | *.rdl.data 533 | *.bim.layout 534 | *.bim_*.settings 535 | 536 | # Microsoft Fakes 537 | FakesAssemblies/ 538 | 539 | # GhostDoc plugin setting file 540 | *.GhostDoc.xml 541 | 542 | # Node.js Tools for Visual Studio 543 | .ntvs_analysis.dat 544 | 545 | # Visual Studio 6 build log 546 | *.plg 547 | 548 | # Visual Studio 6 workspace options file 549 | *.opt 550 | 551 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 552 | *.vbw 553 | 554 | # Visual Studio LightSwitch build output 555 | **/*.HTMLClient/GeneratedArtifacts 556 | **/*.DesktopClient/GeneratedArtifacts 557 | **/*.DesktopClient/ModelManifest.xml 558 | **/*.Server/GeneratedArtifacts 559 | **/*.Server/ModelManifest.xml 560 | _Pvt_Extensions 561 | 562 | # Paket dependency manager 563 | .paket/paket.exe 564 | paket-files/ 565 | 566 | # FAKE - F# Make 567 | .fake/ 568 | 569 | # JetBrains Rider 570 | .idea/ 571 | *.sln.iml 572 | 573 | # CodeRush 574 | .cr/ 575 | 576 | # Python Tools for Visual Studio (PTVS) 577 | __pycache__/ 578 | *.pyc 579 | 580 | # Cake - Uncomment if you are using it 581 | # tools/ 582 | 583 | ### VisualStudio Patch ### 584 | build/ 585 | 586 | ### NetBeans template 587 | nbproject/private/ 588 | build/ 589 | nbbuild/ 590 | dist/ 591 | nbdist/ 592 | nbactions.xml 593 | nb-configuration.xml 594 | 595 | # Mac OS X Garbage 596 | .DS_Store 597 | Thumbs.db 598 | 599 | .idea/ 600 | 601 | ### Android Studio 602 | fabric.properties 603 | mobile/mobile.iml 604 | app/app.iml 605 | app/*.iml 606 | tv/tv.iml 607 | *.iml 608 | mobile/*.iml 609 | tv/*.iml 610 | .idea/workspace.xml 611 | .idea/libraries 612 | .idea/ 613 | .idea 614 | /build 615 | /captures 616 | ### Android template 617 | # Built application files 618 | *.apk 619 | *.ap_ 620 | /build 621 | /captures 622 | # Files for the Dalvik VM 623 | *.dex 624 | /Properties 625 | /SignKeys 626 | /apk_output_folder 627 | # Java class files 628 | *.class 629 | 630 | # Generated files 631 | bin/ 632 | gen/ 633 | R.java 634 | 635 | # Gradle files 636 | .gradle/ 637 | 638 | # Local configuration file (sdk path, etc) 639 | local.properties 640 | 641 | # Proguard folder generated by Eclipse 642 | proguard/ 643 | 644 | # Log Files 645 | *.log 646 | 647 | 648 | ### Java template 649 | *.class 650 | 651 | # Mobile Tools for Java (J2ME) 652 | .mtj.tmp/ 653 | 654 | # Package Files # 655 | *.war 656 | *.ear 657 | 658 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 659 | hs_err_pid* 660 | 661 | 662 | ### Eclipse template 663 | *.pydevproject 664 | .metadata 665 | .gradle 666 | bin/ 667 | tmp/ 668 | *.tmp 669 | *.bak 670 | *.swp 671 | *~.nib 672 | .settings/ 673 | .loadpath 674 | /build 675 | /captures 676 | # External tool builders 677 | .externalToolBuilders/ 678 | .cxx/ 679 | 680 | # Locally stored "Eclipse launch configurations" 681 | *.launch 682 | 683 | # CDT-specific 684 | .cproject 685 | 686 | # PDT-specific 687 | .buildpath 688 | 689 | # sbteclipse plugin 690 | .target 691 | 692 | # TeXlipse plugin 693 | .texlipse 694 | 695 | # Android Studio 696 | *.iml 697 | gradlew 698 | # Keep external libs 699 | !app/libs/*.jar 700 | !gradle/wrapper/*.jar 701 | # script output 702 | check-dpi.txt* 703 | 704 | # Miscellaneous 705 | *.class 706 | *.lock 707 | *.log 708 | *.pyc 709 | *.swp 710 | .DS_Store 711 | .atom/ 712 | .buildlog/ 713 | .history 714 | .svn/ 715 | 716 | # IntelliJ related 717 | *.iml 718 | *.ipr 719 | *.iws 720 | .idea/ 721 | 722 | # Visual Studio Code related 723 | .vscode/ 724 | 725 | # Flutter/Dart/Pub related 726 | **/doc/api/ 727 | .dart_tool/ 728 | .flutter-plugins 729 | .packages 730 | .pub-cache/ 731 | .pub/ 732 | build/ 733 | 734 | # Android related 735 | **/android/**/gradle-wrapper.jar 736 | **/android/.gradle 737 | **/android/captures/ 738 | **/android/gradlew 739 | **/android/gradlew.bat 740 | **/android/local.properties 741 | **/android/**/GeneratedPluginRegistrant.java 742 | 743 | # iOS/XCode related 744 | **/ios/**/*.mode1v3 745 | **/ios/**/*.mode2v3 746 | **/ios/**/*.moved-aside 747 | **/ios/**/*.pbxuser 748 | **/ios/**/*.perspectivev3 749 | **/ios/**/*sync/ 750 | **/ios/**/.sconsign.dblite 751 | **/ios/**/.tags* 752 | **/ios/**/.vagrant/ 753 | **/ios/**/DerivedData/ 754 | **/ios/**/Icon? 755 | **/ios/**/Pods/ 756 | **/ios/**/.symlinks/ 757 | **/ios/**/profile 758 | **/ios/**/xcuserdata 759 | **/ios/.generated/ 760 | **/ios/Flutter/App.framework 761 | **/ios/Flutter/Flutter.framework 762 | **/ios/Flutter/Generated.xcconfig 763 | **/ios/Flutter/app.flx 764 | **/ios/Flutter/app.zip 765 | **/ios/Flutter/flutter_assets/ 766 | **/ios/ServiceDefinitions.json 767 | **/ios/Runner/GeneratedPluginRegistrant.* 768 | 769 | # Exceptions to above rules. 770 | !**/ios/**/default.mode1v3 771 | !**/ios/**/default.mode2v3 772 | !**/ios/**/default.pbxuser 773 | !**/ios/**/default.perspectivev3 774 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 775 | 776 | /fastlane/report.xml 777 | /app/EagleHorse 778 | app/EagleHorse_Google 779 | 780 | --------------------------------------------------------------------------------