incognito header fix

This commit is contained in:
rebelonion 2024-01-17 01:45:41 -06:00
parent 4e6842862e
commit 51a5609395
12 changed files with 185 additions and 96 deletions

View file

@ -279,7 +279,6 @@ class AnimeFragment : Fragment() {
override fun onResume() {
if (!model.loaded) Refresh.activity[this.hashCode()]!!.postValue(true)
if (animePageAdapter.trendingViewPager != null) {
animePageAdapter.setIncognito()
binding.root.requestApplyInsets()
binding.root.requestLayout()
}

View file

@ -93,7 +93,6 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
)
}
setIncognito()
binding.animeSearchBar.setEndIconOnClickListener {
binding.animeSearchBarText.performClick()
}
@ -150,19 +149,6 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
trendingViewPager!!.updateLayoutParams { height += statusBarHeight }
}
fun setIncognito() {
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if (incognito) {
binding.incognitoTextView.visibility = View.VISIBLE
if (!uiSettings.immersiveMode) {
binding.root.fitsSystemWindows = true
}
} else {
binding.incognitoTextView.visibility = View.GONE
}
}
fun updateTrending(adaptor: MediaAdaptor) {
binding.animeTrendingProgressBar.visibility = View.GONE
binding.animeTrendingViewPager.adapter = adaptor

View file

@ -72,7 +72,6 @@ class HomeFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val scope = lifecycleScope
var uiSettings = loadData<UserInterfaceSettings>("ui_settings") ?: UserInterfaceSettings()
setIncognito()
fun load() {
if (activity != null && _binding != null) lifecycleScope.launch(Dispatchers.Main) {
binding.homeUserName.text = Anilist.username
@ -359,30 +358,8 @@ class HomeFragment : Fragment() {
}
}
private fun setIncognito() {
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if (incognito) {
val uiSettings =
loadData<UserInterfaceSettings>("ui_settings") ?: UserInterfaceSettings()
binding.incognitoTextView.visibility = View.VISIBLE
if (!uiSettings.immersiveMode) {
binding.root.fitsSystemWindows = true
//holy deprecation
binding.root.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
binding.root.requestApplyInsets()
binding.root.requestLayout()
}
} else {
binding.incognitoTextView.visibility = View.GONE
}
}
override fun onResume() {
if (!model.loaded) Refresh.activity[1]!!.postValue(true)
setIncognito()
super.onResume()
}
}

View file

@ -254,7 +254,6 @@ class MangaFragment : Fragment() {
if (!model.loaded) Refresh.activity[this.hashCode()]!!.postValue(true)
//make sure mangaPageAdapter is initialized
if (mangaPageAdapter.trendingViewPager != null) {
mangaPageAdapter.setIncognito()
binding.root.requestApplyInsets()
binding.root.requestLayout()
}

View file

@ -98,7 +98,6 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
}
setIncognito()
binding.mangaSearchBar.setEndIconOnClickListener {
binding.mangaSearchBarText.performClick()
}
@ -141,20 +140,6 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
fun updateHeight() {
trendingViewPager!!.updateLayoutParams { height += statusBarHeight }
}
fun setIncognito() {
val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("incognito", false) ?: false
if (incognito) {
binding.incognitoTextView.visibility = View.VISIBLE
if (!uiSettings.immersiveMode) {
binding.root.fitsSystemWindows = true
}
} else {
binding.incognitoTextView.visibility = View.GONE
}
}
fun updateTrending(adaptor: MediaAdaptor) {
binding.mangaTrendingProgressBar.visibility = View.GONE
binding.mangaTrendingViewPager.adapter = adaptor