mirror of https://github.com/M66B/FairEmail.git
Show account usage percentage
This commit is contained in:
parent
4c4dffa5ea
commit
821f713728
|
@ -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,6 +275,11 @@ public class FragmentFolders extends FragmentBase {
|
|||
db.account().liveAccount(account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable EntityAccount account) {
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue