mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fix re-use of folder list on rotation.
This commit is contained in:
parent
492f24dd53
commit
337926f986
1 changed files with 6 additions and 3 deletions
|
@ -285,12 +285,14 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
||||||
socialFeedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.SOCIAL_FEED_NEUTRAL_COUNT), R.id.row_socialsumneu);
|
socialFeedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.SOCIAL_FEED_NEUTRAL_COUNT), R.id.row_socialsumneu);
|
||||||
socialFeedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.SOCIAL_FEED_POSITIVE_COUNT), R.id.row_socialsumpos);
|
socialFeedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.SOCIAL_FEED_POSITIVE_COUNT), R.id.row_socialsumpos);
|
||||||
}
|
}
|
||||||
recountFeeds();
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFolderFeedMapCursor(Cursor cursor) {
|
public synchronized void setFolderFeedMapCursor(Cursor cursor) {
|
||||||
|
if (cursor.getCount() < 1) return;
|
||||||
this.folderFeedMap = new TreeMap<String,List<String>>();
|
this.folderFeedMap = new TreeMap<String,List<String>>();
|
||||||
|
// some newer frameworks like to re-use cursors, so we cannot assume a starting index
|
||||||
|
cursor.moveToPosition(-1);
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
String folderName = getStr(cursor, DatabaseConstants.FEED_FOLDER_FOLDER_NAME);
|
String folderName = getStr(cursor, DatabaseConstants.FEED_FOLDER_FOLDER_NAME);
|
||||||
String feedId = getStr(cursor, DatabaseConstants.FEED_FOLDER_FEED_ID);
|
String feedId = getStr(cursor, DatabaseConstants.FEED_FOLDER_FEED_ID);
|
||||||
|
@ -301,7 +303,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFeedCursor(Cursor cursor) {
|
public synchronized void setFeedCursor(Cursor cursor) {
|
||||||
this.feedCursor = cursor;
|
this.feedCursor = cursor;
|
||||||
if (feedColumnMap == null) {
|
if (feedColumnMap == null) {
|
||||||
feedColumnMap = new HashMap<Integer,Integer>();
|
feedColumnMap = new HashMap<Integer,Integer>();
|
||||||
|
@ -310,6 +312,7 @@ public class FolderListAdapter extends BaseExpandableListAdapter {
|
||||||
feedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.FEED_NEUTRAL_COUNT), R.id.row_feedneutral);
|
feedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.FEED_NEUTRAL_COUNT), R.id.row_feedneutral);
|
||||||
feedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.FEED_POSITIVE_COUNT), R.id.row_feedpositive);
|
feedColumnMap.put(cursor.getColumnIndexOrThrow(DatabaseConstants.FEED_POSITIVE_COUNT), R.id.row_feedpositive);
|
||||||
}
|
}
|
||||||
|
recountFeeds();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue