Fix story sync status indication. (#644)

This commit is contained in:
dosiecki 2015-01-20 16:11:01 -08:00
parent d5d15e9c17
commit d8d091d1c7
4 changed files with 14 additions and 8 deletions

View file

@ -132,7 +132,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
}
private void updateStatusIndicators() {
boolean isLoading = NBSyncService.isFeedSetSyncing(this.fs);
boolean isLoading = NBSyncService.isFeedSetSyncing(this.fs, this);
setProgressBarIndeterminateVisibility(isLoading);
if (overlayStatusText != null) {

View file

@ -318,7 +318,7 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
@Override
protected void handleUpdate(boolean freshData) {
enableMainProgress(NBSyncService.isFeedSetSyncing(this.fs));
enableMainProgress(NBSyncService.isFeedSetSyncing(this.fs, this));
updateOverlayNav();
if (freshData) updateCursor();
}

View file

@ -106,7 +106,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
}
TextView emptyView = (TextView) itemList.getEmptyView();
boolean isLoading = NBSyncService.isFeedSetSyncing(getFeedSet());
boolean isLoading = NBSyncService.isFeedSetSyncing(getFeedSet(), activity);
if (isLoading || (!cursorSeenYet)) {
emptyView.setText(R.string.empty_list_view_loading);
} else {

View file

@ -3,6 +3,7 @@ package com.newsblur.service;
import android.app.Service;
import android.content.ComponentCallbacks2;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.IBinder;
@ -564,15 +565,20 @@ public class NBSyncService extends Service {
}
}
boolean stopSync() {
static boolean stopSync(Context context) {
if (HaltNow) {
if (AppConstants.VERBOSE_LOG) Log.d(this.getClass().getName(), "stopping sync, soft interrupt set.");
if (AppConstants.VERBOSE_LOG) Log.d(NBSyncService.class.getName(), "stopping sync, soft interrupt set.");
return true;
}
if (!NetworkUtils.isOnline(this)) return true;
if (context == null) return false;
if (!NetworkUtils.isOnline(context)) return true;
return false;
}
boolean stopSync() {
return stopSync(this);
}
public void onTrimMemory (int level) {
if (level > ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
isMemoryLow = true;
@ -595,8 +601,8 @@ public class NBSyncService extends Service {
/**
* Is there a sync for a given FeedSet running?
*/
public static boolean isFeedSetSyncing(FeedSet fs) {
return (fs.equals(PendingFeed));
public static boolean isFeedSetSyncing(FeedSet fs, Context context) {
return (fs.equals(PendingFeed) && (!stopSync(context)));
}
public static String getSyncStatusMessage() {