Commit b452c5b0bf47aa7c66d25019c2f54b39bb0ed0ea
1 parent
9ffe80e9
Exists in
yxb_dev
and in
2 other branches
no message
Showing
3 changed files
with
15 additions
and
34 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
| @@ -64,6 +64,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | @@ -64,6 +64,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | ||
| 64 | mRxManager.register(mIModel.getBanners(position,areaName).subscribe(new Consumer<JsonObject>() { | 64 | mRxManager.register(mIModel.getBanners(position,areaName).subscribe(new Consumer<JsonObject>() { |
| 65 | @Override | 65 | @Override |
| 66 | public void accept(JsonObject jsonObject) throws Exception { | 66 | public void accept(JsonObject jsonObject) throws Exception { |
| 67 | + Log.d("66666","getBanners="+jsonObject); | ||
| 67 | if (jsonObject.get("status").getAsString().equals("1")){ | 68 | if (jsonObject.get("status").getAsString().equals("1")){ |
| 68 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); | 69 | JsonArray jsonArray=jsonObject.getAsJsonArray("data"); |
| 69 | List<GuangGaoBean> guangGaoBeanList=new ArrayList<>(); | 70 | List<GuangGaoBean> guangGaoBeanList=new ArrayList<>(); |
| @@ -89,7 +90,6 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | @@ -89,7 +90,6 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | ||
| 89 | mRxManager.register(mIModel.getConsultContent(areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { | 90 | mRxManager.register(mIModel.getConsultContent(areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { |
| 90 | @Override | 91 | @Override |
| 91 | public void accept(JsonObject jsonObject) throws Exception { | 92 | public void accept(JsonObject jsonObject) throws Exception { |
| 92 | -// ToastUtils.showToast(jsonObject.toString()); | ||
| 93 | JsonObject json=jsonObject.getAsJsonObject("data"); | 93 | JsonObject json=jsonObject.getAsJsonObject("data"); |
| 94 | Gson g=new Gson(); | 94 | Gson g=new Gson(); |
| 95 | ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | 95 | ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
| @@ -53,7 +53,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -53,7 +53,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | List<ChannelContextBean> myConsultBeanList = new ArrayList<>(); | 55 | List<ChannelContextBean> myConsultBeanList = new ArrayList<>(); |
| 56 | - boolean first=true; | ||
| 57 | 56 | ||
| 58 | String channel = ""; | 57 | String channel = ""; |
| 59 | int pageIndex; | 58 | int pageIndex; |
| @@ -90,11 +89,11 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -90,11 +89,11 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 90 | 89 | ||
| 91 | private void initViews(View view) { | 90 | private void initViews(View view) { |
| 92 | channel = getArguments().getString("channel"); | 91 | channel = getArguments().getString("channel"); |
| 93 | - ToastUtils.showToast(channel); | ||
| 94 | layout_control = view.findViewById(R.id.layout_control); | 92 | layout_control = view.findViewById(R.id.layout_control); |
| 95 | layout_control.measure(0, 0); | 93 | layout_control.measure(0, 0); |
| 96 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); | 94 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); |
| 97 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); | 95 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); |
| 96 | + | ||
| 98 | recyclerViewConsultOne.setLayoutManager(new LinearLayoutManager(getActivity())); | 97 | recyclerViewConsultOne.setLayoutManager(new LinearLayoutManager(getActivity())); |
| 99 | recyclerViewConsultOne.setLoadingListener(new XRecyclerView.LoadingListener() { | 98 | recyclerViewConsultOne.setLoadingListener(new XRecyclerView.LoadingListener() { |
| 100 | @Override | 99 | @Override |
| @@ -117,7 +116,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -117,7 +116,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 117 | pageIndex = 1; | 116 | pageIndex = 1; |
| 118 | mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex); | 117 | mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex); |
| 119 | 118 | ||
| 120 | - mPresenter.getBanners("3", AppContext.getInstance().district); | 119 | + mPresenter.getBanners("4", AppContext.getInstance().district); |
| 121 | 120 | ||
| 122 | } | 121 | } |
| 123 | 122 |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java
| @@ -37,7 +37,8 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -37,7 +37,8 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 37 | List<ChannelContextBean> myConsultBeanList = new ArrayList<>(); | 37 | List<ChannelContextBean> myConsultBeanList = new ArrayList<>(); |
| 38 | 38 | ||
| 39 | int pageIndex = 1; | 39 | int pageIndex = 1; |
| 40 | - String channel="",titleName; | 40 | + String channel = "", titleName; |
| 41 | + | ||
| 41 | @Override | 42 | @Override |
| 42 | public int getLayoutId() { | 43 | public int getLayoutId() { |
| 43 | return R.layout.fragment_consult_two_level; | 44 | return R.layout.fragment_consult_two_level; |
| @@ -47,10 +48,10 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -47,10 +48,10 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 47 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 48 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 48 | tvContentName = view.findViewById(R.id.tvContentName); | 49 | tvContentName = view.findViewById(R.id.tvContentName); |
| 49 | tvContentName.setText(getArguments().getString("titleName")); | 50 | tvContentName.setText(getArguments().getString("titleName")); |
| 50 | - channel=getArguments().getString("channel"); | 51 | + channel = getArguments().getString("channel"); |
| 51 | recyclerView = view.findViewById(R.id.recyclerView); | 52 | recyclerView = view.findViewById(R.id.recyclerView); |
| 52 | 53 | ||
| 53 | - mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel),0,1); | 54 | + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, 1); |
| 54 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); | 55 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); |
| 55 | recyclerView.setLoadingListener(new XRecyclerView.LoadingListener() { | 56 | recyclerView.setLoadingListener(new XRecyclerView.LoadingListener() { |
| 56 | @Override | 57 | @Override |
| @@ -76,21 +77,6 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -76,21 +77,6 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 76 | // initRecyclerView(); | 77 | // initRecyclerView(); |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | -// private void initRecyclerView() { | ||
| 80 | -// | ||
| 81 | -// if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); | ||
| 82 | -// for (int i = 0; i < 12; i++) { | ||
| 83 | -// MyConsultBean myConsultBean = new MyConsultBean(); | ||
| 84 | -// myConsultBean.consultCounts = i + ""; | ||
| 85 | -// myConsultBean.consultContent = "咨询内容" + i; | ||
| 86 | -// myConsultBean.consultTitle = "咨询标题" + i; | ||
| 87 | -// myConsultBean.consultZhuanfaCounts = "转发:" + i; | ||
| 88 | -// myConsultBeanList.add(myConsultBean); | ||
| 89 | -// } | ||
| 90 | -// myConsultAdapter.addAll(myConsultBeanList); | ||
| 91 | -// recyclerView.setAdapter(myConsultAdapter); | ||
| 92 | -// } | ||
| 93 | - | ||
| 94 | @NonNull | 80 | @NonNull |
| 95 | @Override | 81 | @Override |
| 96 | public BasePresenter initPresenter() { | 82 | public BasePresenter initPresenter() { |
| @@ -103,21 +89,17 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -103,21 +89,17 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
| 103 | } | 89 | } |
| 104 | 90 | ||
| 105 | @Override | 91 | @Override |
| 106 | - public void showBanners(List<GuangGaoBean> guangGaoBeanList) { | ||
| 107 | - | 92 | + public void showConsultContent(List<ChannelContextBean> list) { |
| 93 | + myConsultBeanList.clear(); | ||
| 94 | + myConsultBeanList.addAll(list); | ||
| 95 | + if (myConsultAdapter == null) myConsultAdapter = new MyConsultAdapter(getActivity()); | ||
| 96 | + if (null == recyclerView.getAdapter()) recyclerView.setAdapter(myConsultAdapter); | ||
| 97 | + myConsultAdapter.addAll(myConsultBeanList); | ||
| 108 | } | 98 | } |
| 109 | 99 | ||
| 110 | @Override | 100 | @Override |
| 111 | - public void showConsultContent(List<ChannelContextBean> list) { | ||
| 112 | - myConsultBeanList.addAll(list); | ||
| 113 | - if (myConsultAdapter == null) { | ||
| 114 | - myConsultAdapter = new MyConsultAdapter(getActivity()); | ||
| 115 | - myConsultAdapter.addAll(myConsultBeanList); | ||
| 116 | - recyclerView.setAdapter(myConsultAdapter); | ||
| 117 | - } else { | ||
| 118 | - myConsultAdapter.addAll(myConsultBeanList); | ||
| 119 | - myConsultAdapter.notifyDataSetChanged(); | ||
| 120 | - } | 101 | + public void showBanners(List<GuangGaoBean> guangGaoBeanList) { |
| 102 | + | ||
| 121 | } | 103 | } |
| 122 | 104 | ||
| 123 | @Override | 105 | @Override |