Fix dialog dismissal when returning from settings
This commit is contained in:
parent
241f0868cd
commit
b747c87d23
2 changed files with 9 additions and 2 deletions
|
@ -206,7 +206,6 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes
|
|||
viewModel.save(this@MainActivity, data.data)
|
||||
}
|
||||
}
|
||||
REQUEST_DARK_MODE -> recreate()
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
Loading…
Reference in a new issue