实现了垂直排序
This commit is contained in:
Generated
+11
@@ -4,6 +4,17 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="SmartPlateCabinet.app">
|
<SelectionState runConfigName="SmartPlateCabinet.app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DropdownSelection timestamp="2025-07-25T08:39:03.160022800Z">
|
||||||
|
<Target type="DEFAULT_BOOT">
|
||||||
|
<handle>
|
||||||
|
<DeviceId pluginId="Default" identifier="serial=?;connection=93a2ccce" />
|
||||||
|
</handle>
|
||||||
|
</Target>
|
||||||
|
</DropdownSelection>
|
||||||
|
<DialogSelection />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="LoginByFaceActivity">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ object GlobalData {
|
|||||||
/**
|
/**
|
||||||
* 竖排数量
|
* 竖排数量
|
||||||
*/
|
*/
|
||||||
var arrayVertical: Int = 11
|
var arrayVertical: Int = 10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排列方式 0 垂直 1 水平
|
* 排列方式 0 垂直 1 水平
|
||||||
|
|||||||
@@ -339,6 +339,7 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
|||||||
|
|
||||||
|
|
||||||
override fun onGlobalLayout() {
|
override fun onGlobalLayout() {
|
||||||
|
Timber.d("onGlobalLayout")
|
||||||
binding.dualCameraTexturePreviewRgb.getViewTreeObserver().removeOnGlobalLayoutListener(this)
|
binding.dualCameraTexturePreviewRgb.getViewTreeObserver().removeOnGlobalLayoutListener(this)
|
||||||
// 请求权限
|
// 请求权限
|
||||||
checkCameraPermission()
|
checkCameraPermission()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sw.platecabinet.fragment
|
package com.sw.platecabinet.fragment
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
@@ -42,7 +43,7 @@ class SettingListFragment :
|
|||||||
* 垂直滚动的adapter
|
* 垂直滚动的adapter
|
||||||
*/
|
*/
|
||||||
private var itemAdapter: GenericItemAdapter<EquipmentUserInfo, ItemBindViewBinding>? = null
|
private var itemAdapter: GenericItemAdapter<EquipmentUserInfo, ItemBindViewBinding>? = null
|
||||||
private val itemsPerPage = GlobalData.arrayCross * GlobalData.arrayVertical // 每行2个,每列11个,共22个
|
private val itemsPerPage = 2 * GlobalData.arrayVertical // 每行2个,每列11个,共22个
|
||||||
|
|
||||||
override fun registerDataChange() {
|
override fun registerDataChange() {
|
||||||
super.registerDataChange()
|
super.registerDataChange()
|
||||||
@@ -107,6 +108,11 @@ class SettingListFragment :
|
|||||||
item: EquipmentUserInfo,
|
item: EquipmentUserInfo,
|
||||||
position: Int
|
position: Int
|
||||||
) {
|
) {
|
||||||
|
if (item.equipmentBoxCode?.isEmpty() == true) {
|
||||||
|
this.llRoot.isVisible = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.llRoot.isVisible = true
|
||||||
this.tvNum.text = formatNumber(item.equipmentBoxCode ?: "")
|
this.tvNum.text = formatNumber(item.equipmentBoxCode ?: "")
|
||||||
if (item.isBound()) {
|
if (item.isBound()) {
|
||||||
val date = DateTimeUtils.parseDateTime(item.updateTime)
|
val date = DateTimeUtils.parseDateTime(item.updateTime)
|
||||||
@@ -176,14 +182,21 @@ class SettingListFragment :
|
|||||||
fun updateAdapter(items: List<EquipmentUserInfo>) {
|
fun updateAdapter(items: List<EquipmentUserInfo>) {
|
||||||
if (GlobalData.arrayCross > 2) {
|
if (GlobalData.arrayCross > 2) {
|
||||||
var pages = if (items.size > itemsPerPage) {
|
var pages = if (items.size > itemsPerPage) {
|
||||||
items.chunked(itemsPerPage) {
|
val pageList = items.chunked(itemsPerPage)
|
||||||
convertToColumnFirst(it, 11)
|
pageList.mapIndexed { index, it ->
|
||||||
|
var itemList: MutableList<EquipmentUserInfo> = it.toMutableList()
|
||||||
|
if (index == pageList.size - 1) {
|
||||||
|
itemList = (itemList + List(GlobalData.arrayVertical) {
|
||||||
|
EquipmentUserInfo()
|
||||||
|
}) as MutableList<EquipmentUserInfo>
|
||||||
|
}
|
||||||
|
convertToColumnFirst(itemList, GlobalData.arrayVertical)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
listOf(
|
listOf(
|
||||||
// 根据条件判断是否需要重新排列
|
// 根据条件判断是否需要重新排列
|
||||||
// items
|
items
|
||||||
convertToColumnFirst(items, 11)
|
// convertToColumnFirst(items, GlobalData.arrayVertical)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
pageAdapter?.updatePages(pages)
|
pageAdapter?.updatePages(pages)
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ class SettingViewModel : BaseViewModel() {
|
|||||||
_equipmentList.value = response.data ?: emptyList()
|
_equipmentList.value = response.data ?: emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// val list = mutableListOf<EquipmentUserInfo>()
|
||||||
|
// for (i in 1 .. 30){
|
||||||
|
// list.add(EquipmentUserInfo(id = i, equipmentBoxCode = i.toString()))
|
||||||
|
// }
|
||||||
|
// _equipmentList.value = list
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user