Skip to content

Commit

Permalink
Don't cause incorrect memeory status info to cause a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
niranjan94 committed Dec 23, 2018
1 parent 69edfb5 commit 462c164
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,21 @@ class DecompilerProcessActivity : BaseActivity() {
if (!showMemoryUsage) {
return
}
val percentage = message.toDouble()
memoryStatus.text = "$message%"
val textColor = ContextCompat.getColor(
context,
when {
percentage < 40 -> R.color.green_500
percentage < 60 -> R.color.amber_500
percentage < 80 -> R.color.orange_500
else -> R.color.red_500
}
)
memoryStatus.setTextColor(textColor)
memoryUsage.setTextColor(textColor)
try {
val percentage = message.toDouble()
memoryStatus.text = "$message%"
val textColor = ContextCompat.getColor(
context,
when {
percentage < 40 -> R.color.green_500
percentage < 60 -> R.color.amber_500
percentage < 80 -> R.color.orange_500
else -> R.color.red_500
}
)
memoryStatus.setTextColor(textColor)
memoryUsage.setTextColor(textColor)
} catch (ignored: Exception) { }
return
}

Expand Down

0 comments on commit 462c164

Please sign in to comment.