Search in sources :

Example 6 with GojuonGif

use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif in project MyJapanese by 54wall.

the class MemoryFragment method setData.

@Override
public void setData(List<GojuonItem> data) {
    if (adapter == null) {
        adapter = new MemorySwipeAdapter(data);
        adapter.setOnWriteButtonClickListener(new MemorySwipeAdapter.OnWriteButtonClickListener() {

            @Override
            public void onClick(GojuonItem item) {
                GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
                if (gif != null) {
                    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();
                }
            }
        });
        adapter.setOnYinButtonClickListener(new MemorySwipeAdapter.OnYinButtonClickListener() {

            @Override
            public void onClick(GojuonItem item) {
                SoundPoolManager.getInstance().play(item.getRome());
            }
        });
    }
    adapter.setList(data);
    mSwipeFlingAdapterView.setAdapter(adapter);
}
Also used : ImageDialog(pri.weiqaing.common.widget.dialog.ImageDialog) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem) MemorySwipeAdapter(pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter)

Example 7 with GojuonGif

use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif 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)

Example 8 with GojuonGif

use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif in project LiYuJapanese by 54wall.

the class MemoryFragment method setData.

@Override
public void setData(List<GojuonItem> data) {
    if (adapter == null) {
        adapter = new MemorySwipeAdapter(data);
        adapter.setOnWriteButtonClickListener(new MemorySwipeAdapter.OnWriteButtonClickListener() {

            @Override
            public void onClick(GojuonItem item) {
                GojuonGif gif = GifManager.getInstance().getJPGif(item.getRome());
                if (gif != null) {
                    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();
                }
            }
        });
        adapter.setOnYinButtonClickListener(new MemorySwipeAdapter.OnYinButtonClickListener() {

            @Override
            public void onClick(GojuonItem item) {
                SoundPoolManager.getInstance().play(item.getRome());
            }
        });
    }
    adapter.setList(data);
    mSwipeFlingAdapterView.setAdapter(adapter);
}
Also used : ImageDialog(pri.weiqaing.common.widget.dialog.ImageDialog) GojuonGif(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem) MemorySwipeAdapter(pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter)

Aggregations

GojuonGif (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif)8 ImageDialog (pri.weiqaing.common.widget.dialog.ImageDialog)6 GojuonItem (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)4 GojuonMemory (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonMemory)2 GojuonMemoryRecyclerAdapter (pri.weiqiang.liyujapanese.ui.adapter.GojuonMemoryRecyclerAdapter)2 GojuonRecyclerAdapter (pri.weiqiang.liyujapanese.ui.adapter.GojuonRecyclerAdapter)2 MemorySwipeAdapter (pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter)2