Commit d878a8a1f6ce0aa27294cc4677ca0cb39eeb90cd
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' into yxb_dev
# Conflicts: # app/src/main/java/com/shunzhi/parent/model/consult/consultone/ConsultOneModel.java
Showing
12 changed files
with
72 additions
and
29 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/api/Consult.java
| ... | ... | @@ -15,13 +15,18 @@ import retrofit2.http.Query; |
| 15 | 15 | |
| 16 | 16 | public interface Consult { |
| 17 | 17 | |
| 18 | - @GET("/api/ParentService/GetAds") | |
| 18 | + @GET("api/ParentService/GetAds") | |
| 19 | 19 | Observable<JsonObject> getBanners(@Query("position") String position, @Query("areaName") String areaName); |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | @FormUrlEncoded |
| 23 | - @POST("/api/ParentService/GetChannelInfo") | |
| 23 | + @POST("api/ParentService/GetChannelInfo") | |
| 24 | 24 | Observable<JsonObject> getConsultContent(@Field("areaName") String areaName, @Field("channel") int channel |
| 25 | 25 | , @Field("toFirstPage") int toFirstPage, @Field("pageIndex") int pageIndex); |
| 26 | 26 | |
| 27 | + @FormUrlEncoded | |
| 28 | + @POST("api/ParentService/GetInformationTopic") | |
| 29 | + Observable<JsonObject> getInformationTopic(@Field("keyword") String keyword,@Field("areaName") String areaName, @Field("channel") String channel | |
| 30 | + , @Field("toFirstPage") String toFirstPage, @Field("pageIndex") int pageIndex); | |
| 31 | + | |
| 27 | 32 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/model/consult/consultone/ConsultOneModel.java
| ... | ... | @@ -5,6 +5,7 @@ import com.share.mvpsdk.base.BaseModel; |
| 5 | 5 | import com.share.mvpsdk.helper.RetrofitCreateHelper; |
| 6 | 6 | import com.share.mvpsdk.helper.RxHelper; |
| 7 | 7 | import com.shunzhi.parent.AppConfig; |
| 8 | +import com.shunzhi.parent.AppContext; | |
| 8 | 9 | import com.shunzhi.parent.api.Consult; |
| 9 | 10 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; |
| 10 | 11 | |
| ... | ... | @@ -39,7 +40,8 @@ public class ConsultOneModel extends BaseModel implements ConsultOneContract.ICo |
| 39 | 40 | |
| 40 | 41 | @Override |
| 41 | 42 | public Observable<JsonObject> getInformationTopic(String keyword, String areaName, String channel, String toFirstPage, int pageIndex) { |
| 42 | - return null; | |
| 43 | + return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | |
| 44 | + .getInformationTopic(keyword,areaName,channel,toFirstPage,pageIndex).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
| ... | ... | @@ -54,7 +54,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
| 54 | 54 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
| 55 | 55 | @Override |
| 56 | 56 | public void onClick(View view) { |
| 57 | - ConsultOneLevelActivity.getInstance(mIView.getBindActivity()); | |
| 57 | +// ConsultOneLevelActivity.getInstance(mIView.getBindActivity()); | |
| 58 | 58 | } |
| 59 | 59 | }); |
| 60 | 60 | layout_control.addView(textAndImgShowView); |
| ... | ... | @@ -94,7 +94,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
| 94 | 94 | mRxManager.register(mIModel.getContextChannel(areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { |
| 95 | 95 | @Override |
| 96 | 96 | public void accept(JsonObject jsonObject) throws Exception { |
| 97 | - ToastUtils.showToast(jsonObject.toString()); | |
| 97 | +// ToastUtils.showToast(jsonObject.toString()); | |
| 98 | 98 | JsonObject json=jsonObject.getAsJsonObject("data"); |
| 99 | 99 | Gson g=new Gson(); |
| 100 | 100 | ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
| ... | ... | @@ -52,7 +52,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ |
| 52 | 52 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
| 53 | 53 | @Override |
| 54 | 54 | public void onClick(View view) { |
| 55 | - ConsultTwoLevelActivity.getInstance(mIView.getBindActivity()); | |
| 55 | +// ConsultTwoLevelActivity.getInstance(mIView.getBindActivity()); | |
| 56 | 56 | } |
| 57 | 57 | }); |
| 58 | 58 | } |
| ... | ... | @@ -89,7 +89,7 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ |
| 89 | 89 | mRxManager.register(mIModel.getConsultContent(areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { |
| 90 | 90 | @Override |
| 91 | 91 | public void accept(JsonObject jsonObject) throws Exception { |
| 92 | - ToastUtils.showToast(jsonObject.toString()); | |
| 92 | +// ToastUtils.showToast(jsonObject.toString()); | |
| 93 | 93 | JsonObject json=jsonObject.getAsJsonObject("data"); |
| 94 | 94 | Gson g=new Gson(); |
| 95 | 95 | ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java
| ... | ... | @@ -2,27 +2,40 @@ package com.shunzhi.parent.ui.activity.consult; |
| 2 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.content.Intent; |
| 5 | +import android.support.v4.app.FragmentTransaction; | |
| 5 | 6 | import android.support.v7.app.AppCompatActivity; |
| 6 | 7 | import android.os.Bundle; |
| 7 | 8 | import android.view.View; |
| 8 | 9 | import android.widget.EditText; |
| 10 | +import android.widget.FrameLayout; | |
| 9 | 11 | import android.widget.ImageView; |
| 10 | 12 | import android.widget.TextView; |
| 11 | 13 | |
| 12 | 14 | import com.share.mvpsdk.base.activity.BaseCompatActivity; |
| 15 | +import com.share.mvpsdk.utils.ToastUtils; | |
| 13 | 16 | import com.shunzhi.parent.R; |
| 17 | +import com.shunzhi.parent.ui.fragment.consult.ConsultOneLevelFragment; | |
| 14 | 18 | |
| 15 | 19 | public class ConsultOneLevelActivity extends BaseCompatActivity implements View.OnClickListener{ |
| 16 | 20 | |
| 17 | 21 | |
| 18 | - public static void getInstance(Context context){ | |
| 22 | + public static void getInstance(Context context,String channel){ | |
| 19 | 23 | Intent intent=new Intent(context,ConsultOneLevelActivity.class); |
| 24 | + intent.putExtra("channel",channel); | |
| 20 | 25 | context.startActivity(intent); |
| 21 | 26 | } |
| 22 | 27 | |
| 23 | 28 | EditText et_search; |
| 24 | 29 | |
| 25 | 30 | ImageView ivSearch,ivBack; |
| 31 | + | |
| 32 | + String channel=""; | |
| 33 | + | |
| 34 | + FrameLayout frame_consult; | |
| 35 | + | |
| 36 | + FragmentTransaction fragmentTransaction=null; | |
| 37 | + | |
| 38 | + ConsultOneLevelFragment consultOneLevelFragment=null; | |
| 26 | 39 | @Override |
| 27 | 40 | protected void initView(Bundle savedInstanceState) { |
| 28 | 41 | |
| ... | ... | @@ -32,12 +45,23 @@ public class ConsultOneLevelActivity extends BaseCompatActivity implements View. |
| 32 | 45 | |
| 33 | 46 | private void initViews() { |
| 34 | 47 | |
| 48 | + channel=getIntent().getStringExtra("channel"); | |
| 49 | + consultOneLevelFragment=new ConsultOneLevelFragment(); | |
| 35 | 50 | et_search=findViewById(R.id.et_search); |
| 36 | 51 | ivSearch=findViewById(R.id.ivSearch); |
| 37 | 52 | ivBack=findViewById(R.id.ivBack); |
| 53 | + frame_consult=findViewById(R.id.frame_consult); | |
| 38 | 54 | |
| 39 | 55 | ivSearch.setOnClickListener(this); |
| 40 | 56 | ivBack.setOnClickListener(this); |
| 57 | + | |
| 58 | + Bundle bundle=new Bundle(); | |
| 59 | + bundle.putString("channel",channel); | |
| 60 | + consultOneLevelFragment.setArguments(bundle); | |
| 61 | + ToastUtils.showToast("channel="+channel); | |
| 62 | + fragmentTransaction=getSupportFragmentManager().beginTransaction(); | |
| 63 | + fragmentTransaction.add(R.id.frame_consult,consultOneLevelFragment) | |
| 64 | + .show(consultOneLevelFragment).commit(); | |
| 41 | 65 | } |
| 42 | 66 | |
| 43 | 67 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
| ... | ... | @@ -21,8 +21,9 @@ import java.util.List; |
| 21 | 21 | |
| 22 | 22 | public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener { |
| 23 | 23 | |
| 24 | - public static void getInstance(Context context){ | |
| 24 | + public static void getInstance(Context context,String channel){ | |
| 25 | 25 | Intent intent=new Intent(context,ConsultTwoLevelActivity.class); |
| 26 | + intent.putExtra("channel",channel); | |
| 26 | 27 | context.startActivity(intent); |
| 27 | 28 | } |
| 28 | 29 | |
| ... | ... | @@ -30,7 +31,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi |
| 30 | 31 | |
| 31 | 32 | EditText et_search; |
| 32 | 33 | |
| 33 | - | |
| 34 | + String channel; | |
| 34 | 35 | @Override |
| 35 | 36 | protected void initView(Bundle savedInstanceState) { |
| 36 | 37 | initViews(); |
| ... | ... | @@ -43,7 +44,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi |
| 43 | 44 | |
| 44 | 45 | |
| 45 | 46 | private void initViews() { |
| 46 | - | |
| 47 | + channel=getIntent().getStringExtra("channel"); | |
| 47 | 48 | ivBack = findViewById(R.id.ivBack); |
| 48 | 49 | ivBack.setOnClickListener(this); |
| 49 | 50 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
| ... | ... | @@ -173,7 +173,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
| 173 | 173 | public void getCity(String name) { |
| 174 | 174 | tvLocalAddress.setText(name.split(" ")[1]); |
| 175 | 175 | mPresenter.getTools(layout_control, name.split(" ")[2]); |
| 176 | - ToastUtils.showToast(name.split(" ")[2]); | |
| 176 | + AppContext.getInstance().cityName=name.split(" ")[1]; | |
| 177 | + AppContext.getInstance().district=name.split(" ")[2]; | |
| 178 | +// ToastUtils.showToast(name.split(" ")[2]); | |
| 177 | 179 | } |
| 178 | 180 | |
| 179 | 181 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -196,7 +196,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | @Override |
| 199 | - public void showChannel(List<ChannelBean> list) { | |
| 199 | + public void showChannel(final List<ChannelBean> list) { | |
| 200 | 200 | for (int i = 0; i < list.size(); i++) { |
| 201 | 201 | TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); |
| 202 | 202 | textAndImgShowView.setTextColor(R.color.textColor); |
| ... | ... | @@ -206,10 +206,12 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 206 | 206 | textAndImgShowView.setSelect(true); |
| 207 | 207 | textAndImgShowView.setWidth(getActivity(), layout_control); |
| 208 | 208 | textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0)); |
| 209 | + textAndImgShowView.setTag(list.get(i)); | |
| 209 | 210 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
| 210 | 211 | @Override |
| 211 | 212 | public void onClick(View view) { |
| 212 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 213 | + ChannelBean channelBean= (ChannelBean) view.getTag(); | |
| 214 | + ConsultOneLevelActivity.getInstance(getActivity(),channelBean.getId()+""); | |
| 213 | 215 | } |
| 214 | 216 | }); |
| 215 | 217 | layout_control.addView(textAndImgShowView); |
| ... | ... | @@ -233,5 +235,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 233 | 235 | @Override |
| 234 | 236 | public void getCity(String name) { |
| 235 | 237 | tvLocalAddress.setText(name.split(" ")[1]); |
| 238 | + mPresenter.getBanners("2", name.split(" ")[2]); | |
| 239 | + mPresenter.getContextChannel(name.split(" ")[2], 0, 1, 1); | |
| 240 | + AppContext.getInstance().cityName=name.split(" ")[1]; | |
| 241 | + AppContext.getInstance().district=name.split(" ")[2]; | |
| 236 | 242 | } |
| 237 | 243 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
| ... | ... | @@ -20,6 +20,7 @@ import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
| 20 | 20 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
| 21 | 21 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 22 | 22 | import com.share.mvpsdk.utils.DisplayUtils; |
| 23 | +import com.share.mvpsdk.utils.ToastUtils; | |
| 23 | 24 | import com.shunzhi.parent.AppConfig; |
| 24 | 25 | import com.shunzhi.parent.AppContext; |
| 25 | 26 | import com.shunzhi.parent.R; |
| ... | ... | @@ -31,6 +32,7 @@ import com.shunzhi.parent.bean.channel.ChannelContextBean; |
| 31 | 32 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; |
| 32 | 33 | import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; |
| 33 | 34 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
| 35 | +import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; | |
| 34 | 36 | import com.shunzhi.parent.util.AttrsUtils; |
| 35 | 37 | import com.shunzhi.parent.views.TextAndImgShowView; |
| 36 | 38 | |
| ... | ... | @@ -49,6 +51,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 49 | 51 | |
| 50 | 52 | List<MyConsultBean> myConsultBeanList = null; |
| 51 | 53 | |
| 54 | + String channel=""; | |
| 55 | + | |
| 52 | 56 | @Override |
| 53 | 57 | public int getLayoutId() { |
| 54 | 58 | return R.layout.fragment_consult_one_level; |
| ... | ... | @@ -79,7 +83,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 79 | 83 | } |
| 80 | 84 | |
| 81 | 85 | private void initViews(View view) { |
| 82 | - | |
| 86 | + channel=getArguments().getString("channel"); | |
| 87 | + ToastUtils.showToast(channel); | |
| 83 | 88 | layout_control = view.findViewById(R.id.layout_control); |
| 84 | 89 | layout_control.measure(0, 0); |
| 85 | 90 | // mPresenter.getTools(layout_control); |
| ... | ... | @@ -87,7 +92,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 87 | 92 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); |
| 88 | 93 | |
| 89 | 94 | mPresenter.getBanners("3", AppContext.getInstance().district); |
| 90 | - mPresenter.getConsultContent(AppContext.getInstance().district, 42, 0, 1); | |
| 95 | + mPresenter.getConsultContent(AppContext.getInstance().district, Integer.parseInt(channel), 0, 1); | |
| 91 | 96 | // initRecyclerViewConsult(); |
| 92 | 97 | } |
| 93 | 98 | |
| ... | ... | @@ -132,8 +137,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 132 | 137 | |
| 133 | 138 | @Override |
| 134 | 139 | public void showConsultContent(List<ChannelContextBean> list) { |
| 135 | -// contextList.clear(); | |
| 136 | -// contextList.addAll(list); | |
| 137 | 140 | if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); |
| 138 | 141 | myConsultAdapter.addAll(list); |
| 139 | 142 | recyclerViewConsultOne.setAdapter(myConsultAdapter); |
| ... | ... | @@ -150,10 +153,12 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon |
| 150 | 153 | textAndImgShowView.setSelect(true); |
| 151 | 154 | textAndImgShowView.setWidth(getActivity(), layout_control); |
| 152 | 155 | textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0)); |
| 156 | + textAndImgShowView.setTag(list.get(i)); | |
| 153 | 157 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
| 154 | 158 | @Override |
| 155 | 159 | public void onClick(View view) { |
| 156 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 160 | + ChannelBean channelBean= (ChannelBean) view.getTag(); | |
| 161 | + ConsultTwoLevelActivity.getInstance(getActivity(),channelBean.getId()+""); | |
| 157 | 162 | } |
| 158 | 163 | }); |
| 159 | 164 | layout_control.addView(textAndImgShowView); | ... | ... |
app/src/main/res/layout/activity_consult_one_level.xml
| ... | ... | @@ -10,11 +10,10 @@ |
| 10 | 10 | <include layout="@layout/layout_search_back"/> |
| 11 | 11 | |
| 12 | 12 | |
| 13 | - <fragment | |
| 14 | - android:id="@+id/MyFragment" | |
| 13 | + <FrameLayout | |
| 15 | 14 | android:layout_width="match_parent" |
| 16 | 15 | android:layout_height="match_parent" |
| 17 | - android:name="com.shunzhi.parent.ui.fragment.consult.ConsultOneLevelFragment" | |
| 18 | - /> | |
| 16 | + android:id="@+id/frame_consult" | |
| 17 | + ></FrameLayout> | |
| 19 | 18 | |
| 20 | 19 | </LinearLayout> | ... | ... |
app/src/main/res/layout/fragment_mine.xml
| ... | ... | @@ -241,7 +241,7 @@ |
| 241 | 241 | <LinearLayout |
| 242 | 242 | android:layout_width="match_parent" |
| 243 | 243 | android:gravity="center_vertical" |
| 244 | - android:layout_height="40dp"> | |
| 244 | + android:layout_height="?android:actionBarSize"> | |
| 245 | 245 | |
| 246 | 246 | <TextView |
| 247 | 247 | android:layout_width="25dp" |
| ... | ... | @@ -269,7 +269,7 @@ |
| 269 | 269 | |
| 270 | 270 | <LinearLayout |
| 271 | 271 | android:layout_width="match_parent" |
| 272 | - android:layout_height="40dp" | |
| 272 | + android:layout_height="?android:actionBarSize" | |
| 273 | 273 | android:gravity="center_vertical" |
| 274 | 274 | |
| 275 | 275 | > |
| ... | ... | @@ -299,7 +299,7 @@ |
| 299 | 299 | android:background="@color/bottomline" /> |
| 300 | 300 | <LinearLayout |
| 301 | 301 | android:layout_width="match_parent" |
| 302 | - android:layout_height="40dp" | |
| 302 | + android:layout_height="?android:actionBarSize" | |
| 303 | 303 | android:gravity="center_vertical" |
| 304 | 304 | > |
| 305 | 305 | |
| ... | ... | @@ -324,14 +324,12 @@ |
| 324 | 324 | <TextView |
| 325 | 325 | android:id="@+id/tvExit" |
| 326 | 326 | android:layout_width="match_parent" |
| 327 | - android:layout_height="wrap_content" | |
| 327 | + android:layout_height="?android:actionBarSize" | |
| 328 | 328 | android:layout_gravity="center_vertical" |
| 329 | 329 | android:gravity="center" |
| 330 | 330 | android:layout_weight="1" |
| 331 | 331 | android:layout_marginTop="@dimen/size_dp_15" |
| 332 | 332 | android:layout_marginBottom="@dimen/size_dp_15" |
| 333 | - android:paddingTop="@dimen/size_dp_5" | |
| 334 | - android:paddingBottom="@dimen/size_dp_5" | |
| 335 | 333 | android:background="@drawable/shape_xueqing_radius8" |
| 336 | 334 | android:text="退出登录" |
| 337 | 335 | android:textColor="@color/white" | ... | ... |