mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Show account usage percentage
This commit is contained in:
parent
4c4dffa5ea
commit
821f713728
1 changed files with 9 additions and 1 deletions
|
@ -57,6 +57,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
@ -82,6 +83,8 @@ public class FragmentFolders extends FragmentBase {
|
|||
private String searching = null;
|
||||
private AdapterFolder adapter;
|
||||
|
||||
private NumberFormat NF = NumberFormat.getNumberInstance();
|
||||
|
||||
static final int REQUEST_SYNC = 1;
|
||||
static final int REQUEST_DELETE_LOCAL = 2;
|
||||
static final int REQUEST_EMPTY_FOLDER = 3;
|
||||
|
@ -272,7 +275,12 @@ public class FragmentFolders extends FragmentBase {
|
|||
db.account().liveAccount(account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable EntityAccount account) {
|
||||
setSubtitle(account == null ? null : account.name);
|
||||
if (account != null && account.quota_usage != null && account.quota_limit != null) {
|
||||
int percent = Math.round((float) account.quota_usage * 100 / account.quota_limit);
|
||||
setSubtitle(getString(R.string.title_name_count,
|
||||
account.name, NF.format(percent) + "%"));
|
||||
} else
|
||||
setSubtitle(account == null ? null : account.name);
|
||||
|
||||
if (account != null && account.error != null)
|
||||
fabError.show();
|
||||
|
|
Loading…
Reference in a new issue