Added option for large message action buttons

pull/209/head
M66B 2 years ago
parent 390d133cec
commit 85719aaa7c

@ -171,6 +171,7 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@ -283,6 +284,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean preview;
private boolean preview_italic;
private int preview_lines;
private boolean large_buttons;
private int message_zoom;
private boolean attachments_alt;
private boolean thumbnails;
@ -465,8 +467,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibJunk;
private ImageButton ibInbox;
private ImageButton ibMore;
private ImageButton ibTools;
private View vwEmpty;
private Flow ibFlow;
private ImageButton ibTools;
private Flow buttons;
private TextView tvReformatted;
private TextView tvDecrypt;
@ -884,9 +887,32 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk = vsBody.findViewById(R.id.ibJunk);
ibInbox = vsBody.findViewById(R.id.ibInbox);
ibMore = vsBody.findViewById(R.id.ibMore);
ibTools = vsBody.findViewById(R.id.ibTools);
vwEmpty = vsBody.findViewById(R.id.vwEmpty);
ibFlow = vsBody.findViewById(R.id.ibFlow);
if (large_buttons) {
int dp36 = Helper.dp2pixels(context, 48);
ConstraintLayout cl = (ConstraintLayout) ibFlow.getParent();
List<Integer> ids = new ArrayList<>();
for (int id : ibFlow.getReferencedIds())
ids.add(id);
for (int id : new int[]{
R.id.ibTools, R.id.vwEmpty,
R.id.ibFull, R.id.ibImages, R.id.ibAmp,
R.id.ibDecrypt, R.id.ibVerify})
ids.add(id);
for (int id : ids) {
View v = cl.findViewById(id);
ViewGroup.LayoutParams lparam = v.getLayoutParams();
lparam.width = dp36;
lparam.height = dp36;
}
}
ibTools = vsBody.findViewById(R.id.ibTools);
buttons = vsBody.findViewById(R.id.buttons);
tvReformatted = vsBody.findViewById(R.id.tvReformatted);
tvDecrypt = vsBody.findViewById(R.id.tvDecrypt);
tvSignedData = vsBody.findViewById(R.id.tvSignedData);
@ -1709,8 +1735,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk.setVisibility(View.GONE);
ibInbox.setVisibility(View.GONE);
ibMore.setVisibility(View.GONE);
ibTools.setVisibility(View.GONE);
vwEmpty.setVisibility(View.GONE);
ibTools.setVisibility(View.GONE);
clearButtons();
tvReformatted.setVisibility(View.GONE);
tvDecrypt.setVisibility(View.GONE);
@ -1990,8 +2016,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk.setVisibility(View.GONE);
ibInbox.setVisibility(View.GONE);
ibMore.setVisibility(View.GONE);
ibTools.setVisibility(View.GONE);
vwEmpty.setVisibility(View.GONE);
ibTools.setVisibility(View.GONE);
clearButtons();
tvReformatted.setVisibility(View.GONE);
tvDecrypt.setVisibility(View.GONE);
@ -2233,12 +2259,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibJunk.setVisibility(tools && button_junk && report ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(tools && inbox ? View.VISIBLE : View.GONE);
ibMore.setVisibility(tools && !outbox ? View.VISIBLE : View.GONE);
vwEmpty.setVisibility(outbox ? View.GONE : View.VISIBLE);
ibTools.setImageLevel(tools ? 0 : 1);
ibTools.setContentDescription(context.getString(tools ? R.string.title_less : R.string.title_more));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
ibTools.setTooltipText(ibTools.getContentDescription());
ibTools.setVisibility(outbox ? View.GONE : View.VISIBLE);
vwEmpty.setVisibility(outbox ? View.GONE : View.VISIBLE);
if (tools)
bindButtons(message);
@ -7218,6 +7244,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.preview = prefs.getBoolean("preview", false);
this.preview_italic = prefs.getBoolean("preview_italic", true);
this.preview_lines = prefs.getInt("preview_lines", 1);
this.large_buttons = prefs.getBoolean("large_buttons", false);
this.message_zoom = prefs.getInt("message_zoom", 100);
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.thumbnails = prefs.getBoolean("thumbnails", true);

@ -152,6 +152,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private TextView tvPreviewLinesHint;
private SwitchCompat swAddresses;
private SwitchCompat swLargeButtons;
private TextView tvMessageZoom;
private SeekBar sbMessageZoom;
private SwitchCompat swOverviewMode;
@ -203,7 +204,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"subject_top", "subject_italic", "highlight_subject", "font_size_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background",
"preview", "preview_italic", "preview_lines",
"addresses",
"addresses", "large_buttons",
"message_zoom", "overview_mode", "override_width",
"hyphenation", "display_font", "contrast", "monospaced_pre",
"text_separators",
@ -311,6 +312,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPreviewLines = view.findViewById(R.id.spPreviewLines);
tvPreviewLinesHint = view.findViewById(R.id.tvPreviewLinesHint);
swAddresses = view.findViewById(R.id.swAddresses);
swLargeButtons = view.findViewById(R.id.swLargeButtons);
tvMessageZoom = view.findViewById(R.id.tvMessageZoom);
sbMessageZoom = view.findViewById(R.id.sbMessageZoom);
swOverviewMode = view.findViewById(R.id.swOverviewMode);
@ -1068,6 +1070,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swLargeButtons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("large_buttons", checked).apply();
}
});
sbMessageZoom.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
@ -1479,6 +1488,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPreviewLines.setEnabled(swPreview.isChecked());
swAddresses.setChecked(prefs.getBoolean("addresses", false));
swLargeButtons.setChecked(prefs.getBoolean("large_buttons", false));
int message_zoom = prefs.getInt("message_zoom", 100);
tvMessageZoom.setText(getString(R.string.title_advanced_message_text_zoom2, NF.format(message_zoom)));

@ -827,10 +827,10 @@
android:layout_marginTop="6dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorWarning"
android:text="@string/title_advanced_privacy_risk"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBimi" />
@ -842,10 +842,10 @@
android:layout_marginTop="6dp"
android:drawableStart="@drawable/twotone_check_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorControlNormal"
android:text="@string/title_advanced_bimi_unverified"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:drawableTint="?attr/colorControlNormal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBimiHint" />
@ -857,10 +857,10 @@
android:layout_marginTop="6dp"
android:drawableStart="@drawable/twotone_done_all_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorVerified"
android:text="@string/title_advanced_bimi_verified"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:drawableTint="?attr/colorVerified"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBimiUnverified" />
@ -893,10 +893,10 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="6dp"
app:drawableTint="?attr/colorWarning"
android:text="@string/title_advanced_privacy_risk"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swGravatars" />
@ -908,10 +908,10 @@
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
app:drawableTint="?android:attr/textColorLink"
android:text="@string/title_privacy_policy"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink"
app:drawableTint="?android:attr/textColorLink"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvGravatarsHint" />
@ -932,10 +932,10 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="6dp"
app:drawableTint="?attr/colorWarning"
android:text="@string/title_advanced_privacy_risk"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swLibravatars" />
@ -947,10 +947,10 @@
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
app:drawableTint="?android:attr/textColorLink"
android:text="@string/title_privacy_policy"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink"
app:drawableTint="?android:attr/textColorLink"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLibravatarsHint" />
@ -973,10 +973,10 @@
android:layout_marginTop="6dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorWarning"
android:text="@string/title_advanced_privacy_risk"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:drawableTint="?attr/colorWarning"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swFavicons" />
@ -1576,6 +1576,17 @@
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swLargeButtons"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_large_buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvMessageZoom"
android:layout_width="0dp"
@ -1586,7 +1597,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses" />
app:layout_constraintTop_toBottomOf="@id/swLargeButtons" />
<SeekBar
android:id="@+id/sbMessageZoom"
@ -1872,12 +1883,12 @@
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorWarning"
android:gravity="center"
android:text="@string/title_advanced_advanced"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:drawableTint="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -2007,8 +2018,8 @@
android:checked="true"
android:drawableStart="@drawable/twotone_flag_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorWarning"
android:text="@string/title_advanced_authentication"
app:drawableTint="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTextTitles"
@ -2046,10 +2057,10 @@
android:layout_marginTop="6dp"
android:drawableStart="@drawable/twotone_gpp_maybe_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorControlNormal"
android:text="@string/title_advanced_authentication_some"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:drawableTint="?attr/colorControlNormal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthenticationIndicator" />
@ -2061,10 +2072,10 @@
android:layout_marginTop="6dp"
android:drawableStart="@drawable/twotone_gpp_good_24"
android:drawablePadding="6dp"
app:drawableTint="?attr/colorVerified"
android:text="@string/title_advanced_authentication_all"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:drawableTint="?attr/colorVerified"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAuthSome" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -558,6 +558,7 @@
<string name="title_advanced_preview_italic">Show message preview in italics</string>
<string name="title_advanced_preview_lines">Number of preview lines</string>
<string name="title_advanced_addresses">Expand address details by default</string>
<string name="title_advanced_large_buttons">Use large buttons for message actions</string>
<string name="title_advanced_unzip">Show contents of compressed attachments</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
<string name="title_advanced_thumbnails">Show image thumbnails after the message text</string>

Loading…
Cancel
Save