diff --git a/app/src/main/java/com/example/defenseapplication/liveVideo/LiveVideoActivity.kt b/app/src/main/java/com/example/defenseapplication/liveVideo/LiveVideoActivity.kt
index efd86d5..6040789 100644
--- a/app/src/main/java/com/example/defenseapplication/liveVideo/LiveVideoActivity.kt
+++ b/app/src/main/java/com/example/defenseapplication/liveVideo/LiveVideoActivity.kt
@@ -198,32 +198,69 @@ class LiveVideoActivity : BaseActivity() {
intent.putExtra("from_live_video", true)
startActivity(intent)
}
+
+ // 控制台方向按钮点击事件
+ binding.ivUp.setOnClickListener {
+ handleDirectionClick("up")
+ }
+ binding.ivDown.setOnClickListener {
+ handleDirectionClick("down")
+ }
+ binding.ivLeft.setOnClickListener {
+ handleDirectionClick("left")
+ }
+ binding.ivRight.setOnClickListener {
+ handleDirectionClick("right")
+ }
+
+ // 触摸反馈
+ setTouchFeedback(binding.ivUp)
+ setTouchFeedback(binding.ivDown)
+ setTouchFeedback(binding.ivLeft)
+ setTouchFeedback(binding.ivRight)
+ }
+
+ private fun setTouchFeedback(view: View) {
+ view.setOnTouchListener { v, event ->
+ when (event.action) {
+ android.view.MotionEvent.ACTION_DOWN -> {
+ v.scaleX = 0.9f
+ v.scaleY = 0.9f
+ }
+ android.view.MotionEvent.ACTION_UP, android.view.MotionEvent.ACTION_CANCEL -> {
+ v.scaleX = 1.0f
+ v.scaleY = 1.0f
+ }
+ }
+ false
+ }
+ }
+
+ private fun handleDirectionClick(direction: String) {
+ val directionText = when (direction) {
+ "up" -> getString(R.string.direction_up)
+ "down" -> getString(R.string.direction_down)
+ "left" -> getString(R.string.direction_left)
+ "right" -> getString(R.string.direction_right)
+ else -> ""
+ }
+
}
private fun fetchAlarmList(page: Int = 1) {
val currentDeviceId = deviceId ?: return
- Log.d("LiveVideoActivity", "=== 开始请求设备告警日志 ===")
- Log.d("LiveVideoActivity", "请求参数 - deviceId: $currentDeviceId, page: $page, pageSize: $pageSize")
-
isLoading = true
lifecycleScope.launch {
try {
- Log.d("LiveVideoActivity", "正在发送网络请求...")
val response = RetrofitNetwork.getNetworkService().getDeviceAlarmList(
deviceId = currentDeviceId,
pageNum = page.toString(),
pageSize = pageSize.toString()
)
-
- Log.d("LiveVideoActivity", "请求完成")
- Log.d("LiveVideoActivity", "完整响应对象: $response")
Log.d("LiveVideoActivity", "总条数: ${response.total}, 当前页数据条数: ${response.rows.size}")
-
val newData = response.rows
if (newData.isEmpty()) {
- Log.d("LiveVideoActivity", "当前页数据为空列表")
} else {
- Log.d("LiveVideoActivity", "数据示例:")
newData.take(3).forEachIndexed { index, item ->
Log.d("LiveVideoActivity", " 第${index + 1}条 - id: ${item.id}, categoryName: ${item.categoryName}, createTime: ${item.createTime}")
}
@@ -234,28 +271,18 @@ class LiveVideoActivity : BaseActivity() {
} else {
response.total / pageSize + 1
}
- Log.d("LiveVideoActivity", "总页数: $totalPage")
-
isFirstLoad = false
if (page == 1) {
alarmList.clear()
hasMore = totalPage > 1
- Log.d("LiveVideoActivity", "第一页,已清空列表")
}
-
alarmList.addAll(newData)
- Log.d("LiveVideoActivity", "已添加 ${newData.size} 条数据,列表总条数: ${alarmList.size}")
alarmAdapter?.notifyDataSetChanged()
- Log.d("LiveVideoActivity", "已通知适配器刷新")
-
} catch (e: Exception) {
- Log.e("LiveVideoActivity", "请求异常: ${e.message}", e)
hasMore = false
} finally {
isLoading = false
- Log.d("LiveVideoActivity", "请求结束,isLoading: $isLoading")
- Log.d("LiveVideoActivity", "=== 请求结束 ===")
}
}
}
diff --git a/app/src/main/res/drawable/console.png b/app/src/main/res/drawable/console.png
deleted file mode 100644
index 98ac9fb..0000000
Binary files a/app/src/main/res/drawable/console.png and /dev/null differ
diff --git a/app/src/main/res/drawable/down.png b/app/src/main/res/drawable/down.png
new file mode 100644
index 0000000..346023f
Binary files /dev/null and b/app/src/main/res/drawable/down.png differ
diff --git a/app/src/main/res/drawable/down2.png b/app/src/main/res/drawable/down2.png
new file mode 100644
index 0000000..ea5f512
Binary files /dev/null and b/app/src/main/res/drawable/down2.png differ
diff --git a/app/src/main/res/drawable/left.png b/app/src/main/res/drawable/left.png
new file mode 100644
index 0000000..b8d3a88
Binary files /dev/null and b/app/src/main/res/drawable/left.png differ
diff --git a/app/src/main/res/drawable/left2.png b/app/src/main/res/drawable/left2.png
new file mode 100644
index 0000000..acd076b
Binary files /dev/null and b/app/src/main/res/drawable/left2.png differ
diff --git a/app/src/main/res/drawable/right.png b/app/src/main/res/drawable/right.png
new file mode 100644
index 0000000..b332345
Binary files /dev/null and b/app/src/main/res/drawable/right.png differ
diff --git a/app/src/main/res/drawable/right2.png b/app/src/main/res/drawable/right2.png
new file mode 100644
index 0000000..9c02406
Binary files /dev/null and b/app/src/main/res/drawable/right2.png differ
diff --git a/app/src/main/res/drawable/up.png b/app/src/main/res/drawable/up.png
new file mode 100644
index 0000000..51ff0ff
Binary files /dev/null and b/app/src/main/res/drawable/up.png differ
diff --git a/app/src/main/res/drawable/up2.png b/app/src/main/res/drawable/up2.png
new file mode 100644
index 0000000..b05e63c
Binary files /dev/null and b/app/src/main/res/drawable/up2.png differ
diff --git a/app/src/main/res/layout/live_video_activity.xml b/app/src/main/res/layout/live_video_activity.xml
index e01967f..b3cbce9 100644
--- a/app/src/main/res/layout/live_video_activity.xml
+++ b/app/src/main/res/layout/live_video_activity.xml
@@ -144,12 +144,65 @@
android:orientation="vertical"
android:visibility="gone">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d6157fc..d654678 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -477,4 +477,10 @@
A maximum of 11 users can be added
Phone: %s
ID: %s
+
+
+ Move Up
+ Move Down
+ Move Left
+ Move Right
\ No newline at end of file