feat: adult only media option
This commit is contained in:
parent
c0bccc027f
commit
99b3bbaaad
13 changed files with 137 additions and 135 deletions
|
@ -278,7 +278,6 @@ class AnimeFragment : Fragment() {
|
|||
}
|
||||
model.loaded = true
|
||||
model.loadTrending(1)
|
||||
model.loadUpdated()
|
||||
model.loadAll()
|
||||
model.loadPopular(
|
||||
"ANIME", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
|
||||
|
|
|
@ -195,70 +195,61 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
|||
}
|
||||
|
||||
fun updateRecent(adaptor: MediaAdaptor) {
|
||||
binding.animeUpdatedProgressBar.visibility = View.GONE
|
||||
binding.animeUpdatedRecyclerView.adapter = adaptor
|
||||
binding.animeUpdatedRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.animeUpdatedRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
binding.apply{
|
||||
init(
|
||||
adaptor,
|
||||
animeUpdatedRecyclerView,
|
||||
animeUpdatedProgressBar,
|
||||
animeRecently
|
||||
)
|
||||
binding.animeUpdatedRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.animeRecently.visibility = View.VISIBLE
|
||||
binding.animeRecently.startAnimation(setSlideUp())
|
||||
binding.animeUpdatedRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
binding.animePopular.visibility = View.VISIBLE
|
||||
animePopular.visibility = View.VISIBLE
|
||||
binding.animePopular.startAnimation(setSlideUp())
|
||||
}
|
||||
}
|
||||
fun updateMovies(adaptor: MediaAdaptor) {
|
||||
binding.animeMoviesProgressBar.visibility = View.GONE
|
||||
binding.animeMoviesRecyclerView.adapter = adaptor
|
||||
binding.animeMoviesRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.animeMoviesRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
binding.apply{
|
||||
init(
|
||||
adaptor,
|
||||
animeMoviesRecyclerView,
|
||||
animeMoviesProgressBar,
|
||||
animeMovies
|
||||
)
|
||||
binding.animeMoviesRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.animeMovies.visibility = View.VISIBLE
|
||||
binding.animeMovies.startAnimation(setSlideUp())
|
||||
binding.animeMoviesRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateTopRated(adaptor: MediaAdaptor) {
|
||||
binding.animeTopRatedProgressBar.visibility = View.GONE
|
||||
binding.animeTopRatedRecyclerView.adapter = adaptor
|
||||
binding.animeTopRatedRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.animeTopRatedRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
binding.apply{
|
||||
init(
|
||||
adaptor,
|
||||
animeTopRatedRecyclerView,
|
||||
animeTopRatedProgressBar,
|
||||
animeTopRated
|
||||
)
|
||||
binding.animeTopRatedRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.animeTopRated.visibility = View.VISIBLE
|
||||
binding.animeTopRated.startAnimation(setSlideUp())
|
||||
binding.animeTopRatedRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
}
|
||||
fun updateMostFav(adaptor: MediaAdaptor) {
|
||||
binding.animeMostFavProgressBar.visibility = View.GONE
|
||||
binding.animeMostFavRecyclerView.adapter = adaptor
|
||||
binding.animeMostFavRecyclerView.layoutManager =
|
||||
binding.apply{
|
||||
init(
|
||||
adaptor,
|
||||
animeMostFavRecyclerView,
|
||||
animeMostFavProgressBar,
|
||||
animeMostFav
|
||||
)
|
||||
}
|
||||
}
|
||||
fun init(adaptor: MediaAdaptor,recyclerView: RecyclerView, progress: View, title: View){
|
||||
progress.visibility = View.GONE
|
||||
recyclerView.adapter = adaptor
|
||||
recyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.animeMostFavRecyclerView.context,
|
||||
recyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.animeMostFavRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.animeMostFav.visibility = View.VISIBLE
|
||||
binding.animeMostFav.startAnimation(setSlideUp())
|
||||
binding.animeMostFavRecyclerView.layoutAnimation =
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
title.visibility = View.VISIBLE
|
||||
title.startAnimation(setSlideUp())
|
||||
recyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
fun updateAvatar() {
|
||||
|
|
|
@ -160,7 +160,7 @@ class MangaFragment : Fragment() {
|
|||
})
|
||||
mangaPageAdapter.ready.observe(viewLifecycleOwner) { i ->
|
||||
if (i == true) {
|
||||
model.getTrendingNovel().observe(viewLifecycleOwner) {
|
||||
model.getPopularNovel().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateNovel(MediaAdaptor(0, it, requireActivity()))
|
||||
}
|
||||
|
@ -257,7 +257,6 @@ class MangaFragment : Fragment() {
|
|||
}
|
||||
model.loaded = true
|
||||
model.loadTrending()
|
||||
model.loadTrendingNovel()
|
||||
model.loadAll()
|
||||
model.loadPopular(
|
||||
"MANGA", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
|
||||
|
|
|
@ -182,86 +182,72 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
|||
}
|
||||
|
||||
fun updateTrendingManga(adaptor: MediaAdaptor) {
|
||||
binding.mangaTrendingMangaProgressBar.visibility = View.GONE
|
||||
binding.mangaTrendingMangaRecyclerView.adapter = adaptor
|
||||
binding.mangaTrendingMangaRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.mangaTrendingMangaRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTrendingMangaRecyclerView,
|
||||
mangaTrendingMangaProgressBar,
|
||||
mangaTrendingManga
|
||||
)
|
||||
binding.mangaTrendingMangaRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.mangaTrendingManga.visibility = View.VISIBLE
|
||||
binding.mangaTrendingManga.startAnimation(setSlideUp())
|
||||
binding.mangaTrendingMangaRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
}
|
||||
fun updateTrendingManhwa(adaptor: MediaAdaptor) {
|
||||
binding.mangaTrendingManhwaProgressBar.visibility = View.GONE
|
||||
binding.mangaTrendingManhwaRecyclerView.adapter = adaptor
|
||||
binding.mangaTrendingManhwaRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.mangaNovelRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTrendingManhwaRecyclerView,
|
||||
mangaTrendingManhwaProgressBar,
|
||||
mangaTrendingManhwa
|
||||
)
|
||||
binding.mangaTrendingManhwaRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.mangaTrendingManhwa.visibility = View.VISIBLE
|
||||
binding.mangaTrendingManhwa.startAnimation(setSlideUp())
|
||||
binding.mangaTrendingManhwaRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
fun updateTopRated(adaptor: MediaAdaptor) {
|
||||
binding.mangaTopRatedProgressBar.visibility = View.GONE
|
||||
binding.mangaTopRatedRecyclerView.adapter = adaptor
|
||||
binding.mangaTopRatedRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.mangaTopRatedRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.mangaTopRatedRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.mangaTopRated.visibility = View.VISIBLE
|
||||
binding.mangaTopRated.startAnimation(setSlideUp())
|
||||
binding.mangaTopRatedRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
fun updateMostFav(adaptor: MediaAdaptor) {
|
||||
binding.mangaMostFavProgressBar.visibility = View.GONE
|
||||
binding.mangaMostFavRecyclerView.adapter = adaptor
|
||||
binding.mangaMostFavRecyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.mangaMostFavRecyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.mangaMostFavRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.mangaMostFav.visibility = View.VISIBLE
|
||||
binding.mangaMostFav.startAnimation(setSlideUp())
|
||||
binding.mangaMostFavRecyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
}
|
||||
fun updateNovel(adaptor: MediaAdaptor) {
|
||||
binding.mangaNovelProgressBar.visibility = View.GONE
|
||||
binding.mangaNovelRecyclerView.adapter = adaptor
|
||||
binding.mangaNovelRecyclerView.layoutManager =
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaNovelRecyclerView,
|
||||
mangaNovelProgressBar,
|
||||
mangaNovel
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
fun updateTopRated(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaTopRatedRecyclerView,
|
||||
mangaTopRatedProgressBar,
|
||||
mangaTopRated
|
||||
)
|
||||
}
|
||||
}
|
||||
fun updateMostFav(adaptor: MediaAdaptor) {
|
||||
binding.apply {
|
||||
init(
|
||||
adaptor,
|
||||
mangaMostFavRecyclerView,
|
||||
mangaMostFavProgressBar,
|
||||
mangaMostFav
|
||||
)
|
||||
mangaPopular.visibility = View.VISIBLE
|
||||
mangaPopular.startAnimation(setSlideUp())
|
||||
}
|
||||
}
|
||||
fun init(adaptor: MediaAdaptor,recyclerView: RecyclerView, progress: View, title: View){
|
||||
progress.visibility = View.GONE
|
||||
recyclerView.adapter = adaptor
|
||||
recyclerView.layoutManager =
|
||||
LinearLayoutManager(
|
||||
binding.mangaNovelRecyclerView.context,
|
||||
recyclerView.context,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
binding.mangaNovelRecyclerView.visibility = View.VISIBLE
|
||||
|
||||
binding.mangaNovel.visibility = View.VISIBLE
|
||||
binding.mangaNovel.startAnimation(setSlideUp())
|
||||
binding.mangaNovelRecyclerView.layoutAnimation =
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
title.visibility = View.VISIBLE
|
||||
title.startAnimation(setSlideUp())
|
||||
recyclerView.layoutAnimation =
|
||||
LayoutAnimationController(setSlideIn(), 0.25f)
|
||||
binding.mangaPopular.visibility = View.VISIBLE
|
||||
binding.mangaPopular.startAnimation(setSlideUp())
|
||||
}
|
||||
|
||||
fun updateAvatar() {
|
||||
|
|
|
@ -30,7 +30,7 @@ class OtherDetailsViewModel : ViewModel() {
|
|||
fun getCalendar(): LiveData<Map<String, MutableList<Media>>> = calendar
|
||||
suspend fun loadCalendar() {
|
||||
val curr = System.currentTimeMillis() / 1000
|
||||
val res = Anilist.query.recentlyUpdated(false, curr - 86400, curr + (86400 * 6))
|
||||
val res = Anilist.query.recentlyUpdated(curr - 86400, curr + (86400 * 6))
|
||||
val df = DateFormat.getDateInstance(DateFormat.FULL)
|
||||
val map = mutableMapOf<String, MutableList<Media>>()
|
||||
val idMap = mutableMapOf<String, MutableList<Int>>()
|
||||
|
|
|
@ -457,7 +457,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
settingsIncludeAnimeList.isChecked = PrefManager.getVal(PrefName.IncludeAnimeList)
|
||||
settingsIncludeAnimeList.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.IncludeAnimeList, isChecked)
|
||||
restartApp(binding.root)
|
||||
}
|
||||
|
||||
var previousEp: View = when (PrefManager.getVal<Int>(PrefName.AnimeDefaultView)) {
|
||||
0 -> settingsEpList
|
||||
1 -> settingsEpGrid
|
||||
|
@ -548,6 +550,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
settingsIncludeMangaList.isChecked = PrefManager.getVal(PrefName.IncludeMangaList)
|
||||
settingsIncludeMangaList.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.IncludeMangaList, isChecked)
|
||||
restartApp(binding.root)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,7 +724,11 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.RecentlyListOnly, isChecked)
|
||||
}
|
||||
|
||||
settingsAdultAnimeOnly.isChecked = PrefManager.getVal(PrefName.AdultOnly)
|
||||
settingsAdultAnimeOnly.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.AdultOnly, isChecked)
|
||||
restartApp(binding.root)
|
||||
}
|
||||
var previousStart: View = when (PrefManager.getVal<Int>(PrefName.DefaultStartUpTab)) {
|
||||
0 -> uiSettingsAnime
|
||||
1 -> uiSettingsHome
|
||||
|
|
|
@ -40,6 +40,9 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
|||
LastAnilistNotificationId(Pref(Location.General, Int::class, 0)),
|
||||
AnilistFilteredTypes(Pref(Location.General, Set::class, setOf<String>())),
|
||||
UseAlarmManager(Pref(Location.General, Boolean::class, false)),
|
||||
IncludeAnimeList(Pref(Location.General, Boolean::class, true)),
|
||||
IncludeMangaList(Pref(Location.General, Boolean::class, true)),
|
||||
AdultOnly(Pref(Location.General, Boolean::class, false)),
|
||||
|
||||
//User Interface
|
||||
UseOLED(Pref(Location.UI, Boolean::class, false)),
|
||||
|
@ -77,8 +80,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
|||
MangaListSortOrder(Pref(Location.UI, String::class, "score")),
|
||||
CommentSortOrder(Pref(Location.UI, String::class, "newest")),
|
||||
FollowerLayout(Pref(Location.UI, Int::class, 0)),
|
||||
IncludeAnimeList(Pref(Location.UI, Boolean::class, true)),
|
||||
IncludeMangaList(Pref(Location.UI, Boolean::class, true)),
|
||||
|
||||
|
||||
//Player
|
||||
DefaultSpeed(Pref(Location.Player, Int::class, 5)),
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
android:id="@+id/profileFollowerCountContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
@ -180,7 +180,7 @@
|
|||
android:id="@+id/profileFollowingCountContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
@ -210,7 +210,7 @@
|
|||
android:id="@+id/profileAnimeCountContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
@ -240,7 +240,7 @@
|
|||
android:id="@+id/profileMangaCountContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
|
|
@ -198,7 +198,6 @@
|
|||
android:id="@+id/settingsIncludeAnimeList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:checked="true"
|
||||
android:drawableStart="@drawable/ic_round_movie_filter_24"
|
||||
android:drawablePadding="16dp"
|
||||
|
@ -212,5 +211,7 @@
|
|||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track" />
|
||||
|
||||
|
||||
</ani.dantotsu.others.Xpandable>
|
||||
</merge>
|
|
@ -2,6 +2,7 @@
|
|||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<ani.dantotsu.others.Xpandable
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -299,5 +300,22 @@
|
|||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/settingsAdultAnimeOnly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:drawableStart="@drawable/ic_round_nsfw_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:minHeight="64dp"
|
||||
android:text="@string/adult_only_content"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?attr/colorOnBackground"
|
||||
app:cornerRadius="0dp"
|
||||
app:drawableTint="?attr/colorPrimary"
|
||||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track" />
|
||||
</ani.dantotsu.others.Xpandable>
|
||||
</merge>
|
|
@ -162,7 +162,7 @@
|
|||
android:id="@+id/settingsIncludeMangaList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:checked="false"
|
||||
android:drawableStart="@drawable/ic_round_movie_filter_24"
|
||||
android:drawablePadding="16dp"
|
||||
android:elegantTextHeight="true"
|
||||
|
|
|
@ -327,8 +327,7 @@
|
|||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible">
|
||||
android:visibility="invisible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
|
@ -337,7 +336,6 @@
|
|||
android:fontFamily="@font/poppins_bold"
|
||||
android:padding="8dp"
|
||||
android:text="@string/popular_manga"
|
||||
android:visibility="invisible"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
|
|
|
@ -848,4 +848,5 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
|||
<string name="top_rated">Top rated</string>
|
||||
<string name="most_favourite">Most Favourite</string>
|
||||
<string name="trending_manhwa">Trending Manhwa</string>
|
||||
<string name="adult_only_content">Adult only content</string>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue