diff --git a/app/build.gradle b/app/build.gradle index ea147117..455f7b47 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,7 +29,7 @@ android { debug { applicationIdSuffix ".sad" manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_beta", icon_placeholder_round: "@mipmap/ic_launcher_beta_round"] - debuggable true + debuggable false } release { manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher", icon_placeholder_round: "@mipmap/ic_launcher_round"] diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt index de4727d4..decc6f79 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsDialogFragment.kt @@ -28,6 +28,7 @@ import ani.dantotsu.others.imagesearch.ImageSearchActivity import ani.dantotsu.setSafeOnClickListener import ani.dantotsu.startMainActivity import ani.dantotsu.toast +import com.google.android.material.snackbar.Snackbar class SettingsDialogFragment() : BottomSheetDialogFragment() { @@ -75,17 +76,25 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() { Anilist.loginIntent(requireActivity()) } } + binding.settingsIncognito.isChecked = - getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean( + context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + ?.getBoolean( "incognito", false ) + binding.settingsIncognito.setOnCheckedChangeListener { _, isChecked -> - getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() - .putBoolean("incognito", isChecked).apply() - restartApp() - } + context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit() + ?.putBoolean("incognito", isChecked).apply() + } + + incognito = context?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + ?.getBoolean( + "incognito", + false + ) binding.settingsExtensionSettings.setSafeOnClickListener { startActivity(Intent(activity, ExtensionsActivity::class.java)) @@ -143,25 +152,6 @@ class SettingsDialogFragment() : BottomSheetDialogFragment() { _binding = null } - private fun restartApp() { - Snackbar.make( - binding.root, - R.string.restart_app, Snackbar.LENGTH_SHORT - ).apply { - val mainIntent = - Intent.makeRestartActivityTask( - context.packageManager.getLaunchIntentForPackage( - context.packageName - )!!.component - ) - setAction("Do it!") { - context.startActivity(mainIntent) - Runtime.getRuntime().exit(0) - } - show() - } - } - companion object { enum class PageType { MANGA, ANIME, HOME