diff --git a/build.gradle b/build.gradle
index 55cf1095..5e985ffa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -24,7 +24,7 @@ plugins {
id 'com.android.library' version '9.0.0' apply false
id 'org.jetbrains.kotlin.android' version "$kotlinVersion" apply false
id 'com.android.legacy-kapt' version '9.0.0' apply false
- id 'com.diffplug.spotless' version '8.1.0' apply false
+ id 'com.diffplug.spotless' version '8.2.0' apply false
id 'io.gitlab.arturbosch.detekt' version '1.23.8' apply false
id 'com.android.application' version '9.0.0' apply false
}
diff --git a/core/src/main/java/com/nextcloud/android/common/core/utils/DateFormatter.kt b/core/src/main/java/com/nextcloud/android/common/core/utils/DateFormatter.kt
index 873efb9f..4d947aca 100644
--- a/core/src/main/java/com/nextcloud/android/common/core/utils/DateFormatter.kt
+++ b/core/src/main/java/com/nextcloud/android/common/core/utils/DateFormatter.kt
@@ -25,9 +25,6 @@ class DateFormatter(
private val sdfMonths: SimpleDateFormat
private val sdfYears: SimpleDateFormat
- /**
- * constructor.
- */
init {
val locale =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@@ -59,13 +56,18 @@ class DateFormatter(
val span = System.currentTimeMillis() - calendar.getTimeInMillis()
return when {
// less than 1m
- span < ONE_MINUTE_IN_MILLIS -> context.getString(R.string.date_formatting_now)
+ span < ONE_MINUTE_IN_MILLIS -> {
+ context.getString(R.string.date_formatting_now)
+ }
+
// less than 1h
- span < ONE_HOUR_IN_MILLIS ->
+ span < ONE_HOUR_IN_MILLIS -> {
context.getString(
R.string.date_formatting_relative_minutes,
span / ONE_MINUTE_IN_MILLIS
)
+ }
+
// less than 1d
span < ONE_DAY_IN_MILLIS -> {
val hours: Int = span.toInt() / ONE_HOUR_IN_MILLIS
@@ -73,12 +75,21 @@ class DateFormatter(
.resources
.getQuantityString(R.plurals.date_formatting_relative_hours, hours, hours)
}
+
// less than 1w
- span <= SIX_DAYS_IN_MILLIS -> sdfDays.format(calendar.getTime())
+ span <= SIX_DAYS_IN_MILLIS -> {
+ sdfDays.format(calendar.getTime())
+ }
+
// less than 1y -> up to 364 days
- span <= YEAR_IN_MILLIS -> sdfMonths.format(calendar.getTime())
+ span <= YEAR_IN_MILLIS -> {
+ sdfMonths.format(calendar.getTime())
+ }
+
// more than 1y -> more than 364 days
- else -> sdfYears.format(calendar.getTime())
+ else -> {
+ sdfYears.format(calendar.getTime())
+ }
}
}
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index a06c901e..63646a6b 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -203,6 +203,7 @@
+
@@ -5792,6 +5793,14 @@
+
+
+
+
+
+
+
+
@@ -5808,6 +5817,14 @@
+
+
+
+
+
+
+
+
@@ -5818,6 +5835,11 @@
+
+
+
+
+
@@ -13014,6 +13036,11 @@
+
+
+
+
+
@@ -13086,6 +13113,14 @@
+
+
+
+
+
+
+
+
@@ -13158,6 +13193,14 @@
+
+
+
+
+
+
+
+
@@ -13230,6 +13273,14 @@
+
+
+
+
+
+
+
+
@@ -13604,6 +13655,14 @@
+
+
+
+
+
+
+
+
@@ -13652,6 +13711,14 @@
+
+
+
+
+
+
+
+
@@ -13700,6 +13767,14 @@
+
+
+
+
+
+
+
+
@@ -14335,6 +14410,14 @@
+
+
+
+
+
+
+
+
@@ -14351,6 +14434,14 @@
+
+
+
+
+
+
+
+
@@ -14367,6 +14458,14 @@
+
+
+
+
+
+
+
+
@@ -14383,6 +14482,14 @@
+
+
+
+
+
+
+
+
@@ -14399,6 +14506,14 @@
+
+
+
+
+
+
+
+
@@ -14415,6 +14530,14 @@
+
+
+
+
+
+
+
+
@@ -14431,6 +14554,14 @@
+
+
+
+
+
+
+
+
@@ -14447,6 +14578,14 @@
+
+
+
+
+
+
+
+
@@ -14463,6 +14602,14 @@
+
+
+
+
+
+
+
+
@@ -14479,6 +14626,14 @@
+
+
+
+
+
+
+
+
@@ -14495,6 +14650,14 @@
+
+
+
+
+
+
+
+
@@ -14511,6 +14674,14 @@
+
+
+
+
+
+
+
+
@@ -14527,6 +14698,14 @@
+
+
+
+
+
+
+
+
@@ -14543,6 +14722,14 @@
+
+
+
+
+
+
+
+
@@ -14559,6 +14746,14 @@
+
+
+
+
+
+
+
+
@@ -14749,6 +14944,14 @@
+
+
+
+
+
+
+
+
@@ -14793,6 +14996,11 @@
+
+
+
+
+
@@ -14825,6 +15033,14 @@
+
+
+
+
+
+
+
+
@@ -14875,6 +15091,14 @@
+
+
+
+
+
+
+
+
@@ -16281,6 +16505,11 @@
+
+
+
+
+
@@ -16614,6 +16843,14 @@
+
+
+
+
+
+
+
+
@@ -16634,6 +16871,11 @@
+
+
+
+
+
@@ -16666,6 +16908,14 @@
+
+
+
+
+
+
+
+
@@ -17236,6 +17486,14 @@
+
+
+
+
+
+
+
+
@@ -17559,6 +17817,14 @@
+
+
+
+
+
+
+
+
@@ -18230,6 +18496,14 @@
+
+
+
+
+
+
+
+
@@ -18536,6 +18810,14 @@
+
+
+
+
+
+
+
+
@@ -18633,6 +18915,11 @@
+
+
+
+
+
@@ -19633,6 +19920,11 @@
+
+
+
+
+
@@ -19776,6 +20068,14 @@
+
+
+
+
+
+
+
+
@@ -19986,6 +20286,14 @@
+
+
+
+
+
+
+
+
@@ -19994,6 +20302,14 @@
+
+
+
+
+
+
+
+
@@ -20002,6 +20318,14 @@
+
+
+
+
+
+
+
+
@@ -20018,6 +20342,14 @@
+
+
+
+
+
+
+
+
@@ -20026,6 +20358,14 @@
+
+
+
+
+
+
+
+
@@ -20034,6 +20374,14 @@
+
+
+
+
+
+
+
+
@@ -20042,6 +20390,14 @@
+
+
+
+
+
+
+
+
@@ -20050,6 +20406,14 @@
+
+
+
+
+
+
+
+
@@ -20058,6 +20422,14 @@
+
+
+
+
+
+
+
+
@@ -20066,6 +20438,14 @@
+
+
+
+
+
+
+
+
@@ -20074,6 +20454,14 @@
+
+
+
+
+
+
+
+
@@ -20082,6 +20470,14 @@
+
+
+
+
+
+
+
+
@@ -20095,6 +20491,14 @@
+
+
+
+
+
+
+
+
@@ -20103,6 +20507,11 @@
+
+
+
+
+
@@ -20113,6 +20522,11 @@
+
+
+
+
+