mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix warning with parcelable
This commit is contained in:
@@ -47,7 +47,7 @@ class AutoType : Parcelable {
|
|||||||
constructor(parcel: Parcel) {
|
constructor(parcel: Parcel) {
|
||||||
this.enabled = parcel.readByte().toInt() != 0
|
this.enabled = parcel.readByte().toInt() != 0
|
||||||
this.obfuscationOptions = parcel.readLong()
|
this.obfuscationOptions = parcel.readLong()
|
||||||
this.defaultSequence = parcel.readString()
|
this.defaultSequence = parcel.readString() ?: defaultSequence
|
||||||
this.windowSeqPairs = MemoryUtil.readStringParcelableMap(parcel)
|
this.windowSeqPairs = MemoryUtil.readStringParcelableMap(parcel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,11 +292,11 @@ class GroupVersioned : NodeVersioned, PwGroupInterface<GroupVersioned, EntryVers
|
|||||||
pwGroupV4?.nodeId = id
|
pwGroupV4?.nodeId = id
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setEnableAutoType(enableAutoType: Boolean?) {
|
fun setEnableAutoType(enableAutoType: Boolean) {
|
||||||
pwGroupV4?.enableAutoType = enableAutoType
|
pwGroupV4?.enableAutoType = enableAutoType
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setEnableSearching(enableSearching: Boolean?) {
|
fun setEnableSearching(enableSearching: Boolean) {
|
||||||
pwGroupV4?.enableSearching = enableSearching
|
pwGroupV4?.enableSearching = enableSearching
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ class PwEntryV3 : PwEntry<PwGroupV3, PwEntryV3> {
|
|||||||
constructor() : super()
|
constructor() : super()
|
||||||
|
|
||||||
constructor(parcel: Parcel) : super(parcel) {
|
constructor(parcel: Parcel) : super(parcel) {
|
||||||
title = parcel.readString()
|
title = parcel.readString() ?: title
|
||||||
username = parcel.readString()
|
username = parcel.readString() ?: username
|
||||||
parcel.readByteArray(passwordBytes)
|
parcel.readByteArray(passwordBytes)
|
||||||
url = parcel.readString()
|
url = parcel.readString() ?: url
|
||||||
notes = parcel.readString()
|
notes = parcel.readString() ?: notes
|
||||||
binaryDesc = parcel.readString()
|
binaryDesc = parcel.readString() ?: binaryDesc
|
||||||
parcel.readByteArray(binaryData)
|
parcel.readByteArray(binaryData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ class PwEntryV4 : PwEntry<PwGroupV4, PwEntryV4>, NodeV4Interface {
|
|||||||
|
|
||||||
override var icon: PwIcon
|
override var icon: PwIcon
|
||||||
get() {
|
get() {
|
||||||
return if (iconCustom.isUnknown)
|
return when {
|
||||||
super.icon
|
iconCustom.isUnknown -> super.icon
|
||||||
else
|
else -> iconCustom
|
||||||
iconCustom
|
}
|
||||||
}
|
}
|
||||||
set(value) {
|
set(value) {
|
||||||
if (value is PwIconStandard)
|
if (value is PwIconStandard)
|
||||||
@@ -91,20 +91,20 @@ class PwEntryV4 : PwEntry<PwGroupV4, PwEntryV4>, NodeV4Interface {
|
|||||||
constructor() : super()
|
constructor() : super()
|
||||||
|
|
||||||
constructor(parcel: Parcel) : super(parcel) {
|
constructor(parcel: Parcel) : super(parcel) {
|
||||||
iconCustom = parcel.readParcelable(PwIconCustom::class.java.classLoader)
|
iconCustom = parcel.readParcelable(PwIconCustom::class.java.classLoader) ?: iconCustom
|
||||||
usageCount = parcel.readLong()
|
usageCount = parcel.readLong()
|
||||||
locationChanged = parcel.readParcelable(PwDate::class.java.classLoader)
|
locationChanged = parcel.readParcelable(PwDate::class.java.classLoader) ?: locationChanged
|
||||||
customData = MemoryUtil.readStringParcelableMap(parcel)
|
customData = MemoryUtil.readStringParcelableMap(parcel)
|
||||||
fields = MemoryUtil.readStringParcelableMap(parcel, ProtectedString::class.java)
|
fields = MemoryUtil.readStringParcelableMap(parcel, ProtectedString::class.java)
|
||||||
// TODO binaries = MemoryUtil.readStringParcelableMap(parcel, ProtectedBinary.class);
|
// TODO binaries = MemoryUtil.readStringParcelableMap(parcel, ProtectedBinary.class);
|
||||||
foregroundColor = parcel.readString()
|
foregroundColor = parcel.readString() ?: foregroundColor
|
||||||
backgroundColor = parcel.readString()
|
backgroundColor = parcel.readString() ?: backgroundColor
|
||||||
overrideURL = parcel.readString()
|
overrideURL = parcel.readString() ?: overrideURL
|
||||||
autoType = parcel.readParcelable(AutoType::class.java.classLoader)
|
autoType = parcel.readParcelable(AutoType::class.java.classLoader) ?: autoType
|
||||||
parcel.readTypedList(history, CREATOR)
|
parcel.readTypedList(history, CREATOR)
|
||||||
url = parcel.readString()
|
url = parcel.readString() ?: url
|
||||||
additional = parcel.readString()
|
additional = parcel.readString() ?: additional
|
||||||
tags = parcel.readString()
|
tags = parcel.readString() ?: tags
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ abstract class PwGroup
|
|||||||
constructor() : super()
|
constructor() : super()
|
||||||
|
|
||||||
constructor(parcel: Parcel) : super(parcel) {
|
constructor(parcel: Parcel) : super(parcel) {
|
||||||
titleGroup = parcel.readString()
|
titleGroup = parcel.readString() ?: titleGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class PwGroupV4 : PwGroup<UUID, PwGroupV4, PwEntryV4>, NodeV4Interface {
|
|||||||
var notes = ""
|
var notes = ""
|
||||||
var isExpanded = true
|
var isExpanded = true
|
||||||
var defaultAutoTypeSequence = ""
|
var defaultAutoTypeSequence = ""
|
||||||
var enableAutoType: Boolean? = null
|
var enableAutoType: Boolean = true
|
||||||
var enableSearching: Boolean? = null
|
var enableSearching: Boolean = true
|
||||||
var lastTopVisibleEntry: UUID = PwDatabase.UUID_ZERO
|
var lastTopVisibleEntry: UUID = PwDatabase.UUID_ZERO
|
||||||
|
|
||||||
override val type: Type
|
override val type: Type
|
||||||
@@ -63,13 +63,13 @@ class PwGroupV4 : PwGroup<UUID, PwGroupV4, PwEntryV4>, NodeV4Interface {
|
|||||||
constructor() : super()
|
constructor() : super()
|
||||||
|
|
||||||
constructor(parcel: Parcel) : super(parcel) {
|
constructor(parcel: Parcel) : super(parcel) {
|
||||||
iconCustom = parcel.readParcelable(PwIconCustom::class.java.classLoader)
|
iconCustom = parcel.readParcelable(PwIconCustom::class.java.classLoader) ?: iconCustom
|
||||||
usageCount = parcel.readLong()
|
usageCount = parcel.readLong()
|
||||||
locationChanged = parcel.readParcelable(PwDate::class.java.classLoader)
|
locationChanged = parcel.readParcelable(PwDate::class.java.classLoader) ?: locationChanged
|
||||||
// TODO customData = MemoryUtil.readStringParcelableMap(in);
|
// TODO customData = MemoryUtil.readStringParcelableMap(in);
|
||||||
notes = parcel.readString()
|
notes = parcel.readString() ?: notes
|
||||||
isExpanded = parcel.readByte().toInt() != 0
|
isExpanded = parcel.readByte().toInt() != 0
|
||||||
defaultAutoTypeSequence = parcel.readString()
|
defaultAutoTypeSequence = parcel.readString() ?: defaultAutoTypeSequence
|
||||||
enableAutoType = parcel.readByte().toInt() != 0
|
enableAutoType = parcel.readByte().toInt() != 0
|
||||||
enableSearching = parcel.readByte().toInt() != 0
|
enableSearching = parcel.readByte().toInt() != 0
|
||||||
lastTopVisibleEntry = parcel.readSerializable() as UUID
|
lastTopVisibleEntry = parcel.readSerializable() as UUID
|
||||||
@@ -92,8 +92,8 @@ class PwGroupV4 : PwGroup<UUID, PwGroupV4, PwEntryV4>, NodeV4Interface {
|
|||||||
dest.writeString(notes)
|
dest.writeString(notes)
|
||||||
dest.writeByte((if (isExpanded) 1 else 0).toByte())
|
dest.writeByte((if (isExpanded) 1 else 0).toByte())
|
||||||
dest.writeString(defaultAutoTypeSequence)
|
dest.writeString(defaultAutoTypeSequence)
|
||||||
dest.writeByte((if (enableAutoType == null) -1 else if (enableAutoType!!) 1 else 0).toByte())
|
dest.writeByte((if (enableAutoType) 1 else 0).toByte())
|
||||||
dest.writeByte((if (enableSearching == null) -1 else if (enableSearching!!) 1 else 0).toByte())
|
dest.writeByte((if (enableSearching) 1 else 0).toByte())
|
||||||
dest.writeSerializable(lastTopVisibleEntry)
|
dest.writeSerializable(lastTopVisibleEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ abstract class PwNode<IdType, Parent : PwGroupInterface<Parent, Entry>, Entry :
|
|||||||
protected constructor()
|
protected constructor()
|
||||||
|
|
||||||
protected constructor(parcel: Parcel) {
|
protected constructor(parcel: Parcel) {
|
||||||
this.nodeId = parcel.readParcelable(PwNodeId::class.java.classLoader)
|
this.nodeId = parcel.readParcelable(PwNodeId::class.java.classLoader) ?: nodeId
|
||||||
this.parent = this.readParentParcelable(parcel)
|
this.parent = this.readParentParcelable(parcel)
|
||||||
this.icon = parcel.readParcelable(PwIcon::class.java.classLoader)
|
this.icon = parcel.readParcelable(PwIcon::class.java.classLoader) ?: icon
|
||||||
this.creationTime = parcel.readParcelable(PwDate::class.java.classLoader)
|
this.creationTime = parcel.readParcelable(PwDate::class.java.classLoader) ?: creationTime
|
||||||
this.lastModificationTime = parcel.readParcelable(PwDate::class.java.classLoader)
|
this.lastModificationTime = parcel.readParcelable(PwDate::class.java.classLoader) ?: lastModificationTime
|
||||||
this.lastAccessTime = parcel.readParcelable(PwDate::class.java.classLoader)
|
this.lastAccessTime = parcel.readParcelable(PwDate::class.java.classLoader) ?: lastAccessTime
|
||||||
this.expiryTime = parcel.readParcelable(PwDate::class.java.classLoader)
|
this.expiryTime = parcel.readParcelable(PwDate::class.java.classLoader) ?: expiryTime
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||||
|
|||||||
@@ -1033,9 +1033,9 @@ class ImporterV4(private val streamDir: File) : Importer<PwDatabaseV4>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun stringToBoolean(str: String?): Boolean? {
|
private fun stringToBoolean(str: String?): Boolean {
|
||||||
if (str == null || str.isEmpty()) {
|
if (str == null || str.isEmpty()) {
|
||||||
return null
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
val trimmed = str.trim { it <= ' ' }
|
val trimmed = str.trim { it <= ' ' }
|
||||||
@@ -1045,7 +1045,7 @@ class ImporterV4(private val streamDir: File) : Importer<PwDatabaseV4>() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user