mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge pull request #355 from manderson23/master
Android: Fix blurblogs for oldest/unread
This commit is contained in:
commit
0eed89f985
5 changed files with 18 additions and 24 deletions
|
@ -72,6 +72,8 @@ public class AllSharedStoriesItemsList extends ItemsList {
|
|||
feedIds.toArray(feeds);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_MULTIFEED_IDS, feeds);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||
intent.putExtra(SyncService.EXTRA_TASK_ORDER, getStoryOrder());
|
||||
intent.putExtra(SyncService.EXTRA_TASK_READ_FILTER, PrefsUtils.getReadFilterForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME));
|
||||
|
||||
startService(intent);
|
||||
}
|
||||
|
|
|
@ -87,6 +87,8 @@ public class AllSharedStoriesReading extends Reading {
|
|||
if (page > 1) {
|
||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||
}
|
||||
intent.putExtra(SyncService.EXTRA_TASK_ORDER, PrefsUtils.getStoryOrderForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME));
|
||||
intent.putExtra(SyncService.EXTRA_TASK_READ_FILTER, PrefsUtils.getReadFilterForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME));
|
||||
|
||||
startService(intent);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.newsblur.fragment.SyncUpdateFragment;
|
|||
import com.newsblur.network.APIManager;
|
||||
import com.newsblur.network.MarkSocialFeedAsReadTask;
|
||||
import com.newsblur.service.SyncService;
|
||||
import com.newsblur.util.PrefConstants;
|
||||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.ReadFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
|
@ -77,6 +76,8 @@ public class SocialFeedItemsList extends ItemsList {
|
|||
intent.putExtra(SyncService.EXTRA_TASK_SOCIALFEED_ID, userId);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||
intent.putExtra(SyncService.EXTRA_TASK_SOCIALFEED_USERNAME, username);
|
||||
intent.putExtra(SyncService.EXTRA_TASK_ORDER, getStoryOrder());
|
||||
intent.putExtra(SyncService.EXTRA_TASK_READ_FILTER, PrefsUtils.getReadFilterForFeed(this, userId));
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
|
@ -103,21 +104,21 @@ public class SocialFeedItemsList extends ItemsList {
|
|||
|
||||
@Override
|
||||
protected StoryOrder getStoryOrder() {
|
||||
return PrefsUtils.getStoryOrderForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME);
|
||||
return PrefsUtils.getStoryOrderForFeed(this, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStoryOrderPreference(StoryOrder newValue) {
|
||||
PrefsUtils.setStoryOrderForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME, newValue);
|
||||
PrefsUtils.setStoryOrderForFeed(this, userId, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateReadFilterPreference(ReadFilter newValue) {
|
||||
PrefsUtils.setReadFilterForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME, newValue);
|
||||
PrefsUtils.setReadFilterForFeed(this, userId, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReadFilter getReadFilter() {
|
||||
return PrefsUtils.getReadFilterForFolder(this, PrefConstants.ALL_SHARED_STORIES_FOLDER_NAME);
|
||||
return PrefsUtils.getReadFilterForFeed(this, userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.net.URL;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -17,7 +15,6 @@ import android.content.ContentResolver;
|
|||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -26,16 +23,12 @@ import android.webkit.CookieSyncManager;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.domain.Classifier;
|
||||
import com.newsblur.domain.Comment;
|
||||
import com.newsblur.domain.Feed;
|
||||
import com.newsblur.domain.FeedResult;
|
||||
import com.newsblur.domain.Folder;
|
||||
import com.newsblur.domain.Reply;
|
||||
import com.newsblur.domain.SocialFeed;
|
||||
import com.newsblur.domain.Story;
|
||||
|
@ -293,7 +286,7 @@ public class APIManager {
|
|||
}
|
||||
}
|
||||
|
||||
public SocialFeedResponse getSharedStoriesForFeeds(String[] feedIds, String pageNumber) {
|
||||
public SocialFeedResponse getSharedStoriesForFeeds(String[] feedIds, String pageNumber, StoryOrder order, ReadFilter filter) {
|
||||
final ValueMultimap values = new ValueMultimap();
|
||||
for (String feedId : feedIds) {
|
||||
values.put(APIConstants.PARAMETER_FEEDS, feedId);
|
||||
|
@ -301,6 +294,8 @@ public class APIManager {
|
|||
if (!TextUtils.isEmpty(pageNumber)) {
|
||||
values.put(APIConstants.PARAMETER_PAGE_NUMBER, "" + pageNumber);
|
||||
}
|
||||
values.put(APIConstants.PARAMETER_ORDER, order.getParameterValue());
|
||||
values.put(APIConstants.PARAMETER_READ_FILTER, filter.getParameterValue());
|
||||
|
||||
final APIResponse response = get(APIConstants.URL_SHARED_RIVER_STORIES, values);
|
||||
SocialFeedResponse storiesResponse = (SocialFeedResponse) response.getResponse(gson, SocialFeedResponse.class);
|
||||
|
@ -340,10 +335,12 @@ public class APIManager {
|
|||
}
|
||||
}
|
||||
|
||||
public SocialFeedResponse getStoriesForSocialFeed(String userId, String username, String pageNumber) {
|
||||
public SocialFeedResponse getStoriesForSocialFeed(String userId, String username, String pageNumber, StoryOrder order, ReadFilter filter) {
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(APIConstants.PARAMETER_USER_ID, userId);
|
||||
values.put(APIConstants.PARAMETER_USERNAME, username);
|
||||
values.put(APIConstants.PARAMETER_ORDER, order.getParameterValue());
|
||||
values.put(APIConstants.PARAMETER_READ_FILTER, filter.getParameterValue());
|
||||
if (!TextUtils.isEmpty(pageNumber)) {
|
||||
values.put(APIConstants.PARAMETER_PAGE_NUMBER, "" + pageNumber);
|
||||
}
|
||||
|
@ -801,10 +798,6 @@ public class APIManager {
|
|||
return this.post(urlString, parameterString);
|
||||
}
|
||||
|
||||
private APIResponse post(final String urlString, final ValueMultimap valueMap) {
|
||||
return post(urlString, valueMap, true);
|
||||
}
|
||||
|
||||
private APIResponse post(final String urlString, final ValueMultimap valueMap, boolean jsonIfy) {
|
||||
String parameterString = jsonIfy ? valueMap.getJsonString() : valueMap.getParameterString();
|
||||
return this.post(urlString, parameterString);
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.newsblur.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
|
@ -15,7 +12,6 @@ import android.util.Log;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.domain.ValueMultimap;
|
||||
import com.newsblur.network.APIConstants;
|
||||
|
@ -162,7 +158,7 @@ public class SyncService extends IntentService {
|
|||
|
||||
case EXTRA_TASK_MULTISOCIALFEED_UPDATE:
|
||||
if (intent.getStringArrayExtra(EXTRA_TASK_MULTIFEED_IDS) != null) {
|
||||
SocialFeedResponse sharedStoriesForFeeds = apiManager.getSharedStoriesForFeeds(intent.getStringArrayExtra(EXTRA_TASK_MULTIFEED_IDS), intent.getStringExtra(EXTRA_TASK_PAGE_NUMBER));
|
||||
SocialFeedResponse sharedStoriesForFeeds = apiManager.getSharedStoriesForFeeds(intent.getStringArrayExtra(EXTRA_TASK_MULTIFEED_IDS), intent.getStringExtra(EXTRA_TASK_PAGE_NUMBER), (StoryOrder) intent.getSerializableExtra(EXTRA_TASK_ORDER), (ReadFilter) intent.getSerializableExtra(EXTRA_TASK_READ_FILTER));
|
||||
if (sharedStoriesForFeeds != null && sharedStoriesForFeeds.stories.length != 0) {
|
||||
receiver.send(STATUS_FINISHED, null);
|
||||
} else {
|
||||
|
@ -204,7 +200,7 @@ public class SyncService extends IntentService {
|
|||
|
||||
case EXTRA_TASK_SOCIALFEED_UPDATE:
|
||||
if (!TextUtils.isEmpty(intent.getStringExtra(EXTRA_TASK_SOCIALFEED_ID)) && !TextUtils.isEmpty(intent.getStringExtra(EXTRA_TASK_SOCIALFEED_USERNAME))) {
|
||||
SocialFeedResponse storiesForSocialFeed = apiManager.getStoriesForSocialFeed(intent.getStringExtra(EXTRA_TASK_SOCIALFEED_ID), intent.getStringExtra(EXTRA_TASK_SOCIALFEED_USERNAME), intent.getStringExtra(EXTRA_TASK_PAGE_NUMBER));
|
||||
SocialFeedResponse storiesForSocialFeed = apiManager.getStoriesForSocialFeed(intent.getStringExtra(EXTRA_TASK_SOCIALFEED_ID), intent.getStringExtra(EXTRA_TASK_SOCIALFEED_USERNAME), intent.getStringExtra(EXTRA_TASK_PAGE_NUMBER), (StoryOrder) intent.getSerializableExtra(EXTRA_TASK_ORDER), (ReadFilter) intent.getSerializableExtra(EXTRA_TASK_READ_FILTER));
|
||||
if (storiesForSocialFeed != null && storiesForSocialFeed.stories.length != 0) {
|
||||
receiver.send(STATUS_FINISHED, null);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue