From 6f73e9688868e94746d18716750e6d871429f107 Mon Sep 17 00:00:00 2001 From: itgaojian Date: Tue, 21 Mar 2023 10:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=8B=E4=BB=B6=E8=87=AA?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=97=A0=E6=97=A5=E5=BF=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drawable/shape_rectangle_white_top.xml | 4 +- .../activitys/logs/IncidentLogActivity.java | 67 ++++++++++--------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/baselib/src/main/res/drawable/shape_rectangle_white_top.xml b/baselib/src/main/res/drawable/shape_rectangle_white_top.xml index 4a54d43..14a189b 100755 --- a/baselib/src/main/res/drawable/shape_rectangle_white_top.xml +++ b/baselib/src/main/res/drawable/shape_rectangle_white_top.xml @@ -3,6 +3,6 @@ android:shape="rectangle"> + android:topLeftRadius="20dp" + android:topRightRadius="20dp" /> \ No newline at end of file diff --git a/commonmodule/src/main/java/com/tengshisoft/commonmodule/activitys/logs/IncidentLogActivity.java b/commonmodule/src/main/java/com/tengshisoft/commonmodule/activitys/logs/IncidentLogActivity.java index b8b6032..34f7bbe 100644 --- a/commonmodule/src/main/java/com/tengshisoft/commonmodule/activitys/logs/IncidentLogActivity.java +++ b/commonmodule/src/main/java/com/tengshisoft/commonmodule/activitys/logs/IncidentLogActivity.java @@ -1,5 +1,10 @@ package com.tengshisoft.commonmodule.activitys.logs; +import android.text.TextUtils; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.alibaba.android.arouter.facade.annotation.Route; import com.scwang.smart.refresh.layout.SmartRefreshLayout; import com.tengshisoft.commonmodule.R; @@ -16,8 +21,6 @@ import com.tenlionsoft.baselib.utils.UserLgUtils; import java.util.ArrayList; import java.util.List; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; @@ -77,7 +80,11 @@ public class IncidentLogActivity extends BaseActivity { mAdapter = new IncidentLogAdapter(mActivity, mDatas); mRlvContent.setLayoutManager(new LinearLayoutManager(mActivity)); mRlvContent.setAdapter(mAdapter); - getLogList(); + if (TextUtils.isEmpty(mBusinessId)) { + refreshView(STATE_LOAD_EMPTY); + } else { + getLogList(); + } } /** @@ -85,37 +92,37 @@ public class IncidentLogActivity extends BaseActivity { */ private void getLogList() { RetrofitManager.getInstance() - .create(GridApis.class) - .getIncidentLogList(mBusinessId, UserLgUtils.getToken()) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer>() { - @Override - public void onSubscribe(@NonNull Disposable d) { + .create(GridApis.class) + .getIncidentLogList(mBusinessId, UserLgUtils.getToken()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer>() { + @Override + public void onSubscribe(@NonNull Disposable d) { - } - - @Override - public void onNext(@NonNull List incidentLogBeans) { - if (incidentLogBeans.size() > 0) { - refreshView(STATE_LOAD_SUCCESS); - mDatas = incidentLogBeans; - mAdapter.setData(mDatas); - } else { - refreshView(STATE_LOAD_EMPTY); } - } - @Override - public void onError(@NonNull Throwable e) { - refreshView(STATE_LOAD_ERROR); - ExceptionHandler.handleException(e); - } + @Override + public void onNext(@NonNull List incidentLogBeans) { + if (incidentLogBeans.size() > 0) { + refreshView(STATE_LOAD_SUCCESS); + mDatas = incidentLogBeans; + mAdapter.setData(mDatas); + } else { + refreshView(STATE_LOAD_EMPTY); + } + } - @Override - public void onComplete() { + @Override + public void onError(@NonNull Throwable e) { + refreshView(STATE_LOAD_ERROR); + ExceptionHandler.handleException(e); + } - } - }); + @Override + public void onComplete() { + + } + }); } } \ No newline at end of file