Skip to content

Commit c8c8bb7

Browse files
sevenhhearchurcode
authored andcommitted
修复【产品体验】扫码批量投产进入配网流程
https://docs.qq.com/doc/DYWlScEd4WkpiZW1G Change-Id: I268a79a06f01b627a7cbd2d193c71ad725b9f24c
1 parent 1c9a30a commit c8c8bb7

File tree

3 files changed

+55
-12
lines changed

3 files changed

+55
-12
lines changed

app/src/main/java/com/tencent/iot/explorer/link/kitlink/activity/DeviceCategoryActivity.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ class DeviceCategoryActivity : PActivity(), MyCallback, CRecyclerView.RecyclerI
5858
private val handler = Handler()
5959

6060
private var permissions = arrayOf(
61-
Manifest.permission.CAMERA
61+
Manifest.permission.CAMERA,
62+
Manifest.permission.ACCESS_WIFI_STATE,
63+
Manifest.permission.CHANGE_WIFI_STATE,
64+
Manifest.permission.CHANGE_WIFI_MULTICAST_STATE,
65+
Manifest.permission.ACCESS_FINE_LOCATION
6266
)
6367

6468
override fun getPresenter(): IPresenter? {

app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/SCStepFragment.kt

+24-5
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,36 @@ class SCStepFragment(type: Int, productId: String) : BaseFragment() {
8383
val config = JsonManager.parseJson(Data[0].Config, ProdConfigDetailEntity::class.java)
8484

8585
if (TextUtils.isEmpty(config.WifiSmartConfig)) {
86+
loadViewStandradInfo()
8687
return
8788
}
8889

8990
var json = JSONObject.parseObject(config.WifiSmartConfig)
9091
if (json.containsKey(CommonField.HARD_WARE_GUIDE)) {
9192
var hardwareGuide = JSONObject.parseObject(json.getString(CommonField.HARD_WARE_GUIDE), HardwareGuide::class.java)
92-
nextBtn?.setText(hardwareGuide.btnText)
93-
tipContent?.setText(hardwareGuide.message)
94-
Picasso.get().load(hardwareGuide.bgImg).placeholder(R.drawable.imageselector_default_error)
95-
.resize(App.data.screenWith / 5, App.data.screenWith / 5).centerCrop()
96-
.into(pic)
93+
if (!TextUtils.isEmpty(hardwareGuide.btnText)) {
94+
nextBtn?.setText(hardwareGuide.btnText)
95+
} else {
96+
nextBtn?.setText(R.string.smart_config_first_title)
97+
}
98+
99+
if (!TextUtils.isEmpty(hardwareGuide.message)) {
100+
tipContent?.setText(hardwareGuide.message)
101+
} else {
102+
tipContent?.setText(R.string.smart_config_first_hint2)
103+
}
104+
105+
if (TextUtils.isEmpty(hardwareGuide.bgImg)) {
106+
pic?.setImageResource(R.mipmap.image_smart_config)
107+
} else {
108+
Picasso.get().load(hardwareGuide.bgImg)
109+
.placeholder(R.drawable.imageselector_default_error)
110+
.resize(App.data.screenWith / 5, App.data.screenWith / 5)
111+
.centerCrop()
112+
.into(pic)
113+
}
114+
} else {
115+
loadViewStandradInfo()
97116
}
98117
}
99118

app/src/main/java/com/tencent/iot/explorer/link/kitlink/fragment/SoftAppStepFragment.kt

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.tencent.iot.explorer.link.kitlink.fragment
22

33
import android.text.TextUtils
4+
import android.util.Log
45
import android.view.View
56
import android.widget.ImageView
67
import android.widget.TextView
@@ -79,17 +80,36 @@ class SoftAppStepFragment(type: Int, productId: String) : BaseFragment() {
7980
val config = JsonManager.parseJson(Data[0].Config, ProdConfigDetailEntity::class.java)
8081

8182
if (TextUtils.isEmpty(config.WifiSoftAP)) {
83+
loadViewStandradInfo()
8284
return
8385
}
84-
8586
var json = JSONObject.parseObject(config.WifiSoftAP)
8687
if (json.containsKey(CommonField.HARD_WARE_GUIDE)) {
88+
8789
var hardwareGuide = JSONObject.parseObject(json.getString(CommonField.HARD_WARE_GUIDE), HardwareGuide::class.java)
88-
nextBtn?.setText(hardwareGuide.btnText)
89-
tipContent?.setText(hardwareGuide.message)
90-
Picasso.get().load(hardwareGuide.bgImg).placeholder(R.drawable.imageselector_default_error)
91-
.resize(App.data.screenWith / 5, App.data.screenWith / 5).centerCrop()
92-
.into(pic)
90+
if (TextUtils.isEmpty(hardwareGuide.btnText)) {
91+
nextBtn?.setText(R.string.soft_ap_first_button)
92+
} else {
93+
nextBtn?.setText(hardwareGuide.btnText)
94+
}
95+
96+
if (TextUtils.isEmpty(hardwareGuide.message)) {
97+
tipContent?.setText(R.string.soft_ap_first_toast)
98+
} else {
99+
tipContent?.setText(hardwareGuide.message)
100+
}
101+
102+
if (TextUtils.isEmpty(hardwareGuide.bgImg)) {
103+
pic?.setImageResource(R.mipmap.image_soft_ap)
104+
} else {
105+
Picasso.get().load(hardwareGuide.bgImg)
106+
.placeholder(R.drawable.imageselector_default_error)
107+
.resize(App.data.screenWith / 5, App.data.screenWith / 5)
108+
.centerCrop()
109+
.into(pic)
110+
}
111+
} else {
112+
loadViewStandradInfo()
93113
}
94114
}
95115
}

0 commit comments

Comments
 (0)