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
a32eb272
Commit
a32eb272
authored
12 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Move an editing method to the RichInputConnection
Change-Id: Ie143ad008ca8deb1c5034cb80ec1cb28a6b0682d
parent
243e370f
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/src/com/android/inputmethod/latin/LatinIME.java
+1
-24
1 addition, 24 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
java/src/com/android/inputmethod/latin/RichInputConnection.java
+23
-0
23 additions, 0 deletions
...rc/com/android/inputmethod/latin/RichInputConnection.java
with
24 additions
and
24 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
+
1
−
24
View file @
a32eb272
...
@@ -1395,7 +1395,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
...
@@ -1395,7 +1395,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
if
(
SPACE_STATE_DOUBLE
==
spaceState
)
{
if
(
SPACE_STATE_DOUBLE
==
spaceState
)
{
mHandler
.
cancelDoubleSpacesTimer
();
mHandler
.
cancelDoubleSpacesTimer
();
if
(
revertDoubleSpace
WhileInBatchEdit
())
{
if
(
mConnection
.
revertDoubleSpace
())
{
// No need to reset mSpaceState, it has already be done (that's why we
// No need to reset mSpaceState, it has already be done (that's why we
// receive it as a parameter)
// receive it as a parameter)
return
;
return
;
...
@@ -2075,29 +2075,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
...
@@ -2075,29 +2075,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler
.
postUpdateSuggestions
();
mHandler
.
postUpdateSuggestions
();
}
}
private
boolean
revertDoubleSpaceWhileInBatchEdit
()
{
// Here we test whether we indeed have a period and a space before us. This should not
// be needed, but it's there just in case something went wrong.
final
CharSequence
textBeforeCursor
=
mConnection
.
getTextBeforeCursor
(
2
,
0
);
if
(!
". "
.
equals
(
textBeforeCursor
))
{
// Theoretically we should not be coming here if there isn't ". " before the
// cursor, but the application may be changing the text while we are typing, so
// anything goes. We should not crash.
Log
.
d
(
TAG
,
"Tried to revert double-space combo but we didn't find "
+
"\". \" just before the cursor."
);
return
false
;
}
mConnection
.
deleteSurroundingText
(
2
,
0
);
if
(
ProductionFlag
.
IS_EXPERIMENTAL
)
{
ResearchLogger
.
latinIME_deleteSurroundingText
(
2
);
}
mConnection
.
commitText
(
" "
,
1
);
if
(
ProductionFlag
.
IS_EXPERIMENTAL
)
{
ResearchLogger
.
latinIME_revertDoubleSpaceWhileInBatchEdit
();
}
return
true
;
}
private
boolean
revertSwapPunctuation
()
{
private
boolean
revertSwapPunctuation
()
{
// Here we test whether we indeed have a space and something else before us. This should not
// Here we test whether we indeed have a space and something else before us. This should not
// be needed, but it's there just in case something went wrong.
// be needed, but it's there just in case something went wrong.
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/RichInputConnection.java
+
23
−
0
View file @
a32eb272
...
@@ -370,4 +370,27 @@ public class RichInputConnection {
...
@@ -370,4 +370,27 @@ public class RichInputConnection {
return
word
;
return
word
;
}
}
public
boolean
revertDoubleSpace
()
{
// Here we test whether we indeed have a period and a space before us. This should not
// be needed, but it's there just in case something went wrong.
final
CharSequence
textBeforeCursor
=
getTextBeforeCursor
(
2
,
0
);
if
(!
". "
.
equals
(
textBeforeCursor
))
{
// Theoretically we should not be coming here if there isn't ". " before the
// cursor, but the application may be changing the text while we are typing, so
// anything goes. We should not crash.
Log
.
d
(
TAG
,
"Tried to revert double-space combo but we didn't find "
+
"\". \" just before the cursor."
);
return
false
;
}
deleteSurroundingText
(
2
,
0
);
if
(
ProductionFlag
.
IS_EXPERIMENTAL
)
{
ResearchLogger
.
latinIME_deleteSurroundingText
(
2
);
}
commitText
(
" "
,
1
);
if
(
ProductionFlag
.
IS_EXPERIMENTAL
)
{
ResearchLogger
.
latinIME_revertDoubleSpaceWhileInBatchEdit
();
}
return
true
;
}
}
}
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