mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-25 01:06:04 +00:00
Show account usage on start screen
This commit is contained in:
parent
5a36462feb
commit
70b868cc41
2 changed files with 20 additions and 1 deletions
|
@ -95,6 +95,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
private ImageView ivState;
|
||||
private TextView tvHost;
|
||||
private TextView tvLast;
|
||||
private TextView tvUsage;
|
||||
private TextView tvQuota;
|
||||
private TextView tvMaxSize;
|
||||
private TextView tvIdentity;
|
||||
|
@ -121,6 +122,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);
|
||||
tvUsage = itemView.findViewById(R.id.tvUsage);
|
||||
tvQuota = itemView.findViewById(R.id.tvQuota);
|
||||
tvMaxSize = itemView.findViewById(R.id.tvMaxSize);
|
||||
tvIdentity = itemView.findViewById(R.id.tvIdentity);
|
||||
|
@ -195,6 +197,11 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
"/" + account.keep_alive_ok +
|
||||
"/" + account.keep_alive_failed +
|
||||
"/" + account.keep_alive_succeeded : "")));
|
||||
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,
|
||||
(account.quota_usage == null ? "-" : Helper.humanReadableByteCount(account.quota_usage)),
|
||||
(account.quota_limit == null ? "-" : Helper.humanReadableByteCount(account.quota_limit))));
|
||||
|
|
|
@ -154,10 +154,22 @@
|
|||
android:singleLine="true"
|
||||
android:text="Last connected time"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tvUsage"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivState"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvHost" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvUsage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:ellipsize="start"
|
||||
android:singleLine="true"
|
||||
android:text="50%"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvHost" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvQuota"
|
||||
android:layout_width="0dp"
|
||||
|
|
Loading…
Reference in a new issue