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
428d1b64
Commit
428d1b64
authored
12 years ago
by
Tadashi G. Takaoka
Committed by
Android Git Automerger
12 years ago
Browse files
Options
Downloads
Plain Diff
am
4826c3ff
: Merge "Fix language switch key behavior (DO NOT MERGE)" into jb-mr1.1-dev
* commit '
4826c3ff
': Fix language switch key behavior (DO NOT MERGE)
parents
36c6e293
4826c3ff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+8
-0
8 additions, 0 deletions
...d/inputmethod/compat/InputMethodManagerCompatWrapper.java
java/src/com/android/inputmethod/latin/LatinIME.java
+31
-16
31 additions, 16 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
with
39 additions
and
16 deletions
java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+
8
−
0
View file @
428d1b64
...
@@ -52,6 +52,10 @@ public final class InputMethodManagerCompatWrapper {
...
@@ -52,6 +52,10 @@ public final class InputMethodManagerCompatWrapper {
sInstance
.
mImm
=
ImfUtils
.
getInputMethodManager
(
context
);
sInstance
.
mImm
=
ImfUtils
.
getInputMethodManager
(
context
);
}
}
public
InputMethodSubtype
getCurrentInputMethodSubtype
()
{
return
mImm
.
getCurrentInputMethodSubtype
();
}
public
InputMethodSubtype
getLastInputMethodSubtype
()
{
public
InputMethodSubtype
getLastInputMethodSubtype
()
{
return
mImm
.
getLastInputMethodSubtype
();
return
mImm
.
getLastInputMethodSubtype
();
}
}
...
@@ -65,6 +69,10 @@ public final class InputMethodManagerCompatWrapper {
...
@@ -65,6 +69,10 @@ public final class InputMethodManagerCompatWrapper {
onlyCurrentIme
);
onlyCurrentIme
);
}
}
public
void
setInputMethodAndSubtype
(
IBinder
token
,
String
id
,
InputMethodSubtype
subtype
)
{
mImm
.
setInputMethodAndSubtype
(
token
,
id
,
subtype
);
}
public
void
showInputMethodPicker
()
{
public
void
showInputMethodPicker
()
{
mImm
.
showInputMethodPicker
();
mImm
.
showInputMethodPicker
();
}
}
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/LatinIME.java
+
31
−
16
View file @
428d1b64
...
@@ -141,7 +141,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -141,7 +141,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private
SharedPreferences
mPrefs
;
private
SharedPreferences
mPrefs
;
/* package for tests */
final
KeyboardSwitcher
mKeyboardSwitcher
;
/* package for tests */
final
KeyboardSwitcher
mKeyboardSwitcher
;
private
final
SubtypeSwitcher
mSubtypeSwitcher
;
private
final
SubtypeSwitcher
mSubtypeSwitcher
;
private
boolean
mShouldSwitchToLastSubtype
=
true
;
private
final
SubtypeState
mSubtypeState
=
new
SubtypeState
()
;
private
boolean
mIsMainDictionaryAvailable
;
private
boolean
mIsMainDictionaryAvailable
;
private
UserBinaryDictionary
mUserDictionary
;
private
UserBinaryDictionary
mUserDictionary
;
...
@@ -365,6 +365,34 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -365,6 +365,34 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
}
}
}
}
static
final
class
SubtypeState
{
private
InputMethodSubtype
mLastActiveSubtype
;
private
boolean
mCurrentSubtypeUsed
;
public
void
currentSubtypeUsed
()
{
mCurrentSubtypeUsed
=
true
;
}
public
void
switchSubtype
(
final
IBinder
token
,
final
InputMethodManagerCompatWrapper
imm
,
final
Context
context
)
{
final
InputMethodSubtype
currentSubtype
=
imm
.
getCurrentInputMethodSubtype
();
final
InputMethodSubtype
lastActiveSubtype
=
mLastActiveSubtype
;
final
boolean
currentSubtypeUsed
=
mCurrentSubtypeUsed
;
if
(
currentSubtypeUsed
)
{
mLastActiveSubtype
=
currentSubtype
;
mCurrentSubtypeUsed
=
false
;
}
if
(
currentSubtypeUsed
&&
ImfUtils
.
checkIfSubtypeBelongsToThisImeAndEnabled
(
context
,
lastActiveSubtype
)
&&
!
currentSubtype
.
equals
(
lastActiveSubtype
))
{
final
String
id
=
ImfUtils
.
getInputMethodIdOfThisIme
(
context
);
imm
.
setInputMethodAndSubtype
(
token
,
id
,
lastActiveSubtype
);
return
;
}
imm
.
switchToNextInputMethod
(
token
,
true
/* onlyCurrentIme */
);
}
}
public
LatinIME
()
{
public
LatinIME
()
{
super
();
super
();
mSubtypeSwitcher
=
SubtypeSwitcher
.
getInstance
();
mSubtypeSwitcher
=
SubtypeSwitcher
.
getInstance
();
...
@@ -887,6 +915,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -887,6 +915,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Make a note of the cursor position
// Make a note of the cursor position
mLastSelectionStart
=
newSelStart
;
mLastSelectionStart
=
newSelStart
;
mLastSelectionEnd
=
newSelEnd
;
mLastSelectionEnd
=
newSelEnd
;
mSubtypeState
.
currentSubtypeUsed
();
}
}
/**
/**
...
@@ -1235,19 +1264,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -1235,19 +1264,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mImm
.
switchToNextInputMethod
(
token
,
false
/* onlyCurrentIme */
);
mImm
.
switchToNextInputMethod
(
token
,
false
/* onlyCurrentIme */
);
return
;
return
;
}
}
if
(
mShouldSwitchToLastSubtype
)
{
mSubtypeState
.
switchSubtype
(
token
,
mImm
,
this
);
final
InputMethodSubtype
lastSubtype
=
mImm
.
getLastInputMethodSubtype
();
final
boolean
lastSubtypeBelongsToThisIme
=
ImfUtils
.
checkIfSubtypeBelongsToThisImeAndEnabled
(
this
,
lastSubtype
);
if
(
lastSubtypeBelongsToThisIme
&&
mImm
.
switchToLastInputMethod
(
token
))
{
mShouldSwitchToLastSubtype
=
false
;
}
else
{
mImm
.
switchToNextInputMethod
(
token
,
true
/* onlyCurrentIme */
);
mShouldSwitchToLastSubtype
=
true
;
}
}
else
{
mImm
.
switchToNextInputMethod
(
token
,
true
/* onlyCurrentIme */
);
}
}
}
private
void
sendDownUpKeyEventForBackwardCompatibility
(
final
int
code
)
{
private
void
sendDownUpKeyEventForBackwardCompatibility
(
final
int
code
)
{
...
@@ -1316,7 +1333,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -1316,7 +1333,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
handleBackspace
(
spaceState
);
handleBackspace
(
spaceState
);
mDeleteCount
++;
mDeleteCount
++;
mExpectingUpdateSelection
=
true
;
mExpectingUpdateSelection
=
true
;
mShouldSwitchToLastSubtype
=
true
;
LatinImeLogger
.
logOnDelete
(
x
,
y
);
LatinImeLogger
.
logOnDelete
(
x
,
y
);
break
;
break
;
case
Keyboard
.
CODE_SHIFT
:
case
Keyboard
.
CODE_SHIFT
:
...
@@ -1372,7 +1388,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -1372,7 +1388,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
handleCharacter
(
primaryCode
,
keyX
,
keyY
,
spaceState
);
handleCharacter
(
primaryCode
,
keyX
,
keyY
,
spaceState
);
}
}
mExpectingUpdateSelection
=
true
;
mExpectingUpdateSelection
=
true
;
mShouldSwitchToLastSubtype
=
true
;
break
;
break
;
}
}
switcher
.
onCodeInput
(
primaryCode
);
switcher
.
onCodeInput
(
primaryCode
);
...
...
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