Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
236d633a
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
236d633a
编写于
7月 30, 2018
作者:
J
Jonah Williams
提交者:
GitHub
7月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add word movement granularities to android (#5902)
上级
5ae82408
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
48 addition
and
2 deletion
+48
-2
lib/ui/semantics.dart
lib/ui/semantics.dart
+24
-0
shell/platform/android/io/flutter/view/AccessibilityBridge.java
...platform/android/io/flutter/view/AccessibilityBridge.java
+24
-2
未找到文件。
lib/ui/semantics.dart
浏览文件 @
236d633a
...
...
@@ -28,6 +28,8 @@ class SemanticsAction {
static
const
int
_kDidLoseAccessibilityFocusIndex
=
1
<<
16
;
static
const
int
_kCustomAction
=
1
<<
17
;
static
const
int
_kDismissIndex
=
1
<<
18
;
static
const
int
_kMoveCursorForwardByWordIndex
=
1
<<
19
;
static
const
int
_kMoveCursorBackwardByWordIndex
=
1
<<
20
;
/// The numerical value for this action.
///
...
...
@@ -163,6 +165,22 @@ class SemanticsAction {
/// (with VoiceOver) users can perform a standard gesture to dismiss it.
static
const
SemanticsAction
dismiss
=
const
SemanticsAction
.
_
(
_kDismissIndex
);
/// Move the cursor forward by one word.
///
/// This is for example used by the cursor control in text fields.
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static
const
SemanticsAction
moveCursorForwardByWord
=
const
SemanticsAction
.
_
(
_kMoveCursorForwardByWordIndex
);
/// Move the cursor backward by one word.
///
/// This is for example used by the cursor control in text fields.
///
/// The action includes a boolean argument, which indicates whether the cursor
/// movement should extend (or start) a selection.
static
const
SemanticsAction
moveCursorBackwardByWord
=
const
SemanticsAction
.
_
(
_kMoveCursorBackwardByWordIndex
);
/// The possible semantics actions.
///
/// The map's key is the [index] of the action and the value is the action
...
...
@@ -187,6 +205,8 @@ class SemanticsAction {
_kDidLoseAccessibilityFocusIndex:
didLoseAccessibilityFocus
,
_kCustomAction:
customAction
,
_kDismissIndex:
dismiss
,
_kMoveCursorForwardByWordIndex:
moveCursorForwardByWord
,
_kMoveCursorBackwardByWordIndex:
moveCursorBackwardByWord
,
};
@override
...
...
@@ -230,6 +250,10 @@ class SemanticsAction {
return
'SemanticsAction.customAction'
;
case
_kDismissIndex:
return
'SemanticsAction.dismiss'
;
case
_kMoveCursorForwardByWordIndex:
return
'SemanticsAction.moveCursorForwardByWord'
;
case
_kMoveCursorBackwardByWordIndex:
return
'SemanticsAction.moveCursorBackwardByWord'
;
}
return
null
;
}
...
...
shell/platform/android/io/flutter/view/AccessibilityBridge.java
浏览文件 @
236d633a
...
...
@@ -63,7 +63,9 @@ class AccessibilityBridge
DID_GAIN_ACCESSIBILITY_FOCUS
(
1
<<
15
),
DID_LOSE_ACCESSIBILITY_FOCUS
(
1
<<
16
),
CUSTOM_ACTION
(
1
<<
17
),
DISMISS
(
1
<<
18
);
DISMISS
(
1
<<
18
),
MOVE_CURSOR_FORWARD_BY_WORD
(
1
<<
19
),
MOVE_CURSOR_BACKWARD_BY_WORD
(
1
<<
20
);
Action
(
int
value
)
{
this
.
value
=
value
;
...
...
@@ -172,6 +174,14 @@ class AccessibilityBridge
result
.
addAction
(
AccessibilityNodeInfo
.
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
);
granularities
|=
AccessibilityNodeInfo
.
MOVEMENT_GRANULARITY_CHARACTER
;
}
if
(
object
.
hasAction
(
Action
.
MOVE_CURSOR_FORWARD_BY_WORD
))
{
result
.
addAction
(
AccessibilityNodeInfo
.
ACTION_NEXT_AT_MOVEMENT_GRANULARITY
);
granularities
|=
AccessibilityNodeInfo
.
MOVEMENT_GRANULARITY_WORD
;
}
if
(
object
.
hasAction
(
Action
.
MOVE_CURSOR_BACKWARD_BY_WORD
))
{
result
.
addAction
(
AccessibilityNodeInfo
.
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
);
granularities
|=
AccessibilityNodeInfo
.
MOVEMENT_GRANULARITY_WORD
;
}
result
.
setMovementGranularities
(
granularities
);
}
if
(
object
.
hasAction
(
Action
.
SET_SELECTION
))
{
...
...
@@ -479,8 +489,20 @@ class AccessibilityBridge
Action
.
MOVE_CURSOR_BACKWARD_BY_CHARACTER
,
extendSelection
);
return
true
;
}
break
;
}
case
AccessibilityNodeInfo
.
MOVEMENT_GRANULARITY_WORD
:
if
(
forward
&&
object
.
hasAction
(
Action
.
MOVE_CURSOR_FORWARD_BY_WORD
))
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
Action
.
MOVE_CURSOR_FORWARD_BY_WORD
,
extendSelection
);
return
true
;
}
if
(!
forward
&&
object
.
hasAction
(
Action
.
MOVE_CURSOR_BACKWARD_BY_WORD
))
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
Action
.
MOVE_CURSOR_BACKWARD_BY_WORD
,
extendSelection
);
return
true
;
}
// TODO(goderbauer): support other granularities.
break
;
}
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录