Commit 9ffe80e9b1f7a3f7fefb7a54725b57191f7fb1d7

Authored by 陶汉栋
2 parents 9ef200d2 ae079afc

no message

app/src/main/java/com/shunzhi/parent/AppContext.java
@@ -3,18 +3,17 @@ package com.shunzhi.parent; @@ -3,18 +3,17 @@ package com.shunzhi.parent;
3 import android.content.Context; 3 import android.content.Context;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.content.SharedPreferences; 5 import android.content.SharedPreferences;
6 -import android.util.Log;  
7 6
8 import com.amap.api.location.AMapLocation; 7 import com.amap.api.location.AMapLocation;
9 import com.amap.api.location.AMapLocationClient; 8 import com.amap.api.location.AMapLocationClient;
10 import com.amap.api.location.AMapLocationClientOption; 9 import com.amap.api.location.AMapLocationClientOption;
  10 +import com.amap.api.location.AMapLocationClientOption.AMapLocationMode;
11 import com.amap.api.location.AMapLocationListener; 11 import com.amap.api.location.AMapLocationListener;
12 import com.netease.nimlib.sdk.NIMClient; 12 import com.netease.nimlib.sdk.NIMClient;
13 import com.netease.nimlib.sdk.SDKOptions; 13 import com.netease.nimlib.sdk.SDKOptions;
14 import com.netease.nimlib.sdk.StatusBarNotificationConfig; 14 import com.netease.nimlib.sdk.StatusBarNotificationConfig;
15 import com.netease.nimlib.sdk.auth.LoginInfo; 15 import com.netease.nimlib.sdk.auth.LoginInfo;
16 import com.share.mvpsdk.global.GlobalApplication; 16 import com.share.mvpsdk.global.GlobalApplication;
17 -import com.amap.api.location.AMapLocationClientOption.AMapLocationMode;  
18 17
19 /** 18 /**
20 * Created by Administrator on 2018/3/7 0007. 19 * Created by Administrator on 2018/3/7 0007.
@@ -137,7 +136,8 @@ public class AppContext extends GlobalApplication { @@ -137,7 +136,8 @@ public class AppContext extends GlobalApplication {
137 sendBroadcast(intent); 136 sendBroadcast(intent);
138 stopLocation(); 137 stopLocation();
139 } else { 138 } else {
140 - cityName = "定位失败"; 139 + cityName = "定位失败";district="定位失败";
  140 +
141 // Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); 141 // Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo());
142 } 142 }
143 143
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
@@ -2,25 +2,20 @@ package com.shunzhi.parent.ui.activity.consult; @@ -2,25 +2,20 @@ package com.shunzhi.parent.ui.activity.consult;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.content.Intent; 4 import android.content.Intent;
5 -import android.support.annotation.NonNull;  
6 import android.os.Bundle; 5 import android.os.Bundle;
7 -import android.support.v7.widget.RecyclerView; 6 +import android.support.annotation.NonNull;
  7 +import android.support.v4.app.FragmentTransaction;
8 import android.view.View; 8 import android.view.View;
9 import android.widget.EditText; 9 import android.widget.EditText;
10 import android.widget.FrameLayout; 10 import android.widget.FrameLayout;
11 import android.widget.ImageView; 11 import android.widget.ImageView;
12 -import android.widget.TextView;  
13 12
14 import com.share.mvpsdk.base.BasePresenter; 13 import com.share.mvpsdk.base.BasePresenter;
15 import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; 14 import com.share.mvpsdk.base.activity.BaseMVPCompatActivity;
  15 +import com.share.mvpsdk.utils.ToastUtils;
16 import com.shunzhi.parent.R; 16 import com.shunzhi.parent.R;
17 -import com.shunzhi.parent.adapter.MyConsultAdapter;  
18 -import com.shunzhi.parent.bean.MyConsultBean;  
19 import com.shunzhi.parent.ui.fragment.consult.ConsultTwoLevelFragment; 17 import com.shunzhi.parent.ui.fragment.consult.ConsultTwoLevelFragment;
20 18
21 -import java.util.ArrayList;  
22 -import java.util.List;  
23 -  
24 public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener { 19 public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener {
25 20
26 public static void getInstance(Context context,String channel,String titleName){ 21 public static void getInstance(Context context,String channel,String titleName){
@@ -36,9 +31,12 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi @@ -36,9 +31,12 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi
36 31
37 String channel,titleName; 32 String channel,titleName;
38 33
39 - FrameLayout frame_consult_two; 34 + FrameLayout frame_consult;
  35 +
  36 + ConsultTwoLevelFragment consultTwoLevelFragment;
  37 +
  38 + FragmentTransaction fragmentTransaction=null;
40 39
41 - ConsultTwoLevelFragment consultTwoLevelFragment=null;  
42 @Override 40 @Override
43 protected void initView(Bundle savedInstanceState) { 41 protected void initView(Bundle savedInstanceState) {
44 initViews(); 42 initViews();
@@ -55,19 +53,23 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi @@ -55,19 +53,23 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi
55 titleName=getIntent().getStringExtra("titleName"); 53 titleName=getIntent().getStringExtra("titleName");
56 ivBack = findViewById(R.id.ivBack); 54 ivBack = findViewById(R.id.ivBack);
57 ivBack.setOnClickListener(this); 55 ivBack.setOnClickListener(this);
58 - frame_consult_two=findViewById(R.id.frame_consult_two);  
59 56
60 et_search = findViewById(R.id.et_search); 57 et_search = findViewById(R.id.et_search);
  58 + consultTwoLevelFragment=new ConsultTwoLevelFragment();
  59 + et_search=findViewById(R.id.et_search);
  60 + ivSearch=findViewById(R.id.ivSearch);
  61 + ivBack=findViewById(R.id.ivBack);
  62 + frame_consult=findViewById(R.id.frame_consult);
61 63
62 - ivSearch = findViewById(R.id.ivSearch);  
63 ivSearch.setOnClickListener(this); 64 ivSearch.setOnClickListener(this);
  65 + ivBack.setOnClickListener(this);
64 66
65 - consultTwoLevelFragment=new ConsultTwoLevelFragment();  
66 Bundle bundle=new Bundle(); 67 Bundle bundle=new Bundle();
67 bundle.putString("channel",channel); 68 bundle.putString("channel",channel);
68 bundle.putString("titleName",titleName); 69 bundle.putString("titleName",titleName);
69 consultTwoLevelFragment.setArguments(bundle); 70 consultTwoLevelFragment.setArguments(bundle);
70 - getSupportFragmentManager().beginTransaction().add(R.id.frame_consult_two,consultTwoLevelFragment) 71 + fragmentTransaction=getSupportFragmentManager().beginTransaction();
  72 + fragmentTransaction.add(R.id.frame_consult,consultTwoLevelFragment)
71 .show(consultTwoLevelFragment).commit(); 73 .show(consultTwoLevelFragment).commit();
72 74
73 } 75 }
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -8,13 +8,14 @@ import android.os.Bundle; @@ -8,13 +8,14 @@ import android.os.Bundle;
8 import android.support.annotation.NonNull; 8 import android.support.annotation.NonNull;
9 import android.support.annotation.Nullable; 9 import android.support.annotation.Nullable;
10 import android.support.v7.widget.LinearLayoutManager; 10 import android.support.v7.widget.LinearLayoutManager;
11 -import android.support.v7.widget.RecyclerView; 11 +import android.util.Log;
12 import android.view.View; 12 import android.view.View;
13 import android.widget.ImageView; 13 import android.widget.ImageView;
14 import android.widget.LinearLayout; 14 import android.widget.LinearLayout;
15 import android.widget.TextView; 15 import android.widget.TextView;
16 16
17 import com.bumptech.glide.Glide; 17 import com.bumptech.glide.Glide;
  18 +import com.jcodecraeer.xrecyclerview.XRecyclerView;
18 import com.share.mvpsdk.base.BasePresenter; 19 import com.share.mvpsdk.base.BasePresenter;
19 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; 20 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
20 import com.shunzhi.parent.AppConfig; 21 import com.shunzhi.parent.AppConfig;
@@ -46,7 +47,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -46,7 +47,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
46 47
47 XBanner xBanner; 48 XBanner xBanner;
48 49
49 - RecyclerView recycler_context; 50 + XRecyclerView recycler_context;
50 51
51 ContextAdapter contextAdapter; 52 ContextAdapter contextAdapter;
52 53
@@ -62,6 +63,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -62,6 +63,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
62 63
63 CityPicker cityPicker = null; 64 CityPicker cityPicker = null;
64 65
  66 + int pageIndex = 1;
  67 + boolean first = true;
  68 +
65 @Override 69 @Override
66 public int getLayoutId() { 70 public int getLayoutId() {
67 return R.layout.fragment_zi_xun; 71 return R.layout.fragment_zi_xun;
@@ -79,14 +83,14 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -79,14 +83,14 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
79 tvLocalAddress = view.findViewById(R.id.tvLocalAddress); 83 tvLocalAddress = view.findViewById(R.id.tvLocalAddress);
80 layout_control = view.findViewById(R.id.layout_control); 84 layout_control = view.findViewById(R.id.layout_control);
81 85
82 - tvLocalAddress.setText(AppContext.getInstance().cityName); 86 + tvLocalAddress.setText(AppContext.getInstance().district);
83 videoplayer.batteryLevel.setVisibility(View.GONE); 87 videoplayer.batteryLevel.setVisibility(View.GONE);
84 videoplayer.replayTextView.setVisibility(View.GONE); 88 videoplayer.replayTextView.setVisibility(View.GONE);
85 videoplayer.backButton.setVisibility(View.GONE); 89 videoplayer.backButton.setVisibility(View.GONE);
86 90
87 // mPresenter.getTools(layout_control); 91 // mPresenter.getTools(layout_control);
88 mPresenter.getBanners("2", AppContext.getInstance().district); 92 mPresenter.getBanners("2", AppContext.getInstance().district);
89 - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, 1); 93 +
90 94
91 initBroadCast(); 95 initBroadCast();
92 96
@@ -95,8 +99,27 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -95,8 +99,27 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
95 99
96 private void initRecycler() { 100 private void initRecycler() {
97 recycler_context.setLayoutManager(new LinearLayoutManager(getActivity())); 101 recycler_context.setLayoutManager(new LinearLayoutManager(getActivity()));
98 - contextAdapter = new ContextAdapter(getActivity()); 102 +// contextAdapter = new ContextAdapter(getActivity());
  103 + recycler_context.setLoadingListener(new XRecyclerView.LoadingListener() {
  104 + @Override
  105 + public void onRefresh() {
  106 + //refresh data here
  107 + pageIndex = 1;
  108 + contextList.clear();
  109 + mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex);
  110 + recycler_context.refreshComplete();
  111 + }
99 112
  113 + @Override
  114 + public void onLoadMore() {
  115 + // load more data here
  116 + pageIndex = pageIndex + 1;
  117 + mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex);
  118 + recycler_context.refreshComplete();
  119 + }
  120 + });
  121 + pageIndex = 1;
  122 + mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex);
100 } 123 }
101 124
102 private void initListeners() { 125 private void initListeners() {
@@ -117,7 +140,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -117,7 +140,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
117 xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() { 140 xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() {
118 @Override 141 @Override
119 public void onItemClick(XBanner banner, int position) { 142 public void onItemClick(XBanner banner, int position) {
120 - WebViewActivity.getInstance(getContext(),imgesUrl.get(position),-1); 143 + WebViewActivity.getInstance(getContext(), imgesUrl.get(position), -1);
121 } 144 }
122 }); 145 });
123 146
@@ -174,7 +197,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -174,7 +197,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
174 @Override 197 @Override
175 public void onReceive(Context context, Intent intent) { 198 public void onReceive(Context context, Intent intent) {
176 if (intent.getAction().equals(AppContext.LOCATION_CITYNAME + "")) { 199 if (intent.getAction().equals(AppContext.LOCATION_CITYNAME + "")) {
177 - tvLocalAddress.setText(AppContext.getInstance().cityName); 200 + tvLocalAddress.setText(AppContext.getInstance().district);
178 } 201 }
179 } 202 }
180 }; 203 };
@@ -202,47 +225,53 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu @@ -202,47 +225,53 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu
202 225
203 @Override 226 @Override
204 public void showChannel(final List<ChannelBean> list) { 227 public void showChannel(final List<ChannelBean> list) {
205 - for (int i = 0; i < list.size(); i++) {  
206 - TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity());  
207 - textAndImgShowView.setTextColor(R.color.textColor);  
208 - textAndImgShowView.setText(list.get(i).getChannelName()); 228 + if (first) {
  229 + layout_control.removeAllViews();
  230 + for (int i = 0; i < list.size(); i++) {
  231 + TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity());
  232 + textAndImgShowView.setTextColor(R.color.textColor);
  233 + textAndImgShowView.setText(list.get(i).getChannelName());
209 // textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(list.get(i).getChannelImage())); 234 // textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(list.get(i).getChannelImage()));
210 - textAndImgShowView.addImgs(list.get(i).getChannelImage());  
211 - textAndImgShowView.setSelect(true);  
212 - textAndImgShowView.setWidth(getActivity(), layout_control);  
213 - textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0));  
214 - textAndImgShowView.setTag(list.get(i));  
215 - textAndImgShowView.setOnClickListener(new View.OnClickListener() {  
216 - @Override  
217 - public void onClick(View view) {  
218 - ChannelBean channelBean= (ChannelBean) view.getTag();  
219 - ConsultOneLevelActivity.getInstance(getActivity(),channelBean.getId()+"");  
220 - }  
221 - });  
222 - layout_control.addView(textAndImgShowView); 235 + textAndImgShowView.addImgs(list.get(i).getChannelImage());
  236 + textAndImgShowView.setSelect(true);
  237 + textAndImgShowView.setWidth(getActivity(), layout_control);
  238 + textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0));
  239 + textAndImgShowView.setTag(list.get(i));
  240 + textAndImgShowView.setOnClickListener(new View.OnClickListener() {
  241 + @Override
  242 + public void onClick(View view) {
  243 + ChannelBean channelBean = (ChannelBean) view.getTag();
  244 + ConsultOneLevelActivity.getInstance(getActivity(), channelBean.getId() + "");
  245 + }
  246 + });
  247 + layout_control.addView(textAndImgShowView);
  248 + }
  249 + first = false;
223 } 250 }
224 251
225 252
226 -  
227 -  
228 } 253 }
229 254
230 @Override 255 @Override
231 public void showContext(List<ChannelContextBean> list) { 256 public void showContext(List<ChannelContextBean> list) {
232 - contextList.clear();  
233 contextList.addAll(list); 257 contextList.addAll(list);
234 - contextAdapter.addAll(contextList);  
235 - recycler_context.setAdapter(contextAdapter);  
236 -  
237 - 258 + if (contextAdapter == null) {
  259 + contextAdapter = new ContextAdapter(getActivity());
  260 + contextAdapter.addAll(contextList);
  261 + recycler_context.setAdapter(contextAdapter);
  262 + } else {
  263 + contextAdapter.addAll(contextList);
  264 + contextAdapter.notifyDataSetChanged();
  265 + }
238 } 266 }
239 267
240 @Override 268 @Override
241 public void getCity(String name) { 269 public void getCity(String name) {
  270 + first=true;
242 tvLocalAddress.setText(name.split(" ")[1]); 271 tvLocalAddress.setText(name.split(" ")[1]);
243 mPresenter.getBanners("2", name.split(" ")[2]); 272 mPresenter.getBanners("2", name.split(" ")[2]);
244 mPresenter.getContextChannel(name.split(" ")[2], 0, 1, 1); 273 mPresenter.getContextChannel(name.split(" ")[2], 0, 1, 1);
245 - AppContext.getInstance().cityName=name.split(" ")[1];  
246 - AppContext.getInstance().district=name.split(" ")[2]; 274 + AppContext.getInstance().cityName = name.split(" ")[1];
  275 + AppContext.getInstance().district = name.split(" ")[2];
247 } 276 }
248 } 277 }
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
@@ -5,7 +5,6 @@ import android.support.annotation.NonNull; @@ -5,7 +5,6 @@ import android.support.annotation.NonNull;
5 import android.support.annotation.Nullable; 5 import android.support.annotation.Nullable;
6 import android.support.v7.widget.LinearLayoutManager; 6 import android.support.v7.widget.LinearLayoutManager;
7 import android.support.v7.widget.RecyclerView; 7 import android.support.v7.widget.RecyclerView;
8 -import android.util.Log;  
9 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
10 import android.view.View; 9 import android.view.View;
11 import android.view.ViewGroup; 10 import android.view.ViewGroup;
@@ -15,6 +14,7 @@ import android.widget.LinearLayout; @@ -15,6 +14,7 @@ import android.widget.LinearLayout;
15 import android.widget.TextView; 14 import android.widget.TextView;
16 15
17 import com.bumptech.glide.Glide; 16 import com.bumptech.glide.Glide;
  17 +import com.jcodecraeer.xrecyclerview.XRecyclerView;
18 import com.share.mvpsdk.base.BasePresenter; 18 import com.share.mvpsdk.base.BasePresenter;
19 import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; 19 import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter;
20 import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; 20 import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder;
@@ -26,22 +26,24 @@ import com.shunzhi.parent.AppContext; @@ -26,22 +26,24 @@ import com.shunzhi.parent.AppContext;
26 import com.shunzhi.parent.R; 26 import com.shunzhi.parent.R;
27 import com.shunzhi.parent.adapter.MyConsultAdapter; 27 import com.shunzhi.parent.adapter.MyConsultAdapter;
28 import com.shunzhi.parent.bean.GuangGaoBean; 28 import com.shunzhi.parent.bean.GuangGaoBean;
29 -import com.shunzhi.parent.bean.MyConsultBean;  
30 import com.shunzhi.parent.bean.channel.ChannelBean; 29 import com.shunzhi.parent.bean.channel.ChannelBean;
31 import com.shunzhi.parent.bean.channel.ChannelContextBean; 30 import com.shunzhi.parent.bean.channel.ChannelContextBean;
32 import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; 31 import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract;
33 import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; 32 import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter;
34 -import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity;  
35 import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; 33 import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity;
36 import com.shunzhi.parent.util.AttrsUtils; 34 import com.shunzhi.parent.util.AttrsUtils;
37 import com.shunzhi.parent.views.TextAndImgShowView; 35 import com.shunzhi.parent.views.TextAndImgShowView;
38 36
  37 +import java.util.ArrayList;
39 import java.util.List; 38 import java.util.List;
40 39
  40 +import retrofit2.http.HEAD;
  41 +
41 public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter, 42 public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter,
42 ConsultOneContract.IConsultOneModel> implements View.OnClickListener, ConsultOneContract.IConsultOneView { 43 ConsultOneContract.IConsultOneModel> implements View.OnClickListener, ConsultOneContract.IConsultOneView {
43 44
44 - RecyclerView recyclerViewGrally, recyclerViewConsultOne; 45 + RecyclerView recyclerViewGrally;
  46 + XRecyclerView recyclerViewConsultOne;
45 47
46 MyGrallyAdapter myGrallyAdapter = null; 48 MyGrallyAdapter myGrallyAdapter = null;
47 49
@@ -49,7 +51,13 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -49,7 +51,13 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
49 51
50 LinearLayout layout_control; 52 LinearLayout layout_control;
51 53
  54 +
  55 + List<ChannelContextBean> myConsultBeanList = new ArrayList<>();
  56 + boolean first=true;
  57 +
52 String channel = ""; 58 String channel = "";
  59 + int pageIndex;
  60 +
53 61
54 @Override 62 @Override
55 public int getLayoutId() { 63 public int getLayoutId() {
@@ -87,9 +95,30 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -87,9 +95,30 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
87 layout_control.measure(0, 0); 95 layout_control.measure(0, 0);
88 recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); 96 recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally);
89 recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); 97 recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne);
  98 + recyclerViewConsultOne.setLayoutManager(new LinearLayoutManager(getActivity()));
  99 + recyclerViewConsultOne.setLoadingListener(new XRecyclerView.LoadingListener() {
  100 + @Override
  101 + public void onRefresh() {
  102 + //refresh data here
  103 + pageIndex = 1;
  104 + myConsultBeanList.clear();
  105 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
  106 + recyclerViewConsultOne.refreshComplete();
  107 + }
  108 +
  109 + @Override
  110 + public void onLoadMore() {
  111 + // load more data here
  112 + pageIndex = pageIndex + 1;
  113 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
  114 + recyclerViewConsultOne.refreshComplete();
  115 + }
  116 + });
  117 + pageIndex = 1;
  118 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
90 119
91 mPresenter.getBanners("3", AppContext.getInstance().district); 120 mPresenter.getBanners("3", AppContext.getInstance().district);
92 - mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, 1); 121 +
93 } 122 }
94 123
95 public void showSearchContent(String keyword) { 124 public void showSearchContent(String keyword) {
@@ -120,13 +149,20 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -120,13 +149,20 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
120 149
121 @Override 150 @Override
122 public void showConsultContent(List<ChannelContextBean> list) { 151 public void showConsultContent(List<ChannelContextBean> list) {
123 - if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity());  
124 - myConsultAdapter.addAll(list);  
125 - recyclerViewConsultOne.setAdapter(myConsultAdapter); 152 + myConsultBeanList.addAll(list);
  153 + if (myConsultAdapter == null) {
  154 + myConsultAdapter = new MyConsultAdapter(getActivity());
  155 + myConsultAdapter.addAll(myConsultBeanList);
  156 + recyclerViewConsultOne.setAdapter(myConsultAdapter);
  157 + } else {
  158 + myConsultAdapter.addAll(myConsultBeanList);
  159 + myConsultAdapter.notifyDataSetChanged();
  160 + }
126 } 161 }
127 162
128 @Override 163 @Override
129 public void showChannel(List<ChannelBean> list) { 164 public void showChannel(List<ChannelBean> list) {
  165 + layout_control.removeAllViews();
130 for (int i = 0; i < list.size(); i++) { 166 for (int i = 0; i < list.size(); i++) {
131 TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); 167 TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity());
132 textAndImgShowView.setTextColor(R.color.textColor); 168 textAndImgShowView.setTextColor(R.color.textColor);
@@ -140,7 +176,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -140,7 +176,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
140 @Override 176 @Override
141 public void onClick(View view) { 177 public void onClick(View view) {
142 ChannelBean channelBean = (ChannelBean) view.getTag(); 178 ChannelBean channelBean = (ChannelBean) view.getTag();
143 - ConsultTwoLevelActivity.getInstance(getActivity(), channelBean.getId() + "",channelBean.getChannelName()); 179 + ConsultTwoLevelActivity.getInstance(getActivity(), channelBean.getId() + "", channelBean.getChannelName());
144 } 180 }
145 }); 181 });
146 layout_control.addView(textAndImgShowView); 182 layout_control.addView(textAndImgShowView);
@@ -181,7 +217,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -181,7 +217,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
181 217
182 @Override 218 @Override
183 public void onBindViewHolder(GuangGaoBean object, int position) { 219 public void onBindViewHolder(GuangGaoBean object, int position) {
184 - Glide.with(getActivity()).load(AppConfig.BASE_URL_FILE + object.fileSrc).error(R.drawable.ic_launcher_foreground).into(iv_grally); 220 + Glide.with(getActivity()).load(AppConfig.BASE_URL_IMG + object.fileSrc).error(R.drawable.ic_launcher_foreground).into(iv_grally);
185 tv_grally_title.setText(object.describe + ""); 221 tv_grally_title.setText(object.describe + "");
186 } 222 }
187 } 223 }
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java
@@ -3,18 +3,17 @@ package com.shunzhi.parent.ui.fragment.consult; @@ -3,18 +3,17 @@ package com.shunzhi.parent.ui.fragment.consult;
3 import android.os.Bundle; 3 import android.os.Bundle;
4 import android.support.annotation.NonNull; 4 import android.support.annotation.NonNull;
5 import android.support.annotation.Nullable; 5 import android.support.annotation.Nullable;
6 -import android.support.v7.widget.RecyclerView; 6 +import android.support.v7.widget.LinearLayoutManager;
7 import android.view.View; 7 import android.view.View;
8 import android.widget.TextView; 8 import android.widget.TextView;
9 9
  10 +import com.jcodecraeer.xrecyclerview.XRecyclerView;
10 import com.share.mvpsdk.base.BasePresenter; 11 import com.share.mvpsdk.base.BasePresenter;
11 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; 12 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
12 -import com.shunzhi.parent.AppConfig;  
13 import com.shunzhi.parent.AppContext; 13 import com.shunzhi.parent.AppContext;
14 import com.shunzhi.parent.R; 14 import com.shunzhi.parent.R;
15 import com.shunzhi.parent.adapter.MyConsultAdapter; 15 import com.shunzhi.parent.adapter.MyConsultAdapter;
16 import com.shunzhi.parent.bean.GuangGaoBean; 16 import com.shunzhi.parent.bean.GuangGaoBean;
17 -import com.shunzhi.parent.bean.MyConsultBean;  
18 import com.shunzhi.parent.bean.channel.ChannelBean; 17 import com.shunzhi.parent.bean.channel.ChannelBean;
19 import com.shunzhi.parent.bean.channel.ChannelContextBean; 18 import com.shunzhi.parent.bean.channel.ChannelContextBean;
20 import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; 19 import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract;
@@ -31,11 +30,13 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -31,11 +30,13 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
31 30
32 TextView tvContentName; 31 TextView tvContentName;
33 32
34 - RecyclerView recyclerView; 33 + XRecyclerView recyclerView;
35 34
36 MyConsultAdapter myConsultAdapter = null; 35 MyConsultAdapter myConsultAdapter = null;
37 36
  37 + List<ChannelContextBean> myConsultBeanList = new ArrayList<>();
38 38
  39 + int pageIndex = 1;
39 String channel="",titleName; 40 String channel="",titleName;
40 @Override 41 @Override
41 public int getLayoutId() { 42 public int getLayoutId() {
@@ -50,8 +51,46 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -50,8 +51,46 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
50 recyclerView = view.findViewById(R.id.recyclerView); 51 recyclerView = view.findViewById(R.id.recyclerView);
51 52
52 mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel),0,1); 53 mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel),0,1);
  54 + recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  55 + recyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
  56 + @Override
  57 + public void onRefresh() {
  58 + //refresh data here
  59 + pageIndex = 1;
  60 + myConsultBeanList.clear();
  61 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
  62 + recyclerView.refreshComplete();
  63 + }
  64 +
  65 + @Override
  66 + public void onLoadMore() {
  67 + // load more data here
  68 + pageIndex = pageIndex + 1;
  69 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
  70 + recyclerView.refreshComplete();
  71 + }
  72 + });
  73 + pageIndex = 1;
  74 + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, pageIndex);
  75 +
  76 +// initRecyclerView();
53 } 77 }
54 78
  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 +
55 @NonNull 94 @NonNull
56 @Override 95 @Override
57 public BasePresenter initPresenter() { 96 public BasePresenter initPresenter() {
@@ -70,9 +109,15 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -70,9 +109,15 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
70 109
71 @Override 110 @Override
72 public void showConsultContent(List<ChannelContextBean> list) { 111 public void showConsultContent(List<ChannelContextBean> list) {
73 - if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity());  
74 - myConsultAdapter.addAll(list);  
75 - recyclerView.setAdapter(myConsultAdapter); 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 + }
76 } 121 }
77 122
78 @Override 123 @Override
@@ -81,5 +126,4 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -81,5 +126,4 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
81 } 126 }
82 127
83 128
84 -  
85 } 129 }
app/src/main/res/layout/activity_consult_two_level.xml
@@ -9,11 +9,9 @@ @@ -9,11 +9,9 @@
9 tools:context="com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity"> 9 tools:context="com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity">
10 10
11 <include layout="@layout/layout_search_back"/> 11 <include layout="@layout/layout_search_back"/>
12 -  
13 <FrameLayout 12 <FrameLayout
14 android:layout_width="match_parent" 13 android:layout_width="match_parent"
15 android:layout_height="match_parent" 14 android:layout_height="match_parent"
16 - android:id="@+id/frame_consult_two" 15 + android:id="@+id/frame_consult"
17 ></FrameLayout> 16 ></FrameLayout>
18 -  
19 </LinearLayout> 17 </LinearLayout>
app/src/main/res/layout/fragment_consult_one_level.xml
@@ -19,12 +19,12 @@ @@ -19,12 +19,12 @@
19 19
20 <include layout="@layout/layout_textandimgshow"/> 20 <include layout="@layout/layout_textandimgshow"/>
21 21
22 - <android.support.v7.widget.RecyclerView 22 + <com.jcodecraeer.xrecyclerview.XRecyclerView
23 android:layout_marginTop="@dimen/size_dp_10" 23 android:layout_marginTop="@dimen/size_dp_10"
24 android:layout_width="match_parent" 24 android:layout_width="match_parent"
25 android:layout_height="0dp" 25 android:layout_height="0dp"
26 android:layout_weight="3" 26 android:layout_weight="3"
27 android:id="@+id/recyclerViewConsultOne" 27 android:id="@+id/recyclerViewConsultOne"
28 - ></android.support.v7.widget.RecyclerView> 28 + ></com.jcodecraeer.xrecyclerview.XRecyclerView>
29 29
30 </LinearLayout> 30 </LinearLayout>
app/src/main/res/layout/fragment_consult_two_level.xml
@@ -17,12 +17,14 @@ @@ -17,12 +17,14 @@
17 android:paddingBottom="@dimen/size_dp_5" 17 android:paddingBottom="@dimen/size_dp_5"
18 /> 18 />
19 19
20 - <android.support.v7.widget.RecyclerView 20 + <com.jcodecraeer.xrecyclerview.XRecyclerView
21 android:layout_marginLeft="@dimen/size_dp_10" 21 android:layout_marginLeft="@dimen/size_dp_10"
22 android:layout_marginRight="@dimen/size_dp_10" 22 android:layout_marginRight="@dimen/size_dp_10"
23 android:id="@+id/recyclerView" 23 android:id="@+id/recyclerView"
24 android:layout_width="match_parent" 24 android:layout_width="match_parent"
25 - android:layout_height="match_parent"></android.support.v7.widget.RecyclerView> 25 + android:layout_height="match_parent">
  26 +
  27 + </com.jcodecraeer.xrecyclerview.XRecyclerView>
26 28
27 29
28 </LinearLayout> 30 </LinearLayout>
app/src/main/res/layout/fragment_zi_xun.xml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 android:orientation="vertical" 6 android:orientation="vertical"
7 tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment"> 7 tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment">
8 8
9 - <include layout="@layout/layout_search" /> 9 + <include layout="@layout/layout_search"/>
10 10
11 <com.stx.xhb.xbanner.XBanner 11 <com.stx.xhb.xbanner.XBanner
12 android:id="@+id/xBanner" 12 android:id="@+id/xBanner"
@@ -14,23 +14,18 @@ @@ -14,23 +14,18 @@
14 android:layout_height="0dp" 14 android:layout_height="0dp"
15 android:layout_weight="2"></com.stx.xhb.xbanner.XBanner> 15 android:layout_weight="2"></com.stx.xhb.xbanner.XBanner>
16 16
17 - <LinearLayout  
18 - android:layout_width="match_parent"  
19 - android:layout_height="wrap_content"  
20 - android:layout_marginLeft="@dimen/size_dp_10"  
21 - android:layout_marginRight="@dimen/size_dp_10"  
22 - android:paddingTop="@dimen/size_dp_10">  
23 17
24 - <include layout="@layout/layout_textandimgshow" /> 18 +<include layout="@layout/layout_textandimgshow"
  19 + />
25 20
26 - </LinearLayout>  
27 21
28 <LinearLayout 22 <LinearLayout
29 android:layout_width="match_parent" 23 android:layout_width="match_parent"
30 - android:layout_height="wrap_content"  
31 - android:orientation="vertical" 24 + android:layout_height="0dp"
32 android:paddingLeft="@dimen/size_dp_10" 25 android:paddingLeft="@dimen/size_dp_10"
33 - android:paddingRight="@dimen/size_dp_10"> 26 + android:paddingRight="@dimen/size_dp_10"
  27 + android:layout_weight="3"
  28 + android:orientation="vertical">
34 29
35 <TextView 30 <TextView
36 android:layout_width="match_parent" 31 android:layout_width="match_parent"
@@ -44,18 +39,18 @@ @@ -44,18 +39,18 @@
44 android:layout_width="match_parent" 39 android:layout_width="match_parent"
45 android:layout_height="wrap_content"> 40 android:layout_height="wrap_content">
46 41
47 - <android.support.v7.widget.RecyclerView 42 + <com.jcodecraeer.xrecyclerview.XRecyclerView
48 android:id="@+id/recycler_content" 43 android:id="@+id/recycler_content"
49 android:layout_width="match_parent" 44 android:layout_width="match_parent"
50 - android:layout_height="match_parent">  
51 -  
52 - </android.support.v7.widget.RecyclerView> 45 + android:layout_height="wrap_content">
  46 + </com.jcodecraeer.xrecyclerview.XRecyclerView>
53 </LinearLayout> 47 </LinearLayout>
54 </LinearLayout> 48 </LinearLayout>
55 49
56 50
57 <FrameLayout 51 <FrameLayout
58 android:layout_width="match_parent" 52 android:layout_width="match_parent"
  53 + android:visibility="gone"
59 android:layout_height="0dp" 54 android:layout_height="0dp"
60 android:layout_margin="@dimen/size_dp_10" 55 android:layout_margin="@dimen/size_dp_10"
61 android:layout_weight="2"> 56 android:layout_weight="2">
@@ -63,7 +58,8 @@ @@ -63,7 +58,8 @@
63 <cn.jzvd.JZVideoPlayerStandard 58 <cn.jzvd.JZVideoPlayerStandard
64 android:id="@+id/videoplayer" 59 android:id="@+id/videoplayer"
65 android:layout_width="match_parent" 60 android:layout_width="match_parent"
66 - android:layout_height="match_parent"></cn.jzvd.JZVideoPlayerStandard> 61 + android:layout_height="match_parent"
  62 + ></cn.jzvd.JZVideoPlayerStandard>
67 63
68 <TextView 64 <TextView
69 android:id="@+id/tvVideoTitle" 65 android:id="@+id/tvVideoTitle"
mvpsdk/build.gradle
@@ -116,6 +116,9 @@ dependencies { @@ -116,6 +116,9 @@ dependencies {
116 //标签拖动排序 116 //标签拖动排序
117 compile 'com.huxq17.handygridview:handygridview:1.1.0' 117 compile 'com.huxq17.handygridview:handygridview:1.1.0'
118 118
  119 + //xrecyclerview
  120 + compile 'com.jcodecraeer:xrecyclerview:1.5.9'
  121 +
119 //悬浮窗 122 //悬浮窗
120 // compile 'com.github.yhaolpz:FloatWindow:1.0.8' 123 // compile 'com.github.yhaolpz:FloatWindow:1.0.8'
121 124