From 74da37ac0355422dd3f369e124cc18835e610d6c Mon Sep 17 00:00:00 2001 From: Tim Su Date: Wed, 4 Aug 2010 20:55:44 -0700 Subject: [PATCH] Producteev ui enhancements - add onpage and task edit can edit stars --- astrid/astrid.launch | 2 +- astrid/res/drawable/icon_producteev.png | Bin 0 -> 3569 bytes astrid/res/layout/addon_adapter_row.xml | 29 ++++++++++++---- .../astrid/activity/TaskEditActivity.java | 32 +++++++++++++----- .../todoroo/astrid/adapter/AddOnAdapter.java | 3 ++ .../todoroo/astrid/service/AddOnService.java | 12 ++++++- 6 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 astrid/res/drawable/icon_producteev.png diff --git a/astrid/astrid.launch b/astrid/astrid.launch index 7ce8fc659..f5769e42d 100644 --- a/astrid/astrid.launch +++ b/astrid/astrid.launch @@ -4,7 +4,7 @@ - + diff --git a/astrid/res/drawable/icon_producteev.png b/astrid/res/drawable/icon_producteev.png new file mode 100644 index 0000000000000000000000000000000000000000..51d8f09f08f2b83a53f542f9baca663bf50e96fd GIT binary patch literal 3569 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igb) z12H;!$WB8501a_TL_t(&-tAaRh})%U)8&pp4h-E$6bicZlfIz^}Gk0AOunfHAPWG`s3 zt(o&ex{#UA(me;J-7Er;N{|69izT?F9vDW42v@$X3+b%v+3nRn>21^$@I|x0}2Q}8egPr_FUC6wY{r5M!XYYXgvja$7 zi+FhX%Fh}#Ew>q!^=BJ3Er4kO3_$x}uLM?J`EbJq*+D>l|kM%K5th!|P<}UnQ2+#@1ccE{ zR`48=sI4@rng9~aS`imU;171~@%Fy@jq0`ge)_Qk7{0S^seR_<|6$EuQcqR@5GMS- zz3}_?Zf5Cz8{i%C$gZLu&A7S%S^rab0MG&04c}Z*38D+h4zD)r=U-^foDXQ9SxM3( zy(Q-?%%}Y#xnVmd&AH4B_KXmA?jGE?c6<>XsC$8^Z zg+Suk&;M9dHGEo^#ty52Lt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xnS) zH=mm}<+wR0NEpvS7$`>-0AM3)b@+Hc@SUUZ+sDRU)YAW)FpT+uU=XY|JlBDf&%v|< z5Qe~{2JvLtFUPv zCV*J$At?2u}^0 z`M0v~J(v8)!}|B_>N=V2$iTn?t#zTHzP@vs>-_zkyUDa3CK91>;2P3fSN&M$eJAY5 zZr`|P{r7HIaG4zpUdfuv4Y$?+7^Y=S8wc>jO!Nm(E0G6a*R)>y)~GO(bq~U{?t>5( zmx~;Nly9)(JTR&5n!5SG?!A98XJOlK4AX4ovK3fsMTTiiieWl-6VM+l|Mc0?y{8cg z%z_Z#C&RjgggC~Uw3J=ibFQg*>ZtpX0G`~9{5Rs==O^pxHzX2lS~pbuSC ze5C4Aw}pxI$!D}=STG}TlMFLJrWJ-T8ld?WGK?>hVIH$9F*Dfr-qoJ7vSwY+*t9<3 zM9d$2!yCGPS?}`7ni)?6SOw+?GnWHdsqp|F2f#E9NcwB7%SjmL{PwvlB>{%2 zh%DoHSTaD+ss!JAkv->2HS2ovCt_lrjQhiH%8@(UdvB_1s`)g5u4mR)F>|CW?s!2( zL?_Os;yMWH4x-;-ZgwmsPgu*^2P=Okl>aSR%>GN=w+8)_Z8txP_fvb|W6#iwYcHwz zg)pd|wQjQwvA{CuYfK^v(kH$Tgz#V(<5t4SGAT`Z)jZx0sJ8(A9xM63$;S_+ej9%C zcL}aFn@2~-C(7^d`SR>vn$UN!=S0CgUbsyGp%ehGTnn9isH_0afw_;h?f~npAp8$A rryxBqxvod!6rG||bc#;V$4&nSn0@0JLnYdx00000NkvXXu0mjf??9zt literal 0 HcmV?d00001 diff --git a/astrid/res/layout/addon_adapter_row.xml b/astrid/res/layout/addon_adapter_row.xml index 3ede37df8..b3f3cc6c0 100644 --- a/astrid/res/layout/addon_adapter_row.xml +++ b/astrid/res/layout/addon_adapter_row.xml @@ -10,13 +10,30 @@ android:paddingLeft="4dip" android:paddingRight="4dip"> - - + android:orientation="vertical"> + + + + + + + + = i; j--) - label.append('!'); + if(ProducteevUtilities.INSTANCE.isLoggedIn()) + label.append(5 - i).append("\n★"); //$NON-NLS-1$ + else { + for(int j = importanceOffset; j >= i; j--) + label.append('!'); + } button.setTextColor(colors[i]); button.setTextOff(label); @@ -654,11 +667,11 @@ public final class TaskEditActivity extends TabActivity { } } - public int getImportance() { + public Integer getImportance() { for(CompoundButton b : buttons) if(b.isChecked()) return (Integer) b.getTag(); - return Task.IMPORTANCE_LEAST; + return null; } @Override @@ -668,7 +681,8 @@ public final class TaskEditActivity extends TabActivity { @Override public void writeToModel(Task task) { - task.setValue(Task.IMPORTANCE, getImportance()); + if(getImportance() != null) + task.setValue(Task.IMPORTANCE, getImportance()); } } diff --git a/astrid/src/com/todoroo/astrid/adapter/AddOnAdapter.java b/astrid/src/com/todoroo/astrid/adapter/AddOnAdapter.java index eef534f70..933c82d49 100644 --- a/astrid/src/com/todoroo/astrid/adapter/AddOnAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/AddOnAdapter.java @@ -62,6 +62,7 @@ public class AddOnAdapter extends ArrayAdapter { convertView = inflater.inflate(R.layout.addon_adapter_row, parent, false); ViewHolder viewHolder = new ViewHolder(); viewHolder.icon = (ImageView) convertView.findViewById(R.id.icon); + viewHolder.free = (TextView) convertView.findViewById(R.id.free); viewHolder.title = (TextView) convertView.findViewById(R.id.title); viewHolder.description = (TextView) convertView.findViewById(R.id.description); viewHolder.web = (ImageButton) convertView.findViewById(R.id.button_web); @@ -82,6 +83,7 @@ public class AddOnAdapter extends ArrayAdapter { private class ViewHolder { public AddOn item; public ImageView icon; + public TextView free; public TextView title; public TextView description; public ImageButton web; @@ -96,6 +98,7 @@ public class AddOnAdapter extends ArrayAdapter { viewHolder.icon.setImageBitmap(item.getIcon()); viewHolder.title.setText(item.getTitle()); viewHolder.description.setText(item.getDescription()); + viewHolder.free.setVisibility(item.isFree() && !installed ? View.VISIBLE : View.GONE); // populate buttons if(item.getWebPage() != null) { diff --git a/astrid/src/com/todoroo/astrid/service/AddOnService.java b/astrid/src/com/todoroo/astrid/service/AddOnService.java index 49d703033..0e608f23b 100644 --- a/astrid/src/com/todoroo/astrid/service/AddOnService.java +++ b/astrid/src/com/todoroo/astrid/service/AddOnService.java @@ -192,7 +192,7 @@ public class AddOnService { Resources r = ContextManager.getContext().getResources(); // temporary temporary - AddOn[] list = new AddOn[2]; + AddOn[] list = new AddOn[4]; list[0] = new AddOn(false, true, "Astrid Power Pack", null, "Support Astrid and get more productive with the Astrid Power Pack. Backup, widgets, no ads, and calendar integration. Power up today!", POWER_PACK_PACKAGE, "http://www.weloveastrid.com/store", @@ -203,6 +203,16 @@ public class AddOnService { LOCALE_PACKAGE, "http://www.weloveastrid.com/store", ((BitmapDrawable)r.getDrawable(R.drawable.icon_locale)).getBitmap()); + list[2] = new AddOn(true, true, "Remember the Milk", null, + "Synchronize with Remember The Milk service.", + Constants.PACKAGE, "http://www.rmilk.com", + ((BitmapDrawable)r.getDrawable(R.drawable.ic_menu_rmilk)).getBitmap()); + + list[3] = new AddOn(true, true, "Producteev", null, + "Synchronize with Producteev service. Also changes Astrid's importance levels to stars.", + Constants.PACKAGE, "http://www.producteev.com", + ((BitmapDrawable)r.getDrawable(R.drawable.icon_producteev)).getBitmap()); + return list; } }