Removed dead code, fixed a display bug when scrolling the filter list

pull/14/head
Sam Bosley 12 years ago
parent 37a9f88a7c
commit 330e52837c

@ -97,10 +97,6 @@ public class FilterListFragment extends ListFragment {
private View newListButton; private View newListButton;
private boolean mDualFragments;
private int mSelectedIndex;
/* ====================================================================== /* ======================================================================
* ======================================================= initialization * ======================================================= initialization
* ====================================================================== */ * ====================================================================== */
@ -174,18 +170,7 @@ public class FilterListFragment extends ListFragment {
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); 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(); setUpList();
if (mDualFragments) {
getListView().setItemsCanFocus(false);
}
} }
/* ====================================================================== /* ======================================================================
@ -247,8 +232,6 @@ public class FilterListFragment extends ListFragment {
adapter.setListView(getListView()); adapter.setListView(getListView());
setListAdapter(adapter); setListAdapter(adapter);
adapter.setLastSelected(mSelectedIndex);
// Can't do context menus when list is in popup menu for some reason--workaround // Can't do context menus when list is in popup menu for some reason--workaround
if (((AstridActivity) getActivity()).fragmentLayout == AstridActivity.LAYOUT_SINGLE) { if (((AstridActivity) getActivity()).fragmentLayout == AstridActivity.LAYOUT_SINGLE) {
getListView().setOnItemLongClickListener(new OnItemLongClickListener() { getListView().setOnItemLongClickListener(new OnItemLongClickListener() {
@ -297,24 +280,15 @@ public class FilterListFragment extends ListFragment {
@Override @Override
public void onListItemClick(ListView parent, View v, int position, long id) { public void onListItemClick(ListView parent, View v, int position, long id) {
if (mDualFragments)
getListView().setItemChecked(position, true);
Filter item = adapter.getItem(position); 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); mListener.onFilterItemClicked(item);
} }
public void switchToActiveTasks() { public void switchToActiveTasks() {
if (adapter.getCount() > 0) if (adapter.getCount() > 0)
setFilterItemSelected(adapter.getItem(0), 0); mListener.onFilterItemClicked(adapter.getItem(0));
else else
setFilterItemSelected(CoreFilterExposer.buildInboxFilter(getResources()), 0); mListener.onFilterItemClicked(CoreFilterExposer.buildInboxFilter(getResources()));
} }
@Override @Override

@ -104,8 +104,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
/** Pattern for matching filter counts in listing titles */ /** Pattern for matching filter counts in listing titles */
private final Pattern countPattern = Pattern.compile(".* \\((\\d+)\\)$"); //$NON-NLS-1$ private final Pattern countPattern = Pattern.compile(".* \\((\\d+)\\)$"); //$NON-NLS-1$
private int mSelectedIndex;
private final HashMap<Filter, Integer> filterCounts; private final HashMap<Filter, Integer> filterCounts;
private FilterDataSourceChangedListener listener; private FilterDataSourceChangedListener listener;
@ -222,10 +220,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
to.listingIcon = from.listingIcon; to.listingIcon = from.listingIcon;
} }
public void setLastSelected(int lastSelected) {
mSelectedIndex = lastSelected;
}
public int adjustFilterCount(Filter filter, int delta) { public int adjustFilterCount(Filter filter, int delta) {
int filterCount = 0; int filterCount = 0;
if (filterCounts.containsKey(filter)) { if (filterCounts.containsKey(filter)) {
@ -407,9 +401,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
} }
} }
if (mSelectedIndex < getCount()) {
listView.setItemChecked(mSelectedIndex, true);
}
notifyDataSetChanged(); notifyDataSetChanged();
} }
} }

Loading…
Cancel
Save