mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-26 20:06:37 -08:00
Fix DateTime view id
This commit is contained in:
1 parent
bf6cb04fe8
commit
ad5e644362
2 files changed
+7
-2
No files matched your search
@@ -63,8 +63,6 @@ class EntryEditFragment: DatabaseFragment(), SetOTPDialogFragment.CreateOtpListe
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
|
||||
// TODO mTempDateTimeViewId = savedInstanceState.getInt(KEY_SELECTION_DATE_TIME_ID)
|
||||
|
||||
val rootView = inflater.cloneInContext(contextThemed)
|
||||
.inflate(R.layout.fragment_entry_edit, container, false)
|
||||
|
||||
|
||||
@@ -575,6 +575,7 @@ class TemplateView @JvmOverloads constructor(context: Context,
|
||||
return
|
||||
} else {
|
||||
mTemplate = state.template
|
||||
mTempDateTimeViewId = state.tempDateTimeViewId
|
||||
buildTemplateAndPopulateInfo()
|
||||
super.onRestoreInstanceState(state.superState)
|
||||
}
|
||||
@@ -585,6 +586,7 @@ class TemplateView @JvmOverloads constructor(context: Context,
|
||||
val saveState = SavedState(superSave)
|
||||
populateEntryInfoWithViews()
|
||||
saveState.template = this.mTemplate
|
||||
saveState.tempDateTimeViewId = this.mTempDateTimeViewId
|
||||
return saveState
|
||||
}
|
||||
|
||||
@@ -593,17 +595,22 @@ class TemplateView @JvmOverloads constructor(context: Context,
|
||||
|
||||
internal class SavedState : BaseSavedState {
|
||||
var template: Template? = null
|
||||
var tempDateTimeViewId: Int? = null
|
||||
|
||||
constructor(superState: Parcelable?) : super(superState)
|
||||
|
||||
private constructor(parcel: Parcel) : super(parcel) {
|
||||
template = parcel.readParcelable(Template::class.java.classLoader)
|
||||
?: template
|
||||
val dateTimeViewId = parcel.readInt()
|
||||
if (dateTimeViewId != -1)
|
||||
tempDateTimeViewId = dateTimeViewId
|
||||
}
|
||||
|
||||
override fun writeToParcel(out: Parcel, flags: Int) {
|
||||
super.writeToParcel(out, flags)
|
||||
out.writeParcelable(template, flags)
|
||||
out.writeInt(tempDateTimeViewId ?: -1)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in new issue
Block a user