use setemptyview on online lists

This commit is contained in:
Andrew Dolgov 2011-12-06 12:37:46 +03:00
parent d8da03554f
commit 815e40a698
5 changed files with 15 additions and 11 deletions

View File

@ -8,9 +8,9 @@
</LinearLayout>
<ListView android:id="@+id/feeds" android:layout_height="match_parent" android:layout_width="match_parent"></ListView>
<TextView android:id="@+id/no_unread_feeds"
<TextView android:id="@+id/no_feeds"
android:visibility="invisible"
android:layout_gravity="center" android:color="#909090"
android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_unread_feeds"></TextView>
android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_feeds"></TextView>
</FrameLayout>

View File

@ -11,6 +11,6 @@
<TextView android:id="@+id/no_headlines"
android:visibility="invisible"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_unread_headlines"></TextView>
android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_headlines"></TextView>
</FrameLayout>

View File

@ -26,8 +26,8 @@
<string name="headline_context_multiple">Selected articles</string>
<string name="http_authentication">HTTP Authentication</string>
<string name="login_success">Logged in.</string>
<string name="no_unread_feeds">No unread feeds.</string>
<string name="no_unread_headlines">No unread headlines.</string>
<string name="no_unread_feeds">No unread feeds</string>
<string name="no_unread_headlines">No unread articles</string>
<string name="loading_message">Loading, please wait...</string>
<string name="menu_unread_feeds">Show unread feeds</string>
<string name="menu_all_feeds">Show all feeds</string>
@ -94,4 +94,6 @@
<string name="go_online">Go online</string>
<string name="offline_downloading">Preparing offline mode...</string>
<string name="offline_switch_error">Failed to prepare offline mode (see log)</string>
<string name="no_feeds">No feeds to display</string>
<string name="no_headlines">No articles to display</string>
</resources>

View File

@ -127,6 +127,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
ListView list = (ListView)view.findViewById(R.id.feeds);
m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<Feed>)m_feeds);
list.setAdapter(m_adapter);
list.setEmptyView(view.findViewById(R.id.no_feeds));
list.setOnItemClickListener(this);
registerForContextMenu(list);
@ -307,9 +308,9 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
sortFeeds();
if (m_feeds.size() == 0)
setLoadingStatus(R.string.no_feeds_to_display, false);
else
//if (m_feeds.size() == 0)
// setLoadingStatus(R.string.no_feeds_to_display, false);
//else
setLoadingStatus(R.string.blank, false);
if (m_enableFeedIcons && !m_feedIconsChecked) getFeedIcons();

View File

@ -127,6 +127,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
list.setAdapter(m_adapter);
list.setOnItemClickListener(this);
list.setOnScrollListener(this);
list.setEmptyView(view.findViewById(R.id.no_headlines));
registerForContextMenu(list);
Log.d(TAG, "onCreateView, feed=" + m_feed);
@ -278,9 +279,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_adapter.notifyDataSetChanged();
if (m_articles.size() == 0)
setLoadingStatus(R.string.no_headlines_to_display, false);
else
//if (m_articles.size() == 0)
// setLoadingStatus(R.string.no_headlines_to_display, false);
//else
setLoadingStatus(R.string.blank, false);
m_refreshInProgress = false;