diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt index 8a6fcfd..f46f972 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/activity/MainActivity.kt @@ -206,7 +206,6 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes viewModel.save(this@MainActivity, data.data) } } - REQUEST_DARK_MODE -> recreate() } super.onActivityResult(requestCode, resultCode, data) } diff --git a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt index bedf810..77030e6 100644 --- a/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt +++ b/app/src/main/java/com/wbrawner/simplemarkdown/view/fragment/MainMenuFragment.kt @@ -40,7 +40,6 @@ class MainMenuFragment : BottomSheetDialogFragment(), CoroutineScope { R.id.action_settings -> { val settingsIntent = Intent(context, SettingsActivity::class.java) startActivityForResult(settingsIntent, MainActivity.REQUEST_DARK_MODE) - dialog?.dismiss() } R.id.action_libraries -> showInfoActivity(context, R.id.action_libraries) R.id.action_privacy -> showInfoActivity(context, R.id.action_privacy) @@ -54,6 +53,15 @@ class MainMenuFragment : BottomSheetDialogFragment(), CoroutineScope { } } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + if (requestCode == MainActivity.REQUEST_DARK_MODE) { + activity?.recreate() + dialog?.dismiss() + return + } + super.onActivityResult(requestCode, resultCode, data) + } + private fun showInfoActivity(context: Context?, action: Int) { val infoIntent = Intent(context, MarkdownInfoActivity::class.java) var fileName = ""