Small improvements/fixes

This commit is contained in:
M66B 2018-10-07 06:53:09 +00:00
parent 5fe713180d
commit 1fe8784b1f
2 changed files with 23 additions and 10 deletions

View File

@ -49,14 +49,14 @@ public class EntityAccount {
@NonNull
public Integer auth_type;
@NonNull
public Boolean primary;
@NonNull
public Boolean synchronize;
@NonNull
public Boolean primary;
public Integer color;
@NonNull
public Boolean store_sent; // obsolete
@NonNull
public Integer poll_interval; // NOOP interval
public Integer poll_interval; // keep-alive interval
public Long seen_until;
public String state;
public String error;
@ -66,12 +66,16 @@ public class EntityAccount {
if (obj instanceof EntityAccount) {
EntityAccount other = (EntityAccount) obj;
return ((this.name == null ? other.name == null : this.name.equals(other.name)) &&
(this.signature == null ? other.signature == null : this.signature.equals(other.signature)) &&
this.host.equals(other.host) &&
this.port.equals(other.port) &&
this.user.equals(other.user) &&
this.password.equals(other.password) &&
this.primary.equals(other.primary) &&
this.auth_type.equals(other.auth_type) &&
this.synchronize.equals(other.synchronize) &&
this.primary.equals(other.primary) &&
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
this.store_sent.equals(other.store_sent) &&
this.poll_interval.equals(other.poll_interval) &&
(this.seen_until == null ? other.seen_until == null : this.seen_until.equals(other.seen_until)) &&
(this.state == null ? other.state == null : this.state.equals(other.state)) &&

View File

@ -102,6 +102,7 @@ public class FragmentAccount extends FragmentEx {
private TextInputLayout tilPassword;
private Button btnAdvanced;
private TextView tvName;
private EditText etName;
private Button btnColor;
@ -109,11 +110,12 @@ public class FragmentAccount extends FragmentEx {
private ImageView ibColorDefault;
private EditText etSignature;
private ImageButton ibPro;
private CheckBox cbSynchronize;
private CheckBox cbPrimary;
private EditText etInterval;
private Button btnCheck;
private Button btnCheck;
private ProgressBar pbCheck;
private TextView tvIdle;
@ -169,6 +171,7 @@ public class FragmentAccount extends FragmentEx {
tilPassword = view.findViewById(R.id.tilPassword);
btnAdvanced = view.findViewById(R.id.btnAdvanced);
etName = view.findViewById(R.id.etName);
tvName = view.findViewById(R.id.tvName);
btnColor = view.findViewById(R.id.btnColor);
@ -576,10 +579,11 @@ public class FragmentAccount extends FragmentEx {
args.putString("password", tilPassword.getEditText().getText().toString());
args.putInt("auth_type", authorized == null ? Helper.AUTH_TYPE_PASSWORD : provider.getAuthType());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putString("name", etName.getText().toString());
args.putInt("color", color);
args.putString("signature", Html.toHtml(etSignature.getText()));
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putString("interval", etInterval.getText().toString());
@ -601,6 +605,7 @@ public class FragmentAccount extends FragmentEx {
String name = args.getString("name");
int color = args.getInt("color");
String signature = args.getString("signature");
boolean synchronize = args.getBoolean("synchronize");
boolean primary = args.getBoolean("primary");
String interval = args.getString("interval");
@ -660,19 +665,23 @@ public class FragmentAccount extends FragmentEx {
boolean update = (account != null);
if (account == null)
account = new EntityAccount();
account.name = name;
account.color = color;
account.signature = signature;
account.host = host;
account.port = Integer.parseInt(port);
account.user = user;
account.password = password;
account.auth_type = auth_type;
account.name = name;
account.color = color;
account.signature = signature;
account.synchronize = synchronize;
account.primary = (account.synchronize && primary);
account.store_sent = false;
account.poll_interval = Integer.parseInt(interval);
account.store_sent = false;
if (!synchronize)
account.error = null;