第五天敏捷冲刺

1.昨天已经完成的工作

  • 删除了PlanListActivity中无用的引用
  • 重新规整了代码
  • 增加了Clock类
  • 增加了异常类

2.今天计划完成的工作

  • 增加Module类
  • 更改activity——config.xml的布局
  • 完善Sputils中的save方法
  • 完成设置页面的布局
  • 完善TimeUtil类
  • 完善了IOUtils的功能

3.工作中遇到的困难

  • 字符串转化为时间戳时总会遇到问题,最后通过date类的学习,解决问题
  • 设置界面布局困难

4.代码签入

5.最新模块的代码

<?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="match_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/config_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划名称"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <EditText
        android:id="@+id/config_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划的描述"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <EditText
        android:id="@+id/config_begin_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划的开始时间"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <EditText
        android:id="@+id/config_finish_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划的完成时间"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <EditText
        android:id="@+id/config_work_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划的单次工作时间"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <EditText
        android:id="@+id/config_break_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="此处输入计划的单次休息时间"
        android:textColor="@color/purple_200"
        android:textSize="24dp"></EditText>

    <Button
        android:id="@+id/yes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确定"
        android:tex
public class TimeUtil {
    protected static String translateTime(long time) {
        Date date = new Date(time);

        Format format = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");

        return format.format(date);
    }
}
package com.wqf.clock;

public class IOUitils {

    public static void savePlan(Plan plan) {
        // 保存plan为plan.xml文件
        SpUtil sp = SpUtils.getInstance(plan.name);
        sp.save("object", "plan");  // 此项说明文件保存对象的类型为Plan
        sp.save("plan", plan.name);
        sp.save("description", plan.description);
        sp.save("workTime", plan.workTime);
        sp.save("breakTime", plan.breakTime);
        sp.save("beginTime", plan.beginTime);
        sp.save("finishTime", plan.finishTime);
        sp.save("mould", plan.mould.name);
    }

    public static void saveMould(Mould mould) {
        // 保存mould为mould.xml文件
        SpUtil sp = SpUtils.getInstance(mould.name);
        sp.save("object", "mould");  // 此项说明文件保存对象的类型为Mould
        sp.save("mould", mould.name);
    }

    public static Plan loadPlan(String name) {
        // 尝试从名字为name的文件中读取出一个类型为Plan的对象
        // 若文件储存的对象类型为Plan,则根据文件内容构造出plan并返回
        // 若文件储存对象类型不为Plan或不存在该文件则返回null
        String[] fileArray = SpUtil.getFilename();  // 获取所有文件名

        for (String file : fileArray) {  // 遍历所有文件名
            if (file.matches(name)) {  // 若文件名与name匹配
                SpUtil sp = SpUtils.getInstance(file);

                if (sp.getString("object", "").matches("plan")) {  // 若文件储存的对象类型为Plan
                    Plan plan = new Plan();

                    plan.name = sp.getString("name", "未知计划");
                    plan.descroption = sp.getString("description", "");
                    plan.workTime = sp.getLong("workTime", 0);
                    plan.breakTime = sp.getLong("breakTime", 0);
                    plan.beginTime = sp.getLong("beginTime", 0);
                    plan.finishTime = Sp.getLong("finishTime", plan.beginTime);
                    plan.mould = new Mould(sp.getString("mould", "新模块"));
                    plan.setClocks();

                    reurn plan;
                } else {
                    return null;
                }
            }
        }
        return null;
    }


    public static Plan loadMould(String name) 

6.每人每日总结

陈泽同:项目很简单
谢国浩:队内大佬太强了
韦秋风:这个Timeutils做得不太行,但是又有点行。主要是不够高效,只能说勉强完成了任务

posted @ 2021-11-28 00:36  bbq-carol  阅读(20)  评论(0编辑  收藏  举报