diff --git a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt index 045a6ef..1666040 100644 --- a/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt +++ b/app/src/main/java/com/bobbyesp/metadator/presentation/pages/utilities/tageditor/MetadataEditorPage.kt @@ -77,6 +77,7 @@ import com.bobbyesp.ui.components.others.MetadataTag import com.bobbyesp.ui.components.text.LargeCategoryTitle import com.bobbyesp.ui.components.text.MarqueeText import com.bobbyesp.ui.components.text.PreConfiguredOutlinedTextField +import com.bobbyesp.utilities.ext.fromMillisToMinutes import com.bobbyesp.utilities.ext.isNeitherNullNorBlank import com.bobbyesp.utilities.ext.toMinutes import com.bobbyesp.utilities.states.ResourceState @@ -438,7 +439,7 @@ private fun AudioProperties(modifier: Modifier = Modifier, audioProperties: Audi MetadataTag( modifier = Modifier.weight(0.5f), typeOfMetadata = stringResource(id = R.string.duration), - metadata = audioProperties.length.toMinutes() + metadata = audioProperties.length.fromMillisToMinutes() ) } } diff --git a/app/utilities/src/main/java/com/bobbyesp/utilities/ext/Int.kt b/app/utilities/src/main/java/com/bobbyesp/utilities/ext/Int.kt index 8d81f02..e8e99bb 100644 --- a/app/utilities/src/main/java/com/bobbyesp/utilities/ext/Int.kt +++ b/app/utilities/src/main/java/com/bobbyesp/utilities/ext/Int.kt @@ -9,8 +9,27 @@ fun Int.bigQuantityFormatter(): String { } } +/** + * Extension function to convert an integer representing seconds into a formatted string of minutes and seconds. + * + * @receiver Int The number of seconds to be converted. + * @return String The formatted string in "MM:SS" format. + */ fun Int.toMinutes(): String { val minutes = this / 60 val seconds = this % 60 return "%02d:%02d".format(minutes, seconds) +} + +/** + * Extension function to convert an integer representing milliseconds into a formatted string of minutes and seconds. + * + * @receiver Int The number of milliseconds to be converted. + * @return String The formatted string in "MM:SS" format. + */ +fun Int.fromMillisToMinutes(): String { + val totalSeconds = this / 1000 + val minutes = totalSeconds / 60 + val seconds = totalSeconds % 60 + return "%02d:%02d".format(minutes, seconds) } \ No newline at end of file