mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Move story list loader to correct position. (#582)
This commit is contained in:
parent
d2b16b2897
commit
4489d9faf0
4 changed files with 37 additions and 17 deletions
|
@ -10,12 +10,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true" />
|
||||
|
||||
<com.newsblur.view.ProgressThrobber
|
||||
android:id="@+id/itemlist_topthrob"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="3dp"
|
||||
android:layout_alignParentTop="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemlist_sync_status"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
12
clients/android/NewsBlur/res/layout/row_loading_throbber.xml
Normal file
12
clients/android/NewsBlur/res/layout/row_loading_throbber.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<com.newsblur.view.ProgressThrobber
|
||||
android:id="@+id/itemlist_loading_throb"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="4dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -27,7 +27,6 @@ import com.newsblur.util.ReadFilterChangedListener;
|
|||
import com.newsblur.util.StateFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
import com.newsblur.util.StoryOrderChangedListener;
|
||||
import com.newsblur.view.ProgressThrobber;
|
||||
import com.newsblur.view.StateToggleButton.StateChangedListener;
|
||||
|
||||
public abstract class ItemsList extends NbActivity implements StateChangedListener, StoryOrderChangedListener, ReadFilterChangedListener, DefaultFeedViewChangedListener {
|
||||
|
@ -39,7 +38,6 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
public static final String BUNDLE_FEED_IDS = "feedIds";
|
||||
|
||||
protected ItemListFragment itemListFragment;
|
||||
protected ProgressThrobber progressView;
|
||||
protected FragmentManager fragmentManager;
|
||||
private TextView overlayStatusText;
|
||||
protected StateFilter currentState;
|
||||
|
@ -65,7 +63,6 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
this.overlayStatusText = (TextView) findViewById(R.id.itemlist_sync_status);
|
||||
this.progressView = (ProgressThrobber) findViewById(R.id.itemlist_topthrob);
|
||||
}
|
||||
|
||||
protected abstract FeedSet createFeedSet();
|
||||
|
@ -141,12 +138,8 @@ public abstract class ItemsList extends NbActivity implements StateChangedListen
|
|||
|
||||
private void updateStatusIndicators() {
|
||||
boolean isLoading = NBSyncService.isFeedSetSyncing(this.fs, this);
|
||||
if (progressView != null ) {
|
||||
if (isLoading) {
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
progressView.setVisibility(View.GONE);
|
||||
}
|
||||
if (itemListFragment != null) {
|
||||
itemListFragment.setLoading(isLoading);
|
||||
}
|
||||
|
||||
if (overlayStatusText != null) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.newsblur.util.FeedUtils;
|
|||
import com.newsblur.util.PrefsUtils;
|
||||
import com.newsblur.util.StateFilter;
|
||||
import com.newsblur.util.StoryOrder;
|
||||
import com.newsblur.view.ProgressThrobber;
|
||||
|
||||
public abstract class ItemListFragment extends NbFragment implements OnScrollListener, OnCreateContextMenuListener, LoaderManager.LoaderCallbacks<Cursor>, OnItemClickListener {
|
||||
|
||||
|
@ -48,6 +49,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
protected StateFilter currentState;
|
||||
private boolean cursorSeenYet = false;
|
||||
private boolean firstStorySeenYet = false;
|
||||
protected ProgressThrobber progressView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -61,8 +63,13 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_itemlist, null);
|
||||
itemList = (ListView) v.findViewById(R.id.itemlistfragment_list);
|
||||
View footerView = inflater.inflate(R.layout.row_loading_throbber, null);
|
||||
progressView = (ProgressThrobber) footerView.findViewById(R.id.itemlist_loading_throb);
|
||||
progressView.setColor(getResources().getColor(R.color.refresh_3));
|
||||
setupBezelSwipeDetector(itemList);
|
||||
itemList.setEmptyView(v.findViewById(R.id.empty_view));
|
||||
itemList.addFooterView(footerView, null, false);
|
||||
itemList.setFooterDividersEnabled(false);
|
||||
itemList.setOnScrollListener(this);
|
||||
itemList.setOnItemClickListener(this);
|
||||
itemList.setOnCreateContextMenuListener(this);
|
||||
|
@ -95,7 +102,21 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
firstStorySeenYet = false;
|
||||
}
|
||||
|
||||
private void updateLoadingIndicator() {
|
||||
/**
|
||||
* Turns on/off the loading indicator. Note that the text component of the
|
||||
* loading indicator requires a cursor and is handled below.
|
||||
*/
|
||||
public void setLoading(boolean isLoading) {
|
||||
if (progressView != null ) {
|
||||
if (isLoading) {
|
||||
progressView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
progressView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLoadingMessage() {
|
||||
View v = this.getView();
|
||||
if (v == null) return; // we might have beat construction?
|
||||
|
||||
|
@ -180,7 +201,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
|
|||
}
|
||||
adapter.swapCursor(cursor);
|
||||
}
|
||||
updateLoadingIndicator();
|
||||
updateLoadingMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue