use of me.yokeyword.sample.demo_zhihu.adapter.MenuAdapter in project Fragmentation by YoKeyword.
the class MenuListFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
LinearLayoutManager manager = new LinearLayoutManager(_mActivity);
mRecy.setLayoutManager(manager);
mAdapter = new MenuAdapter(_mActivity);
mRecy.setAdapter(mAdapter);
mAdapter.setDatas(mMenus);
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position, View view, RecyclerView.ViewHolder vh) {
showContent(position);
}
});
if (savedInstanceState != null) {
mCurrentPosition = savedInstanceState.getInt(SAVE_STATE_POSITION);
mAdapter.setItemChecked(mCurrentPosition);
} else {
mCurrentPosition = 0;
mAdapter.setItemChecked(0);
}
}
Aggregations