Search in sources :

Example 1 with MemorySwipeAdapter

use of pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter 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 2 with MemorySwipeAdapter

use of pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter 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

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 MemorySwipeAdapter (pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter)2