类似淘宝的写法

1.切换主页面

public void initData(@Nullable Bundle savedInstanceState) {

        ArrayList<Fragment> fragmentlist = new ArrayList<>();
        Frag1Fragment frag1Fragment = new Frag1Fragment();
        LiebiaoFragment liebiaoFragment = new LiebiaoFragment();
        MessageFragmentFragment messageFragmentFragment = new MessageFragmentFragment();
        ShopFragmentFragment shopFragmentFragment = new ShopFragmentFragment();
        MyFragmentFragment myFragmentFragment = new MyFragmentFragment();
        fragmentlist.add(frag1Fragment);
        fragmentlist.add(liebiaoFragment);
        fragmentlist.add(messageFragmentFragment);
        fragmentlist.add(shopFragmentFragment);
        fragmentlist.add(myFragmentFragment);

        manager = getSupportFragmentManager();
        manager.beginTransaction().replace(R.id.fram_layout,frag1Fragment).commit();
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                FragmentTransaction transaction = manager.beginTransaction();
                switch (checkedId)
                {
                    case R.id.btn_show:
                        transaction.replace(R.id.fram_layout,frag1Fragment);
                        break;
                    case R.id.btn_lie:
                        transaction.replace(R.id.fram_layout,liebiaoFragment);
                        break;
                    case R.id.btn_meassage:
                        transaction.replace(R.id.fram_layout,messageFragmentFragment);
                        break;
                    case R.id.btn_shop:
                        transaction.replace(R.id.fram_layout,shopFragmentFragment);
                        break;
                    case R.id.btn_my:
                        transaction.replace(R.id.fram_layout,myFragmentFragment);
                        break;
                }
                //提交事件
                transaction.commit();
            }
        });
    }

2.首页面布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="0.8"
    >
    <include  layout="@layout/include_layout"/>

</LinearLayout>

    <com.scwang.smartrefresh.layout.SmartRefreshLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="vertical"
        android:id="@+id/smar_layout"
        android:layout_weight="9"
        >
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                >
                <com.recker.flybanner.FlyBanner
                    android:layout_width="match_parent"
                    android:layout_height="150dp"
                    android:id="@+id/fly_banner"
                    />

                <android.support.v7.widget.RecyclerView
                    android:layout_width="match_parent"
                    android:layout_height="180dp"
                    android:id="@+id/rece_view"
                    />

                <android.support.v7.widget.RecyclerView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/rece_view1"
                    />

            </LinearLayout>

        </ScrollView>

    </com.scwang.smartrefresh.layout.SmartRefreshLayout>

</LinearLayout>

3.首页面java

public class Frag1Fragment extends BaseFragment<Frag1Presenter> implements Frag1Contract.View {

    @BindView(R.id.fly_banner)
    FlyBanner flyBanner;
    Unbinder unbinder;
    @BindView(R.id.btn_sao)
    Button btnSao;
    @BindView(R.id.rece_view)
    RecyclerView receView;
    @BindView(R.id.rece_view1)
    RecyclerView receView1;
    @BindView(R.id.smar_layout)
    SmartRefreshLayout smarLayout;
    @BindView(R.id.edit_text)
    EditText editText;
    @BindView(R.id.btn_xiaoxi)
    Button btnXiaoxi;

    public static Frag1Fragment newInstance() {
        Frag1Fragment fragment = new Frag1Fragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(@NonNull AppComponent appComponent) {
        DaggerFrag1Component //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .frag1Module(new Frag1Module(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_frag1, container, false);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        //数据库
        DaoSession daoSession = jingd.bwie.com.jdong.app.service.App.getInstance().daoSession();
        User1Dao user1Dao = daoSession.getUser1Dao();
        user1Dao.insert(new User1(null,"哈哈哈","啦啦啦","呀呀呀"));
        user1Dao.loadAll();

        smarLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
                refreshLayout.finishRefresh(2000/*,false*/);//传入false表示刷新失败
            }
        });
        smarLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
                refreshLayout.finishLoadMore(2000/*,false*/);//传入false表示加载失败
            }
        });
        //设置 Header 为 贝塞尔雷达 样式
        smarLayout.setRefreshHeader(new BezierRadarHeader(getActivity()).setEnableHorizontalDrag(true));
//设置 Footer 为 球脉冲 样式
        smarLayout.setRefreshFooter(new BallPulseFooter(getActivity()).setSpinnerStyle(SpinnerStyle.Scale));
    }

    /**
     * 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
     * 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
     * 方法中就可以 {@code switch} 做不同的操作, 这样就可以用统一的入口方法做多个不同的操作, 可以起到分发的作用
     * <p>
     * 调用此方法时请注意调用时 Fragment 的生命周期, 如果调用 {@link #setData(Object)} 方法时 {@link Fragment#onCreate(Bundle)} 还没执行
     * 但在 {@link #setData(Object)} 里却调用了 Presenter 的方法, 是会报空的, 因为 Dagger 注入是在 {@link Fragment#onCreate(Bundle)} 方法中执行的
     * 然后才创建的 Presenter, 如果要做一些初始化操作,可以不必让外部调用 {@link #setData(Object)}, 在 {@link #initData(Bundle)} 中初始化就可以了
     * <p>
     * Example usage:
     * <pre>
     * public void setData(@Nullable Object data) {
     *     if (data != null && data instanceof Message) {
     *         switch (((Message) data).what) {
     *             case 0:
     *                 loadData(((Message) data).arg1);
     *                 break;
     *             case 1:
     *                 refreshUI();
     *                 break;
     *             default:
     *                 //do something
     *                 break;
     *         }
     *     }
     * }
     *
     * // call setData(Object):
     * Message data = new Message();
     * data.what = 0;
     * data.arg1 = 1;
     * fragment.setData(data);
     * </pre>
     *
     * @param data 当不需要参数时 {@code data} 可以为 {@code null}
     */
    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {

    }

    @Override
    public void showData(News1 news1) {

        List<News1.DataBean> data = news1.getData();
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < data.size(); i++) {
            String icon = data.get(i).getIcon();
            Log.i("aaa", "showData: " + icon);
            list.add(data.get(i).getIcon());
        }
        flyBanner.setImagesUrl(list);

    }

    @Override
    public void showData1(News2 news2) {
        List<News2.DataBean> data = news2.getData();

        GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2, GridLayoutManager.HORIZONTAL, false);
        receView.setLayoutManager(gridLayoutManager);
        MyJiuAdapter myJiuAdapter = new MyJiuAdapter(getActivity(), data);
        receView.setAdapter(myJiuAdapter);
    }

    @Override
    public void showData2(News3 news3) {
        List<News3.TuijianBean.ListBean> list = news3.getTuijian().getList();
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2, GridLayoutManager.VERTICAL, false);
        receView1.setLayoutManager(gridLayoutManager);
        MyLieAdapter myLieAdapter = new MyLieAdapter(getActivity(), list);
        receView1.setAdapter(myLieAdapter);
        myLieAdapter.setOnItemClickLisentener(new MyLieAdapter.onItemClickLisentener() {
            @Override
            public void onItemClick(int layoutPosition) {
                int pid = list.get(layoutPosition).getPid();
                Intent intent = new Intent(getActivity(), ShopMessageActivity.class);
                intent.putExtra("pid", pid + "");
                startActivity(intent);
            }
        });
    }

    @Override
    public void error(String s) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        mPresenter.getData();
        mPresenter.getJiugongGe();
        mPresenter.getLiebiao();
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick(R.id.edit_text)
    public void onViewClicked() {

        Intent intent = new Intent(getActivity(), LiushiActivity.class);
        startActivity(intent);
    }
}
-九宫格适配器

public class MyJiuAdapter extends RecyclerView.Adapter<MyJiuAdapter.JiuGongGe> {
    private Context context;
    private List<News2.DataBean> list;

    public MyJiuAdapter(Context context, List<News2.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public JiuGongGe onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.jiugongge_layout, null);
        JiuGongGe jiuGongGe = new JiuGongGe(inflate);
        return jiuGongGe;
    }

    @Override
    public void onBindViewHolder(@NonNull JiuGongGe holder, int position) {

        holder.text_title.setText(list.get(position).getName());
        Uri parse = Uri.parse(list.get(position).getIcon());
        holder.simp_view.setImageURI(parse);
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class JiuGongGe extends RecyclerView.ViewHolder
    {

        private final TextView text_title;
        private final SimpleDraweeView simp_view;

        public JiuGongGe(View itemView) {
            super(itemView);
            simp_view = (SimpleDraweeView)itemView.findViewById(R.id.simp_view);
            text_title = (TextView)itemView.findViewById(R.id.text_title);
        }
    }
}

-列表适配器

public class MyLieAdapter extends RecyclerView.Adapter<MyLieAdapter.LieBiao> {
    private Context context;
    private List<News3.TuijianBean.ListBean> list3;
    onItemClickLisentener onItemClickLisentener;

    public interface onItemClickLisentener{
        void onItemClick(int layoutPosition);
    }
    public void setOnItemClickLisentener(onItemClickLisentener onItemClickLisentener){
        this.onItemClickLisentener=onItemClickLisentener;
    }

    public MyLieAdapter(Context context, List<News3.TuijianBean.ListBean> list3) {
        this.context = context;
        this.list3 = list3;
    }

    @NonNull
    @Override
    public LieBiao onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.show_layout, null);
        LieBiao lieBiao = new LieBiao(inflate);
        return lieBiao;
    }

    @Override
    public void onBindViewHolder(@NonNull LieBiao holder, int position) {

        String images = list3.get(position).getImages();
        if (images.contains("|"))
        {
            images=images.substring(0,images.indexOf("|"));
        }
        else {
            images = list3.get(position).getImages();

        }

        holder.text_shopname.setText(list3.get(position).getSubhead());
        holder.text_shopprice.setText(list3.get(position).getPrice()+"");
        Uri parse = Uri.parse(images);
        holder.simp_view1.setImageURI(parse);
    }

    @Override
    public int getItemCount() {
        return list3.size();
    }

    class LieBiao extends RecyclerView.ViewHolder implements View.OnClickListener {

        private final SimpleDraweeView simp_view1;
        private final TextView text_shopname;
        private final TextView text_shopprice;

        public LieBiao(View itemView) {
            super(itemView);
            simp_view1 = (SimpleDraweeView)itemView.findViewById(R.id.simp_view1);
            text_shopname = (TextView)itemView.findViewById(R.id.text_shopname);
            text_shopprice = (TextView)itemView.findViewById(R.id.text_shopprice);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            int layoutPosition = getLayoutPosition();
            onItemClickLisentener.onItemClick(layoutPosition);
        }
    }

    private OncheckedLisenner oncheckedLisenner;;
    interface OncheckedLisenner{
        void onchecked(int layoutPosition, boolean checked);
    }
    public void setOncheckedLisenner(OncheckedLisenner oncheckedLisenner){
        this.oncheckedLisenner=oncheckedLisenner;
    }
}
-九宫格适配器

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="50dp"
        android:layout_height="50dp"
        app:placeholderImage="@mipmap/ic_launcher"
        android:id="@+id/simp_view"
        android:layout_marginLeft="10dp"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="title"
        android:id="@+id/text_title"
        android:textSize="10sp"
        android:layout_marginLeft="20dp"
        />

</LinearLayout>
-列表布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_height="match_parent">
    
    <com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="150dp"
        android:layout_height="150dp"
        app:placeholderImage="@mipmap/ic_launcher"
        android:id="@+id/simp_view1"
        />
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="name"
        android:layout_marginLeft="20dp"
        android:id="@+id/text_shopname"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="price"
        android:textColor="#f00"
        android:layout_marginLeft="20dp"
        android:id="@+id/text_shopprice"
        />

</LinearLayout>
-分类主页面

public class LiebiaoFragment extends BaseFragment<LiebiaoPresenter> implements LiebiaoContract.View {

    @BindView(R.id.rece_liebiao)
    RecyclerView receLiebiao;
    @BindView(R.id.expan_view)
    ExpandableListView expanView;
    Unbinder unbinder;

    public static LiebiaoFragment newInstance() {
        LiebiaoFragment fragment = new LiebiaoFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(@NonNull AppComponent appComponent) {
        DaggerLiebiaoComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .liebiaoModule(new LiebiaoModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_liebiao, container, false);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

    }


    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {

    }

    @Override
    public void showDataZuo(NewsZuo5 newsZuo5) {

        List<NewsZuo5.DataBean> data = newsZuo5.getData();

        //线性布局
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        receLiebiao.setLayoutManager(linearLayoutManager);
        //创建左侧适配器
        MyLieZuoAdapter myLieZuoAdapter = new MyLieZuoAdapter(getActivity(), data);
        receLiebiao.setAdapter(myLieZuoAdapter);
        myLieZuoAdapter.setOnItemClickListener(new MyLieZuoAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {
                int cid = newsZuo5.getData().get(position).getCid();
                mPresenter.lieyou(cid);
            }
        });
    }

    @Override
    public void showDataYou(NewsYou5 newsYou5) {

        List<NewsYou5.DataBean> data = newsYou5.getData();
        MyLieYouAdapter myLieYouAdapter = new MyLieYouAdapter(getActivity(), newsYou5);
        expanView.setAdapter(myLieYouAdapter);

        int count = expanView.getCount();
        for (int i = 0; i < count; i++) {
            expanView.expandGroup(i);
        }
    }

    @Override
    public void error(String s) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        mPresenter.liezuo();
        mPresenter.lieyou(1);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
-分类左边适配器

public class MyLieZuoAdapter extends RecyclerView.Adapter<MyLieZuoAdapter.LieZuoViewHolder> {
    private Context context;
    private List<NewsZuo5.DataBean> listzuo;
    private OnItemClickListener   mOnItemClickListener;

    public MyLieZuoAdapter(Context context, List<NewsZuo5.DataBean> listzuo) {
        this.context = context;
        this.listzuo = listzuo;
    }

    public interface OnItemClickListener{
        void onItemClick(View view, int position);
    }
    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }

        @NonNull
    @Override
    public LieZuoViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.liezuo_layout, null);
        LieZuoViewHolder lieZuoViewHolder = new LieZuoViewHolder(inflate);
        return lieZuoViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull LieZuoViewHolder holder, int position) {

        holder.text_zuolie.setText(listzuo.get(position).getName());
        if(mOnItemClickListener !=null)
        {
            holder.text_zuolie.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int layoutPosition = holder.getLayoutPosition();
                    mOnItemClickListener.onItemClick(holder.itemView,position);
                }
            });
        }
    }

    @Override
    public int getItemCount() {
        return listzuo.size();
    }

    class LieZuoViewHolder extends RecyclerView.ViewHolder
    {

        private final TextView text_zuolie;

        public LieZuoViewHolder(View itemView) {
            super(itemView);
            text_zuolie = (TextView)itemView.findViewById(R.id.text_zuolie);
        }
    }
}
-分类右边适配器

public class MyLieYouAdapter extends BaseExpandableListAdapter {
    private Context context;
    private NewsYou5 newsYou5;

    public MyLieYouAdapter(Context context, NewsYou5 newsYou5) {
        this.context = context;
        this.newsYou5 = newsYou5;
    }

    @Override
    public int getGroupCount() {
        return newsYou5.getData().size();
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return 1;
    }

    @Override
    public Object getGroup(int groupPosition) {
        return newsYou5.getData().get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return newsYou5.getData().get(groupPosition).getList().get(groupPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        View v = View.inflate(context, R.layout.you_item, null);
        TextView expand_tv = v.findViewById(R.id.text_liebiaoti);
        expand_tv.setText(newsYou5.getData().get(groupPosition).getName());
        return v;
    }

    @Override
    public View getChildView(int i, int i1, boolean isLastChild, View convertView, ViewGroup parent) {
        View v = View.inflate(context, R.layout.youhai_item, null);
        RecyclerView expand_recycler = v.findViewById(R.id.rece_fenlie);
        //网格格式
        GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 3);
        expand_recycler.setLayoutManager(gridLayoutManager);
        //RecyclerView的适配器
        MyReViewAdapter myReViewAdapter = new MyReViewAdapter(context, newsYou5, i, i1);
        expand_recycler.setAdapter(myReViewAdapter);
        return v;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return false;
    }
}
-分类左适配器布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:gravity="center"
        android:text="名字"
        android:layout_gravity="center"
        android:id="@+id/text_zuolie"
        />

</LinearLayout>
-分类右适配器布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="XXX"
        android:id="@+id/text_liebiaoti"
        />

</LinearLayout>
-分类右边适配器嵌套适配器

public class MyReViewAdapter extends RecyclerView.Adapter<MyReViewAdapter.FenLieViewHolder> {

    private Context context;
   private NewsYou5 newsYou5;
    private int i,i1;
    private OnItemClickListener mOnItemClickListener;

    public MyReViewAdapter(Context context, NewsYou5 newsYou5, int i, int i1) {
        this.context = context;
        this.newsYou5 = newsYou5;
        this.i = i;
        this.i1 = i1;
    }

    //点击事件
    public interface OnItemClickListener{
        void onItemClick(View view, int position);
    }
    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener){
        this.mOnItemClickListener = mOnItemClickListener;
    }


    @NonNull
    @Override
    public FenLieViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = View.inflate(context, R.layout.zhanshi_item, null);
        FenLieViewHolder fenLieViewHolder = new FenLieViewHolder(v);
        return fenLieViewHolder;

    }

    @Override
    public void onBindViewHolder(@NonNull FenLieViewHolder holder, int position) {

        holder.text_zhanshi.setText(newsYou5.getData().get(i).getName());
        Uri parse = Uri.parse(newsYou5.getData().get(i).getList().get(0).getIcon());
        holder.simp_zhanshi.setImageURI(parse);

        if(mOnItemClickListener!=null)
        {
            holder.simp_zhanshi.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    int layoutPosition = holder.getLayoutPosition();

                    mOnItemClickListener.onItemClick(holder.itemView,position);
                }
            });
        }

    }

    @Override
    public int getItemCount() {
        return newsYou5.getData().get(i).getList().size();
    }

    class FenLieViewHolder extends RecyclerView.ViewHolder
    {

        private final SimpleDraweeView simp_zhanshi;
        private final TextView text_zhanshi;

        public FenLieViewHolder(View itemView) {
            super(itemView);
            simp_zhanshi = (SimpleDraweeView)itemView.findViewById(R.id.simp_zhanshi);
            text_zhanshi = (TextView)itemView.findViewById(R.id.text_zhanshi);
        }
    }
}
-分类右边适配器嵌套适配器布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="60dp"
        android:layout_height="60dp"
        app:placeholderImage="@mipmap/ic_launcher"
        android:id="@+id/simp_zhanshi"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="xxx"
        android:id="@+id/text_zhanshi"
        android:layout_marginLeft="15dp"
        />

</LinearLayout>
-分类右适配器嵌套布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/rece_fenlie"
        />

</LinearLayout>
-购物车主页面

public class ShopFragmentFragment extends BaseFragment<ShopFragmentPresenter> implements ShopFragmentContract.View {

    Unbinder unbinder;
    @BindView(R.id.rece_shop)
    RecyclerView receShop;
    @BindView(R.id.check_all)
    CheckBox checkAll;
    @BindView(R.id.text_zongjia)
    TextView textZongjia;
    @BindView(R.id.btn_tijiao)
    Button btnTijiao;
    private News4 news4;
    private MyWaiAdapter myWaiAdapter;
    private int b;


    public static ShopFragmentFragment newInstance() {
        ShopFragmentFragment fragment = new ShopFragmentFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(@NonNull AppComponent appComponent) {
        DaggerShopFragmentComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .shopFragmentModule(new ShopFragmentModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_shop, container, false);
    }


    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        mPresenter.shoping();
    }


    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        //注册eventbus
        // EventBus.getDefault().register(getActivity());
        mPresenter.shoping();
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @Override
    public void showDatashop(String json) {
        Gson gson = new Gson();
        news4 = gson.fromJson(json, News4.class);
        List<News4.DataBean> data = news4.getData();
        //设置外层条目
        LinearLayoutManager manager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
        myWaiAdapter = new MyWaiAdapter(R.layout.wai_layout, data);
        receShop.setAdapter(myWaiAdapter);
        receShop.setLayoutManager(manager);
        //对适配回调的内容进行监听
        myWaiAdapter.setOnCheckedChangeLisenter(new MyWaiAdapter.OnCheckedChangeLisenter() {
            @Override
            public void onChecked(int layoutPosition, boolean isChecked) {
                //全选条目的标识
                boolean isAllChecked = true;
                //外层条目的判断
                for (int i = 0; i < news4.getData().size(); i++) {
                    boolean checked = news4.getData().get(i).getChecked();
                    //内层条目的判断
                    for (int j = 0; j < news4.getData().get(i).getList().size(); j++) {
                        boolean innerChecked = news4.getData().get(i).getList().get(j).getInnerChecked();
                        isAllChecked = (isAllChecked & checked & innerChecked);
                    }
                }

                checkAll.setChecked(isAllChecked);
                //外层条目
                //outterBean.getData().get(layoutPosition).setOutterChecked(isChecked);
                //刷新适配器
                myWaiAdapter.notifyDataSetChanged();
            }

            public void onOutterIntemChecked(int layoutPosition, boolean checked) {
                news4.getData().get(layoutPosition).setChecked(checked);
                //全选条目的标识
                boolean isAllChecked = true;
                //外层条目的判断
                for (int i = 0; i < news4.getData().size(); i++) {
                    boolean checked1 = news4.getData().get(i).getChecked();
                    //内层条目的判断
                    for (int j = 0; j < news4.getData().get(i).getList().size(); j++) {
                        boolean innerChecked = news4.getData().get(i).getList().get(j).getInnerChecked();
                        isAllChecked = (isAllChecked & checked1 & innerChecked);
                    }
                }

                checkAll.setChecked(isAllChecked);
                //外层条目
                //outterBean.getData().get(layoutPosition).setOutterChecked(isChecked);
                //刷新适配器
                myWaiAdapter.notifyDataSetChanged();
            }
        });
    }


    @Override
    public void error(String s) {

    }

    @OnClick(R.id.check_all)
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.check_all:
                if (checkAll.isChecked()) {
                    //如果全选被选中,最外层的是否选中的状态手动更改为true,刷新适配器
                    for (int i = 0; i < news4.getData().size(); i++) {
                        news4.getData().get(i).setChecked(true);
                        for (int j = 0; j < news4.getData().get(i).getList().size(); j++) {
                            news4.getData().get(i).getList().get(j).setInnerChecked(true);
                        }
                    }
                } else {
                    //如果全选未被选中,最外层的是否选中的状态手动更改为true,刷新适配器
                    for (int i = 0; i < news4.getData().size(); i++) {
                        news4.getData().get(i).setChecked(false);
                        for (int j = 0; j < news4.getData().get(i).getList().size(); j++) {
                            news4.getData().get(i).getList().get(j).setInnerChecked(false);
                        }
                    }
                }
                initview();
                myWaiAdapter.notifyDataSetChanged();
                break;
        }
    }

    //总价
    private void initview() {
        int zong = 0;
        for (int i = 0; i < news4.getData().size(); i++) {
            for (int j = 0; j < news4.getData().get(i).getList().size(); j++) {
                if (news4.getData().get(i).getList().get(j).getInnerChecked()) {
                    zong += news4.getData().get(i).getList().get(j).getPrice() * news4.getData().get(i).getList().get(j).getNum();
                }
            }
        }
        textZongjia.setText("总价是:" + zong);
        myWaiAdapter.notifyDataSetChanged();
    }

    @Override
    public void onStart() {
        super.onStart();
        EventBus.getDefault().register(this);
    }

    @Override
    public void onStop() {
        super.onStop();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(User user) {/* Do something */
        initview();
//        Toast.makeText(getActivity(), "aaa", Toast.LENGTH_SHORT).show();
    }

    ;

    @OnClick(R.id.btn_tijiao)
    public void onViewClicked() {

        Intent intent = new Intent(getActivity(), DingdanActivity.class);
        startActivity(intent);
    }


}
-购物车底部布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rece_shop"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_gravity=""
        android:gravity="center_vertical"
        >

        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="全选"
            android:id="@+id/check_all"
            />

       <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="总价是:¥"
           android:textSize="20sp"
           android:textColor="#f00"
           android:layout_marginLeft="80dp"
           android:layout_marginTop="10dp"
           android:id="@+id/text_zongjia"
           />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="去结算"
            android:textColor="#ffffff"
            android:background="#f00"
            android:textSize="20sp"
            android:id="@+id/btn_tijiao"
            android:layout_alignParentRight="true"
            />

    </RelativeLayout>

</LinearLayout>

-购物车外部适配器

public class MyWaiAdapter extends BaseQuickAdapter<News4.DataBean,BaseViewHolder> {

    private int layoutPosition;
    private List<News4.DataBean.ListBean> listBeans;
    private MyShopingAdapter myShopingAdapter;


    public interface OnCheckedChangeLisenter {
        void onChecked(int layoutPosition, boolean isChecked);
    }

    public void setOnCheckedChangeLisenter(OnCheckedChangeLisenter onCheckedChangeLisenter) {
        this.onCheckedChangeLisenter = onCheckedChangeLisenter;
    }

    private RecyclerView rece_waishop;
    OnCheckedChangeLisenter onCheckedChangeLisenter;

    public MyWaiAdapter(int layoutResId, @Nullable List<News4.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, News4.DataBean item) {

        //当前位置
        layoutPosition = helper.getLayoutPosition();

        //对外层的条目商家信息内容
        helper.setText(R.id.check_waishop,item.getSellerName());
        //对外层的勾选状态
        CheckBox check_waishop = helper.getView(R.id.check_waishop);
        //外层被点击之后及时通过接口回调的形式通知全选/反选按钮
        check_waishop.setOnCheckedChangeListener(null);
        check_waishop.setChecked(item.getChecked());
        check_waishop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean checked = check_waishop.isChecked();
                item.setChecked(checked);
                if(checked)
                {
                    for (int i = 0; i < item.getList().size(); i++) {
                        item.getList().get(i).setInnerChecked(true);
                    }
                }
                else
                {
                    for (int i = 0; i < item.getList().size(); i++) {
                        item.getList().get(i).setInnerChecked(false);
                    }
                }

            }
        });

        /*check_waishop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    item.setChecked(isChecked);
                    if(isChecked)
                    {
                        for (int i = 0; i < item.getList().size(); i++) {
                            item.getList().get(i).setInnerChecked(true);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < item.getList().size(); i++) {
                            item.getList().get(i).setInnerChecked(false);
                        }
                    }

                    onCheckedChangeLisenter.onChecked(helper.getLayoutPosition(),isChecked);
            }
        });*/
        //外层条目的适配器中需获取内层的RecyclerView
        rece_waishop = helper.getView(R.id.rece_waishop);
        //内层的数据源item.getList();
        listBeans = item.getList();
        //需要将数据源设置给适配器
        myShopingAdapter = new MyShopingAdapter(R.layout.shoping_layout, listBeans);
        LinearLayoutManager manager = new LinearLayoutManager(App.getInstance(), LinearLayoutManager.VERTICAL, false);
        rece_waishop.setLayoutManager(manager);
        rece_waishop.setAdapter(myShopingAdapter);
        myShopingAdapter.setOnCheckedChangeLisenter(new MyShopingAdapter.OnCheckedChangeLisenter() {
            @Override
            public void onChecked(int LayoutPosition, boolean isChecked) {
                boolean isAllInnerChecked = true;
                for (int i = 0; i < item.getList().size(); i++) {
                    boolean innerChecked = item.getList().get(i).getInnerChecked();
                    isAllInnerChecked = (isAllInnerChecked & innerChecked);
                }
                check_waishop.setChecked(isAllInnerChecked);
                //外层条目
                item.setChecked(isAllInnerChecked);
                //首先需要更改bean对象的状态,把具体的位置进行回传
                //然后通过接口回到通知调用者,状态发送改变,及时对全选/反选按钮做更新处理
                onCheckedChangeLisenter.onChecked(layoutPosition,isChecked);

            }
        });
    }
}

-购物车外部适配器布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:layout_height="wrap_content">

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="商家1"
        android:id="@+id/check_waishop"
        />
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/rece_waishop"
        />

</LinearLayout>
-购物车内部适配器

public class MyShopingAdapter extends BaseQuickAdapter<News4.DataBean.ListBean,BaseViewHolder> {

    private int shangpinnumber;


    public MyShopingAdapter(int layoutResId, @Nullable List<News4.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, News4.DataBean.ListBean item) {

        helper.setText(R.id.text_biaoti, item.getTitle());
        helper.setText(R.id.text_shopprice,"总价是:"+item.getPrice());
        SimpleDraweeView iv_showIcon = helper.getView(R.id.simp_viewshop);
        //根据|进行切割
        String images = item.getImages();
        String[] splitImages = images.split("\\|");
        //Fresco加载图片
        Uri uri = Uri.parse(splitImages[0]);
        iv_showIcon.setImageURI(uri);
        //从Bean对象去取出勾选状态
        Log.e("getInnerChecked", "item.getInnerChecked():" + item.getInnerChecked());
        helper.setChecked(R.id.check_shang, item.getInnerChecked());
        CheckBox  check_shang = helper.getView(R.id.check_shang);

        check_shang.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //内层的状态更改完
                item.setInnerChecked(check_shang.isChecked());
                //通过接口回调,把状态回显给外层
                onCheckedChangeLisenter.onChecked(helper.getLayoutPosition(),check_shang.isChecked());
            }
        });

        Jiajian jia_jiajian = helper.getView(R.id.jia_jiajian);
        jia_jiajian.setOnNumCallBack(new Jiajian.onNumCallBack() {
            @Override
            public void onShowNum(int number) {
                shangpinnumber = number;
                Toast.makeText(mContext, "number"+number, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void add() {

                item.setNum(item.getNum()+1);
                User user = new User();
                //todo eventbus发送粘性事件
                EventBus.getDefault().postSticky(user);

            }

            @Override
            public void minus() {

                item.setNum(item.getNum()-1);
                User user = new User();
                EventBus.getDefault().postSticky(user);
            }
        });
       // helper.setText(R.id.jia_jiajian,item.getNum()+"");
        Jiajian jiajianView = helper.getView(R.id.jia_jiajian);
        TextView text_number = jiajianView.findViewById(R.id.text_number);
        text_number.setText(item.getNum()+"");
    }

    public interface OnCheckedChangeLisenter {
        void onChecked(int layoutPosition, boolean isChecked);
    }

    public void setOnCheckedChangeLisenter(OnCheckedChangeLisenter onCheckedChangeLisenter) {
        this.onCheckedChangeLisenter = onCheckedChangeLisenter;
    }

    OnCheckedChangeLisenter onCheckedChangeLisenter;
}
-购物车内部适配器布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_height="70dp">

        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/check_shang"
            />

        <com.facebook.drawee.view.SimpleDraweeView
            android:layout_width="70dp"
            android:layout_height="70dp"
            app:placeholderImage="@mipmap/ic_launcher"
            android:id="@+id/simp_viewshop"
            android:layout_marginLeft="40dp"
            />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="展示数据"
            android:id="@+id/text_biaoti"
            android:layout_marginLeft="125dp"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="价格:"
            android:textColor="#f00"
            android:layout_marginLeft="125dp"
            android:layout_marginTop="45dp"
            android:id="@+id/text_shopprice"
            />

        <jingd.bwie.com.jdong.mvp.ui.Jiajian
            android:id="@+id/jia_jiajian"
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_marginRight="13dp"
            android:layout_marginTop="22dp"
            android:gravity="center_vertical"
            />

</RelativeLayout>
-加减器按钮页面

public class Jiajian extends LinearLayout implements View.OnClickListener {
    private Button btn_jian;
    private Button btn_jia;
    private TextView text_number;

    public Jiajian(Context context) {
        super(context);
    }

    public Jiajian(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        LayoutInflater.from(context).inflate(R.layout.jiajian_layout,this);
        btn_jian = (Button)findViewById(R.id.btn_jian);
        btn_jia = (Button)findViewById(R.id.btn_jia);
        text_number = (TextView)findViewById(R.id.text_number);
        btn_jia.setOnClickListener(this);
        btn_jian.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        String s = text_number.getText().toString();
        int number = Integer.parseInt(s);
        switch (v.getId())
        {
            case R.id.btn_jia:
                number+=1;
                text_number.setText(String.valueOf(number));
                if(onNumCallBack!=null)
                {
                    onNumCallBack.add();
                }
                break;
            case R.id.btn_jian:
                if(number<1)
                {
                    Toast.makeText(getContext(), "最小不能小于1", Toast.LENGTH_SHORT).show();
                    return;
                }
                number-=1;
                text_number.setText(String.valueOf(number));
                onNumCallBack.onShowNum(number);
                if(onNumCallBack!=null)
                {
                    onNumCallBack.minus();
                }
                break;
        }
    }
    //接口回调
    public interface onNumCallBack{
        void onShowNum(int number);

        void add();

        void minus();
    }
    onNumCallBack onNumCallBack;

    public void setOnNumCallBack(onNumCallBack onNumCallBack){
        this.onNumCallBack=onNumCallBack;
    }

}
-加减器按钮布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="horizontal"
    android:layout_height="wrap_content">

    <Button
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:background="@drawable/jian"
        android:id="@+id/btn_jian"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="1"
        android:textSize="20sp"
        android:id="@+id/text_number"
        />

    <Button
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:background="@drawable/add"
        android:id="@+id/btn_jia"
        />

</LinearLayout>
-购物车bean1

public static class DataBean {
        /**
         * list : [{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","num":5,"pid":57,"price":5199,"pscid":40,"selected":1,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","num":1,"pid":45,"price":2999,"pscid":39,"selected":0,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"}]
         * sellerName : 商家1
         * sellerid : 1
         */

        private String sellerName;
        private String sellerid;
        private List<ListBean> list;
        private boolean isChecked;

        public boolean getChecked()
        {
            return isChecked;
        }

        public void setChecked(boolean isChecked)
        {
            this.isChecked = isChecked;
        }

-购物车bean2

 public static class ListBean {
            /**
             * bargainPrice : 11800.0
             * createtime : 2017-10-10T17:33:37
             * detailUrl : https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends
             * images : https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg
             * num : 5
             * pid : 57
             * price : 5199.0
             * pscid : 40
             * selected : 1
             * sellerid : 1
             * subhead : 【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统
             * title : 小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银

             */

            private double bargainPrice;
            private String createtime;
            private String detailUrl;
            private String images;
            private int num;
            private int pid;
            private double price;
            private int pscid;
            private int selected;
            private int sellerid;
            private String subhead;
            private String title;
            private boolean innerChecked;

            public boolean getInnerChecked()
            {
                return innerChecked;
            }

            public void setInnerChecked(boolean innerChecked)
            {
                this.innerChecked = innerChecked;
            }

-我的页面

public class MyFragmentFragment extends BaseFragment<MyFragmentPresenter> implements MyFragmentContract.View {

    @BindView(R.id.text_login)
    TextView textLogin;
    Unbinder unbinder;
    @BindView(R.id.simp_my)
    SimpleDraweeView simpMy;
    @BindView(R.id.rece_myview)
    RecyclerView receMyview;
    @BindView(R.id.rece_myjiu)
    RecyclerView receMyjiu;
    @BindView(R.id.btn_shezhi)
    Button btnShezhi;
    private GridLayoutManager gridLayoutManager;
    private MyJiuAdapter myJiuAdapter;

    public static MyFragmentFragment newInstance() {
        MyFragmentFragment fragment = new MyFragmentFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(@NonNull AppComponent appComponent) {
        DaggerMyFragmentComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .myFragmentModule(new MyFragmentModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_my, container, false);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f);
        roundingParams.setRoundAsCircle(true);
        simpMy.getHierarchy().setRoundingParams(roundingParams);
    }


    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        mPresenter.myliebiao();
        mPresenter.jiugongge();
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.text_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.text_login:
                Intent intent = new Intent(getActivity(), LoginActivityActivity.class);
                startActivityForResult(intent, 999);
                break;
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 999 && resultCode == 1) {
            String mobile = data.getExtras().getString("mobile");
            textLogin.setText(mobile);
        } else {
            if (requestCode == 999 && resultCode == 888) {
                String name = data.getExtras().getString("name");
                String iconurl = data.getExtras().getString("iconurl");
                textLogin.setText(name);

                Uri parse = Uri.parse(iconurl);
                simpMy.setImageURI(parse);
            }
        }
    }

    @Override
    public void showDataMy(News3 news3) {
        List<News3.TuijianBean.ListBean> list = news3.getTuijian().getList();
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2, GridLayoutManager.VERTICAL, false);
        receMyview.setLayoutManager(gridLayoutManager);
        MyLieAdapter myLieAdapter = new MyLieAdapter(getActivity(), list);
        receMyview.setAdapter(myLieAdapter);
        myLieAdapter.setOnItemClickLisentener(new MyLieAdapter.onItemClickLisentener() {
            @Override
            public void onItemClick(int layoutPosition) {
                int pid = list.get(layoutPosition).getPid();
                Intent intent = new Intent(getActivity(), ShopMessageActivity.class);
                intent.putExtra("pid", pid + "");
                startActivity(intent);
            }
        });
    }

    @Override
    public void showDataMyjiu(News2 news2) {

        List<News2.DataBean> data = news2.getData();

        gridLayoutManager = new GridLayoutManager(getActivity(), 2, GridLayoutManager.HORIZONTAL, false);
        receMyjiu.setLayoutManager(gridLayoutManager);
        myJiuAdapter = new MyJiuAdapter(getActivity(), data);
        receMyjiu.setAdapter(myJiuAdapter);

    }

    @OnClick(R.id.btn_shezhi)
    public void onViewClicked() {

        Intent intent = new Intent(getActivity(), SheZhiActivity.class);
        startActivity(intent);
    }
}

-登录Activity

public class LoginActivityActivity extends BaseActivity<LoginActivityPresenter> implements LoginActivityContract.View {

    @BindView(R.id.edit_loginphone)
    EditText editLoginphone;
    @BindView(R.id.edit_loginpassword)
    EditText editLoginpassword;
    @BindView(R.id.btn_login)
    Button btnLogin;
    @BindView(R.id.btn_zhuce)
    Button btnZhuce;
    @BindView(R.id.btn_QQ)
    Button btnQQ;
    private String name;
    private String iconurl;
    UMAuthListener authListener = new UMAuthListener() {
        @Override
        public void onStart(SHARE_MEDIA share_media) {

        }

        @Override
        public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {

            Toast.makeText(LoginActivityActivity.this, "成功了", Toast.LENGTH_SHORT).show();
            name = map.get("name");
            iconurl = map.get("iconurl");
            Intent intent2 = new Intent();
            Bundle bundle = new Bundle();
            bundle.putString("name",name);
            bundle.putString("iconurl",iconurl);
            intent2.putExtras(bundle);
            setResult(888,intent2);
            finish();
        }

        @Override
        public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {

            Toast.makeText(LoginActivityActivity.this, "失败了"+throwable.getMessage(), Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onCancel(SHARE_MEDIA share_media, int i) {

            Toast.makeText(LoginActivityActivity.this, "取消了", Toast.LENGTH_SHORT).show();
        }
    };

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerLoginActivityComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .loginActivityModule(new LoginActivityModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_login; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        if (Build.VERSION.SDK_INT >= 23) {
            String[] mPermissionList = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CALL_PHONE, Manifest.permission.READ_LOGS, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SET_DEBUG_APP, Manifest.permission.SYSTEM_ALERT_WINDOW, Manifest.permission.GET_ACCOUNTS, Manifest.permission.WRITE_APN_SETTINGS};
            ActivityCompat.requestPermissions(this, mPermissionList, 123);
        }

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String permissions[], int[] grantResults) {

    }


    @Override
    public void showDataLogin(Newslogin newslogin) {

        String code = newslogin.getCode();
        String msg = newslogin.getMsg();
        if (code.equals("0")) {
            String mobile = newslogin.getData().getMobile();
            Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
            Intent intent = new Intent();
            Bundle bundle = new Bundle();
            bundle.putString("mobile", mobile);
            intent.putExtras(bundle);
            setResult(1, intent);
            finish();
        }
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }

    @OnClick({R.id.btn_login, R.id.btn_zhuce, R.id.btn_QQ})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_login:
                String name = editLoginphone.getText().toString();
                String password = editLoginpassword.getText().toString();
                mPresenter.getLoginMy(name, password);
                break;
            case R.id.btn_zhuce:
                Intent intent = new Intent(LoginActivityActivity.this, ZhuceActivityActivity.class);
                startActivityForResult(intent, 999);
                break;
            case R.id.btn_QQ:
                UMShareAPI.get(this).getPlatformInfo(LoginActivityActivity.this, SHARE_MEDIA.QQ, authListener);
                break;
        }
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
        if(requestCode == 1)
        {
            String name = data.getExtras().getString("name");
            String password = data.getExtras().getString("password");
            editLoginphone.setText(name);
            editLoginpassword.setText(password);
        }
    }

}
-注册activity

public class ZhuceActivityActivity extends BaseActivity<ZhuceActivityPresenter> implements ZhuceActivityContract.View {

    @BindView(R.id.edit_zhucephone)
    EditText editZhucephone;
    @BindView(R.id.edit_zhucepassword)
    EditText editZhucepassword;
    @BindView(R.id.btn_zhu)
    Button btnZhu;
    private String name;
    private String password;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerZhuceActivityComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .zhuceActivityModule(new ZhuceActivityModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_zhuce; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.btn_zhu)
    public void onViewClicked() {

        name = editZhucephone.getText().toString();
        password = editZhucepassword.getText().toString();
        mPresenter.getZhuce(name,password);
    }

    @Override
    public void showDataZhuce(Newszhuce newszhuce) {

        String code = newszhuce.getCode();
        String msg = newszhuce.getMsg();
        if(code.equals("0"))
        {
            Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
            Intent intent = new Intent();
            Bundle bundle = new Bundle();
            bundle.putString("name",name);
            bundle.putString("password",password);
            intent.putExtras(bundle);
            setResult(1,intent);
            finish();
        }
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }
}
-登录布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="登录"
        android:gravity="center"
        />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="请输入手机号"
        android:layout_margin="20dp"
        android:id="@+id/edit_loginphone"
        />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="请输入密码"
        android:layout_margin="20dp"
        android:id="@+id/edit_loginpassword"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:orientation="horizontal"
        >

        <Button
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="登录"
            android:id="@+id/btn_login"
            />

        <Button
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="注册"
            android:id="@+id/btn_zhuce"
            />

    </LinearLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="QQ登录"
        android:id="@+id/btn_QQ"
        android:layout_margin="10dp"
        />

</LinearLayout>

-注册布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="注册"
        android:gravity="center"
        />
    <EditText
        android:id="@+id/edit_zhucephone"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="请输入手机号"
        android:layout_margin="10dp"
        />

    <EditText
        android:id="@+id/edit_zhucepassword"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:hint="请输入密码"
        android:layout_marginTop="20dp"
        android:layout_margin="10dp"
        />

    <Button
        android:id="@+id/btn_zhu"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="50dp"
        android:text="注册"
        />


</LinearLayout>

-我的页面布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@drawable/reg_bg"
        android:layout_weight="3"
        android:orientation="horizontal"
        >

        <Button
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:background="@drawable/shezhi_black_24dp"
            android:id="@+id/btn_shezhi"
            />

       <com.facebook.drawee.view.SimpleDraweeView
           app:roundedCornerRadius="5dp"
           app:roundBottomLeft="false"
           app:roundBottomRight="false"
           app:roundingBorderWidth="1dp"
           android:layout_width="80dp"
           android:layout_height="80dp"
           android:background="@drawable/user"
           android:layout_marginLeft="20dp"
           android:layout_marginTop="80dp"
           android:id="@+id/simp_my" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="登录/注册"
            android:textSize="30sp"
            android:layout_marginTop="105dp"
            android:layout_marginLeft="10dp"
            android:id="@+id/text_login"
            />

    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:id="@+id/rece_myjiu"
        />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:text="为您推荐"
        android:textColor="#f00"
        android:gravity="center"
        android:textSize="20sp"
        android:background="#CCCCCA"
        />

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:id="@+id/rece_myview"
        />

</LinearLayout>

-设置页面

public class SheZhiActivity extends AppCompatActivity {

    @BindView(R.id.simp_tou)
    SimpleDraweeView simpTou;
    @BindView(R.id.edit_riqi)
    EditText editRiqi;
    private Button btn_pai;
    private Button btn_bendi;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_she_zhi);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.simp_tou, R.id.edit_riqi})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.simp_tou:
                AlertDialog.Builder builder = new AlertDialog.Builder(SheZhiActivity.this);
                //创建一个视图
                AlertDialog dialog = builder.create();
                //加载视图
                View view1 = View.inflate(SheZhiActivity.this, R.layout.include4, null);
                dialog.setView(view1);
                btn_pai = view1.findViewById(R.id.btn_pai);
                btn_bendi = view1.findViewById(R.id.btn_bendi);
                btn_pai.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                        startActivityForResult(intent,1);
                    }
                });
                btn_bendi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        //通过隐式跳转的方式
                        Intent intent = new Intent(Intent.ACTION_PICK);
                        //取出相册图片
                        intent.setType("image/*");
                        startActivityForResult(intent,2);
                    }
                });
                dialog.show();
                break;
            case R.id.edit_riqi:
                //不显示键盘
                new DatePickerDialog(SheZhiActivity.this, new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                        editRiqi.setText(String.format("%d-%d-%d", year, monthOfYear + 1, dayOfMonth));
                    }
                }, 2000, 1, 2).show();

                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==1 && resultCode == RESULT_OK)
        {
            Bitmap bitmap = data.getParcelableExtra("data");
            //设置给图片
            simpTou.setImageBitmap(bitmap);
        }
        if(requestCode==2 && resultCode == RESULT_OK)
        {
            Uri uri = data.getData();
            simpTou.setImageURI(uri);
        }
    }
}
-设置布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".mvp.ui.activity.SheZhiActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="个人中心"
        android:gravity="center"
        android:textSize="25sp"
        />

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="头像"
            android:layout_centerVertical="true"
            android:textSize="25sp"
            />

        <com.facebook.drawee.view.SimpleDraweeView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            app:placeholderImage="@mipmap/ic_launcher"
            android:id="@+id/simp_tou"
            />

    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="用户名"
            android:textSize="25sp"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:text="lianhong."
            android:textSize="25sp"
            />

    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="昵称"
            android:textSize="25sp"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:text="脸红"
            android:textSize="25sp"
            />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="性别"
            android:textSize="25sp"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="女"
            android:textSize="25sp"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="出生日期"
            android:textSize="25sp"
            />
        <EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginEnd="13dp"
            android:layout_marginRight="13dp"
            android:background="#fff"
            android:text="2018年8月23日"
            android:id="@+id/edit_riqi"
            />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#909090"
        />

</LinearLayout>

-拍照

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拍照上传"
        android:textSize="20sp"
        android:id="@+id/btn_pai"
        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="本地上传"
        android:textSize="20sp"
        android:id="@+id/btn_bendi"
        />

</LinearLayout>
-数据库

public class App extends BaseApplication {

    private static App app;
    private DaoSession daoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        app = App.this;
        Fresco.initialize(this);
        UMConfigure.init(this,"5b9c6707f29d9873300002ff"
                ,"umeng",UMConfigure.DEVICE_TYPE_PHONE,"");//58edcfeb310c93091c000be2 5965ee00734be40b580001a0
        PlatformConfig.setWeixin("wxdc1e388c3822c80b", "3baf1193c85774b3fd9d18447d76cab0");
        //豆瓣RENREN平台目前只能在服务器端配置
        PlatformConfig.setSinaWeibo("3921700954", "04b48b094faeb16683c32669824ebdad","http://sns.whalecloud.com");
        PlatformConfig.setYixin("yxc0614e80c9304c11b0391514d09f13bf");
        PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
        PlatformConfig.setTwitter("3aIN7fuF685MuZ7jtXkQxalyi", "MK6FEYG63eWcpDFgRYw4w9puJhzDl0tyuqWjZ3M7XJuuG7mMbO");
        PlatformConfig.setAlipay("2015111700822536");
        PlatformConfig.setLaiwang("laiwangd497e70d4", "d497e70d4c3e4efeab1381476bac4c5e");
        PlatformConfig.setPinterest("1439206");
        PlatformConfig.setKakao("e4f60e065048eb031e235c806b31c70f");
        PlatformConfig.setDing("dingoalmlnohc0wggfedpk");
        PlatformConfig.setVKontakte("5764965","5My6SNliAaLxEm3Lyd9J");
        PlatformConfig.setDropbox("oz8v5apet3arcdy","h7p2pjbzkkxt02a");

        //创建数据库
        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "bway");
        SQLiteDatabase db = helper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(db);
        daoSession = daoMaster.newSession();
    }

    public static App getInstance()
    {
        if(app == null)
        {
            app = new App();
        }
        return app;
    }

    public DaoSession daoSession()
    {
        return daoSession;
    }
}
-mservice

public interface MService {

    //轮播
    @GET("ad/getAd")
    Observable<News1> getLunbo();

    //九宫格
    @GET("product/getCatagory")
    Observable<News2> getJiugongge();

    //展示下拉列表
    @GET("ad/getAd")
    Observable<News3> getLiebiao();

    //购物车
    @GET("product/getCarts?uid=71")
    Observable<ResponseBody> getShop();

    //分类左侧
    @GET("product/getCatagory")
    Observable<NewsZuo5> getLiezuo();

    //分类右侧
    @GET("product/getProductCatagory")
    Observable<NewsYou5> getLieyou(@Query("cid")int id);

    //登录
    @GET("user/login?")
    Observable<Newslogin> getMylogin(@Query("mobile") String mobile,@Query("password") String password);

    //注册
    @GET("user/reg")
    Observable<Newszhuce> getMyzhuce(@Query("mobile") String mobile,@Query("password") String password);

    //商品详情
    @GET("product/getProductDetail?")
    Observable<NewsShopmessage> getShopmessage(@Query("pid") String uid);

    //添加购物车
    @GET("product/addCart?")
    Observable<NewsShopadd> getShopadd(@QueryMap Map<String,String> querymap);

    //发现详情页面
    @GET("product/searchProducts?")
    Observable<NewsMessage> getMessage(@Query("keywords") String keywords);

}

-搜索布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        >

        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="请输入关键字"
            android:id="@+id/edit_guanjianzi"
            />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="搜索"
            android:id="@+id/btn_sousuo"
            />

    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="9"
        android:id="@+id/rece_shoplie"
        />

</LinearLayout>

-搜索页面

public class MessageFragmentFragment extends BaseFragment<MessageFragmentPresenter> implements MessageFragmentContract.View {

    @BindView(R.id.edit_guanjianzi)
    EditText editGuanjianzi;
    @BindView(R.id.btn_sousuo)
    Button btnSousuo;
    @BindView(R.id.rece_shoplie)
    RecyclerView receShoplie;
    Unbinder unbinder;

    public static MessageFragmentFragment newInstance() {
        MessageFragmentFragment fragment = new MessageFragmentFragment();
        return fragment;
    }

    @Override
    public void setupFragmentComponent(@NonNull AppComponent appComponent) {
        DaggerMessageFragmentComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .messageFragmentModule(new MessageFragmentModule(this))
                .build()
                .inject(this);
    }

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_message, container, false);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        //mPresenter.getmessage();
    }
    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick(R.id.btn_sousuo)
    public void onViewClicked() {
        String s = editGuanjianzi.getText().toString().trim();
        mPresenter.getmessage(s);
    }

    @Override
    public void showDatafxian(NewsMessage newsMessage) {
        List<NewsMessage.DataBean> data = newsMessage.getData();
        //Toast.makeText(getActivity(), "data:" + data, Toast.LENGTH_SHORT).show();
        LinearLayoutManager manager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
        receShoplie.setLayoutManager(manager);
        MyMessageAdapter myMessageAdapter = new MyMessageAdapter(getActivity(), data);
        receShoplie.setAdapter(myMessageAdapter);
    }
}
-搜索适配器

public class MyMessageAdapter extends RecyclerView.Adapter<MyMessageAdapter.MessageViewHolder> {

    private Context context;
    private List<NewsMessage.DataBean> list;

    public MyMessageAdapter(Context context, List<NewsMessage.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public MessageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.message_layout, null);
        MessageViewHolder messageViewHolder = new MessageViewHolder(inflate);
        return messageViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MessageViewHolder holder, int position) {

        holder.text_name.setText(list.get(position).getTitle());
        String[] splitImages = list.get(position).getImages().split("\\|");
        Uri parse = Uri.parse(splitImages[0]);
        holder.simp_ss.setImageURI(parse);
        holder.text_price.setText(list.get(position).getPrice()+"");
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class MessageViewHolder extends RecyclerView.ViewHolder
    {

        private final SimpleDraweeView simp_ss;
        private final TextView text_price;
        private final TextView text_name;

        public MessageViewHolder(View itemView) {
            super(itemView);
            simp_ss = (SimpleDraweeView)itemView.findViewById(R.id.simp_ss);
            text_name = (TextView)itemView.findViewById(R.id.text_name);
            text_price = (TextView)itemView.findViewById(R.id.text_price);
        }
    }
}
 

-全部依赖

 implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.recker.flybanner:flybanner:1.3'
    implementation 'com.android.support:design:27.1.0'
    // 其他依赖
    implementation 'com.facebook.fresco:fresco:0.12.0'
    // 在 API < 14 上的机器支持 WebP 时,需要添加
    implementation 'com.facebook.fresco:animated-base-support:0.12.0'
    // 支持 GIF 动图,需要添加
    implementation 'com.facebook.fresco:animated-gif:0.12.0'
    // 支持 WebP (静态图+动图),需要添加
    implementation 'com.facebook.fresco:animated-webp:0.12.0'
    implementation 'com.facebook.fresco:webpsupport:0.12.0'
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14'
    implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-14'
    //没有使用特殊Header,可以不加这行
    implementation 'com.google.code.gson:gson:2.2.4'
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
    implementation files('libs/umeng-common-1.5.3.jar')
    implementation files('libs/umeng-share-core-6.9.3.jar')
    implementation files('libs/umeng-share-QQ-simplify-6.9.3.jar')
    implementation files('libs/umeng-shareboard-widget-6.9.3.jar')
    implementation files('libs/umeng-sharetool-6.9.3.jar')
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.trello.rxlifecycle2:rxlifecycle-android-lifecycle:2.2.1'
    implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'
    implementation 'com.fyales.android:library:1.0.2'
    implementation 'org.greenrobot:greendao:3.2.2' // add library

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值