Added option to display attachments after the message text

pull/156/head
M66B 6 years ago
parent 02cba3b9f9
commit 3fb60e0d65

@ -151,6 +151,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean subject_italic; private boolean subject_italic;
private boolean flags; private boolean flags;
private boolean preview; private boolean preview;
private boolean attachments_alt;
private boolean monospaced; private boolean monospaced;
private boolean autohtml; private boolean autohtml;
private boolean autoimages; private boolean autoimages;
@ -269,6 +270,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
super(itemView); super(itemView);
view = itemView.findViewById(R.id.clItem); view = itemView.findViewById(R.id.clItem);
vwColor = itemView.findViewById(R.id.vwColor); vwColor = itemView.findViewById(R.id.vwColor);
vwStatus = itemView.findViewById(R.id.vwStatus); vwStatus = itemView.findViewById(R.id.vwStatus);
ivExpander = itemView.findViewById(R.id.ivExpander); ivExpander = itemView.findViewById(R.id.ivExpander);
@ -293,6 +295,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
pbLoading = itemView.findViewById(R.id.pbLoading); pbLoading = itemView.findViewById(R.id.pbLoading);
vwRipple = itemView.findViewById(R.id.vwRipple); vwRipple = itemView.findViewById(R.id.vwRipple);
ConstraintLayout inAttachments = itemView.findViewById(R.id.inAttachments);
ConstraintLayout inAttachmentsAlt = itemView.findViewById(R.id.inAttachmentsAlt);
inAttachments.setVisibility(attachments_alt ? View.GONE : View.VISIBLE);
inAttachmentsAlt.setVisibility(attachments_alt ? View.VISIBLE : View.GONE);
ConstraintLayout attachments = (attachments_alt ? inAttachmentsAlt : inAttachments);
ivExpanderAddress = itemView.findViewById(R.id.ivExpanderAddress); ivExpanderAddress = itemView.findViewById(R.id.ivExpanderAddress);
ibSearchContact = itemView.findViewById(R.id.ibSearchContact); ibSearchContact = itemView.findViewById(R.id.ibSearchContact);
@ -325,7 +333,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
pbHeaders = itemView.findViewById(R.id.pbHeaders); pbHeaders = itemView.findViewById(R.id.pbHeaders);
tvNoInternetHeaders = itemView.findViewById(R.id.tvNoInternetHeaders); tvNoInternetHeaders = itemView.findViewById(R.id.tvNoInternetHeaders);
rvAttachment = itemView.findViewById(R.id.rvAttachment); rvAttachment = attachments.findViewById(R.id.rvAttachment);
rvAttachment.setHasFixedSize(false); rvAttachment.setHasFixedSize(false);
LinearLayoutManager llm = new LinearLayoutManager(context); LinearLayoutManager llm = new LinearLayoutManager(context);
rvAttachment.setLayoutManager(llm); rvAttachment.setLayoutManager(llm);
@ -334,10 +342,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
adapterAttachment = new AdapterAttachment(context, owner, true); adapterAttachment = new AdapterAttachment(context, owner, true);
rvAttachment.setAdapter(adapterAttachment); rvAttachment.setAdapter(adapterAttachment);
cbInline = itemView.findViewById(R.id.cbInline); cbInline = attachments.findViewById(R.id.cbInline);
btnDownloadAttachments = itemView.findViewById(R.id.btnDownloadAttachments); btnDownloadAttachments = attachments.findViewById(R.id.btnDownloadAttachments);
btnSaveAttachments = itemView.findViewById(R.id.btnSaveAttachments); btnSaveAttachments = attachments.findViewById(R.id.btnSaveAttachments);
tvNoInternetAttachments = itemView.findViewById(R.id.tvNoInternetAttachments); tvNoInternetAttachments = attachments.findViewById(R.id.tvNoInternetAttachments);
bnvActions = itemView.findViewById(R.id.bnvActions); bnvActions = itemView.findViewById(R.id.bnvActions);
@ -359,7 +367,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
grpAddresses = itemView.findViewById(R.id.grpAddresses); grpAddresses = itemView.findViewById(R.id.grpAddresses);
grpHeaders = itemView.findViewById(R.id.grpHeaders); grpHeaders = itemView.findViewById(R.id.grpHeaders);
grpAttachments = itemView.findViewById(R.id.grpAttachments); grpAttachments = attachments.findViewById(R.id.grpAttachments);
grpImages = itemView.findViewById(R.id.grpImages); grpImages = itemView.findViewById(R.id.grpImages);
} }
@ -3084,6 +3092,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.subject_italic = prefs.getBoolean("subject_italic", true); this.subject_italic = prefs.getBoolean("subject_italic", true);
this.flags = prefs.getBoolean("flags", true); this.flags = prefs.getBoolean("flags", true);
this.preview = prefs.getBoolean("preview", false); this.preview = prefs.getBoolean("preview", false);
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.monospaced = prefs.getBoolean("monospaced", false); this.monospaced = prefs.getBoolean("monospaced", false);
this.autohtml = (this.hasWebView && this.contacts && prefs.getBoolean("autohtml", false)); this.autohtml = (this.hasWebView && this.contacts && prefs.getBoolean("autohtml", false));
this.autoimages = (this.contacts && prefs.getBoolean("autoimages", false)); this.autoimages = (this.contacts && prefs.getBoolean("autoimages", false));

@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{ static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic", "flags", "preview", "startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
"addresses", "monospaced", "autohtml", "autoimages", "actionbar", "addresses", "attachments_alt", "monospaced", "autohtml", "autoimages", "actionbar",
"pull", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext", "pull", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
"subscriptions", "subscriptions",
"authentication", "debug" "authentication", "debug"

@ -48,6 +48,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swFlags; private SwitchCompat swFlags;
private SwitchCompat swPreview; private SwitchCompat swPreview;
private SwitchCompat swAddresses; private SwitchCompat swAddresses;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swMonospaced; private SwitchCompat swMonospaced;
private SwitchCompat swHtml; private SwitchCompat swHtml;
private SwitchCompat swImages; private SwitchCompat swImages;
@ -55,7 +56,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic", "startup", "date", "threading", "avatars", "identicons", "circular", "name_email", "subject_italic",
"flags", "preview", "addresses", "monospaced", "autohtml", "autoimages", "actionbar", "flags", "preview", "addresses", "attachments_alt", "monospaced", "autohtml", "autoimages", "actionbar",
}; };
@Override @Override
@ -79,6 +80,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swFlags = view.findViewById(R.id.swFlags); swFlags = view.findViewById(R.id.swFlags);
swPreview = view.findViewById(R.id.swPreview); swPreview = view.findViewById(R.id.swPreview);
swAddresses = view.findViewById(R.id.swAddresses); swAddresses = view.findViewById(R.id.swAddresses);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swMonospaced = view.findViewById(R.id.swMonospaced); swMonospaced = view.findViewById(R.id.swMonospaced);
swHtml = view.findViewById(R.id.swHtml); swHtml = view.findViewById(R.id.swHtml);
swImages = view.findViewById(R.id.swImages); swImages = view.findViewById(R.id.swImages);
@ -176,6 +178,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
} }
}); });
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("attachments_alt", checked).apply();
}
});
swMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -268,6 +277,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swFlags.setChecked(prefs.getBoolean("flags", true)); swFlags.setChecked(prefs.getBoolean("flags", true));
swPreview.setChecked(prefs.getBoolean("preview", false)); swPreview.setChecked(prefs.getBoolean("preview", false));
swAddresses.setChecked(prefs.getBoolean("addresses", false)); swAddresses.setChecked(prefs.getBoolean("addresses", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swMonospaced.setChecked(prefs.getBoolean("monospaced", false)); swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swHtml.setChecked(prefs.getBoolean("autohtml", false)); swHtml.setChecked(prefs.getBoolean("autohtml", false));
swImages.setChecked(prefs.getBoolean("autoimages", false)); swImages.setChecked(prefs.getBoolean("autoimages", false));

@ -186,6 +186,16 @@
app:layout_constraintTop_toBottomOf="@id/tvPreviewHint" app:layout_constraintTop_toBottomOf="@id/tvPreviewHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAttachmentsAlt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_attachments_alt"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swMonospaced" android:id="@+id/swMonospaced"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -193,7 +203,7 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_advanced_monospaced" android:text="@string/title_advanced_monospaced"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses" app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -350,12 +350,20 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inMessage" /> app:layout_constraintTop_toBottomOf="@id/inMessage" />
<include
android:id="@+id/inAttachmentsAlt"
layout="@layout/include_message_attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vwBody" />
<include <include
android:id="@+id/inImages" android:id="@+id/inImages"
layout="@layout/include_message_images" layout="@layout/include_message_images"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vwBody" /> app:layout_constraintTop_toBottomOf="@id/inAttachmentsAlt" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>

@ -343,12 +343,20 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inMessage" /> app:layout_constraintTop_toBottomOf="@id/inMessage" />
<include
android:id="@+id/inAttachmentsAlt"
layout="@layout/include_message_attachments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vwBody" />
<include <include
android:id="@+id/inImages" android:id="@+id/inImages"
layout="@layout/include_message_images" layout="@layout/include_message_images"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vwBody" /> app:layout_constraintTop_toBottomOf="@id/inAttachmentsAlt" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>

@ -191,6 +191,7 @@
<string name="title_advanced_flags">Show stars</string> <string name="title_advanced_flags">Show stars</string>
<string name="title_advanced_preview">Show message preview</string> <string name="title_advanced_preview">Show message preview</string>
<string name="title_advanced_addresses">Show address details by default</string> <string name="title_advanced_addresses">Show address details by default</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
<string name="title_advanced_monospaced">Use monospaced font for message text</string> <string name="title_advanced_monospaced">Use monospaced font for message text</string>
<string name="title_advanced_html">Automatically show original message for known contacts</string> <string name="title_advanced_html">Automatically show original message for known contacts</string>
<string name="title_advanced_images">Automatically show images for known contacts</string> <string name="title_advanced_images">Automatically show images for known contacts</string>

Loading…
Cancel
Save