Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
truyentd-2427 committed Jul 17, 2024
1 parent 6cca8d8 commit 6a5431f
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 19 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<h1 align="center">Movie Compose</h1>

<p align="center">
<a href="https://developer.android.com/develop/ui/compose"><img alt="Compose" src="https://img.shields.io/badge/compose-1.6.8-green.svg"/></a>
<a href="https://android-arsenal.com/api?level=24"><img alt="API" src="https://img.shields.io/badge/API-24%2B-brightgreen.svg?style=flat"/></a>
<a href="http://kotlinlang.org"><img alt="Language" src="https://img.shields.io/badge/Kotlin-1.8.10-blue.svg?logo=kotlin"/></a>
<a href="https://developer.android.com/build/releases/gradle-plugin"><img alt="Compose" src="https://img.shields.io/badge/gradle-8.0.0-blue.svg"/></a>
</p>

<p align="center">
<img src="screenshots/screenshot1.jpg" width="25%"/>
<img src="screenshots/screenshot2.jpg" width="25%"/>
<img src="screenshots/screenshot3.jpg" width="25%"/>
</p>

<p align="center">
A sample application demonstrates modern Android development with Jetpack Compose, Hilt, Coroutines, Flow, Room.<br />
Build with 💚
</p>

## Tech Stack
- Jetpack Libraries:
- [Compose](https://developer.android.com/jetpack/compose)
- [ViewModel](https://developer.android.com/codelabs/basic-android-kotlin-compose-viewmodel-and-state#0)
- [Lifecycle](https://developer.android.com/develop/ui/compose/lifecycle)
- [Navigation](https://developer.android.com/develop/ui/compose/navigation)
- [Room](https://developer.android.com/training/data-storage/room)
- [Paging3](https://developer.android.com/topic/libraries/architecture/paging/v3-overview)
- [Hilt](https://developer.android.com/training/dependency-injection/hilt-jetpack)
- Others:
- [Coil](https://coil-kt.github.io/coil/compose/)
- [Retrofit](https://square.github.io/retrofit/)
- [OkHttp](https://github.com/square/okhttp)
- [Gson](https://github.com/google/gson)
- [Coroutines](https://github.com/Kotlin/kotlinx.coroutines)

## Features
- Authentication
- View Now playing, popular movies
- View movie details
- Search movies (paging)
- Bookmark movies

## Credits
- [Design](https://www.figma.com/design/TB6uasgrsNDa40lPjqAgOD/Movie-Mobile-App-UI-Design-(Community)?node-id=3-2&t=vuBeAtwxlkAY5Ezw-0)
- [TheMovieDB](https://developer.themoviedb.org/v4/reference)
24 changes: 12 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ dependencies {
implementation("androidx.activity:activity-compose:1.9.0")

// UI
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
implementation(platform("androidx.compose:compose-bom:2024.06.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material:1.6.7")
implementation("androidx.compose.material:material:1.6.8")

// Lifecycle
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.3")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.3")

// Navigation
implementation("androidx.navigation:navigation-compose:2.7.7")
Expand All @@ -77,15 +77,15 @@ dependencies {
implementation("com.google.accompanist:accompanist-permissions:0.35.1-alpha")

// Hilt
implementation("com.google.dagger:hilt-android:2.44")
implementation("androidx.hilt:hilt-navigation-compose:1.1.0")
kapt("com.google.dagger:hilt-android-compiler:2.44")
implementation("com.google.dagger:hilt-android:2.49")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
kapt("com.google.dagger:hilt-android-compiler:2.49")

// Retrofit
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.2")
implementation("com.squareup.okhttp3:logging-interceptor:4.11.0")

// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
Expand All @@ -94,7 +94,7 @@ dependencies {
implementation("io.coil-kt:coil-compose:2.6.0")

// Paging 3
implementation("androidx.paging:paging-runtime:3.3.0")
implementation("androidx.paging:paging-runtime-ktx:3.3.0")
implementation("androidx.paging:paging-compose:3.3.0")

// Room
Expand All @@ -107,9 +107,9 @@ dependencies {
implementation("androidx.security:security-crypto-ktx:1.1.0-alpha06")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2024.06.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class UserRepositoryImpl @Inject constructor(
) : UserRepository {
override suspend fun login() {
delay(1500)
localDataSource.saveAccessToken("eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI0MjdiNWFhOGE0NmFmMGE5OGUyYjM5OTIxMThmNDYzYiIsInN1YiI6IjVmOWZiZTJjZjA0ZDAxMDAzN2E0ZDc5YSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.m-Dda75kQLr1zEk-xDKJpRLAi1G0bXVTq8sMt1LE02c")
localDataSource.saveAccessToken("PLACE_ACCESS_TOKEN_HERE")
localDataSource.saveHasLoggedIn(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SearchMoviesPagingSource(
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, MovieData> {
return try {
val page = params.key ?: 1
delay(1000) // TODO Remove later
delay(1000) // TODO Test loading in case network so fast
val response = authApi.execute { searchMovies(keyword = keyword, page) }
val nextPage = if (page + 1 <= (response.totalPages ?: 0)) page + 1 else null
LoadResult.Page(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class BaseDestination(val route: String = "") {
}
}

data class PopUpTo(
data class PopBackStack(
val targetDestination: BaseDestination,
val inclusive: Boolean = false,
val results: HashMap<String, Any> = hashMapOf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.truyentd.moviecompose.navigation.auth

import com.truyentd.moviecompose.navigation.BaseDestination

sealed class AuthDestination(route: String): BaseDestination(route) {
sealed class AuthDestination(route: String) : BaseDestination(route) {
object Login : BaseDestination(route = "login")

object Login2 : BaseDestination(route = "login2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun NavHostController.navigate(
navigateUp()
}

is BaseDestination.PopUpTo -> {
is BaseDestination.PopBackStack -> {
destination.results.forEach { (key, value) ->
getBackStackEntry(destination.targetDestination.route).savedStateHandle[key] = value
}
Expand Down
Binary file added screenshots/screenshot1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/screenshot2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/screenshot3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6a5431f

Please sign in to comment.