use of cn.nicolite.palm300heroes.model.bean.FightSkill in project Palm300Heroes by nicolite.
the class FightSkillAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final FightSkillViewHolder holder, int position) {
FightSkill fightSkill = dataList.get(position);
Glide.with(context).load(Constants.FIGHT_SKILL_URL + Uri.encode(fightSkill.getPicture())).crossFade().into(holder.img);
holder.name.setText(fightSkill.getName());
holder.level.setText(String.valueOf("召唤师等级:" + fightSkill.getLevel()));
holder.cd.setText(String.valueOf("冷却时间:" + fightSkill.getCd()));
holder.jjcEf.setText(String.valueOf(fightSkill.getJjc()));
if (!TextUtils.isEmpty(fightSkill.getZc())) {
holder.zcEf.setVisibility(View.VISIBLE);
holder.zcEf.setText(String.valueOf(fightSkill.getZc()));
} else {
holder.zcEf.setVisibility(View.GONE);
}
}
use of cn.nicolite.palm300heroes.model.bean.FightSkill in project Palm300Heroes by nicolite.
the class FightSkillPresenter method showFightSkill.
public void showFightSkill(boolean isForce) {
final FightSkillDao fightSkillDao = getDaoSession().getFightSkillDao();
if (!isForce && fightSkillDao.count() > 0) {
if (getView() != null) {
List<FightSkill> list = fightSkillDao.queryBuilder().orderAsc(FightSkillDao.Properties.Position).list();
getView().showFightSkill(list);
}
return;
}
if (getView() != null) {
getView().showLoading();
}
BmobQuery<FightSkill> query = new BmobQuery<>(Constants.BMOB_FIGHT_SKILL);
query.setLimit(20).order("position").findObjects(new FindListener<FightSkill>() {
@Override
public void done(final List<FightSkill> list, BmobException e) {
if (getView() != null) {
getView().closeLoading();
if (e == null) {
getView().showFightSkill(list);
if (!saveFlag) {
saveFlag = true;
new Thread(new Runnable() {
@Override
public void run() {
fightSkillDao.deleteAll();
for (FightSkill fightSkill : list) {
fightSkillDao.insert(fightSkill);
}
saveFlag = false;
}
}).start();
}
} else {
BmobUtils.showErrorMessage(e.toString());
}
}
}
});
}
Aggregations