Check for empty subjects, crowdin sync

This commit is contained in:
M66B 2019-09-11 20:37:31 +02:00
parent bcf9cd7eb5
commit 0157973d16
5 changed files with 30 additions and 10 deletions

View File

@ -2750,6 +2750,15 @@ public class FragmentCompose extends FragmentBase {
if (draft.to == null && draft.cc == null && draft.bcc == null)
throw new IllegalArgumentException(context.getString(R.string.title_to_missing));
if (identity.plain_only)
db.message().setMessagePlainOnly(draft.id, true);
if (identity.encrypt)
db.message().setMessageEncrypt(draft.id, true);
if (TextUtils.isEmpty(draft.subject))
args.putBoolean("remind_subject", true);
int attached = 0;
for (EntityAttachment attachment : attachments)
if (!attachment.available)
@ -2757,12 +2766,6 @@ public class FragmentCompose extends FragmentBase {
else if (!attachment.isInline() && attachment.encryption == null)
attached++;
if (identity.plain_only)
db.message().setMessagePlainOnly(draft.id, true);
if (identity.encrypt)
db.message().setMessageEncrypt(draft.id, true);
// Check for missing attachments
if (attached == 0) {
List<String> keywords = new ArrayList<>();
@ -2785,7 +2788,7 @@ public class FragmentCompose extends FragmentBase {
String plain = HtmlHelper.getText(body);
for (String keyword : keywords)
if (plain.matches("(?si).*\\b" + Pattern.quote(keyword.trim()) + "\\b.*")) {
args.putBoolean("remind", true);
args.putBoolean("remind_attachment", true);
break;
}
}
@ -3550,7 +3553,8 @@ public class FragmentCompose extends FragmentBase {
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
long id = getArguments().getLong("id");
boolean remind = getArguments().getBoolean("remind", false);
boolean remind_subject = getArguments().getBoolean("remind_subject", false);
boolean remind_attachment = getArguments().getBoolean("remind_attachment", false);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
int send_delayed = prefs.getInt("send_delayed", 0);
@ -3565,12 +3569,14 @@ public class FragmentCompose extends FragmentBase {
final CheckBox cbEncrypt = dview.findViewById(R.id.cbEncrypt);
final TextView tvSendAt = dview.findViewById(R.id.tvSendAt);
final ImageButton ibSendAt = dview.findViewById(R.id.ibSendAt);
final TextView tvRemindSubject = dview.findViewById(R.id.tvRemindSubject);
final TextView tvRemindAttachment = dview.findViewById(R.id.tvRemindAttachment);
tvTo.setText(null);
tvVia.setText(null);
tvSendAt.setText(null);
tvRemindAttachment.setVisibility(remind ? View.VISIBLE : View.GONE);
tvRemindSubject.setVisibility(remind_subject ? View.VISIBLE : View.GONE);
tvRemindAttachment.setVisibility(remind_attachment ? View.VISIBLE : View.GONE);
DB db = DB.getInstance(getContext());
db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer<TupleMessageEx>() {

View File

@ -120,6 +120,17 @@
app:layout_constraintBottom_toBottomOf="@id/tvSendAt"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/tvRemindSubject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_subject_reminder"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibSendAt" />
<TextView
android:id="@+id/tvRemindAttachment"
android:layout_width="wrap_content"
@ -129,6 +140,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibSendAt" />
app:layout_constraintTop_toBottomOf="@id/tvRemindSubject" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -507,6 +507,7 @@
<string name="title_send_plain_text">Alleen platte tekst</string>
<string name="title_from_missing">Zender ontbreekt</string>
<string name="title_to_missing">Ontvanger ontbreekt</string>
<string name="title_subject_reminder">Onderwerp is leeg</string>
<string name="title_attachment_keywords">bijlage, bijlagen</string>
<string name="title_attachment_reminder">Was u van plan een bijlage toe te voegen?</string>
<string name="title_attachments_missing">Niet alle bijlagen zijn gedownload</string>

View File

@ -693,6 +693,7 @@
<string name="title_no_body">Ingen meddelandetext hittades</string>
<string name="title_no_charset">Kodningen stöds inte: %1$s</string>
<string name="title_via">Via: %1$s</string>
<string name="title_reset">Återställ</string>
<string name="title_icalendar_accept">Godkänn</string>
<string name="title_icalendar_decline">Avfärda</string>
<string name="title_icalendar_maybe">Kanske</string>

View File

@ -578,6 +578,7 @@
<string name="title_from_missing">Sender missing</string>
<string name="title_to_missing">Recipient missing</string>
<string name="title_subject_reminder">Subject is empty</string>
<string name="title_attachment_keywords">attached,attachment,attachments,included</string>
<string name="title_attachment_reminder">Did you intend to add an attachment?</string>
<string name="title_attachments_missing">Not all attachments are downloaded</string>