show avatar in editaccount

This commit is contained in:
iNPUTmice 2014-11-04 17:38:41 +01:00
parent b824e55277
commit cd5a56e8e7
3 changed files with 33 additions and 5 deletions

View File

@ -64,6 +64,7 @@ public class EditAccountActivity extends XmppActivity {
private TextView mServerInfoPep; private TextView mServerInfoPep;
private TextView mSessionEst; private TextView mSessionEst;
private TextView mOtrFingerprint; private TextView mOtrFingerprint;
private ImageView mAvatar;
private RelativeLayout mOtrFingerprintBox; private RelativeLayout mOtrFingerprintBox;
private ImageButton mOtrFingerprintToClipboardButton; 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) { protected void finishInitialSetup(final Avatar avatar) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@ -300,6 +312,8 @@ public class EditAccountActivity extends XmppActivity {
this.mPassword = (EditText) findViewById(R.id.account_password); this.mPassword = (EditText) findViewById(R.id.account_password);
this.mPassword.addTextChangedListener(this.mTextWatcher); this.mPassword.addTextChangedListener(this.mTextWatcher);
this.mPasswordConfirm = (EditText) findViewById(R.id.account_password_confirm); 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.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
this.mStats = (LinearLayout) findViewById(R.id.stats); this.mStats = (LinearLayout) findViewById(R.id.stats);
this.mSessionEst = (TextView) findViewById(R.id.session_est); this.mSessionEst = (TextView) findViewById(R.id.session_est);
@ -347,8 +361,9 @@ public class EditAccountActivity extends XmppActivity {
this.jidToEdit = getIntent().getStringExtra("jid"); this.jidToEdit = getIntent().getStringExtra("jid");
if (this.jidToEdit != null) { if (this.jidToEdit != null) {
this.mRegisterNew.setVisibility(View.GONE); this.mRegisterNew.setVisibility(View.GONE);
getActionBar().setTitle(jidToEdit); getActionBar().setTitle(getString(R.string.account_details));
} else { } else {
this.mAvatar.setVisibility(View.GONE);
getActionBar().setTitle(R.string.action_add_account); getActionBar().setTitle(R.string.action_add_account);
} }
} }
@ -385,6 +400,8 @@ public class EditAccountActivity extends XmppActivity {
private void updateAccountInformation() { private void updateAccountInformation() {
this.mAccountJid.setText(this.mAccount.getJid()); this.mAccountJid.setText(this.mAccount.getJid());
this.mPassword.setText(this.mAccount.getPassword()); 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)) { if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
this.mRegisterNew.setVisibility(View.VISIBLE); this.mRegisterNew.setVisibility(View.VISIBLE);
this.mRegisterNew.setChecked(true); this.mRegisterNew.setChecked(true);

View File

@ -15,7 +15,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <RelativeLayout
android:id="@+id/editor" android:id="@+id/editor"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -23,7 +23,16 @@
android:background="@drawable/infocard_border" android:background="@drawable/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="16dp"> android:padding="16dp">
<ImageView android:id="@+id/avater"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toRightOf="@+id/avater">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -89,6 +98,7 @@
android:textColorHint="@color/secondarytext" android:textColorHint="@color/secondarytext"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody" />
</LinearLayout> </LinearLayout>
</RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/stats" android:id="@+id/stats"

View File

@ -284,4 +284,5 @@
<string name="image_transmission_failed">Image transmission failed</string> <string name="image_transmission_failed">Image transmission failed</string>
<string name="scan_qr_code">Scan QR code</string> <string name="scan_qr_code">Scan QR code</string>
<string name="show_qr_code">Show QR code</string> <string name="show_qr_code">Show QR code</string>
<string name="account_details">Account details</string>
</resources> </resources>