Disable hiding reply/compose FAB if accessibility is enabled

pull/202/head
M66B 3 years ago
parent e76055dca1
commit 2dcd57a0a2

@ -90,7 +90,6 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.textclassifier.ConversationAction;
@ -5664,8 +5663,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.dp12 = Helper.dp2pixels(context, 12);
this.dp60 = Helper.dp2pixels(context, 60);
AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
this.accessibility = (am != null && am.isEnabled());
this.accessibility = Helper.isAccessibilityEnabled(context);
this.TF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);
this.DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.LONG, SimpleDateFormat.LONG);

@ -319,6 +319,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private int colorSeparator;
private int colorWarning;
private boolean accessibility;
private long primary;
private boolean connected;
private boolean reset = false;
@ -439,6 +441,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
colorSeparator = Helper.resolveColor(getContext(), R.attr.colorSeparator);
colorWarning = Helper.resolveColor(getContext(), R.attr.colorWarning);
accessibility = Helper.isAccessibilityEnabled(getContext());
if (criteria == null)
if (thread == null) {
if (folder < 0)
@ -761,7 +765,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean down = (dy > 0);
if (scrolling != down) {
scrolling = down;
if (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
if (!accessibility &&
(viewType == AdapterMessage.ViewType.UNIFIED ||
viewType == AdapterMessage.ViewType.FOLDER))
if (dy > 0)
fabCompose.hide();
else
@ -5425,7 +5431,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void updateExpanded() {
int expanded = (values.containsKey("expanded") ? values.get("expanded").size() : 0);
if (scrolling)
if (scrolling && !accessibility)
fabReply.hide();
else {
if (expanded == 1) {

@ -19,6 +19,9 @@ package eu.faircode.email;
Copyright 2018-2021 by Marcel Bokhorst (M66B)
*/
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
import android.Manifest;
import android.app.Activity;
import android.app.ActivityManager;
@ -62,6 +65,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.webkit.MimeTypeMap;
@ -137,9 +141,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
public class Helper {
private static Boolean hasPlayStore = null;
private static Boolean hasValidFingerprint = null;
@ -549,6 +550,17 @@ public class Helper {
}
}
static boolean isAccessibilityEnabled(Context context) {
try {
AccessibilityManager am =
(AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
return (am != null && am.isEnabled());
} catch (Throwable ex) {
Log.e(ex);
return false;
}
}
// View
static Intent getChooser(Context context, Intent intent) {

Loading…
Cancel
Save