mirror of https://github.com/M66B/FairEmail.git
Added option to swap archive/delete button
This commit is contained in:
parent
84cfc8472b
commit
a2f7f3996b
|
@ -350,6 +350,8 @@ public class FragmentMessages extends FragmentBase
|
|||
private boolean swipenav;
|
||||
private boolean seekbar;
|
||||
private boolean actionbar;
|
||||
private int actionbar_delete_id;
|
||||
private int actionbar_archive_id;
|
||||
private boolean actionbar_color;
|
||||
private boolean autoexpand;
|
||||
private boolean autoclose;
|
||||
|
@ -491,6 +493,9 @@ public class FragmentMessages extends FragmentBase
|
|||
args.getBoolean("force_threading"));
|
||||
seekbar = prefs.getBoolean("seekbar", false);
|
||||
actionbar = prefs.getBoolean("actionbar", true);
|
||||
boolean actionbar_swap = prefs.getBoolean("actionbar_swap", false);
|
||||
actionbar_delete_id = (actionbar_swap ? R.id.action_archive : R.id.action_delete);
|
||||
actionbar_archive_id = (actionbar_swap ? R.id.action_delete : R.id.action_archive);
|
||||
actionbar_color = prefs.getBoolean("actionbar_color", false);
|
||||
autoexpand = prefs.getBoolean("autoexpand", true);
|
||||
autoclose = prefs.getBoolean("autoclose", true);
|
||||
|
@ -1274,7 +1279,7 @@ public class FragmentMessages extends FragmentBase
|
|||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
ActionData data = (ActionData) bottom_navigation.getTag();
|
||||
int itemId = menuItem.getItemId();
|
||||
if (itemId == R.id.action_delete) {
|
||||
if (itemId == actionbar_delete_id) {
|
||||
if (data.delete)
|
||||
onActionDelete();
|
||||
else
|
||||
|
@ -1283,7 +1288,7 @@ public class FragmentMessages extends FragmentBase
|
|||
} else if (itemId == R.id.action_snooze) {
|
||||
onActionSnooze();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_archive) {
|
||||
} else if (itemId == actionbar_archive_id) {
|
||||
onActionMove(EntityFolder.ARCHIVE);
|
||||
return true;
|
||||
} else if (itemId == R.id.action_prev) {
|
||||
|
@ -6884,20 +6889,26 @@ public class FragmentMessages extends FragmentBase
|
|||
|
||||
bottom_navigation.setTag(data);
|
||||
|
||||
bottom_navigation.getMenu().findItem(R.id.action_delete).setIcon(
|
||||
data.forever ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible(data.trashable);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_snooze).setVisible(data.snoozable);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(data.archivable);
|
||||
bottom_navigation.getMenu().findItem(actionbar_delete_id)
|
||||
.setIcon(data.forever ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24)
|
||||
.setTitle(data.forever ? R.string.title_delete_permanently : R.string.title_trash)
|
||||
.setVisible(data.trashable);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_snooze)
|
||||
.setVisible(data.snoozable);
|
||||
bottom_navigation.getMenu().findItem(actionbar_archive_id)
|
||||
.setIcon(R.drawable.twotone_archive_24)
|
||||
.setTitle(R.string.title_archive)
|
||||
.setVisible(data.archivable);
|
||||
bottom_navigation.setVisibility(View.VISIBLE);
|
||||
|
||||
bottom_navigation.findViewById(R.id.action_delete).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
onActionDelete();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
bottom_navigation.findViewById(actionbar_delete_id)
|
||||
.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
onActionDelete();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7687,10 +7698,10 @@ public class FragmentMessages extends FragmentBase
|
|||
!bottom_navigation.isEnabled() ||
|
||||
bottom_navigation.getVisibility() != View.VISIBLE)
|
||||
return false;
|
||||
MenuItem archive = bottom_navigation.getMenu().findItem(R.id.action_archive);
|
||||
MenuItem archive = bottom_navigation.getMenu().findItem(actionbar_archive_id);
|
||||
if (archive == null || !archive.isVisible() || !archive.isEnabled())
|
||||
return false;
|
||||
bottom_navigation.getMenu().performIdentifierAction(R.id.action_archive, 0);
|
||||
bottom_navigation.getMenu().performIdentifierAction(actionbar_archive_id, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7699,10 +7710,10 @@ public class FragmentMessages extends FragmentBase
|
|||
!bottom_navigation.isEnabled() ||
|
||||
bottom_navigation.getVisibility() != View.VISIBLE)
|
||||
return false;
|
||||
MenuItem delete = bottom_navigation.getMenu().findItem(R.id.action_delete);
|
||||
MenuItem delete = bottom_navigation.getMenu().findItem(actionbar_delete_id);
|
||||
if (delete == null || !delete.isVisible() || !delete.isEnabled())
|
||||
return false;
|
||||
bottom_navigation.getMenu().performIdentifierAction(R.id.action_delete, 0);
|
||||
bottom_navigation.getMenu().performIdentifierAction(actionbar_delete_id, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"list_count", "bundled_fonts", "parse_classes",
|
||||
"background_color", "text_color", "text_size", "text_font", "text_align", "text_titles", "text_separators",
|
||||
"collapse_quotes", "image_placeholders", "inline_images",
|
||||
"seekbar", "actionbar", "actionbar_color", "group_category",
|
||||
"seekbar", "actionbar", "actionbar_swap", "actionbar_color", "group_category",
|
||||
"autoscroll", "swipenav", "reversed", "swipe_close", "swipe_move", "autoexpand", "autoclose", "onclose",
|
||||
"swipe_reply",
|
||||
"language_detection",
|
||||
|
|
|
@ -98,6 +98,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swIndentation;
|
||||
private SwitchCompat swSeekbar;
|
||||
private SwitchCompat swActionbar;
|
||||
private SwitchCompat swActionbarSwap;
|
||||
private SwitchCompat swActionbarColor;
|
||||
|
||||
private SwitchCompat swHighlightUnread;
|
||||
|
@ -195,7 +196,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "dividers",
|
||||
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
|
||||
"nav_options", "nav_categories", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
|
||||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
|
||||
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
|
||||
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "generated_icons", "identicons",
|
||||
"circular", "saturation", "brightness", "threshold",
|
||||
|
@ -259,6 +260,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swIndentation = view.findViewById(R.id.swIndentation);
|
||||
swSeekbar = view.findViewById(R.id.swSeekbar);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
swActionbarSwap = view.findViewById(R.id.swActionbarSwap);
|
||||
swActionbarColor = view.findViewById(R.id.swActionbarColor);
|
||||
|
||||
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
||||
|
@ -647,10 +649,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("actionbar", checked).apply();
|
||||
swActionbarSwap.setEnabled(checked);
|
||||
swActionbarColor.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swActionbarSwap.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("actionbar_swap", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swActionbarColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -1400,6 +1410,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swIndentation.setEnabled(swCards.isChecked() && swThreading.isChecked());
|
||||
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
|
||||
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
||||
swActionbarSwap.setChecked(prefs.getBoolean("actionbar_swap", false));
|
||||
swActionbarSwap.setEnabled(swActionbar.isChecked());
|
||||
swActionbarColor.setChecked(prefs.getBoolean("actionbar_color", false));
|
||||
swActionbarColor.setEnabled(swActionbar.isChecked());
|
||||
|
||||
|
|
|
@ -707,6 +707,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swSeekbar"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swActionbarSwap"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_actionbar_swap"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swActionbar"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swActionbarColor"
|
||||
android:layout_width="0dp"
|
||||
|
@ -716,7 +728,7 @@
|
|||
android:text="@string/title_advanced_actionbar_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swActionbar"
|
||||
app:layout_constraintTop_toBottomOf="@id/swActionbarSwap"
|
||||
app:switchPadding="12dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
|
|
@ -592,6 +592,7 @@
|
|||
<string name="title_advanced_button_extra">Show extra buttons at the bottom of a message</string>
|
||||
<string name="title_advanced_seekbar">Show relative conversation position with a dot</string>
|
||||
<string name="title_advanced_actionbar">Show conversation action bar</string>
|
||||
<string name="title_advanced_actionbar_swap">Swap trash and archive button</string>
|
||||
<string name="title_advanced_actionbar_color">Use account color as background color for conversation action bar</string>
|
||||
<string name="title_advanced_category_header">Group by account category</string>
|
||||
<string name="title_advanced_navbar_colorize">Colorize the Android navigation bar</string>
|
||||
|
|
Loading…
Reference in New Issue