告警日志
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package com.example.defenseapplication.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.defenseapplication.bean.DeviceAlarmBean
|
||||
import com.example.defenseapplication.databinding.ItemAlarmLogBinding
|
||||
|
||||
class AlarmLogAdapter(private val items: List<String>) : RecyclerView.Adapter<AlarmLogAdapter.ViewHolder>() {
|
||||
class AlarmLogAdapter(private val items: List<DeviceAlarmBean>) : RecyclerView.Adapter<AlarmLogAdapter.ViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ItemAlarmLogBinding.inflate(
|
||||
@@ -24,10 +24,9 @@ class AlarmLogAdapter(private val items: List<String>) : RecyclerView.Adapter<Al
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
class ViewHolder(private val binding: ItemAlarmLogBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: String) {
|
||||
val parts = item.split(" - ")
|
||||
binding.tvTitle.text = parts.firstOrNull()
|
||||
binding.tvTime.text = parts.getOrNull(1)
|
||||
fun bind(item: DeviceAlarmBean) {
|
||||
binding.tvTitle.text = item.categoryName
|
||||
binding.tvTime.text = item.createTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.example.defenseapplication.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.example.defenseapplication.bean.DeviceAlarmBean
|
||||
import com.example.defenseapplication.databinding.ItemAlarmLogHorizontalBinding
|
||||
|
||||
class AlarmLogHorizontalAdapter(
|
||||
private val items: List<DeviceAlarmBean>,
|
||||
private val onItemClick: (DeviceAlarmBean) -> Unit
|
||||
) : RecyclerView.Adapter<AlarmLogHorizontalAdapter.ViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ItemAlarmLogHorizontalBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return ViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
inner class ViewHolder(private val binding: ItemAlarmLogHorizontalBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: DeviceAlarmBean) {
|
||||
binding.tvTitle.text = item.categoryName
|
||||
binding.tvTime.text = item.createTime
|
||||
|
||||
if (!item.image.isNullOrEmpty()) {
|
||||
Glide.with(binding.root.context)
|
||||
.load(item.image)
|
||||
.into(binding.ivAlarmImage)
|
||||
}
|
||||
|
||||
binding.root.setOnClickListener {
|
||||
onItemClick(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.example.defenseapplication.bean
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class DeviceAlarmBean(
|
||||
val id: String,
|
||||
val userId: String,
|
||||
val deviceId: String,
|
||||
val category: Int,
|
||||
val categoryName: String,
|
||||
val image: String?,
|
||||
val imageUrl: String?,
|
||||
val video: String?,
|
||||
val createTime: String
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString() ?: "",
|
||||
parcel.readString() ?: "",
|
||||
parcel.readString() ?: "",
|
||||
parcel.readInt(),
|
||||
parcel.readString() ?: "",
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString() ?: ""
|
||||
)
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(userId)
|
||||
parcel.writeString(deviceId)
|
||||
parcel.writeInt(category)
|
||||
parcel.writeString(categoryName)
|
||||
parcel.writeString(image)
|
||||
parcel.writeString(imageUrl)
|
||||
parcel.writeString(video)
|
||||
parcel.writeString(createTime)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<DeviceAlarmBean> {
|
||||
override fun createFromParcel(parcel: Parcel): DeviceAlarmBean {
|
||||
return DeviceAlarmBean(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<DeviceAlarmBean?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.defenseapplication.bean
|
||||
|
||||
data class DeviceAlarmResponse(
|
||||
val total: Int,
|
||||
val rows: List<DeviceAlarmBean>
|
||||
)
|
||||
@@ -1,13 +1,54 @@
|
||||
package com.example.defenseapplication.bean
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
data class MessageBean(
|
||||
val id: String,
|
||||
val userId: String,
|
||||
val deviceId: String,
|
||||
val category: Int,
|
||||
val categoryName: String,
|
||||
val id: String?,
|
||||
val userId: String?,
|
||||
val deviceId: String?,
|
||||
val category: Int?,
|
||||
val categoryName: String?,
|
||||
val image: String?,
|
||||
val imageUrl: String?,
|
||||
val video: String?,
|
||||
val createTime: String
|
||||
)
|
||||
val createTime: String?
|
||||
) : Parcelable {
|
||||
constructor(parcel: Parcel) : this(
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readValue(Int::class.java.classLoader) as? Int,
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString(),
|
||||
parcel.readString()
|
||||
)
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(userId)
|
||||
parcel.writeString(deviceId)
|
||||
parcel.writeValue(category)
|
||||
parcel.writeString(categoryName)
|
||||
parcel.writeString(image)
|
||||
parcel.writeString(imageUrl)
|
||||
parcel.writeString(video)
|
||||
parcel.writeString(createTime)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<MessageBean> {
|
||||
override fun createFromParcel(parcel: Parcel): MessageBean {
|
||||
return MessageBean(parcel)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<MessageBean?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -463,6 +463,7 @@ class HomeMenuFragment : Fragment() {
|
||||
if (device.isOnline) {
|
||||
DeviceIdEvent.setDeviceId(device.deviceId)
|
||||
val intent = Intent(requireContext(), LiveVideoActivity::class.java)
|
||||
intent.putExtra("device_id", device.deviceId)
|
||||
intent.putExtra("device_name", device.name)
|
||||
startActivity(intent)
|
||||
} else {
|
||||
|
||||
@@ -162,7 +162,7 @@ class MessageActivity : AppCompatActivity() {
|
||||
|
||||
private fun convertToMessageListItems(messages: List<com.example.defenseapplication.bean.MessageBean>): List<MessageListItem> {
|
||||
val items = mutableListOf<MessageListItem>()
|
||||
val groupedMessages = messages.groupBy { extractDate(it.createTime) }
|
||||
val groupedMessages = messages.groupBy { extractDate(it.createTime ?: "") }
|
||||
groupedMessages.forEach { (date, messageList) ->
|
||||
val headerTitle = formatDate(date)
|
||||
messageList.forEachIndexed { index, message ->
|
||||
@@ -172,9 +172,9 @@ class MessageActivity : AppCompatActivity() {
|
||||
messageList.forEach { message ->
|
||||
items.add(
|
||||
MessageListItem.Message(
|
||||
time = extractTime(message.createTime),
|
||||
title = message.categoryName,
|
||||
dateTime = message.createTime,
|
||||
time = extractTime(message.createTime ?: ""),
|
||||
title = message.categoryName ?: "未知消息",
|
||||
dateTime = message.createTime ?: "",
|
||||
unread = false
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.example.defenseapplication.liveVideo
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -13,15 +11,20 @@ import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chuangyuan.ycj.videolibrary.listener.VideoInfoListener
|
||||
import chuangyuan.ycj.videolibrary.video.ExoUserPlayer
|
||||
import chuangyuan.ycj.videolibrary.video.VideoPlayerManager
|
||||
import com.google.android.exoplayer2.ui.PlayerView
|
||||
import com.example.defenseapplication.R
|
||||
import com.example.defenseapplication.adapter.AlarmLogAdapter
|
||||
import com.example.defenseapplication.bean.DeviceAlarmBean
|
||||
import com.example.defenseapplication.bean.DeviceAlarmResponse
|
||||
import com.example.defenseapplication.databinding.AlarmLogActivityBinding
|
||||
import com.example.defenseapplication.utils.ActivityManager
|
||||
import com.example.defenseapplication.utils.RetrofitNetwork
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener
|
||||
@@ -31,11 +34,14 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
private lateinit var binding: AlarmLogActivityBinding
|
||||
private lateinit var calendar: Calendar
|
||||
private var adapter: AlarmLogAdapter? = null
|
||||
private val alarmList = mutableListOf<String>()
|
||||
private val alarmList = mutableListOf<DeviceAlarmBean>()
|
||||
private val originalAlarmList = mutableListOf<DeviceAlarmBean>()
|
||||
private lateinit var exoPlayerManager: ExoUserPlayer
|
||||
private var isMuted = false
|
||||
private var isVoiceEnabled = false
|
||||
private var isLightOn = false
|
||||
private var deviceId: String? = null
|
||||
private var isLoading = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -46,11 +52,12 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
.titleBar(binding.exoPlayContextId)
|
||||
.init()
|
||||
|
||||
deviceId = intent.getStringExtra("device_id")
|
||||
calendar = Calendar.getInstance()
|
||||
updateDateDisplay()
|
||||
initVideoPlayer()
|
||||
initRecyclerView()
|
||||
loadAlarmList()
|
||||
fetchAlarmList()
|
||||
initListener()
|
||||
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
@@ -143,14 +150,53 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
binding.alarmListRecyclerView.adapter = adapter
|
||||
}
|
||||
|
||||
private fun loadAlarmList() {
|
||||
private fun fetchAlarmList() {
|
||||
val currentDeviceId = deviceId ?: return
|
||||
|
||||
Log.d("AlarmLogActivity", "=== 开始请求设备告警日志 ===")
|
||||
Log.d("AlarmLogActivity", "请求参数 - deviceId: $currentDeviceId")
|
||||
|
||||
isLoading = true
|
||||
lifecycleScope.launch {
|
||||
try {
|
||||
Log.d("AlarmLogActivity", "正在发送网络请求...")
|
||||
val response = RetrofitNetwork.getNetworkService().getDeviceAlarmList(
|
||||
deviceId = currentDeviceId,
|
||||
pageNum = "1",
|
||||
pageSize = "100"
|
||||
)
|
||||
|
||||
Log.d("AlarmLogActivity", "请求完成")
|
||||
Log.d("AlarmLogActivity", "总条数: ${response.total}, 当前页数据条数: ${response.rows.size}")
|
||||
|
||||
val newData = response.rows
|
||||
originalAlarmList.clear()
|
||||
originalAlarmList.addAll(newData)
|
||||
filterAlarmListByDate(calendar)
|
||||
Log.d("AlarmLogActivity", "已获取 ${newData.size} 条数据")
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("AlarmLogActivity", "请求异常: ${e.message}", e)
|
||||
} finally {
|
||||
isLoading = false
|
||||
Log.d("AlarmLogActivity", "请求结束")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun filterAlarmListByDate(selectedDate: Calendar) {
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||
val selectedDateStr = dateFormat.format(selectedDate.time)
|
||||
|
||||
alarmList.clear()
|
||||
alarmList.add("入侵告警 - 10:30")
|
||||
alarmList.add("入侵告警 - 09:15")
|
||||
alarmList.add("入侵告警 - 08:45")
|
||||
alarmList.add("入侵告警 - 07:20")
|
||||
alarmList.add("入侵告警 - 06:50")
|
||||
originalAlarmList.forEach { item ->
|
||||
val itemDateStr = item.createTime.substring(0, 10)
|
||||
if (itemDateStr == selectedDateStr) {
|
||||
alarmList.add(item)
|
||||
}
|
||||
}
|
||||
adapter?.notifyDataSetChanged()
|
||||
Log.d("AlarmLogActivity", "日期筛选完成,筛选后条数: ${alarmList.size}")
|
||||
}
|
||||
|
||||
private fun updateDateDisplay() {
|
||||
@@ -241,7 +287,7 @@ class AlarmLogActivity : AppCompatActivity() {
|
||||
val timePicker = TimePickerBuilder(this, OnTimeSelectListener { date, _ ->
|
||||
calendar.time = date
|
||||
updateDateDisplay()
|
||||
loadAlarmList()
|
||||
filterAlarmListByDate(calendar)
|
||||
})
|
||||
.setType(booleanArrayOf(true, true, true, false, false, false)) // 年月日
|
||||
.setTitleText(getString(R.string.select_date))
|
||||
|
||||
@@ -10,12 +10,20 @@ import android.view.animation.ScaleAnimation
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import chuangyuan.ycj.videolibrary.video.ExoUserPlayer
|
||||
import com.example.defenseapplication.R
|
||||
import com.example.defenseapplication.adapter.AlarmLogHorizontalAdapter
|
||||
import com.example.defenseapplication.base.BaseActivity
|
||||
import com.example.defenseapplication.bean.DeviceAlarmBean
|
||||
import com.example.defenseapplication.bean.DeviceAlarmResponse
|
||||
import com.example.defenseapplication.databinding.LiveVideoActivityBinding
|
||||
import com.example.defenseapplication.utils.ActivityManager
|
||||
import com.example.defenseapplication.utils.RetrofitNetwork
|
||||
import com.gyf.immersionbar.ImmersionBar
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import android.content.res.Configuration
|
||||
@@ -33,6 +41,13 @@ class LiveVideoActivity : BaseActivity() {
|
||||
private var isRecording = false
|
||||
private var mediaRecorder: MediaRecorder? = null
|
||||
private var micPulseAnimation: ScaleAnimation? = null
|
||||
private var deviceId: String? = null
|
||||
private var alarmList: MutableList<DeviceAlarmBean> = mutableListOf()
|
||||
private var alarmAdapter: AlarmLogHorizontalAdapter? = null
|
||||
private var currentPage = 1
|
||||
private val pageSize = 10
|
||||
private var hasMore = true
|
||||
private var isLoading = false
|
||||
|
||||
private val requestPermissionLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.RequestPermission()
|
||||
@@ -55,13 +70,16 @@ class LiveVideoActivity : BaseActivity() {
|
||||
.titleBar(binding.topBar)
|
||||
.init()
|
||||
|
||||
deviceId = intent.getStringExtra("device_id")
|
||||
val deviceName = intent.getStringExtra("device_name")
|
||||
if (!deviceName.isNullOrEmpty()) {
|
||||
binding.tvTitle.text = deviceName
|
||||
}
|
||||
|
||||
initVideoPlayer()
|
||||
initAlarmRecyclerView()
|
||||
initListener()
|
||||
fetchAlarmList()
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (exoPlayerManager.onBackPressed()) {
|
||||
@@ -105,6 +123,37 @@ class LiveVideoActivity : BaseActivity() {
|
||||
exoPlayerManager.startPlayer()
|
||||
}
|
||||
|
||||
private fun initAlarmRecyclerView() {
|
||||
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||
binding.alarmLogRecyclerView.layoutManager = layoutManager
|
||||
alarmAdapter = AlarmLogHorizontalAdapter(alarmList) { messageBean ->
|
||||
val intent = Intent(this, AlarmLogActivity::class.java)
|
||||
intent.putExtra("device_id", deviceId)
|
||||
intent.putExtra("selected_id", messageBean.id)
|
||||
startActivity(intent)
|
||||
}
|
||||
binding.alarmLogRecyclerView.adapter = alarmAdapter
|
||||
|
||||
binding.alarmLogRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
if (dx > 0 && !isLoading && hasMore) {
|
||||
val lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition()
|
||||
val totalItemCount = layoutManager.itemCount
|
||||
if (lastVisibleItemPosition >= totalItemCount - 1) {
|
||||
loadMoreAlarms()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun loadMoreAlarms() {
|
||||
if (!hasMore || isLoading) return
|
||||
currentPage++
|
||||
fetchAlarmList(currentPage)
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
binding.btnBack.setOnClickListener {
|
||||
ActivityManager.finishExceptHome()
|
||||
@@ -137,10 +186,63 @@ class LiveVideoActivity : BaseActivity() {
|
||||
|
||||
binding.xq.setOnClickListener {
|
||||
val intent = Intent(this, AlarmLogActivity::class.java)
|
||||
intent.putExtra("device_id", deviceId)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
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}")
|
||||
}
|
||||
}
|
||||
|
||||
if (page == 1) {
|
||||
alarmList.clear()
|
||||
hasMore = true
|
||||
Log.d("LiveVideoActivity", "第一页,已清空列表")
|
||||
}
|
||||
alarmList.addAll(newData)
|
||||
Log.d("LiveVideoActivity", "已添加 ${newData.size} 条数据,列表总条数: ${alarmList.size}")
|
||||
alarmAdapter?.notifyDataSetChanged()
|
||||
Log.d("LiveVideoActivity", "已通知适配器刷新")
|
||||
hasMore = newData.size >= pageSize
|
||||
Log.d("LiveVideoActivity", "是否有更多数据: $hasMore")
|
||||
|
||||
} catch (e: Exception) {
|
||||
Log.e("LiveVideoActivity", "请求异常: ${e.message}", e)
|
||||
hasMore = false
|
||||
} finally {
|
||||
isLoading = false
|
||||
Log.d("LiveVideoActivity", "请求结束,isLoading: $isLoading")
|
||||
Log.d("LiveVideoActivity", "=== 请求结束 ===")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleVoice() {
|
||||
isVoiceEnabled = !isVoiceEnabled
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.defenseapplication.utils
|
||||
|
||||
import android.R
|
||||
import bean.ForgotRequest
|
||||
import com.example.defenseapplication.bean.DeviceBean
|
||||
import com.example.defenseapplication.bean.DeviceUserBean
|
||||
@@ -12,6 +13,7 @@ import com.example.defenseapplication.bean.AddDeviceBean
|
||||
import com.example.defenseapplication.bean.AddDeviceUserRequest
|
||||
import com.example.defenseapplication.bean.DeleteBean
|
||||
import com.example.defenseapplication.bean.DeleteDeviceUserRequest
|
||||
import com.example.defenseapplication.bean.DeviceAlarmResponse
|
||||
import com.example.defenseapplication.bean.FamilyMembersBean
|
||||
import com.example.defenseapplication.bean.MessageBean
|
||||
import com.example.defenseapplication.bean.MessageListResponse
|
||||
@@ -220,6 +222,19 @@ interface ApiService {
|
||||
@POST("/app/upload")
|
||||
suspend fun uploadFile(@retrofit2.http.Part file: MultipartBody.Part): UploadResponse
|
||||
|
||||
/**
|
||||
* 设备告警日志
|
||||
*/
|
||||
@GET("/app/appMessage/deviceMeslist")
|
||||
suspend fun getDeviceAlarmList(
|
||||
@Query("deviceId") deviceId: String,
|
||||
@Query("pageNum") pageNum: String="1",
|
||||
@Query("pageSize") pageSize: String="10",
|
||||
@Query("startTime") startTime: String? = null,
|
||||
@Query("endTime") endTime: String? = null
|
||||
): DeviceAlarmResponse
|
||||
|
||||
|
||||
/**
|
||||
* 查看告警消息
|
||||
*/
|
||||
|
||||
9
app/src/main/res/drawable/card_bg.xml
Normal file
9
app/src/main/res/drawable/card_bg.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="#FFFFFF" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#EEEEEE" />
|
||||
</shape>
|
||||
41
app/src/main/res/layout/item_alarm_log_horizontal.xml
Normal file
41
app/src/main/res/layout/item_alarm_log_horizontal.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:background="@drawable/card_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_alarm_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="#F5F5F5" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#333333"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#999999" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -193,154 +193,13 @@
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 告警图片列表 -->
|
||||
<LinearLayout
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/alarmLogRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="200dp"
|
||||
android:background="#FFFFFF"
|
||||
android:paddingTop="8dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/img" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#000000"
|
||||
android:padding="2dp"
|
||||
android:text="60s"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/intrusion_detected"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03-11"
|
||||
android:textColor="@color/ic_normal"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/img" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/album" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/intrusion_detected"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03-11"
|
||||
android:textColor="@color/ic_normal"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/img" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#000000"
|
||||
android:padding="2dp"
|
||||
android:text="60s"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/intrusion_detected"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="03-11"
|
||||
android:textColor="@color/ic_normal"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user