Load data in onResume instead of onCreate

This commit is contained in:
daniel oeh 2014-04-26 23:22:06 +02:00
parent a7c8438b15
commit 68494fd022
5 changed files with 13 additions and 6 deletions

View File

@ -119,8 +119,6 @@ public class MainActivity extends ActionBarActivity {
navList.setAdapter(navAdapter); navList.setAdapter(navAdapter);
navList.setOnItemClickListener(navListClickListener); navList.setOnItemClickListener(navListClickListener);
loadData();
} }
public ActionBar getMainActivtyActionBar() { public ActionBar getMainActivtyActionBar() {
@ -272,6 +270,8 @@ public class MainActivity extends ActionBarActivity {
} else if (feeds != null && intent.hasExtra(EXTRA_NAV_INDEX) && intent.hasExtra(EXTRA_NAV_TYPE)) { } else if (feeds != null && intent.hasExtra(EXTRA_NAV_INDEX) && intent.hasExtra(EXTRA_NAV_TYPE)) {
handleNavIntent(); handleNavIntent();
} }
loadData();
} }
@Override @Override
@ -342,6 +342,7 @@ public class MainActivity extends ActionBarActivity {
}; };
private void loadData() { private void loadData() {
cancelLoadTask();
loadTask = new AsyncTask<Void, Void, List<Feed>>() { loadTask = new AsyncTask<Void, Void, List<Feed>>() {
@Override @Override
protected List<Feed> doInBackground(Void... params) { protected List<Feed> doInBackground(Void... params) {

View File

@ -96,8 +96,6 @@ public class ItemlistFragment extends ListFragment {
Bundle args = getArguments(); Bundle args = getArguments();
if (args == null) throw new IllegalArgumentException("args invalid"); if (args == null) throw new IllegalArgumentException("args invalid");
feedID = args.getLong(ARGUMENT_FEED_ID); feedID = args.getLong(ARGUMENT_FEED_ID);
startItemLoader();
} }
@Override @Override
@ -124,6 +122,7 @@ public class ItemlistFragment extends ListFragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
updateProgressBarVisibility(); updateProgressBarVisibility();
startItemLoader();
} }
@Override @Override

View File

@ -72,13 +72,12 @@ public class NewEpisodesFragment extends Fragment {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setRetainInstance(true); setRetainInstance(true);
setHasOptionsMenu(true); setHasOptionsMenu(true);
startItemLoader();
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
startItemLoader();
} }
@Override @Override

View File

@ -52,7 +52,11 @@ public class PlaybackHistoryFragment extends ListFragment {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setRetainInstance(true); setRetainInstance(true);
setHasOptionsMenu(true); setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
startItemLoader(); startItemLoader();
} }

View File

@ -73,7 +73,11 @@ public class QueueFragment extends Fragment {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setRetainInstance(true); setRetainInstance(true);
setHasOptionsMenu(true); setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
startItemLoader(); startItemLoader();
} }