From cd5a56e8e795e76f9cc775e2d213fafc1155c2e7 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 4 Nov 2014 17:38:41 +0100 Subject: [PATCH] show avatar in editaccount --- .../conversations/ui/EditAccountActivity.java | 19 ++++++++++++++++++- src/main/res/layout/activity_edit_account.xml | 18 ++++++++++++++---- src/main/res/values/strings.xml | 1 + 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index c5529613b..e0ec2899c 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -64,6 +64,7 @@ public class EditAccountActivity extends XmppActivity { private TextView mServerInfoPep; private TextView mSessionEst; private TextView mOtrFingerprint; + private ImageView mAvatar; private RelativeLayout mOtrFingerprintBox; private ImageButton mOtrFingerprintToClipboardButton; @@ -210,6 +211,17 @@ public class EditAccountActivity extends XmppActivity { } }; + private OnClickListener mAvatarClickListener = new OnClickListener() { + @Override + public void onClick(View view) { + if (mAccount!=null) { + Intent intent = new Intent(getApplicationContext(), + PublishProfilePictureActivity.class); + intent.putExtra("account", mAccount.getJid()); + startActivity(intent); + } + } + }; protected void finishInitialSetup(final Avatar avatar) { runOnUiThread(new Runnable() { @@ -300,6 +312,8 @@ public class EditAccountActivity extends XmppActivity { this.mPassword = (EditText) findViewById(R.id.account_password); this.mPassword.addTextChangedListener(this.mTextWatcher); this.mPasswordConfirm = (EditText) findViewById(R.id.account_password_confirm); + this.mAvatar = (ImageView) findViewById(R.id.avater); + this.mAvatar.setOnClickListener(this.mAvatarClickListener); this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new); this.mStats = (LinearLayout) findViewById(R.id.stats); this.mSessionEst = (TextView) findViewById(R.id.session_est); @@ -347,8 +361,9 @@ public class EditAccountActivity extends XmppActivity { this.jidToEdit = getIntent().getStringExtra("jid"); if (this.jidToEdit != null) { this.mRegisterNew.setVisibility(View.GONE); - getActionBar().setTitle(jidToEdit); + getActionBar().setTitle(getString(R.string.account_details)); } else { + this.mAvatar.setVisibility(View.GONE); getActionBar().setTitle(R.string.action_add_account); } } @@ -385,6 +400,8 @@ public class EditAccountActivity extends XmppActivity { private void updateAccountInformation() { this.mAccountJid.setText(this.mAccount.getJid()); this.mPassword.setText(this.mAccount.getPassword()); + this.mAvatar.setVisibility(View.VISIBLE); + this.mAvatar.setImageBitmap(avatarService().get(this.mAccount,getPixel(72))); if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { this.mRegisterNew.setVisibility(View.VISIBLE); this.mRegisterNew.setChecked(true); diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 97289628c..fa39ed5ec 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -15,15 +15,24 @@ android:layout_height="wrap_content" android:orientation="vertical" > - - + android:padding="16dp"> + + - + + Image transmission failed Scan QR code Show QR code + Account details \ No newline at end of file