Search in sources :

Example 1 with GojuonMemoryRecyclerAdapter

use of pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter in project MyJapanese by 54wall.

the class GojuonMemoryFragment method setData.

@Override
public void setData(List<GojuonMemory> data) {
    Log.e(TAG, "setData!!");
    adapter = new GojuonMemoryRecyclerAdapter(category_gojuon_memory, data);
    adapter.setOnItemClickListener(new GojuonMemoryRecyclerAdapter.OnItemClickListener() {

        @Override
        public void onClick(GojuonMemory bean) {
            Log.e(TAG, "onItemClick bean:" + bean.getRome() + ":" + bean.getKatakana());
            SoundPoolManager.getInstance().play(bean.getRome());
        }
    });
    adapter.setOnItemLongClickListener(new GojuonMemoryRecyclerAdapter.OnItemLongClickListener() {

        @Override
        public void onLongClick(GojuonMemory item) {
            Log.e(TAG, "onLongClick item:" + item.getRome() + ":" + item.getKatakana());
            GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
            if (gif != null) {
                if (BaseApplication.TYPE_MING == Constants.TYPE_HIRAGANA) {
                    new ImageDialog.Builder(getContext()).setResId(gif.getHiragana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
                } else {
                    new ImageDialog.Builder(getContext()).setResId(gif.getKatakana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
                }
            }
        }
    });
    mRecyclerView.setAdapter(adapter);
}
Also used : ImageDialog(pri.weiqaing.common.widget.dialog.ImageDialog) GojuonMemory(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonMemoryRecyclerAdapter(pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter)

Example 2 with GojuonMemoryRecyclerAdapter

use of pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter in project LiYuJapanese by 54wall.

the class GojuonMemoryFragment method setData.

@Override
public void setData(List<GojuonMemory> data) {
    Log.e(TAG, "setData!!");
    adapter = new GojuonMemoryRecyclerAdapter(category_gojuon_memory, data);
    adapter.setOnItemClickListener(new GojuonMemoryRecyclerAdapter.OnItemClickListener() {

        @Override
        public void onClick(GojuonMemory bean) {
            Log.e(TAG, "onItemClick bean:" + bean.getRome() + ":" + bean.getKatakana());
            SoundPoolManager.getInstance().play(bean.getRome());
        }
    });
    adapter.setOnItemLongClickListener(new GojuonMemoryRecyclerAdapter.OnItemLongClickListener() {

        @Override
        public void onLongClick(GojuonMemory item) {
            Log.e(TAG, "onLongClick item:" + item.getRome() + ":" + item.getKatakana());
            GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
            if (gif != null) {
                if (BaseApplication.TYPE_MING == Constants.TYPE_HIRAGANA) {
                    new ImageDialog.Builder(getContext()).setResId(gif.getHiragana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
                } else {
                    new ImageDialog.Builder(getContext()).setResId(gif.getKatakana()).override((int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_width), (int) ResourceUtils.getDimension(getContext(), R.dimen.dialog_height)).create().show();
                }
            }
        }
    });
    mRecyclerView.setAdapter(adapter);
}
Also used : ImageDialog(pri.weiqaing.common.widget.dialog.ImageDialog) GojuonMemory(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonMemoryRecyclerAdapter(pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter)

Aggregations

ImageDialog (pri.weiqaing.common.widget.dialog.ImageDialog)2 GojuonGif (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif)2 GojuonMemory (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory)2 GojuonMemoryRecyclerAdapter (pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter)2