From 330e52837cd5b903e8aa0158dcb67835f1ef8f13 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 4 Oct 2012 14:11:21 -0700 Subject: [PATCH] Removed dead code, fixed a display bug when scrolling the filter list --- .../astrid/activity/FilterListFragment.java | 30 ++----------------- .../todoroo/astrid/adapter/FilterAdapter.java | 9 ------ 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java index f172bae7e..8f2bf0c1c 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java @@ -97,10 +97,6 @@ public class FilterListFragment extends ListFragment { private View newListButton; - private boolean mDualFragments; - - private int mSelectedIndex; - /* ====================================================================== * ======================================================= initialization * ====================================================================== */ @@ -174,18 +170,7 @@ public class FilterListFragment extends ListFragment { AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); } }); - - AstridActivity activity = (AstridActivity) getActivity(); - if (activity.getFragmentLayout() > AstridActivity.LAYOUT_SINGLE) { - mDualFragments = true; - mSelectedIndex = activity.getIntent().getIntExtra(TOKEN_LAST_SELECTED, 0); - } - setUpList(); - - if (mDualFragments) { - getListView().setItemsCanFocus(false); - } } /* ====================================================================== @@ -247,8 +232,6 @@ public class FilterListFragment extends ListFragment { adapter.setListView(getListView()); setListAdapter(adapter); - adapter.setLastSelected(mSelectedIndex); - // Can't do context menus when list is in popup menu for some reason--workaround if (((AstridActivity) getActivity()).fragmentLayout == AstridActivity.LAYOUT_SINGLE) { getListView().setOnItemLongClickListener(new OnItemLongClickListener() { @@ -297,24 +280,15 @@ public class FilterListFragment extends ListFragment { @Override public void onListItemClick(ListView parent, View v, int position, long id) { - if (mDualFragments) - getListView().setItemChecked(position, true); Filter item = adapter.getItem(position); - setFilterItemSelected(item, position); - } - - private void setFilterItemSelected(Filter item, int position) { - mSelectedIndex = position; - adapter.setLastSelected(mSelectedIndex); - getActivity().getIntent().putExtra(TOKEN_LAST_SELECTED, mSelectedIndex); mListener.onFilterItemClicked(item); } public void switchToActiveTasks() { if (adapter.getCount() > 0) - setFilterItemSelected(adapter.getItem(0), 0); + mListener.onFilterItemClicked(adapter.getItem(0)); else - setFilterItemSelected(CoreFilterExposer.buildInboxFilter(getResources()), 0); + mListener.onFilterItemClicked(CoreFilterExposer.buildInboxFilter(getResources())); } @Override diff --git a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java index 1b2915a19..6b13a9b03 100644 --- a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java @@ -104,8 +104,6 @@ public class FilterAdapter extends ArrayAdapter { /** Pattern for matching filter counts in listing titles */ private final Pattern countPattern = Pattern.compile(".* \\((\\d+)\\)$"); //$NON-NLS-1$ - private int mSelectedIndex; - private final HashMap filterCounts; private FilterDataSourceChangedListener listener; @@ -222,10 +220,6 @@ public class FilterAdapter extends ArrayAdapter { to.listingIcon = from.listingIcon; } - public void setLastSelected(int lastSelected) { - mSelectedIndex = lastSelected; - } - public int adjustFilterCount(Filter filter, int delta) { int filterCount = 0; if (filterCounts.containsKey(filter)) { @@ -407,9 +401,6 @@ public class FilterAdapter extends ArrayAdapter { } } - if (mSelectedIndex < getCount()) { - listView.setItemChecked(mSelectedIndex, true); - } notifyDataSetChanged(); } }