Improved quota handling

This commit is contained in:
M66B
2021-06-28 11:31:19 +02:00
parent 13f809e3c8
commit bd6defc0fa
5 changed files with 32 additions and 24 deletions

View File

@@ -121,16 +121,13 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
ivExternal.setVisibility(View.GONE);
int percent;
if (account.quota_usage == null || account.quota_limit == null)
percent = 0;
else
percent = Math.round(account.quota_usage * 100f / account.quota_limit);
Integer percent = account.getQuotaPercentage();
if (account.error != null) {
ivWarning.setEnabled(false);
ivWarning.setImageResource(R.drawable.twotone_warning_24);
ivWarning.setVisibility(View.VISIBLE);
} else if (percent > QUOTA_WARNING) {
} else if (percent != null && percent > QUOTA_WARNING) {
ivWarning.setEnabled(true);
ivWarning.setImageResource(R.drawable.twotone_disc_full_24);
ivWarning.setVisibility(View.VISIBLE);