| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | void chooseStateView(boolean state) { |
| | | if (state) { |
| | | binding.manageStateProgress.setTextColor(getResources().getColor(R.color.title_color)); |
| | | binding.manageStateProgress.setBackground(getResources().getDrawable(R.drawable.ic_choose_bg_whit)); |
| | | binding.manageStateProgress.setTextColor(getResources().getColor(R.color.title_color,null)); |
| | | binding.manageStateProgress.setBackground(getResources().getDrawable(R.drawable.ic_choose_bg_whit,null)); |
| | | binding.manageStateProgress.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); |
| | | binding.manageStateFinish.setTextColor(getResources().getColor(R.color.black)); |
| | | binding.manageStateFinish.setBackground(getResources().getDrawable(R.color.title_choose_bg)); |
| | | binding.manageStateFinish.setTextColor(getResources().getColor(R.color.black,null)); |
| | | binding.manageStateFinish.setBackground(getResources().getDrawable(R.color.title_choose_bg,null)); |
| | | binding.manageStateFinish.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); |
| | | binding.refreshLayout.setVisibility(View.VISIBLE); |
| | | binding.refreshLayoutDone.setVisibility(View.GONE); |
| | | } else { |
| | | binding.manageStateFinish.setTextColor(getResources().getColor(R.color.title_color)); |
| | | binding.manageStateFinish.setBackground(getResources().getDrawable(R.drawable.ic_choose_bg_whit)); |
| | | binding.manageStateFinish.setTextColor(getResources().getColor(R.color.title_color,null)); |
| | | binding.manageStateFinish.setBackground(getResources().getDrawable(R.drawable.ic_choose_bg_whit,null)); |
| | | binding.manageStateFinish.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); |
| | | binding.manageStateProgress.setTextColor(getResources().getColor(R.color.black)); |
| | | binding.manageStateProgress.setBackground(getResources().getDrawable(R.color.title_choose_bg)); |
| | | binding.manageStateProgress.setTextColor(getResources().getColor(R.color.black,null)); |
| | | binding.manageStateProgress.setBackground(getResources().getDrawable(R.color.title_choose_bg,null)); |
| | | binding.manageStateProgress.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); |
| | | binding.refreshLayout.setVisibility(View.GONE); |
| | | binding.refreshLayoutDone.setVisibility(View.VISIBLE); |