|
@@ -10,6 +10,7 @@ import android.widget.AdapterView;
|
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
|
|
|
|
import com.blankj.utilcode.util.LogUtils;
|
|
import com.blankj.utilcode.util.LogUtils;
|
|
|
|
+import com.blankj.utilcode.util.ThreadUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -17,6 +18,7 @@ import java.util.List;
|
|
import core.ui.activity.BaseCountDownActivity;
|
|
import core.ui.activity.BaseCountDownActivity;
|
|
import core.util.FastClickDelegate;
|
|
import core.util.FastClickDelegate;
|
|
import http.client.ApiRepository;
|
|
import http.client.ApiRepository;
|
|
|
|
+import http.net.UrlValidator;
|
|
import http.vo.request.SafetyListReq;
|
|
import http.vo.request.SafetyListReq;
|
|
import http.vo.response.SafeBook;
|
|
import http.vo.response.SafeBook;
|
|
import io.reactivex.rxjava3.functions.Consumer;
|
|
import io.reactivex.rxjava3.functions.Consumer;
|
|
@@ -91,15 +93,31 @@ public class RuleActivity extends BaseCountDownActivity<ActivityRuleBinding> {
|
|
binding.listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
binding.listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
@Override
|
|
@Override
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
- SafeBook safeBook = ruleAdapter.getItem(position);
|
|
|
|
- if (TextUtils.isEmpty(safeBook.content)) {
|
|
|
|
- showToast("数据异常,无法展示,请重新上传!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- Intent intent = new Intent(RuleActivity.this, RuleDetailActivity.class);
|
|
|
|
- intent.putExtra("data", safeBook);
|
|
|
|
- intent.putExtra("onEboard", true);
|
|
|
|
- startActivity(intent);
|
|
|
|
|
|
+ showLoading("请稍候...");
|
|
|
|
+ ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<SafeBook>() {
|
|
|
|
+ @Override
|
|
|
|
+ public SafeBook doInBackground() throws Throwable {
|
|
|
|
+ SafeBook safeBook = ruleAdapter.getItem(position);
|
|
|
|
+ if (TextUtils.isEmpty(safeBook.content)) {
|
|
|
|
+ showToast("数据异常,无法展示,请重新上传!");
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ if (!UrlValidator.isDownloadable(safeBook.content)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return safeBook;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onSuccess(SafeBook result) {
|
|
|
|
+ dismissLoading();
|
|
|
|
+ Intent intent = new Intent(RuleActivity.this, RuleDetailActivity.class);
|
|
|
|
+ intent.putExtra("data", result);
|
|
|
|
+ intent.putExtra("onEboard", true);
|
|
|
|
+ startActivity(intent);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|