X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-fixes/blobdiff_plain/1559225a3318764b882a6dd62af2520bbba8f7ba..a4838b14f5c5bdb4ceda232aec01e695e56af575:/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java?ds=sidebyside diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java b/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java index 2771ef2..1c14e2c 100644 --- a/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java +++ b/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java @@ -21,6 +21,11 @@ public class MS2Debounce extends Activity { private DebounceModuleHelper module; + // Calling these is expensive, so cache the result... + private boolean loaded; + private boolean safe_to_load; + private int debounce_delay; + public MS2Debounce() { super(); @@ -42,7 +47,7 @@ public class MS2Debounce extends Activity module.setSavedDelay(Integer.parseInt(delay.toString())); Button reload = (Button)findViewById(R.id.reload); - if (module.isLoaded() && module.getSavedDelay() != module.getDelay()) { + if (loaded && module.getSavedDelay() != debounce_delay) { reload.setEnabled(true); } else { reload.setEnabled(false); @@ -66,9 +71,9 @@ public class MS2Debounce extends Activity disableUI(); // Calling these is expensive, so cache the result... - boolean loaded = module.isLoaded(); - boolean safe_to_load = module.is_safe_to_load(); - int debounce_delay = module.getDelay(); + loaded = module.isLoaded(); + safe_to_load = module.is_safe_to_load(); + debounce_delay = module.getDelay(); TextView text = (TextView)findViewById(R.id.text); text.setText("Current status:\n\nModule loaded: " + loaded + "\ndebounce_delay: " + debounce_delay + "ms\nsafe_to_load: " + safe_to_load);