From 52c0a9d0b3580248119caa32392201186d7e8394 Mon Sep 17 00:00:00 2001 From: taohd <2821744554@qq.com> Date: Sat, 5 May 2018 10:09:52 +0800 Subject: [PATCH] no message --- app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java | 2 ++ app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java b/app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java index e42d7eb..8002fb9 100644 --- a/app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java +++ b/app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java @@ -71,7 +71,9 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { GuangGaoBean guangGaoBean = new Gson().fromJson(jsonArray.get(i).getAsJsonObject(), GuangGaoBean.class); guangGaoBeanList.add(guangGaoBean); } + if (guangGaoBeanList.size()>0) mIView.showBanners(guangGaoBeanList); + else ToastUtils.showToast("该地区下没有信息,请换个地区"); } else { ToastUtils.showToast(jsonObject.get("message").getAsString()); } diff --git a/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java b/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java index 27e2e1e..49002a2 100644 --- a/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java +++ b/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java @@ -9,6 +9,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; +import android.support.v4.view.ViewPager; import android.support.v4.widget.NestedScrollView; import android.text.TextUtils; import android.view.View; @@ -242,16 +243,18 @@ public class ConsultFragment extends BaseMVPCompatFragment guangGaoBeanList) { - describeList.clear(); - imgesUrl.clear(); - imgWebUrl.clear(); - guanggaoList = guangGaoBeanList; - for (int i = 0; i < guangGaoBeanList.size(); i++) { - imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); - describeList.add(guangGaoBeanList.get(i).describe); - imgWebUrl.add(guangGaoBeanList.get(i).url); + if (guangGaoBeanList.size()>0){ + describeList.clear(); + imgesUrl.clear(); + imgWebUrl.clear(); + guanggaoList = guangGaoBeanList; + for (int i = 0; i < guangGaoBeanList.size(); i++) { + imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); + describeList.add(guangGaoBeanList.get(i).describe); + imgWebUrl.add(guangGaoBeanList.get(i).url); + } + initBanners(); } - initBanners(); } @Override -- libgit2 0.21.0