diff options
-rw-r--r-- | res/layout/organize_queue.xml | 7 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java | 25 |
2 files changed, 31 insertions, 1 deletions
diff --git a/res/layout/organize_queue.xml b/res/layout/organize_queue.xml index 3982529a2..5c08417b9 100644 --- a/res/layout/organize_queue.xml +++ b/res/layout/organize_queue.xml @@ -30,6 +30,13 @@ android:gravity="center" android:text="@string/no_items_label" /> + <ProgressBar + android:id="@+id/progLoading" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:indeterminateOnly="true" /> + <LinearLayout android:id="@+id/undobar" style="@style/UndoBar"> <TextView android:id="@+id/undobar_message" style="@style/UndoBarMessage" /> <Button android:id="@+id/undobar_button" style="@style/UndoBarButton" /> diff --git a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java index 9bf655855..5ed1dd09a 100644 --- a/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java +++ b/src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java @@ -14,6 +14,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; +import android.widget.ProgressBar; import android.widget.TextView; import com.mobeta.android.dslv.DragSortListView; @@ -41,6 +42,8 @@ public class OrganizeQueueActivity extends ActionBarActivity implements private UndoBarController undoBarController; private DragSortListView listView; + private TextView emptyView; + private ProgressBar progLoading; @Override protected void onCreate(Bundle savedInstanceState) { @@ -50,6 +53,9 @@ public class OrganizeQueueActivity extends ActionBarActivity implements getSupportActionBar().setDisplayHomeAsUpEnabled(true); listView = (DragSortListView) findViewById(android.R.id.list); + emptyView = (TextView) findViewById(android.R.id.empty); + progLoading = (ProgressBar) findViewById(R.id.progLoading); + listView.setDropListener(dropListener); listView.setRemoveListener(removeListener); listView.setEmptyView(findViewById(android.R.id.empty)); @@ -68,6 +74,17 @@ public class OrganizeQueueActivity extends ActionBarActivity implements } @Override + protected void onPreExecute() { + super.onPreExecute(); + // do not show loading animation if queue is already loaded + if (queue == null) { + progLoading.setVisibility(View.VISIBLE); + listView.setVisibility(View.GONE); + emptyView.setVisibility(View.GONE); + } + } + + @Override protected void onPostExecute(List<FeedItem> feedItems) { super.onPostExecute(feedItems); if (feedItems != null) { @@ -80,9 +97,15 @@ public class OrganizeQueueActivity extends ActionBarActivity implements } else { Log.e(TAG, "Queue was null"); } + progLoading.setVisibility(View.GONE); + listView.setVisibility(View.VISIBLE); } }; - loadTask.execute(); + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { + loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } else { + loadTask.execute(); + } } @Override |