Fix crash in ProfileSwitchDialog
This commit is contained in:
parent
75439f53f4
commit
26c1652bba
2 changed files with 5 additions and 5 deletions
|
@ -59,7 +59,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private var profileIndex: Int? = null
|
private var profileName: String? = null
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
private var _binding: DialogProfileswitchBinding? = null
|
private var _binding: DialogProfileswitchBinding? = null
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
): View {
|
): View {
|
||||||
onCreateViewGeneral()
|
onCreateViewGeneral()
|
||||||
arguments?.let { bundle ->
|
arguments?.let { bundle ->
|
||||||
profileIndex = bundle.getInt("profileIndex", 0)
|
profileName = bundle.getString("profileName", null)
|
||||||
}
|
}
|
||||||
_binding = DialogProfileswitchBinding.inflate(inflater, container, false)
|
_binding = DialogProfileswitchBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -130,8 +130,8 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList))
|
binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList))
|
||||||
// set selected to actual profile
|
// set selected to actual profile
|
||||||
if (profileIndex != null)
|
if (profileName != null)
|
||||||
binding.profileList.setText(profileList[profileIndex as Int], false)
|
binding.profileList.setText(profileName, false)
|
||||||
else {
|
else {
|
||||||
binding.profileList.setText(profileList[0], false)
|
binding.profileList.setText(profileList[0], false)
|
||||||
for (p in profileList.indices)
|
for (p in profileList.indices)
|
||||||
|
|
|
@ -308,7 +308,7 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
|
|
||||||
binding.profileswitch.setOnClickListener {
|
binding.profileswitch.setOnClickListener {
|
||||||
ProfileSwitchDialog()
|
ProfileSwitchDialog()
|
||||||
.also { it.arguments = Bundle().also { bundle -> bundle.putInt("profileIndex", localProfilePlugin.currentProfileIndex) } }
|
.also { it.arguments = Bundle().also { bundle -> bundle.putString("profileName", localProfilePlugin.currentProfile()?.name) } }
|
||||||
.show(childFragmentManager, "ProfileSwitchDialog")
|
.show(childFragmentManager, "ProfileSwitchDialog")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue