mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Added show quotes button
This commit is contained in:
parent
3512920bbc
commit
d9052eaaae
2 changed files with 35 additions and 6 deletions
|
@ -266,13 +266,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
private RecyclerView rvAttachment;
|
private RecyclerView rvAttachment;
|
||||||
private CheckBox cbInline;
|
private CheckBox cbInline;
|
||||||
private ImageButton ibDecrypt;
|
|
||||||
private Button btnDownloadAttachments;
|
private Button btnDownloadAttachments;
|
||||||
private Button btnSaveAttachments;
|
private Button btnSaveAttachments;
|
||||||
private TextView tvNoInternetAttachments;
|
private TextView tvNoInternetAttachments;
|
||||||
|
|
||||||
private BottomNavigationView bnvActions;
|
private BottomNavigationView bnvActions;
|
||||||
|
|
||||||
|
private ImageButton ibDecrypt;
|
||||||
|
private ImageButton ibQuotes;
|
||||||
private ImageButton ibImages;
|
private ImageButton ibImages;
|
||||||
private ImageButton ibFull;
|
private ImageButton ibFull;
|
||||||
private TextView tvBody;
|
private TextView tvBody;
|
||||||
|
@ -409,6 +410,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
ibDecrypt = vsBody.findViewById(R.id.ibDecrypt);
|
ibDecrypt = vsBody.findViewById(R.id.ibDecrypt);
|
||||||
|
ibQuotes = vsBody.findViewById(R.id.ibQuotes);
|
||||||
ibImages = vsBody.findViewById(R.id.ibImages);
|
ibImages = vsBody.findViewById(R.id.ibImages);
|
||||||
ibFull = vsBody.findViewById(R.id.ibFull);
|
ibFull = vsBody.findViewById(R.id.ibFull);
|
||||||
tvBody = vsBody.findViewById(R.id.tvBody);
|
tvBody = vsBody.findViewById(R.id.tvBody);
|
||||||
|
@ -469,6 +471,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibAddContact.setOnClickListener(this);
|
ibAddContact.setOnClickListener(this);
|
||||||
|
|
||||||
ibDecrypt.setOnClickListener(this);
|
ibDecrypt.setOnClickListener(this);
|
||||||
|
ibQuotes.setOnClickListener(this);
|
||||||
btnDownloadAttachments.setOnClickListener(this);
|
btnDownloadAttachments.setOnClickListener(this);
|
||||||
btnSaveAttachments.setOnClickListener(this);
|
btnSaveAttachments.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -502,6 +505,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibAddContact.setOnClickListener(null);
|
ibAddContact.setOnClickListener(null);
|
||||||
|
|
||||||
ibDecrypt.setOnClickListener(null);
|
ibDecrypt.setOnClickListener(null);
|
||||||
|
ibQuotes.setOnClickListener(null);
|
||||||
btnDownloadAttachments.setOnClickListener(null);
|
btnDownloadAttachments.setOnClickListener(null);
|
||||||
btnSaveAttachments.setOnClickListener(null);
|
btnSaveAttachments.setOnClickListener(null);
|
||||||
|
|
||||||
|
@ -834,13 +838,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
pbCalendarWait.setVisibility(View.GONE);
|
pbCalendarWait.setVisibility(View.GONE);
|
||||||
|
|
||||||
cbInline.setVisibility(View.GONE);
|
cbInline.setVisibility(View.GONE);
|
||||||
ibDecrypt.setVisibility(View.GONE);
|
|
||||||
btnDownloadAttachments.setVisibility(View.GONE);
|
btnDownloadAttachments.setVisibility(View.GONE);
|
||||||
btnSaveAttachments.setVisibility(View.GONE);
|
btnSaveAttachments.setVisibility(View.GONE);
|
||||||
tvNoInternetAttachments.setVisibility(View.GONE);
|
tvNoInternetAttachments.setVisibility(View.GONE);
|
||||||
|
|
||||||
bnvActions.setVisibility(View.GONE);
|
bnvActions.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
ibDecrypt.setVisibility(View.GONE);
|
||||||
|
ibQuotes.setVisibility(View.GONE);
|
||||||
ibImages.setVisibility(View.GONE);
|
ibImages.setVisibility(View.GONE);
|
||||||
ibFull.setVisibility(View.GONE);
|
ibFull.setVisibility(View.GONE);
|
||||||
tvBody.setVisibility(View.GONE);
|
tvBody.setVisibility(View.GONE);
|
||||||
|
@ -1386,9 +1391,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
if (message == null)
|
if (message == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (view.getId() == R.id.ibDecrypt)
|
if (view.getId() == R.id.ivSnoozed)
|
||||||
onMenuDecrypt(message);
|
|
||||||
else if (view.getId() == R.id.ivSnoozed)
|
|
||||||
onShowSnoozed(message);
|
onShowSnoozed(message);
|
||||||
else if (view.getId() == R.id.ivFlagged)
|
else if (view.getId() == R.id.ivFlagged)
|
||||||
onToggleFlag(message);
|
onToggleFlag(message);
|
||||||
|
@ -1409,6 +1412,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
case R.id.btnSaveAttachments:
|
case R.id.btnSaveAttachments:
|
||||||
onSaveAttachments(message);
|
onSaveAttachments(message);
|
||||||
break;
|
break;
|
||||||
|
case R.id.ibDecrypt:
|
||||||
|
onMenuDecrypt(message);
|
||||||
|
break;
|
||||||
|
case R.id.ibQuotes:
|
||||||
|
onShowQuotes(message);
|
||||||
|
break;
|
||||||
case R.id.ibImages:
|
case R.id.ibImages:
|
||||||
onShowImages(message);
|
onShowImages(message);
|
||||||
break;
|
break;
|
||||||
|
@ -1825,6 +1834,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onShowQuotes(TupleMessageEx message) {
|
||||||
|
properties.setValue("quotes", message.id, true);
|
||||||
|
loadText(message);
|
||||||
|
}
|
||||||
|
|
||||||
private void onShowImages(final TupleMessageEx message) {
|
private void onShowImages(final TupleMessageEx message) {
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (prefs.getBoolean("show_images_confirmed", false)) {
|
if (prefs.getBoolean("show_images_confirmed", false)) {
|
||||||
|
@ -1913,7 +1927,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putSerializable("message", message);
|
args.putSerializable("message", message);
|
||||||
args.putBoolean("show_images", show_images);
|
args.putBoolean("show_images", show_images);
|
||||||
args.putBoolean("show_quotes", show_quotes);
|
args.putBoolean("show_quotes", show_quotes || !threading);
|
||||||
args.putInt("zoom", zoom);
|
args.putInt("zoom", zoom);
|
||||||
bodyTask.setCount(false).execute(context, owner, args, "message:body");
|
bodyTask.setCount(false).execute(context, owner, args, "message:body");
|
||||||
}
|
}
|
||||||
|
@ -1997,6 +2011,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
builder.getSpanFlags(squote));
|
builder.getSpanFlags(squote));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args.putBoolean("has_quotes", quoteSpans.length > 0);
|
||||||
args.putBoolean("has_images", builder.getSpans(0, body.length(), ImageSpan.class).length > 0);
|
args.putBoolean("has_images", builder.getSpans(0, body.length(), ImageSpan.class).length > 0);
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
|
@ -2015,10 +2030,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
if (!show_expanded)
|
if (!show_expanded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
boolean has_quotes = args.getBoolean("has_quotes");
|
||||||
boolean has_images = args.getBoolean("has_images");
|
boolean has_images = args.getBoolean("has_images");
|
||||||
|
boolean show_quotes = properties.getValue("quotes", message.id);
|
||||||
boolean show_images = properties.getValue("images", message.id);
|
boolean show_images = properties.getValue("images", message.id);
|
||||||
|
|
||||||
ibFull.setVisibility(hasWebView ? View.VISIBLE : View.GONE);
|
ibFull.setVisibility(hasWebView ? View.VISIBLE : View.GONE);
|
||||||
|
ibQuotes.setVisibility(has_quotes && threading && !show_quotes ? View.VISIBLE : View.GONE);
|
||||||
ibImages.setVisibility(has_images && !show_images ? View.VISIBLE : View.GONE);
|
ibImages.setVisibility(has_images && !show_images ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
tvBody.setText(body);
|
tvBody.setText(body);
|
||||||
|
|
|
@ -26,6 +26,17 @@
|
||||||
android:layout_marginEnd="6dp"
|
android:layout_marginEnd="6dp"
|
||||||
android:contentDescription="@string/title_decrypt"
|
android:contentDescription="@string/title_decrypt"
|
||||||
android:src="@drawable/baseline_no_encryption_24"
|
android:src="@drawable/baseline_no_encryption_24"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/ibQuotes"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/bnvActions" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/ibQuotes"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:contentDescription="@string/title_legend_show_quotes"
|
||||||
|
android:src="@drawable/baseline_format_quote_24"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/ibImages"
|
app:layout_constraintEnd_toStartOf="@+id/ibImages"
|
||||||
app:layout_constraintTop_toBottomOf="@id/bnvActions" />
|
app:layout_constraintTop_toBottomOf="@id/bnvActions" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue