From b6f44dd53a9e42e8f4ffa8480b531da304a6f570 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Thu, 8 Jan 2009 20:38:17 +0000 Subject: [PATCH] Updated look & feel with graphical icons, added hours:minutes to snooze dialog, and two new preferences: font size, and default deadline time --- AndroidManifest.xml | 9 +- res/drawable/bubble_blue.png | Bin 0 -> 483 bytes res/drawable/bubble_gray.png | Bin 0 -> 478 bytes res/drawable/bubble_red.png | Bin 0 -> 399 bytes res/drawable/bubble_yellow.png | Bin 0 -> 477 bytes res/drawable/bullet_blue.png | Bin 0 -> 312 bytes res/drawable/bullet_error.png | Bin 0 -> 454 bytes res/drawable/bullet_orange.png | Bin 0 -> 283 bytes res/drawable/bullet_pink.png | Bin 0 -> 305 bytes res/drawable/bullet_red.png | Bin 0 -> 287 bytes res/drawable/bullet_star.png | Bin 0 -> 374 bytes res/drawable/bullet_white.png | Bin 0 -> 232 bytes res/layout/edit_alert_item.xml | 1 + res/layout/edit_importance_item.xml | 26 ++++ res/layout/task_edit.xml | 6 +- res/layout/task_list_row.xml | 16 ++- res/values/colors.xml | 13 +- res/values/strings.xml | 20 +-- res/values/styles.xml | 2 +- res/xml/preferences.xml | 8 ++ src/com/timsu/astrid/activities/TaskEdit.java | 118 ++++++++---------- .../astrid/activities/TaskListAdapter.java | 10 +- .../astrid/activities/TaskViewNotifier.java | 18 +-- .../timsu/astrid/data/enums/Importance.java | 16 ++- .../astrid/data/task/AbstractTaskModel.java | 2 +- .../astrid/data/task/TaskModelForList.java | 2 + .../timsu/astrid/utilities/Preferences.java | 57 +++++---- .../timsu/astrid/widget/DateControlSet.java | 7 +- 28 files changed, 203 insertions(+), 128 deletions(-) create mode 100644 res/drawable/bubble_blue.png create mode 100644 res/drawable/bubble_gray.png create mode 100644 res/drawable/bubble_red.png create mode 100644 res/drawable/bubble_yellow.png create mode 100644 res/drawable/bullet_blue.png create mode 100644 res/drawable/bullet_error.png create mode 100644 res/drawable/bullet_orange.png create mode 100644 res/drawable/bullet_pink.png create mode 100644 res/drawable/bullet_red.png create mode 100644 res/drawable/bullet_star.png create mode 100644 res/drawable/bullet_white.png create mode 100644 res/layout/edit_importance_item.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 863e0f5df..acc79e462 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,13 @@ + android:versionCode="44" + android:versionName="1.11.0"> + + + diff --git a/res/drawable/bubble_blue.png b/res/drawable/bubble_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e82e1acfb9b4a5f35262e80a49c6d53130f54755 GIT binary patch literal 483 zcmV<90UZ8`P)bq`40_!5h#! za1k6`+yrkx5F8s&@dt6zMNnvKFrvh!T2h;@$?M>Msh;KKzm5GFfDhY zIF>v2pV3)HI}>y&ANQL(j*~kvt$BljX+Jg+&iwiharWcso!>VSD40VAz-hJ4K)&~v zduPJs{R;pFapae4&56?W6aBfKu9ccPBi1Rz(XBxglnASCnc+PDA*?1uf!9kTJf?Q% zGCt>^db*3V6!z8+@Gq8>h@f(PHumH;?$RuS9Z6v|p|p8~f3YCC<*RPfpkUen#F5`Q ZjW-?395JxA-9Z2V002ovPDHLkV1lBa(K7%5 literal 0 HcmV?d00001 diff --git a/res/drawable/bubble_gray.png b/res/drawable/bubble_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..ac071326a2b45d3d759fe7568fe22241c3bd38d9 GIT binary patch literal 478 zcmV<40U`d0P)-ZNgT&{nx-E`QP5dMQBazuA8{P#K@cQg!jhvM7DHK8s`~7}%wOYY@|IKw> z<8(Tqu50vqy`~W2F65ji`~4ovVT@rw5z&N*0XVXb`+jWH9g^$@@n{*l(&8DsLs@pybQ#tggNZjUkcYnX^I zolak>s(N5Vghr#0wA=0H!C-LPYPGH|o9FZS>u$HZ_ug;VZ`0tMCjelr-CR!N6D%An U#I~-Z{Qv*}07*qoM6N<$f|6y?3;+NC literal 0 HcmV?d00001 diff --git a/res/drawable/bubble_red.png b/res/drawable/bubble_red.png new file mode 100644 index 0000000000000000000000000000000000000000..e639565ad6bbf9fabe87d7579b026a95b67851fa GIT binary patch literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kmSQK*5Dp-y;YjHK@;M7UB8!3Q zuY)k7lg8`{prB-lYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&3=E7so-U3d z8WU?L?d>{LAaJCg z(f+t6C&MR#b+*ABs`zEiG(Pss{nIancnM{0y|n21 zZmS2;vJzW%-R0UWnIie5@@3xk+f&a~{7E!Dn6|t1O&_^1V}|F3Q% zclJ3$gyxz^z1=--0jsC3p6^#+GwBdN-w(kUmMT-h7?}^;(VNAe@chf!%l_Oc;+tku pH@9oSvNck^8yJHk?86?5AAisC+=F-VRbb#Tc)I$ztaD0e0sth0m_Yyl literal 0 HcmV?d00001 diff --git a/res/drawable/bubble_yellow.png b/res/drawable/bubble_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..c4a2ee2c3ec3c4ae561b38d76c2a64fd7826f8fa GIT binary patch literal 477 zcmV<30V4j1P)F=G?4yA`c`gNi6t+`IYVcl|UisO^h zX>L!T8-e1d?8czy>_+5s`SgT+uxQyCvb2A|&GA1a6r&eOyTM3?F$;j7hsgT)#vZ?3 zygvoN3Y%QPRcN^e_Qb|yHTjOOghro1+%3eFJ|M5HR9`H`l4w_VxuP+1ggr}>Y%Q~loCIA`NY$5;v literal 0 HcmV?d00001 diff --git a/res/drawable/bullet_error.png b/res/drawable/bullet_error.png new file mode 100644 index 0000000000000000000000000000000000000000..bca2b491fd4a72918c37eb218bf9655d7f514750 GIT binary patch literal 454 zcmV;%0XhDOP);<5v0zO%9O+HCOhCe@lCtqI|U`n(Bw>E`n0X60GiU=_L{j`ZeTrWl7@6TVgmzQ|3 z5;Op46VsoczbZwwqJ7S==^_3_&=Ox0MY;dOCY;|ap-3z08F!}8RFQf3;+NC07*qoM6N<$g0j}hYXATM literal 0 HcmV?d00001 diff --git a/res/drawable/bullet_orange.png b/res/drawable/bullet_orange.png new file mode 100644 index 0000000000000000000000000000000000000000..fa63024e55bdde1851f2067dee1a6cad2e9115ea GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;^>lFzu{izqk|8%^q0F(5@h6w@ zuSbE=i9QOwKvPc#-iPCap~BwXFHIr_gU^WCH%x0(Cm8h3e{9o}5`YUO%{ zPiLR-*D%CfK42<(c~V-?1q(}8{p2N#A`c~!wa4X-$LfsZ0%WH-1^Zy?%r3<3e~Rbycg=S_Egdz d?>~Yc*m~Z+JF!m3&mHJ+22WQ%mvv4FO#s^$Z2kZM literal 0 HcmV?d00001 diff --git a/res/drawable/bullet_pink.png b/res/drawable/bullet_pink.png new file mode 100644 index 0000000000000000000000000000000000000000..811bc8fa6ccd2d95002677a13e2b95bec16e3bc5 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*x37`TN&n2}-D90{Nxdx@v7EBj4G4h{wtW5wV?pwLE77sn8b({Cs3 z8uni2 z_KQ(lnY`x-XDY#DW^u;K&o-|vHe`x?xbw1zYx$2><(A#;6QU!sSfhO( ioL~suuJh6Vfb_?jd)=>7iZy|bXYh3Ob6Mw<&;$Tq>~Ep~ literal 0 HcmV?d00001 diff --git a/res/drawable/bullet_star.png b/res/drawable/bullet_star.png new file mode 100644 index 0000000000000000000000000000000000000000..475c58a88ee6532ae544e0661572543b99ae9e6d GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*x37`TN&n2}-D90{Nxdx@v7EBj4G4t7iFhWT4g1BJeMx;TbdoPIlb zV-{1Ofb07`yfaL@dp8PjdnzinL}cl=McjNMuk)wL!Op?^|3Uj3T1$OrnJDI^uT)T* z+WO}6+iL5{TD={5H@BE~2d;SF1U%M^dTC4oMTB~p(M08fe)eWl!gx0@yOczY$p6JUu zr8&CK{0+~E-Fy*Cm=sQJb2C%Dcdos_Q*>oW>StRP?@W2G=kW*hKRryI+~(`p0}KHM MPgg&ebxsLQ04d#zz5oCK literal 0 HcmV?d00001 diff --git a/res/drawable/bullet_white.png b/res/drawable/bullet_white.png new file mode 100644 index 0000000000000000000000000000000000000000..b6648ae10b57c7dbead602148534b18ed08f35a4 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf67>k44ofy`glX(f`FeQ1ryD%`U z>Qy!Z@;D1TB8wRqxP?KOkzv*x37{Z*iKnkC`%Oj;b}RFlS>3OJLOGr;jv*T7uTI#= z*$fub6l;Pe9<}(;`Okj0_GLJ!_*|tdfO0GK6*ieRw5Y XWoNYYWnRH?puG&9u6{1-oD!M + + + + + + \ No newline at end of file diff --git a/res/layout/task_edit.xml b/res/layout/task_edit.xml index 35c3e3701..c2287020c 100644 --- a/res/layout/task_edit.xml +++ b/res/layout/task_edit.xml @@ -51,9 +51,11 @@ android:text="@string/importance_label" style="@style/TextAppearance.EditEvent_Label"/> - + android:layout_height="wrap_content"> + @@ -31,19 +32,18 @@ android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" - android:minWidth="41px" - android:paddingLeft="5dip" /> + android:minWidth="41px" /> - @@ -80,5 +80,11 @@ + + \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index e358bb67c..87711472e 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -20,10 +20,11 @@ --> - #FFFB0000 + #FFFB6666 + #FFFFFFFF #ff777777 - #ffFFBF9E + #FFFB6666 #ffF0E89E #ff888888 #ff888888 @@ -32,9 +33,9 @@ #ffbbbbbb #ffff0000 - #ffffffff - #ffc0c4dc - #ff7381c8 - #ff446592 + #ffff5555 + #fffea400 + #ff33a5e8 + #ff808080 diff --git a/res/values/strings.xml b/res/values/strings.xml index 99646727f..d83045c2c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -27,10 +27,10 @@ - I need to do this - I really should do this - It would be nice to do this - Who cares! + !!!! + !!! + !! + ! Day(s) @@ -197,7 +197,7 @@ If you don\'t want to see the new task right after you complete the old one, you Let's do it! Snooze! No, quit. - Minutes to snooze? + Hours/minutes to snooze? Delete Delete this task? @@ -224,15 +224,19 @@ If you don\'t want to see the new task right after you complete the old one, you notif_qend notif_annoy notification_ringtone + font_size + deadline_time Quiet Hours Start Starting hour when Astrid should be quiet (e.g. 22) Quiet Hours End Ending hour when Astrid should be quiet (e.g. 08) Persistence Mode - -If checked, Astrid will try a bit harder to get your attention - + If checked, Astrid will try a bit harder to get your attention Notification Ringtone Choose how Astrid alerts you! + Task List Font + Font on the main listing page (i.e. 22) + Default Deadline Time + # of days from now to set new deadlines (i.e. 7) diff --git a/res/values/styles.xml b/res/values/styles.xml index 57082c346..75f08fa85 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -29,7 +29,7 @@ diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index f406b889d..17b0e4c52 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -21,4 +21,12 @@ android:showDefault="true" android:showSilent="true" /> + + \ No newline at end of file diff --git a/src/com/timsu/astrid/activities/TaskEdit.java b/src/com/timsu/astrid/activities/TaskEdit.java index e4901096f..9c7aeb251 100644 --- a/src/com/timsu/astrid/activities/TaskEdit.java +++ b/src/com/timsu/astrid/activities/TaskEdit.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Set; import android.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.database.Cursor; @@ -40,7 +39,7 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; @@ -55,6 +54,7 @@ import android.widget.Spinner; import android.widget.TabHost; import android.widget.TabWidget; import android.widget.TextView; +import android.widget.ToggleButton; import android.widget.CompoundButton.OnCheckedChangeListener; import com.timsu.astrid.R; @@ -98,7 +98,7 @@ public class TaskEdit extends TaskModificationTabbedActivity { // UI components private EditText name; - private Spinner importance; + private ImportanceControlSet importance; private TimeDurationControlSet estimatedDuration; private TimeDurationControlSet elapsedDuration; private TimeDurationControlSet notification; @@ -184,7 +184,7 @@ public class TaskEdit extends TaskModificationTabbedActivity { append(model.getName())); estimatedDuration.setTimeDuration(model.getEstimatedSeconds()); elapsedDuration.setTimeDuration(model.getElapsedSeconds()); - importance.setSelection(model.getImportance().ordinal()); + importance.setImportance(model.getImportance()); definiteDueDate.setDate(model.getDefiniteDueDate()); preferredDueDate.setDate(model.getPreferredDueDate()); hiddenUntil.setDate(model.getHiddenUntil()); @@ -244,8 +244,7 @@ public class TaskEdit extends TaskModificationTabbedActivity { model.setName(name.getText().toString()); model.setEstimatedSeconds(estimatedDuration.getTimeDurationInSeconds()); model.setElapsedSeconds(elapsedDuration.getTimeDurationInSeconds()); - model.setImportance(Importance.values() - [importance.getSelectedItemPosition()]); + model.setImportance(importance.getImportance()); model.setDefiniteDueDate(definiteDueDate.getDate()); model.setPreferredDueDate(preferredDueDate.getDate()); model.setHiddenUntil(hiddenUntil.getDate()); @@ -326,7 +325,7 @@ public class TaskEdit extends TaskModificationTabbedActivity { // populate instance variables name = (EditText)findViewById(R.id.name); - importance = (Spinner)findViewById(R.id.importance); + importance = new ImportanceControlSet(R.id.importance_container); tagsContainer = (LinearLayout)findViewById(R.id.tags_container); estimatedDuration = new TimeDurationControlSet(this, R.id.estimatedDuration, 0, R.string.hour_minutes_dialog, @@ -351,11 +350,6 @@ public class TaskEdit extends TaskModificationTabbedActivity { repeatValue = (Button)findViewById(R.id.repeat_value); // individual ui component initialization - ImportanceAdapter importanceAdapter = new ImportanceAdapter(this, - android.R.layout.simple_spinner_item, - R.layout.importance_spinner_dropdown, - Importance.values()); - importance.setAdapter(importanceAdapter); ArrayAdapter repeatAdapter = new ArrayAdapter( this, android.R.layout.simple_spinner_item, RepeatInterval.getLabels(getResources())); @@ -667,58 +661,6 @@ public class TaskEdit extends TaskModificationTabbedActivity { * ========================================== UI component helper classes * ====================================================================== */ - /** Adapter with custom view to display Importance with proper formatting */ - private class ImportanceAdapter extends ArrayAdapter { - private int textViewResourceId, dropDownResourceId; - private LayoutInflater inflater; - - public ImportanceAdapter(Context context, int textViewResourceId, - int dropDownResourceId, Importance[] objects) { - super(context, textViewResourceId, objects); - - inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - this.textViewResourceId = textViewResourceId; - this.dropDownResourceId = dropDownResourceId; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - return getView(position, convertView, parent, textViewResourceId, true); - } - - @Override - public View getDropDownView(int position, View convertView, ViewGroup parent) { - return getView(position, convertView, parent, dropDownResourceId, true); - } - - public View getView(int position, View convertView, ViewGroup parent, - int resource, boolean setColors) { - View view; - TextView text; - Resources r = getResources(); - - if (convertView == null) { - view = inflater.inflate(resource, parent, false); - } else { - view = convertView; - } - - try { - text = (TextView) view; - } catch (ClassCastException e) { - Log.e("ArrayAdapter", "You must supply a resource ID for a TextView"); - throw new IllegalStateException( - "ArrayAdapter requires the resource ID to be a TextView", e); - } - - text.setText(r.getString(getItem(position).getLabelResource())); - if(setColors) - text.setBackgroundColor(r.getColor(getItem(position).getColorResource())); - - return view; - } - } - /** Control set dealing with notification flags */ public class NotifyFlagControlSet { private CheckBox before, during, after; @@ -751,6 +693,54 @@ public class TaskEdit extends TaskModificationTabbedActivity { } } + /** Control set dealing with importance */ + public class ImportanceControlSet { + private List buttons = new LinkedList(); + + public ImportanceControlSet(int containerId) { + LinearLayout layout = (LinearLayout)findViewById(containerId); + Resources r = getResources(); + + for(Importance i : Importance.values()) { + final ToggleButton button = new ToggleButton(TaskEdit.this); + button.setLayoutParams(new LinearLayout.LayoutParams( + LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1)); + button.setTextColor(r.getColor(i.getColorResource())); + button.setTextOff(r.getString(i.getLabelResource())); + button.setTextOn(r.getString(i.getLabelResource())); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + setImportance((Importance)button.getTag()); + } + }); + button.setTag(i); + + buttons.add(button); + layout.addView(button); + } + } + + public void setImportance(Importance i) { + for(CompoundButton b : buttons) { + if(b.getTag() == i) { + b.setTextSize(24); + b.setChecked(true); + } else { + b.setTextSize(16); + b.setChecked(false); + } + } + } + + public Importance getImportance() { + for(CompoundButton b : buttons) + if(b.isChecked()) + return (Importance)b.getTag(); + return Importance.DEFAULT; + } + } + /** Control set dealing with "blocking on" */ public class BlockingOnControlSet { diff --git a/src/com/timsu/astrid/activities/TaskListAdapter.java b/src/com/timsu/astrid/activities/TaskListAdapter.java index b3703470b..8f5146202 100644 --- a/src/com/timsu/astrid/activities/TaskListAdapter.java +++ b/src/com/timsu/astrid/activities/TaskListAdapter.java @@ -46,6 +46,7 @@ import com.timsu.astrid.data.tag.TagModelForView; import com.timsu.astrid.data.task.TaskController; import com.timsu.astrid.data.task.TaskModelForList; import com.timsu.astrid.utilities.DateUtilities; +import com.timsu.astrid.utilities.Preferences; /** Adapter for displaying a list of TaskModelForList entities * @@ -105,7 +106,8 @@ public class TaskListAdapter extends ArrayAdapter { final TextView dueDateView = ((TextView)view.findViewById(R.id.text_dueDate)); final TextView tagsView = ((TextView)view.findViewById(R.id.text_tags)); final CheckBox progress = ((CheckBox)view.findViewById(R.id.cb1)); - final ImageView timer = ((ImageView)view.findViewById(R.id.image1)); + final ImageView timer = ((ImageView)view.findViewById(R.id.imageLeft)); + final ImageView importance = ((ImageView)view.findViewById(R.id.imageRight)); boolean hasProperties = false; view.setTag(task); @@ -115,8 +117,12 @@ public class TaskListAdapter extends ArrayAdapter { if(task.getHiddenUntil() != null && task.getHiddenUntil().after(new Date())) nameValue = "(" + r.getString(R.string.taskList_hiddenPrefix) + ") " + nameValue; name.setText(nameValue); + Integer fontSizePreference = Preferences.getTaskListFontSize(getContext()); + if(fontSizePreference != null && fontSizePreference > 0) + name.setTextSize(fontSizePreference); if(task.getTimerStart() != null) timer.setImageDrawable(r.getDrawable(R.drawable.ic_dialog_time)); + importance.setImageDrawable(r.getDrawable(task.getImportance().getIconResource())); progress.setChecked(task.isTaskCompleted()); // due date / completion date @@ -241,7 +247,7 @@ public class TaskListAdapter extends ArrayAdapter { } private void setTaskProgress(final TaskModelForList task, View view, int progress) { - final ImageView timer = ((ImageView)view.findViewById(R.id.image1)); + final ImageView timer = ((ImageView)view.findViewById(R.id.imageLeft)); task.setProgressPercentage(progress); hooks.getTaskController().saveTask(task); diff --git a/src/com/timsu/astrid/activities/TaskViewNotifier.java b/src/com/timsu/astrid/activities/TaskViewNotifier.java index 55a12cd0a..5ebf7fc7a 100644 --- a/src/com/timsu/astrid/activities/TaskViewNotifier.java +++ b/src/com/timsu/astrid/activities/TaskViewNotifier.java @@ -10,9 +10,8 @@ import android.os.Bundle; import com.timsu.astrid.R; import com.timsu.astrid.utilities.Constants; import com.timsu.astrid.utilities.Notifications; -import com.timsu.astrid.widget.NumberPicker; -import com.timsu.astrid.widget.NumberPickerDialog; -import com.timsu.astrid.widget.NumberPickerDialog.OnNumberPickedListener; +import com.timsu.astrid.widget.NNumberPickerDialog; +import com.timsu.astrid.widget.NNumberPickerDialog.OnNNumberPickedListener; public class TaskViewNotifier extends TaskView { @@ -80,18 +79,19 @@ public class TaskViewNotifier extends TaskView { private void snoozeAlert() { Resources r = getResources(); // ask how long - new NumberPickerDialog(this, - new OnNumberPickedListener() { - @Override - public void onNumberPicked(NumberPicker view, int number) { + new NNumberPickerDialog(this, new OnNNumberPickedListener() { + public void onNumbersPicked(int[] values) { + int snoozeSeconds = values[0] * 3600 + values[1] * 60; Notifications.createSnoozeAlarm(TaskViewNotifier.this, - model.getTaskIdentifier(), number * 60, flags, + model.getTaskIdentifier(), snoozeSeconds, flags, repeatInterval); setResult(Constants.RESULT_GO_HOME); TaskList.shouldCloseInstance = true; finish(); } - }, r.getString(R.string.notify_snooze_title), 10, 10, 0, 120).show(); + }, r.getString(R.string.notify_snooze_title), + new int[] {0, 0}, new int[] {1, 5}, new int[] {0, 0}, + new int[] {99, 59}, new String[] {":", null}).show(); } } diff --git a/src/com/timsu/astrid/data/enums/Importance.java b/src/com/timsu/astrid/data/enums/Importance.java index a5f9bac26..924a3d38c 100644 --- a/src/com/timsu/astrid/data/enums/Importance.java +++ b/src/com/timsu/astrid/data/enums/Importance.java @@ -24,21 +24,23 @@ import com.timsu.astrid.R; public enum Importance { // MOST IMPORTANT - LEVEL_1(R.string.importance_1, R.color.importance_1), - LEVEL_2(R.string.importance_2, R.color.importance_2), - LEVEL_3(R.string.importance_3, R.color.importance_3), - LEVEL_4(R.string.importance_4, R.color.importance_4), + LEVEL_1(R.string.importance_1, R.color.importance_1, R.drawable.bullet_red), + LEVEL_2(R.string.importance_2, R.color.importance_2, R.drawable.bullet_orange), + LEVEL_3(R.string.importance_3, R.color.importance_3, R.drawable.bullet_blue), + LEVEL_4(R.string.importance_4, R.color.importance_4, R.drawable.bullet_white), // LEAST IMPORTANT ; int label; int color; + int icon; public static final Importance DEFAULT = LEVEL_3; - private Importance(int label, int color) { + private Importance(int label, int color, int icon) { this.label = label; this.color = color; + this.icon = icon; } public int getLabelResource() { @@ -48,4 +50,8 @@ public enum Importance { public int getColorResource() { return color; } + + public int getIconResource() { + return icon; + } } diff --git a/src/com/timsu/astrid/data/task/AbstractTaskModel.java b/src/com/timsu/astrid/data/task/AbstractTaskModel.java index b62820cc9..6f08f0156 100644 --- a/src/com/timsu/astrid/data/task/AbstractTaskModel.java +++ b/src/com/timsu/astrid/data/task/AbstractTaskModel.java @@ -192,7 +192,7 @@ public abstract class AbstractTaskModel extends AbstractModel { System.currentTimeMillis()) { return R.color.task_list_overdue; } else { - return getImportance().getColorResource(); + return R.color.task_list_normal; } } diff --git a/src/com/timsu/astrid/data/task/TaskModelForList.java b/src/com/timsu/astrid/data/task/TaskModelForList.java index c1e22632f..f3aaa5e83 100644 --- a/src/com/timsu/astrid/data/task/TaskModelForList.java +++ b/src/com/timsu/astrid/data/task/TaskModelForList.java @@ -85,6 +85,8 @@ public class TaskModelForList extends AbstractTaskModel { int secondsLeft = getEstimatedSeconds() - getElapsedSeconds(); if(secondsLeft > 0) weight += secondsLeft / 120; + else + weight += 3600 / 120; // default if no time set // looming absolute deadline if(getDefiniteDueDate() != null) { diff --git a/src/com/timsu/astrid/utilities/Preferences.java b/src/com/timsu/astrid/utilities/Preferences.java index 6b7cb5bb6..4620db6d2 100644 --- a/src/com/timsu/astrid/utilities/Preferences.java +++ b/src/com/timsu/astrid/utilities/Preferences.java @@ -18,10 +18,6 @@ public class Preferences { // default values private static final boolean DEFAULT_PERSISTENCE_MODE = true; - private static SharedPreferences getPrefs(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context); - } - /** Set preference defaults, if unset. called at startup */ public static void setPreferenceDefaults(Context context) { SharedPreferences prefs = getPrefs(context); @@ -32,6 +28,12 @@ public class Preferences { editor.putBoolean(r.getString(R.string.p_notif_annoy), DEFAULT_PERSISTENCE_MODE); } + if(!prefs.contains(r.getString(R.string.p_fontSize))) { + editor.putString(r.getString(R.string.p_fontSize), "20"); + } + if(!prefs.contains(r.getString(R.string.p_deadlineTime))) { + editor.putString(r.getString(R.string.p_deadlineTime), "7"); + } editor.commit(); } @@ -61,28 +63,12 @@ public class Preferences { /** returns hour at which quiet hours start, or null if not set */ public static Integer getQuietHourStart(Context context) { - Resources r = context.getResources(); - String value = getPrefs(context).getString(r.getString( - R.string.p_notif_quietStart), ""); - - try { - return Integer.parseInt(value); - } catch (Exception e) { - return null; - } + return getIntegerValue(context, R.string.p_notif_quietStart); } /** returns hour at which quiet hours start, or null if not set */ public static Integer getQuietHourEnd(Context context) { - Resources r = context.getResources(); - String value = getPrefs(context).getString(r.getString( - R.string.p_notif_quietEnd), ""); - - try { - return Integer.parseInt(value); - } catch (Exception e) { - return null; - } + return getIntegerValue(context, R.string.p_notif_quietEnd); } /** Get notification ringtone, or null if not set */ @@ -104,4 +90,31 @@ public class Preferences { return getPrefs(context).getBoolean(r.getString( R.string.p_notif_annoy), DEFAULT_PERSISTENCE_MODE); } + + /** returns the font size user wants on the front page */ + public static Integer getTaskListFontSize(Context context) { + return getIntegerValue(context, R.string.p_fontSize); + } + + /** Return # of days from now to set deadlines by default */ + public static Integer getDefaultDeadlineDays(Context context) { + return getIntegerValue(context, R.string.p_deadlineTime); + } + + // --- helper methods + + private static SharedPreferences getPrefs(Context context) { + return PreferenceManager.getDefaultSharedPreferences(context); + } + + private static Integer getIntegerValue(Context context, int keyResource) { + Resources r = context.getResources(); + String value = getPrefs(context).getString(r.getString(keyResource), ""); + + try { + return Integer.parseInt(value); + } catch (Exception e) { + return null; + } + } } diff --git a/src/com/timsu/astrid/widget/DateControlSet.java b/src/com/timsu/astrid/widget/DateControlSet.java index 3275769ed..d65739d26 100644 --- a/src/com/timsu/astrid/widget/DateControlSet.java +++ b/src/com/timsu/astrid/widget/DateControlSet.java @@ -33,6 +33,8 @@ import android.widget.Button; import android.widget.DatePicker; import android.widget.TimePicker; +import com.timsu.astrid.utilities.Preferences; + public class DateControlSet implements OnTimeSetListener, OnDateSetListener, View.OnClickListener { @@ -68,7 +70,10 @@ public class DateControlSet implements OnTimeSetListener, this.date = newDate; if(newDate == null) { date = new Date(); - date.setTime(date.getTime() + 24*3600*1000); + Integer days = Preferences.getDefaultDeadlineDays(activity); + if(days == null) + days = 1; + date.setTime(date.getTime() + days*24*3600*1000); date.setMinutes(0); }