Search in sources :

Example 1 with GojuonRecyclerAdapter

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

the class GojuonFragment method setData.

@Override
public void setData(List<GojuonItem> data) {
    adapter = new GojuonRecyclerAdapter(data);
    adapter.setOnItemClickListener(new GojuonRecyclerAdapter.OnItemClickListener() {

        @Override
        public void onClick(GojuonItem item) {
            SoundPoolManager.getInstance().play(item.getRome());
        }
    });
    adapter.setOnItemLongClickListener(new GojuonRecyclerAdapter.OnItemLongClickListener() {

        @Override
        public void onLongClick(GojuonItem 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) GojuonRecyclerAdapter(pri.weiqiang.liyujapanese.ui.adapter.GojuonRecyclerAdapter) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Example 2 with GojuonRecyclerAdapter

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

the class GojuonFragment method setData.

@Override
public void setData(List<GojuonItem> data) {
    adapter = new GojuonRecyclerAdapter(data);
    adapter.setOnItemClickListener(new GojuonRecyclerAdapter.OnItemClickListener() {

        @Override
        public void onClick(GojuonItem item) {
            SoundPoolManager.getInstance().play(item.getRome());
        }
    });
    adapter.setOnItemLongClickListener(new GojuonRecyclerAdapter.OnItemLongClickListener() {

        @Override
        public void onLongClick(GojuonItem 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) GojuonRecyclerAdapter(pri.weiqiang.liyujapanese.ui.adapter.GojuonRecyclerAdapter) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Aggregations

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