Show backoff time

This commit is contained in:
M66B
2020-10-29 20:03:09 +01:00
parent 1f9232bb1e
commit d3806b8eb1
8 changed files with 2360 additions and 4 deletions

View File

@@ -96,6 +96,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private TextView tvHost;
private TextView tvLast;
private TextView tvUsage;
private TextView tvBackoff;
private TextView tvQuota;
private TextView tvMaxSize;
private TextView tvIdentity;
@@ -123,6 +124,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvHost = itemView.findViewById(R.id.tvHost);
tvLast = itemView.findViewById(R.id.tvLast);
tvUsage = itemView.findViewById(R.id.tvUsage);
tvBackoff = itemView.findViewById(R.id.tvBackoff);
tvQuota = itemView.findViewById(R.id.tvQuota);
tvMaxSize = itemView.findViewById(R.id.tvMaxSize);
tvIdentity = itemView.findViewById(R.id.tvIdentity);
@@ -197,9 +199,15 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
"/" + account.keep_alive_ok +
"/" + account.keep_alive_failed +
"/" + account.keep_alive_succeeded : "")));
tvBackoff.setText(context.getString(R.string.title_backoff_until,
account.backoff_until == null ? "-" : DTF.format(account.backoff_until)));
tvBackoff.setVisibility(account.backoff_until == null && !BuildConfig.DEBUG ? View.GONE : View.VISIBLE);
Integer percent = null;
if (!settings && account.quota_usage != null && account.quota_limit != null)
percent = Math.round((float) account.quota_usage * 100 / account.quota_limit);
tvUsage.setText(percent == null ? null : NF.format(percent) + "%");
tvUsage.setVisibility(percent == null ? View.GONE : View.VISIBLE);
tvQuota.setText(context.getString(R.string.title_storage_quota,