General improvements (#134)
* Add visual options and seamless transitions to the EPUB reader * Add support for DOCX file format * Refine padding and status bar inset handling in Epub pagination mode * Add file size parameter for recent files and sorting * Refactor book data cleanup logic into a centralized method * Bump version to 1.0.40(41)
This commit is contained in:
parent
15264a31ae
commit
6fd6dd5609
20 changed files with 623 additions and 134 deletions
|
|
@ -101,6 +101,8 @@ import timber.log.Timber
|
|||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import kotlin.math.log10
|
||||
import kotlin.math.pow
|
||||
|
||||
internal const val PRIVACY_POLICY_URL = "https://aryan-raj3112.github.io/reader-policy/privacy-policy.html"
|
||||
internal const val TERMS_URL = "https://aryan-raj3112.github.io/reader-policy/terms-and-conditions.html"
|
||||
|
|
@ -123,6 +125,13 @@ class CustomTabUriHandler(private val context: Context) : UriHandler {
|
|||
}
|
||||
}
|
||||
|
||||
fun formatFileSize(bytes: Long): String {
|
||||
if (bytes <= 0) return "Unknown"
|
||||
val units = arrayOf("B", "KB", "MB", "GB", "TB")
|
||||
val digitGroups = (log10(bytes.toDouble()) / log10(1024.0)).toInt()
|
||||
return String.format(Locale.US, "%.2f %s", bytes / 1024.0.pow(digitGroups.toDouble()), units[digitGroups])
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LegalText(
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
@ -446,6 +455,7 @@ fun FileInfoDialog(item: RecentFileItem, onDismiss: () -> Unit, onUpdateName: (S
|
|||
InfoRowDetailed("Author", it)
|
||||
}
|
||||
InfoRowDetailed("Format", item.type.name)
|
||||
InfoRowDetailed("Size", formatFileSize(item.fileSize))
|
||||
InfoRowDetailed("Added", formattedDate)
|
||||
InfoRowDetailed(
|
||||
label = "Location",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue