Fixed issue whereby social items would not be reloaded upon reading due to feedId not being a unique row name in the DB.

This commit is contained in:
RyanBateman 2012-08-09 17:16:53 -04:00
parent 35fadd13bd
commit 64166b6dfe
4 changed files with 18 additions and 7 deletions

View file

@ -269,7 +269,10 @@ public class FeedProvider extends ContentProvider {
case INDIVIDUAL_SOCIALFEED:
String[] userArgument = new String[] { uri.getLastPathSegment() };
String userQuery = "SELECT " + TextUtils.join(",", DatabaseConstants.STORY_COLUMNS) + ", " + TextUtils.join(",", DatabaseConstants.FEED_COLUMNS) + " FROM " + DatabaseConstants.SOCIALFEED_STORY_MAP_TABLE +
String userQuery = "SELECT " + TextUtils.join(",", DatabaseConstants.STORY_COLUMNS) + ", " + DatabaseConstants.FEED_TITLE + ", " +
DatabaseConstants.FEED_FAVICON_URL + ", " + DatabaseConstants.FEED_FAVICON_COLOUR + ", " + DatabaseConstants.FEED_FAVICON_BORDER + ", " +
DatabaseConstants.FEED_FAVICON_FADE +
" FROM " + DatabaseConstants.SOCIALFEED_STORY_MAP_TABLE +
" INNER JOIN " + DatabaseConstants.STORY_TABLE +
" ON " + DatabaseConstants.STORY_TABLE + "." + DatabaseConstants.STORY_ID + " = " + DatabaseConstants.SOCIALFEED_STORY_MAP_TABLE + "." + DatabaseConstants.SOCIALFEED_STORY_STORYID +
" INNER JOIN " + DatabaseConstants.FEED_TABLE +

View file

@ -5,6 +5,7 @@ import android.content.ContentValues;
import android.net.Uri;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
import com.newsblur.domain.Story;
@ -44,7 +45,8 @@ public class MarkStoryAsReadIntenallyTask extends AsyncTask<Story, Void, Void>{
Uri storyUri = FeedProvider.STORY_URI.buildUpon().appendPath(story.id).build();
ContentValues values = new ContentValues();
values.put(DatabaseConstants.STORY_READ, true);
contentResolver.update(storyUri, values, null, null);
int updated = contentResolver.update(storyUri, values, null, null);
Log.d("TAG", "Updated: " + updated + " stories");
}
return null;

View file

@ -23,6 +23,17 @@ public class SocialFeedItemsAdapter extends SimpleCursorAdapter {
this.context = context;
this.cursor = c;
}
@Override
public int getCount() {
return cursor.getCount();
}
@Override
public Cursor swapCursor(Cursor c) {
this.cursor = c;
return super.swapCursor(c);
}
@Override
public View getView(int position, View view, ViewGroup viewGroup) {

View file

@ -2,17 +2,12 @@ package com.newsblur.view;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.newsblur.R;
import com.newsblur.activity.NewsBlurApplication;
import com.newsblur.database.DatabaseConstants;
import com.newsblur.util.AppConstants;