From 3b9526c4b76bd5515017430517985467eeda3ffd Mon Sep 17 00:00:00 2001 From: mehedihasanpiash Date: Sun, 8 Sep 2024 13:16:48 +0600 Subject: [PATCH] - Code Refactor --- .../ExampleInstrumentedTest.kt | 6 ++-- .../data/repository/MovieRepository.kt | 6 +++- .../navigation/NavGraph.kt | 6 ++-- .../{MovieItemList.kt => MovieItem.kt} | 23 +++++++++--- .../ui/component/SearchBar.kt | 14 +++++--- .../ui/component/SearchUI.kt | 8 ++++- .../ui/component/SeeMoreText.kt | 13 +++++-- .../ui/component/text/BioGraphyText.kt | 1 - .../ui/screens/artistdetail/ArtistDetail.kt | 12 +++++-- .../artistdetail/ArtistDetailViewModel.kt | 2 -- .../ui/screens/drawer/NavigationDrawer.kt | 8 ++++- .../ui/screens/mainscreen/MainScreen.kt | 35 ++++++++++++++++--- .../ui/screens/mainscreen/MainViewModel.kt | 8 ++++- .../ui/screens/moviedetail/MovieDetail.kt | 29 +++++++++++---- .../moviedetail/MovieDetailViewModel.kt | 8 ++--- app/src/main/res/values-night/themes.xml | 2 +- app/src/main/res/values/themes.xml | 2 +- .../ExampleUnitTest.kt | 3 +- 18 files changed, 139 insertions(+), 47 deletions(-) rename app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/{MovieItemList.kt => MovieItem.kt} (88%) diff --git a/app/src/androidTest/java/com/piashcse/hilt_mvvm_compose_movie/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/piashcse/hilt_mvvm_compose_movie/ExampleInstrumentedTest.kt index 1d9e701..94f9b83 100644 --- a/app/src/androidTest/java/com/piashcse/hilt_mvvm_compose_movie/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/piashcse/hilt_mvvm_compose_movie/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package com.piashcse.hilt_mvvm_compose_movie -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/data/repository/MovieRepository.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/data/repository/MovieRepository.kt index 3d19dac..cfb2e2a 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/data/repository/MovieRepository.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/data/repository/MovieRepository.kt @@ -4,7 +4,11 @@ import androidx.paging.Pager import androidx.paging.PagingConfig import androidx.paging.PagingData import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.ApiService -import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.* +import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.GenrePagingDataSource +import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.NowPlayingPagingDataSource +import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.PopularPagingDataSource +import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.TopRatedPagingDataSource +import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.paging.UpcomingPagingDataSource import com.piashcse.hilt_mvvm_compose_movie.data.model.BaseModel import com.piashcse.hilt_mvvm_compose_movie.data.model.Genres import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/navigation/NavGraph.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/navigation/NavGraph.kt index 51e4853..96a9497 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/navigation/NavGraph.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/navigation/NavGraph.kt @@ -12,16 +12,14 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.navArgument import com.piashcse.hilt_mvvm_compose_movie.R -import com.piashcse.hilt_mvvm_compose_movie.data.model.Genres import com.piashcse.hilt_mvvm_compose_movie.data.model.moviedetail.Genre -import com.piashcse.hilt_mvvm_compose_movie.ui.screens.genre.GenreScreen import com.piashcse.hilt_mvvm_compose_movie.ui.screens.artistdetail.ArtistDetail import com.piashcse.hilt_mvvm_compose_movie.ui.screens.bottomnavigation.nowplaying.NowPlaying -import com.piashcse.hilt_mvvm_compose_movie.ui.screens.moviedetail.MovieDetail import com.piashcse.hilt_mvvm_compose_movie.ui.screens.bottomnavigation.popular.Popular import com.piashcse.hilt_mvvm_compose_movie.ui.screens.bottomnavigation.toprated.TopRated import com.piashcse.hilt_mvvm_compose_movie.ui.screens.bottomnavigation.upcoming.Upcoming -import com.piashcse.hilt_mvvm_compose_movie.utils.network.DataState +import com.piashcse.hilt_mvvm_compose_movie.ui.screens.genre.GenreScreen +import com.piashcse.hilt_mvvm_compose_movie.ui.screens.moviedetail.MovieDetail @Composable fun Navigation( diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItemList.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItem.kt similarity index 88% rename from app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItemList.kt rename to app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItem.kt index dd908c7..df9cc53 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItemList.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/MovieItem.kt @@ -8,13 +8,22 @@ import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.items import androidx.compose.material3.Text -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -28,12 +37,16 @@ import androidx.navigation.NavController import androidx.paging.PagingData import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.collectAsLazyPagingItems -import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem -import com.piashcse.hilt_mvvm_compose_movie.navigation.currentRoute import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.ApiURL +import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem import com.piashcse.hilt_mvvm_compose_movie.data.model.moviedetail.Genre import com.piashcse.hilt_mvvm_compose_movie.navigation.Screen -import com.piashcse.hilt_mvvm_compose_movie.ui.theme.* +import com.piashcse.hilt_mvvm_compose_movie.navigation.currentRoute +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.DefaultBackgroundColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.Purple200 +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.Purple500 +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.SecondaryFontColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.cornerRadius import com.piashcse.hilt_mvvm_compose_movie.utils.conditional import com.piashcse.hilt_mvvm_compose_movie.utils.items import com.piashcse.hilt_mvvm_compose_movie.utils.pagingLoadingState diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchBar.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchBar.kt index c93a769..2cfd7e4 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchBar.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchBar.kt @@ -6,13 +6,19 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Icon -import androidx.compose.material3.TextField -import androidx.compose.material3.TextFieldDefaults import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Clear import androidx.compose.material.icons.filled.Search -import androidx.compose.runtime.* +import androidx.compose.material3.Icon +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchUI.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchUI.kt index 6d8641d..a57ded6 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchUI.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SearchUI.kt @@ -2,7 +2,13 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.component import androidx.compose.foundation.background import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SeeMoreText.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SeeMoreText.kt index 7ea25f7..1e6ef7c 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SeeMoreText.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/SeeMoreText.kt @@ -3,11 +3,20 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.component import androidx.compose.animation.animateContentSize import androidx.compose.foundation.text.ClickableText import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalUriHandler -import androidx.compose.ui.text.* +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.TextLayoutResult +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.sp import com.piashcse.hilt_mvvm_compose_movie.ui.theme.LinkColor import com.piashcse.hilt_mvvm_compose_movie.ui.theme.SecondaryFontColor diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/text/BioGraphyText.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/text/BioGraphyText.kt index 879f047..ce90e14 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/text/BioGraphyText.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/component/text/BioGraphyText.kt @@ -4,7 +4,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import com.piashcse.hilt_mvvm_compose_movie.ui.theme.bioGrapyText -import com.piashcse.hilt_mvvm_compose_movie.ui.theme.subTitleSecondary @Composable fun BioGraphyText(text:String) { diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetail.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetail.kt index 225cbc5..e1fe861 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetail.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetail.kt @@ -1,7 +1,12 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.artistdetail import androidx.compose.foundation.background -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text @@ -21,7 +26,10 @@ import com.piashcse.hilt_mvvm_compose_movie.R import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.ApiURL import com.piashcse.hilt_mvvm_compose_movie.ui.component.CircularIndeterminateProgressBar import com.piashcse.hilt_mvvm_compose_movie.ui.component.text.BioGraphyText -import com.piashcse.hilt_mvvm_compose_movie.ui.theme.* +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.DefaultBackgroundColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.FontColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.SecondaryFontColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.cornerRadius import com.piashcse.hilt_mvvm_compose_movie.utils.genderInString import com.skydoves.landscapist.ImageOptions import com.skydoves.landscapist.animation.circular.CircularRevealPlugin diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetailViewModel.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetailViewModel.kt index e308ae7..3d62aa1 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetailViewModel.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/artistdetail/ArtistDetailViewModel.kt @@ -1,7 +1,5 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.artistdetail -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.piashcse.hilt_mvvm_compose_movie.data.model.artist.ArtistDetail diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/drawer/NavigationDrawer.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/drawer/NavigationDrawer.kt index 6a117b5..9c1ec56 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/drawer/NavigationDrawer.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/drawer/NavigationDrawer.kt @@ -1,7 +1,13 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.drawer import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainScreen.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainScreen.kt index 21c1fe8..2f33418 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainScreen.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainScreen.kt @@ -1,14 +1,37 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.mainscreen -import androidx.compose.foundation.layout.* -import androidx.compose.material3.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.Menu import androidx.compose.material.icons.filled.Search +import androidx.compose.material3.CenterAlignedTopAppBar +import androidx.compose.material3.DrawerValue +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ModalDrawerSheet +import androidx.compose.material3.ModalNavigationDrawer +import androidx.compose.material3.NavigationBar +import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold -import androidx.compose.runtime.* +import androidx.compose.material3.Snackbar +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.rememberDrawerState +import androidx.compose.material3.rememberTopAppBarState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource @@ -20,10 +43,12 @@ import androidx.navigation.compose.rememberNavController import com.piashcse.hilt_mvvm_compose_movie.R import com.piashcse.hilt_mvvm_compose_movie.data.model.Genres import com.piashcse.hilt_mvvm_compose_movie.data.model.moviedetail.Genre -import com.piashcse.hilt_mvvm_compose_movie.navigation.* +import com.piashcse.hilt_mvvm_compose_movie.navigation.Navigation +import com.piashcse.hilt_mvvm_compose_movie.navigation.Screen +import com.piashcse.hilt_mvvm_compose_movie.navigation.currentRoute import com.piashcse.hilt_mvvm_compose_movie.ui.component.CircularIndeterminateProgressBar -import com.piashcse.hilt_mvvm_compose_movie.ui.component.SearchUI import com.piashcse.hilt_mvvm_compose_movie.ui.component.SearchBar +import com.piashcse.hilt_mvvm_compose_movie.ui.component.SearchUI import com.piashcse.hilt_mvvm_compose_movie.ui.screens.drawer.DrawerUI import com.piashcse.hilt_mvvm_compose_movie.ui.theme.FloatingActionBackground import com.piashcse.hilt_mvvm_compose_movie.ui.theme.cornerRadius diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainViewModel.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainViewModel.kt index ea2c8a5..fcb2736 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainViewModel.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/mainscreen/MainViewModel.kt @@ -11,7 +11,13 @@ import com.piashcse.hilt_mvvm_compose_movie.utils.network.DataState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.debounce +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetail.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetail.kt index f44188e..6255e16 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetail.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetail.kt @@ -1,11 +1,25 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.moviedetail -import androidx.compose.foundation.* -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale @@ -18,15 +32,18 @@ import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import com.piashcse.hilt_mvvm_compose_movie.R -import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem -import com.piashcse.hilt_mvvm_compose_movie.ui.component.CircularIndeterminateProgressBar import com.piashcse.hilt_mvvm_compose_movie.data.datasource.remote.ApiURL +import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem import com.piashcse.hilt_mvvm_compose_movie.data.model.artist.Cast import com.piashcse.hilt_mvvm_compose_movie.navigation.Screen +import com.piashcse.hilt_mvvm_compose_movie.ui.component.CircularIndeterminateProgressBar import com.piashcse.hilt_mvvm_compose_movie.ui.component.ExpandingText import com.piashcse.hilt_mvvm_compose_movie.ui.component.text.SubtitlePrimary import com.piashcse.hilt_mvvm_compose_movie.ui.component.text.SubtitleSecondary -import com.piashcse.hilt_mvvm_compose_movie.ui.theme.* +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.DefaultBackgroundColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.FontColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.SecondaryFontColor +import com.piashcse.hilt_mvvm_compose_movie.ui.theme.cornerRadius import com.piashcse.hilt_mvvm_compose_movie.utils.hourMinutes import com.piashcse.hilt_mvvm_compose_movie.utils.roundTo import com.skydoves.landscapist.ImageOptions diff --git a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetailViewModel.kt b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetailViewModel.kt index e455158..16ab75a 100644 --- a/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetailViewModel.kt +++ b/app/src/main/java/com/piashcse/hilt_mvvm_compose_movie/ui/screens/moviedetail/MovieDetailViewModel.kt @@ -1,17 +1,17 @@ package com.piashcse.hilt_mvvm_compose_movie.ui.screens.moviedetail -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.piashcse.hilt_mvvm_compose_movie.data.model.BaseModel import com.piashcse.hilt_mvvm_compose_movie.data.model.MovieItem import com.piashcse.hilt_mvvm_compose_movie.data.model.artist.Artist import com.piashcse.hilt_mvvm_compose_movie.data.model.moviedetail.MovieDetail import com.piashcse.hilt_mvvm_compose_movie.data.repository.MovieRepository import com.piashcse.hilt_mvvm_compose_movie.utils.network.DataState import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import javax.inject.Inject diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 938bc7d..8565fc4 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,4 +1,4 @@ - +