Highlight selected items, dont show zero counts

pull/253/head
Alex Baker 10 years ago
parent f9831384bd
commit 1ff6fb4f50

@ -44,6 +44,8 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static org.tasks.preferences.ResourceResolver.getData;
public class FilterAdapter extends ArrayAdapter<Filter> { public class FilterAdapter extends ArrayAdapter<Filter> {
private static final Logger log = LoggerFactory.getLogger(FilterAdapter.class); private static final Logger log = LoggerFactory.getLogger(FilterAdapter.class);
@ -197,15 +199,12 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
Filter selected = null; Filter selected = null;
if (activity instanceof AstridActivity) { if (activity instanceof AstridActivity) {
boolean shouldHighlightSelected = ((AstridActivity) activity).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE;
if (shouldHighlightSelected) {
TaskListFragment tlf = ((AstridActivity) activity).getTaskListFragment(); TaskListFragment tlf = ((AstridActivity) activity).getTaskListFragment();
selected = tlf.getFilter(); selected = tlf.getFilter();
} }
}
if (selected == null || !selected.equals(viewHolder.item)) { if (selected != null && selected.equals(viewHolder.item)) {
convertView.setBackgroundColor(activity.getResources().getColor(android.R.color.transparent)); convertView.setBackgroundColor(getData(activity, R.attr.drawer_selected));
} }
return convertView; return convertView;
@ -390,7 +389,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
} }
if(countInt == 0 && filter instanceof FilterWithCustomIntent) { if(countInt == 0 && filter instanceof FilterWithCustomIntent) {
viewHolder.name.setTextColor(Color.GRAY); viewHolder.size.setVisibility(View.GONE);
} }
viewHolder.name.getLayoutParams().height = (int) (58 * metrics.density); viewHolder.name.getLayoutParams().height = (int) (58 * metrics.density);

@ -37,6 +37,7 @@
<attr name="drawer_text" format="color"/> <attr name="drawer_text" format="color"/>
<attr name="task_edit_theme_color" format="color"/> <attr name="task_edit_theme_color" format="color"/>
<attr name="importance_background_selected" format="reference"/> <attr name="importance_background_selected" format="reference"/>
<attr name="drawer_selected" format="color"/>
<attr name="tea_icn_files" format="reference"/> <attr name="tea_icn_files" format="reference"/>
<attr name="tea_icn_addcal" format="reference"/> <attr name="tea_icn_addcal" format="reference"/>

@ -48,6 +48,7 @@
<item name="tea_icn_reminder">@drawable/tea_icn_reminder_lightblue</item> <item name="tea_icn_reminder">@drawable/tea_icn_reminder_lightblue</item>
<item name="drawer_background">#303030</item> <item name="drawer_background">#303030</item>
<item name="drawer_text">#ffffff</item> <item name="drawer_text">#ffffff</item>
<item name="drawer_selected">#555555</item>
<!-- actionbar-styling --> <!-- actionbar-styling -->
<item name="android:actionBarStyle">@style/AstridV11ActionBarStyle</item> <item name="android:actionBarStyle">@style/AstridV11ActionBarStyle</item>
<item name="actionBarStyle">@style/AstridActionBarStyle</item> <item name="actionBarStyle">@style/AstridActionBarStyle</item>
@ -105,6 +106,7 @@
<item name="drawer_background">#efefef</item> <item name="drawer_background">#efefef</item>
<item name="drawer_text">#000</item> <item name="drawer_text">#000</item>
<item name="drawer_selected">#dddddd</item>
<!-- actionbar-styling --> <!-- actionbar-styling -->
<item name="android:actionBarStyle">@style/AstridV11ActionBarStyle.Light</item> <item name="android:actionBarStyle">@style/AstridV11ActionBarStyle.Light</item>
<item name="actionBarStyle">@style/AstridActionBarStyle.Light</item> <item name="actionBarStyle">@style/AstridActionBarStyle.Light</item>

Loading…
Cancel
Save