Revert "Persist scroll position in Queue view"

This commit is contained in:
Tom Hennen 2015-03-03 18:00:16 -05:00
parent fa87433e59
commit 36abac1318
1 changed files with 1 additions and 22 deletions

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -65,10 +65,6 @@ public class QueueFragment extends Fragment {
private boolean viewsCreated = false; private boolean viewsCreated = false;
private boolean isUpdatingFeeds = false; private boolean isUpdatingFeeds = false;
private static final String PREFS = "QueueFragment";
private static final String PREF_KEY_LIST_TOP = "list_top";
private static final String PREF_KEY_LIST_SELECTION = "list_selection";
private AtomicReference<Activity> activity = new AtomicReference<Activity>(); private AtomicReference<Activity> activity = new AtomicReference<Activity>();
private DownloadObserver downloadObserver = null; private DownloadObserver downloadObserver = null;
@ -106,18 +102,6 @@ public class QueueFragment extends Fragment {
} }
} }
@Override
public void onPause() {
super.onPause();
SharedPreferences prefs = getActivity().getSharedPreferences(PREFS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
View v = listView.getChildAt(0);
int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
editor.putInt(PREF_KEY_LIST_SELECTION, listView.getFirstVisiblePosition());
editor.putInt(PREF_KEY_LIST_TOP, top);
editor.commit();
}
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
@ -329,11 +313,6 @@ public class QueueFragment extends Fragment {
} }
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
SharedPreferences prefs = getActivity().getSharedPreferences(PREFS, Context.MODE_PRIVATE);
int listSelection = prefs.getInt(PREF_KEY_LIST_SELECTION, 0);
int top = prefs.getInt(PREF_KEY_LIST_TOP, 0);
listView.setSelectionFromTop(listSelection, top);
// we need to refresh the options menu because it sometimes // we need to refresh the options menu because it sometimes
// needs data that may have just been loaded. // needs data that may have just been loaded.
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();