diff --git a/res/layout/activity_publish_profile_picture.xml b/res/layout/activity_publish_profile_picture.xml index 9dd7a5dc2..6dd1f7d3d 100644 --- a/res/layout/activity_publish_profile_picture.xml +++ b/res/layout/activity_publish_profile_picture.xml @@ -69,7 +69,8 @@ android:layout_height="fill_parent" android:layout_above="@+id/button_bar" android:layout_below="@+id/hint" - android:layout_centerHorizontal="true" + android:layout_alignParentLeft="true" + android:layout_alignParentRight="true" android:gravity="center_vertical" android:orientation="vertical" android:paddingLeft="8dp" @@ -83,12 +84,14 @@ android:textSize="18sp"/> + android:textSize="14sp" + android:minLines="3" /> \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index de925254a..3b57be7a2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -271,4 +271,7 @@ Publish avatar Touch avatar to select picture from gallary Please note: Everyone subscribed to your presence updates will be allowed to see this picture. + Publishing… + The server rejected your publication + Something went wrong while converting your picture diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index c750ed532..370d83043 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1216,17 +1216,17 @@ public class XmppConnectionService extends Service { if (result.getType() == IqPacket.TYPE_RESULT) { callback.success(avatar); } else { - callback.error(R.string.error, avatar); + callback.error(R.string.error_publish_avatar_server_reject, avatar); } } }); } else { - callback.error(R.string.error, avatar); + callback.error(R.string.error_publish_avatar_server_reject, avatar); } } }); } else { - callback.error(R.string.error, null); + callback.error(R.string.error_publish_avatar_converting, null); } } diff --git a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index a2cc84a6d..353600ef3 100644 --- a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -22,6 +22,7 @@ public class PublishProfilePictureActivity extends XmppActivity { private ImageView avatar; private TextView accountTextView; + private TextView hintOrWarning; private Button cancelButton; private Button publishButton; @@ -33,19 +34,32 @@ public class PublishProfilePictureActivity extends XmppActivity { @Override public void success(Avatar object) { - finish(); + runOnUiThread(new Runnable() { + + @Override + public void run() { + finish(); + } + }); } @Override - public void error(int errorCode, Avatar object) { - // TODO Auto-generated method stub + public void error(final int errorCode, Avatar object) { + runOnUiThread(new Runnable() { + + @Override + public void run() { + hintOrWarning.setText(errorCode); + hintOrWarning.setTextColor(getWarningTextColor()); + publishButton.setText(R.string.publish_avatar); + enablePublishButton(); + } + }); } @Override public void userInputRequried(PendingIntent pi, Avatar object) { - // TODO Auto-generated method stub - } }; @@ -57,11 +71,13 @@ public class PublishProfilePictureActivity extends XmppActivity { this.cancelButton = (Button) findViewById(R.id.cancel_button); this.publishButton = (Button) findViewById(R.id.publish_button); this.accountTextView = (TextView) findViewById(R.id.account); + this.hintOrWarning = (TextView) findViewById(R.id.hint_or_warning); this.publishButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (avatarUri != null) { + publishButton.setText(R.string.publishing); disablePublishButton(); xmppConnectionService.publishAvatar(account, avatarUri, avatarPublication); @@ -99,7 +115,7 @@ public class PublishProfilePictureActivity extends XmppActivity { } } } - + @Override public boolean onOptionsItemSelected(MenuItem menuItem) { super.onOptionsItemSelected(menuItem); @@ -133,13 +149,16 @@ public class PublishProfilePictureActivity extends XmppActivity { 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()); } protected void enablePublishButton() { this.publishButton.setEnabled(true); this.publishButton.setTextColor(getPrimaryTextColor()); } - + protected void disablePublishButton() { this.publishButton.setEnabled(false); this.publishButton.setTextColor(getSecondaryTextColor());