fix: Remove AndroidX dependency and format code

This commit is contained in:
J-Jamet 2023-05-14 17:52:40 +02:00
parent e1ecebb4a0
commit 81930bf3a1
12 changed files with 88 additions and 69 deletions

View file

@ -32,7 +32,6 @@ android {
}
dependencies {
implementation "androidx.core:core-ktx:$android_core_version"
// Time
implementation 'joda-time:joda-time:2.10.13'
// Apache Commons

View file

@ -19,16 +19,20 @@
*/
package com.kunzisoft.keepass.database.element
import android.content.res.Resources
import android.os.Parcel
import android.os.Parcelable
import androidx.core.os.ConfigurationCompat
import com.kunzisoft.keepass.utils.readEnum
import com.kunzisoft.keepass.utils.writeEnum
import org.joda.time.*
import java.text.DateFormat
import org.joda.time.Duration
import org.joda.time.Instant
import org.joda.time.LocalDate
import org.joda.time.LocalDateTime
import org.joda.time.LocalTime
import java.text.SimpleDateFormat
import java.util.*
import java.util.Calendar
import java.util.Date
import java.util.Locale
import java.util.TimeZone
class DateInstant : Parcelable {
@ -122,25 +126,6 @@ class DateInstant : Parcelable {
dest.writeEnum(mType)
}
fun getDateTimeString(resources: Resources): String {
val locale = ConfigurationCompat.getLocales(resources.configuration)[0] ?: Locale.ROOT
return when (mType) {
Type.DATE -> DateFormat.getDateInstance(
DateFormat.MEDIUM,
locale)
.format(jDate)
Type.TIME -> DateFormat.getTimeInstance(
DateFormat.SHORT,
locale)
.format(jDate)
else -> DateFormat.getDateTimeInstance(
DateFormat.MEDIUM,
DateFormat.SHORT,
locale)
.format(jDate)
}
}
fun getYearInt(): Int {
val dateFormat = SimpleDateFormat("yyyy", Locale.ENGLISH)
return dateFormat.format(date).toInt()

View file

@ -1,13 +0,0 @@
package com.kunzisoft.keepass.model
import androidx.annotation.StringRes
data class ProgressMessage(
@StringRes
var titleId: Int,
@StringRes
var messageId: Int? = null,
@StringRes
var warningId: Int? = null,
var cancelable: (() -> Unit)? = null
)

View file

@ -19,12 +19,12 @@
*/
package com.kunzisoft.keepass.utils;
import androidx.annotation.Nullable;
import java.util.UUID;
import static com.kunzisoft.keepass.utils.StreamBytesUtilsKt.uuidTo16Bytes;
import org.jetbrains.annotations.Nullable;
public class UuidUtil {
public static @Nullable String toHexString(@Nullable UUID uuid) {