From 6db012ac6fc43690f7b6aa3632f10474ad492742 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 13 Mar 2014 04:21:59 +0100 Subject: [PATCH] ui for registry. --- .../siacs/conversations/ui/EditAccount.java | 3 ++ .../ui/ManageAccountActivity.java | 32 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/eu/siacs/conversations/ui/EditAccount.java b/src/eu/siacs/conversations/ui/EditAccount.java index b6311238b..8c180d75a 100644 --- a/src/eu/siacs/conversations/ui/EditAccount.java +++ b/src/eu/siacs/conversations/ui/EditAccount.java @@ -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"); diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java index 58479cb49..23de4ed5c 100644 --- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -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();