From a73776b5ea53d2e385e98612b7c9be71149bec8f Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 12 Sep 2012 10:56:11 -0700 Subject: [PATCH] Don't show filter images on the nook since they have a crazy bug --- .../com/todoroo/astrid/adapter/FilterAdapter.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java index 86cff545a..1b2915a19 100644 --- a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java @@ -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 { @@ -108,6 +110,8 @@ public class FilterAdapter extends ArrayAdapter { 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 { this.selectable = selectable; this.filterCounts = new HashMap(); + 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 { 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 { } 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);