列表项排档时间旁增加倒计时/已过时间显示

- 排档时间行改为横向布局,新增蓝色 TextView
- 排档时间大于当前时间显示剩余X月X天X小时
- 排档时间小于等于当前时间显示已过X月X天X小时
This commit is contained in:
aBuild
2026-05-22 18:58:54 +08:00
parent e61c36dfed
commit 4acae6726c
3 changed files with 38 additions and 12 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Fri May 22 17:22:44 HKT 2026
#Fri May 22 18:52:55 HKT 2026
stageCount=5
libraryProject=
baseVersion=15.20
publishVersion=15.20.4
buildCount=0
buildCount=1
baseBetaVersion=15.20.5
@@ -612,6 +612,14 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
viewHolder.mtvDuration.setText(formatDurationToString(item.getDurationMinutes()));
viewHolder.mtvRemark.setText(item.getRemark());
long diffMs = item.getCurrentScheduleTime() - System.currentTimeMillis();
int diffMinutes = (int) Math.abs(diffMs / 60000);
if (diffMs >= 0) {
viewHolder.mtvTimeDiff.setText("剩余" + formatDurationToString(diffMinutes));
} else {
viewHolder.mtvTimeDiff.setText("已过" + formatDurationToString(diffMinutes));
}
if (item.getCurrentScheduleTime() <= System.currentTimeMillis()) {
viewHolder.mllMain.setBackgroundResource(R.color.colorScheduleFutureBackground);
} else {
@@ -663,6 +671,7 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
class TaskViewHolder extends RecyclerView.ViewHolder {
TextView mtvTaskName;
TextView mtvCurrentScheduleTime;
TextView mtvTimeDiff;
TextView mtvDuration;
TextView mtvRemark;
LinearLayout mllMain;
@@ -672,6 +681,7 @@ public class TaskSchedulerActivity extends WinBoLLActivity {
super(itemView);
mtvTaskName = itemView.findViewById(R.id.item_task_name);
mtvCurrentScheduleTime = itemView.findViewById(R.id.item_start_time);
mtvTimeDiff = itemView.findViewById(R.id.item_time_diff);
mtvDuration = itemView.findViewById(R.id.item_duration);
mtvRemark = itemView.findViewById(R.id.item_remark);
mllMain = itemView.findViewById(R.id.itemtaskscheduler_llmain);
@@ -50,22 +50,38 @@
android:gravity="center_vertical"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="排档时间:"
android:textAppearance="?android:attr/textAppearanceSmall"/>
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="@+id/item_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="排档时间:"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/item_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/item_time_diff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FF1976D2"
android:layout_marginStart="10dp"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 排档幅度:"
android:text="排档幅度:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginLeft="0dp"/>