Skip to content

Commit

Permalink
Merge pull request #3366 from kiwix/Issue#3328
Browse files Browse the repository at this point in the history
Fixed deprecated inline modifer
  • Loading branch information
kelson42 authored Jun 5, 2023
2 parents 7a233e0 + d1cfb48 commit 7df79cd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/eu/mhutti1/utils/storage/Bytes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const val Tb = Gb * 1024
const val Pb = Tb * 1024
const val Eb = Pb * 1024

inline class Bytes(val size: Long) {
@JvmInline
value class Bytes(val size: Long) {
val humanReadable
get() = when {
size < Kb -> "$size Bytes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.util.Base64

inline class Base64String(private val encodedString: String?) {
@JvmInline
value class Base64String(private val encodedString: String?) {
fun toBitmap(): Bitmap? = try {
encodedString?.let { nonNullString ->
Base64.decode(nonNullString, Base64.DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import org.kiwix.kiwixmobile.core.R
import java.util.Locale
import kotlin.math.roundToLong

inline class Seconds(val seconds: Long) {
@JvmInline
value class Seconds(val seconds: Long) {
fun toHumanReadableTime(): String {
val minutes = 60.0
val hours = 60 * minutes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.kiwix.kiwixmobile.core.extensions

inline class HeaderizableList<SUPERTYPE, out ITEM : SUPERTYPE, in HEADER : SUPERTYPE>(
@JvmInline
value class HeaderizableList<SUPERTYPE, out ITEM : SUPERTYPE, in HEADER : SUPERTYPE>(
val list: List<ITEM>
) {
fun foldOverAddingHeaders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ object ImageUtils {
}
}

inline class MeasuredView(private val view: View) {
@JvmInline
value class MeasuredView(private val view: View) {
val width: Int
get() = view.measuredWidth
val height: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import java.text.DecimalFormat
import kotlin.math.log10
import kotlin.math.pow

inline class KiloByte(private val kilobyteString: String?) {
@JvmInline
value class KiloByte(private val kilobyteString: String?) {
val humanReadable
get() = kilobyteString?.toLongOrNull()?.let {
val units = arrayOf("KB", "MB", "GB", "TB")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import java.text.DecimalFormat
import kotlin.math.log10
import kotlin.math.pow

inline class ArticleCount(val articleCount: String) {
@JvmInline
value class ArticleCount(val articleCount: String) {
fun toHumanReadable(context: Context): String = try {
val size = Integer.parseInt(articleCount)
if (size <= 0) {
Expand Down

0 comments on commit 7df79cd

Please sign in to comment.