use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese 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;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese 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;
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese 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));
}
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem 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);
}
use of pri.weiqiang.liyujapanese.mvp.bean.gojuon.GojuonItem in project MyJapanese by 54wall.
the class MemorySwipeAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
final GojuonItem item = list.get(position);
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_memory, parent, false);
holder = new ViewHolder();
holder.tv_rome = convertView.findViewById(R.id.tv_rome);
holder.btn_yin = convertView.findViewById(R.id.btn_yin);
holder.btn_write = convertView.findViewById(R.id.btn_write);
holder.tv_hiragana = convertView.findViewById(R.id.tv_hiragana);
holder.tv_katakana = convertView.findViewById(R.id.tv_katakana);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tv_rome.setText(item.getRome());
if (item.getCategory() == Constants.CATEGORY_AOYIN) {
holder.tv_hiragana.setTextSize(ResourceUtils.getDimension(parent.getContext(), R.dimen.memory_item_text_size_mini));
} else {
holder.tv_hiragana.setTextSize(ResourceUtils.getDimension(parent.getContext(), R.dimen.memory_item_text_size));
}
holder.tv_hiragana.setText(item.getHiragana());
holder.tv_katakana.setText(item.getKatakana());
holder.btn_yin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onYinButtonClickListener != null) {
onYinButtonClickListener.onClick(item);
}
}
});
if (item.getCategory() == Constants.CATEGORY_AOYIN) {
holder.btn_write.setEnabled(false);
} else {
holder.btn_write.setEnabled(true);
holder.btn_write.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onWriteButtonClickListener != null) {
onWriteButtonClickListener.onClick(item);
}
}
});
}
return convertView;
}
Aggregations