use of icepick.Icicle in project wh-app-android by WhiteHouse.
the class DrawerFragment method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mMenu = new MenuBuilder(getActivity());
bindSubscription(AndroidObservable.bindFragment(this, FeedCategoryManager.get().getFeedCategoryConfig().first().subscribeOn(Schedulers.newThread())).subscribe(feedCategoryConfig -> {
List<FeedCategoryItem> items = feedCategoryConfig.feeds();
int i = 0;
int group = 0;
for (FeedCategoryItem c : items) {
switch(c.viewType()) {
case FeedCategoryItem.VIEW_TYPE_ARTICLE_LIST:
group = GROUP_ARTICLES;
break;
case FeedCategoryItem.VIEW_TYPE_PHOTO_GALLERY:
group = GROUP_PHOTOS;
break;
case FeedCategoryItem.VIEW_TYPE_VIDEO_GALLERY:
group = GROUP_VIDEOS;
break;
case FeedCategoryItem.VIEW_TYPE_LIVE:
mLivePosition = i + 1;
group = GROUP_LIVE;
break;
}
mMenu.add(group, Menu.NONE, i++, c.title()).setIntent(new Intent().setData(Uri.parse(c.feedUrl())));
}
mMenu.add(GROUP_FAVORITES, Menu.NONE, i++, R.string.title_favorites);
getAdapter().addHeader(new Object());
getAdapter().fillWith(getMenuItems());
getAdapter().selectOnly(mCheckedPosition);
getProgressBar().setVisibility(View.GONE);
getRecyclerView().setVisibility(View.VISIBLE);
if (mDrawerCallbacks != null) {
if (icicle == null) {
mDrawerCallbacks.onRestoreSelectedItem(getAdapter().getItem(mCheckedPosition));
}
updateTitle();
}
}));
}
Aggregations