version:2.1
fix: update:优化没有数据时的显示
This commit is contained in:
@@ -77,6 +77,15 @@ public class SecondFragment extends BaseFragment {
|
|||||||
@BindView(R.id.tv_price)
|
@BindView(R.id.tv_price)
|
||||||
TextView tv_price;
|
TextView tv_price;
|
||||||
|
|
||||||
|
@BindView(R.id.iv1)
|
||||||
|
ImageView iv1;
|
||||||
|
@BindView(R.id.iv2)
|
||||||
|
ImageView iv2;
|
||||||
|
@BindView(R.id.iv3)
|
||||||
|
ImageView iv3;
|
||||||
|
@BindView(R.id.iv4)
|
||||||
|
ImageView iv4;
|
||||||
|
|
||||||
@BindView(R.id.cl_activity)
|
@BindView(R.id.cl_activity)
|
||||||
ConstraintLayout cl_activity;
|
ConstraintLayout cl_activity;
|
||||||
|
|
||||||
@@ -170,13 +179,15 @@ public class SecondFragment extends BaseFragment {
|
|||||||
Log.e("getDemandList", "onNext: " + listBaseResponse);
|
Log.e("getDemandList", "onNext: " + listBaseResponse);
|
||||||
if (listBaseResponse.code == 200) {
|
if (listBaseResponse.code == 200) {
|
||||||
cl4.setVisibility(View.VISIBLE);
|
cl4.setVisibility(View.VISIBLE);
|
||||||
|
iv4.setVisibility(View.GONE);
|
||||||
List<DemandBean> demandBeans = listBaseResponse.data;
|
List<DemandBean> demandBeans = listBaseResponse.data;
|
||||||
if (demandBeans != null && demandBeans.size() != 0) {
|
if (demandBeans != null && demandBeans.size() != 0) {
|
||||||
DemandBean demandBean = demandBeans.get(0);
|
DemandBean demandBean = demandBeans.get(0);
|
||||||
setDemand(demandBean);
|
setDemand(demandBean);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
cl4.setVisibility(View.GONE);
|
cl4.setVisibility(View.GONE);
|
||||||
|
iv4.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,13 +224,15 @@ public class SecondFragment extends BaseFragment {
|
|||||||
Log.e("getActivityList", "onNext: " + listBaseResponse);
|
Log.e("getActivityList", "onNext: " + listBaseResponse);
|
||||||
if (listBaseResponse.code == 200) {
|
if (listBaseResponse.code == 200) {
|
||||||
cl3.setVisibility(View.VISIBLE);
|
cl3.setVisibility(View.VISIBLE);
|
||||||
|
iv3.setVisibility(View.GONE);
|
||||||
List<ActivityBean> activityBeans = listBaseResponse.data;
|
List<ActivityBean> activityBeans = listBaseResponse.data;
|
||||||
if (activityBeans != null && activityBeans.size() != 0) {
|
if (activityBeans != null && activityBeans.size() != 0) {
|
||||||
ActivityBean activityBean = activityBeans.get(0);
|
ActivityBean activityBean = activityBeans.get(0);
|
||||||
setActivity(activityBean);
|
setActivity(activityBean);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
cl3.setVisibility(View.GONE);
|
cl3.setVisibility(View.GONE);
|
||||||
|
iv3.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +268,7 @@ public class SecondFragment extends BaseFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openApp(){
|
private void openApp() {
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
/*知道要跳转应用的包命与目标Activity*/
|
/*知道要跳转应用的包命与目标Activity*/
|
||||||
ComponentName componentName = new ComponentName("com.uiui.city", "com.uiui.city.activity.MainActivity");
|
ComponentName componentName = new ComponentName("com.uiui.city", "com.uiui.city.activity.MainActivity");
|
||||||
@@ -279,13 +292,15 @@ public class SecondFragment extends BaseFragment {
|
|||||||
Log.e("getGoods", "onNext: " + listBaseResponse);
|
Log.e("getGoods", "onNext: " + listBaseResponse);
|
||||||
if (listBaseResponse.code == 200) {
|
if (listBaseResponse.code == 200) {
|
||||||
cl1.setVisibility(View.VISIBLE);
|
cl1.setVisibility(View.VISIBLE);
|
||||||
|
iv1.setVisibility(View.GONE);
|
||||||
List<GoodsInfo> goodsInfoList = listBaseResponse.data;
|
List<GoodsInfo> goodsInfoList = listBaseResponse.data;
|
||||||
if (goodsInfoList != null && goodsInfoList.size() != 0) {
|
if (goodsInfoList != null && goodsInfoList.size() != 0) {
|
||||||
GoodsInfo goodsInfo = goodsInfoList.get(0);
|
GoodsInfo goodsInfo = goodsInfoList.get(0);
|
||||||
setGoodsInfo(goodsInfo);
|
setGoodsInfo(goodsInfo);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
cl1.setVisibility(View.GONE);
|
cl1.setVisibility(View.GONE);
|
||||||
|
iv1.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,13 +337,15 @@ public class SecondFragment extends BaseFragment {
|
|||||||
Log.e("getArticle", "onNext: " + listBaseResponse);
|
Log.e("getArticle", "onNext: " + listBaseResponse);
|
||||||
if (listBaseResponse.code == 200) {
|
if (listBaseResponse.code == 200) {
|
||||||
cl2.setVisibility(View.VISIBLE);
|
cl2.setVisibility(View.VISIBLE);
|
||||||
|
iv2.setVisibility(View.GONE);
|
||||||
List<ArticleInfo> articleInfos = listBaseResponse.data;
|
List<ArticleInfo> articleInfos = listBaseResponse.data;
|
||||||
if (articleInfos != null && articleInfos.size() != 0) {
|
if (articleInfos != null && articleInfos.size() != 0) {
|
||||||
ArticleInfo articleInfo = articleInfos.get(0);
|
ArticleInfo articleInfo = articleInfos.get(0);
|
||||||
setArticleInfo(articleInfo);
|
setArticleInfo(articleInfo);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
cl2.setVisibility(View.GONE);
|
cl2.setVisibility(View.GONE);
|
||||||
|
iv2.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,18 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv1"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/nodata"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/cl1"
|
android:id="@+id/cl1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -47,18 +59,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView9">
|
app:layout_constraintTop_toBottomOf="@+id/textView9">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv1"
|
|
||||||
android:layout_width="80dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/nodata"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_img"
|
android:id="@+id/iv_img"
|
||||||
android:layout_width="152dp"
|
android:layout_width="152dp"
|
||||||
@@ -194,6 +194,18 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv2"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/nodata"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/cl2"
|
android:id="@+id/cl2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -201,19 +213,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView13">
|
app:layout_constraintTop_toBottomOf="@+id/textView13">
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv2"
|
|
||||||
android:layout_width="80dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/nodata"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_aimg"
|
android:id="@+id/iv_aimg"
|
||||||
android:layout_width="224dp"
|
android:layout_width="224dp"
|
||||||
@@ -347,7 +346,7 @@
|
|||||||
android:background="@drawable/custom_background">
|
android:background="@drawable/custom_background">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv3"
|
android:id="@+id/iv4"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user