mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 21:24:34 +00:00
Added option to auto go to next
This commit is contained in:
parent
b42f9719a4
commit
8744844977
6 changed files with 54 additions and 8 deletions
1
FAQ.md
1
FAQ.md
|
@ -35,7 +35,6 @@ None at this moment.
|
|||
## Frequently requested features
|
||||
|
||||
* Swipe left/right to go to previous/next message: besides that swiping left/right is already being used to move messages to archive/trash, swiping also selects message text, so this will not work reliably. You can use the bottom navigation bar instead.
|
||||
* Automatically go to the next message on deleting a message: since the 'next' message can either be an older or a newer message this would be confusing. You can disable auto closing in the advanced options and use the bottom navigation bar instead.
|
||||
* Rich text editor: besides that very few people would use this on a small mobile device, Android doesn't support a rich text editor and most rich text editor open source projects are abandoned.
|
||||
* Widget to read e-mail: widgets can have limited user interaction only, so a widget to read e-mail would not be very useful. Moreover, it would be not very useful to duplicate functions which are already available in the app.
|
||||
* Executing filter rules: filter rules should be executed on the server because a battery powered device with possibly an unstable internet connection is not suitable for this.
|
||||
|
|
|
@ -42,7 +42,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|||
|
||||
private static String[] restart = new String[]{
|
||||
"unified", "threading", "compact", "avatars", "identicons", "preview", "addresses",
|
||||
"pull", "actionbar", "autoclose", "confirm", "debug"
|
||||
"pull", "actionbar", "autoclose", "autonext", "confirm", "debug"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
|
|
@ -117,6 +117,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
private boolean pull;
|
||||
private boolean actionbar;
|
||||
private boolean autoclose;
|
||||
private boolean autonext;
|
||||
private boolean addresses;
|
||||
|
||||
private long primary = -1;
|
||||
|
@ -179,6 +180,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
threading = prefs.getBoolean("threading", true);
|
||||
actionbar = prefs.getBoolean("actionbar", true);
|
||||
autoclose = prefs.getBoolean("autoclose", true);
|
||||
autonext = prefs.getBoolean("autonext", false);
|
||||
addresses = prefs.getBoolean("addresses", true);
|
||||
}
|
||||
|
||||
|
@ -1860,8 +1862,9 @@ public class FragmentMessages extends FragmentEx {
|
|||
@Override
|
||||
public void onChanged(@Nullable PagedList<TupleMessageEx> messages) {
|
||||
if (messages == null ||
|
||||
(viewType == AdapterMessage.ViewType.THREAD && messages.size() == 0 && autoclose)) {
|
||||
finish();
|
||||
(viewType == AdapterMessage.ViewType.THREAD && messages.size() == 0 &&
|
||||
(autoclose || autonext))) {
|
||||
autoCloseNext();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1921,7 +1924,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
handleExpand(expand.id);
|
||||
}
|
||||
} else {
|
||||
if (autoCloseCount > 0 && autoclose) {
|
||||
if (autoCloseCount > 0 && (autoclose || autonext)) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
TupleMessageEx message = messages.get(i);
|
||||
|
@ -1933,11 +1936,11 @@ public class FragmentMessages extends FragmentEx {
|
|||
}
|
||||
Log.i("Auto close=" + count);
|
||||
|
||||
// Auto close when:
|
||||
// Auto close/next when:
|
||||
// - no more non archived/trashed/sent messages
|
||||
|
||||
if (count == 0) {
|
||||
finish();
|
||||
autoCloseNext();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2025,6 +2028,25 @@ public class FragmentMessages extends FragmentEx {
|
|||
});
|
||||
}
|
||||
|
||||
private void autoCloseNext() {
|
||||
if (autoclose)
|
||||
finish();
|
||||
else if (autonext) {
|
||||
ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class);
|
||||
ViewModelMessages.Target[] pn = model.getPrevNext(thread);
|
||||
if (pn[1] == null)
|
||||
finish();
|
||||
else {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(
|
||||
new Intent(ActivityView.ACTION_VIEW_THREAD)
|
||||
.putExtra("account", pn[1].account)
|
||||
.putExtra("thread", pn[1].thread)
|
||||
.putExtra("id", pn[1].id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleExpand(long id) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", id);
|
||||
|
|
|
@ -70,6 +70,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
private SwitchCompat swSwipe;
|
||||
private SwitchCompat swActionbar;
|
||||
private SwitchCompat swAutoClose;
|
||||
private SwitchCompat swAutoNext;
|
||||
private SwitchCompat swAutoRead;
|
||||
private SwitchCompat swCollapse;
|
||||
private SwitchCompat swAutoMove;
|
||||
|
@ -111,6 +112,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
swSwipe = view.findViewById(R.id.swSwipe);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
swAutoClose = view.findViewById(R.id.swAutoClose);
|
||||
swAutoNext = view.findViewById(R.id.swAutoNext);
|
||||
swAutoRead = view.findViewById(R.id.swAutoRead);
|
||||
swCollapse = view.findViewById(R.id.swCollapse);
|
||||
swAutoMove = view.findViewById(R.id.swAutoMove);
|
||||
|
@ -293,9 +295,19 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("autoclose", checked).apply();
|
||||
swAutoNext.setEnabled(!checked);
|
||||
}
|
||||
});
|
||||
|
||||
swAutoNext.setChecked(prefs.getBoolean("autonext", false));
|
||||
swAutoNext.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("autonext", checked).apply();
|
||||
}
|
||||
});
|
||||
swAutoNext.setEnabled(!swAutoClose.isChecked());
|
||||
|
||||
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
|
||||
swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
|
|
@ -359,6 +359,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoClose" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoNext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:text="@string/title_advanced_autonext"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAutocloseHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoRead"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -368,7 +380,7 @@
|
|||
android:layout_marginEnd="12dp"
|
||||
android:text="@string/title_advanced_autoread"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAutocloseHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoNext"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
<string name="title_advanced_swipe">Swipe actions</string>
|
||||
<string name="title_advanced_actionbar">Conversation action bar</string>
|
||||
<string name="title_advanced_autoclose">Automatically close conversations</string>
|
||||
<string name="title_advanced_autonext">Automatically go to next conversation on close conversation</string>
|
||||
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
|
||||
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
|
||||
<string name="title_advanced_automove">Confirm moving messages</string>
|
||||
|
|
Loading…
Reference in a new issue