fix class
This commit is contained in:
@@ -2,8 +2,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.biz
|
||||
|
||||
import android.util.Log
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.IBadCasePresenter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.Repository
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import kotlinx.android.synthetic.main.layout_badcase_collect.view.*
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -31,17 +31,17 @@ import java.util.*
|
||||
internal class BadCaseView: ConstraintLayout {
|
||||
|
||||
@Volatile
|
||||
private var selectCase: Reason? = null
|
||||
private var selectCase: BadCaseResponse.Reason? = null
|
||||
|
||||
@Volatile
|
||||
private var cases: List<Reason>? = null
|
||||
private var cases: List<BadCaseResponse.Reason>? = null
|
||||
|
||||
private val presenter by lazy {
|
||||
BadCasePresenter()
|
||||
}
|
||||
|
||||
private var onDismiss: (() -> Unit)? = null
|
||||
private var onSelect:(suspend (reason: Reason) -> Unit)? = null
|
||||
private var onSelect:(suspend (reason: BadCaseResponse.Reason) -> Unit)? = null
|
||||
|
||||
private val scope by lazy {
|
||||
lifecycleOwner.lifecycleScope
|
||||
@@ -94,7 +94,7 @@ internal class BadCaseView: ConstraintLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private fun refresh(causes: List<Reason>) {
|
||||
private fun refresh(causes: List<BadCaseResponse.Reason>) {
|
||||
cases = causes
|
||||
rv_take_over?.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context, LinearLayoutManager.VERTICAL, false)
|
||||
@@ -146,7 +146,7 @@ internal class BadCaseView: ConstraintLayout {
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun bindData(case: Reason) {
|
||||
fun bindData(case: BadCaseResponse.Reason) {
|
||||
check.isSelected = case.isChecked
|
||||
reason.text = case.reason ?: ""
|
||||
if (case.isChecked) {
|
||||
@@ -163,7 +163,7 @@ internal class BadCaseView: ConstraintLayout {
|
||||
|
||||
private fun hasCheckedItem(): Boolean = cases?.find { it.isChecked } != null
|
||||
|
||||
private fun cancelOtherChecked(case: Reason) {
|
||||
private fun cancelOtherChecked(case: BadCaseResponse.Reason) {
|
||||
val cases = cases
|
||||
if (cases == null || cases.isEmpty()) {
|
||||
return
|
||||
@@ -174,7 +174,7 @@ internal class BadCaseView: ConstraintLayout {
|
||||
}
|
||||
}
|
||||
|
||||
fun register(record: AutoPilotRecord?, onDismiss: () -> Unit, onSelect:suspend (reason: Reason) -> Unit) {
|
||||
fun register(record: AutoPilotRecord?, onDismiss: () -> Unit, onSelect:suspend (reason: BadCaseResponse.Reason) -> Unit) {
|
||||
this.record = record
|
||||
this.onDismiss = onDismiss
|
||||
this.onSelect = onSelect
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
|
||||
|
||||
internal interface IBadCasePresenter {
|
||||
|
||||
suspend fun loadBadCases(): List<Reason>
|
||||
suspend fun loadBadCases(): List<BadCaseResponse.Reason>
|
||||
|
||||
suspend fun updateLastModified(timestamp: Long)
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository.net.api
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.UploadResult
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
internal interface BadCaseApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-vehicle-management-service/tool/badcase/add")
|
||||
suspend fun post(@FieldMap map: Map<String, String>): Response<UploadResult>
|
||||
|
||||
@GET("/yycp-vehicle-management-service/tool/badcase/reasons")
|
||||
suspend fun get(): Response<BadCaseResponse>
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.Expose
|
||||
|
||||
@Keep
|
||||
internal class BadCaseResponse {
|
||||
var code: Int = -1
|
||||
var data: List<Reason>? = null
|
||||
var msg: String? = null
|
||||
var success: Boolean = false
|
||||
var total: Int = -1
|
||||
|
||||
@Expose(serialize = false, deserialize = false)
|
||||
var isBuildIn: Boolean = false
|
||||
|
||||
@Keep
|
||||
class Reason {
|
||||
var id: String? = null
|
||||
var reason: String? = null
|
||||
|
||||
/**
|
||||
* 业务字段,不参与序列化和反序列化
|
||||
*/
|
||||
@Expose(deserialize = false, serialize = false)
|
||||
var isChecked: Boolean = false
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
@Keep
|
||||
internal class UploadResult {
|
||||
var code: Int = -1
|
||||
var msg: String? = null
|
||||
var data: Array<String>? = null
|
||||
var success: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "UploadResult(code=$code, msg=$msg, data=${data?.contentToString()}, success=$success)"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user