| | |
| | | fun show( |
| | | context: Context, |
| | | result: CruiseCheckInOperationResult, |
| | | needNext: Boolean = true, |
| | | needOperation: Boolean = true, |
| | | operationLabel: String? = "前往下一个点位", |
| | | ): MaterialDialog { |
| | | val dialog = DialogFactory.produce(context).apply { |
| | | customView( |
| | |
| | | } |
| | | rvList.layoutManager = GridLayoutManager(context, 3) |
| | | tvOperation.setOnClickListener { dismiss() } |
| | | tvOperation.visibility = if (needNext) View.VISIBLE else View.GONE |
| | | tvOperation.visibility = if (needOperation) View.VISIBLE else View.GONE |
| | | tvOperation.text = operationLabel |
| | | } |
| | | dialog.show() |
| | | dialog.window?.setGravity(Gravity.CENTER) |
| | |
| | | |
| | | companion object { |
| | | //获取跳转此页面参数 |
| | | fun getParams(id: String, point: CheckInMissionPointInfo): Bundle { |
| | | fun getParams(id: String, point: CheckInMissionPointInfo, endPoint: Boolean): Bundle { |
| | | return bundleOf( |
| | | Key.ID to id, |
| | | Key.DATA to point |
| | | Key.DATA to point, |
| | | Key.END_POINT to endPoint, |
| | | ) |
| | | } |
| | | } |
| | |
| | | super.onCreate(savedInstanceState) |
| | | viewModel.id = intent.getStringExtra(Key.ID) ?: "" |
| | | viewModel.model.postValue(intent.getParcelableExtra(Key.DATA)) |
| | | viewModel.isEndPoint = intent.getBooleanExtra(Key.END_POINT, false) |
| | | } |
| | | |
| | | override fun setListener() { |
| | |
| | | launchRequest { |
| | | workRepository.getCruiseCheckInRecordInfo(id, info.locationId!!)?.also { |
| | | withContext(Dispatchers.Main) { |
| | | CruiseCheckInSuccessDialog.show(context, it, needNext = false) |
| | | CruiseCheckInSuccessDialog.show(context, it, needOperation = false) |
| | | } |
| | | } |
| | | } |
| | |
| | | val workRepository: WorkRepository by inject() |
| | | var id: String = "" |
| | | val model = MutableLiveData<CheckInMissionPointInfo>() |
| | | |
| | | //是否是最后一个点 |
| | | var isEndPoint = false |
| | | val working = MutableLiveData<Boolean>(true) |
| | | val maxLength = MutableLiveData(200) |
| | | val desc = MutableLiveData("") |
| | |
| | | val list = workRepository.getCheckInMissionPointsList(id) |
| | | if (list == null || list.count { !it.hadCheckIn() } > 0) { |
| | | withContext(Dispatchers.Main) { |
| | | CruiseCheckInSuccessDialog.show(context, it).apply { |
| | | CruiseCheckInSuccessDialog.show( |
| | | context = context, result = it, |
| | | operationLabel = if (isEndPoint) "前往打卡列表页" else "前往下一个点位" |
| | | ).apply { |
| | | setOnDismissListener { _ -> |
| | | EventBus.getDefault().post(it) |
| | | finish() |
| | |
| | | fun jumpToCheckInPage(info: CheckInMissionPointInfo) { |
| | | startActivity( |
| | | CruiseCheckInOperationActivity::class.java, |
| | | CruiseCheckInOperationActivity.getParams(id, info) |
| | | CruiseCheckInOperationActivity.getParams(id, info, info == points.value?.lastOrNull()) |
| | | ) |
| | | } |
| | | |