Skip to content

Commit

Permalink
fix: changed the color of progress bar when the quota is not exceeded…
Browse files Browse the repository at this point in the history
… and hided status text when it isn't necessary
  • Loading branch information
joragua committed Nov 5, 2024
1 parent 2f7bae6 commit e6dd08d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ abstract class DrawerActivity : ToolbarActivity() {
getAccountQuotaBar()?.apply {
isVisible = true
progress = 0
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.color_accent))
}
getAccountQuotaText()?.text = String.format(
getString(R.string.drawer_unavailable_free_storage),
DisplayUtils.bytesToHumanReadable(userQuota.used, this, true)
)
getAccountQuotaStatusText()?.visibility = View.GONE

} else if (userQuota.isExceeded()) {
getAccountQuotaBar()?.apply {
Expand All @@ -343,11 +345,13 @@ abstract class DrawerActivity : ToolbarActivity() {
} else if (userQuota.available == 0L) { // Quota 0, guest users
getAccountQuotaBar()?.isVisible = false
getAccountQuotaText()?.text = getString(R.string.drawer_unavailable_used_storage)
getAccountQuotaStatusText()?.visibility = View.GONE

} else if (userQuota.isNearing()) {
getAccountQuotaBar()?.apply {
isVisible = true
progress = userQuota.getRelative().toInt()
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.color_accent))
}
getAccountQuotaText()?.apply {
text = String.format(
Expand All @@ -366,6 +370,7 @@ abstract class DrawerActivity : ToolbarActivity() {
getAccountQuotaBar()?.apply {
isVisible = true
progress = userQuota.getRelative().toInt()
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.color_accent))
}
getAccountQuotaText()?.apply {
text = String.format(
Expand All @@ -385,13 +390,15 @@ abstract class DrawerActivity : ToolbarActivity() {
getAccountQuotaBar()?.apply {
progress = userQuota.getRelative().toInt()
isVisible = true
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.color_accent))
}
getAccountQuotaText()?.text = String.format(
getString(R.string.drawer_quota),
DisplayUtils.bytesToHumanReadable(userQuota.used, this, true),
DisplayUtils.bytesToHumanReadable(userQuota.getTotal(), this, true),
userQuota.getRelative()
)
getAccountQuotaStatusText()?.visibility = View.GONE
}
}
}
Expand Down

0 comments on commit e6dd08d

Please sign in to comment.