Search in sources :

Example 1 with RightMenuAdapter

use of pri.weiqiang.myjapanese.ui.adapter.RightMenuAdapter in project MyJapanese by 54wall.

the class LessonsFragment method setData.

@Override
public void setData(List<Book> data) {
    // 来自initAdapter
    mBookList = data;
    leftAdapter = new LeftMenuAdapter(getActivity(), data);
    rightAdapter = new RightMenuAdapter(getActivity(), data);
    rightAdapter.setOnItemClickListener(new RightMenuAdapter.OnItemClickListener() {

        @Override
        public void onClick(Lesson item) {
            Log.e(TAG, "lesson:" + item.getTitle());
            SharedPreferenceManager.getInstance().putString(Constants.CURRENT_LESSON, item.getTitle());
            ((MainActivity) getActivity()).switchWords(item.getTitle());
        }
    });
    mRightMenu.setAdapter(rightAdapter);
    mRightMenu.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    mLeftMenu.setAdapter(leftAdapter);
    leftAdapter.addItemSelectedListener(this);
    initHeadView();
}
Also used : RightMenuAdapter(pri.weiqiang.myjapanese.ui.adapter.RightMenuAdapter) LeftMenuAdapter(pri.weiqiang.myjapanese.ui.adapter.LeftMenuAdapter) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) Lesson(pri.weiqiang.myjapanese.mvp.bean.Lesson)

Aggregations

DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 Lesson (pri.weiqiang.myjapanese.mvp.bean.Lesson)1 LeftMenuAdapter (pri.weiqiang.myjapanese.ui.adapter.LeftMenuAdapter)1 RightMenuAdapter (pri.weiqiang.myjapanese.ui.adapter.RightMenuAdapter)1