-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add getRecommendedTimeoutMillis to AccessibilityInfo #31063
Closed
grgr-dkrk
wants to merge
5
commits into
facebook:master
from
grgr-dkrk:feature/add_getRecommendedTimeoutMillis
+75
−0
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ public void onChange(boolean selfChange, Uri uri) { | |
private final ContentResolver mContentResolver; | ||
private boolean mReduceMotionEnabled = false; | ||
private boolean mTouchExplorationEnabled = false; | ||
private int mRecommendedTimeout; | ||
|
||
private static final String REDUCE_MOTION_EVENT_NAME = "reduceMotionDidChange"; | ||
private static final String TOUCH_EXPLORATION_EVENT_NAME = "touchExplorationDidChange"; | ||
|
@@ -189,4 +190,30 @@ public void announceForAccessibility(String message) { | |
public void setAccessibilityFocus(double reactTag) { | ||
// iOS only | ||
} | ||
|
||
@Override | ||
public void getRecommendedTimeoutMillis( | ||
double originalTimeout, String uiContentFlags, Callback successCallback) { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { | ||
grgr-dkrk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
successCallback.invoke((int) originalTimeout); | ||
return; | ||
} | ||
int flag = 0; | ||
switch (uiContentFlags) { | ||
case "FLAG_CONTENT_CONTROLS": | ||
flag = AccessibilityManager.FLAG_CONTENT_CONTROLS; | ||
break; | ||
case "FLAG_CONTENT_ICONS": | ||
flag = AccessibilityManager.FLAG_CONTENT_ICONS; | ||
break; | ||
case "FLAG_CONTENT_TEXT": | ||
flag = AccessibilityManager.FLAG_CONTENT_TEXT; | ||
break; | ||
default: | ||
break; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@@ -215 +215,2 @@
- mRecommendedTimeout = mAccessibilityManager.getRecommendedTimeoutMillis((int)originalTimeout, flag);
+ mRecommendedTimeout =
+ mAccessibilityManager.getRecommendedTimeoutMillis((int) originalTimeout, flag);
|
||
mRecommendedTimeout = | ||
mAccessibilityManager.getRecommendedTimeoutMillis((int) originalTimeout, flag); | ||
successCallback.invoke(mRecommendedTimeout); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should bother to surface this param in the javascript API.
Under the hood it's actually not doing anything, no matter which flag you pass in, the same value comes back. Looking through the Android source, it seems like they originally intended to have two user settings for timings, one for interactive elements, and one for static elements, but at some point this was dropped in favor of a single setting that just sets both values behind the scenes. These flags seem like a vestigial remnant of that original idea, and will likely be removed in a later API version.
@kacieb, does RN generally have a standard for when we should match a platform API strictly versus going with a simpler API if both options have the same end result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting again to request changes.