Browse Source

Added advanced option to disable swipe actions

main
M66B 6 years ago
parent
commit
1d9b8a8bde
4 changed files with 26 additions and 1 deletions
  1. +3
    -0
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  2. +11
    -0
      app/src/main/java/eu/faircode/email/FragmentOptions.java
  3. +11
    -1
      app/src/main/res/layout/fragment_options.xml
  4. +1
    -0
      app/src/main/res/values/strings.xml

+ 3
- 0
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -177,6 +177,9 @@ public class FragmentMessages extends FragmentEx {
new ItemTouchHelper(new ItemTouchHelper.Callback() { new ItemTouchHelper(new ItemTouchHelper.Callback() {
@Override @Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (!prefs.getBoolean("swipe", true))
return 0;
int pos = viewHolder.getAdapterPosition(); int pos = viewHolder.getAdapterPosition();
if (pos == RecyclerView.NO_POSITION) if (pos == RecyclerView.NO_POSITION)
return 0; return 0;


+ 11
- 0
app/src/main/java/eu/faircode/email/FragmentOptions.java View File

@ -36,6 +36,7 @@ public class FragmentOptions extends FragmentEx {
private CheckBox cbAvatars; private CheckBox cbAvatars;
private CheckBox cbLight; private CheckBox cbLight;
private CheckBox cbBrowse; private CheckBox cbBrowse;
private CheckBox cbSwipe;
private CheckBox cbDebug; private CheckBox cbDebug;
@Override @Override
@ -50,6 +51,7 @@ public class FragmentOptions extends FragmentEx {
cbAvatars = view.findViewById(R.id.cbAvatars); cbAvatars = view.findViewById(R.id.cbAvatars);
cbLight = view.findViewById(R.id.cbLight); cbLight = view.findViewById(R.id.cbLight);
cbBrowse = view.findViewById(R.id.cbBrowse); cbBrowse = view.findViewById(R.id.cbBrowse);
cbSwipe = view.findViewById(R.id.cbSwipe);
cbDebug = view.findViewById(R.id.cbDebug); cbDebug = view.findViewById(R.id.cbDebug);
// Wire controls // 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.setChecked(prefs.getBoolean("debug", false));
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override


+ 11
- 1
app/src/main/res/layout/fragment_options.xml View File

@ -51,6 +51,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLight" /> 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 <CheckBox
android:id="@+id/cbDebug" android:id="@+id/cbDebug"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -59,6 +69,6 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_advanced_debug" android:text="@string/title_advanced_debug"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbBrowse" />
app:layout_constraintTop_toBottomOf="@id/cbSwipe" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>

+ 1
- 0
app/src/main/res/values/strings.xml View File

@ -83,6 +83,7 @@
<string name="title_advanced_avatars">Show contact photos</string> <string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_light">Use notification light</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_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_advanced_debug">Debug mode</string>
<string name="title_select">Select &#8230;</string> <string name="title_select">Select &#8230;</string>


Loading…
Cancel
Save