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.setOnItemClickListener(navListClickListener);
loadData();
}
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)) {
handleNavIntent();
}
loadData();
}
@Override
@ -342,6 +342,7 @@ public class MainActivity extends ActionBarActivity {
};
private void loadData() {
cancelLoadTask();
loadTask = new AsyncTask<Void, Void, List<Feed>>() {
@Override
protected List<Feed> doInBackground(Void... params) {

View File

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

View File

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

View File

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

View File

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