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<ConsultContract.Consu @Override public void showBanners(List<GuangGaoBean> 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