revert: readd haptic feedback setting on Android 11 and lower
Some OEMs do not implement a systemwide setting for touch feedback.
This reverts commit e0a793e176.
This commit is contained in:
@@ -74,6 +74,7 @@ public class GlobalUserPreferences{
|
|||||||
public static boolean doubleTapToSearch;
|
public static boolean doubleTapToSearch;
|
||||||
public static boolean doubleTapToSwipe;
|
public static boolean doubleTapToSwipe;
|
||||||
public static boolean confirmBeforeReblog;
|
public static boolean confirmBeforeReblog;
|
||||||
|
public static boolean hapticFeedback;
|
||||||
public static boolean replyLineAboveHeader;
|
public static boolean replyLineAboveHeader;
|
||||||
public static boolean swapBookmarkWithBoostAction;
|
public static boolean swapBookmarkWithBoostAction;
|
||||||
public static boolean mentionRebloggerAutomatically;
|
public static boolean mentionRebloggerAutomatically;
|
||||||
@@ -154,6 +155,7 @@ public class GlobalUserPreferences{
|
|||||||
doubleTapToSwipe =prefs.getBoolean("doubleTapToSwipe", true);
|
doubleTapToSwipe =prefs.getBoolean("doubleTapToSwipe", true);
|
||||||
replyLineAboveHeader=prefs.getBoolean("replyLineAboveHeader", true);
|
replyLineAboveHeader=prefs.getBoolean("replyLineAboveHeader", true);
|
||||||
confirmBeforeReblog=prefs.getBoolean("confirmBeforeReblog", false);
|
confirmBeforeReblog=prefs.getBoolean("confirmBeforeReblog", false);
|
||||||
|
hapticFeedback=prefs.getBoolean("hapticFeedback", true);
|
||||||
swapBookmarkWithBoostAction=prefs.getBoolean("swapBookmarkWithBoostAction", false);
|
swapBookmarkWithBoostAction=prefs.getBoolean("swapBookmarkWithBoostAction", false);
|
||||||
mentionRebloggerAutomatically=prefs.getBoolean("mentionRebloggerAutomatically", false);
|
mentionRebloggerAutomatically=prefs.getBoolean("mentionRebloggerAutomatically", false);
|
||||||
showPostsWithoutAlt=prefs.getBoolean("showPostsWithoutAlt", true);
|
showPostsWithoutAlt=prefs.getBoolean("showPostsWithoutAlt", true);
|
||||||
@@ -225,6 +227,7 @@ public class GlobalUserPreferences{
|
|||||||
.putBoolean("replyLineAboveHeader", replyLineAboveHeader)
|
.putBoolean("replyLineAboveHeader", replyLineAboveHeader)
|
||||||
.putBoolean("confirmBeforeReblog", confirmBeforeReblog)
|
.putBoolean("confirmBeforeReblog", confirmBeforeReblog)
|
||||||
.putBoolean("swapBookmarkWithBoostAction", swapBookmarkWithBoostAction)
|
.putBoolean("swapBookmarkWithBoostAction", swapBookmarkWithBoostAction)
|
||||||
|
.putBoolean("hapticFeedback", hapticFeedback)
|
||||||
.putBoolean("mentionRebloggerAutomatically", mentionRebloggerAutomatically)
|
.putBoolean("mentionRebloggerAutomatically", mentionRebloggerAutomatically)
|
||||||
.putBoolean("showDividers", showDividers)
|
.putBoolean("showDividers", showDividers)
|
||||||
.putBoolean("relocatePublishButton", relocatePublishButton)
|
.putBoolean("relocatePublishButton", relocatePublishButton)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.joinmastodon.android.fragments.settings;
|
package org.joinmastodon.android.fragments.settings;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -39,7 +40,7 @@ public class SettingsBehaviorFragment extends BaseSettingsFragment<Void> impleme
|
|||||||
private CheckableListItem<Void> remoteLoadingItem, showBoostsItem, showRepliesItem, loadNewPostsItem, seeNewPostsBtnItem, overlayMediaItem;
|
private CheckableListItem<Void> remoteLoadingItem, showBoostsItem, showRepliesItem, loadNewPostsItem, seeNewPostsBtnItem, overlayMediaItem;
|
||||||
|
|
||||||
// MOSHIDON
|
// MOSHIDON
|
||||||
private CheckableListItem<Void> mentionRebloggerAutomaticallyItem, showPostsWithoutAltItem;
|
private CheckableListItem<Void> mentionRebloggerAutomaticallyItem, hapticFeedbackItem, showPostsWithoutAltItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
@@ -75,6 +76,11 @@ public class SettingsBehaviorFragment extends BaseSettingsFragment<Void> impleme
|
|||||||
replyVisibilityItem=new ListItem<>(R.string.sk_settings_reply_visibility, getReplyVisibilityString(), R.drawable.ic_fluent_chat_24_regular, this::onReplyVisibilityClick)
|
replyVisibilityItem=new ListItem<>(R.string.sk_settings_reply_visibility, getReplyVisibilityString(), R.drawable.ic_fluent_chat_24_regular, this::onReplyVisibilityClick)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// add a haptic feedback item for devices running Android 11 and below,
|
||||||
|
// as some OEMs do not implement the system setting haptic feedback setting
|
||||||
|
if(Build.VERSION.SDK_INT<=Build.VERSION_CODES.R)
|
||||||
|
items.add(hapticFeedbackItem=new CheckableListItem<>(R.string.mo_haptic_feedback, R.string.mo_setting_haptic_feedback_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.hapticFeedback, R.drawable.ic_fluent_phone_vibrate_24_regular, i->toggleCheckableItem(hapticFeedbackItem), true));
|
||||||
|
|
||||||
loadNewPostsItem.checkedChangeListener=checked->onLoadNewPostsClick();
|
loadNewPostsItem.checkedChangeListener=checked->onLoadNewPostsClick();
|
||||||
seeNewPostsBtnItem.isEnabled=loadNewPostsItem.checked;
|
seeNewPostsBtnItem.isEnabled=loadNewPostsItem.checked;
|
||||||
|
|
||||||
@@ -211,6 +217,7 @@ public class SettingsBehaviorFragment extends BaseSettingsFragment<Void> impleme
|
|||||||
GlobalUserPreferences.showNewPostsButton=seeNewPostsBtnItem.checked;
|
GlobalUserPreferences.showNewPostsButton=seeNewPostsBtnItem.checked;
|
||||||
GlobalUserPreferences.allowRemoteLoading=remoteLoadingItem.checked;
|
GlobalUserPreferences.allowRemoteLoading=remoteLoadingItem.checked;
|
||||||
GlobalUserPreferences.mentionRebloggerAutomatically=mentionRebloggerAutomaticallyItem.checked;
|
GlobalUserPreferences.mentionRebloggerAutomatically=mentionRebloggerAutomaticallyItem.checked;
|
||||||
|
GlobalUserPreferences.hapticFeedback=hapticFeedbackItem.checked;
|
||||||
GlobalUserPreferences.showPostsWithoutAlt=showPostsWithoutAltItem.checked;
|
GlobalUserPreferences.showPostsWithoutAlt=showPostsWithoutAltItem.checked;
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
AccountLocalPreferences lp=getLocalPrefs();
|
AccountLocalPreferences lp=getLocalPrefs();
|
||||||
|
|||||||
@@ -434,6 +434,8 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void vibrateForAction(View view, boolean isPositive) {
|
private static void vibrateForAction(View view, boolean isPositive) {
|
||||||
|
if (!GlobalUserPreferences.hapticFeedback) return;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
view.performHapticFeedback(isPositive ? HapticFeedbackConstants.CONFIRM : HapticFeedbackConstants.REJECT);
|
view.performHapticFeedback(isPositive ? HapticFeedbackConstants.CONFIRM : HapticFeedbackConstants.REJECT);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user