|
@@ -23,6 +23,7 @@ import com.blankj.utilcode.util.AppUtils
|
|
|
import com.develop.base.R
|
|
|
import com.develop.base.ext.dimenRes
|
|
|
import com.develop.base.ext.getSN
|
|
|
+import com.develop.base.ext.isBrand036I
|
|
|
import com.develop.base.ext.isNightTheme
|
|
|
import com.develop.base.ext.updateText
|
|
|
import com.develop.base.util.GlobalToast
|
|
@@ -87,12 +88,15 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
super.onCreate(savedInstanceState)
|
|
|
val ivLogoParam = binding.ivLogo.layoutParams as RelativeLayout.LayoutParams
|
|
|
val ivUpdateParam = binding.icUpdate.layoutParams as LinearLayout.LayoutParams
|
|
|
- if (isNightTheme()) {
|
|
|
+ if (isNightTheme() || isBrand036I()) {
|
|
|
ivLogoParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_321px)
|
|
|
height = dimenRes(com.develop.common.R.dimen.convert_95px)
|
|
|
marginStart = dimenRes(com.develop.common.R.dimen.convert_135px)
|
|
|
}
|
|
|
+ if (isBrand036I()) {
|
|
|
+ binding.ivLogo.setBackgroundResource(com.develop.common.R.drawable.ic_logo_036i)
|
|
|
+ }
|
|
|
ivUpdateParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_66px)
|
|
|
height = dimenRes(com.develop.common.R.dimen.convert_66px)
|
|
@@ -120,7 +124,8 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
binding.devSn.text = getSN()
|
|
|
|
|
|
CofarSDK.devInfo().let {
|
|
|
- binding.tvMcuVersion.text = (it.manufacturer.toString() + "P" + it.haradware.toString() + "S" + it.software.toString())
|
|
|
+ binding.tvMcuVersion.text =
|
|
|
+ (it.manufacturer.toString() + "P" + it.haradware.toString() + "S" + it.software.toString())
|
|
|
}
|
|
|
|
|
|
binding.tvFirmware.text = Build.DISPLAY
|
|
@@ -167,38 +172,39 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
if (weightAlignCount >= 7) {
|
|
|
weightAlignCount = 0
|
|
|
|
|
|
- //2023年06月29日14:16:18 处理密码弹出
|
|
|
+ //2023年06月29日14:16:18 处理密码弹出
|
|
|
val pwdDialog = PwdDialog()
|
|
|
pwdDialog.title = getString(com.develop.common.R.string.password)
|
|
|
- pwdDialog.showDialog(supportFragmentManager,"pwdDialog")
|
|
|
- pwdDialog.onDialogClickListener = object :PwdDialog.OnDialogClickListener{
|
|
|
-
|
|
|
- override fun onConfirm(pwd:String) {
|
|
|
- if("12345678".equals(pwd)){
|
|
|
- pwdDialog.removeSelf()
|
|
|
- cancelConfirmDialog.title = getString(com.develop.common.R.string.change_lang_tips)
|
|
|
- cancelConfirmDialog.showCancel = false
|
|
|
- cancelConfirmDialog.onDialogClickListener =
|
|
|
- object : CancelConfirmDialog.OnDialogClickListener {
|
|
|
- override fun onConfirm() {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- override fun onCancel() {
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if (CofarSDK.devInfo().runningStatus == DevStatus.RUNNING) {
|
|
|
- cancelConfirmDialog.showDialog(supportFragmentManager, "confirm")
|
|
|
- } else {
|
|
|
- //进入称重标定模式
|
|
|
- CofarSDK.startWeightAlign()
|
|
|
- GlobalDevEvent.weight = true
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- GlobalToast.showToast(getString(com.develop.common.R.string.password_uncorrect))
|
|
|
- }
|
|
|
+ pwdDialog.showDialog(supportFragmentManager, "pwdDialog")
|
|
|
+ pwdDialog.onDialogClickListener = object : PwdDialog.OnDialogClickListener {
|
|
|
+
|
|
|
+ override fun onConfirm(pwd: String) {
|
|
|
+ if ("12345678".equals(pwd)) {
|
|
|
+ pwdDialog.removeSelf()
|
|
|
+ cancelConfirmDialog.title =
|
|
|
+ getString(com.develop.common.R.string.change_lang_tips)
|
|
|
+ cancelConfirmDialog.showCancel = false
|
|
|
+ cancelConfirmDialog.onDialogClickListener =
|
|
|
+ object : CancelConfirmDialog.OnDialogClickListener {
|
|
|
+ override fun onConfirm() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onCancel() {
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (CofarSDK.devInfo().runningStatus == DevStatus.RUNNING) {
|
|
|
+ cancelConfirmDialog.showDialog(supportFragmentManager, "confirm")
|
|
|
+ } else {
|
|
|
+ //进入称重标定模式
|
|
|
+ CofarSDK.startWeightAlign()
|
|
|
+ GlobalDevEvent.weight = true
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ GlobalToast.showToast(getString(com.develop.common.R.string.password_uncorrect))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun onCancel() {
|
|
@@ -285,11 +291,11 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
//2023年06月29日14:16:18 处理密码弹出
|
|
|
val pwdDialog = PwdDialog()
|
|
|
pwdDialog.title = getString(com.develop.common.R.string.password)
|
|
|
- pwdDialog.showDialog(supportFragmentManager,"pwdDialog")
|
|
|
- pwdDialog.onDialogClickListener = object :PwdDialog.OnDialogClickListener{
|
|
|
+ pwdDialog.showDialog(supportFragmentManager, "pwdDialog")
|
|
|
+ pwdDialog.onDialogClickListener = object : PwdDialog.OnDialogClickListener {
|
|
|
|
|
|
- override fun onConfirm(pwd:String) {
|
|
|
- if("12345678".equals(pwd)){
|
|
|
+ override fun onConfirm(pwd: String) {
|
|
|
+ if ("12345678".equals(pwd)) {
|
|
|
if (isAdbDebuggingEnabled(ctx)) {
|
|
|
Toast.makeText(ctx, "adb disable", Toast.LENGTH_SHORT).show()
|
|
|
toggleAdbDebugging(ctx, false)
|
|
@@ -297,7 +303,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
Toast.makeText(ctx, "adb enable", Toast.LENGTH_SHORT).show()
|
|
|
toggleAdbDebugging(ctx, true)
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
GlobalToast.showToast(getString(com.develop.common.R.string.password_uncorrect))
|
|
|
}
|
|
|
}
|
|
@@ -308,7 +314,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -322,13 +327,13 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
//2023年06月29日14:16:18 处理密码弹出
|
|
|
val pwdDialog = PwdDialog()
|
|
|
pwdDialog.title = getString(com.develop.common.R.string.password)
|
|
|
- pwdDialog.showDialog(supportFragmentManager,"pwdDialog")
|
|
|
- pwdDialog.onDialogClickListener = object :PwdDialog.OnDialogClickListener{
|
|
|
+ pwdDialog.showDialog(supportFragmentManager, "pwdDialog")
|
|
|
+ pwdDialog.onDialogClickListener = object : PwdDialog.OnDialogClickListener {
|
|
|
|
|
|
- override fun onConfirm(pwd:String) {
|
|
|
- if("12345678".equals(pwd)){
|
|
|
+ override fun onConfirm(pwd: String) {
|
|
|
+ if ("12345678".equals(pwd)) {
|
|
|
togglePointerLocation(ctx)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
GlobalToast.showToast(getString(com.develop.common.R.string.password_uncorrect))
|
|
|
}
|
|
|
}
|
|
@@ -353,11 +358,11 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
//2023年06月29日14:16:18 处理密码弹出
|
|
|
val pwdDialog = PwdDialog()
|
|
|
pwdDialog.title = getString(com.develop.common.R.string.password)
|
|
|
- pwdDialog.showDialog(supportFragmentManager,"pwdDialog")
|
|
|
- pwdDialog.onDialogClickListener = object :PwdDialog.OnDialogClickListener{
|
|
|
+ pwdDialog.showDialog(supportFragmentManager, "pwdDialog")
|
|
|
+ pwdDialog.onDialogClickListener = object : PwdDialog.OnDialogClickListener {
|
|
|
|
|
|
- override fun onConfirm(pwd:String) {
|
|
|
- if("12345678".equals(pwd)){
|
|
|
+ override fun onConfirm(pwd: String) {
|
|
|
+ if ("12345678".equals(pwd)) {
|
|
|
// 创建启动目标活动的Intent
|
|
|
val intent = Intent()
|
|
|
intent.component = ComponentName(
|
|
@@ -367,7 +372,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
|
|
|
// 启动目标活动
|
|
|
startActivity(intent)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
GlobalToast.showToast(getString(com.develop.common.R.string.password_uncorrect))
|
|
|
}
|
|
|
}
|
|
@@ -378,7 +383,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -397,7 +401,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
binding.updateFirmware.visibility = View.VISIBLE
|
|
|
}
|
|
|
|
|
|
- viewModel.errorCallBack.observe(this){
|
|
|
+ viewModel.errorCallBack.observe(this) {
|
|
|
GlobalToast.showToast(getString(com.develop.common.R.string.no_net_error))
|
|
|
}
|
|
|
|
|
@@ -408,7 +412,8 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
try {
|
|
|
val packageInstaller = context.packageManager.packageInstaller
|
|
|
|
|
|
- val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
|
|
+ val params =
|
|
|
+ PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
|
|
|
|
|
val sessionId = packageInstaller.createSession(params)
|
|
|
val session = packageInstaller.openSession(sessionId)
|
|
@@ -416,7 +421,8 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
addApkToSession(apk, session)
|
|
|
|
|
|
val intent = Intent(context, InstallResultReceiver::class.java)
|
|
|
- val pendingIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
|
|
+ val pendingIntent =
|
|
|
+ PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
|
|
|
|
|
session.commit(pendingIntent.intentSender)
|
|
|
|