|
45 | 45 | import android.graphics.drawable.ShapeDrawable; |
46 | 46 | import android.os.Build; |
47 | 47 | import androidx.annotation.NonNull; |
| 48 | +import androidx.core.view.AccessibilityDelegateCompat; |
48 | 49 | import androidx.core.view.ViewCompat; |
| 50 | +import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; |
| 51 | + |
49 | 52 | import android.text.TextUtils; |
50 | 53 | import android.util.Pair; |
51 | 54 | import android.util.SparseArray; |
@@ -1915,6 +1918,12 @@ protected void registerForTouch(final View touchable) |
1915 | 1918 | boolean soundEnabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_SOUND_EFFECTS_ENABLED), true); |
1916 | 1919 | touchable.setSoundEffectsEnabled(soundEnabled); |
1917 | 1920 | } |
| 1921 | + |
| 1922 | + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_ACCESSIBILITY_DISABLE_LONG)) { |
| 1923 | + if (TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_ACCESSIBILITY_DISABLE_LONG))) { |
| 1924 | + removeAccessibilityLongClick(); |
| 1925 | + } |
| 1926 | + } |
1918 | 1927 | registerTouchEvents(touchable); |
1919 | 1928 |
|
1920 | 1929 | // Previously, we used the single tap handling above to fire our click event. It doesn't |
@@ -2363,4 +2372,19 @@ public String composeContentDescription() |
2363 | 2372 | } |
2364 | 2373 | return composeContentDescription(proxy.getProperties()); |
2365 | 2374 | } |
| 2375 | + |
| 2376 | + public void removeAccessibilityLongClick() |
| 2377 | + { |
| 2378 | + ViewCompat.setAccessibilityDelegate(nativeView, new AccessibilityDelegateCompat() |
| 2379 | + { |
| 2380 | + @Override |
| 2381 | + public void onInitializeAccessibilityNodeInfo(@NonNull View host, |
| 2382 | + @NonNull AccessibilityNodeInfoCompat info) |
| 2383 | + { |
| 2384 | + super.onInitializeAccessibilityNodeInfo(host, info); |
| 2385 | + info.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK); |
| 2386 | + info.setLongClickable(false); |
| 2387 | + } |
| 2388 | + }); |
| 2389 | + } |
2366 | 2390 | } |
0 commit comments