From c57c33c088af44f08e55e38ae4d42b4ff00d5f56 Mon Sep 17 00:00:00 2001 From: Sadwhy <99601717+Sadwhy@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:55:01 +0600 Subject: [PATCH] Small delay to offline toggle (#171) --- .../java/ani/dantotsu/settings/SettingsDialogFragment.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt index 4d9202384a0..5f62fc67cc3 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt @@ -3,6 +3,8 @@ package ani.dantotsu.settings import android.content.Intent import android.graphics.Color import android.os.Bundle +import java.util.* +import kotlin.concurrent.schedule import android.util.TypedValue import android.view.LayoutInflater import android.view.View @@ -101,6 +103,7 @@ class SettingsDialogFragment : BottomSheetDialogFragment() { binding.settingsDownloads.isChecked = PrefManager.getVal(PrefName.OfflineMode) binding.settingsDownloads.setOnCheckedChangeListener { _, isChecked -> + Timer().schedule(300){ when (pageType) { PageType.MANGA -> { val intent = Intent(activity, NoInternet::class.java) @@ -151,6 +154,7 @@ class SettingsDialogFragment : BottomSheetDialogFragment() { dismiss() PrefManager.setVal(PrefName.OfflineMode, isChecked) } + } } override fun onDestroyView() { @@ -171,4 +175,4 @@ class SettingsDialogFragment : BottomSheetDialogFragment() { return fragment } } -} \ No newline at end of file +}