mirror of https://github.com/M66B/FairEmail.git
Jacuzzi
This commit is contained in:
parent
c179613a5d
commit
ebc4176a00
|
@ -191,6 +191,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
private boolean date;
|
||||
private boolean threading;
|
||||
private boolean bubble;
|
||||
private boolean avatars;
|
||||
private boolean name_email;
|
||||
private boolean distinguish_contacts;
|
||||
private boolean subject_top;
|
||||
|
@ -248,8 +250,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
View.OnTouchListener,
|
||||
View.OnLayoutChangeListener,
|
||||
BottomNavigationView.OnNavigationItemSelectedListener {
|
||||
private ImageView ivAvatarStart;
|
||||
private ViewCardOptional card;
|
||||
private View view;
|
||||
private ImageView ivAvatarEnd;
|
||||
|
||||
private View vwColor;
|
||||
private ImageButton ibExpander;
|
||||
|
@ -364,8 +368,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
|
||||
ivAvatarStart = itemView.findViewById(R.id.ivAvatarStart);
|
||||
card = itemView.findViewById(R.id.card);
|
||||
view = itemView.findViewById(R.id.clItem);
|
||||
ivAvatarEnd = itemView.findViewById(R.id.ivAvatarEnd);
|
||||
|
||||
vwColor = itemView.findViewById(R.id.vwColor);
|
||||
ibExpander = itemView.findViewById(R.id.ibExpander);
|
||||
|
@ -624,6 +630,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void clear() {
|
||||
ivAvatarStart.setVisibility(View.GONE);
|
||||
ivAvatarEnd.setVisibility(View.GONE);
|
||||
vwColor.setVisibility(View.GONE);
|
||||
ibExpander.setVisibility(View.GONE);
|
||||
ibFlagged.setVisibility(View.GONE);
|
||||
|
@ -659,15 +667,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
boolean inbox = EntityFolder.INBOX.equals(message.folderType);
|
||||
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
|
||||
|
||||
boolean outgoing = false;
|
||||
if (viewType != ViewType.THREAD)
|
||||
if (EntityFolder.isOutgoing(message.folderType))
|
||||
outgoing = true;
|
||||
else if (!EntityFolder.ARCHIVE.equals(message.folderType) &&
|
||||
message.identityEmail != null &&
|
||||
message.from != null && message.from.length == 1 &&
|
||||
message.identityEmail.equals(((InternetAddress) message.from[0]).getAddress()))
|
||||
outgoing = true;
|
||||
boolean outgoing = isOutgoing(message);
|
||||
if (viewType == ViewType.THREAD) {
|
||||
ivAvatarStart.setVisibility(outgoing && bubble ? View.INVISIBLE : View.GONE);
|
||||
ivAvatarEnd.setVisibility(outgoing || !bubble ? View.GONE : View.INVISIBLE);
|
||||
ivAvatar.setVisibility(bubble || !avatars ? View.GONE : View.INVISIBLE);
|
||||
outgoing = false;
|
||||
} else {
|
||||
ivAvatarStart.setVisibility(View.GONE);
|
||||
ivAvatarEnd.setVisibility(View.GONE);
|
||||
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
// Text size
|
||||
if (textSize != 0) {
|
||||
|
@ -861,13 +871,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
aargs.putSerializable("addresses", addresses);
|
||||
|
||||
new SimpleTask<ContactInfo>() {
|
||||
@Override
|
||||
protected void onPreExecute(Bundle args) {
|
||||
//Address[] addresses = (Address[]) args.getSerializable("addresses");
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
//tvFrom.setText(MessageHelper.formatAddresses(addresses, name_email, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContactInfo onExecute(Context context, Bundle args) {
|
||||
long account = args.getLong("account");
|
||||
|
@ -997,15 +1000,30 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void bindContactInfo(ContactInfo info, TupleMessageEx message) {
|
||||
if (bubble && viewType == ViewType.THREAD) {
|
||||
boolean outgoing = isOutgoing(message);
|
||||
if (outgoing) {
|
||||
if (info.hasPhoto())
|
||||
ivAvatarStart.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatarStart.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatarStart.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (info.hasPhoto())
|
||||
ivAvatarEnd.setImageBitmap(info.getPhotoBitmap());
|
||||
else
|
||||
ivAvatarEnd.setImageResource(R.drawable.baseline_person_24);
|
||||
ivAvatarEnd.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (info.hasPhoto()) {
|
||||
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
||||
ivAvatar.setVisibility(View.VISIBLE);
|
||||
} else
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (distinguish_contacts && info.isKnown())
|
||||
tvFrom.setPaintFlags(tvFrom.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
//tvFrom.setText(info.getDisplayName(name_email));
|
||||
}
|
||||
|
||||
private void bindExpanded(final TupleMessageEx message, final boolean scroll) {
|
||||
|
@ -1918,6 +1936,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}.execute(context, owner, args, "message:participation");
|
||||
}
|
||||
|
||||
private boolean isOutgoing(TupleMessageEx message) {
|
||||
if (EntityFolder.isOutgoing(message.folderType))
|
||||
return true;
|
||||
else if ((viewType == ViewType.THREAD || !EntityFolder.ARCHIVE.equals(message.folderType)) &&
|
||||
message.identityEmail != null &&
|
||||
message.from != null && message.from.length == 1 &&
|
||||
message.identityEmail.equals(((InternetAddress) message.from[0]).getAddress()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private TupleMessageEx getMessage() {
|
||||
int pos = getAdapterPosition();
|
||||
if (pos == RecyclerView.NO_POSITION)
|
||||
|
@ -3529,8 +3558,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
this.contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
||||
this.textSize = Helper.getTextSize(context, zoom);
|
||||
|
||||
boolean contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
||||
boolean avatars = prefs.getBoolean("avatars", true);
|
||||
boolean generated = prefs.getBoolean("generated_icons", true);
|
||||
|
||||
this.date = prefs.getBoolean("date", true);
|
||||
this.threading = prefs.getBoolean("threading", true);
|
||||
this.bubble = prefs.getBoolean("bubble", false);
|
||||
this.avatars = (contacts && avatars) || generated;
|
||||
this.name_email = prefs.getBoolean("name_email", false);
|
||||
this.distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
|
||||
this.subject_top = prefs.getBoolean("subject_top", false);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
|
||||
static String[] OPTIONS_RESTART = new String[]{
|
||||
"subscriptions",
|
||||
"startup", "cards", "date", "threading", "highlight_unread",
|
||||
"startup", "cards", "date", "threading", "bubble", "highlight_unread",
|
||||
"avatars", "generated_icons", "identicons", "circular",
|
||||
"name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "subject_italic", "subject_ellipsize",
|
||||
|
|
|
@ -48,6 +48,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swCards;
|
||||
private SwitchCompat swDate;
|
||||
private SwitchCompat swThreading;
|
||||
private SwitchCompat swBubble;
|
||||
private SwitchCompat swHighlightUnread;
|
||||
private SwitchCompat swAvatars;
|
||||
private SwitchCompat swGeneratedIcons;
|
||||
|
@ -75,7 +76,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swActionbar;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"theme", "startup", "cards", "date", "threading", "highlight_unread",
|
||||
"theme", "startup", "cards", "date", "threading", "bubble", "highlight_unread",
|
||||
"avatars", "generated_icons", "identicons", "circular", "name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "subject_italic", "subject_ellipsize",
|
||||
"flags", "flags_background", "preview", "preview_italic", "addresses", "attachments_alt",
|
||||
|
@ -98,6 +99,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swCards = view.findViewById(R.id.swCards);
|
||||
swDate = view.findViewById(R.id.swDate);
|
||||
swThreading = view.findViewById(R.id.swThreading);
|
||||
swBubble = view.findViewById(R.id.swBubble);
|
||||
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
||||
swAvatars = view.findViewById(R.id.swAvatars);
|
||||
swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons);
|
||||
|
@ -171,6 +173,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
swBubble.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("bubble", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swHighlightUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -410,6 +419,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swCards.setChecked(prefs.getBoolean("cards", true));
|
||||
swDate.setChecked(prefs.getBoolean("date", true));
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
swBubble.setChecked(prefs.getBoolean("bubble", false));
|
||||
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false));
|
||||
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
||||
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));
|
||||
|
|
|
@ -23,7 +23,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -58,7 +58,7 @@ public class ViewCardOptional extends CardView {
|
|||
if (cards) {
|
||||
int dp = Helper.dp2pixels(getContext(), compact ? 3 : 6);
|
||||
|
||||
FrameLayout.LayoutParams lparam = (FrameLayout.LayoutParams) getLayoutParams();
|
||||
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
lparam.setMargins(dp, dp, dp, dp);
|
||||
setLayoutParams(lparam);
|
||||
|
||||
|
|
|
@ -116,6 +116,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swThreading" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swBubble"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_bubble"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swHighlightUnread"
|
||||
android:layout_width="0dp"
|
||||
|
@ -125,7 +137,7 @@
|
|||
android:text="@string/title_advanced_highlight_unread"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swBubble"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAvatarStart"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:contentDescription="@string/title_legend_avatar"
|
||||
android:padding="6dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/baseline_person_24" />
|
||||
|
||||
<eu.faircode.email.ViewCardOptional
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:attr/selectableItemBackground">
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivAvatarEnd"
|
||||
app:layout_constraintStart_toEndOf="@id/ivAvatarStart"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clItem"
|
||||
|
@ -37,4 +52,16 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/inHeader" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ViewCardOptional>
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAvatarEnd"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:contentDescription="@string/title_legend_avatar"
|
||||
android:padding="6dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/baseline_person_24" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAvatarStart"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:contentDescription="@string/title_legend_avatar"
|
||||
android:padding="6dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/baseline_person_24" />
|
||||
|
||||
<eu.faircode.email.ViewCardOptional
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:attr/selectableItemBackground">
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivAvatarEnd"
|
||||
app:layout_constraintStart_toEndOf="@id/ivAvatarStart"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clItem"
|
||||
|
@ -38,4 +53,16 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/inHeader" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ViewCardOptional>
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAvatarEnd"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:contentDescription="@string/title_legend_avatar"
|
||||
android:padding="6dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/baseline_person_24" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -243,6 +243,7 @@
|
|||
<string name="title_advanced_cards">Show cards</string>
|
||||
<string name="title_advanced_date_header">Group by date</string>
|
||||
<string name="title_advanced_threading">Conversation threading</string>
|
||||
<string name="title_advanced_bubble">Show conversations in messaging style</string>
|
||||
<string name="title_advanced_highlight_unread">Highlight unread messages</string>
|
||||
<string name="title_advanced_distinguish_contacts">Distinguish messages from known and unknown contacts</string>
|
||||
<string name="title_advanced_avatars">Show contact photos</string>
|
||||
|
|
Loading…
Reference in New Issue