Merge remote-tracking branch 'upstream/120120_as_new_task_icons' into 4.0

pull/14/head
Sam Bosley 13 years ago
commit 05018ec901

@ -92,6 +92,12 @@
<!-- today -->
<string name="yesterday">Yesterday</string>
<!-- tomorrow abbreviated -->
<string name="tmrw">Tmrw</string>
<!-- today abbreviated -->
<string name="yest">Yest</string>
<!-- ================================================== Generic Dialogs == -->
<!-- confirmation dialog title -->

@ -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) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -3,9 +3,9 @@
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_1" />
android:drawable="@drawable/check_box_1" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_1" />
android:drawable="@drawable/check_box_checked_1" />
</selector>

@ -3,9 +3,9 @@
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_2" />
android:drawable="@drawable/check_box_2" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_2" />
android:drawable="@drawable/check_box_checked_2" />
</selector>

@ -3,9 +3,9 @@
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_3" />
android:drawable="@drawable/check_box_3" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_3" />
android:drawable="@drawable/check_box_checked_3" />
</selector>

@ -3,9 +3,9 @@
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_4" />
android:drawable="@drawable/check_box_4" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/repeat_box_4" />
android:drawable="@drawable/check_box_checked_4" />
</selector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_1" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_checked_1" />
</selector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_2" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_checked_2" />
</selector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_3" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_checked_3" />
</selector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_4" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/check_box_repeat_checked_4" />
</selector>

@ -1,84 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- See the file "LICENSE" for the full license governing this code. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/rowBody"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="60dip"
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout android:id="@+id/rowBody"
android:layout_height="70dip"
android:paddingBottom="4dip" >
<!-- completion check-box -->
<CheckBox
android:id="@+id/completeBox"
android:layout_width="45dip"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dip"
android:button="@drawable/btn_check" />
<!-- assignee photo -->
<greendroid.widget.AsyncImageView
android:id="@+id/picture"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_marginLeft="10dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:visibility="gone" />
<LinearLayout
android:id="@+id/task_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:paddingBottom="4dip">
<!-- completion check-box -->
<CheckBox android:id="@+id/completeBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="5dip"
android:button="@drawable/btn_check"/>
<!-- assignee photo -->
<greendroid.widget.AsyncImageView android:id="@+id/picture"
android:layout_width="35dip"
android:layout_height="35dip"
android:padding="5dip"
android:scaleType="fitCenter"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:visibility="gone"/>
<LinearLayout android:id="@+id/task_row"
android:layout_height="fill_parent"
android:layout_alignTop="@id/completeBox"
android:layout_toRightOf="@id/completeBox"
android:orientation="horizontal"
android:paddingLeft="5dip" >
<!-- task name -->
<TextView
android:id="@+id/title"
style="@style/TextAppearance.TAd_ItemTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/completeBox"
android:layout_alignTop="@id/completeBox"
android:paddingLeft="5dip"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:orientation="horizontal">
<!-- task name -->
<TextView android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
style="@style/TextAppearance.TAd_ItemTitle"/>
<!-- due date -->
<TextView android:id="@+id/dueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="4dip"
android:singleLine="true"/>
</LinearLayout>
<!-- details line 1 -->
<TextView android:id="@+id/details1"
android:layout_height="fill_parent"
android:layout_weight="100"
android:gravity="center_vertical"
android:maxLines="2" />
<!-- due date -->
<TextView
android:id="@+id/dueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_row"
android:layout_alignLeft="@id/task_row"
android:layout_marginTop="-5dip"
android:layout_marginLeft="5dip"
style="@style/TextAppearance.TAd_ItemDetails"
android:visibility="gone" />
<!-- details line 2 -->
<TextView android:id="@+id/details2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/details1"
android:layout_alignLeft="@id/task_row"
android:layout_marginLeft="5dip"
style="@style/TextAppearance.TAd_ItemDetails"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="4dip"
android:gravity="center_vertical|right" />
</LinearLayout>
<!-- details line 1 -->
<TextView
android:id="@+id/details1"
style="@style/TextAppearance.TAd_ItemDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/task_row"
android:layout_below="@id/task_row"
android:layout_marginLeft="5dip"
android:layout_marginTop="-5dip"
android:visibility="gone" />
<!-- details line 2 -->
<TextView
android:id="@+id/details2"
style="@style/TextAppearance.TAd_ItemDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/task_row"
android:layout_below="@id/details1"
android:layout_marginLeft="5dip"
android:visibility="gone" />
</RelativeLayout>

@ -263,6 +263,12 @@
<item>-1</item>
</string-array>
<!-- show task details (corresponds to showing repeat and tag details in the task adapter) -->
<string name="p_default_showdetails_key">p_show_details</string>
<!-- show task decorations (corresponds to showing notes icon in the task adapter) -->
<string name="p_default_showdecorations_key">p_show_decorations</string>
<!-- ============================================================ SYNC == -->
<string-array name="sync_SPr_interval_values">

@ -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);

Loading…
Cancel
Save