mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixed issue whereby when reading in feedReading, older pages would deleted due to passed parameter
This commit is contained in:
parent
28f55ed04d
commit
bebeef24cf
2 changed files with 27 additions and 43 deletions
|
@ -26,6 +26,7 @@ public class AllStoriesReading extends Reading {
|
||||||
private int currentPage;
|
private int currentPage;
|
||||||
private ArrayList<String> feedIds;
|
private ArrayList<String> feedIds;
|
||||||
private boolean stopLoading = false;
|
private boolean stopLoading = false;
|
||||||
|
private boolean requestedPage = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceBundle) {
|
protected void onCreate(Bundle savedInstanceBundle) {
|
||||||
|
@ -82,27 +83,12 @@ public class AllStoriesReading extends Reading {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkStoryCount(int position) {
|
public void checkStoryCount(int position) {
|
||||||
if (position == stories.getCount() - 1) {
|
if (position == stories.getCount() - 1 && !stopLoading && !requestedPage) {
|
||||||
boolean loadMore = false;
|
requestedPage = true;
|
||||||
|
currentPage += 1;
|
||||||
switch (currentState) {
|
triggerRefresh(currentPage);
|
||||||
case AppConstants.STATE_ALL:
|
} else {
|
||||||
loadMore = positiveCount + neutralCount + negativeCount > stories.getCount();
|
Log.d(TAG, "No need");
|
||||||
break;
|
|
||||||
case AppConstants.STATE_BEST:
|
|
||||||
loadMore = positiveCount > stories.getCount();
|
|
||||||
break;
|
|
||||||
case AppConstants.STATE_SOME:
|
|
||||||
loadMore = positiveCount + neutralCount > stories.getCount();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadMore) {
|
|
||||||
currentPage += 1;
|
|
||||||
triggerRefresh(currentPage);
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "No need");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +115,7 @@ public class AllStoriesReading extends Reading {
|
||||||
public void updateAfterSync() {
|
public void updateAfterSync() {
|
||||||
setSupportProgressBarIndeterminateVisibility(false);
|
setSupportProgressBarIndeterminateVisibility(false);
|
||||||
stories.requery();
|
stories.requery();
|
||||||
|
requestedPage = false;
|
||||||
readingAdapter.notifyDataSetChanged();
|
readingAdapter.notifyDataSetChanged();
|
||||||
checkStoryCount(pager.getCurrentItem());
|
checkStoryCount(pager.getCurrentItem());
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class FeedReading extends Reading {
|
||||||
private Feed feed;
|
private Feed feed;
|
||||||
private int currentPage;
|
private int currentPage;
|
||||||
private boolean stopLoading = false;
|
private boolean stopLoading = false;
|
||||||
|
private boolean requestedPage = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceBundle) {
|
protected void onCreate(Bundle savedInstanceBundle) {
|
||||||
|
@ -77,30 +78,24 @@ public class FeedReading extends Reading {
|
||||||
checkStoryCount(position);
|
checkStoryCount(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAfterSync() {
|
||||||
|
setSupportProgressBarIndeterminateVisibility(false);
|
||||||
|
stories.requery();
|
||||||
|
requestedPage = false;
|
||||||
|
readingAdapter.notifyDataSetChanged();
|
||||||
|
checkStoryCount(pager.getCurrentItem());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkStoryCount(int position) {
|
public void checkStoryCount(int position) {
|
||||||
if (position == stories.getCount() - 1) {
|
if (position == stories.getCount() - 1 && !stopLoading && !requestedPage) {
|
||||||
boolean loadMore = false;
|
requestedPage = true;
|
||||||
|
currentPage += 1;
|
||||||
switch (currentState) {
|
triggerRefresh(currentPage);
|
||||||
case AppConstants.STATE_ALL:
|
} else {
|
||||||
loadMore = feed.positiveCount + feed.neutralCount + feed.negativeCount > stories.getCount();
|
Log.d(TAG, "No need");
|
||||||
break;
|
|
||||||
case AppConstants.STATE_BEST:
|
|
||||||
loadMore = feed.positiveCount > stories.getCount();
|
|
||||||
break;
|
|
||||||
case AppConstants.STATE_SOME:
|
|
||||||
loadMore = feed.positiveCount + feed.neutralCount > stories.getCount();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadMore) {
|
|
||||||
currentPage += 1;
|
|
||||||
triggerRefresh(currentPage);
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "No need");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +119,10 @@ public class FeedReading extends Reading {
|
||||||
final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
|
final Intent intent = new Intent(Intent.ACTION_SYNC, null, this, SyncService.class);
|
||||||
intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, syncFragment.receiver);
|
intent.putExtra(SyncService.EXTRA_STATUS_RECEIVER, syncFragment.receiver);
|
||||||
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_FEED_UPDATE);
|
intent.putExtra(SyncService.SYNCSERVICE_TASK, SyncService.EXTRA_TASK_FEED_UPDATE);
|
||||||
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
|
||||||
intent.putExtra(SyncService.EXTRA_TASK_FEED_ID, feedId);
|
intent.putExtra(SyncService.EXTRA_TASK_FEED_ID, feedId);
|
||||||
|
if (page > 1) {
|
||||||
|
intent.putExtra(SyncService.EXTRA_TASK_PAGE_NUMBER, Integer.toString(page));
|
||||||
|
}
|
||||||
startService(intent);
|
startService(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue