ui for registry.

This commit is contained in:
Daniel Gultsch 2014-03-13 04:21:59 +01:00
parent a80e3131be
commit 6db012ac6f
2 changed files with 23 additions and 12 deletions

View file

@ -7,6 +7,7 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
@ -61,10 +62,12 @@ public class EditAccount extends DialogFragment {
} else {
useTLS.setChecked(false);
}
Log.d("xmppService","mein debugger. account != null");
if (account.isOptionSet(Account.OPTION_REGISTER)) {
registerAccount.setChecked(true);
builder.setTitle("Add account");
okButtonDesc = "Register";
passwordConfirm.setVisibility(View.VISIBLE);
} else {
registerAccount.setVisibility(View.GONE);
builder.setTitle("Edit account");

View file

@ -79,7 +79,6 @@ public class ManageAccountActivity extends XmppActivity {
StringBuilder humanReadableSha = new StringBuilder();
humanReadableSha.append(fingerprint);
for(int i = 2; i < 59; i += 3) {
Log.d("gultsch","insert into "+i);
if ((i==14)||(i==29)||(i==44)) {
humanReadableSha.insert(i, "\n");
} else {
@ -184,6 +183,8 @@ public class ManageAccountActivity extends XmppActivity {
activity.xmppConnectionService.reconnectAccount(accountList.get(position),true);
} else if (account.getStatus() == Account.STATUS_ONLINE) {
activity.startActivity(new Intent(activity.getApplicationContext(),NewConversationActivity.class));
} else if (account.isOptionSet(Account.OPTION_REGISTER)) {
editAccount(account);
}
} else {
selectedAccountForActionMode = accountList.get(position);
@ -230,17 +231,7 @@ public class ManageAccountActivity extends XmppActivity {
@Override
public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
if (item.getItemId()==R.id.mgmt_account_edit) {
EditAccount dialog = new EditAccount();
dialog.setAccount(selectedAccountForActionMode);
dialog.setEditAccountListener(new EditAccountListener() {
@Override
public void onAccountEdited(Account account) {
xmppConnectionService.updateAccount(account);
actionMode.finish();
}
});
dialog.show(getFragmentManager(), "edit_account");
editAccount(selectedAccountForActionMode);
} else if (item.getItemId()==R.id.mgmt_account_disable) {
selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, true);
xmppConnectionService.updateAccount(selectedAccountForActionMode);
@ -303,6 +294,8 @@ public class ManageAccountActivity extends XmppActivity {
}
return true;
}
}));
return true;
} else {
@ -355,6 +348,21 @@ public class ManageAccountActivity extends XmppActivity {
return super.onOptionsItemSelected(item);
}
private void editAccount(Account account) {
EditAccount dialog = new EditAccount();
dialog.setAccount(account);
dialog.setEditAccountListener(new EditAccountListener() {
@Override
public void onAccountEdited(Account account) {
xmppConnectionService.updateAccount(account);
actionMode.finish();
}
});
dialog.show(getFragmentManager(), "edit_account");
}
protected void addAccount() {
final Activity activity = this;
EditAccount dialog = new EditAccount();