Skip to content

Commit 0774129

Browse files
committed
拉取多设备实现
1 parent 918456f commit 0774129

File tree

4 files changed

+1129
-0
lines changed

4 files changed

+1129
-0
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
package com.tencent.iot.explorer.link.demo.video
2+
3+
import android.content.Intent
4+
import android.text.InputType
5+
import android.view.View
6+
import com.tencent.iot.explorer.link.demo.R
7+
import com.tencent.iot.explorer.link.demo.VideoBaseActivity
8+
import com.tencent.iot.explorer.link.demo.databinding.ActivityMultiDeviceInputBinding
9+
import com.tencent.iot.explorer.link.demo.video.preview.MultiVideoTestActivity
10+
11+
12+
class MultiVideoTestInputActivity : VideoBaseActivity<ActivityMultiDeviceInputBinding>() {
13+
14+
override fun getViewBinding(): ActivityMultiDeviceInputBinding =
15+
ActivityMultiDeviceInputBinding.inflate(layoutInflater)
16+
17+
override fun initView() {
18+
with(binding) {
19+
vTitle.tvTitle.setText(R.string.multi_device_connection)
20+
21+
// 设备1
22+
device1ProductIdLayout.tvTip.setText(R.string.product_id_text)
23+
device1ProductIdLayout.evContent.setHint(R.string.hint_product_id)
24+
device1ProductIdLayout.evContent.setText("CE3P21B2JW")
25+
device1ProductIdLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
26+
27+
device1DeviceNameLayout.tvTip.setText(R.string.device_name_text)
28+
device1DeviceNameLayout.evContent.setHint(R.string.hint_device_name)
29+
device1DeviceNameLayout.evContent.setText("4C_40300001_152384222_4")
30+
device1DeviceNameLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
31+
32+
device1P2pInfoLayout.tvTip.setText(R.string.p2p_info_text)
33+
device1P2pInfoLayout.evContent.setHint(R.string.hint_p2p_info)
34+
device1P2pInfoLayout.evContent.setText("XP2P1HNek+BperPLzEXSyb67SI7k%2.4.50")
35+
device1P2pInfoLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
36+
37+
// 设备2
38+
device2ProductIdLayout.tvTip.setText(R.string.product_id_text)
39+
device2ProductIdLayout.evContent.setHint(R.string.hint_product_id)
40+
device2ProductIdLayout.evContent.setText("CE3P21B2JW")
41+
device2ProductIdLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
42+
43+
device2DeviceNameLayout.tvTip.setText(R.string.device_name_text)
44+
device2DeviceNameLayout.evContent.setHint(R.string.hint_device_name)
45+
device2DeviceNameLayout.evContent.setText("4C_40300001_162157562_78")
46+
device2DeviceNameLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
47+
48+
device2P2pInfoLayout.tvTip.setText(R.string.p2p_info_text)
49+
device2P2pInfoLayout.evContent.setHint(R.string.hint_p2p_info)
50+
device2P2pInfoLayout.evContent.setText("XP2PiMbQ1FQE+6ovftkH0GeChw==%2.4.50")
51+
device2P2pInfoLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
52+
53+
// 设备3
54+
device3ProductIdLayout.tvTip.setText(R.string.product_id_text)
55+
device3ProductIdLayout.evContent.setHint(R.string.hint_product_id)
56+
device3ProductIdLayout.evContent.setText("CE3P21B2JW")
57+
device3ProductIdLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
58+
59+
device3DeviceNameLayout.tvTip.setText(R.string.device_name_text)
60+
device3DeviceNameLayout.evContent.setHint(R.string.hint_device_name)
61+
device3DeviceNameLayout.evContent.setText("4C_40300001_162157562_54")
62+
device3DeviceNameLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
63+
64+
device3P2pInfoLayout.tvTip.setText(R.string.p2p_info_text)
65+
device3P2pInfoLayout.evContent.setHint(R.string.hint_p2p_info)
66+
device3P2pInfoLayout.evContent.setText("XP2Pgvn3TmlXF16x+9WTJvSt96EI%2.4.50")
67+
device3P2pInfoLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
68+
69+
// 设备4
70+
device4ProductIdLayout.tvTip.setText(R.string.product_id_text)
71+
device4ProductIdLayout.evContent.setHint(R.string.hint_product_id)
72+
device4ProductIdLayout.evContent.setText("CE3P21B2JW")
73+
device4ProductIdLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
74+
75+
device4DeviceNameLayout.tvTip.setText(R.string.device_name_text)
76+
device4DeviceNameLayout.evContent.setHint(R.string.hint_device_name)
77+
device4DeviceNameLayout.evContent.setText("4C_40300001_162157562_57")
78+
device4DeviceNameLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
79+
80+
device4P2pInfoLayout.tvTip.setText(R.string.p2p_info_text)
81+
device4P2pInfoLayout.evContent.setHint(R.string.hint_p2p_info)
82+
device4P2pInfoLayout.evContent.setText("XP2PAbTOrSl+BGVu3siirwE+Joda%2.4.50")
83+
device4P2pInfoLayout.evContent.inputType = InputType.TYPE_CLASS_TEXT
84+
}
85+
}
86+
87+
override fun setListener() {
88+
with(binding) {
89+
vTitle.ivBack.setOnClickListener { finish() }
90+
btnLogin.setOnClickListener(loginClickedListener)
91+
}
92+
}
93+
94+
private var loginClickedListener = object : View.OnClickListener {
95+
override fun onClick(v: View?) {
96+
with(binding) {
97+
// 验证设备1信息
98+
if (device1ProductIdLayout.evContent.text.isNullOrEmpty()) {
99+
show("设备1产品ID不能为空")
100+
return
101+
}
102+
if (device1DeviceNameLayout.evContent.text.isNullOrEmpty()) {
103+
show("设备1设备名称不能为空")
104+
return
105+
}
106+
if (device1P2pInfoLayout.evContent.text.isNullOrEmpty()) {
107+
show("设备1P2P信息不能为空")
108+
return
109+
}
110+
111+
// 跳转到多设备测试页面
112+
val intent = Intent(this@MultiVideoTestInputActivity, MultiVideoTestActivity::class.java)
113+
114+
// 传递设备1信息
115+
intent.putExtra("device1_productId", device1ProductIdLayout.evContent.text.toString())
116+
intent.putExtra("device1_deviceName", device1DeviceNameLayout.evContent.text.toString())
117+
intent.putExtra("device1_p2pInfo", device1P2pInfoLayout.evContent.text.toString())
118+
119+
// 传递设备2信息
120+
intent.putExtra("device2_productId", device2ProductIdLayout.evContent.text.toString())
121+
intent.putExtra("device2_deviceName", device2DeviceNameLayout.evContent.text.toString())
122+
intent.putExtra("device2_p2pInfo", device2P2pInfoLayout.evContent.text.toString())
123+
124+
// 传递设备3信息
125+
intent.putExtra("device3_productId", device3ProductIdLayout.evContent.text.toString())
126+
intent.putExtra("device3_deviceName", device3DeviceNameLayout.evContent.text.toString())
127+
intent.putExtra("device3_p2pInfo", device3P2pInfoLayout.evContent.text.toString())
128+
129+
// 传递设备4信息
130+
intent.putExtra("device4_productId", device4ProductIdLayout.evContent.text.toString())
131+
intent.putExtra("device4_deviceName", device4DeviceNameLayout.evContent.text.toString())
132+
intent.putExtra("device4_p2pInfo", device4P2pInfoLayout.evContent.text.toString())
133+
134+
startActivity(intent)
135+
}
136+
}
137+
}
138+
139+
override fun onDestroy() {
140+
super.onDestroy()
141+
}
142+
}

0 commit comments

Comments
 (0)