Android应用程序开发
课程设计报告
(2019—2020学年 第Ⅰ学期)
基于Android的日历系统
系 别 信息与控制工程
专 业 计算机科学与技术
班 级 1701
姓 名 刘畅
指导教师 郭 丹
目录
一、 摘要3
二、 需求分析3
2.1 需求分析 3
2.2 UML需求用例图及用例分析说明 4
三、 系统设计5
3.1 系统总体设计 5
3.2系统数据库设计 5
3.3系统详细设计 6
3.4各模块功能 6
3.5 UML设计 7
四、系统测试8
4.1日历主界面 8
4.2编辑日程界面 9
4.3查看界面 12
五、系统实现13
5.1系统实现目标 13
5.2界面布局 13
附件 19
一、摘要
日历提醒软件的设计和实现是在Android平台下开发的,实现了一个多功能和全方位的日历提醒功能,为用户提供全方位的时间安排和管理,随时记录所思所想,具有较高的实用价值。
如今智能手机的发展,进入崭新的时代,与此同时,移动互联网也在高速的发展,进入4G时代,促进智能手机的不断进步。Android作为一个重要的手机软件发展平台,以及当今手机软件的主流使用系统,它的特点是具有开放性体系架构,具有非常好的开发,调试环境,而且还可以支持各种拓展的用户体验,包括了丰富的图形组建还有多媒体支持功能,同时有强大的浏览器,因此对软件从业人员来说,Android平台具有无限的吸引力。
本系统在分析讨论原有的手机软件开发原理的基础上,开发出能为用户提供的更好基于Android的日历提醒软件。
二、需求分析
2.1 需求分析
日历提醒软件主要帮助人们对时间日程进行安排,日常生活中我们难免要进行时间的查看,这个日历软件有以下功能:首先和传统的日历软件一样,可以对时间,年月,日期,节日进行查看;其次还可以对每日的行程进行记录,对日程安排进行提醒,方便人们在快节奏的生活中,合理高效的安排自己的时间;同时对学生来说,我们还有课程提醒模块,不论大学生还是高中生,课前都会有闹铃提醒,所谓的“忘记上课”“不知道上什么课”这些理由也可以不出现自己的生活中了;最后,每日我们会发生很多的事情,轻轻一点,我们就可以及时记录下当时当日的心情,感受,在以后回想起来都是不同的感情。这个应用软件简单易学,功能全面,界面简单操作方便,在传统的日历系统中添加了很多特别的元素,成为人们生活中不可缺少的一部分。
本次项目所实现的日历系统,除了最基本的日期信息查询功能外,还具备了设置日程,会议、约会、生日提醒等功能,当天日期定位功能和日程管理功能。通过转换功能,用户想知道某天或某个月有什么节日,可以直接在界面中查看,而日程管理功能则为用户提供了类似备忘录的平台。
2.2 UML需求用例图及用例分析说明
用例分析说明
日历主页面:查看当前月份,并且可以定位到当前的日期,而且可以左右滑动看之前或者之后月份的日期
输入日程:在输入日程页面,用户需要添加自己想要添加的日程信息,这些数据会被存储到数据库中
日程类型:在输入日程页面,用户可以根据自己的要求来设置自己所需的日程类型,如:会议、约会、课程。
设置时间:在输入日程页面,用户可以添加提醒的时间间隔,这样更方便快捷
查看日程:在日历主页面,用户可以查看自己所添加的日程,这些数据会从数据库中调出
名称 |
数据类型 |
长度 |
约束 |
说明 |
scheduleID |
integer |
0 |
PRIMARY KEY AUTOINCREMENT |
日程编号 |
scheduleTypeID |
integer |
0 |
|
日程类型 |
remindID |
integer |
0 |
|
日程类型编号 |
Time |
varchar |
20 |
|
时间间隔 |
scheduleContent |
varchar |
20 |
|
日程内容 |
scheduleDate |
varchar |
20 |
|
日程时间 |
scheduleID |
scheduleTypeID |
remindID |
Time |
scheduleContent |
scheduleDate |
6 |
会议 |
1 |
提醒一次 |
表彰大会 |
13:30 |
7 |
约会 |
2 |
提醒一次 |
看电影 |
15:00 |
编号 |
点击 |
处理 |
输出 |
1 |
当前日期 |
与设定值相等 |
进入当前日期 |
2 |
之前和之后的日期 |
与设定值相等 |
进入所点击的日期 |
编号 |
输入 |
处理 |
输出 |
1 |
日程类型,如:会议、约会、课程 |
将数据存入数据库 |
添加成功 |
2 |
添加提醒的时间间隔 |
将数据存入数据库 |
添加成功 |
3 |
添加的日程时间 |
将数据存入数据库 |
添加成功 |
4 |
添加的日程信息 |
将数据存入数据库 |
添加成功 |
编号 |
输入 |
处理 |
输出 |
1 |
设置日程的日期 |
跳转到已设置的日程页面 |
显示查看日程页面 |
日历主界面:查看当前月份,并且可以定位到当前的日期,而且可以左右滑动看之前或者之后月份的日期,使用onCreat方法,实现页面跳转,日期的查询、跳转,不管浏览查看的是哪天的信息,只要点击今天就能成功的跳转到今天所在的那年那月的节目,并且对那日进行不同颜色的标注。
编辑日程界面:首页主要由4个分支组成,用户在日程类型界面可以根据自己的要求来设置自己所需的日程类型,如:会议、约会、课程,在日程时间间隔界面,提醒用户可以添加提醒的时间间隔,这样更方便快捷,在日程时间界面,用户可以设定时间,在输入日程界面,用户需要添加自己想要添加的日程信息,这些数据会被存储到数据库中。
日程类型模块:使用了SQLite数据库,实现了日程类型的添加,同时查询显示用户信息时调适配器实现了Listview。
日程时间间隔模块:实现了Activity之间的跳转,可以选择自己想要的时间间隔。
日程时间模块:使用了SQLite数据库,添加自己想要的时间。
输入日程模块:使用了SQLite数据库,实现了日程的添加。
查看日程界面:实现了Activity之间的跳转,使用了SQLite数据库,可以查看自己的所添加的日程。
3.5.1 UML时序图
本次课程设计所用的开发环境为:eclipse
开发技术:Android
数据库:SQLite数据库
可以查看当前的日期和前后月份的日期
添加想要选择的会议类型
4.1.2 日程提醒时间
添加日程类型提醒时间
4.1.3 日程时间
添加日程时间
4.1.4 日程内容
添加日程内容
查看你所添加的日程
一个好的日历系统应该功能明确,用户可以很快的熟悉使用流程,而不是看到界面不知道应该如何的操作,即操作要简单,界面友好易懂。本软件安装便捷,使用简单,正好可以解决这一问题。本系统是基于Android系统的日历系统,日历系统本身,主要有如下功能:可以在主界面进行日历的查询:显示当月,前一个月后一个月,前一年后一年,并且日历中包含了各个重要的节日或纪念日等并且在日历界面上点击每个日期都会跳到当前日期的日程添加界面。
5.2.1 日历主界面
calendar.xml
<?xml version="1.0" encoding="utf-8"?>
//线性布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#FFFFFF"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
//使用组件TextView输入文字
<TextView
android:gravity="center"
android:layout_width="46dp"
android:layout_height="55dp"
android:id="@+id/tvtext"/>
</LinearLayout>
convert.xml
<?xml version="1.0" encoding="utf-8"?>
//线性布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/schedule_bk">
<com.pwp.borderText.BorderTextView
android:id="@+id/convertTop"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/top_day"
android:textStyle="bold"
android:clickable="true"
android:textColor="#000000"
android:text="日期转换"
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/convertDate"
android:layout_marginTop="5dp"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ffffff"
android:drawableRight="@drawable/date_convert"
android:paddingRight="5dp"
android:textStyle="bold"
android:clickable="true"
android:textColor="#000000"
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/convert"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_width="100dp"
android:layout_height="40dp"
android:background="#A0FF20"
android:paddingRight="5dp"
android:textStyle="bold"
android:clickable="true"
android:textColor="#ffffff"
android:text="查询"
/>
//使用组件TextView输入文字
<TextView
android:id="@+id/convertResult"
android:layout_marginTop="5dp"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:background="#A08080"
android:textStyle="bold"
android:textColor="#208080"
android:textSize="20sp"
/>
</LinearLayout>
5.1.2 编辑日程界面
main.xml
<?xml version="1.0" encoding="utf-8"?>
//线性布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.pwp.borderText.BorderText
android:layout_width="fill_parent"
android:layout_height="38dp"
android:gravity="center"
android:id="@+id/toptext"
android:textSize="15sp"
android:drawableLeft="@drawable/previous_year"
android:drawableRight="@drawable/next_year"
android:paddingLeft="35dp"
android:paddingRight="35dp"
/>
//显示视图控件
<ViewFlipper android:id="@+id/flipper"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
</LinearLayout>
schedule.xml
<?xml version="1.0" encoding="utf-8"?>
//线性布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/schedule_bk"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.pwp.borderText.BorderTextView
android:id="@+id/scheduleTop"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/top_day"
android:textStyle="bold"
android:clickable="true"
android:textColor="#000000"
android:text="编辑日程"
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/scheduleType"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:drawableRight="@drawable/schedule_type"
android:textColor="#000000"
android:clickable="true"
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/scheduleDate"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="43dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#000000"
android:clickable="true"
/>
<com.pwp.borderText.BorderEditText
android:id="@+id/scheduleText"
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="240dp"
android:background="@null"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#000000"
android:hint="请输入你的日程..."
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/save"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/top_day"
android:textStyle="bold"
android:clickable="true"
android:layout_marginTop="5dp"
android:textColor="#000000"
android:text="保存"
/>
<!--<Button
android:id="@+id/save"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="SAVE"
/>
--></LinearLayout>
5.2.3 查看日程界面
schedule_info.xml
<?xml version="1.0" encoding="utf-8"?>
//线性布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/schedule_bk"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.pwp.borderText.BorderTextView
android:id="@+id/scheduleInfoTop"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/top_day"
android:textStyle="bold"
android:clickable="true"
android:textColor="#000000"
android:text="日程"
/>
<com.pwp.borderText.BorderTextView
android:id="@+id/scheduleInfo"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/top_day"
android:textStyle="bold"
android:clickable="true"
android:textColor="#000000"
/>
</LinearLayout>
一、课设题目
基于Android的日历系统
二、技术说明
1.Activity之间的跳转
实现页面跳转
2. Sqlite数据库
实现数据的添加功能
3.控件的使用
Textview 、Button 等
4.Listview的使用
两个适配器的调试
5.事件的监听
OnClickListener()方法实现监听
6.页面布局
使用线性布局(LinearLayout)
三、UML类图
四、代码
清单文件:
布局文件:
2.1 截图
2.2 原码
类说明
CalendarActivity.java--日历显示activity
CalendarConvert.java-- 日期转换
CalendarView.java--日历gridview中的每一个item显示的textview
ScheduleAll.java--显示所有日程的activity
ScheduleInfoView.java--显示日程所有信息
ScheduleTypeView.java--日程类型选择
ScheduleView.java--添加日程主界面
BorderEditText.java--带边框的EditText
BorderText.java--实现带下边框的textView
BorderTextView.java--带边框的TextView
LunarCalendar.java--得到当前年对应的年份
SpecialCalendar.java--指定某年中的某月的第一天是星期几
CalendarConstant.java--日程类型
ScheduleDateTag.java--需要标记的日程日期
ScheduleVO.java--日程的VO类
DBOpenHelper.java--extends SQLite数据库
ScheduleDAO.java--对日程DAO操作
原文:https://www.cnblogs.com/lc07/p/11997123.html