Removed auto next on close

pull/147/head
M66B 6 years ago
parent 8e2c629043
commit f645c8b396

@ -36,6 +36,7 @@ Anything on this list is in random order and *might* be added in the near future
## 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 next message: after closing a conversation thread it is not possible anymore to reliably determine the next conversation thread without delays. Note that most apps implementing something similar work with individual messages instead of conversations and don't support two way synchronization.
* 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.
* Badge count: there is no standard Android API for this and third party solutions might stop working anytime. For example *ShortcutBadger* [has lots of problems](https://github.com/leolin310148/ShortcutBadger/issues). You can use the provided widget instead.

@ -117,7 +117,6 @@ public class FragmentMessages extends FragmentBase {
private boolean pull;
private boolean actionbar;
private boolean autoclose;
private boolean autonext;
private boolean addresses;
private long primary = -1;
@ -129,7 +128,6 @@ public class FragmentMessages extends FragmentBase {
private AdapterMessage.ViewType viewType;
private SelectionTracker<Long> selectionTracker = null;
private Long last_next = null;
private int autoCloseCount = 0;
private boolean autoExpand = true;
private Map<String, List<Long>> values = new HashMap<>();
@ -188,7 +186,6 @@ public class FragmentMessages extends FragmentBase {
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);
}
@ -292,11 +289,15 @@ public class FragmentMessages extends FragmentBase {
@Override
public void onNext(boolean exists, Long id) {
if (id != null)
last_next = id;
bottom_navigation.getMenu().findItem(R.id.action_next).setIntent(new Intent().putExtra("id", id));
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(id != null);
}
@Override
public void onDeleted() {
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false);
}
});
}
} else {
@ -1846,9 +1847,8 @@ public class FragmentMessages extends FragmentBase {
@Override
public void onChanged(@Nullable PagedList<TupleMessageEx> messages) {
if (messages == null ||
(viewType == AdapterMessage.ViewType.THREAD && messages.size() == 0 &&
(autoclose || autonext))) {
handleAutoClose();
(viewType == AdapterMessage.ViewType.THREAD && messages.size() == 0 && autoclose)) {
finish();
return;
}
@ -1947,7 +1947,7 @@ public class FragmentMessages extends FragmentBase {
handleExpand(expand.id);
}
} else {
if (autoCloseCount > 0 && (autoclose || autonext)) {
if (autoCloseCount > 0 && autoclose) {
int count = 0;
for (int i = 0; i < messages.size(); i++) {
TupleMessageEx message = messages.get(i);
@ -1964,7 +1964,7 @@ public class FragmentMessages extends FragmentBase {
// - no more non archived/trashed/sent messages
if (count == 0) {
handleAutoClose();
finish();
return;
}
}
@ -2079,40 +2079,6 @@ public class FragmentMessages extends FragmentBase {
}.execute(this, args, "messages:expand");
}
private void handleAutoClose() {
if (autoclose)
finish();
else if (autonext) {
if (last_next != null) {
Log.i("Navigating to last next=" + last_next);
navigate(last_next);
return;
}
ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class);
model.observePrevNext(getViewLifecycleOwner(), thread, new ViewModelMessages.IPrevNext() {
private boolean once = false;
@Override
public void onPrevious(boolean exists, Long id) {
// Do nothing
}
@Override
public void onNext(boolean exists, Long id) {
if (once)
return;
once = true;
if (id != null)
navigate(id);
if (!exists)
finish();
}
});
}
}
private void navigate(long id) {
Bundle args = new Bundle();
args.putLong("id", id);
@ -2125,17 +2091,14 @@ public class FragmentMessages extends FragmentBase {
@Override
protected void onExecuted(Bundle args, EntityMessage message) {
if (message == null) {
finish();
return;
if (message != null) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_THREAD)
.putExtra("account", message.account)
.putExtra("thread", message.thread)
.putExtra("id", message.id));
}
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_THREAD)
.putExtra("account", message.account)
.putExtra("thread", message.thread)
.putExtra("id", message.id));
}
@Override

@ -74,7 +74,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private SwitchCompat swPull;
private SwitchCompat swActionbar;
private SwitchCompat swAutoClose;
private SwitchCompat swAutoNext;
private SwitchCompat swAutoRead;
private SwitchCompat swCollapse;
private SwitchCompat swAutoMove;
@ -134,7 +133,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swPull = view.findViewById(R.id.swPull);
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);
@ -291,14 +289,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoclose", checked).apply();
swAutoNext.setEnabled(!checked);
}
});
swAutoNext.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autonext", checked).apply();
}
});
@ -459,8 +449,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swPull.setChecked(prefs.getBoolean("pull", true));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
swAutoClose.setChecked(prefs.getBoolean("autoclose", true));
swAutoNext.setChecked(prefs.getBoolean("autonext", false));
swAutoNext.setEnabled(!swAutoClose.isChecked());
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swCollapse.setChecked(prefs.getBoolean("collapse", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false));

@ -117,8 +117,7 @@ public class ViewModelMessages extends ViewModel {
}
Log.w("Observe previous/next gone thread=" + thread);
reportNext(intf, false, null);
reportPrevious(intf, false, null);
intf.onDeleted();
}
});
}
@ -137,5 +136,7 @@ public class ViewModelMessages extends ViewModel {
void onPrevious(boolean exists, Long id);
void onNext(boolean exists, Long id);
void onDeleted();
}
}

@ -386,18 +386,6 @@
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"
@ -407,7 +395,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autoread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoNext"
app:layout_constraintTop_toBottomOf="@id/tvAutocloseHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

Loading…
Cancel
Save