Search in sources :

Example 1 with MoreKnowLedgeAdapter

use of com.knight.wanandroid.module_home.module_adapter.MoreKnowLedgeAdapter in project wanandroid by KnightAndroid.

the class KnowledgeLabelActivity method initData.

@Override
public void initData() {
    myTagInfos.addAll(addTags("fix", fixDataList, TagInfo.TYPE_TAG_SERVICE));
    myTagInfos.addAll(addTags("default", mDefaultList, TagInfo.TYPE_TAG_USER));
    mDatabind.homeKnowledgetTag.setTags(myTagInfos);
    mManager = new FlexboxLayoutManager(this);
    mManager.setFlexDirection(FlexDirection.ROW);
    // 左对齐
    mManager.setJustifyContent(JustifyContent.FLEX_START);
    mManager.setAlignItems(AlignItems.CENTER);
    mDatabind.homeMoreknowledgeRv.setLayoutManager(mManager);
    // 首先读取本地是否有保存
    moreKnowLedgeList = CacheUtils.getDataInfo("moreknowledgeLabel", new TypeToken<List<TagInfo>>() {
    }.getType());
    if (moreKnowLedgeList == null || moreKnowLedgeList.size() == 0) {
        moreKnowLedgeList = new ArrayList<>();
    }
    mMoreKnowLedgeAdapter = new MoreKnowLedgeAdapter(moreKnowLedgeList);
    mDatabind.homeMoreknowledgeRv.setAdapter(mMoreKnowLedgeAdapter);
    mDatabind.homeTvMorelabel.setText(getString(R.string.home_more_knowledge) + "(" + mMoreKnowLedgeAdapter.getData().size() + "/10)");
    initLinstener();
}
Also used : FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) ArrayList(java.util.ArrayList) List(java.util.List) MoreKnowLedgeAdapter(com.knight.wanandroid.module_home.module_adapter.MoreKnowLedgeAdapter)

Aggregations

FlexboxLayoutManager (com.google.android.flexbox.FlexboxLayoutManager)1 MoreKnowLedgeAdapter (com.knight.wanandroid.module_home.module_adapter.MoreKnowLedgeAdapter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1