Fix laggy updates for saved stories unsave ops.

This commit is contained in:
ojiikun 2013-11-17 06:18:00 +00:00
parent 4acddfdf0c
commit 873d6fbacc
3 changed files with 5 additions and 4 deletions

View file

@ -9,7 +9,6 @@ import android.view.ViewGroup;
import com.newsblur.domain.Story;
import com.newsblur.fragment.LoadingFragment;
import com.newsblur.fragment.ReadingItemFragment;
public abstract class ReadingAdapter extends FragmentStatePagerAdapter {

View file

@ -603,8 +603,11 @@ public class FeedProvider extends ContentProvider {
case SOCIALFEED_STORIES:
return db.update(DatabaseConstants.SOCIALFEED_TABLE, values, DatabaseConstants.FEED_ID + " = ?", new String[] { uri.getLastPathSegment() });
case INDIVIDUAL_STORY:
return db.update(DatabaseConstants.STORY_TABLE, values, DatabaseConstants.STORY_ID + " = ?", new String[] { uri.getLastPathSegment() });
// In order to run a raw SQL query whereby we make decrement the column we need to a dynamic reference - something the usual content provider can't easily handle. Hence this circuitous hack.
int count = 0;
count += db.update(DatabaseConstants.STORY_TABLE, values, DatabaseConstants.STORY_ID + " = ?", new String[] { uri.getLastPathSegment() });
count += db.update(DatabaseConstants.STARRED_STORIES_TABLE, values, DatabaseConstants.STORY_ID + " = ?", new String[] { uri.getLastPathSegment() });
return count;
// In order to run a raw SQL query whereby we make decrement the column we need to a dynamic reference - something the usual content provider can't easily handle. Hence this circuitous hack.
case FEED_COUNT:
db.execSQL("UPDATE " + DatabaseConstants.FEED_TABLE + " SET " + selectionArgs[0] + " = " + selectionArgs[0] + " - 1 WHERE " + DatabaseConstants.FEED_ID + " = " + selectionArgs[1]);
return 0;

View file

@ -14,7 +14,6 @@ import com.newsblur.fragment.ReadingItemFragment;
public class MixedFeedsReadingAdapter extends ReadingAdapter {
private String TAG = "FeedReadingAdapter";
private LoadingFragment loadingFragment;
private final ContentResolver resolver;