-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Farhandroid/Part-2
Part 2
- Loading branch information
Showing
79 changed files
with
826 additions
and
354 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 3, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "com.farhan.tanvir.androidcleanarchitecture", | ||
"variantName": "debug", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"attributes": [], | ||
"versionCode": 1, | ||
"versionName": "1.0", | ||
"outputFile": "app-debug.apk" | ||
} | ||
], | ||
"elementType": "File" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/farhan/tanvir/androidcleanarchitecture/di/DatabaseModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.farhan.tanvir.androidcleanarchitecture.di | ||
|
||
import android.app.Application | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import com.farhan.tanvir.data.db.MovieDB | ||
import com.farhan.tanvir.data.db.MovieDao | ||
import com.farhan.tanvir.data.db.MovieRemoteKeysDao | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object DatabaseModule { | ||
|
||
@Provides | ||
fun provideDatabase(app: Application): MovieDB = | ||
Room.databaseBuilder(app, MovieDB::class.java, "movie_db").fallbackToDestructiveMigration() | ||
.build() | ||
|
||
@Provides | ||
fun provideMovieDao(movieDB: MovieDB) : MovieDao= movieDB.movieDao() | ||
|
||
@Provides | ||
fun provideMovieRemoteKeysDao(movieDB: MovieDB) : MovieRemoteKeysDao = movieDB.movieRemoteKeysDao() | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/farhan/tanvir/androidcleanarchitecture/di/LocalDataModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.farhan.tanvir.androidcleanarchitecture.di | ||
|
||
import com.farhan.tanvir.data.db.MovieDao | ||
import com.farhan.tanvir.data.repository.dataSource.MovieLocalDataSource | ||
import com.farhan.tanvir.data.repository.dataSourceImpl.MovieLocalDataSourceImpl | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
|
||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object LocalDataModule { | ||
@Provides | ||
fun provideLocalDataSource(movieDao: MovieDao): MovieLocalDataSource = | ||
MovieLocalDataSourceImpl(movieDao = movieDao) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...in/java/com/farhan/tanvir/androidcleanarchitecture/presentation/components/Progressbar.kt
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...ava/com/farhan/tanvir/androidcleanarchitecture/presentation/components/RatingComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.farhan.tanvir.androidcleanarchitecture.presentation.components | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import com.farhan.tanvir.androidcleanarchitecture.R | ||
|
||
@Composable | ||
fun RatingComponent(rating: String) { | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_baseline_star_rate), | ||
contentDescription = null, | ||
modifier = Modifier | ||
.padding( | ||
end = 2.dp, | ||
) | ||
) | ||
Text(text = rating, style = MaterialTheme.typography.body2) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...om/farhan/tanvir/androidcleanarchitecture/presentation/components/ReleaseDateComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.farhan.tanvir.androidcleanarchitecture.presentation.components | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import com.farhan.tanvir.androidcleanarchitecture.R | ||
import java.util.* | ||
|
||
|
||
@Composable | ||
fun ReleaseDateComponent(releaseDate: String) { | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_baseline_date_range_24), | ||
contentDescription = null, | ||
modifier = Modifier.padding( | ||
end = 2.dp, | ||
) | ||
) | ||
Text(text = releaseDate, style = MaterialTheme.typography.body2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...farhan/tanvir/androidcleanarchitecture/presentation/screen/details/MovieDetailsContent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.farhan.tanvir.androidcleanarchitecture.presentation.screen.details | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material.Card | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.rememberImagePainter | ||
import coil.size.Scale | ||
import com.farhan.tanvir.androidcleanarchitecture.BuildConfig | ||
import com.farhan.tanvir.androidcleanarchitecture.presentation.components.RatingComponent | ||
import com.farhan.tanvir.androidcleanarchitecture.presentation.components.ReleaseDateComponent | ||
import com.farhan.tanvir.androidcleanarchitecture.ui.theme.AppThemeColor | ||
import com.farhan.tanvir.domain.model.Movie | ||
|
||
@Composable | ||
fun MovieDetailsContent(movie: Movie) { | ||
val scrollState = rememberScrollState() | ||
Card( | ||
elevation = 0.dp, | ||
backgroundColor = MaterialTheme.colors.AppThemeColor | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.verticalScroll(scrollState) | ||
) { | ||
Image( | ||
painter = rememberImagePainter( | ||
data = BuildConfig.POSTER_URL + movie.posterPath, builder = { | ||
crossfade(true) | ||
scale(Scale.FIT) | ||
}), | ||
contentDescription = null, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(350.dp), | ||
contentScale = ContentScale.FillWidth | ||
) | ||
Column(modifier = Modifier.padding(8.dp)) { | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
movie.title?.let { | ||
Text( | ||
text = it, | ||
style = MaterialTheme.typography.h5, | ||
fontWeight = FontWeight.Bold | ||
) | ||
} | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
movie.releaseDate?.let { | ||
ReleaseDateComponent(releaseDate = it) | ||
} | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
movie.rating?.let { RatingComponent(rating = it) } | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
movie.overview?.let { | ||
Text( | ||
text = it, | ||
style = MaterialTheme.typography.body2 | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.