From 721b308f28c6efbe8eda917725f2a85d8f70525f Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 12 Aug 2014 21:03:45 +0200 Subject: [PATCH] fixed long press to bring back default in publish avatar activity --- .../ui/PublishProfilePictureActivity.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 0661f1a9..434d1d4d 100644 --- a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -154,16 +154,23 @@ public class PublishProfilePictureActivity extends XmppActivity { this.support = this.account.getXmppConnection().getFeatures().pubsub(); } if (this.avatarUri == null) { - if (this.account.getAvatar() != null) { + if (this.account.getAvatar() != null || this.defaultUri == null) { this.avatar.setImageBitmap(this.account.getImage( getApplicationContext(), 384)); - this.avatar - .setOnLongClickListener(this.backToDefaultListener); - } else { if (this.defaultUri != null) { - this.avatarUri = this.defaultUri; - loadImageIntoPreview(this.defaultUri); + this.avatar + .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 { loadImageIntoPreview(avatarUri); @@ -191,7 +198,7 @@ public class PublishProfilePictureActivity extends XmppActivity { if (this.defaultUri != null && uri.equals(this.defaultUri)) { this.secondaryHint.setVisibility(View.INVISIBLE); this.avatar.setOnLongClickListener(null); - } else { + } else if (this.defaultUri != null ) { this.secondaryHint.setVisibility(View.VISIBLE); this.avatar.setOnLongClickListener(this.backToDefaultListener); }