fix crash in EditProfileActivity

This commit is contained in:
Conny Duck 2018-12-06 22:34:36 +01:00
parent f87b87bea3
commit 073c673e6d

View file

@ -59,6 +59,8 @@ class EditProfileActivity : BaseActivity(), Injectable {
private const val HEADER_PICK_RESULT = 2 private const val HEADER_PICK_RESULT = 2
private const val PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1 private const val PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1
private const val MAX_ACCOUNT_FIELDS = 4 private const val MAX_ACCOUNT_FIELDS = 4
private const val BUNDLE_CURRENTLY_PICKING = "BUNDLE_CURRENTLY_PICKING"
} }
@Inject @Inject
@ -78,6 +80,11 @@ class EditProfileActivity : BaseActivity(), Injectable {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
savedInstanceState?.getString(BUNDLE_CURRENTLY_PICKING)?.let {
currentlyPicking = PickType.valueOf(it)
}
setContentView(R.layout.activity_edit_profile) setContentView(R.layout.activity_edit_profile)
viewModel = ViewModelProviders.of(this, viewModelFactory)[EditProfileViewModel::class.java] viewModel = ViewModelProviders.of(this, viewModelFactory)[EditProfileViewModel::class.java]
@ -170,6 +177,11 @@ class EditProfileActivity : BaseActivity(), Injectable {
} }
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putString(BUNDLE_CURRENTLY_PICKING, currentlyPicking.toString())
}
override fun onStop() { override fun onStop() {
super.onStop() super.onStop()
if(!isFinishing) { if(!isFinishing) {