refactor(entity): 重构数据实体类结构
- 将 FoodCollectionBean 从 objbox 包移动到 entity 包 - 在 DataBean.kt 中添加必要的 Android 图像处理相关导入 - 更新 VectorCollectionAdapter 中 FoodCollectionBean 的导入路径 - 更新 VectorCollectionFragment 中 FoodCollectionBean 的导入路径 - 重命名 DataBean.kt 为 FoodClassInfo.kt - 移除 objbox 包中的重复 FoodCollectionBean 定义
This commit is contained in:
@@ -9,7 +9,7 @@ import com.chad.library.adapter4.BaseQuickAdapter
|
|||||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||||
import com.shuwei.dish.match.R
|
import com.shuwei.dish.match.R
|
||||||
import com.shuwei.dish.match.databinding.ListItemVectorCollectionBinding
|
import com.shuwei.dish.match.databinding.ListItemVectorCollectionBinding
|
||||||
import com.shuwei.dish.match.objbox.FoodCollectionBean
|
import com.shuwei.dish.match.entity.FoodCollectionBean
|
||||||
import com.shuwei.dish.match.utils.ext.load
|
import com.shuwei.dish.match.utils.ext.load
|
||||||
|
|
||||||
class VectorCollectionAdapter (var list: MutableList<FoodCollectionBean>) :
|
class VectorCollectionAdapter (var list: MutableList<FoodCollectionBean>) :
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.shuwei.dish.match.entity
|
package com.shuwei.dish.match.entity
|
||||||
|
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.net.Uri
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
data class HomeModeBean(
|
data class HomeModeBean(
|
||||||
|
|
||||||
var modeName: String = "",
|
var modeName: String = "",
|
||||||
@@ -38,6 +42,44 @@ data class ResetReasoningRecord(
|
|||||||
val list: MutableList<SeasoningEntity>
|
val list: MutableList<SeasoningEntity>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class FoodCollectionBean(
|
||||||
|
var imageUri: Uri? = null,
|
||||||
|
var bitmap: Bitmap? = null,
|
||||||
|
var imageFile: File? = null,
|
||||||
|
var imageVector: FloatArray? = null,
|
||||||
|
var isShowCamera: Boolean = false,
|
||||||
|
var isFinish:Boolean = false,
|
||||||
|
var uploadSuccess:Boolean = false
|
||||||
|
) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as FoodCollectionBean
|
||||||
|
|
||||||
|
if (isShowCamera != other.isShowCamera) return false
|
||||||
|
if (isFinish != other.isFinish) return false
|
||||||
|
if (uploadSuccess != other.uploadSuccess) return false
|
||||||
|
if (imageUri != other.imageUri) return false
|
||||||
|
if (bitmap != other.bitmap) return false
|
||||||
|
if (imageFile != other.imageFile) return false
|
||||||
|
if (!imageVector.contentEquals(other.imageVector)) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = isShowCamera.hashCode()
|
||||||
|
result = 31 * result + isFinish.hashCode()
|
||||||
|
result = 31 * result + uploadSuccess.hashCode()
|
||||||
|
result = 31 * result + (imageUri?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (bitmap?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (imageFile?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (imageVector?.contentHashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//data class DishDetailEntity(
|
//data class DishDetailEntity(
|
||||||
// var foodId: String? = null,
|
// var foodId: String? = null,
|
||||||
// var foodWeight: Double? = null,
|
// var foodWeight: Double? = null,
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
package com.shuwei.dish.match.objbox
|
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.net.Uri
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
data class FoodClassInfo(
|
|
||||||
var class_names: List<String>,
|
|
||||||
var class_to_idx: Map<String, Int>,
|
|
||||||
var idx_to_class: Map<String, String>
|
|
||||||
)
|
|
||||||
|
|
||||||
data class FoodCollectionBean(
|
|
||||||
var imageUri: Uri? = null,
|
|
||||||
var bitmap: Bitmap? = null,
|
|
||||||
var imageFile: File? = null,
|
|
||||||
var imageVector: FloatArray? = null,
|
|
||||||
var isShowCamera: Boolean = false,
|
|
||||||
var isFinish:Boolean = false,
|
|
||||||
var uploadSuccess:Boolean = false
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ReceiptGoodsInfo(
|
|
||||||
var goodsId: String? = "",
|
|
||||||
var goodsName: String? = "",
|
|
||||||
var procurementUnit: String? = "",
|
|
||||||
var procurementCount: Int? = 0,
|
|
||||||
var procurementPrice: Double? = 0.0,
|
|
||||||
var procurementAmount: Double? = 0.0,
|
|
||||||
var receiptCount: Int? = 0,
|
|
||||||
var goodsWeight: Int? = 0,
|
|
||||||
var goodsState: String? = "",
|
|
||||||
var isSelected: Boolean = false,
|
|
||||||
var isLocalGoods: Boolean = false
|
|
||||||
)
|
|
||||||
|
|
||||||
//data class DropdownInfo(
|
|
||||||
// var id: String,
|
|
||||||
// var name: String
|
|
||||||
//)
|
|
||||||
|
|
||||||
//data class RecognizeResult(
|
|
||||||
// var name: String? = null,
|
|
||||||
// var image: String? = null,
|
|
||||||
// var isSelected: Boolean = false
|
|
||||||
//)
|
|
||||||
|
|
||||||
//data class GoodsSearchInfo(
|
|
||||||
// var id: String? = null,
|
|
||||||
// var name: String? = null,
|
|
||||||
// var isSelected: Boolean = false
|
|
||||||
//)
|
|
||||||
|
|
||||||
data class OperateBean(
|
|
||||||
var obj: Any? = null,
|
|
||||||
var typeList: MutableList<OperateType> = mutableListOf(),
|
|
||||||
var isSelected: Boolean = false,
|
|
||||||
var isLocalGoods: Boolean = false,
|
|
||||||
var isReceiptPage: Boolean = true
|
|
||||||
)
|
|
||||||
|
|
||||||
data class OperateType(
|
|
||||||
var value: String = "",
|
|
||||||
var width: Int = 0,
|
|
||||||
var textColor: String = "#FF999999",
|
|
||||||
var isBoldFont: Boolean = false,
|
|
||||||
var isShowIcon: Boolean = false
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.shuwei.dish.match.objbox
|
||||||
|
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.net.Uri
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
data class FoodClassInfo(
|
||||||
|
var class_names: List<String>,
|
||||||
|
var class_to_idx: Map<String, Int>,
|
||||||
|
var idx_to_class: Map<String, String>
|
||||||
|
)
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ import com.shuwei.dish.match.databinding.FragmentVectorCollectionBinding
|
|||||||
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
|
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
|
||||||
import com.shuwei.dish.match.dialog.Loading
|
import com.shuwei.dish.match.dialog.Loading
|
||||||
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
|
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
|
||||||
import com.shuwei.dish.match.objbox.FoodCollectionBean
|
import com.shuwei.dish.match.entity.FoodCollectionBean
|
||||||
import com.shuwei.dish.match.objbox.FoodModule
|
import com.shuwei.dish.match.objbox.FoodModule
|
||||||
import com.shuwei.dish.match.ui.CollectedFoodActivity
|
import com.shuwei.dish.match.ui.CollectedFoodActivity
|
||||||
import com.shuwei.dish.match.ui.SingleFragmentActivity
|
import com.shuwei.dish.match.ui.SingleFragmentActivity
|
||||||
|
|||||||
Reference in New Issue
Block a user