|
|
@ -21,6 +21,7 @@ package com.timsu.astrid.activities;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
@ -30,7 +31,6 @@ import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.res.Resources;
|
|
|
|
import android.content.res.Resources;
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
|
|
import android.database.StaleDataException;
|
|
|
|
import android.database.StaleDataException;
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
@ -127,15 +127,19 @@ public class TagListSubActivity extends SubActivity {
|
|
|
|
|
|
|
|
|
|
|
|
private synchronized void sortTagArray() {
|
|
|
|
private synchronized void sortTagArray() {
|
|
|
|
// get all tasks
|
|
|
|
// get all tasks
|
|
|
|
Cursor taskCursor = getTaskController().getActiveTaskListCursor();
|
|
|
|
HashSet<TaskIdentifier> activeTasks =
|
|
|
|
startManagingCursor(taskCursor);
|
|
|
|
getTaskController().getActiveTaskIdentifiers();
|
|
|
|
|
|
|
|
|
|
|
|
// get task count for each tag
|
|
|
|
// get task count for each tag
|
|
|
|
tagToTaskCount = new HashMap<TagModelForView, Integer>();
|
|
|
|
tagToTaskCount = new HashMap<TagModelForView, Integer>();
|
|
|
|
for(TagModelForView tag : tagArray) {
|
|
|
|
for(TagModelForView tag : tagArray) {
|
|
|
|
LinkedList<TaskIdentifier> tasks = getTagController().getTaggedTasks(
|
|
|
|
LinkedList<TaskIdentifier> tasks = getTagController().getTaggedTasks(
|
|
|
|
getParent(), tag.getTagIdentifier());
|
|
|
|
getParent(), tag.getTagIdentifier());
|
|
|
|
tagToTaskCount.put(tag, tasks.size());
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for(TaskIdentifier task : tasks)
|
|
|
|
|
|
|
|
if(activeTasks.contains(task))
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
tagToTaskCount.put(tag, count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// do sort
|
|
|
|
// do sort
|
|
|
@ -338,7 +342,7 @@ public class TagListSubActivity extends SubActivity {
|
|
|
|
String label = tag.getName();
|
|
|
|
String label = tag.getName();
|
|
|
|
if(tag.shouldHideFromMainList())
|
|
|
|
if(tag.shouldHideFromMainList())
|
|
|
|
label = label.substring(1);
|
|
|
|
label = label.substring(1);
|
|
|
|
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
|
|
|
|
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "@" + label);
|
|
|
|
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON,
|
|
|
|
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON,
|
|
|
|
((BitmapDrawable)r.getDrawable(R.drawable.icon_tag)).getBitmap());
|
|
|
|
((BitmapDrawable)r.getDrawable(R.drawable.icon_tag)).getBitmap());
|
|
|
|
createShortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
|
|
|
|
createShortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
|
|
|
|