|
|
@ -31,6 +31,7 @@ import android.graphics.Color;
|
|
|
|
import android.graphics.Paint;
|
|
|
|
import android.graphics.Paint;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
import android.provider.ContactsContract;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.text.TextWatcher;
|
|
|
@ -120,6 +121,8 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
private EditText etCc;
|
|
|
|
private EditText etCc;
|
|
|
|
private EditText etBcc;
|
|
|
|
private EditText etBcc;
|
|
|
|
private EditText etInternal;
|
|
|
|
private EditText etInternal;
|
|
|
|
|
|
|
|
private Button btnUri;
|
|
|
|
|
|
|
|
private TextView tvUri;
|
|
|
|
private CheckBox cbSignDefault;
|
|
|
|
private CheckBox cbSignDefault;
|
|
|
|
private CheckBox cbEncryptDefault;
|
|
|
|
private CheckBox cbEncryptDefault;
|
|
|
|
private CheckBox cbUnicode;
|
|
|
|
private CheckBox cbUnicode;
|
|
|
@ -153,6 +156,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
private static final int REQUEST_SAVE = 2;
|
|
|
|
private static final int REQUEST_SAVE = 2;
|
|
|
|
private static final int REQUEST_DELETE = 3;
|
|
|
|
private static final int REQUEST_DELETE = 3;
|
|
|
|
private static final int REQUEST_SIGNATURE = 4;
|
|
|
|
private static final int REQUEST_SIGNATURE = 4;
|
|
|
|
|
|
|
|
private static final int REQUEST_URI = 5;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
@ -220,6 +224,8 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
etCc = view.findViewById(R.id.etCc);
|
|
|
|
etCc = view.findViewById(R.id.etCc);
|
|
|
|
etBcc = view.findViewById(R.id.etBcc);
|
|
|
|
etBcc = view.findViewById(R.id.etBcc);
|
|
|
|
etInternal = view.findViewById(R.id.etInternal);
|
|
|
|
etInternal = view.findViewById(R.id.etInternal);
|
|
|
|
|
|
|
|
btnUri = view.findViewById(R.id.btnUri);
|
|
|
|
|
|
|
|
tvUri = view.findViewById(R.id.tvUri);
|
|
|
|
cbSignDefault = view.findViewById(R.id.cbSignDefault);
|
|
|
|
cbSignDefault = view.findViewById(R.id.cbSignDefault);
|
|
|
|
cbEncryptDefault = view.findViewById(R.id.cbEncryptDefault);
|
|
|
|
cbEncryptDefault = view.findViewById(R.id.cbEncryptDefault);
|
|
|
|
cbUnicode = view.findViewById(R.id.cbUnicode);
|
|
|
|
cbUnicode = view.findViewById(R.id.cbUnicode);
|
|
|
@ -481,6 +487,15 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnUri.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
|
|
|
|
|
|
|
|
pick.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
|
|
|
|
|
|
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_URI);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cbEncryptDefault.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
cbEncryptDefault.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
@ -527,6 +542,10 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
cbInsecure.setVisibility(View.GONE);
|
|
|
|
cbInsecure.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
btnAdvanced.setVisibility(View.GONE);
|
|
|
|
btnAdvanced.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
if (!BuildConfig.DEBUG) {
|
|
|
|
|
|
|
|
Helper.hide(btnUri);
|
|
|
|
|
|
|
|
Helper.hide(tvUri);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
etEhlo.setHint(EmailService.getDefaultEhlo());
|
|
|
|
etEhlo.setHint(EmailService.getDefaultEhlo());
|
|
|
|
|
|
|
|
|
|
|
@ -710,6 +729,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
args.putString("cc", etCc.getText().toString().trim());
|
|
|
|
args.putString("cc", etCc.getText().toString().trim());
|
|
|
|
args.putString("bcc", etBcc.getText().toString().trim());
|
|
|
|
args.putString("bcc", etBcc.getText().toString().trim());
|
|
|
|
args.putString("internal", etInternal.getText().toString().replaceAll(" ", ""));
|
|
|
|
args.putString("internal", etInternal.getText().toString().replaceAll(" ", ""));
|
|
|
|
|
|
|
|
args.putString("uri", tvUri.getText().toString());
|
|
|
|
args.putBoolean("sign_default", cbSignDefault.isChecked());
|
|
|
|
args.putBoolean("sign_default", cbSignDefault.isChecked());
|
|
|
|
args.putBoolean("encrypt_default", cbEncryptDefault.isChecked());
|
|
|
|
args.putBoolean("encrypt_default", cbEncryptDefault.isChecked());
|
|
|
|
args.putBoolean("unicode", cbUnicode.isChecked());
|
|
|
|
args.putBoolean("unicode", cbUnicode.isChecked());
|
|
|
@ -794,6 +814,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
String cc = args.getString("cc");
|
|
|
|
String cc = args.getString("cc");
|
|
|
|
String bcc = args.getString("bcc");
|
|
|
|
String bcc = args.getString("bcc");
|
|
|
|
String internal = args.getString("internal");
|
|
|
|
String internal = args.getString("internal");
|
|
|
|
|
|
|
|
String uri = args.getString("uri");
|
|
|
|
boolean sign_default = args.getBoolean("sign_default");
|
|
|
|
boolean sign_default = args.getBoolean("sign_default");
|
|
|
|
boolean encrypt_default = args.getBoolean("encrypt_default");
|
|
|
|
boolean encrypt_default = args.getBoolean("encrypt_default");
|
|
|
|
boolean unicode = args.getBoolean("unicode");
|
|
|
|
boolean unicode = args.getBoolean("unicode");
|
|
|
@ -856,6 +877,9 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
if (TextUtils.isEmpty(internal))
|
|
|
|
if (TextUtils.isEmpty(internal))
|
|
|
|
internal = null;
|
|
|
|
internal = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(uri))
|
|
|
|
|
|
|
|
uri = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(display))
|
|
|
|
if (TextUtils.isEmpty(display))
|
|
|
|
display = null;
|
|
|
|
display = null;
|
|
|
|
|
|
|
|
|
|
|
@ -949,6 +973,8 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.internal, internal))
|
|
|
|
if (!Objects.equals(identity.internal, internal))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (!Objects.equals(identity.uri, uri))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.sign_default, sign_default))
|
|
|
|
if (!Objects.equals(identity.sign_default, sign_default))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.encrypt_default, encrypt_default))
|
|
|
|
if (!Objects.equals(identity.encrypt_default, encrypt_default))
|
|
|
@ -1052,6 +1078,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
identity.cc = cc;
|
|
|
|
identity.cc = cc;
|
|
|
|
identity.bcc = bcc;
|
|
|
|
identity.bcc = bcc;
|
|
|
|
identity.internal = internal;
|
|
|
|
identity.internal = internal;
|
|
|
|
|
|
|
|
identity.uri = uri;
|
|
|
|
identity.sign_default = sign_default;
|
|
|
|
identity.sign_default = sign_default;
|
|
|
|
identity.encrypt_default = encrypt_default;
|
|
|
|
identity.encrypt_default = encrypt_default;
|
|
|
|
identity.unicode = unicode;
|
|
|
|
identity.unicode = unicode;
|
|
|
@ -1238,6 +1265,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
etCc.setText(identity == null ? null : identity.cc);
|
|
|
|
etCc.setText(identity == null ? null : identity.cc);
|
|
|
|
etBcc.setText(identity == null ? null : identity.bcc);
|
|
|
|
etBcc.setText(identity == null ? null : identity.bcc);
|
|
|
|
etInternal.setText(identity == null ? null : identity.internal);
|
|
|
|
etInternal.setText(identity == null ? null : identity.internal);
|
|
|
|
|
|
|
|
tvUri.setText(identity == null ? null : identity.uri);
|
|
|
|
cbSignDefault.setChecked(identity != null && identity.sign_default);
|
|
|
|
cbSignDefault.setChecked(identity != null && identity.sign_default);
|
|
|
|
cbEncryptDefault.setChecked(identity != null && identity.encrypt_default);
|
|
|
|
cbEncryptDefault.setChecked(identity != null && identity.encrypt_default);
|
|
|
|
cbUnicode.setChecked(identity != null && identity.unicode);
|
|
|
|
cbUnicode.setChecked(identity != null && identity.unicode);
|
|
|
@ -1444,6 +1472,9 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
if (resultCode == RESULT_OK && data != null)
|
|
|
|
if (resultCode == RESULT_OK && data != null)
|
|
|
|
onHtml(data.getExtras());
|
|
|
|
onHtml(data.getExtras());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REQUEST_URI:
|
|
|
|
|
|
|
|
onPickUri(resultCode == RESULT_OK ? data : null);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
@ -1488,4 +1519,9 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
private void onHtml(Bundle args) {
|
|
|
|
private void onHtml(Bundle args) {
|
|
|
|
signature = args.getString("html");
|
|
|
|
signature = args.getString("html");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onPickUri(Intent intent) {
|
|
|
|
|
|
|
|
Uri uri = (intent == null ? null : intent.getData());
|
|
|
|
|
|
|
|
tvUri.setText(uri == null ? null : uri.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|