forked from PeterCxy/OpenEUICC
parent
1ed5a4de38
commit
80adac68c8
|
@ -5,7 +5,6 @@ import android.app.Dialog
|
|||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.format.Formatter
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import android.widget.ProgressBar
|
||||
|
@ -131,7 +130,7 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
|||
// Fetch remaining NVRAM
|
||||
val str = channel.lpa.euiccInfo2?.freeNvram?.also {
|
||||
freeNvram = it
|
||||
}?.let { Formatter.formatShortFileSize(requireContext(), it.toLong()) }
|
||||
}?.let { formatFreeSpace(it) }
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
profileDownloadFreeSpace.text = getString(R.string.profile_download_free_space,
|
||||
|
|
|
@ -19,4 +19,12 @@ fun ByteArray.encodeHex(): String {
|
|||
sb.append(String.format("%02X", this[i]))
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun formatFreeSpace(size: Int): String =
|
||||
// SIM cards probably won't have much more space anytime soon.
|
||||
if (size >= 1024) {
|
||||
"%.2f KiB".format(size.toDouble() / 1024)
|
||||
} else {
|
||||
"$size B"
|
||||
}
|
Loading…
Reference in a new issue