|
@@ -4,17 +4,30 @@ import androidx.fragment.app.Fragment;
|
|
|
|
|
|
import com.tofly.latte_core.base.LatteActivity;
|
|
|
import com.tofly.latte_core.base.LatteContract;
|
|
|
+import com.tofly.latte_core.utils.AccountManager;
|
|
|
import com.tofly.yxpc.databinding.ActivityDataCorrectionBinding;
|
|
|
+import com.tofly.yxpc.entity.DataCorrectionBean;
|
|
|
+import com.tofly.yxpc.entity.DataCorrectionPeopleBean;
|
|
|
+import com.tofly.yxpc.entity.PageInfo;
|
|
|
import com.tofly.yxpc.ui.adapter.ListPageAdapter;
|
|
|
import com.tofly.yxpc.ui.fragment.MyDataCorrectionFragment;
|
|
|
import com.tofly.yxpc.ui.fragment.WholeDataCorrectionFragment;
|
|
|
+import com.tofly.yxpc.ui.impl.DataCorrectionImpl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
+
|
|
|
+ * @author 76486
|
|
|
+ */
|
|
|
public class DataCorrectionActivity extends LatteActivity {
|
|
|
|
|
|
private ActivityDataCorrectionBinding binding;
|
|
|
+ private final List<String> titles = new ArrayList<>();
|
|
|
+ private ListPageAdapter listPageAdapter;
|
|
|
|
|
|
@Override
|
|
|
public Object setLayout() {
|
|
@@ -24,7 +37,7 @@ public class DataCorrectionActivity extends LatteActivity {
|
|
|
|
|
|
@Override
|
|
|
protected LatteContract.LattePresenter createPresenter() {
|
|
|
- return null;
|
|
|
+ return new DataCorrectionImpl();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -34,13 +47,14 @@ public class DataCorrectionActivity extends LatteActivity {
|
|
|
}
|
|
|
|
|
|
private void initTabLayout() {
|
|
|
- String[] strings = {"待我整改 0", "全部待整改 0"};
|
|
|
+ titles.add("待我整改");
|
|
|
+ titles.add("全部待整改");
|
|
|
List<Fragment> fragmentList = new ArrayList<>();
|
|
|
MyDataCorrectionFragment myDataCorrectionFragment = new MyDataCorrectionFragment();
|
|
|
WholeDataCorrectionFragment wholeDataCorrectionFragment = new WholeDataCorrectionFragment();
|
|
|
fragmentList.add(myDataCorrectionFragment);
|
|
|
fragmentList.add(wholeDataCorrectionFragment);
|
|
|
- ListPageAdapter listPageAdapter = new ListPageAdapter(getSupportFragmentManager(), strings, null, fragmentList);
|
|
|
+ listPageAdapter = new ListPageAdapter(getSupportFragmentManager(), titles, null, fragmentList);
|
|
|
binding.viewPager.setAdapter(listPageAdapter);
|
|
|
binding.viewPager.setOffscreenPageLimit(2);
|
|
|
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
|
@@ -50,4 +64,51 @@ public class DataCorrectionActivity extends LatteActivity {
|
|
|
|
|
|
binding.viewPager.setCurrentItem(0);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("correctionStatus", "待整改");
|
|
|
+ map.put("inspectUser", AccountManager.getUserId());
|
|
|
+ map.put("size", 1);
|
|
|
+ map.put("current", 1);
|
|
|
+ mPresenter.getResultOne(this, map);
|
|
|
+ mPresenter.getResultTwo(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public <T> void getResultOne(T response) {
|
|
|
+ if (response != null) {
|
|
|
+ PageInfo<DataCorrectionBean> pageInfo = (PageInfo<DataCorrectionBean>) response;
|
|
|
+ if (pageInfo.getTotal() > 0) {
|
|
|
+ titles.set(0, "待我整改 " + pageInfo.getTotal());
|
|
|
+ } else {
|
|
|
+ titles.set(0, "待我整改");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ titles.set(0, "待我整改");
|
|
|
+ }
|
|
|
+ listPageAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public <T> void getResultTwo(T response) {
|
|
|
+ super.getResultTwo(response);
|
|
|
+ List<DataCorrectionPeopleBean> peopleList = new ArrayList<>();
|
|
|
+ if (response != null) {
|
|
|
+ peopleList.addAll((Collection<? extends DataCorrectionPeopleBean>) response);
|
|
|
+ }
|
|
|
+ int size = 0;
|
|
|
+ for (DataCorrectionPeopleBean bean : peopleList) {
|
|
|
+ size = size + bean.getCounts();
|
|
|
+ }
|
|
|
+ if (size > 0) {
|
|
|
+ titles.set(1, "全部待整改 " + size);
|
|
|
+ } else {
|
|
|
+ titles.set(1, "全部待整改");
|
|
|
+ }
|
|
|
+ listPageAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
}
|