Skip to content

Commit

Permalink
fix: modified quota when its value is over 99% of total and included …
Browse files Browse the repository at this point in the history
…1 decimal in manage accounts dialog
  • Loading branch information
joragua committed Nov 14, 2024
1 parent 1e43f43 commit 6b6bd26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ManageAccountsAdapter(
}

else -> { // Limited storage. Value under 100%
if (userQuota.state == UserQuotaState.CRITICAL) { // Value over 90%
if (userQuota.state == UserQuotaState.CRITICAL || userQuota.state == UserQuotaState.EXCEEDED) { // Value over 90%
quotaBar.apply {
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.quota_exceeded))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ abstract class DrawerActivity : ToolbarActivity() {
visibility = View.VISIBLE
text = getString(R.string.drawer_nearing_quota)
}
} else if (userQuota.state == UserQuotaState.CRITICAL) { // Critical storage. Value over 90%
} else if (userQuota.state == UserQuotaState.CRITICAL || userQuota.state == UserQuotaState.EXCEEDED) { // Critical storage. Value over 90%
getAccountQuotaBar()?.apply {
isVisible = true
progress = userQuota.getRelative().toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class DisplayUtils {
* @param bytes Input file size
* @return Like something readable like "12 MB"
*/
public static String bytesToHumanReadable(long bytes, Context context, boolean includeDecimals) {
public static String bytesToHumanReadable(long bytes, Context context, boolean includeMultipleDecimals) {
if (bytes < 0) {
return context.getString(R.string.common_pending);

Expand All @@ -96,8 +96,8 @@ public static String bytesToHumanReadable(long bytes, Context context, boolean i
BigDecimal.ROUND_HALF_UP
).stripTrailingZeros();

if (!includeDecimals) {
readableResult = readableResult.setScale(0, BigDecimal.ROUND_HALF_UP);
if (!includeMultipleDecimals) {
readableResult = readableResult.setScale(1, BigDecimal.ROUND_HALF_UP);
}

// Unscale only values with ten exponent
Expand Down

0 comments on commit 6b6bd26

Please sign in to comment.