Merge branch 'master' into queue

# By Samuel Clay (2) and Lance Johnson (1)
# Via Lance Johnson (2) and Samuel Clay (2)
* master:
  Adding feed id to feed selector.
  Giving error on empty mark read endpoint.
  Fix duplicate feed listing bug and fix issus with remembering folder collapse/expande perferences in main feed list view
This commit is contained in:
Samuel Clay 2013-04-03 15:25:22 -07:00
commit 9d7aeb1a51
4 changed files with 31 additions and 13 deletions

View file

@ -900,6 +900,11 @@ def mark_feed_stories_as_read(request):
r = redis.Redis(connection_pool=settings.REDIS_POOL)
feeds_stories = request.REQUEST.get('feeds_stories', "{}")
feeds_stories = json.decode(feeds_stories)
data = {
'code': -1,
'message': 'Nothing was marked as read'
}
for feed_id, story_ids in feeds_stories.items():
feed_id = int(feed_id)
try:

View file

@ -26,7 +26,6 @@ import com.newsblur.activity.AllStoriesItemsList;
import com.newsblur.domain.Folder;
import com.newsblur.util.AppConstants;
@SuppressWarnings("deprecation")
public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
private Handler mHandler;
@ -173,13 +172,12 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
}
}
@Override
public long getChildId(int groupPosition, int childPosition) {
if (groupPosition == 0) {
return blogCursorHelper.getId(childPosition);
} else {
groupPosition = groupPosition - 2;
return getChildrenCursorHelper(groupPosition, true).getId(childPosition);
MyCursorHelper childrenCursorHelper = getChildrenCursorHelper(groupPosition - 2, true);
return childrenCursorHelper.getId(childPosition);
}
}
@ -251,9 +249,22 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
@Override
public long getGroupId(int groupPosition) {
if (groupPosition >= 2) {
return folderCursorHelper.getId(groupPosition);
return folderCursorHelper.getId(groupPosition-2);
} else {
return groupPosition;
return Long.MAX_VALUE - groupPosition;
}
}
public String getGroupName(int groupPosition) {
if (groupPosition == 0) {
return "[ALL_SHARED_STORIES]";
} else if(groupPosition == 1) {
return "[ALL_STORIES]";
} else {
Cursor cursor = folderCursorHelper.getCursor();
cursor.moveToPosition(groupPosition-2);
// Is folder name really always unique?
return cursor.getString(cursor.getColumnIndex("folder_name"));
}
}

View file

@ -127,8 +127,8 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener
sharedPreferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
}
for (int i = 0; i < folderAdapter.getGroupCount(); i++) {
long groupId = folderAdapter.getGroupId(i);
if (sharedPreferences.getBoolean(AppConstants.FOLDER_PRE + groupId, true)) {
String groupName = folderAdapter.getGroupName(i);
if (sharedPreferences.getBoolean(AppConstants.FOLDER_PRE + "_" + groupName, true)) {
list.expandGroup(i);
} else {
list.collapseGroup(i);
@ -278,19 +278,21 @@ public class FolderListFragment extends Fragment implements OnGroupClickListener
folderAdapter.setBlogCursor(blogCursor);
folderAdapter.setGroupCursor(cursor);
folderAdapter.setCountCursor(countCursor);
folderAdapter.notifyDataSetChanged();
folderAdapter.notifyDataSetChanged();
checkOpenFolderPreferences();
}
@Override
public boolean onGroupClick(ExpandableListView list, View group, int groupPosition, long id) {
if (folderAdapter.isExpandable(groupPosition)) {
long groupId = folderAdapter.getGroupId(groupPosition);
String groupName = folderAdapter.getGroupName(groupPosition);
if (list.isGroupExpanded(groupPosition)) {
group.findViewById(R.id.row_foldersums).setVisibility(View.VISIBLE);
sharedPreferences.edit().putBoolean(AppConstants.FOLDER_PRE + groupId, false).commit();
sharedPreferences.edit().putBoolean(AppConstants.FOLDER_PRE + "_" + groupName, false).commit();
} else {
group.findViewById(R.id.row_foldersums).setVisibility(View.INVISIBLE);
sharedPreferences.edit().putBoolean(AppConstants.FOLDER_PRE + groupId, true).commit();
sharedPreferences.edit().putBoolean(AppConstants.FOLDER_PRE + "_" + groupName, true).commit();
}
return false;
} else {

View file

@ -69,7 +69,7 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
});
var feeds = NEWSBLUR.assets.feeds.filter(function(feed){
return _.string.contains(feed.get('feed_title').toLowerCase(), input);
return _.string.contains(feed.get('feed_title').toLowerCase(), input) || feed.id == input;
});
var socialsubs = NEWSBLUR.assets.social_feeds.filter(function(feed){
return _.string.contains(feed.get('feed_title').toLowerCase(), input) ||