Add close button to attachment type selector

// FREEBIE
master
Moxie Marlinspike 2015-11-04 17:13:21 -08:00
parent be0ca330f5
commit 09c57f3f44
7 changed files with 29 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

View File

@ -141,8 +141,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:layout_marginLeft="16dp">
android:orientation="vertical">
</LinearLayout>
@ -151,8 +150,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:layout_marginLeft="16dp">
android:orientation="vertical">
</LinearLayout>
@ -160,8 +158,22 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:layout_marginLeft="16dp">
android:orientation="vertical">
<org.thoughtcrime.securesms.components.CircleColorImageView
android:id="@+id/close_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/ic_keyboard_arrow_down_white_36dp"
android:scaleType="center"
android:elevation="4dp"
app:circleColor="@color/gray50"/>
<TextView android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AttachmentTypeLabel"
android:text=" "/>
</LinearLayout>

View File

@ -43,6 +43,7 @@ public class AttachmentTypeSelector extends PopupWindow {
private final @NonNull ImageView videoButton;
private final @NonNull ImageView contactButton;
private final @NonNull ImageView cameraButton;
private final @NonNull ImageView closeButton;
private @Nullable View currentAnchor;
private @Nullable AttachmentClickedListener listener;
@ -59,12 +60,14 @@ public class AttachmentTypeSelector extends PopupWindow {
this.videoButton = ViewUtil.findById(layout, R.id.video_button);
this.contactButton = ViewUtil.findById(layout, R.id.contact_button);
this.cameraButton = ViewUtil.findById(layout, R.id.camera_button);
this.closeButton = ViewUtil.findById(layout, R.id.close_button);
this.imageButton.setOnClickListener(new PropagatingClickListener(ADD_IMAGE));
this.audioButton.setOnClickListener(new PropagatingClickListener(ADD_SOUND));
this.videoButton.setOnClickListener(new PropagatingClickListener(ADD_VIDEO));
this.contactButton.setOnClickListener(new PropagatingClickListener(ADD_CONTACT_INFO));
this.cameraButton.setOnClickListener(new PropagatingClickListener(TAKE_PHOTO));
this.closeButton.setOnClickListener(new CloseClickListener());
setContentView(layout);
setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
@ -102,6 +105,7 @@ public class AttachmentTypeSelector extends PopupWindow {
animateButtonIn(audioButton, ANIMATION_DURATION / 3);
animateButtonIn(videoButton, ANIMATION_DURATION / 4);
animateButtonIn(contactButton, 0);
animateButtonIn(closeButton, 0);
}
}
@ -236,6 +240,13 @@ public class AttachmentTypeSelector extends PopupWindow {
}
private class CloseClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
dismiss();
}
}
public interface AttachmentClickedListener {
public void onClick(int type);
}