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