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
b9590566
Commit
b9590566
authored
13 years ago
by
satok
Browse files
Options
Downloads
Patches
Plain Diff
Refactor reflection member
Change-Id: I112dbf851e10dae9e4291cf440f01b28d51180f4
parent
ec52fb6d
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/compat/SuggestionSpanUtils.java
+7
-7
7 additions, 7 deletions
...c/com/android/inputmethod/compat/SuggestionSpanUtils.java
with
7 additions
and
7 deletions
java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
+
7
−
7
View file @
b9590566
...
@@ -50,19 +50,19 @@ public class SuggestionSpanUtils {
...
@@ -50,19 +50,19 @@ public class SuggestionSpanUtils {
.
getConstructor
(
CLASS_SuggestionSpan
,
INPUT_TYPE_SuggestionSpan
);
.
getConstructor
(
CLASS_SuggestionSpan
,
INPUT_TYPE_SuggestionSpan
);
public
static
final
Field
FIELD_FLAG_AUTO_CORRECTION
public
static
final
Field
FIELD_FLAG_AUTO_CORRECTION
=
CompatUtils
.
getField
(
CLASS_SuggestionSpan
,
"FLAG_AUTO_CORRECTION"
);
=
CompatUtils
.
getField
(
CLASS_SuggestionSpan
,
"FLAG_AUTO_CORRECTION"
);
public
static
final
Field
FIELD_SUGGESTION_MAX_SIZE
public
static
final
Field
FIELD_SUGGESTION
S
_MAX_SIZE
=
CompatUtils
.
getField
(
CLASS_SuggestionSpan
,
"SUGGESTIONS_MAX_SIZE"
);
=
CompatUtils
.
getField
(
CLASS_SuggestionSpan
,
"SUGGESTIONS_MAX_SIZE"
);
public
static
final
Integer
OBJ_FLAG_AUTO_CORRECTION
=
(
Integer
)
CompatUtils
public
static
final
Integer
OBJ_FLAG_AUTO_CORRECTION
=
(
Integer
)
CompatUtils
.
getFieldValue
(
null
,
null
,
FIELD_FLAG_AUTO_CORRECTION
);;
.
getFieldValue
(
null
,
null
,
FIELD_FLAG_AUTO_CORRECTION
);;
public
static
final
Integer
OBJ_SUGGESTION_MAX_SIZE
=
(
Integer
)
CompatUtils
public
static
final
Integer
OBJ_SUGGESTION
S
_MAX_SIZE
=
(
Integer
)
CompatUtils
.
getFieldValue
(
null
,
null
,
FIELD_SUGGESTION_MAX_SIZE
);;
.
getFieldValue
(
null
,
null
,
FIELD_SUGGESTION
S
_MAX_SIZE
);;
static
{
static
{
SUGGESTION_SPAN_IS_SUPPORTED
=
SUGGESTION_SPAN_IS_SUPPORTED
=
CLASS_SuggestionSpan
!=
null
&&
CONSTRUCTOR_SuggestionSpan
!=
null
;
CLASS_SuggestionSpan
!=
null
&&
CONSTRUCTOR_SuggestionSpan
!=
null
;
if
(
LatinImeLogger
.
sDBG
)
{
if
(
LatinImeLogger
.
sDBG
)
{
if
(
SUGGESTION_SPAN_IS_SUPPORTED
if
(
SUGGESTION_SPAN_IS_SUPPORTED
&&
(
OBJ_FLAG_AUTO_CORRECTION
==
null
||
OBJ_SUGGESTION_MAX_SIZE
==
null
))
{
&&
(
OBJ_FLAG_AUTO_CORRECTION
==
null
||
OBJ_SUGGESTION
S
_MAX_SIZE
==
null
))
{
throw
new
RuntimeException
(
"Field is accidentially null."
);
throw
new
RuntimeException
(
"Field is accidentially null."
);
}
}
}
}
...
@@ -71,7 +71,7 @@ public class SuggestionSpanUtils {
...
@@ -71,7 +71,7 @@ public class SuggestionSpanUtils {
public
static
CharSequence
getTextWithAutoCorrectionIndicatorUnderline
(
public
static
CharSequence
getTextWithAutoCorrectionIndicatorUnderline
(
Context
context
,
CharSequence
text
)
{
Context
context
,
CharSequence
text
)
{
if
(
TextUtils
.
isEmpty
(
text
)
||
CONSTRUCTOR_SuggestionSpan
==
null
if
(
TextUtils
.
isEmpty
(
text
)
||
CONSTRUCTOR_SuggestionSpan
==
null
||
OBJ_FLAG_AUTO_CORRECTION
==
null
||
OBJ_SUGGESTION_MAX_SIZE
==
null
)
{
||
OBJ_FLAG_AUTO_CORRECTION
==
null
||
OBJ_SUGGESTION
S
_MAX_SIZE
==
null
)
{
return
text
;
return
text
;
}
}
final
Spannable
spannable
=
text
instanceof
Spannable
final
Spannable
spannable
=
text
instanceof
Spannable
...
@@ -94,7 +94,7 @@ public class SuggestionSpanUtils {
...
@@ -94,7 +94,7 @@ public class SuggestionSpanUtils {
if
(
TextUtils
.
isEmpty
(
pickedWord
)
||
CONSTRUCTOR_SuggestionSpan
==
null
if
(
TextUtils
.
isEmpty
(
pickedWord
)
||
CONSTRUCTOR_SuggestionSpan
==
null
||
suggestedWords
==
null
||
suggestedWords
.
size
()
==
0
||
suggestedWords
==
null
||
suggestedWords
.
size
()
==
0
||
suggestedWords
.
getInfo
(
0
).
isObsoleteSuggestedWord
()
||
suggestedWords
.
getInfo
(
0
).
isObsoleteSuggestedWord
()
||
OBJ_SUGGESTION_MAX_SIZE
==
null
)
{
||
OBJ_SUGGESTION
S
_MAX_SIZE
==
null
)
{
return
pickedWord
;
return
pickedWord
;
}
}
...
@@ -106,7 +106,7 @@ public class SuggestionSpanUtils {
...
@@ -106,7 +106,7 @@ public class SuggestionSpanUtils {
}
}
final
ArrayList
<
String
>
suggestionsList
=
new
ArrayList
<
String
>();
final
ArrayList
<
String
>
suggestionsList
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
i
<
suggestedWords
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
suggestedWords
.
size
();
++
i
)
{
if
(
suggestionsList
.
size
()
>=
OBJ_SUGGESTION_MAX_SIZE
)
{
if
(
suggestionsList
.
size
()
>=
OBJ_SUGGESTION
S
_MAX_SIZE
)
{
break
;
break
;
}
}
final
CharSequence
word
=
suggestedWords
.
getWord
(
i
);
final
CharSequence
word
=
suggestedWords
.
getWord
(
i
);
...
...
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