Search in sources :

Example 1 with GankAdapter

use of com.seven.seven.gank.adapter.GankAdapter in project seven_develop by seven123456.

the class GankFragment method initView.

@Override
protected void initView() {
    EventBus.getDefault().register(this);
    gankPresenter = new GankPresenter(this, (MainActivity) getActivity());
    inError = rootView.findViewById(R.id.in_error);
    inError.setVisibility(View.VISIBLE);
    inError.playAnimation();
    recyclerView = rootView.findViewById(R.id.recycler);
    gankAdapter = new GankAdapter(R.layout.recycler_item_gank);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(gankAdapter);
}
Also used : GankAdapter(com.seven.seven.gank.adapter.GankAdapter) GankPresenter(com.seven.seven.gank.presenter.GankPresenter) MainActivity(com.seven.seven.ui.MainActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 2 with GankAdapter

use of com.seven.seven.gank.adapter.GankAdapter in project seven_develop by seven123456.

the class GankFragment method initRecycler.

private void initRecycler(List<GankIoWelfareBean> data) {
    gankAdapter = new GankAdapter(R.layout.recycler_item_gank, data);
    recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
    recyclerView.setAdapter(gankAdapter);
    gankAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {

        @Override
        public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            GankIoWelfareBean gankIoWelfareBean = (GankIoWelfareBean) adapter.getItem(position);
            Intent intent = new Intent(getContext(), LookImageActivity.class);
            intent.putExtra("image", gankIoWelfareBean.getUrl());
            startActivity(intent);
        }
    });
}
Also used : GankIoWelfareBean(com.seven.seven.gank.model.GankIoWelfareBean) GankAdapter(com.seven.seven.gank.adapter.GankAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) LookImageActivity(com.seven.seven.search.LookImageActivity) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) ErrorLayoutView(com.seven.seven.common.view.ErrorLayoutView) View(android.view.View)

Aggregations

GankAdapter (com.seven.seven.gank.adapter.GankAdapter)2 Intent (android.content.Intent)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 ErrorLayoutView (com.seven.seven.common.view.ErrorLayoutView)1 GankIoWelfareBean (com.seven.seven.gank.model.GankIoWelfareBean)1 GankPresenter (com.seven.seven.gank.presenter.GankPresenter)1 LookImageActivity (com.seven.seven.search.LookImageActivity)1 MainActivity (com.seven.seven.ui.MainActivity)1