Add an "empty view" to the message list

This will display a spinning progress indicator while the message list
is loaded from the database.
This commit is contained in:
cketti 2012-12-06 06:11:49 +01:00
parent d5bb462917
commit b04f1b4319
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_list_loading" />
</LinearLayout>

View File

@ -1097,4 +1097,6 @@ http://k9mail.googlecode.com/
<string name="upgrade_databases_title">Upgrading databases</string>
<string name="upgrade_databases_unspecified">Upgrading databases…</string>
<string name="upgrade_database_format">Upgrading database of account \"<xliff:g id="account">%s</xliff:g>\"</string>
<string name="message_list_loading">Loading…</string>
</resources>

View File

@ -712,6 +712,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mActionBarProgressView = inflater.inflate(R.layout.actionbar_indeterminate_progress_actionview, null);
mPullToRefreshView = (PullToRefreshListView) view.findViewById(R.id.message_list);
View loadingView = inflater.inflate(R.layout.message_list_loading, null);
mPullToRefreshView.setEmptyView(loadingView);
initializeLayout();
mListView.setVerticalFadingEdgeEnabled(false);
@ -2891,6 +2893,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mPullToRefreshView.setEmptyView(null);
Cursor cursor;
if (mCursors.length > 1) {
mCursors[loader.getId()] = data;