Added option for swipe feedback

pull/217/head
M66B 6 months ago
parent c93623ad86
commit 4f996333d1

@ -3303,11 +3303,13 @@ public class FragmentMessages extends FragmentBase
if (expanded && swipe_reply) {
redraw(viewHolder);
swipeFeedback();
onMenuReply(message, "reply", null, null);
return;
}
if (EntityFolder.OUTBOX.equals(message.folderType)) {
swipeFeedback();
if (message.warning == null)
ActivityCompose.undoSend(message.id, getContext(), getViewLifecycleOwner(), getParentFragmentManager());
else
@ -3350,6 +3352,8 @@ public class FragmentMessages extends FragmentBase
" message=" + message.id +
" folder=" + message.folderType);
swipeFeedback();
if (EntityMessage.SWIPE_ACTION_ASK.equals(action)) {
rvMessage.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
@Override
@ -3430,6 +3434,13 @@ public class FragmentMessages extends FragmentBase
return message;
}
private void swipeFeedback() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean haptic_feedback_swipe = prefs.getBoolean("haptic_feedback_swipe", false);
if (haptic_feedback_swipe)
Helper.performHapticFeedback(view, HapticFeedbackConstants.GESTURE_END);
}
private void redraw(RecyclerView.ViewHolder vh) {
if (vh != null)
try {

@ -126,6 +126,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SeekBar sbClassMinDifference;
private SwitchCompat swShowFiltered;
private SwitchCompat swHapticFeedback;
private SwitchCompat swHapticFeedbackSwipe;
private ImageButton ibClassification;
private Spinner spLanguage;
private SwitchCompat swUpdates;
@ -288,7 +289,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
final static List<String> RESET_OPTIONS = Collections.unmodifiableList(Arrays.asList(
"sort_answers", "shortcuts", "ical_tentative", "fts",
"classification", "class_min_probability", "class_min_difference",
"show_filtered", "haptic_feedback",
"show_filtered", "haptic_feedback", "haptic_feedback_swipe",
"language",
"updates", "weekly", "beta", "show_changelog", "announcements",
"crash_reports", "cleanup_attachments",
@ -395,6 +396,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbClassMinDifference = view.findViewById(R.id.sbClassMinDifference);
swShowFiltered = view.findViewById(R.id.swShowFiltered);
swHapticFeedback = view.findViewById(R.id.swHapticFeedback);
swHapticFeedbackSwipe = view.findViewById(R.id.swHapticFeedbackSwipe);
spLanguage = view.findViewById(R.id.spLanguage);
swUpdates = view.findViewById(R.id.swUpdates);
tvGithubPrivacy = view.findViewById(R.id.tvGithubPrivacy);
@ -737,6 +739,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swHapticFeedbackSwipe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
prefs.edit().putBoolean("haptic_feedback_swipe", isChecked).apply();
}
});
spLanguage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@ -2473,6 +2482,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swShowFiltered.setChecked(prefs.getBoolean("show_filtered", false));
swHapticFeedback.setChecked(prefs.getBoolean("haptic_feedback", true));
swHapticFeedbackSwipe.setChecked(prefs.getBoolean("haptic_feedback_swipe", false));
int selected = -1;
String language = prefs.getString("language", null);

@ -344,6 +344,18 @@
app:layout_constraintTop_toBottomOf="@id/swShowFiltered"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHapticFeedbackSwipe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_haptic_feedback_swipe"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHapticFeedback"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvLanguage"
android:layout_width="0dp"
@ -355,7 +367,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHapticFeedback" />
app:layout_constraintTop_toBottomOf="@id/swHapticFeedbackSwipe" />
<eu.faircode.email.SpinnerEx
android:id="@+id/spLanguage"

@ -906,6 +906,7 @@
<string name="title_advanced_class_min_difference">Minimum class difference: %1$s %%</string>
<string name="title_advanced_show_filtered">Show a filter icon when rules were applied</string>
<string name="title_advanced_haptic_feedback">Haptic feedback on important actions</string>
<string name="title_advanced_haptic_feedback_swipe">Haptic feedback when swiping left/right</string>
<string name="title_advanced_language">Language</string>
<string name="title_advanced_language_system">System</string>
<string name="title_advanced_integrations_hint">The cloud services below are not part of the app. Any payments will go directly to the cloud service and not to the app developer.</string>

Loading…
Cancel
Save