The Project containes 3 tabs and a details screen.
each tab is an actual page.
including most popular and top-rated movies from the server. support pagination for both, the horizontal and the vertical. saving state of scroll on configuration changes.
clicking on any of the movies will navigate to details screen, with more detail about the selected movie.
a textfiled that auto-fetch relevant movies with the corresponding text. display as grid. has cancel button, support pagination. saving state of scroll on configuration changes.
clicking on any of the movies will navigate to details screen, with more detail about the selected movie.
a vertical list of movies which the user has selected as his favorite. saving state of scroll on configuration changes.
clicking on any of the movies will navigate to details screen, with more detail about the selected movie.
a simple screen contains the movie image, title, and overview has a "add to favorite button" that interact with the local storage to save or remove favorite movies.
I used a Single Activty Application approach, using Jet-Pack Compose only.
MainActivity contains the navigator
the navigator contains the MainScreen and the DetailsScreen
MainScreen contains the 3 pages, (Home, Search, Favorite)
DetailsScreen is relevant only with a movie argument.
each Screen/Page has its own viewModel:
HomePage -> HomeViewModel: contains the popularMoviesState, and topRatedMoviesState, also loading indications.
SearchPage -> SearchViewModel: contains the searchMoviesState, and the searchField state.
FavoritePage -> FavoriteViewModelL contains refernce to DAO, to get all the favorite movies from the user.
DetailsScreen -> DetailsViewModelL contains refernce to DAO, to check if movie is favorite or not, and to set or remove from db.
HomePage - viewmodel(API)
/
MainScreen --|--SearchPage - viewmodel(API)
/ \
MainActivty | FavoritePage - viewmodel(DAO)
\
DetailsScreen - viewmodel(DAO)
Retrofit - easier to implement the REST API requests.
data class for Movie, which is Serializable.
Room Database - most of the fastest ways to get the data.
- Making a generic Composable that support automatic pagination by scroll.
- Dependancy Injection (Dagger Hilt) - helped with providing the instance of the Dao, and for saving the viewmodel instances wuth the MainActivty lifecycle
- Implement a function for passing Serializables using the NavController