diff --git a/api/res/values/strings.xml b/api/res/values/strings.xml index 934835327..178a739e7 100644 --- a/api/res/values/strings.xml +++ b/api/res/values/strings.xml @@ -92,6 +92,12 @@ Yesterday + + Tmrw + + + Yest + diff --git a/api/src/com/todoroo/andlib/utility/DateUtilities.java b/api/src/com/todoroo/andlib/utility/DateUtilities.java index 464981476..cf97ba3eb 100644 --- a/api/src/com/todoroo/andlib/utility/DateUtilities.java +++ b/api/src/com/todoroo/andlib/utility/DateUtilities.java @@ -99,7 +99,10 @@ public class DateUtilities { String value; if (is24HourFormat(context)) { value = "H:mm"; - } else { + } else if (date.getMinutes() == 0){ + value = "h a"; + } + else { value = "h:mm a"; } return new SimpleDateFormat(value).format(date); @@ -124,6 +127,29 @@ public class DateUtilities { return new SimpleDateFormat(value).format(date).replace("#", month); } + /** + * @param context android context + * @param date date to format + * @return date, with month, day, and year + */ + @SuppressWarnings("nls") + public static String getDateStringHideYear(Context context, Date date) { + String month = DateUtils.getMonthString(date.getMonth() + + Calendar.JANUARY, DateUtils.LENGTH_MEDIUM); + String value; + // united states, you are special + if (Locale.US.equals(Locale.getDefault()) + || Locale.CANADA.equals(Locale.getDefault())) + value = "'#' d"; + else + value = "d '#'"; + + if (date.getYear() != (new Date()).getYear()) { + value = value + "\nyyyy"; + } + return new SimpleDateFormat(value).format(date).replace("#", month); + } + /** * @return date format as getDateFormat with weekday */ @@ -141,6 +167,15 @@ public class DateUtilities { DateUtils.LENGTH_LONG); } + + /** + * @return weekday + */ + public static String getWeekdayShort(Date date) { + return DateUtils.getDayOfWeekString(date.getDay() + Calendar.SUNDAY, + DateUtils.LENGTH_MEDIUM); + } + /** * @return date format as getDateFormat with weekday */ @@ -168,16 +203,16 @@ public class DateUtilities { return context.getString(R.string.today).toLowerCase(); if(today + ONE_DAY == input) - return context.getString(R.string.tomorrow).toLowerCase(); + return context.getString(R.string.tmrw).toLowerCase(); if(today == input + ONE_DAY) - return context.getString(R.string.yesterday).toLowerCase(); + return context.getString(R.string.yest).toLowerCase(); if(today + DateUtilities.ONE_WEEK >= input && today - DateUtilities.ONE_WEEK <= input) - return DateUtilities.getWeekday(new Date(date)); + return DateUtilities.getWeekdayShort(new Date(date)); - return DateUtilities.getDateString(context, new Date(date)); + return DateUtilities.getDateStringHideYear(context, new Date(date)); } private static long clearTime(Date date) { diff --git a/astrid/res/drawable/repeat_box_1.png b/astrid/res/drawable/check_box_1.png similarity index 76% rename from astrid/res/drawable/repeat_box_1.png rename to astrid/res/drawable/check_box_1.png index 04c745be7..908faa2c8 100644 Binary files a/astrid/res/drawable/repeat_box_1.png and b/astrid/res/drawable/check_box_1.png differ diff --git a/astrid/res/drawable/repeat_box_2.png b/astrid/res/drawable/check_box_2.png similarity index 76% rename from astrid/res/drawable/repeat_box_2.png rename to astrid/res/drawable/check_box_2.png index f83e43229..2d2f38f70 100644 Binary files a/astrid/res/drawable/repeat_box_2.png and b/astrid/res/drawable/check_box_2.png differ diff --git a/astrid/res/drawable/repeat_box_3.png b/astrid/res/drawable/check_box_3.png similarity index 76% rename from astrid/res/drawable/repeat_box_3.png rename to astrid/res/drawable/check_box_3.png index 4366509ce..5103d5c82 100644 Binary files a/astrid/res/drawable/repeat_box_3.png and b/astrid/res/drawable/check_box_3.png differ diff --git a/astrid/res/drawable/repeat_box_4.png b/astrid/res/drawable/check_box_4.png similarity index 75% rename from astrid/res/drawable/repeat_box_4.png rename to astrid/res/drawable/check_box_4.png index 535e64f76..14b203b97 100644 Binary files a/astrid/res/drawable/repeat_box_4.png and b/astrid/res/drawable/check_box_4.png differ diff --git a/astrid/res/drawable/check_box_checked_1.png b/astrid/res/drawable/check_box_checked_1.png new file mode 100644 index 000000000..2960404eb Binary files /dev/null and b/astrid/res/drawable/check_box_checked_1.png differ diff --git a/astrid/res/drawable/check_box_checked_2.png b/astrid/res/drawable/check_box_checked_2.png new file mode 100644 index 000000000..52b926e50 Binary files /dev/null and b/astrid/res/drawable/check_box_checked_2.png differ diff --git a/astrid/res/drawable/check_box_checked_3.png b/astrid/res/drawable/check_box_checked_3.png new file mode 100644 index 000000000..7ee0c6be3 Binary files /dev/null and b/astrid/res/drawable/check_box_checked_3.png differ diff --git a/astrid/res/drawable/check_box_checked_4.png b/astrid/res/drawable/check_box_checked_4.png new file mode 100644 index 000000000..1d223ae5a Binary files /dev/null and b/astrid/res/drawable/check_box_checked_4.png differ diff --git a/astrid/res/drawable/check_box_repeat_1.png b/astrid/res/drawable/check_box_repeat_1.png new file mode 100644 index 000000000..7e3d46380 Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_1.png differ diff --git a/astrid/res/drawable/check_box_repeat_2.png b/astrid/res/drawable/check_box_repeat_2.png new file mode 100644 index 000000000..5cfb0632c Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_2.png differ diff --git a/astrid/res/drawable/check_box_repeat_3.png b/astrid/res/drawable/check_box_repeat_3.png new file mode 100644 index 000000000..fe7138dc7 Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_3.png differ diff --git a/astrid/res/drawable/check_box_repeat_4.png b/astrid/res/drawable/check_box_repeat_4.png new file mode 100644 index 000000000..b2e1dddea Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_4.png differ diff --git a/astrid/res/drawable/check_box_repeat_checked_1.png b/astrid/res/drawable/check_box_repeat_checked_1.png new file mode 100644 index 000000000..1602b302f Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_checked_1.png differ diff --git a/astrid/res/drawable/check_box_repeat_checked_2.png b/astrid/res/drawable/check_box_repeat_checked_2.png new file mode 100644 index 000000000..028ee0918 Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_checked_2.png differ diff --git a/astrid/res/drawable/check_box_repeat_checked_3.png b/astrid/res/drawable/check_box_repeat_checked_3.png new file mode 100644 index 000000000..1dacaa0bc Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_checked_3.png differ diff --git a/astrid/res/drawable/check_box_repeat_checked_4.png b/astrid/res/drawable/check_box_repeat_checked_4.png new file mode 100644 index 000000000..258b35e3a Binary files /dev/null and b/astrid/res/drawable/check_box_repeat_checked_4.png differ diff --git a/astrid/res/drawable/importance_check_1.xml b/astrid/res/drawable/importance_check_1.xml index 68c0b6ff0..7014f0bb7 100644 --- a/astrid/res/drawable/importance_check_1.xml +++ b/astrid/res/drawable/importance_check_1.xml @@ -3,9 +3,9 @@ + android:drawable="@drawable/check_box_1" /> + android:drawable="@drawable/check_box_checked_1" /> \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_2.xml b/astrid/res/drawable/importance_check_2.xml index a18c0215b..c865b3af6 100644 --- a/astrid/res/drawable/importance_check_2.xml +++ b/astrid/res/drawable/importance_check_2.xml @@ -3,9 +3,9 @@ + android:drawable="@drawable/check_box_2" /> + android:drawable="@drawable/check_box_checked_2" /> \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_3.xml b/astrid/res/drawable/importance_check_3.xml index a9d2037dd..76f4d22e0 100644 --- a/astrid/res/drawable/importance_check_3.xml +++ b/astrid/res/drawable/importance_check_3.xml @@ -3,9 +3,9 @@ + android:drawable="@drawable/check_box_3" /> + android:drawable="@drawable/check_box_checked_3" /> \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_4.xml b/astrid/res/drawable/importance_check_4.xml index f02246457..47e2eeb98 100644 --- a/astrid/res/drawable/importance_check_4.xml +++ b/astrid/res/drawable/importance_check_4.xml @@ -3,9 +3,9 @@ + android:drawable="@drawable/check_box_4" /> + android:drawable="@drawable/check_box_checked_4" /> \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_repeat_1.xml b/astrid/res/drawable/importance_check_repeat_1.xml new file mode 100644 index 000000000..75b16aa7d --- /dev/null +++ b/astrid/res/drawable/importance_check_repeat_1.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_repeat_2.xml b/astrid/res/drawable/importance_check_repeat_2.xml new file mode 100644 index 000000000..76fdae066 --- /dev/null +++ b/astrid/res/drawable/importance_check_repeat_2.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_repeat_3.xml b/astrid/res/drawable/importance_check_repeat_3.xml new file mode 100644 index 000000000..0a97e6ada --- /dev/null +++ b/astrid/res/drawable/importance_check_repeat_3.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/importance_check_repeat_4.xml b/astrid/res/drawable/importance_check_repeat_4.xml new file mode 100644 index 000000000..421df0d11 --- /dev/null +++ b/astrid/res/drawable/importance_check_repeat_4.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/astrid/res/layout/task_adapter_row.xml b/astrid/res/layout/task_adapter_row.xml index baa8a41e2..dad243275 100644 --- a/astrid/res/layout/task_adapter_row.xml +++ b/astrid/res/layout/task_adapter_row.xml @@ -1,84 +1,87 @@ - - - + + + + + + + + + - - - - - - - + + + + - - - - - - - - - - - + + + + - - - - - - - + android:layout_height="fill_parent" + android:layout_alignParentRight="true" + android:layout_marginRight="4dip" + android:gravity="center_vertical|right" /> + + + + + + + + + + \ No newline at end of file diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index 7ad0a63d2..08d60497c 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -263,6 +263,12 @@ -1 + + p_show_details + + + p_show_decorations + diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java index 83da7635b..32cf65d80 100644 --- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java @@ -129,7 +129,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable { }; private static int[] IMPORTANCE_REPEAT_RESOURCES = new int[] { - // stuff will go here + R.drawable.importance_check_repeat_1, //task_indicator_0, + R.drawable.importance_check_repeat_2, //task_indicator_1, + R.drawable.importance_check_repeat_3, //task_indicator_2, + R.drawable.importance_check_repeat_4, //task_indicator_3, }; // --- instance variables @@ -199,13 +202,15 @@ public class TaskAdapter extends CursorAdapter implements Filterable { displayMetrics = new DisplayMetrics(); fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - detailLoader = new DetailLoaderThread(); - detailLoader.start(); + if (Preferences.getBoolean(R.string.p_default_showdetails_key, false)) { + detailLoader = new DetailLoaderThread(); + detailLoader.start(); + } decorationManager = new DecorationManager(); taskActionManager = new TaskActionManager(); - scaleAnimation = new ScaleAnimation(1.6f, 1.0f, 1.6f, 1.0f, + scaleAnimation = new ScaleAnimation(1.4f, 1.0f, 1.4f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setDuration(100); @@ -377,12 +382,24 @@ public class TaskAdapter extends CursorAdapter implements Filterable { final CheckBox checkBoxView = viewHolder.completeBox; { int value = task.getValue(Task.IMPORTANCE); if(value < IMPORTANCE_RESOURCES.length) - if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) - checkBoxView.setButtonDrawable(IMPORTANCE_RESOURCES[value]); - else + if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) { + checkBoxView.setButtonDrawable(IMPORTANCE_REPEAT_RESOURCES[value]); + pictureView.setBackgroundResource(IMPORTANCE_REPEAT_RESOURCES[value]); + } + else { checkBoxView.setButtonDrawable(IMPORTANCE_RESOURCES[value]); + pictureView.setBackgroundResource(IMPORTANCE_RESOURCES[value]); + } else + { checkBoxView.setBackgroundResource(R.drawable.btn_check); + } + if (pictureView.getVisibility() == View.VISIBLE){ + checkBoxView.setVisibility(View.INVISIBLE); + } + else { + checkBoxView.setVisibility(View.VISIBLE); + } } String details; @@ -394,7 +411,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if(TextUtils.isEmpty(details) || DETAIL_SEPARATOR.equals(details) || task.isCompleted()) { viewHolder.details1.setVisibility(View.GONE); viewHolder.details2.setVisibility(View.GONE); - } else { + } else if (Preferences.getBoolean(R.string.p_default_showdetails_key, false)) { viewHolder.details1.setVisibility(View.VISIBLE); if (details.startsWith(DETAIL_SEPARATOR)) { StringBuffer buffer = new StringBuffer(details); @@ -410,8 +427,13 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if(Math.abs(DateUtilities.now() - task.getValue(Task.MODIFICATION_DATE)) < 2000L) mostRecentlyMade = task.getId(); -// // details and decorations, expanded - decorationManager.request(viewHolder); + // // details and decorations, expanded + + + if (Preferences.getBoolean(R.string.p_default_showdecorations_key, false)) { + decorationManager.request(viewHolder); + } + } @SuppressWarnings("nls") @@ -424,7 +446,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { viewHolder.completeBox.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); rightWidth = rightWidth + viewHolder.dueDate.getPaddingRight(); float left = viewHolder.completeBox.getMeasuredWidth() + - ((MarginLayoutParams)viewHolder.completeBox.getLayoutParams()).leftMargin; + ((MarginLayoutParams)viewHolder.completeBox.getLayoutParams()).leftMargin; int availableWidth = (int) (displayMetrics.widthPixels - left - (rightWidth + 16) * displayMetrics.density); int i = 0; @@ -555,8 +577,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable { continue; } else if(Constants.DEBUG) { System.err.println("Forced loading of details: " + task.getId() + //$NON-NLS-1$ - "\n details: " + new Date(task.getValue(Task.DETAILS_DATE)) + //$NON-NLS-1$ - "\n modified: " + new Date(task.getValue(Task.MODIFICATION_DATE))); //$NON-NLS-1$ + "\n details: " + new Date(task.getValue(Task.DETAILS_DATE)) + //$NON-NLS-1$ + "\n modified: " + new Date(task.getValue(Task.MODIFICATION_DATE))); //$NON-NLS-1$ } addTaskToLoadingArray(task); @@ -583,7 +605,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { private boolean detailsAreRecentAndUpToDate(Task task) { return task.getValue(Task.DETAILS_DATE) >= task.getValue(Task.MODIFICATION_DATE) && - !TextUtils.isEmpty(task.getValue(Task.DETAILS)); + !TextUtils.isEmpty(task.getValue(Task.DETAILS)); } private void addTaskToLoadingArray(Task task) { @@ -650,8 +672,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable { return null; Drawable d; if(!cache.containsKey(drawable)) { - d = r.getDrawable(drawable); - d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight()); + d = r.getDrawable(drawable); + d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight()); cache.put(drawable, d); } else d = cache.get(drawable);