From 50229bed6bde9f90f14734c45e0e9ea82f18aeca Mon Sep 17 00:00:00 2001 From: Tim Su Date: Fri, 27 Aug 2010 02:56:08 -0700 Subject: [PATCH] fixed up power widget, moved drawables into drawable/ folder for compatibility with Android 1.5 --- astrid/res/drawable-hdpi/checkbox.png | Bin 1864 -> 0 bytes astrid/res/drawable-mdpi/checkbox.png | Bin 1325 -> 0 bytes astrid/res/drawable-mdpi/importance_1.png | Bin 188 -> 0 bytes astrid/res/drawable-mdpi/importance_2.png | Bin 189 -> 0 bytes astrid/res/drawable-mdpi/importance_3.png | Bin 189 -> 0 bytes astrid/res/drawable-mdpi/importance_4.png | Bin 188 -> 0 bytes astrid/res/drawable-mdpi/importance_5.png | Bin 188 -> 0 bytes astrid/res/drawable-mdpi/importance_6.png | Bin 188 -> 0 bytes .../drawable-mdpi/widget_task_bg_black.9.png | Bin 199 -> 0 bytes .../res/drawable/btn_check_buttonless_off.png | Bin 0 -> 608 bytes .../res/drawable/btn_check_buttonless_on.png | Bin 0 -> 721 bytes astrid/res/drawable/scroll_down.xml | 24 ++ .../scroll_down_disabled.png | Bin .../scroll_down_normal.png} | Bin 285 -> 285 bytes astrid/res/drawable/scroll_down_pressed.png | Bin 0 -> 417 bytes astrid/res/drawable/scroll_up.xml | 24 ++ .../scroll_up_disabled.png | Bin .../scroll_up_normal.png} | Bin astrid/res/drawable/scroll_up_pressed.png | Bin 0 -> 371 bytes .../speech_bubble.9.png | Bin .../widget_bg_44_black.9.png | Bin .../widget_bg_44_blue.9.png | Bin .../widget_bg_44_red.9.png | Bin .../widget_bg_44_white.9.png | Bin astrid/res/layout/widget_power_44.xml | 253 +++++++++--------- astrid/res/values/strings-widget.xml | 2 + .../todoroo/astrid/widget/PowerWidget.java | 214 +++++++++------ 27 files changed, 309 insertions(+), 208 deletions(-) delete mode 100644 astrid/res/drawable-hdpi/checkbox.png delete mode 100644 astrid/res/drawable-mdpi/checkbox.png delete mode 100644 astrid/res/drawable-mdpi/importance_1.png delete mode 100644 astrid/res/drawable-mdpi/importance_2.png delete mode 100644 astrid/res/drawable-mdpi/importance_3.png delete mode 100644 astrid/res/drawable-mdpi/importance_4.png delete mode 100644 astrid/res/drawable-mdpi/importance_5.png delete mode 100644 astrid/res/drawable-mdpi/importance_6.png delete mode 100644 astrid/res/drawable-mdpi/widget_task_bg_black.9.png create mode 100755 astrid/res/drawable/btn_check_buttonless_off.png create mode 100755 astrid/res/drawable/btn_check_buttonless_on.png create mode 100644 astrid/res/drawable/scroll_down.xml rename astrid/res/{drawable-mdpi => drawable}/scroll_down_disabled.png (100%) rename astrid/res/{drawable-mdpi/scroll_down.png => drawable/scroll_down_normal.png} (69%) create mode 100644 astrid/res/drawable/scroll_down_pressed.png create mode 100644 astrid/res/drawable/scroll_up.xml rename astrid/res/{drawable-mdpi => drawable}/scroll_up_disabled.png (100%) rename astrid/res/{drawable-mdpi/scroll_up.png => drawable/scroll_up_normal.png} (100%) create mode 100644 astrid/res/drawable/scroll_up_pressed.png rename astrid/res/{drawable-mdpi => drawable}/speech_bubble.9.png (100%) rename astrid/res/{drawable-mdpi => drawable}/widget_bg_44_black.9.png (100%) rename astrid/res/{drawable-mdpi => drawable}/widget_bg_44_blue.9.png (100%) rename astrid/res/{drawable-mdpi => drawable}/widget_bg_44_red.9.png (100%) rename astrid/res/{drawable-mdpi => drawable}/widget_bg_44_white.9.png (100%) diff --git a/astrid/res/drawable-hdpi/checkbox.png b/astrid/res/drawable-hdpi/checkbox.png deleted file mode 100644 index 0896428ab75b4f6dfd6e365f5ebf841219fdeb32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1864 zcmV-O2ePx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igb_ z6(J&A3cM=-00ziOL_t(&-tC&*ZxiVi#((cSV>=#W#l{~AEQAQMV8}&Osg+1VuPcyN zz2K(#6X;*TKfq=05KyV2;&K=D0z5x!m zejcag03U$=0{;Qrupl*H`S$JGD~p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aA2FpT)VMxESr%~|r)tdurX^)4yOqP?klo!~6h-05lP7F#ZP9Et&xG3F-$zP`VHjwdMi_>; zu8Rs5}eo@bHjkvq`mD#c>?^{XPJVMq?uSvPwl!lp4I* zY~nZ$p68tkkW4Pi&6QxYTUjg?DVNIt6bc0l!{FJoXGBqiVHl^N5~boeCI|w2-{<=E z>v*1rZQB!(tEy@OH#?7wgOy4pY}=+#D4?op3U_pLgy(q-hr<*qpUKamCbWiY1>~?VtMUd0yJC6bc1Q(j*pK4(#$P{KnRiEoT%)19zqCewHl+*h#&|!r-h$CD#y1nE5EMm z93LN3DwUE*ni#(C6Gagl8ygd5ABP*;%K1H(B-!k!*Xx{|oTPpm?;u>)rPJx)c^;$D zX!;TD&HeM#N^KTcKA)#hC}3F@#bPmCbsWbyj>G2WCIExMVD75%ucLB&f?}~q5Ck}m zgAgJuF}kiJgkUfjkaWS*3VgEgxfDw}*zuAyJ}Q+8FJHc7G#VkLq*N-=XfzlOhZAN$ zuOnHcgUw}Cnza?WuH*YYnxMOwMc?}-S77Y zV>iqkuIs)PRKMRJ0I#PhcG&CnUahaMSF+|@)=6AdRdTr;ybg@87@w(XCszR$8srd&>X|!!X|7 z-v0C6y?eg^KLX!NDF^3)0T{q1z=uE^Fqe4d{T28P_z8G%iscM2fC`|$IkuOU2zCVg j1q{Z$to;8DcERyCTPTp19MHQC00000NkvXXu0mjf1`uL_ diff --git a/astrid/res/drawable-mdpi/importance_1.png b/astrid/res/drawable-mdpi/importance_1.png deleted file mode 100644 index a00c2384a4032018e0609fad1b2eb74baa6356fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^%s{Nh!3HE5Jr%7$RB@2I6T`Z5GB1G~wj^(N7l!{J zxM1({$v_d#0*}aI1_o|n5N2eUHAey{$X?><>&kwMLqJqjK7r5F4k#p9;u=xnoS&PU znpeW$T$GwvlA5AWo>`Ki;O^-g5Z=fq4pb!W>Eak7aXI;qywtDxj9fD$CLGX6|53=0 XD#`SvZ1%lQpb`d8S3j3^P6<>&kwMLqJqjaiAgzPZ!4!iOb1x5_u(-E ZL-E&$aqc)I$ztaD0e0s!!dGMWGY diff --git a/astrid/res/drawable-mdpi/importance_3.png b/astrid/res/drawable-mdpi/importance_3.png deleted file mode 100644 index 94923810d53c1464d21be87f767428bee99f72d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^%s{Nh!3HE5Jr%7$RB@2I6T`Z5GB1G~wj^(N7l!{J zxM1({$v_d#0*}aI1_o|n5N2eUHAey{$X?><>&kwMLqJ%Yp`0W0J5Wfn#5JPCIX^cy zHLrxhxhOTUBsE2$JhLQ2!QIn0AiR-J9H>ab)5S4F;&QS{+^<>&kwMLqJs3NcCc-H&95j#5JPCIX^cy zHLrxhxhOTUBsE2$JhLQ2!QIn0AiR-J9H>a#)5S4F;&O6MM#hix46Hsp9tl&7|5z}H XE@nDybJungPzi<Dnm{r-UW|VWTiH diff --git a/astrid/res/drawable-mdpi/importance_5.png b/astrid/res/drawable-mdpi/importance_5.png deleted file mode 100644 index 740521ab6bd7c1e28ac7ae957ceecea7e48e3aa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^%s{Nh!3HE5Jr%7$RB@2I6T`Z5GB1G~wj^(N7l!{J zxM1({$v_d#0*}aI1_o|n5N2eUHAey{$X?><>&kwMLqJs3N}KCpB~VDR#5JPCIX^cy zHLrxhxhOTUBsE2$JhLQ2!QIn0AiR-J9H>a#)5S4F;&L(%2gi@|46Hsp9tl&7|5z|E XTw$^niQ2LpsD#1O)z4*}Q$iB}Cq*tx diff --git a/astrid/res/drawable-mdpi/importance_6.png b/astrid/res/drawable-mdpi/importance_6.png deleted file mode 100644 index 894670918771e463fae1b4caba7242c8ce02f251..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^%s{Nh!3HE5Jr%7$RB@2I6T`Z5GB1G~wj^(N7l!{J zxM1({$v_d#0*}aI1_o|n5N2eUHAey{$X?><>&kwMLqJrGJ;MLrYM_v0iEBiObAE1a zYF-J0b5UwyNotBhd1gt5g1e`0KzJjcI8c$er;B5V#O36WfPf$88CZRIJQAiD|FK|r Y{f%*T=Dw{*fl3%WUHx3vIVCg!0G+Qg1^@s6 diff --git a/astrid/res/drawable-mdpi/widget_task_bg_black.9.png b/astrid/res/drawable-mdpi/widget_task_bg_black.9.png deleted file mode 100644 index 85c90843f85431f958cde3cbde0a55a08159c06a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmPihk&St{^!c-`#>Sd64!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiAh4PZ!4!jq}MV4GsT!jxf53t$4KAB`YBz iNkOnDOF~APx#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy7<5HgbW?9;ba!ELWdKlNX>N2bPDNB8b~7$BH8Ae8p8x;>x=BPq zR9Hvtl}}E>Kp4eIh#R9(3$zG=60|88gcM`{m@X{~*KiKP30QIrj=&8#0!QHp@Ln=a zYE#;R)P%VjGs zU>^(jpb~TowbtwPaJSoCo*QUl!6BpxP<1>W4*(+U`kb&Z=mrZ{T-WVxw_AeRd4fus zraf;q8-hAeF$u;)=5FYD+K5(khd(q|s}(`CF!8KtfiGhFZ5W20K#PL7x%zxQCx}Yj z><9kv0x3`f`W%f$uQ9+lP<1ky^aZGvW(nW362_JlQgOg2=;T1C06akSJ`8jn#~I*R z9O$S({HWNrZB|zm0SSP0Q8g{*Jqn&56^K}CbzL{`q7qs(SUmj80Mur)nVB^Zht9F6 zC<-eq9{>`hAv|va#IrqpSeA9Asw(drlNqh7jB8@>{ueV^4aAheEwXyCJvsY4tE3MQMT$#2sm^faALgAT#_n9o=&79CL$VZRGR umMsEOqO#1DbEE^(0qKBrKsxY;4(tIUE2b2M)0A8Q0000Px#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy7<5HgbW?9;ba!ELWdKlNX>N2bPDNB8b~7$BH8Ae8p8x;?D@jB_ zR9Hvtl|M*ZQ5eO~;F|(9@*uV;BAG-S8l*0DkkF+|sY^gg2ZgE#C8&d-P%s6d)M8Ds z)>dgDf`e#990aBR{6kdy)1cILY3EKI>VA8^cmt2f%QI>^lp8oa!n-%W?>qN=H-PyV z2aE&80pq}b=0FgBMDZ4P@sZE|;&peGpcwX$fI^ZQhH8D>dZ#$R`|RiyAuH4xH4W99 z?Cn!ZUAkCc3qj8bSfWzY0#xOT$`nDjDf{AJPS7Sni%?}_Wk1q~=_Z2eiUZmvXc@|y zu#OV5i5Ni*l;sY)!b6Ur8P^c@tjO8X9zma|S*W&&wgEzJvOa5^J)+r%<7mP(SWD;w|qB4n$7B_7i(10~Bl08Yti2P-3ynk$^;> z3kigavA$8?HyKK7Q2W}}Ee)0eL~^byB0LhFKV2Z)PB8?3$#}^h8BWNV98iar!uQf+ zxD>%+%3qf6Yfz1MAo8rR8|~}XxOIg0x}&cessrJB?fa!~h#ThuWj6=9IA?Q&$gs-L zN?-_g+z>bO-w*|s5quOJ$^=GkaR~(B(Xr^T_YF}XD7)PM%)gxJka7f~;*3A%y)7~r ziR+H!FXMcH@WugzRESQq)~qoO7zd04#sTBNKXl+P8x?U`dgzFa00000NkvXXu0mjf DeOfbV literal 0 HcmV?d00001 diff --git a/astrid/res/drawable/scroll_down.xml b/astrid/res/drawable/scroll_down.xml new file mode 100644 index 000000000..e50282242 --- /dev/null +++ b/astrid/res/drawable/scroll_down.xml @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/astrid/res/drawable-mdpi/scroll_down_disabled.png b/astrid/res/drawable/scroll_down_disabled.png similarity index 100% rename from astrid/res/drawable-mdpi/scroll_down_disabled.png rename to astrid/res/drawable/scroll_down_disabled.png diff --git a/astrid/res/drawable-mdpi/scroll_down.png b/astrid/res/drawable/scroll_down_normal.png similarity index 69% rename from astrid/res/drawable-mdpi/scroll_down.png rename to astrid/res/drawable/scroll_down_normal.png index ae728580fa6f8ce89c38550cba8e1888ed8b4e7e..aa11ac834143e9697ac34636ee6c446fc9229714 100644 GIT binary patch delta 18 acmbQsG?!^Y0*5q*m2AV(x9cWmYy|)~rUxGY delta 18 ZcmbQsG?!^Y0*9cmFuR+-`l*Q-TLCYR1*rf4 diff --git a/astrid/res/drawable/scroll_down_pressed.png b/astrid/res/drawable/scroll_down_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..a3ade5a0b8eb51fe02f1af87fc29cb08ff743e7b GIT binary patch literal 417 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbB7>k44ofy`glX(f`uqAoBy8vk* z`02d69!PN(ctjR6FmMZlFeAgPITAoY_7YEDSN2;R(i~PA*Tgh?fkKict`Q~9`MJ5N zc_j?aMX8A;sVNHOnI#zt?w-B@;f;LaKt+E%T^vIq4!^y&kn2!@$gz+4v(IX=MHU$3 zu+4WkXknlu$+Gyo!lLAZ?GrKuKC-ryvfe+SbuML7S8CPTw(hv|?|h!i>o@USEZ**}u;bc!?{4n8-h<1&*QI#rZ;=+>u~yYb`z&ixlxEgj);Gr@ zGMyL{9vwLN)ZkFz?dw*Wm%Scto3`T0@-}g`Qww4O;tk>*qXM}kR415CNoib~w>11B zw{Xa-;7g0@BN9HfoR}O`C + + + + + + + + diff --git a/astrid/res/drawable-mdpi/scroll_up_disabled.png b/astrid/res/drawable/scroll_up_disabled.png similarity index 100% rename from astrid/res/drawable-mdpi/scroll_up_disabled.png rename to astrid/res/drawable/scroll_up_disabled.png diff --git a/astrid/res/drawable-mdpi/scroll_up.png b/astrid/res/drawable/scroll_up_normal.png similarity index 100% rename from astrid/res/drawable-mdpi/scroll_up.png rename to astrid/res/drawable/scroll_up_normal.png diff --git a/astrid/res/drawable/scroll_up_pressed.png b/astrid/res/drawable/scroll_up_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..3d60d158af128829918b28fc5096a9c8ef7e58fe GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbB7>k44ofy`glX(f`uqAoBy8vk* z`02d69!PN(ctjR6FmMZlFeAgPITAoY_7YEDSN2;R(i~P2AI?iE0)-??Tq8=H^K)}k z^GX<;i&7IyQd1PlGfOfQ+&z5*!W;R-fr`#~x;TbJ9DaLgE!Uv{iDMt1&*g5qno^YT zRcgz7HlC(~rwa_!D)_@TR|d{Vh>s8sY}Sd)y*<-arz_|A=}-UkAK2Q<@f|3XIbPVS zBoo(@z!cG7=C6M@M(;ZE)4;H4;*S?V7sz~Hto~}o`WdEM1eXJS#^CAd=d#Wz Gp$Pyx@`NV< literal 0 HcmV?d00001 diff --git a/astrid/res/drawable-mdpi/speech_bubble.9.png b/astrid/res/drawable/speech_bubble.9.png similarity index 100% rename from astrid/res/drawable-mdpi/speech_bubble.9.png rename to astrid/res/drawable/speech_bubble.9.png diff --git a/astrid/res/drawable-mdpi/widget_bg_44_black.9.png b/astrid/res/drawable/widget_bg_44_black.9.png similarity index 100% rename from astrid/res/drawable-mdpi/widget_bg_44_black.9.png rename to astrid/res/drawable/widget_bg_44_black.9.png diff --git a/astrid/res/drawable-mdpi/widget_bg_44_blue.9.png b/astrid/res/drawable/widget_bg_44_blue.9.png similarity index 100% rename from astrid/res/drawable-mdpi/widget_bg_44_blue.9.png rename to astrid/res/drawable/widget_bg_44_blue.9.png diff --git a/astrid/res/drawable-mdpi/widget_bg_44_red.9.png b/astrid/res/drawable/widget_bg_44_red.9.png similarity index 100% rename from astrid/res/drawable-mdpi/widget_bg_44_red.9.png rename to astrid/res/drawable/widget_bg_44_red.9.png diff --git a/astrid/res/drawable-mdpi/widget_bg_44_white.9.png b/astrid/res/drawable/widget_bg_44_white.9.png similarity index 100% rename from astrid/res/drawable-mdpi/widget_bg_44_white.9.png rename to astrid/res/drawable/widget_bg_44_white.9.png diff --git a/astrid/res/layout/widget_power_44.xml b/astrid/res/layout/widget_power_44.xml index e6ae4f81f..5789695a8 100644 --- a/astrid/res/layout/widget_power_44.xml +++ b/astrid/res/layout/widget_power_44.xml @@ -45,15 +45,21 @@ android:layout_height="36dp" android:paddingTop="0dp" android:paddingBottom="0dp" - android:paddingLeft="7dp" - android:paddingRight="0dp" android:orientation="horizontal" android:layout_alignParentTop="true"> + + + - - - + + + - @@ -97,11 +99,11 @@ android:id="@+id/importance1" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - @@ -127,11 +129,11 @@ android:id="@+id/importance2" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - @@ -157,11 +159,11 @@ android:id="@+id/importance3" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - @@ -187,11 +189,11 @@ android:id="@+id/importance4" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - @@ -217,11 +219,11 @@ android:id="@+id/importance5" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - @@ -247,11 +249,11 @@ android:id="@+id/importance6" android:layout_width="3dp" android:layout_height="38dp" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> - + android:textSize="14sp" android:paddingLeft="5dip" /> @@ -394,28 +396,18 @@ - - + android:layout_height="wrap_content" + android:layout_above="@id/encouragement" + android:layout_alignParentBottom="true"> + + - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/astrid/res/values/strings-widget.xml b/astrid/res/values/strings-widget.xml index 07fe5857b..06fc5f65a 100644 --- a/astrid/res/values/strings-widget.xml +++ b/astrid/res/values/strings-widget.xml @@ -19,5 +19,7 @@ Ready to work? + Have time to finish something? + Gosh, you are looking suave today! diff --git a/astrid/src/com/todoroo/astrid/widget/PowerWidget.java b/astrid/src/com/todoroo/astrid/widget/PowerWidget.java index f9fc526cc..d64e928dc 100644 --- a/astrid/src/com/todoroo/astrid/widget/PowerWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/PowerWidget.java @@ -1,5 +1,7 @@ package com.todoroo.astrid.widget; +import java.util.Date; + import android.app.PendingIntent; import android.app.Service; import android.appwidget.AppWidgetManager; @@ -16,11 +18,11 @@ import android.view.View; import android.widget.RemoteViews; import com.timsu.astrid.R; +import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; -import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.activity.ShortcutActivity; @@ -53,9 +55,9 @@ public class PowerWidget extends AppWidgetProvider { static final long ENCOURAGEMENT_CYCLE_TIME = 1000 * 60 * 60 * 4; // 4 hours - static final String ACTION_MARK_COMPLETE = "com.timsu.astrid.widget.ACTION_MARK_COMPLETE"; - static final String ACTION_SCROLL_UP = "com.timsu.astrid.widget.ACTION_SCROLL_UP"; - static final String ACTION_SCROLL_DOWN = "com.timsu.astrid.widget.ACTION_SCROLL_DOWN"; + static final String ACTION_MARK_COMPLETE = "com.todoroo.astrid.widget.ACTION_MARK_COMPLETE"; + static final String ACTION_SCROLL_UP = "com.todoroo.astrid.widget.ACTION_SCROLL_UP"; + static final String ACTION_SCROLL_DOWN = "com.todoroo.astrid.widget.ACTION_SCROLL_DOWN"; // Prefix for Shared Preferences static final String PREF_COLOR = "powerwidget-color-"; @@ -66,10 +68,20 @@ public class PowerWidget extends AppWidgetProvider { static final String PREF_VALUES = "powerwidget-values-"; static final String PREF_ENCOURAGEMENT_LAST_ROTATION_TIME = "powerwidget-encouragementRotationTime-"; static final String PREF_ENCOURAGEMENT_CURRENT = "powerwidget-encouragementCurrent-"; + static final String PREF_LAST_COMPLETED_ID = "powerwidget-lastCompletedId-"; + static final String PREF_LAST_COMPLETED_POS = "powerwidget-lastCompletedPos-"; + static final String PREF_LAST_COMPLETED_DATE = "powerwidget-lastCompletedDate-"; public final static String APP_WIDGET_IDS = "com.timsu.astrid.APP_WIDGET_IDS"; - public final static String COMPLETED_TASK_ID = "com.timsu.astrid.COMPLETED_TASK_ID"; - public final static String EXTRA_SCROLL_OFFSET = "com.timsu.astrid.EXTRA_SCROLL_OFFSET"; + + /** id of task to complete */ + public final static String COMPLETED_TASK_ID = "compId"; + + /** position in list of task that was completed */ + public final static String COMPLETED_TASK_POSITION = "compPos"; + + /** new scroll offset */ + public final static String EXTRA_SCROLL_OFFSET = "soff"; public final static int[] TASK_TITLE = { R.id.task_title1, R.id.task_title2, R.id.task_title3, R.id.task_title4, R.id.task_title5, R.id.task_title6, @@ -87,6 +99,8 @@ public class PowerWidget extends AppWidgetProvider { R.id.checkbox3, R.id.checkbox4, R.id.checkbox5, R.id.checkbox6, R.id.checkbox7, R.id.checkbox8, R.id.checkbox9, R.id.checkbox10 }; + private static final int ROW_LIMIT = 10; + private static int[] importanceColors = null; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, @@ -108,16 +122,16 @@ public class PowerWidget extends AppWidgetProvider { @Override public void onReceive(Context context, Intent intent) { if (ACTION_MARK_COMPLETE.equals(intent.getAction())){ - long taskId = intent.getLongExtra(COMPLETED_TASK_ID, -1); - Intent updateIntent = new Intent(context, UpdateService.class); - updateIntent.putExtra(COMPLETED_TASK_ID, taskId); + updateIntent.setAction(ACTION_MARK_COMPLETE); + updateIntent.putExtras(intent.getExtras()); context.startService(updateIntent); } else if (ACTION_SCROLL_UP.equals(intent.getAction()) || ACTION_SCROLL_DOWN.equals(intent.getAction())){ int id = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (id != AppWidgetManager.INVALID_APPWIDGET_ID){ int scrollOffset = intent.getIntExtra(EXTRA_SCROLL_OFFSET, 0); Intent updateIntent = new Intent(context, UpdateService.class); + updateIntent.setAction(intent.getAction()); updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id); updateIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset); context.startService(updateIntent); @@ -151,32 +165,48 @@ public class PowerWidget extends AppWidgetProvider { public static class UpdateService extends Service { @Autowired - Database database; + private Database database; @Autowired - TaskService taskService; + private TaskService taskService; + + public UpdateService() { + DependencyInjectionService.getInstance().inject(this); + } @Override public void onStart(Intent intent, int startId) { ContextManager.setContext(this); + AppWidgetManager manager = AppWidgetManager.getInstance(this); - if (intent != null){ + if (intent != null && ACTION_MARK_COMPLETE.equals(intent.getAction())) { long taskId = intent.getLongExtra(COMPLETED_TASK_ID, -1); - if (taskId > 0){ - Task task = taskService.fetchById(taskId, Task.PROPERTIES); - if (task != null){ - taskService.setComplete(task, true); + if (taskId > 0) { + Task task = taskService.fetchById(taskId, Task.ID, Task.COMPLETION_DATE); + if (task != null) { + taskService.setComplete(task, !task.isCompleted()); + + int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, + AppWidgetManager.INVALID_APPWIDGET_ID); + Preferences.setLong(PREF_LAST_COMPLETED_ID + + appWidgetId, taskId); + Preferences.setInt(PREF_LAST_COMPLETED_POS + + appWidgetId, intent.getIntExtra(COMPLETED_TASK_POSITION, -1)); + Preferences.setLong(PREF_LAST_COMPLETED_DATE + + appWidgetId, DateUtilities.now()); + System.err.println("completed business. posn " + + intent.getIntExtra(COMPLETED_TASK_POSITION, 0) + + " app id: " + appWidgetId); } } } - AppWidgetManager manager = AppWidgetManager.getInstance(this); int scrollOffset = 0; int[] appWidgetIds = null; int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; - if (intent != null){ + if (intent != null && (ACTION_SCROLL_UP.equals(intent.getAction()) || ACTION_SCROLL_DOWN.equals(intent.getAction()))) { scrollOffset = intent.getIntExtra(EXTRA_SCROLL_OFFSET, 0); appWidgetIds = intent.getIntArrayExtra(APP_WIDGET_IDS); appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); @@ -204,6 +234,8 @@ public class PowerWidget extends AppWidgetProvider { public RemoteViews buildUpdate(Context context, int appWidgetId, int scrollOffset) { DependencyInjectionService.getInstance().inject(this); + System.err.println("BUILD UPDATE " + DateUtilities.now()); + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_power_44); @@ -292,28 +324,70 @@ public class PowerWidget extends AppWidgetProvider { int sort = Preferences.getInt(SortSelectionActivity.PREF_SORT_SORT, 0); String query = SortSelectionActivity.adjustQueryForFlagsAndSort( filter.sqlQuery, flags, sort); - query = query.replace(Task.COMPLETION_DATE.eq(0).toString(), Criterion.or(Task.COMPLETION_DATE.eq(0), - Task.COMPLETION_DATE.gt(DateUtilities.now() - 60000L)).toString()); + + scrollOffset = Math.max(0, scrollOffset); + query = query.replaceAll("[lL][iI][mM][iI][tT] +[^ ]+", "") + " LIMIT " + + scrollOffset + "," + ROW_LIMIT; + + System.err.println("PRE LOAD DATA " + DateUtilities.now()); database.openForReading(); - cursor = taskService.fetchFiltered(query, null, Task.ID, Task.TITLE, - Task.DUE_DATE, Task.IMPORTANCE, Task.COMPLETION_DATE); - - // adjust bounds of scrolling - if (scrollOffset < 0){ - scrollOffset = 0; - } else if (scrollOffset >= cursor.getCount()){ - scrollOffset = cursor.getCount() - 1 ; + final Property[] properties = new Property[] { Task.ID, Task.TITLE, + Task.DUE_DATE, Task.IMPORTANCE, Task.COMPLETION_DATE }; + cursor = taskService.fetchFiltered(query, null, properties); + + boolean canScrollDown = cursor.getCount() > 1; + + if(importanceColors == null) { + importanceColors = Task.getImportanceColors(getResources()); + System.err.println("loaded importance"); } - int[] importanceColors = Task.getImportanceColors(getResources()); + // load last completed task + Task lastCompleted = null; + int lastCompletedPosition = 0; + System.err.println("last completed for " + appWidgetId + ": " + + new Date(Preferences.getLong(PREF_LAST_COMPLETED_DATE+appWidgetId, 0))); + if(DateUtilities.now() - Preferences.getLong(PREF_LAST_COMPLETED_DATE+appWidgetId, 0) < 120000L) { + lastCompleted = taskService.fetchById(Preferences.getLong(PREF_LAST_COMPLETED_ID+appWidgetId, -1L), + properties); + lastCompletedPosition = Preferences.getInt(PREF_LAST_COMPLETED_POS+appWidgetId, 0); + } Task task = new Task(); - for (int i = scrollOffset; i < cursor.getCount() && i < 10; i++) { - cursor.moveToPosition(i); - task.readFromCursor(cursor); + int position; + for (position = 0; position < cursor.getCount() && position < ROW_LIMIT; position++) { + if(lastCompleted != null && lastCompletedPosition == position + scrollOffset) { + task = lastCompleted; + } else { + cursor.moveToNext(); + task.readFromCursor(cursor); + } + + long taskId = task.getValue(Task.ID); - String textContent = ""; + // importance + views.setInt(TASK_IMPORTANCE[position], "setBackgroundColor", importanceColors[task.getValue(Task.IMPORTANCE)]); + + // check box + Intent markCompleteIntent = new Intent(context, PowerWidget.class); + markCompleteIntent.setAction(ACTION_MARK_COMPLETE); + markCompleteIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); + markCompleteIntent.putExtra(COMPLETED_TASK_ID, taskId); + markCompleteIntent.putExtra(COMPLETED_TASK_POSITION, scrollOffset + position); + markCompleteIntent.setType(COMPLETED_TASK_ID + taskId); + PendingIntent pMarkCompleteIntent = PendingIntent.getBroadcast(context, 0, markCompleteIntent, 0); + views.setOnClickPendingIntent(TASK_CHECKBOX[position], pMarkCompleteIntent); + + if(task.isCompleted()) { + views.setImageViewResource(TASK_CHECKBOX[position], R.drawable.btn_check_buttonless_on); + views.setInt(TASK_TITLE[position], "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG); + } else { + views.setImageViewResource(TASK_CHECKBOX[position], R.drawable.btn_check_buttonless_off); + views.setInt(TASK_TITLE[position], "setPaintFlags", 0); + } + + // title int titleColor = textColor; int dueString = R.string.PPW_due; if(task.isCompleted()) { @@ -323,78 +397,68 @@ public class PowerWidget extends AppWidgetProvider { titleColor = overdueColor; dueString = R.string.PPW_past_due; } - - textContent = task.getValue(Task.TITLE); - - String dateValue = ""; - if(dueString != 0 && task.hasDueDate()) { - dateValue = getString(dueString) + "\n" + - DateUtils.getRelativeTimeSpanString(task.getValue(Task.DUE_DATE)); - } - - long taskId = task.getValue(Task.ID); + String textContent = task.getValue(Task.TITLE); + views.setTextViewText(TASK_TITLE[position], textContent); + views.setTextColor(TASK_TITLE[position], titleColor); Intent viewTaskIntent = new Intent(context, ShortcutActivity.class); viewTaskIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); viewTaskIntent.putExtra(ShortcutActivity.TOKEN_SINGLE_TASK, taskId); viewTaskIntent.setType(ShortcutActivity.TOKEN_SINGLE_TASK + taskId); - Log.d(LOG_TAG, "viewTaskIntent type: "+ShortcutActivity.TOKEN_SINGLE_TASK + taskId); PendingIntent pEditTask = PendingIntent.getActivity(context, 0, viewTaskIntent, PendingIntent.FLAG_CANCEL_CURRENT); + views.setOnClickPendingIntent(TASK_TITLE[position], pEditTask); - Intent markCompleteIntent = new Intent(context, PowerWidget.class); - markCompleteIntent.setAction(ACTION_MARK_COMPLETE); - markCompleteIntent.putExtra(COMPLETED_TASK_ID, taskId); - markCompleteIntent.setType(COMPLETED_TASK_ID + taskId); - PendingIntent pMarkCompleteIntent = PendingIntent.getBroadcast(context, 0, markCompleteIntent, 0); + // due date + String dateValue = ""; + if(dueString != 0 && task.hasDueDate()) { + dateValue = getString(dueString) + "\n" + + DateUtils.getRelativeTimeSpanString(task.getValue(Task.DUE_DATE)); + } + views.setTextViewText(TASK_DUE[position], dateValue); + views.setTextColor(TASK_DUE[position], titleColor); - // set importance marker - views.setInt(TASK_IMPORTANCE[i], "setBackgroundColor", importanceColors[task.getValue(Task.IMPORTANCE)]); - // set click listener for checkbox - views.setOnClickPendingIntent(TASK_CHECKBOX[i], pMarkCompleteIntent); - // set task title - if(task.isCompleted()) - views.setInt(TASK_TITLE[i], "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG); - views.setTextViewText(TASK_TITLE[i], textContent); - views.setTextColor(TASK_TITLE[i], titleColor); - // set due date - views.setTextViewText(TASK_DUE[i], dateValue); - views.setTextColor(TASK_DUE[i], titleColor); - // set click listener for text content - views.setOnClickPendingIntent(TASK_TITLE[i], pEditTask); + views.setViewVisibility(TASK_IMPORTANCE[position], View.VISIBLE); + views.setViewVisibility(TASK_CHECKBOX[position], View.VISIBLE); + views.setViewVisibility(TASK_TITLE[position], View.VISIBLE); + views.setViewVisibility(TASK_DUE[position], View.VISIBLE); } + for(; position < ROW_LIMIT; position++) { + views.setViewVisibility(TASK_IMPORTANCE[position], View.INVISIBLE); + views.setViewVisibility(TASK_CHECKBOX[position], View.INVISIBLE); + views.setViewVisibility(TASK_TITLE[position], View.INVISIBLE); + views.setViewVisibility(TASK_DUE[position], View.INVISIBLE); + } // create intent to scroll up Intent scrollUpIntent = new Intent(context, PowerWidget.class); scrollUpIntent.setAction(ACTION_SCROLL_UP); scrollUpIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - scrollUpIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset-1); scrollUpIntent.setType(AppWidgetManager.EXTRA_APPWIDGET_ID + appWidgetId); - PendingIntent pScrollUpIntent = PendingIntent.getBroadcast(context, 0, scrollUpIntent, PendingIntent.FLAG_UPDATE_CURRENT); - views.setOnClickPendingIntent(R.id.scroll_up, pScrollUpIntent); if (scrollOffset-1 < 0){ - // show disabled up button + scrollUpIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset); views.setImageViewResource(R.id.scroll_up, R.drawable.scroll_up_disabled); } else { + scrollUpIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset-1); views.setImageViewResource(R.id.scroll_up, R.drawable.scroll_up); } + PendingIntent pScrollUpIntent = PendingIntent.getBroadcast(context, 0, scrollUpIntent, PendingIntent.FLAG_UPDATE_CURRENT); + views.setOnClickPendingIntent(R.id.scroll_up, pScrollUpIntent); // create intent to scroll down Intent scrollDownIntent = new Intent(context, PowerWidget.class); scrollDownIntent.setAction(ACTION_SCROLL_DOWN); scrollDownIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - scrollDownIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset+1); scrollDownIntent.setType(AppWidgetManager.EXTRA_APPWIDGET_ID + appWidgetId); - PendingIntent pScrollDownIntent = PendingIntent.getBroadcast(context, 0, scrollDownIntent, PendingIntent.FLAG_UPDATE_CURRENT); - views.setOnClickPendingIntent(R.id.scroll_down, pScrollDownIntent); - if (scrollOffset+1 >= cursor.getCount()){ - // show disabled down button + if (!canScrollDown){ + scrollDownIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset); views.setImageViewResource(R.id.scroll_down, R.drawable.scroll_down_disabled); } else { + scrollDownIntent.putExtra(EXTRA_SCROLL_OFFSET, scrollOffset+1); views.setImageViewResource(R.id.scroll_down, R.drawable.scroll_down); } - - + PendingIntent pScrollDownIntent = PendingIntent.getBroadcast(context, 0, scrollDownIntent, PendingIntent.FLAG_UPDATE_CURRENT); + views.setOnClickPendingIntent(R.id.scroll_down, pScrollDownIntent); } catch (Exception e) { // can happen if database is not ready Log.e("WIDGET-UPDATE", "Error updating widget", e); @@ -403,7 +467,7 @@ public class PowerWidget extends AppWidgetProvider { cursor.close(); } - + System.err.println("END UPDATE " + DateUtilities.now()); return views; }