From 09c57f3f44ea57a7c91473d919ff0703d4bc3b37 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 4 Nov 2015 17:13:21 -0800 Subject: [PATCH] Add close button to attachment type selector // FREEBIE --- .../ic_keyboard_arrow_down_white_36dp.png | Bin 0 -> 344 bytes .../ic_keyboard_arrow_down_white_36dp.png | Bin 0 -> 284 bytes .../ic_keyboard_arrow_down_white_36dp.png | Bin 0 -> 411 bytes .../ic_keyboard_arrow_down_white_36dp.png | Bin 0 -> 545 bytes .../ic_keyboard_arrow_down_white_36dp.png | Bin 0 -> 717 bytes res/layout/attachment_type_selector.xml | 24 +++++++++++++----- .../components/AttachmentTypeSelector.java | 11 ++++++++ 7 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 res/drawable-hdpi/ic_keyboard_arrow_down_white_36dp.png create mode 100644 res/drawable-mdpi/ic_keyboard_arrow_down_white_36dp.png create mode 100644 res/drawable-xhdpi/ic_keyboard_arrow_down_white_36dp.png create mode 100644 res/drawable-xxhdpi/ic_keyboard_arrow_down_white_36dp.png create mode 100644 res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_36dp.png diff --git a/res/drawable-hdpi/ic_keyboard_arrow_down_white_36dp.png b/res/drawable-hdpi/ic_keyboard_arrow_down_white_36dp.png new file mode 100644 index 0000000000000000000000000000000000000000..4afedf38f5a52186b37b44beeb9500073e89f624 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^W+2SL0wmRZ7KH&Rg=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C(G&@^*J&_}|`tWO>_%)r1c48n{Iv*t(u z1uuBIIEF+VetZ2OUy}jPv5!e&6+kEP?Vm*JB$c55ep5#kf3cV3eUv_GPs(C>5ilCgc zmMe;KPFiYkf17I@V3u=sriQlJ^PVZP)x~LCp3kHUruezISV^vp*1m3T-g!e)UyOeq e)J3|k0wldT1B8K;Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZK3>dAqwX{BQ3+vmeOgEbxddW?CZcv>Get@E6rT%n^SKnJ~L2t80%s!@Dmx)iy8~Jk#WrieRjGv%-9{ zkxX-tmQ1o&z>;abMl+1Qc+T|U_0pWY(s`nhBzM=8gEua88%aLNk-Mlmb86NfS<5FE b@*VvR*LJLLxEFp9=spHdS3j3^P6I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g&? zz`!W%>EalYaqsQTy<$xUJgg5MwAl5()7sy^TH1ZScfxMISAq*YE~h2zI5|u0{sccy zh1XrZ0xklMEP`-iE$f!awHJDtmvm+QcqUeEQ_!Me?A*?_GJkIyGlQ<5mR}zq!ynIm zbENGqK6-Oj^PUXr$@L#a4}VbQwPYyR$b9vM`;wfGzLt-^tk5mb@OdTX(I}%)cXP^= z{|~<;%J80W)mmd|HK9AiFKd-VpO}g2SLGnt;}@G_l(nt>I5Os?9N=W$={~!_$x&|- zr@D-Z>db;9htEqm{A5n}c0D@MbR=u)TZjEiGWu9wcpE*q(GaI1%%@^#weO13r3e$R l3SOlSg(eOpBID`;_0*itg0eLSjsnAs!PC{xWt~$(69D>IlY9UG literal 0 HcmV?d00001 diff --git a/res/drawable-xxhdpi/ic_keyboard_arrow_down_white_36dp.png b/res/drawable-xxhdpi/ic_keyboard_arrow_down_white_36dp.png new file mode 100644 index 0000000000000000000000000000000000000000..b97ab9aa679bb7510db54b9bd33f254b5181380e GIT binary patch literal 545 zcmeAS@N?(olHy`uVBq!ia0vp^IUvlz0wh)Q=eq$Zg=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C(G&@^*J&_}|`tWO>_%)r1c48n{Iv*t)J zFfh*aba4!+xb^n7bt3_d84oNJyY^VZBRWm?;`KvHnVdTJqYc}p9r|=H`Sh0ay<1eKi9cJqbmJcb ze%*m+8+Pne<6U>}#MFb^E>DW6+>pD)Buwp%neN1?+|kRIZrYT18fcbX&b(>oRyD+4 z=87=gpt-gslvO&@RVO0++vm)DcH`=;>t`LmdhkruX00&YH72z&>D~t0Sdxh&>KNYf WWGhDS?eqc09D}E;pUXO@geCy}-PMu+ literal 0 HcmV?d00001 diff --git a/res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_36dp.png b/res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_36dp.png new file mode 100644 index 0000000000000000000000000000000000000000..61c9cf6c7d3cd6620b3951dcda4f623f3b5252f2 GIT binary patch literal 717 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q1xWh(YZ(J6g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C(G&@^*J&_}|`tWO>_%)r1c48n{Iv*t(u zRk(V(IEGZ*dVAY8=um=4>qF<%gxD1u3uhGS_jwnXO6kblof#Hoz@sEEso;Ot_bHx& zpF|XYzWbSGuT(pekww6P0YbPiFmWg}fC&zm7>fWSOpJl4g8{Bs5TcHOX@xqs?W@Rm z$MTCWPQK2vbKqXP^~!EJrw*yoU00Wf$%TJrnDyG%+mlQ2)(4MIiksMPeRL6cTQR3& zP2;!9J)PewV>)sgpGCd?^gD2l#u{xJQ;z?NKQmur#_@l)C#Gx6IsVx9 zR=-B$@#oQJ+BI5_zs|llZ^gycw<_fJe^rQHWFmK7)YW>Ci`;$HaOp)Ma_>!Fp6;Af z`A7V%zOvWz&KX%g>RDeF?T(o@W8-;~MM5@##T!4mxK=!3Yk%Bv>Vu14Si7+3qfS{{ ze&rz5c`t7M5m*$dI`7A)LzPOQk4|Qk$2f_cn;cv}(`(9s$yfPjIZZhhAtuhd$rl|ue|&+4oV>1@Ai2aQ2s^sqo<5PNI^ h;}UDsDoy&reX%b|;GFT=FThmB;OXk;vd$@?2>>4_5F-Ep literal 0 HcmV?d00001 diff --git a/res/layout/attachment_type_selector.xml b/res/layout/attachment_type_selector.xml index 6caec94a9a..a3780d8894 100644 --- a/res/layout/attachment_type_selector.xml +++ b/res/layout/attachment_type_selector.xml @@ -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"> @@ -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"> @@ -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"> + + + + diff --git a/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java b/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java index e92b0b2d7b..9415c5c48f 100644 --- a/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java +++ b/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java @@ -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); }