Added option to disabled swipe navigation

This commit is contained in:
M66B 2019-02-03 18:22:42 +00:00
parent b39c9f0610
commit 5ae209fc8d
4 changed files with 57 additions and 27 deletions

View File

@ -402,6 +402,10 @@ public class FragmentMessages extends FragmentBase {
activity.setSwipeListener(new SwipeListener.ISwipeListener() {
@Override
public boolean onSwipeRight() {
boolean swipenav = prefs.getBoolean("swipenav", true);
if (!swipenav)
return false;
if (previous != null)
navigate(previous, true);
return (previous != null);
@ -409,6 +413,10 @@ public class FragmentMessages extends FragmentBase {
@Override
public boolean onSwipeLeft() {
boolean swipenav = prefs.getBoolean("swipenav", true);
if (!swipenav)
return false;
if (next != null)
navigate(next, false);
return (next != null);

View File

@ -74,11 +74,12 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private SwitchCompat swActionbar;
private SwitchCompat swPull;
private SwitchCompat swSwipeNav;
private SwitchCompat swAutoExpand;
private SwitchCompat swAutoClose;
private SwitchCompat swAutoNext;
private SwitchCompat swAutoRead;
private SwitchCompat swCollapse;
private SwitchCompat swAutoRead;
private SwitchCompat swAutoMove;
private SwitchCompat swSender;
private SwitchCompat swAutoResize;
@ -101,7 +102,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
"enabled", "updates",
"metered", "download",
"unified", "date", "threading", "avatars", "identicons", "preview", "addresses", "autoimages", "actionbar",
"pull", "autoexpand", "autoclose", "autonext", "autoread", "collapse", "automove", "sender", "autoresize", "autosend",
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove", "sender", "autoresize", "autosend",
"light", "sound",
"debug",
"first", "why", "last_update_check", "app_support", "message_swipe", "message_select", "folder_actions", "folder_sync",
@ -136,11 +137,12 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swActionbar = view.findViewById(R.id.swActionbar);
swPull = view.findViewById(R.id.swPull);
swSwipeNav = view.findViewById(R.id.swSwipeNav);
swAutoExpand = view.findViewById(R.id.swAutoExpand);
swAutoClose = view.findViewById(R.id.swAutoClose);
swAutoNext = view.findViewById(R.id.swAutoNext);
swAutoRead = view.findViewById(R.id.swAutoRead);
swCollapse = view.findViewById(R.id.swCollapse);
swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoMove = view.findViewById(R.id.swAutoMove);
swSender = view.findViewById(R.id.swSender);
swAutoResize = view.findViewById(R.id.swAutoResize);
@ -292,7 +294,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -300,6 +301,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swSwipeNav.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("swipenav", checked).apply();
}
});
swAutoExpand.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -322,13 +330,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoread", checked).apply();
}
});
swCollapse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -336,6 +337,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swAutoRead.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autoread", checked).apply();
}
});
swAutoMove.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -480,12 +488,13 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
swPull.setChecked(prefs.getBoolean("pull", true));
swSwipeNav.setChecked(prefs.getBoolean("swipenav", true));
swAutoExpand.setChecked(prefs.getBoolean("autoexpand", 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));
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false));
swSender.setChecked(prefs.getBoolean("sender", false));
swAutoResize.setChecked(prefs.getBoolean("autoresize", true));

View File

@ -399,6 +399,18 @@
app:layout_constraintTop_toBottomOf="@id/vSeparatorBehavior"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSwipeNav"
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_swipenav"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPull"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoExpand"
android:layout_width="match_parent"
@ -408,7 +420,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_autoexpand"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPull"
app:layout_constraintTop_toBottomOf="@id/swSwipeNav"
app:switchPadding="12dp" />
<TextView
@ -461,18 +473,6 @@
app:layout_constraintTop_toBottomOf="@id/tvAutoCloseHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoRead"
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_autoread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoNext"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCollapse"
android:layout_width="match_parent"
@ -482,7 +482,19 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_collapse"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoRead"
app:layout_constraintTop_toBottomOf="@id/swAutoNext"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoRead"
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_autoread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCollapse"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -494,7 +506,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_automove"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCollapse"
app:layout_constraintTop_toBottomOf="@id/swAutoRead"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -161,6 +161,7 @@
<string name="title_advanced_pull_refresh">Pull down to refresh</string>
<string name="title_advanced_autoexpand">Automatically expand messages</string>
<string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_swipenav">Swipe left/right to go to next/previous conversation</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>