修改告警记录
This commit is contained in:
@@ -184,6 +184,7 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("AlarmLogActivity", "请求异常: ${e.message}", e)
|
||||
showAlarmListNetworkError()
|
||||
} finally {
|
||||
isLoading = false
|
||||
Log.d("AlarmLogActivity", "请求结束")
|
||||
@@ -191,14 +192,22 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showEmptyView() {
|
||||
binding.alarmListRecyclerView.visibility = View.GONE
|
||||
binding.emptyLayout.visibility = View.VISIBLE
|
||||
private fun updateAlarmListState() {
|
||||
if (alarmList.isEmpty()) {
|
||||
binding.alarmListRecyclerView.visibility = View.GONE
|
||||
binding.layoutNoPermission.visibility = View.VISIBLE
|
||||
binding.layoutNoNetwork.visibility = View.GONE
|
||||
} else {
|
||||
binding.alarmListRecyclerView.visibility = View.VISIBLE
|
||||
binding.layoutNoPermission.visibility = View.GONE
|
||||
binding.layoutNoNetwork.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideEmptyView() {
|
||||
binding.alarmListRecyclerView.visibility = View.VISIBLE
|
||||
binding.emptyLayout.visibility = View.GONE
|
||||
private fun showAlarmListNetworkError() {
|
||||
binding.alarmListRecyclerView.visibility = View.GONE
|
||||
binding.layoutNoPermission.visibility = View.GONE
|
||||
binding.layoutNoNetwork.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun filterAlarmListByDate(selectedDate: Calendar) {
|
||||
@@ -214,14 +223,13 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
}
|
||||
adapter?.notifyDataSetChanged()
|
||||
Log.d("AlarmLogActivity", "日期筛选完成,筛选后条数: ${alarmList.size}")
|
||||
|
||||
|
||||
if (alarmList.isEmpty()) {
|
||||
showEmptyView()
|
||||
currentAlarmItem = null
|
||||
} else {
|
||||
hideEmptyView()
|
||||
currentAlarmItem = alarmList.firstOrNull()
|
||||
}
|
||||
updateAlarmListState()
|
||||
}
|
||||
|
||||
private fun updateDateDisplay() {
|
||||
@@ -407,7 +415,7 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
adapter?.notifyDataSetChanged()
|
||||
currentAlarmItem = alarmList.firstOrNull()
|
||||
if (alarmList.isEmpty()) {
|
||||
showEmptyView()
|
||||
showAlarmListNetworkError()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this@AlarmLogActivity, response.msg, Toast.LENGTH_SHORT).show()
|
||||
|
||||
@@ -423,14 +423,35 @@ class LiveVideoActivity : BaseActivity() {
|
||||
}
|
||||
alarmList.addAll(newData)
|
||||
alarmAdapter?.notifyDataSetChanged()
|
||||
updateAlarmListState()
|
||||
} catch (e: Exception) {
|
||||
Log.e("LiveVideoActivity", "请求告警列表失败", e)
|
||||
hasMore = false
|
||||
showAlarmListNetworkError()
|
||||
} finally {
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateAlarmListState() {
|
||||
if (alarmList.isEmpty()) {
|
||||
binding.alarmLogRecyclerView.visibility = View.GONE
|
||||
binding.layoutNoPermission.visibility = View.VISIBLE
|
||||
binding.layoutNoNetwork.visibility = View.GONE
|
||||
} else {
|
||||
binding.alarmLogRecyclerView.visibility = View.VISIBLE
|
||||
binding.layoutNoPermission.visibility = View.GONE
|
||||
binding.layoutNoNetwork.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun showAlarmListNetworkError() {
|
||||
binding.alarmLogRecyclerView.visibility = View.GONE
|
||||
binding.layoutNoPermission.visibility = View.GONE
|
||||
binding.layoutNoNetwork.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.exoPlayContextId.onVideoResume()
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
android:background="#FFFFFF" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/emptyLayout"
|
||||
android:id="@+id/layoutNoPermission"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
@@ -116,6 +116,22 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/no_message" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutNoNetwork"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:background="#FFFFFF"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/no_network_img_name" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -252,6 +252,39 @@
|
||||
android:background="#FFFFFF"
|
||||
android:paddingTop="8dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutNoPermission"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:background="@color/white"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="244dp"
|
||||
android:layout_height="131dp"
|
||||
android:src="@mipmap/no_message" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutNoNetwork"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:background="@color/white"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="244dp"
|
||||
android:layout_height="131dp"
|
||||
android:src="@mipmap/no_network_img_name" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user