- 首页新增净材、毛菜两个渐变色按钮(蓝/橙),隐藏原ImageView入口 - 新增StoreActivity,继承GoodsListActivity,复用秤监听、相机、识别弹窗能力 - GoodsListActivity.replaceIncludeContent()新增else分支,非采购/自采页面隐藏flContainer - BaseDialog设备列表提取为常量,优化小屏幕判断逻辑 - 更新本地测试环境地址及环境切换弹窗文案 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
80 lines
2.2 KiB
Kotlin
80 lines
2.2 KiB
Kotlin
package com.sw.inbound.dialog
|
|
|
|
import android.app.Dialog
|
|
import android.content.Context
|
|
import android.content.ContextWrapper
|
|
import android.graphics.drawable.ColorDrawable
|
|
import android.os.Bundle
|
|
import android.view.Gravity
|
|
import android.view.View
|
|
import com.sw.inbound.GlobalData
|
|
import com.sw.inbound.R
|
|
import com.sw.inbound.activity.FoodCollectionActivity
|
|
import com.sw.inbound.activity.GoodsListActivity
|
|
import com.sw.inbound.utils.ext.dp
|
|
import com.sw.inbound.utils.ext.hideKeyboard
|
|
|
|
//测试设备,小屏幕
|
|
private val devices = listOf(
|
|
"f0bcabbb-0d58-3b14-8bed-9863b7ec61ef",
|
|
"3dff871a-c66a-3fd8-93ce-81b57ead80f4"
|
|
)
|
|
|
|
abstract class BaseDialog(
|
|
context: Context,
|
|
var defWidth: Int = 1500.dp,
|
|
// var defHeight: Int = 900.dp
|
|
var defHeight: Int = if (devices.contains(GlobalData.deviceId)) 750.dp else 900.dp
|
|
) : Dialog(context, R.style.DialogTheme) {
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
val rootView = getRootView()
|
|
setContentView(rootView)
|
|
setCancelable(false)
|
|
setCanceledOnTouchOutside(false)
|
|
window?.apply {
|
|
setLayout(defWidth, defHeight)
|
|
setBackgroundDrawable(ColorDrawable())
|
|
setGravity(Gravity.CENTER)
|
|
}
|
|
rootView.setOnClickListener { it.hideKeyboard() }
|
|
initView()
|
|
}
|
|
|
|
abstract fun getRootView(): View
|
|
|
|
abstract fun initView()
|
|
|
|
fun getReceiptActivity(): GoodsListActivity? {
|
|
var ctx = context
|
|
while (ctx is ContextWrapper) {
|
|
ctx = ctx.baseContext
|
|
if (ctx is GoodsListActivity) {
|
|
return ctx
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
|
|
fun getFoodCollectionActivity(): FoodCollectionActivity? {
|
|
var ctx = context
|
|
while (ctx is ContextWrapper) {
|
|
ctx = ctx.baseContext
|
|
if (ctx is FoodCollectionActivity) {
|
|
return ctx
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
|
|
override fun show() {
|
|
super.show()
|
|
DialogManager.addDialog(this)
|
|
}
|
|
|
|
override fun dismiss() {
|
|
super.dismiss()
|
|
DialogManager.removeDialog(this)
|
|
}
|
|
} |