[6.10.0]数据落盘修改
This commit is contained in:
@@ -8,12 +8,14 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.mogo.eagle.core.data.deva.diskcopy.CopyCalendarInfo
|
||||
import com.mogo.eagle.core.function.api.devatools.IDiskCopyListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDiskCopyManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.diskcopy.adapter.DiskCopyCalendarAdapter
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import kotlinx.android.synthetic.main.view_disk_copy.view.groupDateSelect
|
||||
import kotlinx.android.synthetic.main.view_disk_copy.view.groupDiskCopy
|
||||
import kotlinx.android.synthetic.main.view_disk_copy.view.ivDiskUnplug
|
||||
@@ -28,6 +30,7 @@ import kotlinx.android.synthetic.main.view_disk_copy.view.tvDiskFreeSpace
|
||||
import kotlinx.android.synthetic.main.view_disk_copy.view.tvDiskUsedPercent
|
||||
import kotlinx.android.synthetic.main.view_disk_copy.view.viewDiskCopyDate
|
||||
import packet_mytest_upload.CopyBag
|
||||
import java.lang.Exception
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
@@ -48,6 +51,10 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
|
||||
private var diskCopyCalendarAdapter: DiskCopyCalendarAdapter ?= null
|
||||
private var calendarList: ArrayList<CopyCalendarInfo> = ArrayList()
|
||||
//当前拷贝日期
|
||||
private var currentCopyDate: Int = 0
|
||||
//当前拷贝状态 0:默认状态;1:开始拷贝数据;2:拷贝中;3:拷贝成功;4:剩余空间不足;5:所选日期无法拷贝
|
||||
private var copyStatus: Int = 0
|
||||
|
||||
init{
|
||||
LayoutInflater.from(context).inflate(R.layout.view_disk_copy, this, true)
|
||||
@@ -57,7 +64,7 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
|
||||
private fun initView(){
|
||||
val gridLayoutManager = GridLayoutManager(context,7)
|
||||
diskCopyCalendarAdapter = DiskCopyCalendarAdapter()
|
||||
diskCopyCalendarAdapter = DiskCopyCalendarAdapter(context)
|
||||
diskCopyCalendarAdapter?.setDateSelectListener(object: DiskCopyCalendarAdapter.DateSelectListener{
|
||||
override fun onDateSelect(info: CopyCalendarInfo) {
|
||||
//切换页面隐藏日历显示,切换为硬盘接入页面
|
||||
@@ -67,17 +74,50 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
//显示选择日期
|
||||
tvCurrentDate.text = info.uiDateFormat
|
||||
tvCurrentWeek.text = parseWeekDescribe(info.currentDayOfWeek)
|
||||
if(info.canCopy){
|
||||
//开始拷贝数据
|
||||
tvCopyStatus.text = resources.getString(R.string.copy_bag_start)
|
||||
tvCopyStatus.setTextColor(context.getColor(R.color.color_copy_bag_start))
|
||||
copyStatus = 1
|
||||
currentCopyDate = info.ipcDateFormat.toInt()
|
||||
}else{
|
||||
//所选日期无法拷贝
|
||||
tvCopyStatus.text = resources.getString(R.string.date_cannot_copy)
|
||||
tvCopyStatus.setTextColor(context.getColor(R.color.color_date_cannot_copy))
|
||||
copyStatus = 5
|
||||
}
|
||||
}
|
||||
})
|
||||
rvCalendar.adapter = diskCopyCalendarAdapter
|
||||
rvCalendar.layoutManager = gridLayoutManager
|
||||
|
||||
//拷贝状态
|
||||
tvCopyStatus.setOnClickListener {
|
||||
if(copyStatus == 1){
|
||||
//开始拷贝数据
|
||||
CallerAutoPilotControlManager.sendCopyBagCopyDate(currentCopyDate)
|
||||
}else if(copyStatus == 2){
|
||||
//拷贝中
|
||||
ToastUtils.showShort("正在拷贝中...")
|
||||
}else if(copyStatus == 3){
|
||||
//拷贝成功
|
||||
ToastUtils.showShort("当前日期数据已拷贝成功")
|
||||
}else if(copyStatus == 4){
|
||||
//剩余空间不足
|
||||
ToastUtils.showShort("当前硬盘剩余空间不足")
|
||||
}else if(copyStatus == 5){
|
||||
//所选日期无法拷贝
|
||||
ToastUtils.showShort("所选日期无法拷贝")
|
||||
}
|
||||
}
|
||||
//拔出硬盘
|
||||
ivDiskUnplug.setOnClickListener {
|
||||
//TODO
|
||||
|
||||
//如果处于拷贝中,弹出终止数据拷贝确认提示窗
|
||||
CallerHmiManager.showTerminateCopyDataDialog()
|
||||
if(copyStatus == 2){
|
||||
//如果处于拷贝中,弹出终止数据拷贝确认提示窗
|
||||
CallerHmiManager.showTerminateCopyDataDialog()
|
||||
}else{
|
||||
//如果处于未拷贝状态,则调用硬盘安全弹出请求
|
||||
CallerAutoPilotControlManager.sendCopyBagSafeUnmount()
|
||||
}
|
||||
}
|
||||
|
||||
//数据日期
|
||||
@@ -240,6 +280,11 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
//展示当天日期
|
||||
tvCurrentDate.text = todayOfUi
|
||||
tvCurrentWeek.text = parseWeekDescribe(todayOfWeek)
|
||||
try {
|
||||
currentCopyDate = todayOfIpc.toInt()
|
||||
}catch (e: Exception){
|
||||
Logger.i(TAG,"日期转换异常:$e")
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseWeekDescribe(currentWeek: Int?): String{
|
||||
@@ -330,7 +375,14 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
diskCopy.mountSuccess.datesList.forEach {
|
||||
Logger.i(TAG, "可拷贝日期=$it")
|
||||
}
|
||||
|
||||
calendarList.forEach {
|
||||
if(!it.isTitle && it.ipcDateFormat.isNotEmpty()){
|
||||
if(diskCopy.mountSuccess.datesList.contains(it.ipcDateFormat)){
|
||||
it.canCopy = true
|
||||
}
|
||||
}
|
||||
}
|
||||
diskCopyCalendarAdapter?.setData(calendarList)
|
||||
//挂载异常: 移动硬盘挂载失败,请重插或更换硬盘
|
||||
Logger.i(TAG,"挂载异常="+diskCopy.mountError)
|
||||
|
||||
@@ -349,6 +401,7 @@ class DiskCopyView @JvmOverloads constructor(
|
||||
pbDiskCopyProgress.progress = copyProgress
|
||||
//拷贝状态控件显示当前拷贝进度
|
||||
tvCopyStatus.text = String.format(resources.getString(R.string.disk_copy_progress),copyProgress)
|
||||
tvCopyStatus.setTextColor(context.getColor(R.color.color_disk_copy_progress))
|
||||
}
|
||||
//拷贝剩余时间
|
||||
Logger.i(TAG,"拷贝剩余时间="+diskCopy.freeTime)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.diskcopy.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -11,12 +12,13 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
/**
|
||||
* 数据落盘日历适配器
|
||||
*/
|
||||
class DiskCopyCalendarAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
class DiskCopyCalendarAdapter(private val context: Context): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
private var data: ArrayList<CopyCalendarInfo> ?= null
|
||||
private val title: Int = 0
|
||||
private var dateSelectListener: DateSelectListener ?= null
|
||||
|
||||
|
||||
fun setData(list: ArrayList<CopyCalendarInfo>){
|
||||
data = list
|
||||
notifyDataSetChanged()
|
||||
@@ -46,6 +48,11 @@ class DiskCopyCalendarAdapter(): RecyclerView.Adapter<RecyclerView.ViewHolder>()
|
||||
data?.let {
|
||||
val dateInfo = it[position]
|
||||
holder.tvCalendarContent.text = dateInfo.calendarDateFormat
|
||||
if(dateInfo.canCopy){
|
||||
holder.tvCalendarContent.setTextColor(context.getColor(R.color.white))
|
||||
}else{
|
||||
holder.tvCalendarContent.setTextColor(context.getColor(R.color.color_disk_copy_date))
|
||||
}
|
||||
holder.tvCalendarContent.setOnClickListener {
|
||||
dateSelectListener?.onDateSelect(dateInfo)
|
||||
}
|
||||
|
||||
@@ -7,29 +7,28 @@
|
||||
android:height="@dimen/dp_440"
|
||||
android:gravity="center_vertical">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<solid android:color="#FFFFFFFF" />
|
||||
<corners android:radius="@dimen/dp_50" />
|
||||
<solid android:color="#00FFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 设置进度条颜色 -->
|
||||
<item
|
||||
android:id="@android:id/progress"
|
||||
android:width="@dimen/dp_654"
|
||||
android:height="@dimen/dp_440"
|
||||
android:gravity="center_vertical">
|
||||
<shape>
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_50"
|
||||
android:bottomLeftRadius="@dimen/dp_50"
|
||||
android:topRightRadius="@dimen/dp_0"
|
||||
android:bottomRightRadius="@dimen/dp_0"
|
||||
/>
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#00E5FF"
|
||||
android:endColor="#00FFA6"
|
||||
/>
|
||||
</shape>
|
||||
android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_50"
|
||||
android:bottomLeftRadius="@dimen/dp_50"
|
||||
android:topRightRadius="@dimen/dp_0"
|
||||
android:bottomRightRadius="@dimen/dp_0"
|
||||
/>
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#0000E5FF"
|
||||
android:endColor="#8000FFA6"
|
||||
/>
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -14,17 +14,16 @@
|
||||
|
||||
<!-- 设置进度条颜色 -->
|
||||
<item
|
||||
android:id="@android:id/progress"
|
||||
android:width="@dimen/dp_590"
|
||||
android:height="@dimen/dp_60"
|
||||
android:gravity="center_vertical">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#1F8DC0"
|
||||
android:endColor="#22DAF8"
|
||||
/>
|
||||
</shape>
|
||||
android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#1F8DC0"
|
||||
android:endColor="#22DAF8"
|
||||
/>
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -10,9 +10,9 @@
|
||||
android:layout_width="@dimen/dp_654"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_14"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:progressDrawable="@drawable/progressbar_disk_copy_progress"
|
||||
android:max="100"
|
||||
|
||||
@@ -95,4 +95,11 @@
|
||||
|
||||
<color name="cold_start_fail">#FF4E41</color>
|
||||
|
||||
<color name="color_disk_copy_date">#666666</color>
|
||||
<color name="color_disk_copy_progress">#99FFFFFF</color>
|
||||
<color name="color_copy_bag_start">#FF2EACFF</color>
|
||||
<color name="color_copy_bag_success">#FF26C14F</color>
|
||||
<color name="color_disk_not_enough_space">#FFFF4E41</color>
|
||||
<color name="color_date_cannot_copy">#FFFFCD3D</color>
|
||||
|
||||
</resources>
|
||||
@@ -287,7 +287,11 @@
|
||||
<string name="copy_bag_success_icon">数据落盘成功图标</string>
|
||||
<string name="copy_bag_success_close">关闭</string>
|
||||
<string name="disk_free_space">%dG可用</string>
|
||||
<string name="disk_used_percent">%d%</string>
|
||||
<string name="disk_copy_progress">拷贝中…%d%</string>
|
||||
<string name="disk_used_percent">%d%%</string>
|
||||
<string name="disk_copy_progress">拷贝中…%d%%</string>
|
||||
<string name="copy_bag_start">开始拷贝数据</string>
|
||||
<string name="copy_bag_success">拷贝成功</string>
|
||||
<string name="disk_not_enough_space">剩余空间不足</string>
|
||||
<string name="date_cannot_copy">所选日期无法拷贝</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.mogo.eagle.core.data.deva.diskcopy
|
||||
* @param ipcDateFormat 工控机约定格式日期
|
||||
* @param uiDateFormat UI约定显示日期
|
||||
* @param currentDayOfWeek 当前星期
|
||||
* @param canCopy 当天有可拷贝文件
|
||||
*/
|
||||
data class CopyCalendarInfo(var isTitle: Boolean, var calendarDateFormat: String,var ipcDateFormat: String? = "",
|
||||
var uiDateFormat: String? = "",var currentDayOfWeek: Int? = 0)
|
||||
data class CopyCalendarInfo(var isTitle: Boolean, var calendarDateFormat: String,var ipcDateFormat: String = "",
|
||||
var uiDateFormat: String = "",var currentDayOfWeek: Int = 0,var canCopy: Boolean = false)
|
||||
Reference in New Issue
Block a user