clean Sad's shit
This commit is contained in:
parent
84e300482a
commit
cc5b512441
53 changed files with 652 additions and 466 deletions
|
@ -2,7 +2,6 @@ package ani.dantotsu.home
|
|||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -25,7 +24,6 @@ import ani.dantotsu.connections.anilist.Anilist
|
|||
import ani.dantotsu.connections.anilist.AnilistMangaViewModel
|
||||
import ani.dantotsu.connections.anilist.SearchResults
|
||||
import ani.dantotsu.connections.anilist.getUserId
|
||||
import ani.dantotsu.currContext
|
||||
import ani.dantotsu.databinding.FragmentMangaBinding
|
||||
import ani.dantotsu.loadData
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
|
@ -48,14 +46,14 @@ class MangaFragment : Fragment() {
|
|||
private lateinit var mangaPageAdapter: MangaPageAdapter
|
||||
|
||||
private var uiSettings: UserInterfaceSettings =
|
||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||
|
||||
val model: AnilistMangaViewModel by activityViewModels()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentMangaBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
|
@ -76,11 +74,11 @@ class MangaFragment : Fragment() {
|
|||
if (displayCutout != null) {
|
||||
if (displayCutout.boundingRects.size > 0) {
|
||||
height = max(
|
||||
statusBarHeight,
|
||||
min(
|
||||
displayCutout.boundingRects[0].width(),
|
||||
displayCutout.boundingRects[0].height()
|
||||
)
|
||||
statusBarHeight,
|
||||
min(
|
||||
displayCutout.boundingRects[0].width(),
|
||||
displayCutout.boundingRects[0].height()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -98,18 +96,18 @@ class MangaFragment : Fragment() {
|
|||
if (model.notSet) {
|
||||
model.notSet = false
|
||||
model.searchResults = SearchResults(
|
||||
"MANGA",
|
||||
isAdult = false,
|
||||
onList = false,
|
||||
results = arrayListOf(),
|
||||
hasNextPage = true,
|
||||
sort = Anilist.sortBy[1]
|
||||
"MANGA",
|
||||
isAdult = false,
|
||||
onList = false,
|
||||
results = arrayListOf(),
|
||||
hasNextPage = true,
|
||||
sort = Anilist.sortBy[1]
|
||||
)
|
||||
}
|
||||
val popularAdaptor = MediaAdaptor(1, model.searchResults.results, requireActivity())
|
||||
val progressAdaptor = ProgressAdapter(searched = model.searched)
|
||||
binding.mangaPageRecyclerView.adapter =
|
||||
ConcatAdapter(mangaPageAdapter, popularAdaptor, progressAdaptor)
|
||||
ConcatAdapter(mangaPageAdapter, popularAdaptor, progressAdaptor)
|
||||
val layout = LinearLayoutManager(requireContext())
|
||||
binding.mangaPageRecyclerView.layoutManager = layout
|
||||
|
||||
|
@ -135,7 +133,7 @@ class MangaFragment : Fragment() {
|
|||
}
|
||||
|
||||
binding.mangaPageRecyclerView.addOnScrollListener(object :
|
||||
RecyclerView.OnScrollListener() {
|
||||
RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(v: RecyclerView, dx: Int, dy: Int) {
|
||||
if (!v.canScrollVertically(1)) {
|
||||
if (model.searchResults.hasNextPage && model.searchResults.results.isNotEmpty() && !loading) {
|
||||
|
@ -175,19 +173,19 @@ class MangaFragment : Fragment() {
|
|||
model.getTrending().observe(viewLifecycleOwner) {
|
||||
if (it != null) {
|
||||
mangaPageAdapter.updateTrending(
|
||||
MediaAdaptor(
|
||||
if (uiSettings.smallView) 3 else 2,
|
||||
it,
|
||||
requireActivity(),
|
||||
viewPager = mangaPageAdapter.trendingViewPager
|
||||
)
|
||||
MediaAdaptor(
|
||||
if (uiSettings.smallView) 3 else 2,
|
||||
it,
|
||||
requireActivity(),
|
||||
viewPager = mangaPageAdapter.trendingViewPager
|
||||
)
|
||||
)
|
||||
mangaPageAdapter.updateAvatar()
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.mangaPageScrollTop.translationY =
|
||||
-(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
||||
-(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue