+ //if (!module.isLoaded()) {
+ // module.loadModule();
+ //}
+
+ setContentView(R.layout.main);
+ updateUI();
+ }
+
+ private void updateUI() {
+ disableUI();
+
+ boolean loaded = module.isLoaded();
+ boolean safe_to_load = module.is_safe_to_load();
+
+ TextView text = (TextView)findViewById(R.id.text);
+ text.setText("Current status:\n\nModule loaded: " + loaded + "\ndebounce_delay: " + module.getDelay() + "ms\nsafe_to_load: " + safe_to_load);
+
+ //EditText textDelay = (EditText)findViewById(R.id.debounce_delay);
+ //textDelay.setText(module.getSavedDelay());
+
+ Button reload = (Button)findViewById(R.id.reload);
+ if (loaded) {
+ reload.setEnabled(true);
+ } else {
+ reload.setEnabled(false);
+ }
+
+ Button load = (Button)findViewById(R.id.load);
+ if (loaded) {
+ load.setEnabled(false);
+ } else {
+ load.setEnabled(true);
+ }
+
+ Button unload = (Button)findViewById(R.id.unload);
+ if (loaded) {
+ unload.setEnabled(true);
+ } else {
+ unload.setEnabled(false);
+ }
+
+ CheckBox on_boot = (CheckBox)findViewById(R.id.on_boot);
+ on_boot.setChecked(module.get_on_boot());
+ if (safe_to_load) {
+ on_boot.setEnabled(true);
+ } else {
+ on_boot.setEnabled(false);
+ }
+ }
+
+ private void disableUI() {
+ Button reload = (Button)findViewById(R.id.reload);
+ reload.setEnabled(false);
+
+ Button load = (Button)findViewById(R.id.load);
+ load.setEnabled(false);
+
+ Button unload = (Button)findViewById(R.id.unload);
+ unload.setEnabled(false);
+
+ CheckBox on_boot = (CheckBox)findViewById(R.id.on_boot);
+ on_boot.setEnabled(false);
+ }