check for activity context
This commit is contained in:
parent
8a9668bc79
commit
b8fbeed785
2 changed files with 18 additions and 8 deletions
|
@ -242,11 +242,16 @@ class MangaFragment : Fragment() {
|
|||
model.loaded = true
|
||||
model.loadTrending()
|
||||
model.loadTrendingNovel()
|
||||
model.loadPopular("MANGA", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
.getBoolean("popular_list", false) )
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.mangaRefresh?.isRefreshing = false
|
||||
withContext(Dispatchers.Main) {
|
||||
if (isAdded) {
|
||||
val sharedPrefs = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
val isPopularList = sharedPrefs.getBoolean("popular_list", false)
|
||||
model.loadPopular("MANGA", sort = Anilist.sortBy[1], onList = isPopularList)
|
||||
}
|
||||
live.postValue(false)
|
||||
_binding?.mangaRefresh?.isRefreshing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue