mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 15:32:52 +00:00
Support catch all addresses
This commit is contained in:
parent
ae6176df0d
commit
2f69c2b63a
3 changed files with 14 additions and 25 deletions
|
@ -136,9 +136,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
private ViewGroup view;
|
private ViewGroup view;
|
||||||
private Spinner spIdentity;
|
private Spinner spIdentity;
|
||||||
private TextView tvExtraPrefix;
|
|
||||||
private EditText etExtra;
|
private EditText etExtra;
|
||||||
private TextView tvExtraSuffix;
|
private TextView tvDomain;
|
||||||
private MultiAutoCompleteTextView etTo;
|
private MultiAutoCompleteTextView etTo;
|
||||||
private ImageView ivToAdd;
|
private ImageView ivToAdd;
|
||||||
private MultiAutoCompleteTextView etCc;
|
private MultiAutoCompleteTextView etCc;
|
||||||
|
@ -193,9 +192,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
// Get controls
|
// Get controls
|
||||||
spIdentity = view.findViewById(R.id.spIdentity);
|
spIdentity = view.findViewById(R.id.spIdentity);
|
||||||
tvExtraPrefix = view.findViewById(R.id.tvExtraPrefix);
|
|
||||||
etExtra = view.findViewById(R.id.etExtra);
|
etExtra = view.findViewById(R.id.etExtra);
|
||||||
tvExtraSuffix = view.findViewById(R.id.tvExtraSuffix);
|
tvDomain = view.findViewById(R.id.tvDomain);
|
||||||
etTo = view.findViewById(R.id.etTo);
|
etTo = view.findViewById(R.id.etTo);
|
||||||
ivToAdd = view.findViewById(R.id.ivToAdd);
|
ivToAdd = view.findViewById(R.id.ivToAdd);
|
||||||
etCc = view.findViewById(R.id.etCc);
|
etCc = view.findViewById(R.id.etCc);
|
||||||
|
@ -228,8 +226,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
EntityIdentity identity = (EntityIdentity) parent.getAdapter().getItem(position);
|
EntityIdentity identity = (EntityIdentity) parent.getAdapter().getItem(position);
|
||||||
int at = (identity == null ? -1 : identity.email.indexOf('@'));
|
int at = (identity == null ? -1 : identity.email.indexOf('@'));
|
||||||
tvExtraPrefix.setText(at < 0 ? null : identity.email.substring(0, at));
|
etExtra.setHint(at < 0 ? null : identity.email.substring(0, at));
|
||||||
tvExtraSuffix.setText(at < 0 ? null : identity.email.substring(at));
|
tvDomain.setText(at < 0 ? null : identity.email.substring(at));
|
||||||
Spanned signature = null;
|
Spanned signature = null;
|
||||||
if (pro) {
|
if (pro) {
|
||||||
if (identity != null && !TextUtils.isEmpty(identity.signature))
|
if (identity != null && !TextUtils.isEmpty(identity.signature))
|
||||||
|
@ -250,8 +248,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
tvExtraPrefix.setText(null);
|
etExtra.setHint("");
|
||||||
tvExtraSuffix.setText(null);
|
tvDomain.setText(null);
|
||||||
tvSignature.setText(null);
|
tvSignature.setText(null);
|
||||||
grpSignature.setVisibility(View.GONE);
|
grpSignature.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -375,8 +373,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
setSubtitle(R.string.title_compose);
|
setSubtitle(R.string.title_compose);
|
||||||
tvExtraPrefix.setText(null);
|
etExtra.setHint("");
|
||||||
tvExtraSuffix.setText(null);
|
tvDomain.setText(null);
|
||||||
|
|
||||||
grpHeader.setVisibility(View.GONE);
|
grpHeader.setVisibility(View.GONE);
|
||||||
grpExtra.setVisibility(View.GONE);
|
grpExtra.setVisibility(View.GONE);
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class MessageHelper {
|
||||||
String name = ((InternetAddress) message.from[0]).getPersonal();
|
String name = ((InternetAddress) message.from[0]).getPersonal();
|
||||||
if (email != null && !TextUtils.isEmpty(message.extra)) {
|
if (email != null && !TextUtils.isEmpty(message.extra)) {
|
||||||
int at = email.indexOf('@');
|
int at = email.indexOf('@');
|
||||||
email = email.substring(0, at) + message.extra + email.substring(at);
|
email = message.extra + email.substring(at);
|
||||||
Log.i("extra=" + email);
|
Log.i("extra=" + email);
|
||||||
}
|
}
|
||||||
imessage.setFrom(new InternetAddress(email, name));
|
imessage.setFrom(new InternetAddress(email, name));
|
||||||
|
|
|
@ -24,29 +24,20 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvExtraPrefix"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:text="name"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/etExtra"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/etExtra" />
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etExtra"
|
android:id="@+id/etExtra"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:hint="name"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/tvExtraSuffix"
|
app:layout_constraintEnd_toStartOf="@+id/tvDomain"
|
||||||
app:layout_constraintStart_toEndOf="@id/tvExtraPrefix"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/spIdentity" />
|
app:layout_constraintTop_toBottomOf="@id/spIdentity" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvExtraSuffix"
|
android:id="@+id/tvDomain"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
|
|
Loading…
Reference in a new issue