|
@@ -150,7 +150,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
edit.setText("")
|
|
|
}
|
|
|
cancel.setOnClickListener {
|
|
|
- popupWindow.dismiss()
|
|
|
+ popupWindow.dismiss()
|
|
|
}
|
|
|
}.onDismissListener {
|
|
|
}.build<ViewDataBinding>(this)
|
|
@@ -238,15 +238,16 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
val ivUpdateParam = binding.icUpdate.layoutParams as LinearLayout.LayoutParams
|
|
|
binding.ivClose.setVisible()
|
|
|
binding.ivClose.setImageResource(com.develop.common.R.drawable.ic_close)
|
|
|
- if (baseSn.startsWith("011F")){
|
|
|
- binding.aboutLayout.background = resources.getDrawable(com.develop.common.R.drawable.home_bg_011_f)
|
|
|
+ if (baseSn.startsWith("011F")) {
|
|
|
+ binding.aboutLayout.background =
|
|
|
+ resources.getDrawable(com.develop.common.R.drawable.home_bg_011_f)
|
|
|
}
|
|
|
//muc 过长展示需要成mcu
|
|
|
if (binding.tvAboutMcu.text.length > 10) {
|
|
|
binding.tvAboutMcu.text = "MCU"
|
|
|
}
|
|
|
//由于011F换肤风格,导致isNightTheme 不一样,估在这多做处理
|
|
|
- if (isNightTheme() || isBrand036I() ||sn.startsWith("011F")) {
|
|
|
+ if (isNightTheme() || isBrand036I() || sn.startsWith("011F")) {
|
|
|
ivLogoParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_321px)
|
|
|
height = dimenRes(com.develop.common.R.dimen.convert_95px)
|
|
@@ -266,7 +267,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
|
|
|
binding.ivLogo.setBackgroundResource(com.develop.common.R.drawable.ic_logo_054a)
|
|
|
- }else if (sn.startsWith("045")) {
|
|
|
+ } else if (sn.startsWith("045")) {
|
|
|
// ivLogoParam.apply {
|
|
|
// width = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
// height = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
@@ -274,7 +275,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
// }
|
|
|
|
|
|
binding.ivLogo.setBackgroundResource(com.develop.common.R.drawable.ic_logo_045a)
|
|
|
- }else if (sn.startsWith("011")){
|
|
|
+ } else if (sn.startsWith("011")) {
|
|
|
|
|
|
ivLogoParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_320px)
|
|
@@ -282,17 +283,18 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
marginStart = dimenRes(com.develop.common.R.dimen.convert_135px)
|
|
|
}
|
|
|
binding.ivLogo.background = null
|
|
|
- if (sn.startsWith("011F")){
|
|
|
+ if (sn.startsWith("011F")) {
|
|
|
binding.ivLogo.setImageResource(com.develop.common.R.drawable.ic_logo_011_f)
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.ivLogo.setImageResource(com.develop.common.R.drawable.ic_logo_011)
|
|
|
|
|
|
}
|
|
|
// ivLogoParam.width = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
// ivLogoParam.height = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
- }else if (sn.startsWith("010H")||sn.startsWith("010I")
|
|
|
- ||sn.startsWith("083A")||sn.startsWith("083B")){
|
|
|
+ } else if (sn.startsWith("010H") || sn.startsWith("010I")
|
|
|
+ || sn.startsWith("083A") || sn.startsWith("083B")
|
|
|
+ ) {
|
|
|
|
|
|
ivLogoParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_320px)
|
|
@@ -300,17 +302,20 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
marginStart = dimenRes(com.develop.common.R.dimen.convert_135px)
|
|
|
}
|
|
|
binding.ivLogo.background = null
|
|
|
- if (sn.startsWith("010H")){
|
|
|
+ if (sn.startsWith("010H")) {
|
|
|
binding.ivLogo.setImageResource(com.develop.common.R.drawable.ic_logo_010_h)
|
|
|
|
|
|
- }else if (sn.startsWith("010I")){
|
|
|
+ } else if (sn.startsWith("010I")) {
|
|
|
binding.ivLogo.setImageResource(com.develop.common.R.drawable.ic_logo_010_i)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.ivLogo.setImageResource(com.develop.common.R.drawable.ic_logo_083)
|
|
|
}
|
|
|
// ivLogoParam.width = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
// ivLogoParam.height = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
- }else if (sn.startsWith("025")||sn.startsWith("077")||sn.startsWith("053")||sn.startsWith("000B")){
|
|
|
+ } else if (sn.startsWith("025") || sn.startsWith("077") || sn.startsWith("053") || sn.startsWith(
|
|
|
+ "000B"
|
|
|
+ )
|
|
|
+ ) {
|
|
|
ivLogoParam.apply {
|
|
|
width = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
|
height = dimenRes(com.develop.common.R.dimen.convert_180px)
|
|
@@ -359,7 +364,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
|
|
|
binding.tvFirmware.text = Build.DISPLAY
|
|
|
|
|
|
- binding.model.text = if (sn.startsWith("011")){
|
|
|
+ binding.model.text = if (sn.startsWith("011")) {
|
|
|
getModelString()
|
|
|
} else {
|
|
|
getSN().substring(4, 8)
|
|
@@ -401,8 +406,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
binding.ivLogo.setOnClickListener {
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
weightAlignCount++
|
|
|
if (weightAlignCount >= 7) {
|
|
|
weightAlignCount = 0
|
|
@@ -502,7 +505,8 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
|
|
|
|
|
|
tvFirmPopupWindow.inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
|
|
|
- tvFirmPopupWindow.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
|
|
+ tvFirmPopupWindow.softInputMode =
|
|
|
+ WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
|
|
tvFirmPopupWindow.showAtLocation(binding.aboutLayout, Gravity.CENTER, 0, 0)
|
|
|
|
|
|
|
|
@@ -513,7 +517,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
|
|
|
|
|
|
binding.devSn.setOnClickListener {
|
|
|
-// addListLocale()
|
|
|
+ addListLocale()
|
|
|
|
|
|
testCount++
|
|
|
if (testCount >= 7) {
|
|
@@ -527,7 +531,7 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- binding.tvAppName.text = if (isBrand062())"NoteCook" else "FoodCooking_Android"
|
|
|
+ binding.tvAppName.text = if (isBrand062()) "NoteCook" else "FoodCooking_Android"
|
|
|
var appName = AppUtils.getAppVersionName()
|
|
|
var (mode, code, version) = appName.split(".")
|
|
|
// var appCodeName = code+mode + "_V"+ getAppCode()+"_"+version
|
|
@@ -544,10 +548,10 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
binding.tvUpdate.visibility = View.INVISIBLE
|
|
|
}
|
|
|
binding.updateApk.visibility = View.VISIBLE
|
|
|
- if (sn.startsWith("011")){
|
|
|
- var width = dimenRes(com.develop.common.R.dimen.convert_52px)
|
|
|
- var height = dimenRes(com.develop.common.R.dimen.convert_52px)
|
|
|
- val ivAboutParam = LinearLayout.LayoutParams(width, height)
|
|
|
+ if (sn.startsWith("011")) {
|
|
|
+ var width = dimenRes(com.develop.common.R.dimen.convert_52px)
|
|
|
+ var height = dimenRes(com.develop.common.R.dimen.convert_52px)
|
|
|
+ val ivAboutParam = LinearLayout.LayoutParams(width, height)
|
|
|
|
|
|
|
|
|
binding.updateApk.background = null
|
|
@@ -556,7 +560,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
binding.ivAboutUpdateFw.layoutParams = ivAboutParam
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
binding.updateFirmware.visibility = View.VISIBLE
|
|
@@ -570,27 +573,39 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
|
|
|
fun addListLocale() {
|
|
|
//判断是否设置语言,如果重新设置需要重新写入系统语言,将选中放第一位
|
|
|
- //设置语言
|
|
|
- var list = DataFactory.createLanguageDataV2(resources)
|
|
|
- var listStr = mutableListOf<String>()
|
|
|
- listStr.add("en")
|
|
|
- for (i in 1..list.size) {
|
|
|
- if (list[i - 1].value.lowercase() != "en") {
|
|
|
- listStr.add(list[i - 1].value.lowercase())
|
|
|
- }
|
|
|
+ //设置语言
|
|
|
+ var list = DataFactory.createLanguageDataV2(resources)
|
|
|
+ var listStr = mutableListOf<String>()
|
|
|
+ listStr.add("en")
|
|
|
+ for (i in 1..list.size) {
|
|
|
+ if (list[i - 1].value.lowercase() != "en") {
|
|
|
+ listStr.add(list[i - 1].value.lowercase())
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ //调试键盘问题,但没用
|
|
|
+ val condition: (String) -> Boolean = {
|
|
|
+ it == (MMkvUtils.getString(CURRENT_LANGUAGE)?.lowercase() ?: "en")
|
|
|
+ }
|
|
|
+ firstLocale(listStr, condition)
|
|
|
|
|
|
- //调试键盘问题,但没用
|
|
|
- val condition: (String) -> Boolean = {
|
|
|
- it == (MMkvUtils.getString(CURRENT_LANGUAGE)?.lowercase() ?: "en")
|
|
|
+
|
|
|
+ listStr.forEach {
|
|
|
+ Log.d("TAG lang one", "lang $it")
|
|
|
+ }
|
|
|
+ listStr.forEachIndexed { index, s ->
|
|
|
+ if (s == "ir") {
|
|
|
+ listStr[index] = "fa"
|
|
|
}
|
|
|
- firstLocale(listStr, condition)
|
|
|
- //获取配置语言,然后设置系统语言,首语言默认英语
|
|
|
-// SerialportUtils.getAddLocale(listStr)
|
|
|
+ }
|
|
|
+
|
|
|
listStr.forEach {
|
|
|
- Log.e("TAG asd", "asd:$it");
|
|
|
+ Log.d("TAG lang two", "lang2 $it")
|
|
|
}
|
|
|
|
|
|
+ //获取配置语言,然后设置系统语言,首语言默认英语
|
|
|
+// SerialportUtils.getAddLocale(listStr)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
fun firstLocale(list: MutableList<String>, condition: (String) -> Boolean) {
|
|
@@ -602,7 +617,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
fun installPackage(context: Context, apk: File) {
|
|
|
try {
|
|
|
val packageInstaller = context.packageManager.packageInstaller
|
|
@@ -725,16 +739,16 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun getModelString() :String{
|
|
|
- return if (sn.startsWith("011A")){
|
|
|
+ fun getModelString(): String {
|
|
|
+ return if (sn.startsWith("011A")) {
|
|
|
"MRK-48"
|
|
|
- }else if (sn.startsWith("011D")){
|
|
|
+ } else if (sn.startsWith("011D")) {
|
|
|
"MRK-48P"
|
|
|
- }else if (sn.startsWith("011E")){
|
|
|
+ } else if (sn.startsWith("011E")) {
|
|
|
"MRK-58"
|
|
|
- }else if (sn.startsWith("011F")){
|
|
|
+ } else if (sn.startsWith("011F")) {
|
|
|
"TRM-01"
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
"MRK-48"
|
|
|
}
|
|
|
}
|
|
@@ -745,7 +759,6 @@ class AboutActivity : CommonBVMActivity<ActivityAboutBinding, AboutViewModel>()
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
override fun onDestroy() {
|
|
|
super.onDestroy()
|
|
|
commonDialog.removeSelf()
|