mirror of https://github.com/tasks/tasks
Started with infrastructure for featured lists
parent
e76e3ce8ca
commit
e4295194a5
@ -0,0 +1,37 @@
|
||||
package com.todoroo.astrid.tags.reusable;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.todoroo.astrid.adapter.FilterAdapter;
|
||||
import com.todoroo.astrid.utility.Constants;
|
||||
|
||||
public class FeaturedListFilterAdapter extends FilterAdapter {
|
||||
public static final String BROADCAST_REQUEST_FEATURED_LISTS = Constants.PACKAGE + ".REQUEST_FEATURED_LISTS"; //$NON-NLS-1$
|
||||
public static final String BROADCAST_SEND_FEATURED_LISTS = Constants.PACKAGE + ".SEND_FEATURED_LISTS"; //$NON-NLS-1$
|
||||
|
||||
public FeaturedListFilterAdapter(Activity activity, ListView listView,
|
||||
int rowLayout, boolean skipIntentFilters) {
|
||||
super(activity, listView, rowLayout, skipIntentFilters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLists() {
|
||||
Intent broadcastIntent = new Intent(BROADCAST_REQUEST_FEATURED_LISTS);
|
||||
activity.sendBroadcast(broadcastIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRecevier() {
|
||||
IntentFilter peopleFilter = new IntentFilter(BROADCAST_SEND_FEATURED_LISTS);
|
||||
activity.registerReceiver(filterReceiver, peopleFilter);
|
||||
getLists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterRecevier() {
|
||||
activity.unregisterReceiver(filterReceiver);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.todoroo.astrid.tags.reusable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.todoroo.astrid.api.AstridApiConstants;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
import com.todoroo.astrid.tags.TagFilterExposer;
|
||||
import com.todoroo.astrid.tags.TagService;
|
||||
import com.todoroo.astrid.tags.TagService.Tag;
|
||||
|
||||
public class FeaturedListFilterExposer extends TagFilterExposer {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
FilterListItem[] listAsArray = prepareFilters(context);
|
||||
|
||||
Intent broadcastIntent = new Intent(FeaturedListFilterAdapter.BROADCAST_SEND_FEATURED_LISTS);
|
||||
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray);
|
||||
context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Tag> getTagList() {
|
||||
return TagService.getInstance().getFeaturedLists();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue