Added navigate to folder from message

pull/205/head
M66B 3 years ago
parent 05a90177d9
commit bedaceabb5

@ -237,6 +237,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private int colorWarning;
private int colorError;
private int colorControlNormal;
private int selectableItemBackground;
private boolean hasWebView;
private boolean pin;
@ -872,8 +873,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPriority.setOnClickListener(this);
ibSnoozed.setOnClickListener(this);
ibFlagged.setOnClickListener(this);
if (viewType == ViewType.THREAD)
if (viewType == ViewType.THREAD) {
ibFlagged.setOnLongClickListener(this);
tvFolder.setOnClickListener(this);
if (selectableItemBackground != 0)
tvFolder.setBackgroundResource(selectableItemBackground);
}
ibHelp.setOnClickListener(this);
if (vsBody != null) {
@ -965,8 +970,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPriority.setOnClickListener(null);
ibSnoozed.setOnClickListener(null);
ibFlagged.setOnClickListener(null);
if (viewType == ViewType.THREAD)
if (viewType == ViewType.THREAD) {
ibFlagged.setOnLongClickListener(null);
tvFolder.setOnClickListener(null);
}
ibHelp.setOnClickListener(null);
if (vsBody != null) {
@ -3293,6 +3300,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onShowSnoozed(message);
else if (view.getId() == R.id.ibFlagged)
onToggleFlag(message);
else if (view.getId() == R.id.tvFolder)
onGotoFolder(message);
else if (view.getId() == R.id.ibHelp)
onHelp(message);
else if (view.getId() == R.id.ibReceipt)
@ -3756,6 +3765,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}.execute(context, owner, args, "message:flag");
}
private void onGotoFolder(TupleMessageEx message) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
if (EntityFolder.OUTBOX.equals(message.folderType))
lbm.sendBroadcast(new Intent(ActivityView.ACTION_VIEW_OUTBOX));
else
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("account", message.account)
.putExtra("folder", message.folder)
.putExtra("type", message.folderType));
}
private void onHelp(TupleMessageEx message) {
Helper.viewFAQ(context, 130);
}
@ -5776,6 +5797,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
this.colorControlNormal = Helper.resolveColor(context, R.attr.colorControlNormal);
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, tv, true);
this.selectableItemBackground = tv.resourceId;
this.hasWebView = Helper.hasWebView(context);
this.pin = ShortcutManagerCompat.isRequestPinShortcutSupported(context);
this.contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);

@ -314,7 +314,7 @@
<eu.faircode.email.FixedTextView
android:id="@+id/tvFolder"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
@ -323,7 +323,9 @@
android:singleLine="true"
android:text="Folder"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/ibFlagged"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@id/ibAvatar"
app:layout_constraintTop_toBottomOf="@id/tvKeywords" />

@ -286,7 +286,7 @@
<eu.faircode.email.FixedTextView
android:id="@+id/tvFolder"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
@ -295,7 +295,9 @@
android:minHeight="21dp"
android:text="folder"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/tvCount"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toBottomOf="@id/tvKeywords" />

Loading…
Cancel
Save