Commit 57dfbdb69e002899f6fe0e36b240d5d654530387
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' into yxb_dev
Showing
11 changed files
with
108 additions
and
43 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/contract/consult/ConsultContract.java
... | ... | @@ -26,6 +26,8 @@ public interface ConsultContract { |
26 | 26 | public abstract void getBanners(String position, String areaName); |
27 | 27 | |
28 | 28 | public abstract void getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); |
29 | + | |
30 | + public abstract void getInformationTopic(String keyword,String areaName,String channel,String toFirstPage,int pageIndex); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | |
... | ... | @@ -35,6 +37,8 @@ public interface ConsultContract { |
35 | 37 | Observable<JsonObject> getBanners(String position, String areaName); |
36 | 38 | |
37 | 39 | Observable<JsonObject> getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); |
40 | + | |
41 | + Observable<JsonObject> getInformationTopic(String keyword,String areaName,String channel,String toFirstPage,int pageIndex); | |
38 | 42 | } |
39 | 43 | |
40 | 44 | interface IConsultView extends IBaseFragment { | ... | ... |
app/src/main/java/com/shunzhi/parent/model/consult/ConsultModel.java
... | ... | @@ -34,6 +34,12 @@ public class ConsultModel extends BaseModel implements ConsultContract.IConsultM |
34 | 34 | .compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
35 | 35 | } |
36 | 36 | |
37 | + @Override | |
38 | + public Observable<JsonObject> getInformationTopic(String keyword, String areaName, String channel, String toFirstPage, int pageIndex) { | |
39 | + return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | |
40 | + .getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
41 | + } | |
42 | + | |
37 | 43 | public static ConsultContract.IConsultModel newInstance() { |
38 | 44 | return new ConsultModel(); |
39 | 45 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
1 | 1 | package com.shunzhi.parent.presenter.consult; |
2 | 2 | |
3 | +import android.util.Log; | |
3 | 4 | import android.view.View; |
4 | 5 | import android.widget.LinearLayout; |
5 | 6 | |
... | ... | @@ -108,6 +109,30 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
108 | 109 | } |
109 | 110 | |
110 | 111 | @Override |
112 | + public void getInformationTopic(String keyword, String areaName, String channel, String toFirstPage, int pageIndex) { | |
113 | + mRxManager.register(mIModel.getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).subscribe(new Consumer<JsonObject>() { | |
114 | + @Override | |
115 | + public void accept(JsonObject jsonObject) throws Exception { | |
116 | + JsonObject json=jsonObject.getAsJsonObject("data"); | |
117 | + Gson g=new Gson(); | |
118 | + List<ChannelContextBean> channelList = new ArrayList<>(); | |
119 | + JsonArray jsonArray=json.getAsJsonArray("channelList"); | |
120 | + for (int i = 0; i < jsonArray.size(); i++) { | |
121 | + ChannelContextBean channelBean=g.fromJson(jsonArray.get(i),ChannelContextBean.class); | |
122 | + channelList.add(channelBean); | |
123 | + } | |
124 | + mIView.showContext(channelList); | |
125 | + } | |
126 | + }, new Consumer<Throwable>() { | |
127 | + @Override | |
128 | + public void accept(Throwable throwable) throws Exception { | |
129 | +// Log.d("66666","getInformationTopic="+throwable); | |
130 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | |
131 | + } | |
132 | + })); | |
133 | + } | |
134 | + | |
135 | + @Override | |
111 | 136 | public ConsultContract.IConsultModel getModel() { |
112 | 137 | return ConsultModel.newInstance(); |
113 | 138 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
... | ... | @@ -101,6 +101,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ |
101 | 101 | }, new Consumer<Throwable>() { |
102 | 102 | @Override |
103 | 103 | public void accept(Throwable throwable) throws Exception { |
104 | +// Log.d("66666","getConsultContent="+throwable); | |
104 | 105 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
105 | 106 | } |
106 | 107 | })); |
... | ... | @@ -113,18 +114,22 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ |
113 | 114 | mRxManager.register(mIModel.getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).subscribe(new Consumer<JsonObject>() { |
114 | 115 | @Override |
115 | 116 | public void accept(JsonObject jsonObject) throws Exception { |
117 | + Log.d("66666","getInformationTopic="+jsonObject.toString()); | |
116 | 118 | JsonObject json=jsonObject.getAsJsonObject("data"); |
117 | 119 | Gson g=new Gson(); |
118 | - ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | |
119 | -// Log.e("ssss-===",channelInfo.toString()); | |
120 | - List<ChannelContextBean> contextList = channelInfo.getChannelContent(); | |
121 | - List<ChannelBean> channelList = channelInfo.getSubchannel(); | |
122 | - mIView.showChannel(channelList); | |
123 | - mIView.showConsultContent(contextList); | |
120 | + List<ChannelContextBean> channelList = new ArrayList<>(); | |
121 | + JsonArray jsonArray=json.getAsJsonArray("channelList"); | |
122 | + for (int i = 0; i < jsonArray.size(); i++) { | |
123 | + ChannelContextBean channelBean=g.fromJson(jsonArray.get(i),ChannelContextBean.class); | |
124 | + channelList.add(channelBean); | |
125 | + } | |
126 | + Log.d("66666","channelList="+channelList.toString()); | |
127 | + mIView.showConsultContent(channelList); | |
124 | 128 | } |
125 | 129 | }, new Consumer<Throwable>() { |
126 | 130 | @Override |
127 | 131 | public void accept(Throwable throwable) throws Exception { |
132 | +// Log.d("66666","getInformationTopic="+throwable); | |
128 | 133 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
129 | 134 | } |
130 | 135 | })); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... | ... | @@ -8,7 +8,9 @@ import android.os.Bundle; |
8 | 8 | import android.support.annotation.NonNull; |
9 | 9 | import android.support.annotation.Nullable; |
10 | 10 | import android.support.v7.widget.LinearLayoutManager; |
11 | +import android.text.TextUtils; | |
11 | 12 | import android.view.View; |
13 | +import android.widget.EditText; | |
12 | 14 | import android.widget.ImageView; |
13 | 15 | import android.widget.LinearLayout; |
14 | 16 | import android.widget.TextView; |
... | ... | @@ -63,6 +65,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
63 | 65 | |
64 | 66 | CityPicker cityPicker = null; |
65 | 67 | |
68 | + EditText et_search; | |
69 | + | |
66 | 70 | int pageIndex = 1; |
67 | 71 | boolean first = true; |
68 | 72 | |
... | ... | @@ -82,6 +86,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
82 | 86 | videoplayer = view.findViewById(R.id.videoplayer); |
83 | 87 | tvLocalAddress = view.findViewById(R.id.tvLocalAddress); |
84 | 88 | layout_control = view.findViewById(R.id.layout_control); |
89 | + et_search=view.findViewById(R.id.et_search); | |
85 | 90 | tvLocalAddress.setText(AppContext.getInstance().district); |
86 | 91 | videoplayer.batteryLevel.setVisibility(View.GONE); |
87 | 92 | videoplayer.replayTextView.setVisibility(View.GONE); |
... | ... | @@ -169,7 +174,10 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
169 | 174 | else cityPicker.show(); |
170 | 175 | break; |
171 | 176 | case R.id.ivSearch://搜索按钮 |
172 | - | |
177 | + if (!TextUtils.isEmpty(et_search.getText().toString())){ | |
178 | + contextList.clear(); | |
179 | + mPresenter.getInformationTopic(et_search.getText().toString(),AppContext.getInstance().district,"0","1",1); | |
180 | + } | |
173 | 181 | break; |
174 | 182 | } |
175 | 183 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
... | ... | @@ -6,6 +6,7 @@ import android.support.annotation.Nullable; |
6 | 6 | import android.support.v7.widget.LinearLayoutManager; |
7 | 7 | import android.support.v7.widget.RecyclerView; |
8 | 8 | import android.text.TextUtils; |
9 | +import android.util.Log; | |
9 | 10 | import android.view.LayoutInflater; |
10 | 11 | import android.view.View; |
11 | 12 | import android.view.ViewGroup; |
... | ... | @@ -20,6 +21,7 @@ import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
20 | 21 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
21 | 22 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
22 | 23 | import com.share.mvpsdk.utils.DisplayUtils; |
24 | +import com.share.mvpsdk.utils.ToastUtils; | |
23 | 25 | import com.shunzhi.parent.AppContext; |
24 | 26 | import com.shunzhi.parent.R; |
25 | 27 | import com.shunzhi.parent.adapter.MyConsultAdapter; |
... | ... | @@ -100,8 +102,10 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
100 | 102 | } |
101 | 103 | |
102 | 104 | public void showSearchContent(String keyword) { |
103 | - if (!TextUtils.isEmpty(keyword)) | |
104 | - mPresenter.getInformationTopic(keyword, AppContext.getInstance().district, channel, "0", 1); | |
105 | + if (!TextUtils.isEmpty(keyword)){ | |
106 | + myConsultBeanList.clear(); | |
107 | + mPresenter.getInformationTopic(keyword, AppContext.getInstance().district, channel, "0", 1); | |
108 | + } | |
105 | 109 | } |
106 | 110 | |
107 | 111 | @NonNull |
... | ... | @@ -147,37 +151,42 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
147 | 151 | |
148 | 152 | @Override |
149 | 153 | public void showConsultContent(List<ChannelContextBean> list) { |
150 | - myConsultBeanList.addAll(list); | |
151 | - if (myConsultAdapter == null) { | |
152 | - myConsultAdapter = new MyConsultAdapter(getActivity()); | |
153 | - myConsultAdapter.addAll(myConsultBeanList); | |
154 | - recyclerViewConsultOne.setAdapter(myConsultAdapter); | |
155 | - } else { | |
156 | - myConsultAdapter.addAll(myConsultBeanList); | |
157 | - myConsultAdapter.notifyDataSetChanged(); | |
158 | - } | |
154 | +// Log.d("66666", "ChannelContextBean=" + list); | |
155 | + if (null != list) { | |
156 | + myConsultBeanList.addAll(list); | |
157 | + if (myConsultAdapter == null) { | |
158 | + myConsultAdapter = new MyConsultAdapter(getActivity()); | |
159 | + myConsultAdapter.addAll(myConsultBeanList); | |
160 | + recyclerViewConsultOne.setAdapter(myConsultAdapter); | |
161 | + } else { | |
162 | + myConsultAdapter.addAll(myConsultBeanList); | |
163 | + myConsultAdapter.notifyDataSetChanged(); | |
164 | + } | |
165 | + }else ToastUtils.showToast("没有数据"); | |
159 | 166 | } |
160 | 167 | |
161 | 168 | @Override |
162 | 169 | public void showChannel(List<ChannelBean> list) { |
163 | - layout_control.removeAllViews(); | |
164 | - for (int i = 0; i < list.size(); i++) { | |
165 | - TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); | |
166 | - textAndImgShowView.setTextColor(R.color.textColor); | |
167 | - textAndImgShowView.setText(list.get(i).getChannelName()); | |
168 | - textAndImgShowView.addImgs(list.get(i).getChannelImage()); | |
169 | - textAndImgShowView.setSelect(true); | |
170 | - textAndImgShowView.setWidth(getActivity(), layout_control); | |
171 | - textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0)); | |
172 | - textAndImgShowView.setTag(list.get(i)); | |
173 | - textAndImgShowView.setOnClickListener(new View.OnClickListener() { | |
174 | - @Override | |
175 | - public void onClick(View view) { | |
176 | - ChannelBean channelBean = (ChannelBean) view.getTag(); | |
177 | - ConsultTwoLevelActivity.getInstance(getActivity(), channelBean.getId() + "", channelBean.getChannelName()); | |
178 | - } | |
179 | - }); | |
180 | - layout_control.addView(textAndImgShowView); | |
170 | + if (null != list) { | |
171 | + layout_control.removeAllViews(); | |
172 | + for (int i = 0; i < list.size(); i++) { | |
173 | + TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); | |
174 | + textAndImgShowView.setTextColor(R.color.textColor); | |
175 | + textAndImgShowView.setText(list.get(i).getChannelName()); | |
176 | + textAndImgShowView.addImgs(list.get(i).getChannelImage()); | |
177 | + textAndImgShowView.setSelect(true); | |
178 | + textAndImgShowView.setWidth(getActivity(), layout_control); | |
179 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0)); | |
180 | + textAndImgShowView.setTag(list.get(i)); | |
181 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | |
182 | + @Override | |
183 | + public void onClick(View view) { | |
184 | + ChannelBean channelBean = (ChannelBean) view.getTag(); | |
185 | + ConsultTwoLevelActivity.getInstance(getActivity(), channelBean.getId() + "", channelBean.getChannelName()); | |
186 | + } | |
187 | + }); | |
188 | + layout_control.addView(textAndImgShowView); | |
189 | + } | |
181 | 190 | } |
182 | 191 | } |
183 | 192 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultTwoLevelFragment.java
... | ... | @@ -4,6 +4,7 @@ import android.os.Bundle; |
4 | 4 | import android.support.annotation.NonNull; |
5 | 5 | import android.support.annotation.Nullable; |
6 | 6 | import android.support.v7.widget.LinearLayoutManager; |
7 | +import android.text.TextUtils; | |
7 | 8 | import android.view.View; |
8 | 9 | import android.widget.TextView; |
9 | 10 | |
... | ... | @@ -90,7 +91,6 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
90 | 91 | |
91 | 92 | @Override |
92 | 93 | public void showConsultContent(List<ChannelContextBean> list) { |
93 | - myConsultBeanList.clear(); | |
94 | 94 | myConsultBeanList.addAll(list); |
95 | 95 | if (myConsultAdapter == null) myConsultAdapter = new MyConsultAdapter(getActivity()); |
96 | 96 | if (null == recyclerView.getAdapter()) recyclerView.setAdapter(myConsultAdapter); |
... | ... | @@ -108,4 +108,12 @@ public class ConsultTwoLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | + public void showSearch(String s) { | |
112 | + | |
113 | + if (!TextUtils.isEmpty(s)){ | |
114 | + myConsultBeanList.clear(); | |
115 | + mPresenter.getInformationTopic(s,AppContext.getInstance().district,channel,"0",1); | |
116 | + } | |
117 | + | |
118 | + } | |
111 | 119 | } | ... | ... |
app/src/main/res/layout/layout_consult_content.xml
... | ... | @@ -25,7 +25,6 @@ |
25 | 25 | android:layout_height="0dp" |
26 | 26 | android:layout_weight="2" |
27 | 27 | android:ellipsize="end" |
28 | - android:gravity="center_vertical" | |
29 | 28 | android:maxLines="2" |
30 | 29 | android:layout_gravity="top" |
31 | 30 | android:text="学校初一段家长统一测试使用家长慧得到良好反馈评价" |
... | ... | @@ -80,6 +79,7 @@ |
80 | 79 | </LinearLayout> |
81 | 80 | |
82 | 81 | <ImageView |
82 | + android:layout_gravity="center" | |
83 | 83 | android:id="@+id/iv_consult" |
84 | 84 | android:layout_width="0dp" |
85 | 85 | android:layout_height="match_parent" | ... | ... |
app/src/main/res/layout/text_and_img_show.xml
... | ... | @@ -16,8 +16,8 @@ |
16 | 16 | |
17 | 17 | <ImageView |
18 | 18 | android:id="@+id/image" |
19 | - android:layout_width="wrap_content" | |
20 | - android:layout_height="wrap_content" | |
19 | + android:layout_width="@dimen/size_dp_50" | |
20 | + android:layout_height="@dimen/size_dp_50" | |
21 | 21 | android:scaleType="fitXY" |
22 | 22 | /> |
23 | 23 | ... | ... |
app/src/main/res/values/colors.xml
... | ... | @@ -9,9 +9,9 @@ |
9 | 9 | <color name="bottomline">#B8B8B9</color> |
10 | 10 | <color name="bg_main">#F0EFF5</color> |
11 | 11 | <color name="textRed">#FC5B6A</color> |
12 | - <color name="back_top">#C6DAFF</color> | |
12 | + <color name="back_top">#A6DAFF</color> | |
13 | 13 | <color name="textBlue">#ACC9FC</color> |
14 | - <color name="titleColor">#C6DAFF</color> | |
14 | + <color name="titleColor">#A6DAFF</color> | |
15 | 15 | <color name="bgColor">#F0EFF5</color> |
16 | 16 | <color name="textColor">#494947</color> |
17 | 17 | <color name="xueqing_blue">#ABC9FF</color> | ... | ... |