Fix dialog dismissal when returning from settings
This commit is contained in:
parent
d0736458b6
commit
e08d03ef01
2 changed files with 9 additions and 2 deletions
|
@ -206,7 +206,6 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes
|
||||||
viewModel.save(this@MainActivity, data.data)
|
viewModel.save(this@MainActivity, data.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REQUEST_DARK_MODE -> recreate()
|
|
||||||
}
|
}
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ class MainMenuFragment : BottomSheetDialogFragment(), CoroutineScope {
|
||||||
R.id.action_settings -> {
|
R.id.action_settings -> {
|
||||||
val settingsIntent = Intent(context, SettingsActivity::class.java)
|
val settingsIntent = Intent(context, SettingsActivity::class.java)
|
||||||
startActivityForResult(settingsIntent, MainActivity.REQUEST_DARK_MODE)
|
startActivityForResult(settingsIntent, MainActivity.REQUEST_DARK_MODE)
|
||||||
dialog?.dismiss()
|
|
||||||
}
|
}
|
||||||
R.id.action_libraries -> showInfoActivity(context, R.id.action_libraries)
|
R.id.action_libraries -> showInfoActivity(context, R.id.action_libraries)
|
||||||
R.id.action_privacy -> showInfoActivity(context, R.id.action_privacy)
|
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) {
|
private fun showInfoActivity(context: Context?, action: Int) {
|
||||||
val infoIntent = Intent(context, MarkdownInfoActivity::class.java)
|
val infoIntent = Intent(context, MarkdownInfoActivity::class.java)
|
||||||
var fileName = ""
|
var fileName = ""
|
||||||
|
|
Loading…
Reference in a new issue