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
b0e0c5a8
Commit
b0e0c5a8
authored
11 years ago
by
Tadashi G. Takaoka
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Defer getting no language subtype"
parents
d3c283d5
254b484e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+20
-12
20 additions, 12 deletions
java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
with
20 additions
and
12 deletions
java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+
20
−
12
View file @
b0e0c5a8
...
...
@@ -43,20 +43,23 @@ public final class SubtypeSwitcher {
private
static
final
String
TAG
=
SubtypeSwitcher
.
class
.
getSimpleName
();
private
static
final
SubtypeSwitcher
sInstance
=
new
SubtypeSwitcher
();
private
/* final */
RichInputMethodManager
mRichImm
;
private
/* final */
Resources
mResources
;
private
/* final */
ConnectivityManager
mConnectivityManager
;
/*-----------------------------------------------------------*/
// Variants which should be changed only by reload functions.
private
NeedsToDisplayLanguage
mNeedsToDisplayLanguage
=
new
NeedsToDisplayLanguage
();
private
final
NeedsToDisplayLanguage
mNeedsToDisplayLanguage
=
new
NeedsToDisplayLanguage
();
private
InputMethodInfo
mShortcutInputMethodInfo
;
private
InputMethodSubtype
mShortcutSubtype
;
private
InputMethodSubtype
mNoLanguageSubtype
;
/*-----------------------------------------------------------*/
private
boolean
mIsNetworkConnected
;
// Dummy no language QWERTY subtype. See {@link R.xml.method}.
private
static
final
InputMethodSubtype
DUMMY_NO_LANGUAGE_SUBTYPE
=
new
InputMethodSubtype
(
R
.
string
.
subtype_no_language_qwerty
,
R
.
drawable
.
ic_subtype_keyboard
,
"zz"
,
"keyboard"
,
"KeyboardLayoutSet=qwerty,AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable"
,
false
/* isAuxiliary */
,
false
/* overridesImplicitlyEnabledSubtype */
);
static
final
class
NeedsToDisplayLanguage
{
private
int
mEnabledSubtypeCount
;
private
boolean
mIsSystemLanguageSameAsInputLanguage
;
...
...
@@ -96,11 +99,6 @@ public final class SubtypeSwitcher {
mRichImm
=
RichInputMethodManager
.
getInstance
();
mConnectivityManager
=
(
ConnectivityManager
)
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
mNoLanguageSubtype
=
mRichImm
.
findSubtypeByLocaleAndKeyboardLayoutSet
(
SubtypeLocale
.
NO_LANGUAGE
,
SubtypeLocale
.
QWERTY
);
if
(
mNoLanguageSubtype
==
null
)
{
throw
new
RuntimeException
(
"Can't find no lanugage with QWERTY subtype"
);
}
final
NetworkInfo
info
=
mConnectivityManager
.
getActiveNetworkInfo
();
mIsNetworkConnected
=
(
info
!=
null
&&
info
.
isConnected
());
...
...
@@ -255,10 +253,20 @@ public final class SubtypeSwitcher {
}
public
InputMethodSubtype
getCurrentSubtype
()
{
return
mRichImm
.
getCurrentInputMethodSubtype
(
m
NoLanguageSubtype
);
return
mRichImm
.
getCurrentInputMethodSubtype
(
get
NoLanguageSubtype
()
);
}
public
InputMethodSubtype
getNoLanguageSubtype
()
{
return
mNoLanguageSubtype
;
if
(
mNoLanguageSubtype
==
null
)
{
mNoLanguageSubtype
=
mRichImm
.
findSubtypeByLocaleAndKeyboardLayoutSet
(
SubtypeLocale
.
NO_LANGUAGE
,
SubtypeLocale
.
QWERTY
);
}
if
(
mNoLanguageSubtype
!=
null
)
{
return
mNoLanguageSubtype
;
}
Log
.
w
(
TAG
,
"Can't find no lanugage with QWERTY subtype"
);
Log
.
w
(
TAG
,
"No input method subtype found; return dummy subtype: "
+
DUMMY_NO_LANGUAGE_SUBTYPE
);
return
DUMMY_NO_LANGUAGE_SUBTYPE
;
}
}
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