mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Added advanced option to disable swipe actions
This commit is contained in:
parent
8c4dc66550
commit
1d9b8a8bde
4 changed files with 26 additions and 1 deletions
|
@ -177,6 +177,9 @@ public class FragmentMessages extends FragmentEx {
|
|||
new ItemTouchHelper(new ItemTouchHelper.Callback() {
|
||||
@Override
|
||||
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||
if (!prefs.getBoolean("swipe", true))
|
||||
return 0;
|
||||
|
||||
int pos = viewHolder.getAdapterPosition();
|
||||
if (pos == RecyclerView.NO_POSITION)
|
||||
return 0;
|
||||
|
|
|
@ -36,6 +36,7 @@ public class FragmentOptions extends FragmentEx {
|
|||
private CheckBox cbAvatars;
|
||||
private CheckBox cbLight;
|
||||
private CheckBox cbBrowse;
|
||||
private CheckBox cbSwipe;
|
||||
private CheckBox cbDebug;
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +51,7 @@ public class FragmentOptions extends FragmentEx {
|
|||
cbAvatars = view.findViewById(R.id.cbAvatars);
|
||||
cbLight = view.findViewById(R.id.cbLight);
|
||||
cbBrowse = view.findViewById(R.id.cbBrowse);
|
||||
cbSwipe = view.findViewById(R.id.cbSwipe);
|
||||
cbDebug = view.findViewById(R.id.cbDebug);
|
||||
|
||||
// Wire controls
|
||||
|
@ -92,6 +94,15 @@ public class FragmentOptions extends FragmentEx {
|
|||
}
|
||||
});
|
||||
|
||||
cbSwipe.setChecked(prefs.getBoolean("swipe", true));
|
||||
cbSwipe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("swipe", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "swipe=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
cbDebug.setChecked(prefs.getBoolean("debug", false));
|
||||
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
|
|
@ -51,6 +51,16 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbLight" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSwipe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_swipe"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbBrowse" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbDebug"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -59,6 +69,6 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_debug"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbBrowse" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSwipe" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
|
@ -83,6 +83,7 @@
|
|||
<string name="title_advanced_avatars">Show contact photos</string>
|
||||
<string name="title_advanced_light">Use notification light</string>
|
||||
<string name="title_advanced_browse">Browse messages on the server</string>
|
||||
<string name="title_advanced_swipe">Swipe actions</string>
|
||||
<string name="title_advanced_debug">Debug mode</string>
|
||||
|
||||
<string name="title_select">Select …</string>
|
||||
|
|
Loading…
Reference in a new issue