mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 14:11:00 +00:00
Revise identity layout
This commit is contained in:
parent
ea177d5a61
commit
7590a6ffae
3 changed files with 358 additions and 321 deletions
|
@ -49,15 +49,13 @@ public class EntityIdentity {
|
|||
public String name;
|
||||
@NonNull
|
||||
public String email;
|
||||
public String display;
|
||||
public String replyto;
|
||||
public String bcc;
|
||||
@NonNull
|
||||
public Boolean delivery_receipt;
|
||||
@NonNull
|
||||
public Boolean read_receipt;
|
||||
@NonNull
|
||||
public Long account;
|
||||
public String display;
|
||||
public Integer color;
|
||||
public String signature;
|
||||
@NonNull
|
||||
public Integer auth_type;
|
||||
@NonNull
|
||||
public String host; // SMTP
|
||||
@NonNull
|
||||
|
@ -71,15 +69,17 @@ public class EntityIdentity {
|
|||
@NonNull
|
||||
public String password;
|
||||
@NonNull
|
||||
public Integer auth_type;
|
||||
@NonNull
|
||||
public Boolean primary;
|
||||
public Integer color;
|
||||
public String signature;
|
||||
@NonNull
|
||||
public Boolean synchronize;
|
||||
@NonNull
|
||||
public Boolean store_sent;
|
||||
public Boolean primary;
|
||||
public String replyto;
|
||||
public String bcc;
|
||||
@NonNull
|
||||
public Boolean delivery_receipt;
|
||||
@NonNull
|
||||
public Boolean read_receipt;
|
||||
@NonNull
|
||||
public Boolean store_sent = false; // obsolete
|
||||
public Long sent_folder;
|
||||
public Boolean tbd;
|
||||
public String state;
|
||||
|
@ -88,25 +88,26 @@ public class EntityIdentity {
|
|||
public JSONObject toJSON() throws JSONException {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name", name);
|
||||
json.put("display", display);
|
||||
json.put("email", email);
|
||||
json.put("replyto", replyto);
|
||||
json.put("bcc", bcc);
|
||||
json.put("delivery_receipt", delivery_receipt);
|
||||
json.put("read_receipt", read_receipt);
|
||||
json.put("display", display);
|
||||
if (color != null)
|
||||
json.put("color", color);
|
||||
json.put("signature", signature);
|
||||
// not account
|
||||
json.put("auth_type", auth_type);
|
||||
json.put("host", host);
|
||||
json.put("starttls", starttls);
|
||||
json.put("insecure", insecure);
|
||||
json.put("port", port);
|
||||
json.put("user", user);
|
||||
json.put("password", password);
|
||||
json.put("auth_type", auth_type);
|
||||
json.put("primary", primary);
|
||||
if (color != null)
|
||||
json.put("color", color);
|
||||
json.put("signature", signature);
|
||||
json.put("synchronize", synchronize);
|
||||
json.put("primary", primary);
|
||||
|
||||
json.put("replyto", replyto);
|
||||
json.put("bcc", bcc);
|
||||
json.put("delivery_receipt", delivery_receipt);
|
||||
json.put("read_receipt", read_receipt);
|
||||
json.put("store_sent", store_sent);
|
||||
if (sent_folder != null)
|
||||
json.put("sent_folder", sent_folder);
|
||||
|
@ -118,11 +119,26 @@ public class EntityIdentity {
|
|||
public static EntityIdentity fromJSON(JSONObject json) throws JSONException {
|
||||
EntityIdentity identity = new EntityIdentity();
|
||||
identity.name = json.getString("name");
|
||||
identity.email = json.getString("email");
|
||||
|
||||
if (json.has("display"))
|
||||
identity.display = json.getString("display");
|
||||
|
||||
identity.email = json.getString("email");
|
||||
if (json.has("color"))
|
||||
identity.color = json.getInt("color");
|
||||
if (json.has("signature"))
|
||||
identity.signature = json.getString("signature");
|
||||
|
||||
identity.auth_type = json.getInt("auth_type");
|
||||
identity.host = json.getString("host");
|
||||
identity.starttls = json.getBoolean("starttls");
|
||||
identity.insecure = (json.has("insecure") && json.getBoolean("insecure"));
|
||||
identity.port = json.getInt("port");
|
||||
identity.user = json.getString("user");
|
||||
identity.password = json.getString("password");
|
||||
|
||||
identity.synchronize = json.getBoolean("synchronize");
|
||||
identity.primary = json.getBoolean("primary");
|
||||
|
||||
if (json.has("replyto"))
|
||||
identity.replyto = json.getString("replyto");
|
||||
|
@ -140,22 +156,8 @@ public class EntityIdentity {
|
|||
else
|
||||
identity.read_receipt = false;
|
||||
|
||||
identity.host = json.getString("host");
|
||||
identity.starttls = json.getBoolean("starttls");
|
||||
identity.insecure = (json.has("insecure") && json.getBoolean("insecure"));
|
||||
identity.port = json.getInt("port");
|
||||
identity.user = json.getString("user");
|
||||
identity.password = json.getString("password");
|
||||
identity.auth_type = json.getInt("auth_type");
|
||||
identity.primary = json.getBoolean("primary");
|
||||
|
||||
if (json.has("color"))
|
||||
identity.color = json.getInt("color");
|
||||
if (json.has("signature"))
|
||||
identity.signature = json.getString("signature");
|
||||
|
||||
identity.synchronize = json.getBoolean("synchronize");
|
||||
identity.store_sent = json.getBoolean("store_sent");
|
||||
if (json.has("store_sent"))
|
||||
identity.store_sent = json.getBoolean("store_sent");
|
||||
|
||||
if (json.has("sent_folder"))
|
||||
identity.sent_folder = json.getLong("sent_folder");
|
||||
|
@ -169,19 +171,21 @@ public class EntityIdentity {
|
|||
EntityIdentity other = (EntityIdentity) obj;
|
||||
return (this.name.equals(other.name) &&
|
||||
this.email.equals(other.email) &&
|
||||
(this.replyto == null ? other.replyto == null : this.replyto.equals(other.replyto)) &&
|
||||
this.account.equals(other.account) &&
|
||||
(this.display == null ? other.display == null : this.display.equals(other.display)) &&
|
||||
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
|
||||
(this.signature == null ? other.signature == null : this.signature.equals(other.signature)) &&
|
||||
this.host.equals(other.host) &&
|
||||
this.starttls.equals(other.starttls) &&
|
||||
this.insecure.equals(other.insecure) &&
|
||||
this.port.equals(other.port) &&
|
||||
this.user.equals(other.user) &&
|
||||
this.password.equals(other.password) &&
|
||||
this.primary.equals(other.primary) &&
|
||||
(this.color == null ? other.color == null : this.color.equals(other.color)) &&
|
||||
(this.signature == null ? other.signature == null : this.signature.equals(other.signature)) &&
|
||||
this.synchronize.equals(other.synchronize) &&
|
||||
this.store_sent.equals(other.store_sent) &&
|
||||
this.primary.equals(other.primary) &&
|
||||
(this.replyto == null ? other.replyto == null : this.replyto.equals(other.replyto)) &&
|
||||
this.delivery_receipt.equals(other.delivery_receipt) &&
|
||||
this.read_receipt.equals(other.read_receipt) &&
|
||||
(this.sent_folder == null ? other.sent_folder == null : this.sent_folder.equals(other.sent_folder)) &&
|
||||
(this.tbd == null ? other.tbd == null : this.tbd.equals(other.tbd)) &&
|
||||
(this.state == null ? other.state == null : this.state.equals(other.state)) &&
|
||||
|
|
|
@ -27,8 +27,10 @@ import android.graphics.drawable.GradientDrawable;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.Editable;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -47,6 +49,7 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.colorpicker.ColorPickerDialog;
|
||||
import com.android.colorpicker.ColorPickerSwatch;
|
||||
|
@ -73,15 +76,21 @@ import androidx.fragment.app.FragmentTransaction;
|
|||
|
||||
public class FragmentIdentity extends FragmentEx {
|
||||
private ViewGroup view;
|
||||
|
||||
private EditText etName;
|
||||
private EditText etEmail;
|
||||
private EditText etDisplay;
|
||||
|
||||
private Spinner spAccount;
|
||||
|
||||
private EditText etDisplay;
|
||||
private Button btnColor;
|
||||
private View vwColor;
|
||||
private ImageView ibColorDefault;
|
||||
private EditText etSignature;
|
||||
private ImageButton ibPro;
|
||||
|
||||
private Button btnAdvanced;
|
||||
private EditText etReplyTo;
|
||||
private EditText etBcc;
|
||||
private CheckBox cbDeliveryReceipt;
|
||||
private CheckBox cbReadReceipt;
|
||||
private TextView tvProvider;
|
||||
private Spinner spProvider;
|
||||
private EditText etDomain;
|
||||
private Button btnAutoConfig;
|
||||
|
@ -92,19 +101,19 @@ public class FragmentIdentity extends FragmentEx {
|
|||
private EditText etUser;
|
||||
private TextInputLayout tilPassword;
|
||||
|
||||
private Button btnColor;
|
||||
private View vwColor;
|
||||
private ImageView ibColorDefault;
|
||||
private EditText etSignature;
|
||||
private ImageButton ibPro;
|
||||
|
||||
private CheckBox cbSynchronize;
|
||||
private CheckBox cbPrimary;
|
||||
|
||||
private EditText etReplyTo;
|
||||
private EditText etBcc;
|
||||
private CheckBox cbDeliveryReceipt;
|
||||
private CheckBox cbReadReceipt;
|
||||
private Spinner spSent;
|
||||
|
||||
private Button btnSave;
|
||||
private ProgressBar pbSave;
|
||||
private ProgressBar pbWait;
|
||||
|
||||
private Group grpAdvanced;
|
||||
|
||||
private long id = -1;
|
||||
|
@ -135,19 +144,18 @@ public class FragmentIdentity extends FragmentEx {
|
|||
etName = view.findViewById(R.id.etName);
|
||||
etEmail = view.findViewById(R.id.etEmail);
|
||||
spAccount = view.findViewById(R.id.spAccount);
|
||||
etDisplay = view.findViewById(R.id.etDisplay);
|
||||
btnColor = view.findViewById(R.id.btnColor);
|
||||
vwColor = view.findViewById(R.id.vwColor);
|
||||
ibColorDefault = view.findViewById(R.id.ibColorDefault);
|
||||
etSignature = view.findViewById(R.id.etSignature);
|
||||
ibPro = view.findViewById(R.id.ibPro);
|
||||
|
||||
btnAdvanced = view.findViewById(R.id.btnAdvanced);
|
||||
etDisplay = view.findViewById(R.id.etDisplay);
|
||||
etReplyTo = view.findViewById(R.id.etReplyTo);
|
||||
etBcc = view.findViewById(R.id.etBcc);
|
||||
cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt);
|
||||
cbReadReceipt = view.findViewById(R.id.cbReadReceipt);
|
||||
|
||||
tvProvider = view.findViewById(R.id.tvProvider);
|
||||
spProvider = view.findViewById(R.id.spProvider);
|
||||
|
||||
etDomain = view.findViewById(R.id.etDomain);
|
||||
btnAutoConfig = view.findViewById(R.id.btnAutoConfig);
|
||||
|
||||
etHost = view.findViewById(R.id.etHost);
|
||||
cbStartTls = view.findViewById(R.id.cbStartTls);
|
||||
cbInsecure = view.findViewById(R.id.cbInsecure);
|
||||
|
@ -155,19 +163,19 @@ public class FragmentIdentity extends FragmentEx {
|
|||
etUser = view.findViewById(R.id.etUser);
|
||||
tilPassword = view.findViewById(R.id.tilPassword);
|
||||
|
||||
btnColor = view.findViewById(R.id.btnColor);
|
||||
vwColor = view.findViewById(R.id.vwColor);
|
||||
ibColorDefault = view.findViewById(R.id.ibColorDefault);
|
||||
etSignature = view.findViewById(R.id.etSignature);
|
||||
ibPro = view.findViewById(R.id.ibPro);
|
||||
|
||||
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
||||
cbPrimary = view.findViewById(R.id.cbPrimary);
|
||||
|
||||
etReplyTo = view.findViewById(R.id.etReplyTo);
|
||||
etBcc = view.findViewById(R.id.etBcc);
|
||||
cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt);
|
||||
cbReadReceipt = view.findViewById(R.id.cbReadReceipt);
|
||||
spSent = view.findViewById(R.id.spSent);
|
||||
|
||||
btnSave = view.findViewById(R.id.btnSave);
|
||||
pbSave = view.findViewById(R.id.pbSave);
|
||||
pbWait = view.findViewById(R.id.pbWait);
|
||||
|
||||
grpAdvanced = view.findViewById(R.id.grpAdvanced);
|
||||
|
||||
// Wire controls
|
||||
|
@ -229,98 +237,6 @@ public class FragmentIdentity extends FragmentEx {
|
|||
}
|
||||
});
|
||||
|
||||
spProvider.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
Integer tag = (Integer) adapterView.getTag();
|
||||
if (tag != null && tag.equals(position))
|
||||
return;
|
||||
adapterView.setTag(position);
|
||||
|
||||
Provider provider = (Provider) adapterView.getSelectedItem();
|
||||
|
||||
// Set associated host/port/starttls
|
||||
etHost.setText(provider.smtp_host);
|
||||
etPort.setText(position == 0 ? null : Integer.toString(provider.smtp_port));
|
||||
cbStartTls.setChecked(provider.smtp_starttls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
});
|
||||
|
||||
btnAutoConfig.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
etDomain.setEnabled(false);
|
||||
btnAutoConfig.setEnabled(false);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("domain", etDomain.getText().toString());
|
||||
|
||||
new SimpleTask<SRVRecord>() {
|
||||
@Override
|
||||
protected SRVRecord onLoad(Context context, Bundle args) throws Throwable {
|
||||
String domain = args.getString("domain");
|
||||
Record[] records = new Lookup("_submission._tcp." + domain, Type.SRV).run();
|
||||
if (records != null)
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
SRVRecord srv = (SRVRecord) records[i];
|
||||
Log.i("SRV=" + srv);
|
||||
return srv;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(getString(R.string.title_no_settings));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoaded(Bundle args, SRVRecord srv) {
|
||||
etDomain.setEnabled(true);
|
||||
btnAutoConfig.setEnabled(true);
|
||||
if (srv != null) {
|
||||
etHost.setText(srv.getTarget().toString(true));
|
||||
etPort.setText(Integer.toString(srv.getPort()));
|
||||
cbStartTls.setChecked(srv.getPort() == 587);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
etDomain.setEnabled(true);
|
||||
btnAutoConfig.setEnabled(true);
|
||||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, args);
|
||||
}
|
||||
});
|
||||
|
||||
btnAdvanced.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
|
||||
grpAdvanced.setVisibility(visibility);
|
||||
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
|
||||
if (visibility == View.VISIBLE)
|
||||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((ScrollView) view).smoothScrollTo(0, etDisplay.getTop());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
cbStartTls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
etPort.setHint(checked ? "587" : "465");
|
||||
}
|
||||
});
|
||||
|
||||
vwColor.setBackgroundColor(color);
|
||||
btnColor.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -362,6 +278,117 @@ public class FragmentIdentity extends FragmentEx {
|
|||
}
|
||||
});
|
||||
|
||||
btnAdvanced.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
|
||||
grpAdvanced.setVisibility(visibility);
|
||||
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
|
||||
if (visibility == View.VISIBLE)
|
||||
new Handler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((ScrollView) view).smoothScrollTo(0, tvProvider.getTop());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
spProvider.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
Integer tag = (Integer) adapterView.getTag();
|
||||
if (tag != null && tag.equals(position))
|
||||
return;
|
||||
adapterView.setTag(position);
|
||||
|
||||
Provider provider = (Provider) adapterView.getSelectedItem();
|
||||
|
||||
// Set associated host/port/starttls
|
||||
etHost.setText(provider.smtp_host);
|
||||
etPort.setText(position == 0 ? null : Integer.toString(provider.smtp_port));
|
||||
cbStartTls.setChecked(provider.smtp_starttls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
});
|
||||
|
||||
etDomain.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence text, int start, int before, int count) {
|
||||
btnAutoConfig.setEnabled(text.length() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
|
||||
btnAutoConfig.setEnabled(false);
|
||||
|
||||
btnAutoConfig.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
etDomain.setEnabled(false);
|
||||
btnAutoConfig.setEnabled(false);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("domain", etDomain.getText().toString());
|
||||
|
||||
new SimpleTask<SRVRecord>() {
|
||||
@Override
|
||||
protected SRVRecord onLoad(Context context, Bundle args) throws Throwable {
|
||||
String dns = "_submission._tcp." + args.getString("domain");
|
||||
Log.i("Lookup dns=" + dns);
|
||||
Record[] records = new Lookup(dns, Type.SRV).run();
|
||||
Log.i("Found dns=" + (records == null ? -1 : records.length));
|
||||
if (records != null)
|
||||
for (int i = 0; i < records.length; i++) {
|
||||
SRVRecord srv = (SRVRecord) records[i];
|
||||
Log.i("SRV=" + srv);
|
||||
return srv;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(getString(R.string.title_no_settings));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoaded(Bundle args, SRVRecord srv) {
|
||||
etDomain.setEnabled(true);
|
||||
btnAutoConfig.setEnabled(true);
|
||||
if (srv != null) {
|
||||
etHost.setText(srv.getTarget().toString(true));
|
||||
etPort.setText(Integer.toString(srv.getPort()));
|
||||
cbStartTls.setChecked(srv.getPort() == 587);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
etDomain.setEnabled(true);
|
||||
btnAutoConfig.setEnabled(true);
|
||||
if (ex instanceof IllegalArgumentException)
|
||||
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||
else
|
||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||
}
|
||||
}.load(FragmentIdentity.this, args);
|
||||
}
|
||||
});
|
||||
|
||||
cbStartTls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
etPort.setHint(checked ? "587" : "465");
|
||||
}
|
||||
});
|
||||
|
||||
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -406,24 +433,27 @@ public class FragmentIdentity extends FragmentEx {
|
|||
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
||||
long id = args.getLong("id");
|
||||
String name = args.getString("name");
|
||||
long account = args.getLong("account");
|
||||
String display = args.getString("display");
|
||||
String email = args.getString("email");
|
||||
String replyto = args.getString("replyto");
|
||||
String bcc = args.getString("bcc");
|
||||
boolean delivery_receipt = args.getBoolean("delivery_receipt");
|
||||
boolean read_receipt = args.getBoolean("read_receipt");
|
||||
long account = args.getLong("account");
|
||||
|
||||
String display = args.getString("display");
|
||||
Integer color = args.getInt("color");
|
||||
String signature = args.getString("signature");
|
||||
|
||||
int auth_type = args.getInt("auth_type");
|
||||
String host = args.getString("host");
|
||||
boolean starttls = args.getBoolean("starttls");
|
||||
boolean insecure = args.getBoolean("insecure");
|
||||
String port = args.getString("port");
|
||||
String user = args.getString("user");
|
||||
String password = args.getString("password");
|
||||
Integer color = args.getInt("color");
|
||||
String signature = args.getString("signature");
|
||||
int auth_type = args.getInt("auth_type");
|
||||
boolean synchronize = args.getBoolean("synchronize");
|
||||
boolean primary = args.getBoolean("primary");
|
||||
|
||||
String replyto = args.getString("replyto");
|
||||
String bcc = args.getString("bcc");
|
||||
boolean delivery_receipt = args.getBoolean("delivery_receipt");
|
||||
boolean read_receipt = args.getBoolean("read_receipt");
|
||||
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
|
||||
|
||||
if (TextUtils.isEmpty(name))
|
||||
|
@ -495,24 +525,26 @@ public class FragmentIdentity extends FragmentEx {
|
|||
if (identity == null)
|
||||
identity = new EntityIdentity();
|
||||
identity.name = name;
|
||||
identity.email = email;
|
||||
identity.account = account;
|
||||
identity.display = display;
|
||||
identity.email = email;
|
||||
identity.replyto = replyto;
|
||||
identity.bcc = bcc;
|
||||
identity.delivery_receipt = delivery_receipt;
|
||||
identity.read_receipt = read_receipt;
|
||||
identity.color = color;
|
||||
identity.signature = signature;
|
||||
|
||||
identity.auth_type = auth_type;
|
||||
identity.host = host;
|
||||
identity.starttls = starttls;
|
||||
identity.insecure = insecure;
|
||||
identity.port = Integer.parseInt(port);
|
||||
identity.user = user;
|
||||
identity.password = password;
|
||||
identity.color = color;
|
||||
identity.signature = signature;
|
||||
identity.auth_type = auth_type;
|
||||
identity.synchronize = synchronize;
|
||||
identity.primary = (identity.synchronize && primary);
|
||||
|
||||
identity.replyto = replyto;
|
||||
identity.bcc = bcc;
|
||||
identity.delivery_receipt = delivery_receipt;
|
||||
identity.read_receipt = read_receipt;
|
||||
identity.store_sent = false;
|
||||
identity.sent_folder = (sent == null ? null : sent.id);
|
||||
identity.error = null;
|
||||
|
@ -602,21 +634,24 @@ public class FragmentIdentity extends FragmentEx {
|
|||
if (savedInstanceState == null) {
|
||||
etName.setText(identity == null ? null : identity.name);
|
||||
etEmail.setText(identity == null ? null : identity.email);
|
||||
|
||||
etDisplay.setText(identity == null ? null : identity.display);
|
||||
etReplyTo.setText(identity == null ? null : identity.replyto);
|
||||
etBcc.setText(identity == null ? null : identity.bcc);
|
||||
cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt);
|
||||
cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt);
|
||||
etSignature.setText(identity == null || identity.signature == null ? null : Html.fromHtml(identity.signature));
|
||||
|
||||
etHost.setText(identity == null ? null : identity.host);
|
||||
cbStartTls.setChecked(identity == null ? false : identity.starttls);
|
||||
cbInsecure.setChecked(identity == null ? false : identity.insecure);
|
||||
etPort.setText(identity == null ? null : Long.toString(identity.port));
|
||||
etUser.setText(identity == null ? null : identity.user);
|
||||
tilPassword.getEditText().setText(identity == null ? null : identity.password);
|
||||
etSignature.setText(identity == null || identity.signature == null ? null : Html.fromHtml(identity.signature));
|
||||
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
|
||||
cbPrimary.setChecked(identity == null ? true : identity.primary);
|
||||
|
||||
etReplyTo.setText(identity == null ? null : identity.replyto);
|
||||
etBcc.setText(identity == null ? null : identity.bcc);
|
||||
cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt);
|
||||
cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt);
|
||||
|
||||
color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color);
|
||||
|
||||
etName.requestFocus();
|
||||
|
|
|
@ -72,20 +72,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAccount" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdvanced"
|
||||
style="@style/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:text="@string/title_setup_advanced"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spAccount" />
|
||||
|
||||
<!-- email -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -95,7 +81,7 @@
|
|||
android:text="@string/title_display_name"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAdvanced" />
|
||||
app:layout_constraintTop_toBottomOf="@id/spAccount" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDisplay"
|
||||
|
@ -107,78 +93,81 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDisplay" />
|
||||
|
||||
<!-- reply to -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReplyTo"
|
||||
<Button
|
||||
android:id="@+id/btnColor"
|
||||
style="@style/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_reply_to"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:text="@string/title_account_color"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etDisplay" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etReplyTo"
|
||||
android:layout_width="match_parent"
|
||||
<View
|
||||
android:id="@+id/vwColor"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@color/colorAccent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnColor"
|
||||
app:layout_constraintStart_toEndOf="@id/btnColor"
|
||||
app:layout_constraintTop_toTopOf="@id/btnColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ibColorDefault"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="emailAddress"
|
||||
android:hint="@string/title_optional"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/baseline_delete_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnColor"
|
||||
app:layout_constraintStart_toEndOf="@id/vwColor"
|
||||
app:layout_constraintTop_toTopOf="@id/btnColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBcc"
|
||||
android:id="@+id/tvSignature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_bcc"
|
||||
android:text="@string/title_account_signature"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etReplyTo" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnColor" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBcc"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/etSignature"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="emailAddress"
|
||||
android:fontFamily="monospace"
|
||||
android:hint="@string/title_optional"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbDeliveryReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_delivery_receipt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etBcc" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbReadReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_read_receipt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbDeliveryReceipt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_receipt_remark"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibPro"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbReadReceipt" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSignature" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibPro"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/baseline_info_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/etSignature"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/etSignature" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdvanced"
|
||||
style="@style/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:text="@string/title_setup_advanced"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etSignature" />
|
||||
|
||||
<!--- provider -->
|
||||
|
||||
|
@ -190,7 +179,7 @@
|
|||
android:text="@string/title_provider"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReceipt" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAdvanced" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spProvider"
|
||||
|
@ -309,7 +298,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPort" />
|
||||
|
||||
<!-- password -->
|
||||
<!-- username -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUser"
|
||||
|
@ -361,70 +350,6 @@
|
|||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnColor"
|
||||
style="@style/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="0dp"
|
||||
android:text="@string/title_account_color"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vwColor"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@color/colorAccent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnColor"
|
||||
app:layout_constraintStart_toEndOf="@id/btnColor"
|
||||
app:layout_constraintTop_toTopOf="@id/btnColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ibColorDefault"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/baseline_delete_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnColor"
|
||||
app:layout_constraintStart_toEndOf="@id/vwColor"
|
||||
app:layout_constraintTop_toTopOf="@id/btnColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSignature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_account_signature"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnColor" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etSignature"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="monospace"
|
||||
android:hint="@string/title_optional"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibPro"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSignature" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibPro"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/baseline_info_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/etSignature"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/etSignature" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSynchronize"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -432,7 +357,7 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_synchronize_identity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etSignature" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbPrimary"
|
||||
|
@ -443,6 +368,79 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
|
||||
|
||||
<!-- reply to -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReplyTo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_reply_to"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etReplyTo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="emailAddress"
|
||||
android:hint="@string/title_optional"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBcc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_bcc"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etReplyTo" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBcc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="emailAddress"
|
||||
android:hint="@string/title_optional"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbDeliveryReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_delivery_receipt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etBcc" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbReadReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_read_receipt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbDeliveryReceipt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_identity_receipt_remark"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbReadReceipt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSent"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -451,7 +449,7 @@
|
|||
android:text="@string/title_store_copy"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvReceipt" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spSent"
|
||||
|
@ -506,6 +504,6 @@
|
|||
android:id="@+id/grpAdvanced"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvDisplay,etDisplay,tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,btnColor,vwColor,ibColorDefault,tvSignature,etSignature,ibPro,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" />
|
||||
app:constraint_referenced_ids="tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue