diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/NodesAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/NodesAdapter.kt index 56d89c90b..1561d5fc8 100644 --- a/app/src/main/java/com/kunzisoft/keepass/adapters/NodesAdapter.kt +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/NodesAdapter.kt @@ -204,6 +204,11 @@ class NodesAdapter ( && oldItem.type == newItem.type && oldItem.title == newItem.title && oldItem.icon == newItem.icon + && oldItem.creationTime == newItem.creationTime + && oldItem.lastModificationTime == newItem.lastModificationTime + && oldItem.lastAccessTime == newItem.lastAccessTime + && oldItem.expiryTime == newItem.expiryTime + && oldItem.expires == newItem.expires && oldItem.isCurrentlyExpires == newItem.isCurrentlyExpires } diff --git a/database/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt b/database/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt index 1b7e8d20b..f2e938624 100644 --- a/database/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt +++ b/database/src/main/java/com/kunzisoft/keepass/database/element/DateInstant.kt @@ -229,8 +229,8 @@ class DateInstant : Parcelable { return this.mInstant.isAfter(dateInstant.mInstant) } - fun compareTo(other: DateInstant?): Int { - return mInstant.compareTo(other?.mInstant) + fun compareTo(other: DateInstant): Int { + return mInstant.compareTo(other.mInstant) } enum class Type { diff --git a/database/src/test/java/com/kunzisoft/keepass/tests/utils/ValuesTest.kt b/database/src/test/java/com/kunzisoft/keepass/tests/utils/ValuesTest.kt index 3471febe4..adc78eaa1 100644 --- a/database/src/test/java/com/kunzisoft/keepass/tests/utils/ValuesTest.kt +++ b/database/src/test/java/com/kunzisoft/keepass/tests/utils/ValuesTest.kt @@ -165,6 +165,27 @@ class ValuesTest : TestCase() { assertTrue("jDate $jDate and cDate $cDate not equal", cDate == jDate) } + fun testDateCompare() { + val dateInstantA = DateInstant().apply { + setDate(2024, 12, 2) + setTime(5, 13) + } + val dateInstantB = DateInstant().apply { + setDate(2024, 12, 2) + setTime(5, 10) + } + val dateInstantC = DateInstant().apply { + setDate(2024, 12, 2) + setTime(5, 10) + } + assertTrue(dateInstantA.compareTo(dateInstantB) > 0) + assertTrue(dateInstantB.compareTo(dateInstantA) < 0) + assertTrue(dateInstantB.compareTo(dateInstantC) == 0) + assertTrue(dateInstantA.isAfter(dateInstantB)) + assertTrue(dateInstantB.isBefore(dateInstantA)) + assertFalse(dateInstantB.isBefore(dateInstantC)) + } + fun testUUID() { val bUUID = ByteArray(16) Random().nextBytes(bUUID)