mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Status overlay for story list.
This commit is contained in:
parent
1cfef7f30f
commit
346d34c777
2 changed files with 33 additions and 1 deletions
|
@ -10,4 +10,16 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemlist_sync_status"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:padding="3dp"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/status_overlay_text"
|
||||
android:background="@color/status_overlay_background"
|
||||
android:text="SYNC STATUS" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -6,7 +6,9 @@ import android.app.FragmentManager;
|
|||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.fragment.DefaultFeedViewDialogFragment;
|
||||
|
@ -38,6 +40,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
|
||||
protected ItemListFragment itemListFragment;
|
||||
protected FragmentManager fragmentManager;
|
||||
private TextView overlayStatusText;
|
||||
protected int currentState;
|
||||
|
||||
private FeedSet fs;
|
||||
|
@ -60,6 +63,8 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
currentState = getIntent().getIntExtra(EXTRA_STATE, 0);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
this.overlayStatusText = (TextView) findViewById(R.id.itemlist_sync_status);
|
||||
|
||||
getFirstStories();
|
||||
}
|
||||
|
||||
|
@ -72,6 +77,7 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateStatusIndicators();
|
||||
stopLoading = false;
|
||||
// this view shows stories, it is not safe to perform cleanup
|
||||
NBSyncService.holdStories(true);
|
||||
|
@ -148,13 +154,27 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
|
||||
@Override
|
||||
public void handleUpdate() {
|
||||
setProgressBarIndeterminateVisibility(NBSyncService.isFeedSetSyncing(this.fs));
|
||||
updateStatusIndicators();
|
||||
if (itemListFragment != null) {
|
||||
itemListFragment.syncDone();
|
||||
itemListFragment.hasUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatusIndicators() {
|
||||
setProgressBarIndeterminateVisibility(NBSyncService.isFeedSetSyncing(this.fs));
|
||||
|
||||
if (overlayStatusText != null) {
|
||||
String syncStatus = NBSyncService.getSyncStatusMessage();
|
||||
if (syncStatus != null) {
|
||||
overlayStatusText.setText(syncStatus);
|
||||
overlayStatusText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
overlayStatusText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedState(int state) {
|
||||
itemListFragment.changeState(state);
|
||||
|
|
Loading…
Add table
Reference in a new issue