use of com.knight.wanandroid.module_square.module_adapter.SquareQuestionAdapter in project wanandroid by KnightAndroid.
the class SquareFragment method initView.
@Override
protected void initView(Bundle savedInstanceState) {
mDatabind.setClick(new ProcyClick());
loadLoading(mDatabind.squareSharearticleFreshlayout);
mHotKeyAdapter = new HotKeyAdapter(new ArrayList<SearchHotKeyEntity>());
mSquareArticleAdapter = new SquareArticleAdapter(new ArrayList<SquareArticleEntity>());
initListener();
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(getActivity());
// 方向 主轴为水平方向,起点在左端
flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
// 左对齐
flexboxLayoutManager.setJustifyContent(JustifyContent.FLEX_START);
// flexboxLayoutManager.setAlignItems(AlignItems.CENTER);
SetInitCustomView.initSwipeRecycleview(mDatabind.squareSearchhotRv, flexboxLayoutManager, mHotKeyAdapter, false);
SetInitCustomView.initSwipeRecycleview(mDatabind.squareArticleRv, new LinearLayoutManager(getActivity()), mSquareArticleAdapter, true);
mDatabind.squareSharearticleFreshlayout.setOnRefreshListener(this);
mDatabind.squareSharearticleFreshlayout.setOnLoadMoreListener(this);
EventBus.getDefault().register(this);
View QuestionMenu = LayoutInflater.from(getActivity()).inflate(R.layout.square_question_activity, null);
mSquareQuestionAdapter = new SquareQuestionAdapter(new ArrayList<>());
initAdapterListener();
baserecycleview = QuestionMenu.findViewById(R.id.base_body_rv);
smartRefreshLayout = (SmartRefreshLayout) QuestionMenu.findViewById(R.id.include_square_question);
tv_question_title = ((TextView) QuestionMenu.findViewById(R.id.square_question_tv_title));
tv_question_title.setText(getString(R.string.square_question));
smartRefreshLayout.setOnRefreshListener(refreshLayout -> {
questionPage = 1;
mPresenter.requestSquareQuestion(questionPage);
});
smartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
mPresenter.requestSquareQuestion(questionPage);
}
});
SetInitCustomView.initSwipeRecycleview(baserecycleview, new LinearLayoutManager(getActivity()), mSquareQuestionAdapter, true);
mDatabind.squareRoot.addView(QuestionMenu);
LoadSir loadSir = LoadSir.getDefault();
mViewLoadService = loadSir.register(QuestionMenu.findViewById(R.id.include_square_question), new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
mViewLoadService.showCallback(LoadCallBack.class);
}
});
mViewLoadService.showCallback(LoadCallBack.class);
mRightLottieAnimation = new RightLottieAnimation.GuillotineBuilder(QuestionMenu, QuestionMenu.findViewById(R.id.square_question_lefticon), mDatabind.squareIvQuestion, mSquareQuestionAdapter).setStartDelay(RIPPLE_DURATION).setActionBarViewForAnimation(mDatabind.squareToolbar).setClosedOnStart(true).setGuillotineListener(new RightLottieListener() {
@Override
public void onRightLottieOpened() {
mDatabind.squareFabUp.setVisibility(View.GONE);
mViewLoadService.showCallback(LoadCallBack.class);
mPresenter.requestSquareQuestion(questionPage);
}
@Override
public void onRightLottieClosed() {
questionPage = 1;
mDatabind.squareFabUp.setVisibility(View.VISIBLE);
}
}).build();
}
Aggregations