use of com.example.jingbin.cloudreader.bean.wanandroid.WxarticleItemBean in project CloudReader by youlookwhat.
the class WanFindViewModel method getWxArticle.
public void getWxArticle() {
Disposable subscribe = HttpClient.Builder.getWanAndroidServer().getWxarticle().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<BaseResultBean<List<WxarticleItemBean>>>() {
@Override
public void accept(BaseResultBean<List<WxarticleItemBean>> naviJsonBean) throws Exception {
if (naviJsonBean != null && naviJsonBean.getData() != null && naviJsonBean.getData().size() > 0) {
// title
dataTitle.setValue(naviJsonBean.getData());
} else {
dataTitle.setValue(null);
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
dataTitle.setValue(null);
}
});
addDisposable(subscribe);
}
use of com.example.jingbin.cloudreader.bean.wanandroid.WxarticleItemBean in project CloudReader by youlookwhat.
the class TreeAdapter method bindView.
@Override
protected void bindView(BaseByViewHolder<TreeItemBean> holder, TreeItemBean dataBean, int position) {
if (dataBean != null) {
TextView tvTreeTitle = holder.getView(R.id.tv_tree_title);
FlexboxLayout flTree = holder.getView(R.id.fl_tree);
String name = DataUtil.getHtmlString(dataBean.getName());
if (isSelect) {
flTree.setVisibility(View.GONE);
if (selectedPosition == position) {
name = name + " ★★★";
tvTreeTitle.setTextColor(CommonUtils.getColor(context, R.color.colorTheme));
} else {
tvTreeTitle.setTextColor(CommonUtils.getColor(context, R.color.colorContent));
}
} else {
tvTreeTitle.setTextColor(CommonUtils.getColor(context, R.color.colorContent));
flTree.setVisibility(View.VISIBLE);
for (int i = 0; i < dataBean.getChildren().size(); i++) {
WxarticleItemBean childItem = dataBean.getChildren().get(i);
TextView child = createOrGetCacheFlexItemTextView(flTree);
child.setText(DataUtil.getHtmlString(childItem.getName()));
child.setOnClickListener(v -> CategoryDetailActivity.start(v.getContext(), childItem.getId(), dataBean));
flTree.addView(child);
}
}
tvTreeTitle.setText(ThinBoldSpan.getDefaultSpanString(tvTreeTitle.getContext(), name));
}
}
use of com.example.jingbin.cloudreader.bean.wanandroid.WxarticleItemBean in project CloudReader by youlookwhat.
the class CategoryDetailActivity method initData.
private void initData() {
int cid = getIntent().getIntExtra("cid", 0);
TreeItemBean mTreeBean = (TreeItemBean) getIntent().getSerializableExtra("CategoryBean");
bindingView.setTreeItemBean(mTreeBean);
List<String> mTitleList = new ArrayList<>();
int initIndex = 0;
for (int i = 0, len = mTreeBean.getChildren().size(); i < len; i++) {
WxarticleItemBean childrenBean = mTreeBean.getChildren().get(i);
mTitleList.add(childrenBean.getName());
if (childrenBean.getId() == cid) {
initIndex = i;
}
}
CommonTabPagerAdapter myAdapter = new CommonTabPagerAdapter(getSupportFragmentManager(), mTitleList);
myAdapter.setListener(position -> CategoryArticleFragment.newInstance(mTreeBean.getChildren().get(position).getId(), mTreeBean.getChildren().get(position).getName(), false));
bindingView.viewPager.setAdapter(myAdapter);
myAdapter.notifyDataSetChanged();
bindingView.tabLayout.setupWithViewPager(bindingView.viewPager);
// 设置初始位置
bindingView.viewPager.setCurrentItem(initIndex);
}
Aggregations