From 4fd8620c6cc1ca88c4496671e6e59c40aba93019 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch <daniel.gultsch@rwth-aachen.de> Date: Tue, 4 Feb 2014 21:44:16 +0100 Subject: [PATCH] allow to temporarily disable accounts --- gen/de/gultsch/chat/R.java | 23 ++-- res/drawable-hdpi/ic_action_add_person.png | Bin 0 -> 679 bytes res/drawable-hdpi/ic_action_delete.png | Bin 0 -> 1624 bytes res/drawable-mdpi/ic_action_add_person.png | Bin 0 -> 513 bytes res/drawable-mdpi/ic_action_delete.png | Bin 0 -> 1359 bytes res/drawable-xhdpi/ic_action_add_person.png | Bin 0 -> 884 bytes res/drawable-xhdpi/ic_action_delete.png | Bin 0 -> 1848 bytes res/drawable-xxhdpi/ic_action_add_person.png | Bin 0 -> 1171 bytes res/layout/account_row.xml | 3 +- res/menu/manageaccounts.xml | 3 +- res/menu/manageaccounts_context.xml | 17 +++ res/values/arrays.xml | 4 + src/de/gultsch/chat/entities/Account.java | 23 +++- .../chat/services/XmppConnectionService.java | 13 +- src/de/gultsch/chat/ui/EditAccount.java | 4 +- .../chat/ui/ManageAccountActivity.java | 124 +++++++++++++++--- .../chat/ui/NewConversationActivity.java | 2 +- 17 files changed, 183 insertions(+), 33 deletions(-) create mode 100644 res/drawable-hdpi/ic_action_add_person.png create mode 100644 res/drawable-hdpi/ic_action_delete.png create mode 100644 res/drawable-mdpi/ic_action_add_person.png create mode 100644 res/drawable-mdpi/ic_action_delete.png create mode 100644 res/drawable-xhdpi/ic_action_add_person.png create mode 100644 res/drawable-xhdpi/ic_action_delete.png create mode 100644 res/drawable-xxhdpi/ic_action_add_person.png create mode 100644 res/menu/manageaccounts_context.xml diff --git a/gen/de/gultsch/chat/R.java b/gen/de/gultsch/chat/R.java index 596a2bad5..982b1e2ed 100644 --- a/gen/de/gultsch/chat/R.java +++ b/gen/de/gultsch/chat/R.java @@ -11,6 +11,7 @@ public final class R { public static final class array { public static final int conversation_encryption_type_entries=0x7f050000; public static final int conversation_encryption_type_values=0x7f050001; + public static final int manage_account_options=0x7f050002; } public static final class attr { } @@ -28,17 +29,20 @@ public final class R { public static final int es_slidingpane_shadow=0x7f020000; public static final int ic_action_add=0x7f020001; public static final int ic_action_add_person=0x7f020002; - public static final int ic_action_send=0x7f020003; - public static final int ic_action_send_now=0x7f020004; - public static final int ic_action_unsecure=0x7f020005; - public static final int ic_launcher=0x7f020006; - public static final int ic_profile=0x7f020007; - public static final int message_border=0x7f020008; - public static final int notification=0x7f020009; - public static final int section_header=0x7f02000a; + public static final int ic_action_delete=0x7f020003; + public static final int ic_action_send=0x7f020004; + public static final int ic_action_send_now=0x7f020005; + public static final int ic_action_unsecure=0x7f020006; + public static final int ic_launcher=0x7f020007; + public static final int ic_profile=0x7f020008; + public static final int message_border=0x7f020009; + public static final int notification=0x7f02000a; + public static final int section_header=0x7f02000b; } public static final class id { public static final int account_confirm_password_desc=0x7f0a0011; + public static final int account_disable=0x7f0a002c; + public static final int account_enable=0x7f0a002d; public static final int account_jid=0x7f0a0000; public static final int account_list=0x7f0a0021; public static final int account_password=0x7f0a000f; @@ -98,7 +102,8 @@ public final class R { public static final class menu { public static final int conversations=0x7f090000; public static final int manageaccounts=0x7f090001; - public static final int newconversation=0x7f090002; + public static final int manageaccounts_context=0x7f090002; + public static final int newconversation=0x7f090003; } public static final class string { public static final int action_accounts=0x7f070003; diff --git a/res/drawable-hdpi/ic_action_add_person.png b/res/drawable-hdpi/ic_action_add_person.png new file mode 100644 index 0000000000000000000000000000000000000000..5ebac97064bbb47fa31bd67f130a9ae3fce34621 GIT binary patch literal 679 zcmV;Y0$BZtP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!Nl8RORCwC#SgmiuP!Ml{nVN~B$ZCt2 zfCPoEWfnUu2EqTq?83i*Wp<N8HR;4m4FVDjwP1HIxh5}7KVHkd_e$1FE-me&cfb31 zclQjVp@wcElj0+z(a7a~M!xSywFdx7kKy70J1MUjfB^VYHW;&l;!NQ=ur09s0{jIa zwz2@UD_DI2YzhA50od*Jdfn6M6lev2mS0qq;{XT?K>ShzXq8wyzfqQ#NOpAqK(Hqm z^F=h(<pGaKo`a#N4gd(WiL4*fP_+kaVy{2xN@6Oq?j3+}?*I;zAL|q?fHok6L{2Jj ztsu+Q0sv_TJjVMgfLfJoK|Bt?kB$)f<}HZ|m1#jHu^|BbML7T#MyxgFD=Id2BFZmu z=V6L(v^8_kjP2p_4Ez`uBzVS}v^_Lw*Nm`v<&=MuF&mgAW7)!{F4>fY$Z?@^x&1y? z{vcyZt2B|JbteKvi6#GrI_}A4VgNEkYdeW4jCmtaIUAQz+LpOqng<d?JhLpDbHgkv zqj!c_KQ6fcZ>hav3MkG(WR}yFM#yPZH;q0hhkR4O>N5$RXF2jtk=(6<1f59=U6*RS zZ0GFvOFR~lMXU%$Py~;h+%-IV0S@7Lbc+Y3)PqNs95fbP2;m0@3a7IHbq)*^S)b&@ zBW)h&a(zwhsgu$=Z;d-5Q?)=WjQxz)6RrtN+l9_x;9ZrGl9KwIqFFS~DS+AmoO5!_ zEjTzhXb+)+@LJ>T3dh)5o(qvu1E2x$-vM-LrcZoic{CboNDci7FaV8qrty#SYVH64 N002ovPDHLkV1g}oA)f#M literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/ic_action_delete.png b/res/drawable-hdpi/ic_action_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..e9ce89e0460b368de996f6b1d7ee149ae5fb1315 GIT binary patch literal 1624 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+bTgE72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vIK{g;1sq&viDnD3d#y!^$T34WPYTV35(_wdbMW+t|zj8Xic>4!<| z7sK0JLlV^|7eqgB)M$NBJD({@ZSk5rnd_3m76!a7sPl4~Et?_5c)#NCrsf=V?u2uJ zTW)3;itq67iswChBGuC;T6sQ`nT)xbX0F+-ATy&J)-}eBu~(eCwq2{`@{m<uvyIm? zn$b}B{8ix-Ip-Op83TDeWqyh*$U5Qv)S6wXT~XxcxyC)6<*EuBZ6ywCmhoO^Dv@>) zD~{#lSYCLj%tQV*@4p)6@Y0fu<fG-@nvWG{u!kRzdu(#n%PTuoC+gl0@1GweY_gmh z=FItiK)68h$Jco!6LXWU7hKX271}oclU&HX_I(W5z9wIvMJQMHTl??kcI!whiRs!V s@5XOi%e3`>&^BP&THD}u+@Fz+;rN|9?#>?y0zqZHr>mdKI;Vst0H|?TumAu6 literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/ic_action_add_person.png b/res/drawable-mdpi/ic_action_add_person.png new file mode 100644 index 0000000000000000000000000000000000000000..c43cf6553cf106bfddbfafcfd62f8627bedaa7ee GIT binary patch literal 513 zcmV+c0{;DpP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F80000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzqe(<TRCwC#RxMA&KoISf8n8t*)YfuI zLEK4d!PbI7faHG1@f%K~u^@|T0+JfUT~bwpC<eisWH#9}{o3ueA%RIIdztOcdpol; zvzGPOW!Cq@FbwBde982lrfD`h0S1ntZq0T9-3%eJ*8#r3at%Fb_=N0B&-02r&v!-% z06f5Q+tbe+B;G*cQ<Z?-vUj2AE7FO8-EeveZJ_9DVT=IeNXHq7`zBMMBm1TZd}$I; zt^}vfh`Qb)oCVkZ3p8o*LHFg7dIJ7e8X>?!z~|6o=o67@$omzOcre-rP}3P|o4Vj3 z^aQ`ZVf&DPUDycxl*oeMqw!YE<w)V3v#FHwEXtI?H=_<C?uttWrF*euBFWH!H0x2< z0iUw0*>{=PYttRkBEZ0Lr5k3fmXw0(K264A5CI0iYngy;LQ%R`iH2Qs>2$$GPq>l% z#iS~oFd6_Z#099BjDF=6)k)yY&`gMwJ0XYv`PV*575arNBLCGky%S~a7(URdr+qC- z+BAW6-v~^SU!-J3I^~PV*qd-NaYpu^SpU)?KLQK@)OmL!XMKio00000NkvXXu0mjf D);{g= literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/ic_action_delete.png b/res/drawable-mdpi/ic_action_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..cedb1085b85cf28fec0152168da61defb93fd6fa GIT binary patch literal 1359 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(#^lGsVip$->3i)zr|`$-u?X(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1OnfUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dPPdr2 z;WQ7bHwCv_3~=hz2RcR{6tzfE4HE*U9}p9saDg0n(of9;ruQOX!d}0Wsg!|%@t~)R zV@SoVH`6zIF*^#hy?=C6g-guwsFP#h8kgDHTg9ZM<&U^+5L)9>BXHj#C&z`mTO&zx zT9ae*f(6sxsFwfZ-v2N{FC{-;wN>(m#iln#|IeK}mvhIWZ?0q1LCFogtQCLNe(YP% z=i4ayK<lw@!SVd-SzDv*7&W)?njKWHKdmFjnEXKEPIRwB*VF^t7EHQaGuW#|K0UWo zaK6u$nB>#Yce2gqtnB)xR0HN`4y-a-l?twJ8cGA$`yVt0o>EPi&ZH#tDLU}k$&Few z*s>G4nfyL+MJx%P_$Xj2-$b)hTX*(9n3O1+e&R7pR^E<I%lHSk+8Tlj*rpxOnXzPs zQ2Ed5f4Ww=4e1|P>~c6XKJCfxTz9hNZ&+UUN8KCg4=bPQ&9;3uO;UDdhwy^~Z4DE2 zHavK7t*grZ`7S1<d4(sKmPE(9^v|BOQ^;$%<FQqd4`yxSW%O&Cn;y4VS>c&zvGKR= zFt4=+eGLWz3OQwmFFfFIn$5(-%-HD5c*vn)gKokC%MZsM1-(%|@>Hfjd(B?X{D|A; zKVE1A*UTx9+30>ksOG5YHI@_Z$1HawOkcgpd77|)(ae(fyKEOoZ+cjNxL*H(djlf_ XdqiO|XOH7mP!Z?p>gTe~DWM4f=>_8H literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/ic_action_add_person.png b/res/drawable-xhdpi/ic_action_add_person.png new file mode 100644 index 0000000000000000000000000000000000000000..91434a47b245c06ee7eac2f640e695cee1b7fa0c GIT binary patch literal 884 zcmV-)1B?8LP)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU#7D+@wRCwC#TCZ>0KomZ=DG4d?z+^Sl z0R@c|4cKs{4Gj(rZNbR?h2qi<jEruy0|PBtq!u=$z?MvEYBI9-su$^WN)zAte0P@b zNl%HK<Z|D4=kMMRAF!U=fhWKd;0frp4RjAUolYn45`&MxPr!%tQ3alZufZQzt5xO# z0f9!~3B1g}!<s)qB7Oo9>rN8@z!C6*R$av&!M_0!l??(88-mAe{ssJFgJJNur%@FB zEsEk_XGD;|Uvl?&6MGvA#vFEn0GjAh6L_A4Wmk5<g@oA2SWIH-E&(KZ=Pk}@?)nZm zZ+T8ble<8LfQf;5O`Ifvwtv`L0t|uY$##x_u|a(bUDbeIr^By(C!jPqx7<Ynazo%N zQ`w<ZK?ElS>YP#B&gb<ya{3eQ_<J(7%~UEv4*~%=@tY<qM#<Gz?$W)>ksuPlgB@zf z;^y43mzk^*NfSUT{cB4Ww@_St%q{rX|A)y_K&c{B6vayvMPngY8Nsy=;On}T9RQCj zKjSXl0l|NqCjbqAqEMZJ9}7i|Pw-g<B;-4Q$MBt{5c59(`0u9UfJQ}860b`^6#19| z3!WLh$M41jS`2d${H={ZNK089h`?=pp>p1%o&fkeTalp7zCcL#^BLP;D@5SG>7K8c zMGM*(l)6J=XQ(89w%rWz)-V#}1u!8|!<EH0S1CCLisGimh=TcK`j!Y3fzO5DWn&pd zitk2q1bR$bF|w@<fh72Zz}IbvR9prr(>uhSbZbH@4kf@ZNac?t#y_GnU$(r31g8)z zmAe8eV+0WR#DYdm+9n~Wx$PIsu3d|_gHWO`Wd*oaHb{RmXZCH|0;J$q<Y`;!@Qms0 z0IOO^;kLPY0Ihz)+_BH53nD3V%UWrg?jj&z?wR(U;b6!1-y|<i?E)hN(2;W8hh(Vt zy}`iMiPbpvVlKa^)10~A7Ay@MUL2VcTU;aAdfujK{$Xi{=eAFTQ|_q78pOVKTHYxF z_SFJFBlxFPO4Ztde?r6);0f>qcmg~D-uw>m1b6~G0sXZ90t^7JSKFHGD^ptl0000< KMNUMnLSTXgwvcuJ literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/ic_action_delete.png b/res/drawable-xhdpi/ic_action_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..98c73da1f35b06932d1a76de6468afb2768998d4 GIT binary patch literal 1848 zcmaJ?X;c$e7!430Q7Iq-qE?2WC|fcU6CsfZSpWkB5h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6<m<l!-;XUa&O5x_{8iE-2-$6BDmqR#bnB?zz7*I>Ffilz+%aAqsIDKM!e^y z8ZKO<nV2Iq{(A522k#{R>tPLUH=m9zOfYPk-8N=x(9zbKusxh`|F!iSv-er-q#ls= zP`xO22?HLm4rtEg6{g#C&N?dGeZ<x~%>{FHNZ4?jnh@HoPJA>|UK_vR^y7jpd3}dM zzdsUIJgM}ZSM0%2=I7()o$wfw<5;&WEM}b!@cv_3<&|FYGyDDaE$*jN%v)M6OmpSO zxmflnGWR;|bcl@rg36ECQs+`rD0}RkEM1muywk(CvYnp|BPDG<3+9O|o4V&3ZTC8@ z4>O)MbeJ={i}PL{*0<b0W+C(3XYd@=`oX%DJ^kC@`eOZ#y;8mRetxlROn&<*zU+?M z<@rU67=qaI<&Hr58?Waj&mBD<Th-QGvU~l@=>8(U)$}WmyN$cvzAqA!FZxJ&-X-<- zj~k~c(_2Qixs(Rhc~2QgwVb3}IR9wnCW99xbxHf1Fk8>+qq#0piF;6U1hpf((0qDT z-4<!ZJ+G^>63;_vU8NZvM>==gce;mb*_S_T%l9aF=-9Be<8HzQk@=+wP4{c3HUycE zb+zKH_imW6(Xi<}D67qHBj0)=MOTB;)azT{8ypJc<qoe{cAZ6kkr%FyY`X~FBy}a2 zMQ>P4zDDxvZT|^d=d%i*DhP2BPM(<Ft(E<m9aB>3e|qe(Q^`q83+L?mTpxFbvQVS* z+Z{+rJlsMFUzku0KOD%vWL7<Ug2TY;zo{t2Ic~r!d@>eYqcwIsIV<yOYX7KP>m`dj z5H}E2SR7$!zIxB%B;|r^z(0KZ)4sgsNjcqR<ULju!H3)<x8&HJt~`?YHQD&}uH(PI z-u!dxOJ<F>-P4&?YE_X5+*pt_*;U*3(dO2ow!!NnGxsseSA8UpCnefGaLNVRzcKyG N#KDoG{er|5{{R}rz~}$~ literal 0 HcmV?d00001 diff --git a/res/drawable-xxhdpi/ic_action_add_person.png b/res/drawable-xxhdpi/ic_action_add_person.png new file mode 100644 index 0000000000000000000000000000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?aeSG7^)v2OyE9Zzn1M$l$;h892v(Ks!C5JBYlAz3*O8TJT5npzlzqp-b z<uz-f<@>EkB)nd7`D%Qe5HvtM6SA+mtBNdwQxf6CIRRw($d&LmOoC@(4Mr_zS89;Y zq`y<<XGY(GpLa8gqA&CL{EsOQ)vHMU?SDXo$}SAVT`H>uP&Zr5ePt(Nlm5;is4)6@ ziMgxn$NPttsnpMpWj^1E1<0i90{M)wjV@@c+(BQg*$x3D0v#&1u+wz`Ul|M7R_-BG z9T#%<3XcB1GQ8rv21YhmK&;$Fzsv3Hq5>q!Z6wADAns@2xB#75c##5)YYsvb(2W4H zdpHACW&~mY1aJ$151pii#M=sAOGo_|G9Q+~(&NxoPX<~OTPRglf{)>XFb4o|K}wxg z_)hxVgAet~)*LVWe1I{SJ8_$LA_ia%fB*mlfB*mlfB*mlfB*mlfB--}tb&4Eq&M&u lpacK_00000a0LGZ7y#EUBa6FqPfY*-002ovPDHLkV1gy*4*mcD literal 0 HcmV?d00001 diff --git a/res/layout/account_row.xml b/res/layout/account_row.xml index 92e179f8a..402cb9658 100644 --- a/res/layout/account_row.xml +++ b/res/layout/account_row.xml @@ -2,7 +2,8 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="8dp"> + android:padding="8dp" + android:background="?android:attr/activatedBackgroundIndicator"> diff --git a/res/menu/manageaccounts.xml b/res/menu/manageaccounts.xml index 63441919e..1d81ba3c6 100644 --- a/res/menu/manageaccounts.xml +++ b/res/menu/manageaccounts.xml @@ -2,7 +2,8 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_add_account" android:showAsAction="always" - android:title="@string/action_add_account"/> + android:title="@string/action_add_account" + android:icon="@drawable/ic_action_add_person"/> <item android:id="@+id/action_settings" android:orderInCategory="100" diff --git a/res/menu/manageaccounts_context.xml b/res/menu/manageaccounts_context.xml new file mode 100644 index 000000000..30ba747d0 --- /dev/null +++ b/res/menu/manageaccounts_context.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + <item android:icon="@drawable/ic_action_delete" + android:title="Delete" + android:showAsAction="always" + /> + <item + android:id="@+id/account_disable" + android:title="Temporarily disable" + android:showAsAction="always"/> + <item + android:id="@+id/account_enable" + android:title="Enable" + android:showAsAction="always" + android:visible="false"/> + +</menu> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 592007ba4..b8135cdea 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -10,4 +10,8 @@ <item>pgp</item> <item>otr</item> </array> + <array name="manage_account_options"> + <item>Delete</item> + <item>Disable</item> + </array> </resources> diff --git a/src/de/gultsch/chat/entities/Account.java b/src/de/gultsch/chat/entities/Account.java index 3dfb298ac..6f8daf8d0 100644 --- a/src/de/gultsch/chat/entities/Account.java +++ b/src/de/gultsch/chat/entities/Account.java @@ -17,7 +17,9 @@ public class Account extends AbstractEntity{ public static final String ROSTERVERSION = "rosterversion"; public static final int OPTION_USETLS = 0; + public static final int OPTION_DISABLED = 1; + public static final int STATUS_DISABLED = -1; public static final int STATUS_OFFLINE = 0; public static final int STATUS_ONLINE = 1; public static final int STATUS_UNAUTHORIZED = 2; @@ -55,6 +57,20 @@ public class Account extends AbstractEntity{ return ((options & (1 << option)) != 0); } + public void setOption(int option, boolean value) { + if (value) { + Log.d("xmppService","options: "+options); + this.options = (this.options | 1 << option); + Log.d("xmppService","setting option "+option+" to 1"); + Log.d("xmppService","options: "+options); + } else { + Log.d("xmppService","options: "+options); + Log.d("xmppService","setting option "+option+" to 0"); + this.options = (this.options ^ 1 << option); + Log.d("xmppService","options: "+options); + } + } + public String getUsername() { return username; } @@ -84,7 +100,11 @@ public class Account extends AbstractEntity{ } public int getStatus() { - return this.status; + if (isOptionSet(OPTION_DISABLED)) { + return STATUS_DISABLED; + } else { + return this.status; + } } public void setResource(String resource) { @@ -102,6 +122,7 @@ public class Account extends AbstractEntity{ values.put(USERNAME, username); values.put(SERVER, server); values.put(PASSWORD, password); + values.put(OPTIONS,options); return values; } diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java index fbbaca5c0..ae1140eef 100644 --- a/src/de/gultsch/chat/services/XmppConnectionService.java +++ b/src/de/gultsch/chat/services/XmppConnectionService.java @@ -95,8 +95,11 @@ public class XmppConnectionService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { for (Account account : accounts) { if (!connections.containsKey(account)) { - - this.connections.put(account, this.createConnection(account)); + if (!account.isOptionSet(Account.OPTION_DISABLED)) { + this.connections.put(account, this.createConnection(account)); + } else { + Log.d(LOGTAG,account.getJid()+": not starting because it's disabled"); + } } } return START_STICKY; @@ -253,7 +256,11 @@ public class XmppConnectionService extends Service { connection.disconnect(); this.connections.remove(account); } - this.connections.put(account, this.createConnection(account)); + if (!account.isOptionSet(Account.OPTION_DISABLED)) { + this.connections.put(account, this.createConnection(account)); + } else { + Log.d(LOGTAG,account.getJid()+": not starting because it's disabled"); + } if (accountChangedListener!=null) accountChangedListener.onAccountListChangedListener(); } diff --git a/src/de/gultsch/chat/ui/EditAccount.java b/src/de/gultsch/chat/ui/EditAccount.java index 7cb48472b..f8d709814 100644 --- a/src/de/gultsch/chat/ui/EditAccount.java +++ b/src/de/gultsch/chat/ui/EditAccount.java @@ -92,7 +92,7 @@ public class EditAccount extends DialogFragment { usernameText.setText(account.getUsername()); serverText.setText(account.getServer()); okButtonDesc = "Edit"; - builder.setNegativeButton("Delete Account", new OnClickListener() { + /*builder.setNegativeButton("Delete Account", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -112,7 +112,7 @@ public class EditAccount extends DialogFragment { builder.setNegativeButton("Cancel",null); builder.create().show(); } - }); + });*/ } else { builder.setTitle("Add account"); okButtonDesc = "Add"; diff --git a/src/de/gultsch/chat/ui/ManageAccountActivity.java b/src/de/gultsch/chat/ui/ManageAccountActivity.java index 0a9b03de5..33469acd5 100644 --- a/src/de/gultsch/chat/ui/ManageAccountActivity.java +++ b/src/de/gultsch/chat/ui/ManageAccountActivity.java @@ -7,23 +7,32 @@ import de.gultsch.chat.R; import de.gultsch.chat.entities.Account; import de.gultsch.chat.ui.EditAccount.EditAccountListener; import android.app.Activity; +import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; +import android.view.ActionMode; +import android.view.ActionMode.Callback; import android.view.LayoutInflater; import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; +import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; -public class ManageAccountActivity extends XmppActivity { +public class ManageAccountActivity extends XmppActivity implements ActionMode.Callback { + protected boolean isActionMode = false; + protected ActionMode actionMode; + protected Account selectedAccountForActionMode = null; + protected List<Account> accountList = new ArrayList<Account>(); protected ListView accountListView; protected ArrayAdapter<Account> accountListViewAdapter; @@ -70,6 +79,10 @@ public class ManageAccountActivity extends XmppActivity { TextView statusView = (TextView) view .findViewById(R.id.account_status); switch (account.getStatus()) { + case Account.STATUS_DISABLED: + statusView.setText("temporarily disabled"); + statusView.setTextColor(0xFF1da9da); + break; case Account.STATUS_ONLINE: statusView.setText("online"); statusView.setTextColor(0xFF83b600); @@ -93,27 +106,49 @@ public class ManageAccountActivity extends XmppActivity { return view; } }; + final Activity activity = this; accountListView.setAdapter(this.accountListViewAdapter); accountListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) { - EditAccount dialog = new EditAccount(); - dialog.setAccount(accountList.get(position)); - dialog.setEditAccountListener(new EditAccountListener() { + if (!isActionMode) { + EditAccount dialog = new EditAccount(); + dialog.setAccount(accountList.get(position)); + dialog.setEditAccountListener(new EditAccountListener() { + + @Override + public void onAccountEdited(Account account) { + xmppConnectionService.updateAccount(account); + } + + @Override + public void onAccountDelete(Account account) { + xmppConnectionService.deleteAccount(account); + } + }); + dialog.show(getFragmentManager(), "edit_account"); + } else { + selectedAccountForActionMode = accountList.get(position); + actionMode.invalidate(); + } + } + }); + accountListView.setOnItemLongClickListener(new OnItemLongClickListener() { - @Override - public void onAccountEdited(Account account) { - xmppConnectionService.updateAccount(account); - } - - @Override - public void onAccountDelete(Account account) { - xmppConnectionService.deleteAccount(account); - } - }); - dialog.show(getFragmentManager(), "edit_account"); + @Override + public boolean onItemLongClick(AdapterView<?> arg0, View view, + int position, long arg3) { + if (!isActionMode) { + accountListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); + accountListView.setItemChecked(position,true); + selectedAccountForActionMode = accountList.get(position); + actionMode = activity.startActionMode((Callback) activity); + return true; + } else { + return false; + } } }); } @@ -180,4 +215,63 @@ public class ManageAccountActivity extends XmppActivity { }); dialog.show(getFragmentManager(), "add_account"); } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + if (item.getItemId()==R.id.account_disable) { + selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, true); + xmppConnectionService.updateAccount(selectedAccountForActionMode); + mode.finish(); + } else if (item.getItemId()==R.id.account_enable) { + selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, false); + xmppConnectionService.updateAccount(selectedAccountForActionMode); + mode.finish(); + } + return true; + } + + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + MenuInflater inflater = mode.getMenuInflater(); + inflater.inflate(R.menu.manageaccounts_context, menu); + return true; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + // TODO Auto-generated method stub + + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + if (selectedAccountForActionMode.isOptionSet(Account.OPTION_DISABLED)) { + menu.findItem(R.id.account_enable).setVisible(true); + menu.findItem(R.id.account_disable).setVisible(false); + } else { + menu.findItem(R.id.account_disable).setVisible(true); + menu.findItem(R.id.account_enable).setVisible(false); + } + return true; + } + + @Override + public void onActionModeStarted(ActionMode mode) { + super.onActionModeStarted(mode); + this.isActionMode = true; + } + + @Override + public void onActionModeFinished(ActionMode mode) { + super.onActionModeFinished(mode); + this.isActionMode = false; + accountListView.clearChoices(); + accountListView.requestLayout(); + accountListView.post(new Runnable() { + @Override + public void run() { + accountListView.setChoiceMode(ListView.CHOICE_MODE_NONE); + } + }); + } } diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java index 71c377dde..3bfb4e2a5 100644 --- a/src/de/gultsch/chat/ui/NewConversationActivity.java +++ b/src/de/gultsch/chat/ui/NewConversationActivity.java @@ -185,7 +185,7 @@ public class NewConversationActivity extends XmppActivity { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("Choose account"); - builder.setSingleChoiceItems(accountList,0,new OnClickListener() { + builder.setItems(accountList,new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {