rename the Long formatting extension function

This commit is contained in:
tibbi 2017-12-05 23:38:08 +01:00
parent dabb5ef766
commit 5e21170731
4 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '3.1.3'
propVersionName = '3.1.4'
kotlin_version = '1.2.0'
support_libs = '27.0.2'
}

View file

@ -63,7 +63,7 @@ class PropertiesDialog() {
if (cursor.moveToFirst()) {
val dateModified = cursor.getIntValue(MediaStore.Images.Media.DATE_MODIFIED)
activity.runOnUiThread {
view.findViewById<TextView>(R.id.properties_last_modified).property_value.text = (dateModified * 1000L).formatLastModified()
view.findViewById<TextView>(R.id.properties_last_modified).property_value.text = (dateModified * 1000L).formatDate()
}
}
}
@ -90,7 +90,7 @@ class PropertiesDialog() {
}
if (file.isDirectory) {
addProperty(R.string.last_modified, file.lastModified().formatLastModified())
addProperty(R.string.last_modified, file.lastModified().formatDate())
} else {
addProperty(R.string.last_modified, "...", R.id.properties_last_modified)
addExifProperties(path)

View file

@ -13,7 +13,7 @@ fun Long.formatSize(): String {
return "${DecimalFormat("#,##0.#").format(this / Math.pow(1024.0, digitGroups.toDouble()))} ${units[digitGroups]}"
}
fun Long.formatLastModified(): String {
fun Long.formatDate(): String {
val cal = Calendar.getInstance(Locale.ENGLISH)
cal.timeInMillis = this
return DateFormat.format("dd.MM.yyyy kk:mm", cal).toString()

View file

@ -85,7 +85,7 @@ fun String.getExifDateTaken(exif: ExifInterface): String {
if (it?.isNotEmpty() == true) {
try {
val simpleDateFormat = SimpleDateFormat("yyyy:MM:dd kk:mm:ss", Locale.ENGLISH)
return simpleDateFormat.parse(it).time.formatLastModified().trim()
return simpleDateFormat.parse(it).time.formatDate().trim()
} catch (ignored: Exception) {
}
}