Added optional HTML button

pull/214/head
M66B 1 year ago
parent 5cb437564b
commit ce6a772a46

@ -467,6 +467,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibRule;
private ImageButton ibUnsubscribe;
private ImageButton ibRaw;
private ImageButton ibHtml;
private ImageButton ibHeaders;
private ImageButton ibPrint;
private ImageButton ibPin;
@ -900,6 +901,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule = vsBody.findViewById(R.id.ibRule);
ibUnsubscribe = vsBody.findViewById(R.id.ibUnsubscribe);
ibRaw = vsBody.findViewById(R.id.ibRaw);
ibHtml = vsBody.findViewById(R.id.ibHtml);
ibHeaders = vsBody.findViewById(R.id.ibHeaders);
ibPrint = vsBody.findViewById(R.id.ibPrint);
ibPin = vsBody.findViewById(R.id.ibPin);
@ -1069,6 +1071,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule.setOnClickListener(this);
ibUnsubscribe.setOnClickListener(this);
ibRaw.setOnClickListener(this);
ibHtml.setOnClickListener(this);
ibHeaders.setOnClickListener(this);
ibHeaders.setOnLongClickListener(this);
ibPrint.setOnClickListener(this);
@ -1190,6 +1193,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule.setOnClickListener(null);
ibUnsubscribe.setOnClickListener(null);
ibRaw.setOnClickListener(null);
ibHtml.setOnClickListener(null);
ibHeaders.setOnClickListener(null);
ibHeaders.setOnLongClickListener(null);
ibPrint.setOnClickListener(null);
@ -1802,6 +1806,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule.setVisibility(View.GONE);
ibUnsubscribe.setVisibility(View.GONE);
ibRaw.setVisibility(View.GONE);
ibHtml.setVisibility(View.GONE);
ibHeaders.setVisibility(View.GONE);
ibPrint.setVisibility(View.GONE);
ibPin.setVisibility(View.GONE);
@ -2094,6 +2099,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule.setVisibility(View.GONE);
ibUnsubscribe.setVisibility(View.GONE);
ibRaw.setVisibility(View.GONE);
ibHtml.setVisibility(View.GONE);
ibHeaders.setVisibility(View.GONE);
ibPrint.setVisibility(View.GONE);
ibPin.setVisibility(View.GONE);
@ -2317,6 +2323,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_pin = prefs.getBoolean("button_pin", false);
boolean button_print = prefs.getBoolean("button_print", false);
boolean button_headers = prefs.getBoolean("button_headers", false);
boolean button_html = prefs.getBoolean("button_html", false);
boolean button_raw = prefs.getBoolean("button_raw", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false);
@ -2338,6 +2345,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibRule.setVisibility(tools && button_rule && !outbox && !message.folderReadOnly ? View.VISIBLE : View.GONE);
ibUnsubscribe.setVisibility(tools && button_unsubscribe && message.unsubscribe != null ? View.VISIBLE : View.GONE);
ibRaw.setVisibility(tools && button_raw && raw ? View.VISIBLE : View.GONE);
ibHtml.setVisibility(tools && button_html && message.content ? View.VISIBLE : View.GONE);
ibHeaders.setVisibility(tools && button_headers && headers ? View.VISIBLE : View.GONE);
ibPrint.setVisibility(tools && !outbox && button_print && hasWebView && message.content && Helper.canPrint(context) ? View.VISIBLE : View.GONE);
ibPin.setVisibility(tools && !outbox && button_pin && pin ? View.VISIBLE : View.GONE);
@ -4418,6 +4426,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onActionUnsubscribe(message);
} else if (id == R.id.ibRaw) {
onMenuRawSave(message);
} else if (id == R.id.ibHtml) {
onMenuShareHtml(message);
} else if (id == R.id.ibHeaders) {
onMenuShowHeaders(message);
} else if (id == R.id.ibPrint) {

@ -63,6 +63,7 @@ public class FragmentDialogButtons extends FragmentDialogBase {
final CheckBox cbPin = dview.findViewById(R.id.cbPin);
final CheckBox cbPrint = dview.findViewById(R.id.cbPrint);
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
final CheckBox cbHtml = dview.findViewById(R.id.cbHtml);
final CheckBox cbRaw = dview.findViewById(R.id.cbRaw);
final CheckBox cbUnsubscribe = dview.findViewById(R.id.cbUnsubscribe);
@ -90,6 +91,7 @@ public class FragmentDialogButtons extends FragmentDialogBase {
cbPin.setChecked(prefs.getBoolean("button_pin", false));
cbPrint.setChecked(prefs.getBoolean("button_print", false));
cbHeaders.setChecked(prefs.getBoolean("button_headers", false));
cbHtml.setChecked(prefs.getBoolean("button_html", false));
cbRaw.setChecked(prefs.getBoolean("button_raw", false));
cbUnsubscribe.setChecked(prefs.getBoolean("button_unsubscribe", true));
@ -120,6 +122,7 @@ public class FragmentDialogButtons extends FragmentDialogBase {
editor.putBoolean("button_pin", cbPin.isChecked());
editor.putBoolean("button_print", cbPrint.isChecked());
editor.putBoolean("button_headers", cbHeaders.isChecked());
editor.putBoolean("button_html", cbHtml.isChecked());
editor.putBoolean("button_raw", cbRaw.isChecked());
editor.putBoolean("button_unsubscribe", cbUnsubscribe.isChecked());
editor.apply();

@ -291,6 +291,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPrint" />
<CheckBox
android:id="@+id/cbHtml"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_html_24"
android:drawablePadding="6dp"
android:text="@string/title_show_html"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
<CheckBox
android:id="@+id/cbRaw"
android:layout_width="0dp"
@ -302,7 +315,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
app:layout_constraintTop_toBottomOf="@id/cbHtml" />
<CheckBox
android:id="@+id/cbUnsubscribe"

@ -50,7 +50,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
app:constraint_referenced_ids="vwEmpty,ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibNotes,ibSeen,ibHide,ibImportance,ibTranslate,ibFullScreen,ibForceLight,ibSearch,ibSearchText,ibEvent,ibShare,ibPin,ibPrint,ibHeaders,ibRaw,ibUnsubscribe,ibRule,ibAnswer,ibUndo"
app:constraint_referenced_ids="vwEmpty,ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibNotes,ibSeen,ibHide,ibImportance,ibTranslate,ibFullScreen,ibForceLight,ibSearch,ibSearchText,ibEvent,ibShare,ibPin,ibPrint,ibHeaders,ibHtml,ibRaw,ibUnsubscribe,ibRule,ibAnswer,ibUndo"
app:flow_horizontalBias="0"
app:flow_horizontalGap="3dp"
app:flow_horizontalStyle="packed"
@ -347,6 +347,18 @@
app:srcCompat="@drawable/twotone_code_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibHtml"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_show_html"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_show_html"
app:srcCompat="@drawable/twotone_html_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibRaw"
android:layout_width="36dp"

Loading…
Cancel
Save