diff --git a/app/src/main/java/ani/dantotsu/connections/anilist/AnilistQueries.kt b/app/src/main/java/ani/dantotsu/connections/anilist/AnilistQueries.kt
index 1c8ba03d87..2886e66cd8 100644
--- a/app/src/main/java/ani/dantotsu/connections/anilist/AnilistQueries.kt
+++ b/app/src/main/java/ani/dantotsu/connections/anilist/AnilistQueries.kt
@@ -413,6 +413,7 @@ class AnilistQueries {
suspend fun initHomePage(): Map> {
val removeList = PrefManager.getCustomVal("removeList", setOf())
+ val removedMedia = ArrayList()
val toShow: List =
PrefManager.getVal(PrefName.HomeLayout) // anime continue, anime fav, anime planned, manga continue, manga fav, manga planned, recommendations
var query = """{"""
@@ -465,6 +466,8 @@ class AnilistQueries {
if (m.id !in removeList) {
m.cameFromContinue = true
subMap[m.id] = m
+ } else {
+ removedMedia.add(m)
}
}
}
@@ -475,6 +478,8 @@ class AnilistQueries {
if (m.id !in removeList) {
m.cameFromContinue = true
subMap[m.id] = m
+ } else {
+ removedMedia.add(m)
}
}
}
@@ -512,6 +517,8 @@ class AnilistQueries {
if (m.id !in removeList) {
m.cameFromContinue = true
subMap[m.id] = m
+ } else {
+ removedMedia.add(m)
}
}
}
@@ -542,6 +549,8 @@ class AnilistQueries {
val m = Media(i).apply { isFav = true }
if (m.id !in removeList) {
returnArray.add(m)
+ } else {
+ removedMedia.add(m)
}
}
}
@@ -643,6 +652,7 @@ class AnilistQueries {
list.addAll(0, anilistActivities)
returnMap["status"] = ArrayList(list)
}
+ returnMap["hidden"] = removedMedia.distinctBy { it.id } as ArrayList
}
return returnMap
}
diff --git a/app/src/main/java/ani/dantotsu/connections/anilist/AnilistViewModel.kt b/app/src/main/java/ani/dantotsu/connections/anilist/AnilistViewModel.kt
index 65f26c81e2..ad8a36f849 100644
--- a/app/src/main/java/ani/dantotsu/connections/anilist/AnilistViewModel.kt
+++ b/app/src/main/java/ani/dantotsu/connections/anilist/AnilistViewModel.kt
@@ -81,6 +81,15 @@ class AnilistHomeViewModel : ViewModel() {
fun getRecommendation(): LiveData> = recommendation
+ private val userStatus: MutableLiveData> =
+ MutableLiveData>(null)
+
+ fun getUserStatus(): LiveData> = userStatus
+
+ private val hidden: MutableLiveData> =
+ MutableLiveData>(null)
+
+ fun getHidden(): LiveData> = hidden
@Suppress("UNCHECKED_CAST")
suspend fun initHomePage() {
val res = Anilist.query.initHomePage()
@@ -91,12 +100,10 @@ class AnilistHomeViewModel : ViewModel() {
res["favoriteManga"]?.let { mangaFav.postValue(it as ArrayList?) }
res["plannedManga"]?.let { mangaPlanned.postValue(it as ArrayList?) }
res["recommendations"]?.let { recommendation.postValue(it as ArrayList?) }
+ res["hidden"]?.let { hidden.postValue(it as ArrayList?) }
res["status"]?.let { userStatus.postValue(it as ArrayList?) }
}
- private val userStatus: MutableLiveData> =
- MutableLiveData>(null)
- fun getUserStatus(): LiveData> = userStatus
suspend fun loadMain(context: FragmentActivity) {
Anilist.getSavedToken()
diff --git a/app/src/main/java/ani/dantotsu/home/HomeFragment.kt b/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
index 9849d810a8..cc3492fa6e 100644
--- a/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
+++ b/app/src/main/java/ani/dantotsu/home/HomeFragment.kt
@@ -281,7 +281,6 @@ class HomeFragment : Fragment() {
binding.homeFavAnime,
binding.homeFavAnimeMore,
getString(R.string.fav_anime)
-
)
initRecyclerView(
@@ -376,6 +375,37 @@ class HomeFragment : Fragment() {
}
}
+ model.getHidden().observe(viewLifecycleOwner) {
+ if (it != null) {
+ if (it.isNotEmpty()) {
+ binding.homeHiddenItemsRecyclerView.adapter = MediaAdaptor(0, it, requireActivity())
+ binding.homeHiddenItemsRecyclerView.layoutManager = LinearLayoutManager(
+ requireContext(),
+ LinearLayoutManager.HORIZONTAL,
+ false
+ )
+ binding.homeContinueWatch.setOnLongClickListener {
+ binding.homeHiddenItemsContainer.visibility = View.VISIBLE
+ binding.homeHiddenItemsRecyclerView.layoutAnimation =
+ LayoutAnimationController(setSlideIn(), 0.25f)
+ true
+ }
+ binding.homeHiddenItemsMore.setSafeOnClickListener { _ ->
+ ContextCompat.startActivity(
+ requireActivity(), Intent(requireActivity(), MediaListViewActivity::class.java)
+ .putExtra("title", getString(R.string.hidden))
+ .putExtra("media", it),
+ null
+ )
+ }
+ binding.homeHiddenItemsTitle.setOnLongClickListener {
+ binding.homeHiddenItemsContainer.visibility = View.GONE
+ true
+ }
+ }
+ }
+ }
+
binding.homeUserAvatarContainer.startAnimation(setSlideUp())
model.empty.observe(viewLifecycleOwner)
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index f77f7f21c3..0f7c3b3972 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -338,6 +338,56 @@
tools:orientation="horizontal" />
+
+
+
+
+
+
+
+
+
+
+
+
Copy Report
Share as file
Hide in Home Screen
+ Hidden