@@ -30,6 +30,7 @@ import kotlin.math.pow
|
||||
object CommonUtil {
|
||||
|
||||
private val siPrefixes: Map<Int, String> = hashMapOf(
|
||||
Pair(0, ""),
|
||||
Pair(1, ""),
|
||||
Pair(3, " KB"),
|
||||
Pair(6, " MB"),
|
||||
@@ -37,6 +38,7 @@ object CommonUtil {
|
||||
)
|
||||
|
||||
private val diPrefixes: Map<Int, String> = hashMapOf(
|
||||
Pair(0, ""),
|
||||
Pair(1, ""),
|
||||
Pair(3, " K"),
|
||||
Pair(6, " M"),
|
||||
@@ -44,7 +46,7 @@ object CommonUtil {
|
||||
)
|
||||
|
||||
fun addSiPrefix(value: Long): String {
|
||||
if (value <= 0L)
|
||||
if (value <= 1L)
|
||||
return "NA"
|
||||
var tempValue = value
|
||||
var order = 0
|
||||
@@ -56,7 +58,7 @@ object CommonUtil {
|
||||
}
|
||||
|
||||
fun addDiPrefix(value: Long): String {
|
||||
if (value <= 0L)
|
||||
if (value <= 1L)
|
||||
return "NA"
|
||||
var tempValue = value
|
||||
var order = 0
|
||||
|
||||
@@ -67,7 +67,14 @@ abstract class BaseDetailsActivity : BaseActivity() {
|
||||
|
||||
//Sub Section Inflation
|
||||
fun inflateAppDescription(B: LayoutDetailsDescriptionBinding, app: App) {
|
||||
B.txtInstalls.text = CommonUtil.addDiPrefix(app.installs)
|
||||
val installs = CommonUtil.addDiPrefix(app.installs)
|
||||
|
||||
if (installs != "NA") {
|
||||
B.txtInstalls.text = CommonUtil.addDiPrefix(app.installs)
|
||||
} else {
|
||||
B.txtInstalls.hide()
|
||||
}
|
||||
|
||||
B.txtSize.text = CommonUtil.addSiPrefix(app.size)
|
||||
B.txtRating.text = app.labeledRating
|
||||
B.txtSdk.text = ("Target SDK ${app.targetSdk}")
|
||||
|
||||
Reference in New Issue
Block a user