backend preference wrapper

This commit is contained in:
rebelonion 2024-01-30 00:39:12 -06:00
parent eb5b83564f
commit 8020b32541
66 changed files with 482 additions and 458 deletions

View file

@ -11,6 +11,8 @@ import ani.dantotsu.R
import ani.dantotsu.databinding.FragmentOfflineBinding
import ani.dantotsu.isOnline
import ani.dantotsu.navBarHeight
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.settings.saving.PrefWrapper
import ani.dantotsu.startMainActivity
import ani.dantotsu.statusBarHeight
@ -26,8 +28,7 @@ class OfflineFragment : Fragment() {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
offline = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("offlineMode", false) ?: false
offline = PrefWrapper.getVal(PrefName.OfflineMode, false)
binding.noInternet.text =
if (offline) "Offline Mode" else getString(R.string.no_internet)
binding.refreshButton.visibility = if (offline) View.GONE else View.VISIBLE
@ -41,7 +42,6 @@ class OfflineFragment : Fragment() {
override fun onResume() {
super.onResume()
offline = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getBoolean("offlineMode", false) ?: false
offline = PrefWrapper.getVal(PrefName.OfflineMode, false)
}
}