From 86925ef40296cd938461b021e04128f3f151af53 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Tue, 5 Mar 2013 14:28:09 +0000 Subject: [PATCH] Hooked up star/unstar and read/unread buttons. Tinkered with layouts. --- .../res/drawable-hdpi/content_read.png | Bin 0 -> 1632 bytes .../res/drawable-hdpi/content_unread.png | Bin 0 -> 1558 bytes .../res/drawable-mdpi/content_read.png | Bin 0 -> 1419 bytes .../res/drawable-mdpi/content_unread.png | Bin 0 -> 1376 bytes .../res/drawable-xhdpi/content_read.png | Bin 0 -> 1895 bytes .../res/drawable-xhdpi/content_unread.png | Bin 0 -> 1774 bytes briar-android/res/values-v11/styles.xml | 2 + briar-android/res/values/strings.xml | 4 +- briar-android/res/values/styles.xml | 1 + .../android/contact/ContactListActivity.java | 11 +- .../messages/ConversationActivity.java | 33 +-- .../messages/ConversationListActivity.java | 20 +- .../android/messages/ReadMessageActivity.java | 209 ++++++++++++------ .../messages/WriteMessageActivity.java | 100 ++++----- 14 files changed, 229 insertions(+), 151 deletions(-) create mode 100644 briar-android/res/drawable-hdpi/content_read.png create mode 100644 briar-android/res/drawable-hdpi/content_unread.png create mode 100644 briar-android/res/drawable-mdpi/content_read.png create mode 100644 briar-android/res/drawable-mdpi/content_unread.png create mode 100644 briar-android/res/drawable-xhdpi/content_read.png create mode 100644 briar-android/res/drawable-xhdpi/content_unread.png diff --git a/briar-android/res/drawable-hdpi/content_read.png b/briar-android/res/drawable-hdpi/content_read.png new file mode 100644 index 0000000000000000000000000000000000000000..5fc1132225399d9dd7dc9511295b7d923cfad0c7 GIT binary patch literal 1632 zcmaJ>X;2eq7!F54QHm5)qFC01dQ_6#&4pPB0y!XRI07S495o~x5@2^jb|HbO2WTsZ ztzzsj;DxlN(0X^o16qxvRUGlEH=?m9I2Mmy8bsS}5U@X_JG1+J-#hQ~ywCf+&um3% za$;b>ga8JE5vWX(sp%E+yd(VRZ>D$e8hT+;at)PE7$~dOf->UuL^cX2F>Ma2M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T`m4^gl)b{<QPb1r=$iXQbV+pe|Yv+T; z)*CC&`TXHpd{*)M6(~jZQ+mVMXF?x^(|=FJT~#Reg<KbN$Kg17!nkO|eWQL?GF$5M zUVp4K!teSP?-17q_ROTfH1_5rkqU=1%3gJPTGQyof6Lt}Gc!DW^*>~vI>m66xd5%N zY!{n1`&4f#_<BcSeaPaX1wjwjo#}X#^Q?CN%NU)taf+kc-ElPVp6Je~Q;MV0x+)I* zbrDm3++reIx}d%WM{o9w>{52;pUh{U)|b^z<*-{Pe4_#PHj0qLyI=p{>e%8t(IxIX zA6(pW@*po>I=`t~bm;VC^0U#^;LPiZzf|YG`lNC)FaOl|tg@e#hV$RM#@ZbBS0~mT zF9a4|ireCRZ~IC4PWOd^oUEd>12^%qoedWrmoMxrdAzi)XpR`W84+INm6!)`A2sLe z=Z=a#!ZxK59G%ErR9`>i(d(Y=FVDpp0RD#DKK5}&P(xeKxaZHiJ^y^AJXy9UVQJaF DPAqQ( literal 0 HcmV?d00001 diff --git a/briar-android/res/drawable-hdpi/content_unread.png b/briar-android/res/drawable-hdpi/content_unread.png new file mode 100644 index 0000000000000000000000000000000000000000..e5f368257d32b4b7be5d2a2cb6fccc9643783a5e GIT binary patch literal 1558 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8<fR&VF+bTgE72zA8;GAESs$i;Tpqp%9W~g9hqGxDg zU}<8hqhMrUXrOOsq;FuZYiM9)YHnp<r~m~@K--E^(yW49+@N*=dA3R!B_#z``ugSN z<$C4Ddih1^`i7R4mih)p`bI{&Koz>hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&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A$7xZ^Po4Wm1CQnw}WH zNGXj<pIu|W?B^HPDYvhzxc<kLZ#w6<W3AcUw`7*xI->gEOUqf#Rfkp6><{ggE4?1t zlWhMt=lhW;g>!fJ-T!{p^vmICPp4n?cbK-nS?YJ@$3vR~|68qP-2zP(Dit;y1`Pk4 VS<3rjZ|wn<)Sj+>F6*2UngDE{QNI8H literal 0 HcmV?d00001 diff --git a/briar-android/res/drawable-mdpi/content_read.png b/briar-android/res/drawable-mdpi/content_read.png new file mode 100644 index 0000000000000000000000000000000000000000..3d61dc5e35867d190dd452c5b86910a8ce349890 GIT binary patch literal 1419 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8<fR&VF+bTgE72zA8;GAESs$i;Tpqp%9W~g9hqGxDg zU}<8hqhMrUXrOOsq;FuZYiM9)YHnp<r~m~@K--E^(yW49+@N*=dA3R!B_#z``ugSN z<$C4Ddih1^`i7R4mih)p`bI{&Koz>hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s0<RzFwUtj!6b93RUi%Wu15$?rmaB)aw zL8^XGYH@yPQ8F;%(v(3~6<9eJr6!i-7lq{K=fFZSAS1sdzc?emK*2fKRL@YsH!(Rg z4<rKC;p=PVnO9trn3tUD>0+w{G(#^lGsVi($k^Q2(Adz_$-u?X(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1OnfUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dPPZ7j z;WQ7bHwCv_3~=hz2RcR{6tzfE4HE*U9}p9saDg0n(of9;ruQOX!cHp*I?KSo_}A0L zF{I+wo9U6>haE&(FCPty4h(c$@!*qqR^ZCtL82^2#U20p+x_CN`4|}x<4|yLss5|o z{8}1Y7IfU=6+VAJv*p5)$y*jS$^OWg<oRsgxjUBTA2VhxyRxZrs?_#f4Ez77h;`qr z+{Sz6;}3>Cr|o9=sCjd55UgP9Y2=IRZVoQUaqoy_{B_{10{_07*LkMhO!w~SY49^h z<d|c4=kww0ZLL2}v-mX#UPuy(m?%)h=I0O<)?irRr?g?}1XTmha|ag&b_5;}h+vI% zh*-kKB>K*z_vdB}GpQSl;b}}xPlVqz^=nnM{t)hsne^z#GGm1%(}1r_Z|<_pNZfGf z=9ef=kH%;@@l_cWO6u<<^;1<J^o8tBJvhxrx1*_4pwQ8!CE0y#nnTKKliue|a{rSI zGbZfcY1AmZC0o8?tI&d?|7{t&5BnSoa!NbM)c^h9#D)9W&ondkg)b;wZR8gr^5{C} z&ShKen(F+Pw|~!XU=QNa`BpRe+=)GYS&eZgL?l>mKj@8q<-PrElxA6PZKNdo*INdY zd9D}8*c9s?-V$B-@5rBzALCX|_uc)TImznxjFYo>$=pbuR65=BL>H^Znyy80Uz((! zHEy`+_)Rm9`@)Ny!mu-sw$2eQ{$On)dYtk9w`fCS3y%<SJ4TaZ2BH(v47qlwDCFyW jocC+{!~NnPv=1;Wo7vFPQ=G{TDjq#u{an^LB{Ts5TyX}r literal 0 HcmV?d00001 diff --git a/briar-android/res/drawable-mdpi/content_unread.png b/briar-android/res/drawable-mdpi/content_unread.png new file mode 100644 index 0000000000000000000000000000000000000000..72956c4456bea7d7e6c678b30ebf1304ea9795b6 GIT binary patch literal 1376 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VX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P+oS zSY0-UjfHjAL9L3SvkgDiS41$M^U1iw+Z657W-D{3t>@8!Qz1L*!zXI+DZM}N|HNz4 vgu?vWhW`{c?hBps&(M>13EL#I52^<kF1eP7o1NE-1eJN7u6{1-oD!M<Do*NO literal 0 HcmV?d00001 diff --git a/briar-android/res/drawable-xhdpi/content_read.png b/briar-android/res/drawable-xhdpi/content_read.png new file mode 100644 index 0000000000000000000000000000000000000000..99a826a8d43aad459ddff4f7fd496a022493b0a1 GIT binary patch literal 1895 zcmaJ?c~BEq7!P0}g0vh8XeC`jQBlZdAtACQ;R+EbK@1Ti6D>KGut2g)vNR!}Qlg_W z74a%^*dld65fvR3Em}kYht^U@8Dq36hYGD$K&r(SOE(m>f0XXb?tAZh-|zR`v)hvr zS2#N^aHLQu&T+AP5xGWKU#dO%tw(e2lgoS}MnWWG>4aXUMJSO<OpX9?YMBZVAu?rN zPA3vZq1b(hiY0_Zm;fs<HA80AVHngniKbA(!VS1gk%bU|98sYfE`6xEg$|%fE`1GK z$Q0tyNCp~f)FR2oM6tq{r3h8h!+AiM0VWC52q6Ou>THb;HgM^ayfC@9ia|OssX}CN z>Hjz-5helAm=*!p3}&E$83F+zEC$44hO$BffFLHs1fd|1$q9s*Fq;E2Az<pElh(A# zbXdd}OxYq&TzUpU;4ld4^?HUrn1N|kAQT!J3NnMhprAlfBT$#8A!LR?jm~$Pfsg1E zS`;TxOaoXMWpXT+;L=G?{|P~jzoFIWrqV<v3^d4a5MnT`Ax$d^h5xUrR=?5K5hCQR zzyC?B6X)RwC_;2tu2w-7F5TB^3WuY$h>XCrVhqck&SFvqMqs)O3<si<*$fB}$`q)^ zDw#wGg>alkN60h^B#zIelN<~bRl;m2DtLKFa0ok!$%mjAD3k?-#;~HIBL!@T!-|5Y zv3yLCt41`$G*<Z*%b5{tZ3Z<?TIM5K^ixDB&|+#}GH4i`*%#J~d{bEE%)YQ^#Db(V zptZFBD)qF8>>um)P2-Y>H?5Co$bQ$7jeRqyFNT~KOB_E^Y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PoYFwv1jZ4r_yQ{f5tak%)2u`d7NLu^musXOR0DR*V5A5%2^aP z;N|(n=&Rq;J~wyeqy|p_y=}H9pU3qN9cz#=3<)FrBX?e!SQk5v``OI#8*|1tZJHJS zs%l~7f%vwa+5CHV&gRXHkB}<HpO_!*rFR@gY#iNd+w_}%`PQ$NoSO`r(-b!MyYn20 zIvfn%;rQVF27!%q$hqPVy$PmflDDZ8a>%MRS3j_^r<87TT3g3`IQj33i%H}kk4h{0 E8&eYK@Bjb+ literal 0 HcmV?d00001 diff --git a/briar-android/res/drawable-xhdpi/content_unread.png b/briar-android/res/drawable-xhdpi/content_unread.png new file mode 100644 index 0000000000000000000000000000000000000000..2e4ddddbd1f576701b7bcebb959c6142a487bbc6 GIT binary patch literal 1774 zcmaJ=Yfuwc6pk1mFy&RPh*n%T3M!J_4M{LD0YaA4bPVzcO65^PvV=9+Y)DoJA~pqv zDk98?FiJ&H<e~Nb7@<;;Dq4JXT1BH$ODon6ibC<#Qf)T~+8@$8vwQD3bH4AKbI*6z z$3%bR;Xcis!C-hO7Nc?W9^v>{F7$sdo^^-b{HUlzDxS=sa@1ywA=Q%U7@#23IxG%T zYjd+YF)@QNaW<|>q!N`&L>iLds2wpJD`BG142C$|YEo<T7zLzbI@~A$AD?Uk0bDBq zm-Cgd(j>z&@x`mnSp4c}m1ebGBh-T7VSv~wq6r9$QUg}PV6=#=5^#i9M4ugQ2n0q# zD7^%HT~wkn29S|v4B&I%U=1ul00EDK@L(ZNxB%e72n-=y2o4QKU=cr51S7!c0_kjK zZH6cgm5=74EeV)OQ6>=t<>cgWazZ$ySqC9Pp%8+(5SJTFM+94Pjg;CNY_zb)7*Ncj zG2<o*CyjuEQJqe%q9h<)>FX8<(;Hf&W%Qcp3xlj`6NGSJM@wUYO6C8D62zNm3l)dG zt@oY87FDhZgW@m?xyr1e2baNiq%w(QW=u_yW)(>q#%?htlcY#XCTRj>@q7*fDAgL= z=<tjnluD7pXra_b4W>XPAkD$Sajl5YL!}6h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ohO=*b{(w{KwF8fj9u}5NyLu<=Mv=|7Q9R)<;qAOeWs!N? zhkIV;>07<)S47NhzkAJUBUgUfvQ#ohaA<?o?N0nIrzedC9qW~C0gXSFRn}*-SkqhQ zpTajm@)6z6NJ*9{vIA<`ybj%UZ!*;fTyFFJWH3K+?d*36yC(6K8_ZatRP~+V)PoFq NDWam$1CeP3{{ru`nf(9& literal 0 HcmV?d00001 diff --git a/briar-android/res/values-v11/styles.xml b/briar-android/res/values-v11/styles.xml index f5476f167a..aa2dc3fa70 100644 --- a/briar-android/res/values-v11/styles.xml +++ b/briar-android/res/values-v11/styles.xml @@ -1,4 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <style name="LightTheme" parent="android:Theme.Holo.Light" /> + <style name="LightThemeNoActionBar" + parent="android:Theme.Holo.Light.NoActionBar" /> </resources> \ No newline at end of file diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml index df2deb07c7..bb5a5d51d6 100644 --- a/briar-android/res/values/strings.xml +++ b/briar-android/res/values/strings.xml @@ -12,7 +12,6 @@ <string name="contact_list_title">Contacts</string> <string name="contact_connected">Connected</string> <string name="contact_last_connected">Last connected <br /> %1$s</string> - <string name="add_contact_button">New Contact</string> <string name="search_button">Search</string> <string name="add_contact_title">Add a Contact</string> <string name="same_network">Briar can add contacts via Wi-Fi or Bluetooth. For security reasons, you must be face-to-face to add someone as a contact. To use Wi-Fi you must both be connected to the same network.</string> @@ -42,6 +41,7 @@ <string name="enter_nickname">Please enter a nickname for this contact:</string> <string name="done_button">Done</string> <string name="messages_title">Messages</string> - <string name="compose_button">New Message</string> + <string name="message_from">From: %1$s</string> <string name="compose_title">New Message</string> + <string name="message_to">To: %1$s</string> </resources> diff --git a/briar-android/res/values/styles.xml b/briar-android/res/values/styles.xml index 7974ea7455..0b92145119 100644 --- a/briar-android/res/values/styles.xml +++ b/briar-android/res/values/styles.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <style name="LightTheme" parent="android:Theme.Light" /> + <style name="LightThemeNoActionBar" parent="android:Theme.Light" /> </resources> \ No newline at end of file diff --git a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java index d0d7ace2fd..6fcea7483b 100644 --- a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java +++ b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java @@ -31,7 +31,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Button; +import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; @@ -69,13 +69,10 @@ implements OnClickListener, DatabaseListener, ConnectionListener { list.setOnItemClickListener(adapter); layout.addView(list); - Button addContactButton = new Button(this); + ImageButton addContactButton = new ImageButton(this); + addContactButton.setPadding(5, 5, 5, 5); addContactButton.setBackgroundResource(0); - addContactButton.setLayoutParams(new LayoutParams(MATCH_PARENT, - WRAP_CONTENT)); - addContactButton.setCompoundDrawablesWithIntrinsicBounds(0, - R.drawable.social_add_person, 0, 0); - addContactButton.setText(R.string.add_contact_button); + addContactButton.setImageResource(R.drawable.social_add_person); addContactButton.setOnClickListener(this); layout.addView(addContactButton); diff --git a/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java b/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java index f178060fda..f290dbc2d8 100644 --- a/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java @@ -7,7 +7,10 @@ import static android.widget.LinearLayout.VERTICAL; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.List; import java.util.concurrent.Executor; import java.util.logging.Logger; @@ -30,7 +33,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; -import android.widget.Button; +import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; @@ -49,22 +52,21 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { @Inject private DatabaseComponent db; @Inject @DatabaseExecutor private Executor dbExecutor; + private ContactId contactId = null; + private String contactName = null; private ConversationAdapter adapter = null; private ListView list = null; - private String contactName = null; - private volatile ContactId contactId = null; @Override public void onCreate(Bundle state) { super.onCreate(null); Intent i = getIntent(); - contactName = i.getStringExtra("net.sf.briar.CONTACT_NAME"); - if(contactName == null) throw new IllegalStateException(); - setTitle(contactName); int id = i.getIntExtra("net.sf.briar.CONTACT_ID", -1); if(id == -1) throw new IllegalStateException(); contactId = new ContactId(id); + contactName = i.getStringExtra("net.sf.briar.CONTACT_NAME"); + if(contactName == null) throw new IllegalStateException(); LinearLayout layout = new LinearLayout(this); layout.setLayoutParams(new LayoutParams(MATCH_PARENT, MATCH_PARENT)); @@ -79,13 +81,10 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { list.setOnItemClickListener(this); layout.addView(list); - Button composeButton = new Button(this); + ImageButton composeButton = new ImageButton(this); + composeButton.setPadding(5, 5, 5, 5); composeButton.setBackgroundResource(0); - composeButton.setLayoutParams(new LayoutParams(MATCH_PARENT, - WRAP_CONTENT)); - composeButton.setCompoundDrawablesWithIntrinsicBounds(0, - R.drawable.content_new_email, 0, 0); - composeButton.setText(R.string.compose_button); + composeButton.setImageResource(R.drawable.content_new_email); composeButton.setOnClickListener(this); layout.addView(composeButton); @@ -122,6 +121,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { } private void reloadMessageHeaders() { + final ContactId contactId = this.contactId; dbExecutor.execute(new Runnable() { public void run() { try { @@ -146,18 +146,19 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { }); } - private void updateConversation( - final Collection<PrivateMessageHeader> headers) { + private void updateConversation(Collection<PrivateMessageHeader> headers) { + final List<PrivateMessageHeader> sort = + new ArrayList<PrivateMessageHeader>(headers); + Collections.sort(sort, AscendingHeaderComparator.INSTANCE); runOnUiThread(new Runnable() { public void run() { int firstUnread = -1; adapter.clear(); - for(PrivateMessageHeader h : headers) { + for(PrivateMessageHeader h : sort) { if(firstUnread == -1 && !h.isRead()) firstUnread = adapter.getCount(); adapter.add(h); } - adapter.sort(AscendingHeaderComparator.INSTANCE); if(firstUnread == -1) list.setSelection(adapter.getCount() - 1); else list.setSelection(firstUnread); } diff --git a/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java b/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java index ba5b3c661d..32b8e73b17 100644 --- a/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java @@ -37,7 +37,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Button; +import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; @@ -75,13 +75,10 @@ implements OnClickListener, DatabaseListener { list.setOnItemClickListener(adapter); layout.addView(list); - Button composeButton = new Button(this); + ImageButton composeButton = new ImageButton(this); + composeButton.setPadding(5, 5, 5, 5); composeButton.setBackgroundResource(0); - composeButton.setLayoutParams(new LayoutParams(MATCH_PARENT, - WRAP_CONTENT)); - composeButton.setCompoundDrawablesWithIntrinsicBounds(0, - R.drawable.content_new_email, 0, 0); - composeButton.setText(R.string.compose_button); + composeButton.setImageResource(R.drawable.content_new_email); composeButton.setOnClickListener(this); layout.addView(composeButton); @@ -110,7 +107,14 @@ implements OnClickListener, DatabaseListener { ContactId contactId = db.addContact("Carol"); // Insert some text messages to and from the contact for(int i = 0; i < 20; i++) { - String body = "Message " + i + " is short"; + String body; + if(i % 3 == 0) { + body = "Message " + i + " is short."; + } else { + body = "Message " + i + " is long enough to" + + " wrap onto a second line on some" + + " screens."; + } Message m = messageFactory.createPrivateMessage( null, "text/plain", body.getBytes("UTF-8")); if(Math.random() < 0.5) diff --git a/briar-android/src/net/sf/briar/android/messages/ReadMessageActivity.java b/briar-android/src/net/sf/briar/android/messages/ReadMessageActivity.java index e998249754..c862c978c0 100644 --- a/briar-android/src/net/sf/briar/android/messages/ReadMessageActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ReadMessageActivity.java @@ -1,7 +1,7 @@ package net.sf.briar.android.messages; +import static android.view.Gravity.CENTER; import static android.view.Gravity.CENTER_VERTICAL; -import static android.view.Gravity.RIGHT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.widget.LinearLayout.HORIZONTAL; @@ -19,6 +19,7 @@ import net.sf.briar.android.BriarActivity; import net.sf.briar.android.BriarService; import net.sf.briar.android.BriarService.BriarServiceConnection; import net.sf.briar.api.ContactId; +import net.sf.briar.api.android.BundleEncrypter; import net.sf.briar.api.db.DatabaseComponent; import net.sf.briar.api.db.DatabaseExecutor; import net.sf.briar.api.db.DbException; @@ -45,14 +46,16 @@ implements OnClickListener { private final BriarServiceConnection serviceConnection = new BriarServiceConnection(); + @Inject private BundleEncrypter bundleEncrypter; @Inject private DatabaseComponent db; @Inject @DatabaseExecutor private Executor dbExecutor; private ContactId contactId = null; private String contactName = null; private MessageId messageId = null; - private boolean starred = false; - private ImageButton starButton = null, replyButton = null; + private boolean starred, read; + private ImageButton replyButton = null, starButton = null; + private ImageButton readButton = null; private TextView content = null; @Override @@ -65,7 +68,6 @@ implements OnClickListener { contactId = new ContactId(cid); contactName = i.getStringExtra("net.sf.briar.CONTACT_NAME"); if(contactName == null) throw new IllegalStateException(); - setTitle(contactName); byte[] mid = i.getByteArrayExtra("net.sf.briar.MESSAGE_ID"); if(mid == null) throw new IllegalStateException(); messageId = new MessageId(mid); @@ -73,52 +75,108 @@ implements OnClickListener { if(contentType == null) throw new IllegalStateException(); long timestamp = i.getLongExtra("net.sf.briar.TIMESTAMP", -1); if(timestamp == -1) throw new IllegalStateException(); - starred = i.getBooleanExtra("net.sf.briar.STARRED", false); + + if(state != null && bundleEncrypter.decrypt(state)) { + starred = state.getBoolean("net.sf.briar.STARRED"); + read = state.getBoolean("net.sf.briar.READ"); + } else { + starred = i.getBooleanExtra("net.sf.briar.STARRED", false); + read = false; + final MessageId id = messageId; + dbExecutor.execute(new Runnable() { + public void run() { + try { + serviceConnection.waitForStartup(); + db.setReadFlag(id, true); + runOnUiThread(new Runnable() { + public void run() { + setRead(true); + } + }); + } catch(DbException e) { + if(LOG.isLoggable(WARNING)) + LOG.log(WARNING, e.toString(), e); + } catch(InterruptedException e) { + if(LOG.isLoggable(INFO)) + LOG.info("Interrupted while waiting for service"); + Thread.currentThread().interrupt(); + } + } + }); + } LinearLayout layout = new LinearLayout(this); layout.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); layout.setOrientation(VERTICAL); + ScrollView scrollView = new ScrollView(this); + // Give me all the width and all the unused height + scrollView.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT, + 1)); + + LinearLayout message = new LinearLayout(this); + message.setOrientation(VERTICAL); + LinearLayout header = new LinearLayout(this); header.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); header.setOrientation(HORIZONTAL); header.setGravity(CENTER_VERTICAL); - starButton = new ImageButton(this); - starButton.setPadding(5, 5, 5, 5); - starButton.setBackgroundResource(0); - if(starred) starButton.setImageResource(R.drawable.rating_important); - else starButton.setImageResource(R.drawable.rating_not_important); - starButton.setOnClickListener(this); - header.addView(starButton); - - replyButton = new ImageButton(this); - replyButton.setPadding(5, 5, 5, 5); - replyButton.setBackgroundResource(0); - replyButton.setImageResource(R.drawable.social_reply); - replyButton.setOnClickListener(this); - header.addView(replyButton); + TextView name = new TextView(this); + // Give me all the unused width + name.setLayoutParams(new LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1)); + name.setTextSize(18); + name.setPadding(10, 0, 0, 0); + String format = getResources().getString(R.string.message_from); + name.setText(String.format(format, contactName)); + header.addView(name); TextView date = new TextView(this); - // Give me all the unused width - date.setLayoutParams(new LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1)); date.setTextSize(14); - date.setPadding(10, 0, 10, 0); - date.setGravity(RIGHT); + date.setPadding(0, 0, 10, 0); long now = System.currentTimeMillis(); date.setText(DateUtils.formatSameDayTime(timestamp, now, SHORT, SHORT)); header.addView(date); - layout.addView(header); + message.addView(header); if(contentType.equals("text/plain")) { // Load and display the message body - ScrollView scrollView = new ScrollView(this); content = new TextView(this); content.setPadding(10, 10, 10, 10); - scrollView.addView(content); - layout.addView(scrollView); + message.addView(content); loadMessageBody(); } + scrollView.addView(message); + layout.addView(scrollView); + + LinearLayout footer = new LinearLayout(this); + footer.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); + footer.setOrientation(HORIZONTAL); + footer.setGravity(CENTER); + + replyButton = new ImageButton(this); + replyButton.setPadding(5, 5, 5, 5); + replyButton.setBackgroundResource(0); + replyButton.setImageResource(R.drawable.social_reply); + replyButton.setOnClickListener(this); + footer.addView(replyButton); + layout.addView(footer); + + starButton = new ImageButton(this); + starButton.setPadding(5, 5, 5, 5); + starButton.setBackgroundResource(0); + if(starred) starButton.setImageResource(R.drawable.rating_important); + else starButton.setImageResource(R.drawable.rating_not_important); + starButton.setOnClickListener(this); + footer.addView(starButton); + + readButton = new ImageButton(this); + readButton.setPadding(5, 5, 5, 5); + readButton.setBackgroundResource(0); + if(read) readButton.setImageResource(R.drawable.content_unread); + else readButton.setImageResource(R.drawable.content_read); + readButton.setOnClickListener(this); + footer.addView(readButton); setContentView(layout); @@ -133,12 +191,9 @@ implements OnClickListener { dbExecutor.execute(new Runnable() { public void run() { try { - // Wait for the service to be bound and started serviceConnection.waitForStartup(); - // Load the message body from the database byte[] body = db.getMessageBody(messageId); final String text = new String(body, "UTF-8"); - // Display the message body runOnUiThread(new Runnable() { public void run() { content.setText(text); @@ -159,26 +214,10 @@ implements OnClickListener { } @Override - public void onResume() { - super.onResume(); - final MessageId id = messageId; - dbExecutor.execute(new Runnable() { - public void run() { - try { - // Wait for the service to be bound and started - serviceConnection.waitForStartup(); - // Mark the message as read - db.setReadFlag(id, true); - } catch(DbException e) { - if(LOG.isLoggable(WARNING)) - LOG.log(WARNING, e.toString(), e); - } catch(InterruptedException e) { - if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); - Thread.currentThread().interrupt(); - } - } - }); + public void onSaveInstanceState(Bundle state) { + state.putBoolean("net.sf.briar.STARRED", starred); + state.putBoolean("net.sf.briar.READ", read); + bundleEncrypter.encrypt(state); } @Override @@ -188,29 +227,71 @@ implements OnClickListener { } public void onClick(View view) { - if(view == starButton) { - final MessageId id = messageId; - final boolean starredNow = !starred; + if(view == replyButton) { + Intent i = new Intent(this, WriteMessageActivity.class); + i.putExtra("net.sf.briar.CONTACT_ID", contactId.getInt()); + i.putExtra("net.sf.briar.CONTACT_NAME", contactName); + i.putExtra("net.sf.briar.PARENT_ID", messageId.getBytes()); + startActivity(i); + finish(); + } else if(view == starButton) { + final MessageId messageId = this.messageId; + final boolean starred = !this.starred; dbExecutor.execute(new Runnable() { public void run() { try { - db.setStarredFlag(id, starredNow); + serviceConnection.waitForStartup(); + db.setStarredFlag(messageId, starred); + runOnUiThread(new Runnable() { + public void run() { + setStarred(starred); + } + }); } catch(DbException e) { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); + } catch(InterruptedException e) { + if(LOG.isLoggable(INFO)) + LOG.info("Interrupted while waiting for service"); + Thread.currentThread().interrupt(); + } + } + }); + } else if(view == readButton) { + final MessageId messageId = this.messageId; + final boolean read = !this.read; + dbExecutor.execute(new Runnable() { + public void run() { + try { + serviceConnection.waitForStartup(); + db.setReadFlag(messageId, read); + runOnUiThread(new Runnable() { + public void run() { + setRead(read); + } + }); + } catch(DbException e) { + if(LOG.isLoggable(WARNING)) + LOG.log(WARNING, e.toString(), e); + } catch(InterruptedException e) { + if(LOG.isLoggable(INFO)) + LOG.info("Interrupted while waiting for service"); + Thread.currentThread().interrupt(); } } }); - starred = starredNow; - if(starred) - starButton.setImageResource(R.drawable.rating_important); - else starButton.setImageResource(R.drawable.rating_not_important); - } else if(view == replyButton) { - Intent i = new Intent(this, WriteMessageActivity.class); - i.putExtra("net.sf.briar.CONTACT_ID", contactId.getInt()); - i.putExtra("net.sf.briar.CONTACT_NAME", contactName); - i.putExtra("net.sf.briar.PARENT_ID", messageId.getBytes()); - startActivity(i); } } + + private void setStarred(boolean starred) { + this.starred = starred; + if(starred) starButton.setImageResource(R.drawable.rating_important); + else starButton.setImageResource(R.drawable.rating_not_important); + } + + private void setRead(boolean read) { + this.read = read; + if(read) readButton.setImageResource(R.drawable.content_unread); + else readButton.setImageResource(R.drawable.content_read); + } } diff --git a/briar-android/src/net/sf/briar/android/messages/WriteMessageActivity.java b/briar-android/src/net/sf/briar/android/messages/WriteMessageActivity.java index 92d0dbfdff..078541da89 100644 --- a/briar-android/src/net/sf/briar/android/messages/WriteMessageActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/WriteMessageActivity.java @@ -9,7 +9,6 @@ import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.util.concurrent.Executor; import java.util.logging.Logger; @@ -35,7 +34,7 @@ import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; -import android.widget.ScrollView; +import android.widget.TextView; import com.google.inject.Inject; @@ -56,7 +55,6 @@ implements OnClickListener { private ContactId contactId = null; private String contactName = null; private MessageId parentId = null; - private ImageButton cancelButton = null, sendButton = null; private EditText content = null; @Override @@ -69,42 +67,42 @@ implements OnClickListener { contactId = new ContactId(cid); contactName = i.getStringExtra("net.sf.briar.CONTACT_NAME"); if(contactName == null) throw new IllegalStateException(); - byte[] pid = i.getByteArrayExtra("net.sf.briar.MESSAGE_ID"); + byte[] pid = i.getByteArrayExtra("net.sf.briar.PARENT_ID"); if(pid != null) parentId = new MessageId(pid); LinearLayout layout = new LinearLayout(this); layout.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); layout.setOrientation(VERTICAL); - LinearLayout header = new LinearLayout(this); - header.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); - header.setOrientation(HORIZONTAL); - header.setGravity(CENTER_VERTICAL); - - cancelButton = new ImageButton(this); - cancelButton.setPadding(5, 5, 5, 5); - cancelButton.setBackgroundResource(0); - cancelButton.setImageResource(R.drawable.navigation_cancel); - cancelButton.setOnClickListener(this); - header.addView(cancelButton); - - sendButton = new ImageButton(this); + LinearLayout actionBar = new LinearLayout(this); + actionBar.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT)); + actionBar.setOrientation(HORIZONTAL); + actionBar.setGravity(CENTER_VERTICAL); + + TextView to = new TextView(this); + // Give me all the unused width + to.setLayoutParams(new LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1)); + to.setPadding(10, 0, 0, 0); + to.setTextSize(18); + String format = getResources().getString(R.string.message_to); + to.setText(String.format(format, contactName)); + actionBar.addView(to); + + ImageButton sendButton = new ImageButton(this); sendButton.setPadding(5, 5, 5, 5); sendButton.setBackgroundResource(0); sendButton.setImageResource(R.drawable.social_send_now); sendButton.setOnClickListener(this); - header.addView(sendButton); - layout.addView(header); + actionBar.addView(sendButton); + layout.addView(actionBar); - ScrollView scrollView = new ScrollView(this); content = new EditText(this); content.setPadding(10, 10, 10, 10); if(state != null && bundleEncrypter.decrypt(state)) { Parcelable p = state.getParcelable("net.sf.briar.CONTENT"); if(p != null) content.onRestoreInstanceState(p); } - scrollView.addView(content); - layout.addView(scrollView); + layout.addView(content); setContentView(layout); @@ -127,38 +125,32 @@ implements OnClickListener { } public void onClick(View view) { - if(view == cancelButton) { - finish(); - } else if(view == sendButton) { - final Message m; - try { - byte[] body = content.getText().toString().getBytes("UTF-8"); - m = messageFactory.createPrivateMessage(parentId, - "text/plain", body); - } catch(UnsupportedEncodingException e) { - throw new RuntimeException(e); - } catch(IOException e) { - throw new RuntimeException(e); - } catch(GeneralSecurityException e) { - throw new RuntimeException(e); - } - final ContactId contactId = this.contactId; - dbExecutor.execute(new Runnable() { - public void run() { - try { - serviceConnection.waitForStartup(); - db.addLocalPrivateMessage(m, contactId); - } catch(DbException e) { - if(LOG.isLoggable(WARNING)) - LOG.log(WARNING, e.toString(), e); - } catch(InterruptedException e) { - if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); - Thread.currentThread().interrupt(); - } - } - }); - finish(); + final Message m; + try { + byte[] body = content.getText().toString().getBytes("UTF-8"); + m = messageFactory.createPrivateMessage(parentId, "text/plain", + body); + } catch(IOException e) { + throw new RuntimeException(e); + } catch(GeneralSecurityException e) { + throw new RuntimeException(e); } + final ContactId contactId = this.contactId; + dbExecutor.execute(new Runnable() { + public void run() { + try { + serviceConnection.waitForStartup(); + db.addLocalPrivateMessage(m, contactId); + } catch(DbException e) { + if(LOG.isLoggable(WARNING)) + LOG.log(WARNING, e.toString(), e); + } catch(InterruptedException e) { + if(LOG.isLoggable(INFO)) + LOG.info("Interrupted while waiting for service"); + Thread.currentThread().interrupt(); + } + } + }); + finish(); } } -- GitLab