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
bd84a00f
Commit
bd84a00f
authored
11 years ago
by
Satoshi Kataoka
Browse files
Options
Downloads
Patches
Plain Diff
Open an API in ExternalDictionaryGetterForDebug
and extend it Change-Id: Id2ba8dd8928a6327d3b31eb35f7cc314e2d31050
parent
d9e08bee
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/ExternalDictionaryGetterForDebug.java
+24
-4
24 additions, 4 deletions
...d/inputmethod/latin/ExternalDictionaryGetterForDebug.java
with
24 additions
and
4 deletions
java/src/com/android/inputmethod/latin/ExternalDictionaryGetterForDebug.java
+
24
−
4
View file @
bd84a00f
...
...
@@ -19,6 +19,7 @@ package com.android.inputmethod.latin;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface.OnCancelListener
;
import
android.content.DialogInterface.OnClickListener
;
import
android.os.Environment
;
...
...
@@ -59,7 +60,7 @@ public class ExternalDictionaryGetterForDebug {
if
(
0
==
fileNames
.
length
)
{
showNoFileDialog
(
context
);
}
else
if
(
1
==
fileNames
.
length
)
{
askInstallFile
(
context
,
fileNames
[
0
]
);
askInstallFile
(
context
,
SOURCE_FOLDER
,
fileNames
[
0
],
null
/* completeRunnable */
);
}
else
{
showChooseFileDialog
(
context
,
fileNames
);
}
...
...
@@ -82,14 +83,19 @@ public class ExternalDictionaryGetterForDebug {
.
setItems
(
fileNames
,
new
OnClickListener
()
{
@Override
public
void
onClick
(
final
DialogInterface
dialog
,
final
int
which
)
{
askInstallFile
(
context
,
fileNames
[
which
]);
askInstallFile
(
context
,
SOURCE_FOLDER
,
fileNames
[
which
],
null
/* completeRunnable */
);
}
})
.
create
().
show
();
}
private
static
void
askInstallFile
(
final
Context
context
,
final
String
fileName
)
{
final
File
file
=
new
File
(
SOURCE_FOLDER
,
fileName
.
toString
());
/**
* Shows a dialog which offers the user to install the external dictionary.
*/
public
static
void
askInstallFile
(
final
Context
context
,
final
String
dirPath
,
final
String
fileName
,
final
Runnable
completeRunnable
)
{
final
File
file
=
new
File
(
dirPath
,
fileName
.
toString
());
final
FileHeader
header
=
DictionaryInfoUtils
.
getDictionaryFileHeaderOrNull
(
file
);
final
StringBuilder
message
=
new
StringBuilder
();
final
String
locale
=
header
.
getLocaleString
();
...
...
@@ -109,12 +115,26 @@ public class ExternalDictionaryGetterForDebug {
@Override
public
void
onClick
(
final
DialogInterface
dialog
,
final
int
which
)
{
dialog
.
dismiss
();
if
(
completeRunnable
!=
null
)
{
completeRunnable
.
run
();
}
}
}).
setPositiveButton
(
android
.
R
.
string
.
ok
,
new
OnClickListener
()
{
@Override
public
void
onClick
(
final
DialogInterface
dialog
,
final
int
which
)
{
installFile
(
context
,
file
,
header
);
dialog
.
dismiss
();
if
(
completeRunnable
!=
null
)
{
completeRunnable
.
run
();
}
}
}).
setOnCancelListener
(
new
OnCancelListener
()
{
@Override
public
void
onCancel
(
DialogInterface
dialog
)
{
// Canceled by the user by hitting the back key
if
(
completeRunnable
!=
null
)
{
completeRunnable
.
run
();
}
}
}).
create
().
show
();
}
...
...
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