Added quota support

This commit is contained in:
M66B
2020-01-07 17:43:27 +01:00
parent d691bd56f1
commit 65f256a4eb
8 changed files with 2121 additions and 2 deletions

View File

@@ -86,6 +86,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private ImageView ivState;
private TextView tvHost;
private TextView tvLast;
private TextView tvQuota;
private TextView tvIdentity;
private TextView tvDrafts;
private TextView tvWarning;
@@ -109,6 +110,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
ivState = itemView.findViewById(R.id.ivState);
tvHost = itemView.findViewById(R.id.tvHost);
tvLast = itemView.findViewById(R.id.tvLast);
tvQuota = itemView.findViewById(R.id.tvQuota);
tvIdentity = itemView.findViewById(R.id.tvIdentity);
tvDrafts = itemView.findViewById(R.id.tvDrafts);
tvWarning = itemView.findViewById(R.id.tvWarning);
@@ -178,6 +180,10 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
" " + account.poll_interval +
"/" + account.keep_alive_ok +
"/" + account.keep_alive_failed : "")));
tvQuota.setText(context.getString(R.string.title_storage_quota,
(account.quota_usage == null ? "-" : Helper.humanReadableByteCount(account.quota_usage, true)),
(account.quota_limit == null ? "-" : Helper.humanReadableByteCount(account.quota_limit, true))));
tvQuota.setVisibility(account.quota_usage != null || account.quota_limit != null ? View.VISIBLE : View.GONE);
tvIdentity.setVisibility(account.identities > 0 || !settings ? View.GONE : View.VISIBLE);
tvDrafts.setVisibility(account.drafts || !settings ? View.GONE : View.VISIBLE);