aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-09 10:20:16 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-09 10:20:16 +0200
commit937fc51b503344948997a1924ee6fdba23850315 (patch)
tree3d4094e30c0bbc4e946af21a43bb13fbad9358b8 /src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
parent0bab1a4613ca91b89266b105ee800b3501dcaa01 (diff)
added warning lable if server doesn't support pubsub. refactored feature identification into seperate class
Diffstat (limited to 'src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java')
-rw-r--r--src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
index e0e0826a..0661f1a9 100644
--- a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
+++ b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java
@@ -32,6 +32,8 @@ public class PublishProfilePictureActivity extends XmppActivity {
private Uri defaultUri;
private Account account;
+
+ private boolean support = false;
private UiCallback<Avatar> avatarPublication = new UiCallback<Avatar>() {
@@ -148,6 +150,9 @@ public class PublishProfilePictureActivity extends XmppActivity {
String jid = getIntent().getStringExtra("account");
if (jid != null) {
this.account = xmppConnectionService.findAccountByJid(jid);
+ if (this.account.getXmppConnection() != null) {
+ this.support = this.account.getXmppConnection().getFeatures().pubsub();
+ }
if (this.avatarUri == null) {
if (this.account.getAvatar() != null) {
this.avatar.setImageBitmap(this.account.getImage(
@@ -173,10 +178,16 @@ public class PublishProfilePictureActivity extends XmppActivity {
Bitmap bm = xmppConnectionService.getFileBackend().cropCenterSquare(
uri, 384);
this.avatar.setImageBitmap(bm);
- enablePublishButton();
- this.publishButton.setText(R.string.publish_avatar);
- this.hintOrWarning.setText(R.string.publish_avatar_explanation);
- this.hintOrWarning.setTextColor(getPrimaryTextColor());
+ if (support) {
+ enablePublishButton();
+ this.publishButton.setText(R.string.publish_avatar);
+ this.hintOrWarning.setText(R.string.publish_avatar_explanation);
+ this.hintOrWarning.setTextColor(getPrimaryTextColor());
+ } else {
+ disablePublishButton();
+ this.hintOrWarning.setTextColor(getWarningTextColor());
+ this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support);
+ }
if (this.defaultUri != null && uri.equals(this.defaultUri)) {
this.secondaryHint.setVisibility(View.INVISIBLE);
this.avatar.setOnLongClickListener(null);