start configuration progress from RegistrationActivity

This commit is contained in:
B. Petersen
2018-08-20 00:20:14 +02:00
parent 5991780d70
commit 4b410c8753
2 changed files with 18 additions and 2 deletions
@@ -209,18 +209,22 @@ public class RegistrationActivity extends BaseActionBarActivity {
setConfig(R.id.smtp_port_text, "send_port");
setConfig(R.id.smtp_login_text, "send_user");
setConfig(R.id.smtp_password_text, "send_pw");
// calling configure() results in ApplicationDcContext.handleEvent()
// receiving multiple DC_EVENT_CONFIGURE_PROGRESS events from different threads
ApplicationContext.getInstance(getApplicationContext()).dcContext.configure();
}
private void setConfig(@IdRes int viewId, String configTarget) {
TextInputEditText view = findViewById(viewId);
String value = view.getText().toString().trim();
if (!value.isEmpty()) {
//JavaBindings.setConfig(configTarget, value); TODO set configuration value via bindings
ApplicationContext.getInstance(getApplicationContext()).dcContext.setConfig(configTarget, value);
}
}
private void stopLoginProcess() {
//JavaBindings.stopLoginProcess(); TODO stop configuration process via bindings
ApplicationContext.getInstance(getApplicationContext()).dcContext.stopOngoingProcess();
}
//@Override
@@ -216,6 +216,18 @@ public class ApplicationDcContext extends DcContext {
});
break;
case DC_EVENT_CONFIGURE_PROGRESS:
if (data1==0/*error/aborted*/) {
// TODO: send this event to RegistrationActivity, take care, we're not in the main thread!
}
else if (data1<1000/*progress in permille*/) {
// TODO: send this event to RegistrationActivity, take care, we're not in the main thread!
}
else if (data1==1000/*done*/) {
// TODO: send this event to RegistrationActivity, take care, we're not in the main thread!
}
break;
case DC_EVENT_HTTP_GET:
String httpContent = null;
try {