Changed how filter row was highlighted on tablets to fix bugs with it sometimes being wrong

pull/14/head
Sam Bosley 12 years ago
parent d3929f2004
commit f9cde8e189

@ -182,8 +182,6 @@ public class FilterListFragment extends ListFragment {
setUpList();
if (mDualFragments) {
// In dual-pane mode, the list view highlights the selected item.
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
getListView().setItemsCanFocus(false);
}
}

@ -44,6 +44,7 @@ import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.AstridFilterExposer;
import com.todoroo.astrid.api.Filter;
@ -305,7 +306,16 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
viewHolder.item = (FilterListItem) getItem(position);
populateView(viewHolder);
if (listView.isItemChecked(position)) {
Filter selected = null;
if (activity instanceof AstridActivity) {
boolean shouldHighlightSelected = ((AstridActivity) activity).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE;
if (shouldHighlightSelected) {
TaskListFragment tlf = ((AstridActivity) activity).getTaskListFragment();
selected = tlf.getFilter();
}
}
if (selected != null && selected.equals(viewHolder.item)) {
convertView.setBackgroundColor(activity.getResources().getColor(R.color.tablet_list_selected));
} else {
convertView.setBackgroundColor(activity.getResources().getColor(android.R.color.transparent));

Loading…
Cancel
Save