mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 05:27:10 +08:00
排档按钮增加确认对话框,列表项背景色标识已过期任务
- 点击 ▷ 按钮弹出确认对话框,显示任务详情与排档后时间 - 确认后执行排档,取消则不做任何操作 - 排档时间不超过当前时间的列表项背景色设为浅绿色 - 新增 dialog_schedule_confirm.xml 布局文件 - 新增 colorScheduleFutureBackground 颜色资源
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri May 22 16:56:04 HKT 2026
|
||||
#Fri May 22 17:09:32 HKT 2026
|
||||
stageCount=4
|
||||
libraryProject=
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.3
|
||||
buildCount=11
|
||||
buildCount=14
|
||||
baseBetaVersion=15.20.4
|
||||
|
||||
+57
-1
@@ -516,6 +516,56 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示排档确认对话框
|
||||
* @param position 要排档的任务位置
|
||||
*/
|
||||
private void showScheduleConfirmDialog(final int position) {
|
||||
if (position < 0 || position >= mTaskList.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TaskSchedulerBean task = mTaskList.get(position);
|
||||
long currentTime = task.getCurrentScheduleTime();
|
||||
int duration = task.getDurationMinutes();
|
||||
long newTime = currentTime + duration * 60 * 1000L;
|
||||
|
||||
final Dialog dialog = new Dialog(this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(R.layout.dialog_schedule_confirm);
|
||||
|
||||
TextView tvTaskName = dialog.findViewById(R.id.dialog_schedule_task_name);
|
||||
TextView tvCurrentTime = dialog.findViewById(R.id.dialog_schedule_current_time);
|
||||
TextView tvDuration = dialog.findViewById(R.id.dialog_schedule_duration);
|
||||
TextView tvRemark = dialog.findViewById(R.id.dialog_schedule_remark);
|
||||
TextView tvNewTime = dialog.findViewById(R.id.dialog_schedule_new_time);
|
||||
Button btnCancel = dialog.findViewById(R.id.dialog_btn_cancel);
|
||||
Button btnConfirm = dialog.findViewById(R.id.dialog_btn_confirm);
|
||||
|
||||
tvTaskName.setText("任务:" + task.getTaskName());
|
||||
tvCurrentTime.setText("当前排档时间:" + formatTimestamp(currentTime));
|
||||
tvDuration.setText("排档幅度:" + formatDurationToString(duration));
|
||||
tvRemark.setText("备注:" + (task.getRemark() != null && !task.getRemark().isEmpty() ? task.getRemark() : "无"));
|
||||
tvNewTime.setText("排档后时间:" + formatTimestamp(newTime));
|
||||
|
||||
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialog.dismiss();
|
||||
performSchedule(position);
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行排档操作
|
||||
* @param position 点击排档按钮的任务位置
|
||||
@@ -562,6 +612,12 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
|
||||
viewHolder.mtvDuration.setText(formatDurationToString(item.getDurationMinutes()));
|
||||
viewHolder.mtvRemark.setText(item.getRemark());
|
||||
|
||||
if (item.getCurrentScheduleTime() <= System.currentTimeMillis()) {
|
||||
viewHolder.mllMain.setBackgroundResource(R.color.colorScheduleFutureBackground);
|
||||
} else {
|
||||
viewHolder.mllMain.setBackgroundResource(R.drawable.bg_frame);
|
||||
}
|
||||
|
||||
// 长按直接内置菜单,直接使用当前position
|
||||
viewHolder.mllMain.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
@@ -593,7 +649,7 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
|
||||
viewHolder.mbtnSchedule.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
performSchedule(position);
|
||||
showScheduleConfirmDialog(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp"
|
||||
android:background="?android:attr/windowBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认执行排档"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="15dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_schedule_task_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingBottom="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:paddingBottom="5dp"
|
||||
android:id="@+id/dialog_schedule_current_time"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:paddingBottom="5dp"
|
||||
android:id="@+id/dialog_schedule_duration"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:paddingBottom="5dp"
|
||||
android:id="@+id/dialog_schedule_remark"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:paddingTop="10dp"
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/dialog_schedule_new_time"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="20dp"
|
||||
android:gravity="end">
|
||||
|
||||
<Button
|
||||
android:id="@+id/dialog_btn_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="取消"
|
||||
android:layout_marginEnd="10dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/dialog_btn_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认排档"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -20,4 +20,6 @@
|
||||
<!-- 基础颜色 -->
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
<!-- 排档时间超过当前时间的列表项背景色 -->
|
||||
<color name="colorScheduleFutureBackground">#FFC8E6C9</color>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user