Skip to content

Commit

Permalink
Optimizer now respects pause and resume to reduce battery drain
Browse files Browse the repository at this point in the history
  • Loading branch information
brentn committed Aug 1, 2014
1 parent a342df0 commit 4bedefc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions main/java/com/brentandjody/stenoime/StenoIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,16 +484,18 @@ private void initializeTranslator() {
Log.d(TAG, "initializeTranslator()");
switch (App.getTranslatorType()) {
case RawStrokes:
if (mTranslator!=null && (! (mTranslator instanceof RawStrokeTranslator))) { //if changing types
mTranslator.stop();
if (mTranslator.usesDictionary()) {
App.unloadDictionary();
if (mTranslator==null || (! (mTranslator instanceof RawStrokeTranslator))) { //if changing types
if (mTranslator!=null) {
mTranslator.stop();
if (mTranslator.usesDictionary()) {
App.unloadDictionary();
}
}
mTranslator = new RawStrokeTranslator();
}
break;
case SimpleDictionary:
if (mTranslator!=null &&(! (mTranslator instanceof SimpleTranslator))) { //if changing types
if (mTranslator==null ||(! (mTranslator instanceof SimpleTranslator))) { //if changing types
mTranslator = new SimpleTranslator(getApplicationContext());
}
((SimpleTranslator) mTranslator).setDictionary(App.getDictionary(StenoIME.this));
Expand Down

0 comments on commit 4bedefc

Please sign in to comment.