|
|
|
|
@ -6,7 +6,6 @@ package com.todoroo.astrid.tags;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
|
import android.content.ComponentName;
|
|
|
|
|
import android.content.ContentValues;
|
|
|
|
|
@ -15,7 +14,6 @@ import android.content.DialogInterface;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.content.res.Resources;
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
@ -34,7 +32,6 @@ import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
|
import com.todoroo.astrid.api.AstridFilterExposer;
|
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
|
import com.todoroo.astrid.api.FilterCategory;
|
|
|
|
|
import com.todoroo.astrid.api.FilterCategoryWithNewButton;
|
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
|
import com.todoroo.astrid.api.FilterWithCustomIntent;
|
|
|
|
|
import com.todoroo.astrid.api.FilterWithUpdate;
|
|
|
|
|
@ -60,8 +57,6 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
|
|
|
|
|
@Autowired TagDataService tagDataService;
|
|
|
|
|
@Autowired GtasksPreferenceService gtasksPreferenceService;
|
|
|
|
|
|
|
|
|
|
private TagService tagService;
|
|
|
|
|
|
|
|
|
|
/** Create filter from new tag object */
|
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
|
public static FilterWithCustomIntent filterFromTag(Context context, Tag tag, Criterion criterion) {
|
|
|
|
|
@ -129,7 +124,6 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
|
|
|
|
|
private FilterListItem[] prepareFilters(Context context) {
|
|
|
|
|
DependencyInjectionService.getInstance().inject(this);
|
|
|
|
|
ContextManager.setContext(context);
|
|
|
|
|
tagService = TagService.getInstance();
|
|
|
|
|
|
|
|
|
|
ArrayList<FilterListItem> list = new ArrayList<FilterListItem>();
|
|
|
|
|
|
|
|
|
|
@ -148,25 +142,13 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private FilterCategory filterFromTags(Tag[] tags, int name) {
|
|
|
|
|
Filter[] filters = new Filter[tags.length + 1];
|
|
|
|
|
Filter[] filters = new Filter[tags.length];
|
|
|
|
|
Resources r = ContextManager.getContext().getResources();
|
|
|
|
|
|
|
|
|
|
int untaggedLabel = gtasksPreferenceService.isLoggedIn() ?
|
|
|
|
|
R.string.tag_FEx_untagged_w_astrid : R.string.tag_FEx_untagged;
|
|
|
|
|
Filter untagged = new Filter(r.getString(untaggedLabel),
|
|
|
|
|
r.getString(R.string.tag_FEx_untagged),
|
|
|
|
|
tagService.untaggedTemplate(),
|
|
|
|
|
null);
|
|
|
|
|
untagged.listingIcon = ((BitmapDrawable)r.getDrawable(R.drawable.gl_lists)).getBitmap();
|
|
|
|
|
filters[0] = untagged;
|
|
|
|
|
|
|
|
|
|
Context context = ContextManager.getContext();
|
|
|
|
|
for(int i = 0; i < tags.length; i++)
|
|
|
|
|
filters[i + 1] = filterFromTag(context, tags[i], TaskCriteria.activeAndVisible());
|
|
|
|
|
FilterCategoryWithNewButton filter = new FilterCategoryWithNewButton(context.getString(name), filters);
|
|
|
|
|
filter.label = r.getString(R.string.tag_FEx_add_new);
|
|
|
|
|
filter.intent = PendingIntent.getActivity(context, 0,
|
|
|
|
|
TagsPlugin.newTagDialog(context), 0);
|
|
|
|
|
filters[i] = filterFromTag(context, tags[i], TaskCriteria.activeAndVisible());
|
|
|
|
|
FilterCategory filter = new FilterCategory(context.getString(name), filters);
|
|
|
|
|
return filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|