mirror of https://github.com/M66B/FairEmail.git
Default primary when no primary account yet
This commit is contained in:
parent
fe69b29484
commit
1aeeebc698
|
@ -47,9 +47,6 @@ public interface DaoAccount {
|
|||
@Query("SELECT * FROM account WHERE `primary`")
|
||||
EntityAccount getPrimaryAccount();
|
||||
|
||||
@Query("SELECT COUNT(*) FROM account WHERE synchronize")
|
||||
int getSynchronizingAccountCount();
|
||||
|
||||
@Query("SELECT * FROM account WHERE `primary`")
|
||||
LiveData<EntityAccount> livePrimaryAccount();
|
||||
|
||||
|
|
|
@ -945,23 +945,22 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
color = (account == null || account.color == null ? Color.TRANSPARENT : account.color);
|
||||
|
||||
if (account == null)
|
||||
new SimpleTask<Integer>() {
|
||||
@Override
|
||||
protected Integer onLoad(Context context, Bundle args) {
|
||||
return DB.getInstance(context).account().getSynchronizingAccountCount();
|
||||
}
|
||||
new SimpleTask<EntityAccount>() {
|
||||
@Override
|
||||
protected EntityAccount onLoad(Context context, Bundle args) {
|
||||
return DB.getInstance(context).account().getPrimaryAccount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoaded(Bundle args, Integer count) {
|
||||
cbPrimary.setChecked(count == 0);
|
||||
}
|
||||
@Override
|
||||
protected void onLoaded(Bundle args, EntityAccount primary) {
|
||||
cbPrimary.setChecked(primary == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, new Bundle());
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentAccount.this, new Bundle());
|
||||
} else {
|
||||
int provider = savedInstanceState.getInt("provider");
|
||||
spProvider.setTag(provider);
|
||||
|
|
Loading…
Reference in New Issue