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
e2651aa4
Commit
e2651aa4
authored
10 years ago
by
Tadashi G. Takaoka
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Announce keyboard language when TalkBack is on"
parents
3d658a63
3cf75907
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
+40
-20
40 additions, 20 deletions
...nputmethod/accessibility/AccessibleKeyboardViewProxy.java
with
40 additions
and
20 deletions
java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
+
40
−
20
View file @
e2651aa4
...
@@ -35,6 +35,7 @@ import com.android.inputmethod.keyboard.Keyboard;
...
@@ -35,6 +35,7 @@ import com.android.inputmethod.keyboard.Keyboard;
import
com.android.inputmethod.keyboard.KeyboardId
;
import
com.android.inputmethod.keyboard.KeyboardId
;
import
com.android.inputmethod.keyboard.MainKeyboardView
;
import
com.android.inputmethod.keyboard.MainKeyboardView
;
import
com.android.inputmethod.latin.R
;
import
com.android.inputmethod.latin.R
;
import
com.android.inputmethod.latin.utils.SubtypeLocaleUtils
;
public
final
class
AccessibleKeyboardViewProxy
extends
AccessibilityDelegateCompat
{
public
final
class
AccessibleKeyboardViewProxy
extends
AccessibilityDelegateCompat
{
private
static
final
AccessibleKeyboardViewProxy
sInstance
=
new
AccessibleKeyboardViewProxy
();
private
static
final
AccessibleKeyboardViewProxy
sInstance
=
new
AccessibleKeyboardViewProxy
();
...
@@ -67,8 +68,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
...
@@ -67,8 +68,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
private
int
mEdgeSlop
;
private
int
mEdgeSlop
;
/** The most recently set keyboard mode. */
/** The most recently set keyboard mode. */
private
int
mLastKeyboardMode
;
private
int
mLastKeyboardMode
=
KEYBOARD_IS_HIDDEN
;
private
static
final
int
NOT_A_
KEYBOARD_
MO
DE
=
-
1
;
private
static
final
int
KEYBOARD_
IS_HID
DE
N
=
-
1
;
public
static
void
init
(
final
InputMethodService
inputMethod
)
{
public
static
void
init
(
final
InputMethodService
inputMethod
)
{
sInstance
.
initInternal
(
inputMethod
);
sInstance
.
initInternal
(
inputMethod
);
...
@@ -124,20 +125,27 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
...
@@ -124,20 +125,27 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
if
(
keyboard
==
null
)
{
if
(
keyboard
==
null
)
{
return
;
return
;
}
}
mKeyboard
=
keyboard
;
if
(
mAccessibilityNodeProvider
!=
null
)
{
if
(
mAccessibilityNodeProvider
!=
null
)
{
mAccessibilityNodeProvider
.
setKeyboard
(
keyboard
);
mAccessibilityNodeProvider
.
setKeyboard
(
keyboard
);
}
}
final
int
keyboardMode
=
keyboard
.
mId
.
mMode
;
final
Keyboard
lastKeyboard
=
mKeyboard
;
final
int
lastKeyboardMode
=
mLastKeyboardMode
;
mKeyboard
=
keyboard
;
mLastKeyboardMode
=
keyboard
.
mId
.
mMode
;
// Since this method is called even when accessibility is off, make sure
// Since this method is called even when accessibility is off, make sure
// to check the state before announcing anything. Also, don't announce
// to check the state before announcing anything.
// changes within the same mode.
if
(!
AccessibilityUtils
.
getInstance
().
isAccessibilityEnabled
())
{
if
(
AccessibilityUtils
.
getInstance
().
isAccessibilityEnabled
()
return
;
&&
(
mLastKeyboardMode
!=
keyboardMode
))
{
}
announceKeyboardMode
(
keyboardMode
);
// Announce the language name only when the language is changed.
if
(
lastKeyboard
==
null
||
!
lastKeyboard
.
mId
.
mSubtype
.
equals
(
keyboard
.
mId
.
mSubtype
))
{
announceKeyboardLanguage
(
keyboard
);
}
// Announce the mode only when the mode is changed.
if
(
lastKeyboardMode
!=
keyboard
.
mId
.
mMode
)
{
announceKeyboardMode
(
keyboard
);
}
}
mLastKeyboardMode
=
keyboardMode
;
}
}
/**
/**
...
@@ -148,23 +156,35 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
...
@@ -148,23 +156,35 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
return
;
return
;
}
}
announceKeyboardHidden
();
announceKeyboardHidden
();
mLastKeyboardMode
=
NOT_A_KEYBOARD_MODE
;
mLastKeyboardMode
=
KEYBOARD_IS_HIDDEN
;
}
/**
* Announces which language of keyboard is being displayed.
*
* @param keyboard The new keyboard.
*/
private
void
announceKeyboardLanguage
(
final
Keyboard
keyboard
)
{
final
String
languageText
=
SubtypeLocaleUtils
.
getSubtypeDisplayNameInSystemLocale
(
keyboard
.
mId
.
mSubtype
);
sendWindowStateChanged
(
languageText
);
}
}
/**
/**
* Announces which type of keyboard is being displayed.
If the keyboard type
* Announces which type of keyboard is being displayed.
* is unknown, no announcement is made.
*
If the keyboard type
is unknown, no announcement is made.
*
*
* @param
mode
The new keyboard
mode
.
* @param
keyboard
The new keyboard.
*/
*/
private
void
announceKeyboardMode
(
final
int
mode
)
{
private
void
announceKeyboardMode
(
final
Keyboard
keyboard
)
{
final
int
resId
=
KEYBOARD_MODE_RES_IDS
.
get
(
mode
);
final
int
mode
=
keyboard
.
mId
.
mMode
;
if
(
resId
==
0
)
{
final
Context
context
=
mView
.
getContext
();
final
int
modeTextResId
=
KEYBOARD_MODE_RES_IDS
.
get
(
mode
);
if
(
modeTextResId
==
0
)
{
return
;
return
;
}
}
final
Context
context
=
mView
.
getContext
();
final
String
modeText
=
context
.
getString
(
modeTextResId
);
final
String
keyboardMode
=
context
.
getString
(
resId
);
final
String
text
=
context
.
getString
(
R
.
string
.
announce_keyboard_mode
,
modeText
);
final
String
text
=
context
.
getString
(
R
.
string
.
announce_keyboard_mode
,
keyboardMode
);
sendWindowStateChanged
(
text
);
sendWindowStateChanged
(
text
);
}
}
...
...
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