Commit 0a469ad2724d0f914df6588f2dbdbb3d4af05ca7

Authored by 陶汉栋
1 parent 2e8868cb

no message

app/src/main/java/com/shunzhi/parent/api/Consult.java
... ... @@ -15,4 +15,6 @@ public interface Consult {
15 15 @GET("api/ParentService/GetAds")
16 16 Observable<JsonObject> getBanners(@Query("position") String position);
17 17  
  18 +
  19 + Observable<JsonObject> getConsultContent();
18 20 }
... ...
app/src/main/java/com/shunzhi/parent/contract/consult/consultone/ConsultOneContract.java
... ... @@ -22,18 +22,26 @@ public interface ConsultOneContract {
22 22 public abstract void getTools(LinearLayout linearLayout);
23 23  
24 24 public abstract void getBanners(String position);
  25 +
  26 + public abstract void getConsultContent();
25 27 }
26 28  
27 29 interface IConsultOneModel extends IBaseModel{
28 30 void getTools();
29 31  
30 32 Observable<JsonObject> getBanners(String position);
  33 +
  34 + Observable<JsonObject> getConsultContent();
31 35 }
32 36  
33 37 interface IConsultOneView extends IBaseFragment{
34 38 void showTools();
35 39  
36 40 void showBanners(List<GuangGaoBean> guangGaoBeanList);
  41 +
  42 + void showConsultContent();
  43 +
  44 +
37 45 }
38 46  
39 47 }
... ...
app/src/main/java/com/shunzhi/parent/model/consult/consultone/ConsultOneModel.java
... ... @@ -31,4 +31,10 @@ public class ConsultOneModel extends BaseModel implements ConsultOneContract.ICo
31 31 return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL)
32 32 .getBanners(position).compose(RxHelper.<JsonObject>rxSchedulerHelper());
33 33 }
  34 +
  35 + @Override
  36 + public Observable<JsonObject> getConsultContent() {
  37 + return RetrofitCreateHelper.getInstance().createApi(Consult.class,AppConfig.BASE_URL)
  38 + .getConsultContent().compose(RxHelper.<JsonObject>rxSchedulerHelper());
  39 + }
34 40 }
... ...
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
... ... @@ -79,6 +79,11 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{
79 79 }
80 80  
81 81 @Override
  82 + public void getConsultContent() {
  83 +
  84 + }
  85 +
  86 + @Override
82 87 public ConsultOneContract.IConsultOneModel getModel() {
83 88 return ConsultOneModel.newInstance();
84 89 }
... ...
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
... ... @@ -30,13 +30,6 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi
30 30  
31 31 EditText et_search;
32 32  
33   - TextView tvContentName;
34   -
35   - RecyclerView recyclerView;
36   -
37   - MyConsultAdapter myConsultAdapter = null;
38   -
39   - List<MyConsultBean> myConsultBeanList = new ArrayList<>();
40 33  
41 34 @Override
42 35 protected void initView(Bundle savedInstanceState) {
... ... @@ -59,28 +52,8 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi
59 52 ivSearch = findViewById(R.id.ivSearch);
60 53 ivSearch.setOnClickListener(this);
61 54  
62   - tvContentName = findViewById(R.id.tvContentName);
63   - tvContentName.setText("");
64   -
65   - recyclerView = findViewById(R.id.recyclerView);
66   -
67   - initRecyclerView();
68 55 }
69 56  
70   - private void initRecyclerView() {
71   -
72   - if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(this);
73   - for (int i = 0; i < 12; i++) {
74   - MyConsultBean myConsultBean = new MyConsultBean();
75   - myConsultBean.consultCounts = i + "";
76   - myConsultBean.consultContent = "咨询内容" + i;
77   - myConsultBean.consultTitle = "咨询标题" + i;
78   - myConsultBean.consultZhuanfaCounts = "转发:" + i;
79   - myConsultBeanList.add(myConsultBean);
80   - }
81   - myConsultAdapter.addAll(myConsultBeanList);
82   - recyclerView.setAdapter(myConsultAdapter);
83   - }
84 57  
85 58 @NonNull
86 59 @Override
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +package com.shunzhi.parent.ui.fragment.consult;
  2 +
  3 +import android.content.Context;
  4 +import android.net.Uri;
  5 +import android.os.Bundle;
  6 +import android.support.annotation.NonNull;
  7 +import android.support.annotation.Nullable;
  8 +import android.support.v4.app.Fragment;
  9 +import android.support.v7.widget.RecyclerView;
  10 +import android.view.LayoutInflater;
  11 +import android.view.View;
  12 +import android.view.ViewGroup;
  13 +import android.widget.TextView;
  14 +
  15 +import com.share.mvpsdk.base.BasePresenter;
  16 +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
  17 +import com.shunzhi.parent.R;
  18 +import com.shunzhi.parent.adapter.MyConsultAdapter;
  19 +import com.shunzhi.parent.bean.GuangGaoBean;
  20 +import com.shunzhi.parent.bean.MyConsultBean;
  21 +import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract;
  22 +import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter;
  23 +
  24 +import java.util.ArrayList;
  25 +import java.util.List;
  26 +
  27 +/**
  28 + */
  29 +public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter,
  30 + ConsultOneContract.IConsultOneModel> implements ConsultOneContract.IConsultOneView {
  31 +
  32 +
  33 + TextView tvContentName;
  34 +
  35 + RecyclerView recyclerView;
  36 +
  37 + MyConsultAdapter myConsultAdapter = null;
  38 +
  39 + List<MyConsultBean> myConsultBeanList = new ArrayList<>();
  40 +
  41 + @Override
  42 + public int getLayoutId() {
  43 + return R.layout.fragment_consult_two_level;
  44 + }
  45 +
  46 + @Override
  47 + public void initUI(View view, @Nullable Bundle savedInstanceState) {
  48 + tvContentName = view.findViewById(R.id.tvContentName);
  49 + tvContentName.setText("");
  50 +
  51 + recyclerView = view.findViewById(R.id.recyclerView);
  52 +
  53 + initRecyclerView();
  54 + }
  55 +
  56 + private void initRecyclerView() {
  57 +
  58 + if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity());
  59 + for (int i = 0; i < 12; i++) {
  60 + MyConsultBean myConsultBean = new MyConsultBean();
  61 + myConsultBean.consultCounts = i + "";
  62 + myConsultBean.consultContent = "咨询内容" + i;
  63 + myConsultBean.consultTitle = "咨询标题" + i;
  64 + myConsultBean.consultZhuanfaCounts = "转发:" + i;
  65 + myConsultBeanList.add(myConsultBean);
  66 + }
  67 + myConsultAdapter.addAll(myConsultBeanList);
  68 + recyclerView.setAdapter(myConsultAdapter);
  69 + }
  70 +
  71 + @NonNull
  72 + @Override
  73 + public BasePresenter initPresenter() {
  74 + return new ConsultOnePresenter();
  75 + }
  76 +
  77 + @Override
  78 + public void showTools() {
  79 +
  80 + }
  81 +
  82 + @Override
  83 + public void showBanners(List<GuangGaoBean> guangGaoBeanList) {
  84 +
  85 + }
  86 +
  87 + /**
  88 + * 显示咨询内容
  89 + */
  90 + @Override
  91 + public void showConsultContent() {
  92 +
  93 + }
  94 +}
... ...
app/src/main/res/layout/activity_consult_two_level.xml
... ... @@ -9,23 +9,5 @@
9 9 tools:context="com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity">
10 10  
11 11 <include layout="@layout/layout_search_back"/>
12   -<TextView
13   - android:layout_width="match_parent"
14   - android:layout_height="wrap_content"
15   - android:textSize="@dimen/textSize16"
16   - android:textColor="@color/textColor"
17   - android:text="政策咨询"
18   - android:gravity="center"
19   - android:id="@+id/tvContentName"
20   - android:paddingTop="@dimen/size_dp_5"
21   - android:paddingBottom="@dimen/size_dp_5"
22   - />
23   -
24   - <android.support.v7.widget.RecyclerView
25   - android:layout_marginLeft="@dimen/size_dp_10"
26   - android:layout_marginRight="@dimen/size_dp_10"
27   - android:id="@+id/recyclerView"
28   - android:layout_width="match_parent"
29   - android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
30 12  
31 13 </LinearLayout>
... ...
app/src/main/res/layout/fragment_consult_two_level.xml 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:orientation="vertical"
  5 + android:layout_height="match_parent"
  6 + tools:context="com.shunzhi.parent.ui.fragment.consult.ConsultTwoLevelFragment">
  7 +
  8 + <TextView
  9 + android:layout_width="match_parent"
  10 + android:layout_height="wrap_content"
  11 + android:textSize="@dimen/textSize16"
  12 + android:textColor="@color/textColor"
  13 + android:text="政策咨询"
  14 + android:gravity="center"
  15 + android:id="@+id/tvContentName"
  16 + android:paddingTop="@dimen/size_dp_5"
  17 + android:paddingBottom="@dimen/size_dp_5"
  18 + />
  19 +
  20 + <android.support.v7.widget.RecyclerView
  21 + android:layout_marginLeft="@dimen/size_dp_10"
  22 + android:layout_marginRight="@dimen/size_dp_10"
  23 + android:id="@+id/recyclerView"
  24 + android:layout_width="match_parent"
  25 + android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
  26 +
  27 +
  28 +</>
... ...