mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
fix(android): address code review comments
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
parent
70282bfd5b
commit
71aefb8f47
1 changed files with 15 additions and 7 deletions
|
|
@ -804,10 +804,20 @@ final class KMKeyboard extends WebView {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the root URL for the data folder. Even though this is a local
|
||||
* location this returns a URL with a magic domain so that it can be
|
||||
* loaded with fetch() in the webview.
|
||||
*/
|
||||
private String getDataRootUrl() {
|
||||
return WebViewUtils.buildAssetUrl("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the root path for the data folder as a file path. This should be
|
||||
* used where the file is not loaded through the webview, but is instead
|
||||
* used by the app directly.
|
||||
*/
|
||||
private String getDataRootPath() {
|
||||
return context.getDir("data", Context.MODE_PRIVATE).toString() + File.separator;
|
||||
}
|
||||
|
|
@ -925,15 +935,13 @@ final class KMKeyboard extends WebView {
|
|||
return "";
|
||||
}
|
||||
|
||||
if (FileUtils.hasFontExtension(font)) {
|
||||
String fontRoot = KMManager.isDefaultFont(font) ? getDataRootPath() : getPackageRootPath(packageID);
|
||||
return fontRoot + font;
|
||||
if (!FileUtils.hasFontExtension(font)) {
|
||||
// QUESTION: do we log this?
|
||||
return "";
|
||||
}
|
||||
|
||||
// REVIEW: Do we have to do anything if font is a JSONObject?
|
||||
// See makeFontObj.
|
||||
|
||||
return "";
|
||||
String fontRoot = KMManager.isDefaultFont(font) ? getDataRootPath() : getPackageRootPath(packageID);
|
||||
return fontRoot + font;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue