mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Added option to enable double tap
This commit is contained in:
parent
3cf4261118
commit
fcd9dbd4e9
4 changed files with 43 additions and 10 deletions
|
@ -1401,6 +1401,21 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
.putExtra("action", "edit")
|
||||
.putExtra("id", message.id));
|
||||
else {
|
||||
final LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
final Intent viewThread = new Intent(ActivityView.ACTION_VIEW_THREAD)
|
||||
.putExtra("account", message.account)
|
||||
.putExtra("thread", message.thread)
|
||||
.putExtra("id", message.id)
|
||||
.putExtra("found", viewType == ViewType.SEARCH);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean doubletap = prefs.getBoolean("doubletap", false);
|
||||
|
||||
if (!doubletap) {
|
||||
lbm.sendBroadcast(viewThread);
|
||||
return;
|
||||
}
|
||||
|
||||
firstClick = !firstClick;
|
||||
if (firstClick) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
|
@ -1408,14 +1423,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
public void run() {
|
||||
if (firstClick) {
|
||||
firstClick = false;
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(
|
||||
new Intent(ActivityView.ACTION_VIEW_THREAD)
|
||||
.putExtra("account", message.account)
|
||||
.putExtra("thread", message.thread)
|
||||
.putExtra("id", message.id)
|
||||
.putExtra("found", viewType == ViewType.SEARCH));
|
||||
lbm.sendBroadcast(viewThread);
|
||||
}
|
||||
}
|
||||
}, ViewConfiguration.getDoubleTapTimeout());
|
||||
|
|
|
@ -38,6 +38,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private SwitchCompat swPull;
|
||||
private SwitchCompat swAutoScroll;
|
||||
private SwitchCompat swSwipeNav;
|
||||
private SwitchCompat swDoubleTap;
|
||||
private SwitchCompat swAutoExpand;
|
||||
private SwitchCompat swAutoClose;
|
||||
private SwitchCompat swAutoNext;
|
||||
|
@ -46,7 +47,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private SwitchCompat swAutoMove;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"pull", "autoscroll", "swipenav", "autoexpand", "autoclose", "autonext",
|
||||
"pull", "autoscroll", "swipenav", "doubletap", "autoexpand", "autoclose", "autonext",
|
||||
"collapse", "autoread", "automove"
|
||||
};
|
||||
|
||||
|
@ -63,6 +64,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swPull = view.findViewById(R.id.swPull);
|
||||
swAutoScroll = view.findViewById(R.id.swAutoScroll);
|
||||
swSwipeNav = view.findViewById(R.id.swSwipeNav);
|
||||
swDoubleTap = view.findViewById(R.id.swDoubleTap);
|
||||
swAutoExpand = view.findViewById(R.id.swAutoExpand);
|
||||
swAutoClose = view.findViewById(R.id.swAutoClose);
|
||||
swAutoNext = view.findViewById(R.id.swAutoNext);
|
||||
|
@ -97,6 +99,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
}
|
||||
});
|
||||
|
||||
swDoubleTap.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("doubletap", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swAutoExpand.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -187,6 +196,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swPull.setChecked(prefs.getBoolean("pull", true));
|
||||
swAutoScroll.setChecked(prefs.getBoolean("autoscroll", false));
|
||||
swSwipeNav.setChecked(prefs.getBoolean("swipenav", true));
|
||||
swDoubleTap.setChecked(prefs.getBoolean("doubletap", false));
|
||||
swAutoExpand.setChecked(prefs.getBoolean("autoexpand", true));
|
||||
swAutoClose.setChecked(prefs.getBoolean("autoclose", true));
|
||||
swAutoNext.setChecked(prefs.getBoolean("autonext", false));
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
android:id="@+id/swPull"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_pull_refresh"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
@ -42,19 +43,31 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_swipenav"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoScroll"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDoubleTap"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_double_tap"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSwipeNav"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoExpand"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_autoexpand"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSwipeNav"
|
||||
app:layout_constraintTop_toBottomOf="@id/swDoubleTap"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
@ -96,6 +109,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_autoclose"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAutoCollapseHint"
|
||||
|
|
|
@ -207,6 +207,7 @@
|
|||
<string name="title_advanced_pull_refresh">Pull down to refresh</string>
|
||||
<string name="title_advanced_autoscroll">Scroll to top on receiving new messages</string>
|
||||
<string name="title_advanced_swipenav">Swipe left/right to go to next/previous conversation</string>
|
||||
<string name="title_advanced_double_tap">Double tap to mark message read/unread</string>
|
||||
<string name="title_advanced_autoexpand">Automatically expand messages</string>
|
||||
<string name="title_advanced_collapse">Collapse messages in conversations on \'back\'</string>
|
||||
<string name="title_advanced_autoclose">Automatically close conversations</string>
|
||||
|
|
Loading…
Reference in a new issue