Incognito and download switch (#121)
* Offline Mode and incognito Switch * fix * Fix 1 * Update MainActivity.kt * Update MainActivity.kt --------- Co-authored-by: rebel onion <87634197+rebelonion@users.noreply.github.com>
This commit is contained in:
parent
46b84ffc76
commit
84e300482a
14 changed files with 192 additions and 180 deletions
|
@ -1,5 +1,6 @@
|
|||
package ani.dantotsu.offline
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -8,6 +9,8 @@ import androidx.core.view.updateLayoutParams
|
|||
import androidx.fragment.app.Fragment
|
||||
import ani.dantotsu.databinding.FragmentOfflineBinding
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.App
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.startMainActivity
|
||||
import ani.dantotsu.statusBarHeight
|
||||
|
@ -23,8 +26,10 @@ class OfflineFragment : Fragment() {
|
|||
topMargin = statusBarHeight
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
val offline = App.context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.getBoolean("offlineMode", false) ?: false
|
||||
binding.noInternet.text = if (!isOnline(requireContext())) getString(R.string.no_internet) else "OFFLINE MODE"
|
||||
binding.refreshButton.setOnClickListener {
|
||||
if (isOnline(requireContext())) {
|
||||
if (!isOnline(requireContext()) && offline) {
|
||||
startMainActivity(requireActivity())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue