mirror of https://github.com/M66B/FairEmail.git
Set first new account/identity primary only
This commit is contained in:
parent
e1447ad132
commit
ee08ec2597
|
@ -48,8 +48,8 @@ public interface DaoIdentity {
|
||||||
@Query("SELECT * FROM identity WHERE id = :id")
|
@Query("SELECT * FROM identity WHERE id = :id")
|
||||||
LiveData<EntityIdentity> liveIdentity(long id);
|
LiveData<EntityIdentity> liveIdentity(long id);
|
||||||
|
|
||||||
@Query("SELECT * FROM identity WHERE account = :account AND `primary`")
|
@Query("SELECT COUNT(*) FROM identity WHERE synchronize")
|
||||||
EntityIdentity getPrimaryIdentity(long account);
|
int getSynchronizingIdentityCount();
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
long insertIdentity(EntityIdentity identity);
|
long insertIdentity(EntityIdentity identity);
|
||||||
|
|
|
@ -751,6 +751,19 @@ public class FragmentAccount extends FragmentEx {
|
||||||
|
|
||||||
cbSynchronize.setChecked(account == null ? true : account.synchronize);
|
cbSynchronize.setChecked(account == null ? true : account.synchronize);
|
||||||
cbPrimary.setChecked(account == null ? true : account.primary);
|
cbPrimary.setChecked(account == null ? true : account.primary);
|
||||||
|
|
||||||
|
if (account == null)
|
||||||
|
new SimpleTask<Integer>() {
|
||||||
|
@Override
|
||||||
|
protected Integer onLoad(Context context, Bundle args) {
|
||||||
|
return DB.getInstance(context).account().getSynchronizingAccountCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onLoaded(Bundle args, Integer count) {
|
||||||
|
cbPrimary.setChecked(count == 0);
|
||||||
|
}
|
||||||
|
}.load(FragmentAccount.this, new Bundle());
|
||||||
} else {
|
} else {
|
||||||
int provider = savedInstanceState.getInt("provider");
|
int provider = savedInstanceState.getInt("provider");
|
||||||
spProvider.setTag(provider);
|
spProvider.setTag(provider);
|
||||||
|
|
|
@ -436,6 +436,19 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
cbStoreSent.setChecked(identity == null ? false : identity.store_sent);
|
cbStoreSent.setChecked(identity == null ? false : identity.store_sent);
|
||||||
|
|
||||||
etName.requestFocus();
|
etName.requestFocus();
|
||||||
|
|
||||||
|
if (identity == null)
|
||||||
|
new SimpleTask<Integer>() {
|
||||||
|
@Override
|
||||||
|
protected Integer onLoad(Context context, Bundle args) {
|
||||||
|
return DB.getInstance(context).identity().getSynchronizingIdentityCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onLoaded(Bundle args, Integer count) {
|
||||||
|
cbPrimary.setChecked(count == 0);
|
||||||
|
}
|
||||||
|
}.load(FragmentIdentity.this, new Bundle());
|
||||||
} else {
|
} else {
|
||||||
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
|
tilPassword.getEditText().setText(savedInstanceState.getString("password"));
|
||||||
grpAdvanced.setVisibility(savedInstanceState.getInt("advanced"));
|
grpAdvanced.setVisibility(savedInstanceState.getInt("advanced"));
|
||||||
|
|
Loading…
Reference in New Issue