Improved send dialog / DSN

pull/194/head
M66B 4 years ago
parent b1c60ee1d3
commit 635c2dfc19

@ -5667,9 +5667,9 @@ public class FragmentCompose extends FragmentBase {
final TextView tvTo = dview.findViewById(R.id.tvTo); final TextView tvTo = dview.findViewById(R.id.tvTo);
final TextView tvVia = dview.findViewById(R.id.tvVia); final TextView tvVia = dview.findViewById(R.id.tvVia);
final CheckBox cbPlainOnly = dview.findViewById(R.id.cbPlainOnly); final CheckBox cbPlainOnly = dview.findViewById(R.id.cbPlainOnly);
final TextView tvRemindPlain = dview.findViewById(R.id.tvRemindPlain); final TextView tvPlainHint = dview.findViewById(R.id.tvPlainHint);
final CheckBox cbReceipt = dview.findViewById(R.id.cbReceipt); final CheckBox cbReceipt = dview.findViewById(R.id.cbReceipt);
final TextView tvReceipt = dview.findViewById(R.id.tvReceiptType); final TextView tvReceiptHint = dview.findViewById(R.id.tvReceiptHint);
final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt); final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt);
final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption); final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption);
final Spinner spPriority = dview.findViewById(R.id.spPriority); final Spinner spPriority = dview.findViewById(R.id.spPriority);
@ -5678,6 +5678,7 @@ public class FragmentCompose extends FragmentBase {
final CheckBox cbArchive = dview.findViewById(R.id.cbArchive); final CheckBox cbArchive = dview.findViewById(R.id.cbArchive);
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain); final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
final TextView tvNotAgain = dview.findViewById(R.id.tvNotAgain); final TextView tvNotAgain = dview.findViewById(R.id.tvNotAgain);
final Group grpDsn = dview.findViewById(R.id.grpDsn);
tvAddressError.setText(address_error == null ? mx_error : address_error); tvAddressError.setText(address_error == null ? mx_error : address_error);
tvAddressError.setVisibility(address_error == null && mx_error == null ? View.GONE : View.VISIBLE); tvAddressError.setVisibility(address_error == null && mx_error == null ? View.GONE : View.VISIBLE);
@ -5696,8 +5697,8 @@ public class FragmentCompose extends FragmentBase {
tvTo.setText(null); tvTo.setText(null);
tvVia.setText(null); tvVia.setText(null);
tvRemindPlain.setVisibility(View.GONE); tvPlainHint.setVisibility(View.GONE);
tvReceipt.setVisibility(View.GONE); tvReceiptHint.setVisibility(View.GONE);
spEncrypt.setTag(0); spEncrypt.setTag(0);
spEncrypt.setSelection(0); spEncrypt.setSelection(0);
spPriority.setTag(1); spPriority.setTag(1);
@ -5740,7 +5741,7 @@ public class FragmentCompose extends FragmentBase {
cbPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
tvRemindPlain.setVisibility(checked && formatted ? View.VISIBLE : View.GONE); tvPlainHint.setVisibility(checked && formatted ? View.VISIBLE : View.GONE);
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", id); args.putLong("id", id);
@ -5769,7 +5770,7 @@ public class FragmentCompose extends FragmentBase {
cbReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
tvReceipt.setVisibility(checked ? View.VISIBLE : View.GONE); tvReceiptHint.setVisibility(checked ? View.VISIBLE : View.GONE);
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", id); args.putLong("id", id);
@ -5937,6 +5938,7 @@ public class FragmentCompose extends FragmentBase {
return; return;
} }
boolean dsn = (draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn));
int to = (draft.to == null ? 0 : draft.to.length); int to = (draft.to == null ? 0 : draft.to.length);
int cc = (draft.cc == null ? 0 : draft.cc.length) + (draft.bcc == null ? 0 : draft.bcc.length); int cc = (draft.cc == null ? 0 : draft.cc.length) + (draft.bcc == null ? 0 : draft.bcc.length);
if (cc == 0) if (cc == 0)
@ -5948,26 +5950,16 @@ public class FragmentCompose extends FragmentBase {
to + cc > RECIPIENTS_WARNING ? R.attr.colorWarning : android.R.attr.textColorPrimary)); to + cc > RECIPIENTS_WARNING ? R.attr.colorWarning : android.R.attr.textColorPrimary));
tvVia.setText(draft.identityEmail); tvVia.setText(draft.identityEmail);
cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only); cbPlainOnly.setChecked(draft.plain_only != null && draft.plain_only && !dsn);
cbReceipt.setChecked(draft.receipt_request != null && draft.receipt_request); cbReceipt.setChecked(draft.receipt_request != null && draft.receipt_request && !dsn);
cbPlainOnly.setVisibility( int encrypt = (draft.ui_encrypt == null || dsn ? EntityMessage.ENCRYPT_NONE : draft.ui_encrypt);
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
? View.GONE : View.VISIBLE);
cbReceipt.setVisibility(
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
? View.GONE : View.VISIBLE);
int encrypt = (draft.ui_encrypt == null ? EntityMessage.ENCRYPT_NONE : draft.ui_encrypt);
for (int i = 0; i < encryptValues.length; i++) for (int i = 0; i < encryptValues.length; i++)
if (encryptValues[i] == encrypt) { if (encryptValues[i] == encrypt) {
spEncrypt.setTag(i); spEncrypt.setTag(i);
spEncrypt.setSelection(i); spEncrypt.setSelection(i);
break; break;
} }
spEncrypt.setVisibility(
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
? View.GONE : View.VISIBLE);
int priority = (draft.priority == null ? 1 : draft.priority); int priority = (draft.priority == null ? 1 : draft.priority);
spPriority.setTag(priority); spPriority.setTag(priority);
@ -5988,6 +5980,8 @@ public class FragmentCompose extends FragmentBase {
tvSendAt.setText(D.format(draft.ui_snoozed) + " " + DTF.format(draft.ui_snoozed)); tvSendAt.setText(D.format(draft.ui_snoozed) + " " + DTF.format(draft.ui_snoozed));
} }
grpDsn.setVisibility(dsn ? View.GONE : View.VISIBLE);
if (!TextUtils.isEmpty(draft.inreplyto)) if (!TextUtils.isEmpty(draft.inreplyto))
if (archive == null) { if (archive == null) {
Bundle args = new Bundle(); Bundle args = new Bundle();

@ -186,7 +186,7 @@
app:layout_constraintTop_toBottomOf="@id/tvVia" /> app:layout_constraintTop_toBottomOf="@id/tvVia" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvRemindPlain" android:id="@+id/tvPlainHint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
@ -204,10 +204,10 @@
android:text="@string/title_send_receipt" android:text="@string/title_send_receipt"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemindPlain" /> app:layout_constraintTop_toBottomOf="@id/tvPlainHint" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvReceiptType" android:id="@+id/tvReceiptHint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/title_send_receipt_remark" android:text="@string/title_send_receipt_remark"
@ -227,7 +227,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toStartOf="@id/ibEncryption" app:layout_constraintEnd_toStartOf="@id/ibEncryption"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReceiptType" /> app:layout_constraintTop_toBottomOf="@id/tvReceiptHint" />
<Spinner <Spinner
android:id="@+id/spEncrypt" android:id="@+id/spEncrypt"
@ -342,5 +342,13 @@
android:textStyle="italic" android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotAgain" /> app:layout_constraintTop_toBottomOf="@id/cbNotAgain" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpDsn"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="
cbPlainOnly,cbReceipt,
tvEncrypt,spEncrypt,ibEncryption" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>
Loading…
Cancel
Save