Search in sources :

Example 21 with GojuonItem

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

the class GojuonRecyclerAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    GojuonItem item = list.get(position);
    if (BaseApplication.TYPE_MING == Constants.TYPE_HIRAGANA) {
        holder.tv_jiaming.setText(item.getHiragana());
    } else {
        holder.tv_jiaming.setText(item.getKatakana());
    }
    if (holder.tv_rome != null) {
        holder.tv_rome.setText(item.getRome());
    }
    holder.item = item;
    if (getItemViewType(position) == Constants.TYPE_ITEM && holder.item.isExisted()) {
        holder.view.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (onItemClickListener != null) {
                    onItemClickListener.onClick(holder.item);
                }
            }
        });
        if (holder.item.getCategory() != Constants.CATEGORY_AOYIN) {
            holder.view.setOnLongClickListener(new View.OnLongClickListener() {

                @Override
                public boolean onLongClick(View v) {
                    if (onItemLongClickListener != null) {
                        onItemLongClickListener.onLongClick(holder.item);
                    }
                    return true;
                }
            });
        }
    }
}
Also used : TextView(android.widget.TextView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Example 22 with GojuonItem

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

the class DBManager method getAoYin.

public List<GojuonItem> getAoYin() {
    if (aoYin == null) {
        aoYin = new ArrayList<>();
        List<GojuonItem> query = query();
        for (GojuonItem item : query) {
            if (item.getCategory() == Constants.CATEGORY_AOYIN) {
                aoYin.add(item);
            }
        }
        Collections.sort(aoYin, new GojuonItemComporator());
    }
    return aoYin;
}
Also used : GojuonItemComporator(pri.weiqiang.liyujapanese.comparator.GojuonItemComporator) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Example 23 with GojuonItem

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

the class DBManager method addHeaderString.

public void addHeaderString(List<GojuonItem> list, int row, int column) {
    for (int i = 1; i < column; i++) {
        GojuonItem item = list.get(i);
        String hiragana = item.getHiragana();
        String katakana = item.getKatakana();
        item.setHiragana(hiragana + ResourceUtils.getString(BaseApplication.getInstance(), R.string.column));
        item.setKatakana(katakana + ResourceUtils.getString(BaseApplication.getInstance(), R.string.column));
    }
    for (int i = 1; i < row; i++) {
        GojuonItem item = list.get(i * column);
        String hiragana = item.getHiragana();
        String katakana = item.getKatakana();
        item.setHiragana(hiragana + ResourceUtils.getString(BaseApplication.getInstance(), R.string.row));
        item.setKatakana(katakana + ResourceUtils.getString(BaseApplication.getInstance(), R.string.row));
    }
}
Also used : GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Example 24 with GojuonItem

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

the class DBManager method getQingYin.

public synchronized List<GojuonItem> getQingYin() {
    if (qingYin == null) {
        qingYin = new ArrayList<>();
        List<GojuonItem> query = query();
        for (GojuonItem item : query) {
            if (item.getCategory() == Constants.CATEGORY_QINGYIN) {
                qingYin.add(item);
            }
        }
        Collections.sort(qingYin, new GojuonItemComporator());
    }
    return qingYin;
}
Also used : GojuonItemComporator(pri.weiqiang.liyujapanese.comparator.GojuonItemComporator) GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Example 25 with GojuonItem

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

the class DBManager method getAoYinWithoutHeader.

public List<GojuonItem> getAoYinWithoutHeader() {
    if (aoYinWithoutHeader == null) {
        aoYinWithoutHeader = new ArrayList<>();
        List<GojuonItem> query = getAoYin();
        for (GojuonItem item : query) {
            if (item.getRow() != 0 && item.getColumn() != 0 && item.isExisted()) {
                aoYinWithoutHeader.add(item);
            }
        }
    }
    return aoYinWithoutHeader;
}
Also used : GojuonItem(pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)

Aggregations

GojuonItem (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem)28 GojuonItemComporator (pri.weiqiang.liyujapanese.comparator.GojuonItemComporator)6 View (android.view.View)4 TextView (android.widget.TextView)4 ImageDialog (pri.weiqaing.common.widget.dialog.ImageDialog)4 GojuonGif (pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonGif)4 Cursor (android.database.Cursor)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 ObservableEmitter (io.reactivex.ObservableEmitter)2 ObservableOnSubscribe (io.reactivex.ObservableOnSubscribe)2 Disposable (io.reactivex.disposables.Disposable)2 ArrayList (java.util.ArrayList)2 GojuonRecyclerAdapter (pri.weiqiang.liyujapanese.ui.adapter.GojuonRecyclerAdapter)2 MemorySwipeAdapter (pri.weiqiang.liyujapanese.ui.adapter.MemorySwipeAdapter)2