Pretty up the attachment drawer a little.

1) Rounded corners on the image.

2) A circle X on top of the image, rather than a remove button.

3) Quick 200ms fade on clear.

Closes #3439
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-06-17 11:54:12 -07:00
parent 485e8455bd
commit 67d8fa26a7
8 changed files with 75 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size android:height="24dp" android:width="24dp"/>
<solid android:color="@color/white"/>
</shape>
</item>
<item>
<shape android:shape="oval">
<size android:height="21dp" android:width="21dp"/>
<solid android:color="@color/textsecure_primary_dark"/>
<stroke android:color="@android:color/transparent"
android:width="3dp"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/ic_clear_white_24dp"
android:gravity="center" />
</item>
</layer-list>

View File

@ -3,6 +3,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
@ -28,35 +29,34 @@
<ScrollView android:layout_width="fill_parent" <ScrollView android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"> android:layout_weight="1">
<LinearLayout <FrameLayout
android:id="@+id/attachment_editor" android:id="@+id/attachment_editor"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_gravity="center_horizontal"
android:visibility="gone"> android:visibility="gone">
<FrameLayout
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<org.thoughtcrime.securesms.components.ThumbnailView <org.thoughtcrime.securesms.components.ThumbnailView
android:id="@+id/attachment_thumbnail" android:id="@+id/attachment_thumbnail"
android:layout_width="0dp"
android:layout_height="150dip"
android:layout_weight="1"
android:contentDescription="@string/conversation_activity__attachment_thumbnail"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="150dip"
android:gravity="center_vertical"> app:riv_corner_radius="3dp"
android:contentDescription="@string/conversation_activity__attachment_thumbnail"/>
</FrameLayout>
<Button <ImageView android:id="@+id/remove_image_button"
android:id="@+id/remove_image_button" android:layout_width="wrap_content"
style="?android:attr/buttonStyleSmall" android:layout_height="wrap_content"
android:layout_width="100dip" android:src="@drawable/conversation_attachment_close_circle"
android:layout_height="50dip" android:layout_gravity="top|left"/>
android:text="@string/conversation_activity__remove" />
</LinearLayout> </FrameLayout>
</LinearLayout>
</ScrollView> </ScrollView>
<View android:layout_width="match_parent" <View android:layout_width="match_parent"

View File

@ -26,7 +26,12 @@ import android.provider.ContactsContract;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.R;
@ -42,7 +47,7 @@ public class AttachmentManager {
private final Context context; private final Context context;
private final View attachmentView; private final View attachmentView;
private final ThumbnailView thumbnail; private final ThumbnailView thumbnail;
private final Button removeButton; private final ImageView removeButton;
private final SlideDeck slideDeck; private final SlideDeck slideDeck;
private final AttachmentListener attachmentListener; private final AttachmentListener attachmentListener;
@ -51,7 +56,7 @@ public class AttachmentManager {
public AttachmentManager(Activity view, AttachmentListener listener) { public AttachmentManager(Activity view, AttachmentListener listener) {
this.attachmentView = view.findViewById(R.id.attachment_editor); this.attachmentView = view.findViewById(R.id.attachment_editor);
this.thumbnail = (ThumbnailView)view.findViewById(R.id.attachment_thumbnail); this.thumbnail = (ThumbnailView)view.findViewById(R.id.attachment_thumbnail);
this.removeButton = (Button)view.findViewById(R.id.remove_image_button); this.removeButton = (ImageView)view.findViewById(R.id.remove_image_button);
this.slideDeck = new SlideDeck(); this.slideDeck = new SlideDeck();
this.context = view; this.context = view;
this.attachmentListener = listener; this.attachmentListener = listener;
@ -60,11 +65,30 @@ public class AttachmentManager {
} }
public void clear() { public void clear() {
AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
animation.setDuration(200);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
slideDeck.clear(); slideDeck.clear();
attachmentView.setVisibility(View.GONE); attachmentView.setVisibility(View.GONE);
attachmentListener.onAttachmentChanged(); attachmentListener.onAttachmentChanged();
} }
@Override
public void onAnimationRepeat(Animation animation) {
}
});
attachmentView.startAnimation(animation);
}
public void cleanup() { public void cleanup() {
if (captureFile != null) captureFile.delete(); if (captureFile != null) captureFile.delete();
captureFile = null; captureFile = null;