| | |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | |
| | | import androidx.activity.result.ActivityResultLauncher; |
| | | import androidx.activity.result.contract.ActivityResultContracts; |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | |
| | | * 备注:首页 |
| | | */ |
| | | public class OrderFragment extends BaseFragment { |
| | | |
| | | public static final int RESULT_REFRESH = 1001; |
| | | |
| | | private final int STATE_DONE = 2; |
| | | private final int STATE_UNDONE = 1; |
| | |
| | | int state = 1; |
| | | List<OrderListResult.Data> recordsListDone = new ArrayList<>(); |
| | | List<OrderListResult.Data> recordsList = new ArrayList<>(); |
| | | RefreshLayout myRefreshLayout; |
| | | |
| | | private ActivityResultLauncher<Intent> activityResultLauncher = |
| | | registerForActivityResult( |
| | | new ActivityResultContracts.StartActivityForResult(), |
| | | result -> { |
| | | if (result.getResultCode() == RESULT_REFRESH) { |
| | | myRefreshLayout.autoRefresh(); |
| | | } |
| | | }); |
| | | |
| | | /** |
| | | * 设置天气相关信息 |
| | |
| | | initView(); |
| | | //获取定位服务传过来的坐标点 |
| | | LiveEventBus.get(CommonKeyName.MQTTData).observeForever(o -> { |
| | | |
| | | }); |
| | | |
| | | |
| | | return binding.getRoot(); |
| | | } |
| | |
| | | state = STATE_DONE;//1 未开始 2 已完成 |
| | | }); |
| | | //未完成 |
| | | RefreshLayout myRefreshLayout = (RefreshLayout) binding.refreshLayout; |
| | | myRefreshLayout = (RefreshLayout) binding.refreshLayout; |
| | | myRefreshLayout.setRefreshHeader(new ClassicsHeader(this.getContext())); |
| | | myRefreshLayout.setRefreshFooter(new ClassicsFooter(this.getContext())); |
| | | |
| | |
| | | } else { |
| | | recordsListDone.addAll(t.getContent().getObj()); |
| | | } |
| | | if (t.getContent().getObj().size() < pageSize) { |
| | | if (t.getContent().getPageTotal() == page) { |
| | | refreshlayout.finishLoadMoreWithNoMoreData(); |
| | | } |
| | | } else { |
| | |
| | | } else { |
| | | mDoneAdapter.notifyDataSetChanged(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }); |
| | |
| | | if (!TextUtils.isEmpty(proResultId)) { |
| | | intent.putExtra("proResultId", proResultId); |
| | | } |
| | | startActivity(intent); |
| | | activityResultLauncher.launch(intent); |
| | | } |
| | | |
| | | |