Last active
January 7, 2017 07:15
-
-
Save suwhs/fd046416544fee5180a723f338ac4454 to your computer and use it in GitHub Desktop.
Preload hyphenation patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new AsyncTask<Void,Void,Void>() { | |
@Override | |
protected void onPreExecute() { | |
// set application state 'rules loading', if nesessary (or do something else) | |
} | |
@Override | |
protected Void doInBackground(Void... params) { | |
/** loading patterns from assets **/ | |
HyphenPattern pat = PatternsLoader | |
.getInstance(getBaseContext()) | |
.getHyphenPatternAssets("en_us.hyphen.dat"); // en_us.hyphen.dat from assets folder | |
if (pat!=null) { | |
/* initialize instance with loaded pattern ) */ | |
LineBreaker hlb = HyphenLineBreker.getInstance(pat); | |
hyphenatorReady = true; | |
} | |
return null; | |
} | |
@Override | |
protected void onPostExecute(Void params) { | |
// set 'rules ready' flag, if nesessary, or do something else | |
} | |
}.execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment