|
|
|
@ -54,8 +54,10 @@ import com.todoroo.astrid.api.FilterListHeader;
|
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
|
import com.todoroo.astrid.api.FilterWithUpdate;
|
|
|
|
|
import com.todoroo.astrid.helper.AsyncImageView;
|
|
|
|
|
import com.todoroo.astrid.service.MarketStrategy.NookMarketStrategy;
|
|
|
|
|
import com.todoroo.astrid.service.TaskService;
|
|
|
|
|
import com.todoroo.astrid.tags.TagService;
|
|
|
|
|
import com.todoroo.astrid.utility.Constants;
|
|
|
|
|
|
|
|
|
|
public class FilterAdapter extends ArrayAdapter<Filter> {
|
|
|
|
|
|
|
|
|
@ -108,6 +110,8 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
|
|
|
|
|
|
|
|
|
|
private FilterDataSourceChangedListener listener;
|
|
|
|
|
|
|
|
|
|
private final boolean nook;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Previous solution involved a queue of filters and a filterSizeLoadingThread. The filterSizeLoadingThread had
|
|
|
|
|
// a few problems: how to make sure that the thread is resumed when the controlling activity is resumed, and
|
|
|
|
@ -136,6 +140,8 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
|
|
|
|
|
this.selectable = selectable;
|
|
|
|
|
this.filterCounts = new HashMap<Filter, Integer>();
|
|
|
|
|
|
|
|
|
|
this.nook = (Constants.MARKET_STRATEGY instanceof NookMarketStrategy);
|
|
|
|
|
|
|
|
|
|
if (activity instanceof AstridActivity && ((AstridActivity) activity).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE)
|
|
|
|
|
filterStyle = R.style.TextAppearance_FLA_Filter_Tablet;
|
|
|
|
|
|
|
|
|
@ -535,7 +541,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
|
|
|
|
|
viewHolder.urlImage.setVisibility(View.GONE);
|
|
|
|
|
viewHolder.icon.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
if(filter.listingIcon != null) {
|
|
|
|
|
if(!nook && filter.listingIcon != null) {
|
|
|
|
|
viewHolder.icon.setVisibility(View.VISIBLE);
|
|
|
|
|
viewHolder.icon.setImageBitmap(filter.listingIcon);
|
|
|
|
|
}
|
|
|
|
@ -566,12 +572,17 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
viewHolder.name.getLayoutParams().height = (int) (58 * metrics.density);
|
|
|
|
|
if(filter instanceof FilterWithUpdate) {
|
|
|
|
|
if(!nook && filter instanceof FilterWithUpdate) {
|
|
|
|
|
viewHolder.urlImage.setVisibility(View.VISIBLE);
|
|
|
|
|
viewHolder.urlImage.setDefaultImageResource(TagService.getDefaultImageIDForTag(viewHolder.name.getText().toString()));
|
|
|
|
|
viewHolder.urlImage.setUrl(((FilterWithUpdate)filter).imageUrl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nook) {
|
|
|
|
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) viewHolder.name.getLayoutParams();
|
|
|
|
|
params.setMargins((int) (8 * metrics.density), 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(filter.color != 0)
|
|
|
|
|
viewHolder.name.setTextColor(filter.color);
|
|
|
|
|
|
|
|
|
|