Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
d9d5ba42
Commit
d9d5ba42
authored
10 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Fix verbalizing missing emoticons
Bug: 15585153 Change-Id: I8ae184047558d1a78e20efde0b08e40beb4458b9
parent
569f6f1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/res/values/strings-talkback-descriptions.xml
+12
-0
12 additions, 0 deletions
java/res/values/strings-talkback-descriptions.xml
java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java
+22
-1
22 additions, 1 deletion
...d/inputmethod/accessibility/KeyCodeDescriptionMapper.java
with
34 additions
and
1 deletion
java/res/values/strings-talkback-descriptions.xml
+
12
−
0
View file @
d9d5ba42
...
@@ -139,6 +139,18 @@
...
@@ -139,6 +139,18 @@
<string
name=
"spoken_symbol_unknown"
>
Unknown symbol
</string>
<string
name=
"spoken_symbol_unknown"
>
Unknown symbol
</string>
<!-- Spoken description for unknown emoji code point. -->
<!-- Spoken description for unknown emoji code point. -->
<string
name=
"spoken_emoji_unknown"
>
Unknown emoji
</string>
<string
name=
"spoken_emoji_unknown"
>
Unknown emoji
</string>
<!-- Spoken description for emoticons ":-!". -->
<string
name=
"spoken_emoticon_3A_2D_21_20"
>
Bored face
</string>
<!-- Spoken description for emoticons ":-$". -->
<string
name=
"spoken_emoticon_3A_2D_24_20"
>
Embarrassed face
</string>
<!-- Spoken description for emoticons "B-)". -->
<string
name=
"spoken_emoticon_42_2D_29_20"
>
Face wearing sunglasses
</string>
<!-- Spoken description for emoticons ":O". -->
<string
name=
"spoken_emoticon_3A_4F_20"
>
Surprised face
</string>
<!-- Spoken description for emoticons ":-*". -->
<string
name=
"spoken_emoticon_3A_2D_2A_20"
>
Kissing face
</string>
<!-- Spoken description for emoticons ":-[". -->
<string
name=
"spoken_emoticon_3A_2D_5B_20"
>
Frowning face
</string>
<!-- Spoken descriptions when opening a more keys keyboard that has alternative characters. -->
<!-- Spoken descriptions when opening a more keys keyboard that has alternative characters. -->
<string
name=
"spoken_open_more_keys_keyboard"
>
Alternative characters are available
</string>
<string
name=
"spoken_open_more_keys_keyboard"
>
Alternative characters are available
</string>
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java
+
22
−
1
View file @
d9d5ba42
...
@@ -37,6 +37,8 @@ final class KeyCodeDescriptionMapper {
...
@@ -37,6 +37,8 @@ final class KeyCodeDescriptionMapper {
private
static
final
String
SPOKEN_LETTER_RESOURCE_NAME_FORMAT
=
"spoken_accented_letter_%04X"
;
private
static
final
String
SPOKEN_LETTER_RESOURCE_NAME_FORMAT
=
"spoken_accented_letter_%04X"
;
private
static
final
String
SPOKEN_SYMBOL_RESOURCE_NAME_FORMAT
=
"spoken_symbol_%04X"
;
private
static
final
String
SPOKEN_SYMBOL_RESOURCE_NAME_FORMAT
=
"spoken_symbol_%04X"
;
private
static
final
String
SPOKEN_EMOJI_RESOURCE_NAME_FORMAT
=
"spoken_emoji_%04X"
;
private
static
final
String
SPOKEN_EMOJI_RESOURCE_NAME_FORMAT
=
"spoken_emoji_%04X"
;
private
static
final
String
SPOKEN_EMOTICON_RESOURCE_NAME_PREFIX
=
"spoken_emoticon"
;
private
static
final
String
SPOKEN_EMOTICON_CODE_POINT_FORMAT
=
"_%02X"
;
// The resource ID of the string spoken for obscured keys
// The resource ID of the string spoken for obscured keys
private
static
final
int
OBSCURED_KEY_RES_ID
=
R
.
string
.
spoken_description_dot
;
private
static
final
int
OBSCURED_KEY_RES_ID
=
R
.
string
.
spoken_description_dot
;
...
@@ -109,7 +111,9 @@ final class KeyCodeDescriptionMapper {
...
@@ -109,7 +111,9 @@ final class KeyCodeDescriptionMapper {
}
}
if
(
code
==
Constants
.
CODE_OUTPUT_TEXT
)
{
if
(
code
==
Constants
.
CODE_OUTPUT_TEXT
)
{
return
key
.
getOutputText
();
final
String
outputText
=
key
.
getOutputText
();
final
String
description
=
getSpokenEmoticonDescription
(
context
,
outputText
);
return
TextUtils
.
isEmpty
(
description
)
?
outputText
:
description
;
}
}
// Just attempt to speak the description.
// Just attempt to speak the description.
...
@@ -340,4 +344,21 @@ final class KeyCodeDescriptionMapper {
...
@@ -340,4 +344,21 @@ final class KeyCodeDescriptionMapper {
}
}
return
resId
;
return
resId
;
}
}
// TODO: Remove this method once TTS supports emoticon verbalization.
private
String
getSpokenEmoticonDescription
(
final
Context
context
,
final
String
outputText
)
{
final
StringBuilder
sb
=
new
StringBuilder
(
SPOKEN_EMOTICON_RESOURCE_NAME_PREFIX
);
final
int
textLength
=
outputText
.
length
();
for
(
int
index
=
0
;
index
<
textLength
;
index
=
outputText
.
offsetByCodePoints
(
index
,
1
))
{
final
int
codePoint
=
outputText
.
codePointAt
(
index
);
sb
.
append
(
String
.
format
(
Locale
.
ROOT
,
SPOKEN_EMOTICON_CODE_POINT_FORMAT
,
codePoint
));
}
final
String
resourceName
=
sb
.
toString
();
final
Resources
resources
=
context
.
getResources
();
// Note that the resource package name may differ from the context package name.
final
String
resourcePackageName
=
resources
.
getResourcePackageName
(
R
.
string
.
spoken_description_unknown
);
final
int
resId
=
resources
.
getIdentifier
(
resourceName
,
"string"
,
resourcePackageName
);
return
(
resId
==
0
)
?
null
:
resources
.
getString
(
resId
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment