From eb1c8b682953c8d05f89f75005034d6b88ccc58a Mon Sep 17 00:00:00 2001 From: Nabil Bouzine Date: Tue, 9 Sep 2025 19:48:08 +0100 Subject: [PATCH 1/3] feature: implement empty state for watch history --- .../watchhistory/WatchHistoryAdapter.kt | 2 + .../watchhistory/WatchHistoryFragment.kt | 6 +- .../watchhistory/WatchHistoryUIEvent.kt | 2 + .../watchhistory/WatchHistoryViewModel.kt | 3 + app/src/main/res/drawable/ic_history.xml | 39 --------- .../main/res/drawable/ic_history_colored.xml | 7 ++ .../res/drawable/icon_circle_background.xml | 6 ++ .../drawable/squircle_button_background.xml | 19 +++++ .../main/res/layout/empty_history_item.xml | 81 +++++++++++++++++++ app/src/main/res/layout/fragment_search.xml | 2 +- .../res/layout/fragment_watch_history.xml | 6 +- .../main/res/navigation/movie_navigation.xml | 6 +- app/src/main/res/values/strings.xml | 5 +- 13 files changed, 138 insertions(+), 46 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_history.xml create mode 100644 app/src/main/res/drawable/ic_history_colored.xml create mode 100644 app/src/main/res/drawable/icon_circle_background.xml create mode 100644 app/src/main/res/drawable/squircle_button_background.xml create mode 100644 app/src/main/res/layout/empty_history_item.xml diff --git a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryAdapter.kt b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryAdapter.kt index 4c69f4662..e3bd0ed3c 100644 --- a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryAdapter.kt @@ -13,4 +13,6 @@ class WatchHistoryAdapter( interface WatchHistoryInteractionListener : BaseInteractionListener { fun onClickMovie(item: MediaHistoryUiState) + + fun onClickExplore() } \ No newline at end of file diff --git a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryFragment.kt b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryFragment.kt index fa334ca20..b05e7289e 100644 --- a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryFragment.kt +++ b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryFragment.kt @@ -35,13 +35,17 @@ class WatchHistoryFragment : BaseFragment() { event.movieID ) } + is WatchHistoryUIEvent.TVShowEvent -> { WatchHistoryFragmentDirections.actionWatchHistoryFragmentToTvShowDetailsFragment( event.tvShowID ) } + + is WatchHistoryUIEvent.NavigateExploreEvent -> { + WatchHistoryFragmentDirections.actionWatchHistoryFragmentToExploringFragment() + } } findNavController().navigate(action) } - } \ No newline at end of file diff --git a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryUIEvent.kt b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryUIEvent.kt index 0ad5bebaa..c1bd64c2c 100644 --- a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryUIEvent.kt +++ b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryUIEvent.kt @@ -3,4 +3,6 @@ package com.karrar.movieapp.ui.profile.watchhistory sealed interface WatchHistoryUIEvent { data class MovieEvent(val movieID: Int) : WatchHistoryUIEvent data class TVShowEvent(val tvShowID: Int) : WatchHistoryUIEvent + + class NavigateExploreEvent(): WatchHistoryUIEvent } \ No newline at end of file diff --git a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryViewModel.kt b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryViewModel.kt index 19ea5885d..2a8af4218 100644 --- a/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryViewModel.kt +++ b/app/src/main/java/com/karrar/movieapp/ui/profile/watchhistory/WatchHistoryViewModel.kt @@ -53,4 +53,7 @@ class WatchHistoryViewModel @Inject constructor( } } + override fun onClickExplore() { + _watchHistoryUIEvent.update { Event(WatchHistoryUIEvent.NavigateExploreEvent()) } + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_history.xml b/app/src/main/res/drawable/ic_history.xml deleted file mode 100644 index 97d52adca..000000000 --- a/app/src/main/res/drawable/ic_history.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - diff --git a/app/src/main/res/drawable/ic_history_colored.xml b/app/src/main/res/drawable/ic_history_colored.xml new file mode 100644 index 000000000..5d996c9dd --- /dev/null +++ b/app/src/main/res/drawable/ic_history_colored.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/src/main/res/drawable/icon_circle_background.xml b/app/src/main/res/drawable/icon_circle_background.xml new file mode 100644 index 000000000..1e9829ba0 --- /dev/null +++ b/app/src/main/res/drawable/icon_circle_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/squircle_button_background.xml b/app/src/main/res/drawable/squircle_button_background.xml new file mode 100644 index 000000000..9a8d9a0fc --- /dev/null +++ b/app/src/main/res/drawable/squircle_button_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/empty_history_item.xml b/app/src/main/res/layout/empty_history_item.xml new file mode 100644 index 000000000..0ca0283e2 --- /dev/null +++ b/app/src/main/res/layout/empty_history_item.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + +