diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java index 3d4dc8d838d454..e80e6cd629069b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java @@ -8,14 +8,12 @@ package com.facebook.react.uimanager; import android.content.Context; -import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.SpannableString; import android.text.style.URLSpan; import android.view.View; -import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import androidx.annotation.Nullable; import androidx.core.view.AccessibilityDelegateCompat; @@ -23,6 +21,7 @@ import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.RangeInfoCompat; +import com.facebook.common.logging.FLog; import com.facebook.react.R; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Dynamic; @@ -45,7 +44,6 @@ * AccessibilityNodeInfo. */ public class ReactAccessibilityDelegate extends AccessibilityDelegateCompat { - private static final String TAG = "ReactAccessibilityDelegate"; public static final String TOP_ACCESSIBILITY_ACTION_EVENT = "topAccessibilityAction"; private static int sCounter = 0x3f000000; @@ -226,7 +224,7 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo (ReadableArray) host.getTag(R.id.accessibility_actions); final ReadableMap accessibilityCollectionItemInfo = - (ReadableMap) host.getTag(R.id.accessibility_collection_item_info); + (ReadableMap) host.getTag(R.id.accessibility_collection_item_info); if (accessibilityCollectionItemInfo != null) { int rowIndex = accessibilityCollectionItemInfo.getInt("rowIndex"); int columnIndex = accessibilityCollectionItemInfo.getInt("columnIndex"); @@ -234,7 +232,9 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo int columnSpan = accessibilityCollectionItemInfo.getInt("columnSpan"); boolean heading = accessibilityCollectionItemInfo.getBoolean("heading"); - AccessibilityNodeInfoCompat.CollectionItemInfoCompat collectionItemInfoCompat = AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(rowIndex, rowSpan, columnIndex, columnSpan, heading); + AccessibilityNodeInfoCompat.CollectionItemInfoCompat collectionItemInfoCompat = + AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain( + rowIndex, rowSpan, columnIndex, columnSpan, heading); info.setCollectionItemInfo(collectionItemInfoCompat); } @@ -293,7 +293,6 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo } } - @Override public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) { super.onInitializeAccessibilityEvent(host, event); @@ -437,6 +436,27 @@ public static void setRole( final AccessibilityNodeInfoCompat.CollectionItemInfoCompat itemInfo = AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(0, 1, 0, 1, true); nodeInfo.setCollectionItemInfo(itemInfo); + } else if (role.equals(AccessibilityRole.GRID)) { + /* + final ReactAccessibilityDelegate.AccessibilityRole accessibilityRole = AccessibilityRole.GRID; + FLog.w( + "TESTING::ReactAccessibilityDelegate", + "accessibilityRole: " + + (accessibilityRole) + + " at ReactAccessibilityDelegate: " + ); + ReactAccessibilityDelegate.setRole(nodeInfo, accessibilityRole, context); + + int rowCount = 10; + int columnCount = 3; + boolean hierarchical = false; + + AccessibilityNodeInfoCompat.CollectionInfoCompat collectionInfoCompat = + AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain( + rowCount, columnCount, hierarchical); + nodeInfo.setCollectionInfo(collectionInfoCompat); + nodeInfo.setScrollable(true); + */ } else if (role.equals(AccessibilityRole.ALERT)) { nodeInfo.setRoleDescription(context.getString(R.string.alert_description)); } else if (role.equals(AccessibilityRole.COMBOBOX)) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index bc7ea3d7aa18f7..9d96621d48f5f9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -109,6 +109,10 @@ public class ReactScrollView extends ScrollView new ReactScrollViewScrollState(ViewCompat.LAYOUT_DIRECTION_LTR); private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0); private PointerEvents mPointerEvents = PointerEvents.AUTO; + public String BLACK = "\u001B[47m\u001B[30m"; + public String WHITE = "\u001B[40m\u001B[37m"; + public String PURPLE = "\u001B[45m\u001B[37m"; + public String RESET = "\u001B[0m"; public ReactScrollView(Context context) { this(context, null); @@ -191,8 +195,8 @@ public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) } if (firstVisibleIndex != null && lastVisibleIndex != null) { - event.setFromIndex(firstVisibleIndex); - event.setToIndex(lastVisibleIndex); + // event.setFromIndex(firstVisibleIndex); + // event.setToIndex(lastVisibleIndex); } } } @@ -205,7 +209,6 @@ public void onInitializeAccessibilityNodeInfo( final ReactAccessibilityDelegate.AccessibilityRole accessibilityRole = (ReactAccessibilityDelegate.AccessibilityRole) host.getTag(R.id.accessibility_role); - if (accessibilityRole != null) { ReactAccessibilityDelegate.setRole(info, accessibilityRole, host.getContext()); } @@ -214,9 +217,14 @@ public void onInitializeAccessibilityNodeInfo( (ReadableMap) host.getTag(R.id.accessibility_collection_info); if (accessibilityCollectionInfo != null) { + /* int rowCount = accessibilityCollectionInfo.getInt("rowCount"); int columnCount = accessibilityCollectionInfo.getInt("columnCount"); boolean hierarchical = accessibilityCollectionInfo.getBoolean("hierarchical"); + */ + int rowCount = 10; + int columnCount = 3; + boolean hierarchical = false; AccessibilityNodeInfoCompat.CollectionInfoCompat collectionInfoCompat = AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain(