设备列表扫码获取数据完成
parent
46e54cda3d
commit
3fec452e95
@ -0,0 +1,67 @@
|
||||
package com.bjzc.bhzhgd.activity.zhgd
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.bjzc.bhzhgd.R
|
||||
import com.bjzc.bhzhgd.adapter.DeviceThreeLevelAdapter
|
||||
import com.bjzc.bhzhgd.adapter.DeviceTwoLevelAdapter
|
||||
import com.bjzc.bhzhgd.bean.DeviceZhgdBean
|
||||
import com.bjzc.bhzhgd.databinding.ActivityDeviceListBinding
|
||||
import com.bjzc.bhzhgd.databinding.ActivityDeviceThreeLevelBinding
|
||||
import com.bjzc.bhzhgd.utils.GsonUtils
|
||||
import com.bjzc.bhzhgd.utils.OAToolbar
|
||||
import com.rehome.scbaxj.base.BaseActivityOaToolbarViewBinding
|
||||
|
||||
class DeviceThreeLevelActivity :
|
||||
BaseActivityOaToolbarViewBinding<ActivityDeviceThreeLevelBinding>() {
|
||||
|
||||
private var datas: MutableList<DeviceZhgdBean.DataBean> = mutableListOf()
|
||||
private lateinit var adapter: DeviceThreeLevelAdapter
|
||||
|
||||
override fun getViewBinding() = ActivityDeviceThreeLevelBinding.inflate(layoutInflater)
|
||||
|
||||
override fun getToolbar() = binding.toolbarView.toolbar
|
||||
|
||||
override fun initView() {
|
||||
initToolbar("三级电箱", "", {finish() }, {
|
||||
|
||||
})
|
||||
|
||||
|
||||
val dataList = intent.getParcelableArrayListExtra<DeviceZhgdBean.DataBean>("data")
|
||||
if (dataList != null && dataList.size > 0) {
|
||||
showLog("data is not null")
|
||||
datas.clear()
|
||||
datas.addAll(dataList)
|
||||
} else {
|
||||
showLog("data is null")
|
||||
}
|
||||
|
||||
binding.lv.emptyView = binding.tvNodata
|
||||
|
||||
adapter = DeviceThreeLevelAdapter(context, datas)
|
||||
binding.lv.adapter = adapter
|
||||
|
||||
if (datas != null && datas.size > 0) {
|
||||
binding.tvNodata.visibility = View.GONE
|
||||
binding.lv.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.tvNodata.visibility = View.VISIBLE
|
||||
binding.lv.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,44 @@
|
||||
package com.bjzc.bhzhgd.adapter
|
||||
|
||||
class DeviceTwoLevelAdapter {
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.bjzc.bhzhgd.base.BaseAdapterViewBinding
|
||||
import com.bjzc.bhzhgd.bean.DeviceZhgdBean
|
||||
import com.bjzc.bhzhgd.databinding.AdapterDeviceTwoLevelBinding
|
||||
|
||||
|
||||
class DeviceTwoLevelAdapter(var context: Context,
|
||||
var data: MutableList<DeviceZhgdBean.DeviceBean>) : BaseAdapterViewBinding<AdapterDeviceTwoLevelBinding>(context) {
|
||||
override fun getCount(): Int {
|
||||
return data.count()
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Any {
|
||||
return data[position]
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return position.toLong()
|
||||
}
|
||||
|
||||
override fun getBinding(
|
||||
inflater: LayoutInflater,
|
||||
parent: ViewGroup?
|
||||
) = AdapterDeviceTwoLevelBinding.inflate(inflater, parent, false)
|
||||
|
||||
override fun handleData(position: Int, binding: AdapterDeviceTwoLevelBinding) {
|
||||
val item: DeviceZhgdBean.DeviceBean = data[position]
|
||||
binding.tvJs.text = item.js
|
||||
binding.tvDxbh.text = item.dxbh
|
||||
binding.tvMc.text = item.mc
|
||||
binding.tvGl.text = item.gl
|
||||
binding.tvGlJ.text = item.gL_J
|
||||
binding.tvBz.text = item.bz
|
||||
binding.tvNfc.text = item.nfc
|
||||
binding.tvWzms.text = item.wzms
|
||||
binding.tvZrrXm.text = item.zrR_XM
|
||||
binding.tvZrrSjhm.text = item.zrR_SJHM
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activity.zhgd.DeviceThreeLevelActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbarView"
|
||||
layout="@layout/layout_base"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/px_10"
|
||||
android:divider="#00000000"
|
||||
android:dividerHeight="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nodata"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/viewfinder_mask"
|
||||
android:gravity="center"
|
||||
android:text="暂无保存数据"/>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@ -1,6 +1,359 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#cccccc"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="公司名称:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gsmc"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备名称:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_mc"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备数量:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sl"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设备容量(kw):" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_rl"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="相数:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_xs"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="功率:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gl"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电压:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dy"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="空载率:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_kzl"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="总功率:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_zrl"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="备注:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bz"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="责任人:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_zrr"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用点设备编号:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ydsbdxbh"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="手机号码:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sjhm"
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
style="@style/dagerListMarginTopStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="invisible"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailLeftStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
style="@style/dagerDetailRightStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue