fixed long press to bring back default in publish avatar activity

This commit is contained in:
iNPUTmice 2014-08-12 21:03:45 +02:00
parent 6952e630c4
commit 721b308f28
1 changed files with 14 additions and 7 deletions

View File

@ -154,16 +154,23 @@ public class PublishProfilePictureActivity extends XmppActivity {
this.support = this.account.getXmppConnection().getFeatures().pubsub(); this.support = this.account.getXmppConnection().getFeatures().pubsub();
} }
if (this.avatarUri == null) { if (this.avatarUri == null) {
if (this.account.getAvatar() != null) { if (this.account.getAvatar() != null || this.defaultUri == null) {
this.avatar.setImageBitmap(this.account.getImage( this.avatar.setImageBitmap(this.account.getImage(
getApplicationContext(), 384)); getApplicationContext(), 384));
this.avatar
.setOnLongClickListener(this.backToDefaultListener);
} else {
if (this.defaultUri != null) { if (this.defaultUri != null) {
this.avatarUri = this.defaultUri; this.avatar
loadImageIntoPreview(this.defaultUri); .setOnLongClickListener(this.backToDefaultListener);
} else {
this.secondaryHint.setVisibility(View.INVISIBLE);
} }
if (!support) {
this.hintOrWarning.setTextColor(getWarningTextColor());
this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support);
}
} else {
this.avatarUri = this.defaultUri;
loadImageIntoPreview(this.defaultUri);
this.secondaryHint.setVisibility(View.INVISIBLE);
} }
} else { } else {
loadImageIntoPreview(avatarUri); loadImageIntoPreview(avatarUri);
@ -191,7 +198,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
if (this.defaultUri != null && uri.equals(this.defaultUri)) { if (this.defaultUri != null && uri.equals(this.defaultUri)) {
this.secondaryHint.setVisibility(View.INVISIBLE); this.secondaryHint.setVisibility(View.INVISIBLE);
this.avatar.setOnLongClickListener(null); this.avatar.setOnLongClickListener(null);
} else { } else if (this.defaultUri != null ) {
this.secondaryHint.setVisibility(View.VISIBLE); this.secondaryHint.setVisibility(View.VISIBLE);
this.avatar.setOnLongClickListener(this.backToDefaultListener); this.avatar.setOnLongClickListener(this.backToDefaultListener);
} }