左右Fragment

package com.example.six_week2.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.six_week2.R;
import com.example.six_week2.adapter.MyAdapter;
import com.example.six_week2.adapter.MyLeftAdapter;
import com.example.six_week2.bean.JsonBean;
import com.example.six_week2.bean.LeftBean;
import com.example.six_week2.left.presenter.ShowPresenterleft;

import java.util.List;

public class OneFragment extends Fragment {
private View inflate;
private RecyclerView leftrecyclerView,rightrecyclerView;
LeftBean leftBean;
private ShowPresenterleft leftPre;
private MyLeftAdapter leftAabter;
private LinearLayoutManager linearLayoutManager;
private MyAdapter rightAdapter;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    inflate = inflater.inflate(R.layout.one_layout, container, false);
    leftrecyclerView = inflate.findViewById(R.id.type_rvleft);
    linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(OrientationHelper.VERTICAL);
    leftrecyclerView.setLayoutManager(linearLayoutManager);
    rightrecyclerView = inflate.findViewById(R.id.type_rvright);
    linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(OrientationHelper.VERTICAL);
    rightrecyclerView.setLayoutManager(linearLayoutManager);
    leftPre = new ShowPresenterleft(this);
    leftPre.GetDDataleft();
    leftPre.GetRightata("1");
    return inflate;
}
public void getleftViewDate(Object  obj) {
    LeftBean leftBean= (LeftBean) obj;
    leftAabter = new MyLeftAdapter(getActivity(),leftBean);
    leftAabter.setRecyclerItemClickListener(new MyLeftAdapter.OnRecyclerItemClickListener() {
        @Override
        public void onItemClick(int position, List<LeftBean.DataBean> dataBeanList) {
            leftPre.GetRightata(dataBeanList.get(position).getCid());
            rightAdapter.notifyDataSetChanged();
        }
    });
    leftrecyclerView.setAdapter(leftAabter);
}
public  void   getRightViewDate(Object obj){

    JsonBean jsonBean= (JsonBean) obj;
    rightAdapter = new MyAdapter(getActivity(), jsonBean);
    rightrecyclerView.setAdapter(rightAdapter);
}

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值