diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-09-27 19:51:03 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-09-27 19:55:06 +0200 |
commit | 79cb4b35a89cdc78017afe8c91d9726c58233ef7 (patch) | |
tree | ecc48f243aaa0321affc521479cab7674678f39c /src | |
parent | 1871817f71a092757d0eae5b41b038cf243ffbce (diff) | |
download | AntennaPod-79cb4b35a89cdc78017afe8c91d9726c58233ef7.zip |
Added loading screen to OrganizeQueueActivity
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/activity/OrganizeQueueActivity.java | 25 |
1 files changed, 24 insertions, 1 deletions
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 |