diff options
Diffstat (limited to '')
-rw-r--r-- | res/layout/activity_publish_profile_picture.xml | 11 | ||||
-rw-r--r-- | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java | 30 |
3 files changed, 36 insertions, 6 deletions
diff --git a/res/layout/activity_publish_profile_picture.xml b/res/layout/activity_publish_profile_picture.xml index 6dd1f7d3..b3c6c427 100644 --- a/res/layout/activity_publish_profile_picture.xml +++ b/res/layout/activity_publish_profile_picture.xml @@ -28,6 +28,15 @@ android:layout_centerHorizontal="true" android:text="@string/touch_to_choose_picture" android:textColor="@color/secondarytext" /> + + <TextView + android:id="@+id/secondary_hint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/hint" + android:layout_centerHorizontal="true" + android:text="@string/or_long_press_for_default" + android:textColor="@color/secondarytext" /> <LinearLayout android:id="@+id/button_bar" @@ -68,7 +77,7 @@ android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_above="@+id/button_bar" - android:layout_below="@+id/hint" + android:layout_below="@+id/secondary_hint" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:gravity="center_vertical" diff --git a/res/values/strings.xml b/res/values/strings.xml index 2e0c2018..6ea73318 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -275,4 +275,5 @@ <string name="error_publish_avatar_server_reject">The server rejected your publication</string> <string name="error_publish_avatar_converting">Something went wrong while converting your picture</string> <string name="error_saving_avatar">Could not save avatar to disk</string> + <string name="or_long_press_for_default">(Or long press to bring back default)</string> </resources> diff --git a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index fcb94efa..e42a2216 100644 --- a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -5,10 +5,10 @@ import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; -import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnLongClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; @@ -24,10 +24,12 @@ public class PublishProfilePictureActivity extends XmppActivity { private ImageView avatar; private TextView accountTextView; private TextView hintOrWarning; + private TextView secondaryHint; private Button cancelButton; private Button publishButton; private Uri avatarUri; + private Uri defaultUri; private Account account; @@ -64,6 +66,16 @@ public class PublishProfilePictureActivity extends XmppActivity { } }; + private OnLongClickListener backToDefaultListener = new OnLongClickListener() { + + @Override + public boolean onLongClick(View v) { + avatarUri = defaultUri; + loadImageIntoPreview(defaultUri); + return true; + } + }; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -73,6 +85,7 @@ public class PublishProfilePictureActivity extends XmppActivity { 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.secondaryHint = (TextView) findViewById(R.id.secondary_hint); this.publishButton.setOnClickListener(new OnClickListener() { @Override @@ -104,6 +117,7 @@ public class PublishProfilePictureActivity extends XmppActivity { startActivityForResult(chooser, REQUEST_CHOOSE_FILE); } }); + this.defaultUri = PhoneHelper.getSefliUri(getApplicationContext()); } @Override @@ -139,10 +153,9 @@ public class PublishProfilePictureActivity extends XmppActivity { this.avatar.setImageBitmap(this.account.getImage( getApplicationContext(), 384)); } else { - this.avatarUri = PhoneHelper - .getSefliUri(getApplicationContext()); - if (this.avatarUri != null) { - loadImageIntoPreview(this.avatarUri); + if (this.defaultUri != null) { + this.avatarUri = this.defaultUri; + loadImageIntoPreview(this.defaultUri); } } } else { @@ -162,6 +175,13 @@ public class PublishProfilePictureActivity extends XmppActivity { this.publishButton.setText(R.string.publish_avatar); this.hintOrWarning.setText(R.string.publish_avatar_explanation); this.hintOrWarning.setTextColor(getPrimaryTextColor()); + if (this.defaultUri != null && uri.equals(this.defaultUri)) { + this.secondaryHint.setVisibility(View.INVISIBLE); + this.avatar.setOnLongClickListener(null); + } else { + this.secondaryHint.setVisibility(View.VISIBLE); + this.avatar.setOnLongClickListener(this.backToDefaultListener ); + } } protected void enablePublishButton() { |