1 先来张图

2 原理

2.1系统原理

实现了会议室的预定功能,且通过日历时间轴等等控件来控制会议室的使用。

2.2数据库

使用了郭霖的LitePal,具体请移步http://blog.csdn.net/guolin_blog。

2.3TimeLine控件源码

package com.example.shijianzhou;import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
import android.text.format.Time;
import android.util.AttributeSet;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;/*** 用来实现会议预定的时间轴。* * @version 0.1* @author zhou* */
public class TimeLine extends LinearLayout {private Runnable mTicker;private Handler mHandler;/*** 控制定时线程是否运行的flag。*/private boolean mTickerStopped;private Calendar mCalendar;private String mFormat = "hh:mm:ss";private ImageView pasttime;private int Width;private int Height;private LinearLayout mainline;private ArrayList<HashMap<String, Integer>> huiyitimelist;public TimeLine(Context context, AttributeSet attrs) {super(context, attrs);// TODO Auto-generated constructor stubLayoutInflater.from(context).inflate(R.layout.timeline, this, true);pasttime = (ImageView) findViewById(R.id.pasttime);mainline = (LinearLayout) findViewById(R.id.mainline);initTimeLine(context);}@Overrideprotected void onAttachedToWindow() {super.onAttachedToWindow();setmTickerstart();}@Overrideprotected void onDetachedFromWindow() {super.onDetachedFromWindow();mTickerStopped = true;}private void initTimeLine(Context context) {if (mCalendar == null) {mCalendar = Calendar.getInstance();}huiyitimelist = new ArrayList<HashMap<String, Integer>>();// 取得屏幕的宽度和高度WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);Display display = windowManager.getDefaultDisplay();Width = display.getWidth();Height = display.getHeight();}/*** * 移动游标到指定位置。* * @param position*            位置参数。*/public void movePoint(int position) {android.view.ViewGroup.LayoutParams params = pasttime.getLayoutParams();params.width = position;pasttime.setLayoutParams(params);}/*** * 使时间轴上指定的一段变红,即该段时间会议室已经被预定。* * @param start*            起始时间(秒)* @param end*            结束时间(秒)* * @return -1 失败 1 成功。*/public int setSegmentRed(int start, int end) {HashMap<String, Integer> map = new HashMap<String, Integer>();map.put("starttime", start);map.put("endtime", end);start = start * Width / (24 * 60 * 60);end = end * Width / (24 * 60 * 60);map.put("start", start);map.put("end", end);if (end <= start) {return -1;// 代表会议时间错误。}for (int i = 0; i < huiyitimelist.size(); i++) {int startlocal = huiyitimelist.get(i).get("start");int endlocal = huiyitimelist.get(i).get("end");if ((start > startlocal & start < endlocal)| (end > startlocal & end < endlocal)) {return -2;// 代表会议时间冲突。}}huiyitimelist.add(map);mainline.removeAllViews();for (int i = 0; i < huiyitimelist.size(); i++) {int startlocal = huiyitimelist.get(i).get("start");int endlocal = huiyitimelist.get(i).get("end");LinearLayout layout_sub_Lin = new LinearLayout(getContext());LinearLayout.LayoutParams LP_WW = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);LP_WW.width = (endlocal - startlocal);if (i == 0) {LP_WW.leftMargin = startlocal;} else {LP_WW.leftMargin = startlocal- huiyitimelist.get(i - 1).get("end");}layout_sub_Lin.setLayoutParams(LP_WW);layout_sub_Lin.setBackgroundColor(0x88ffff00);mainline.addView(layout_sub_Lin);}return 1;}/*** 清除所有时间轴上的会议占用时间标记。*/public void clearAllsegment() {mainline.removeAllViews();huiyitimelist.clear();}/*** 控制定时器是否继续工作。* * @param mTickerStopped*            true则时钟停止。*/public void setmTickerStopped() {mTickerStopped = true;movePoint(0);}/*** 时间轴动起来。*/public void setmTickerstart() {// TODO Auto-generated method stubmTickerStopped = false;mHandler = new Handler();mTicker = new Runnable() {public void run() {if (mTickerStopped) {return;} else {mCalendar.setTimeInMillis(System.currentTimeMillis());Time t = new Time(); // or Time t=new Time("GMT+8"); 加上Time// Zone资料。t.setToNow(); // 取得系统时间。int hour = t.hour; // 0-23int minute = t.minute;int second = t.second;int allseconds = hour * 60 * 60 + minute * 60 + second;int point = allseconds * Width / (24 * 60 * 60);movePoint(point);invalidate();// 遍历是否有会议开始或者结束。// Log.v("znz", "size --> " + huiyitimelist.size());// Log.v("znz",// "starttime --> "// + huiyitimelist.get(0).get("starttime"));// Log.v("znz", "allseconds ---> " + allseconds);// Log.v("znz",// "endtime --> " + huiyitimelist.get(0).get("endtime"));for (int i = 0; i < huiyitimelist.size(); i++) {if (allseconds >= huiyitimelist.get(i).get("starttime")& allseconds <= huiyitimelist.get(i).get("endtime")) {if (timelinecallback != null) {timelinecallback.huiyiStarted(huiyitimelist.get(i).get("starttime"), huiyitimelist.get(i).get("endtime"));break;}}if (i == (huiyitimelist.size() - 1)) {if (timelinecallback != null) {timelinecallback.huiyiStoped();}}}long now = SystemClock.uptimeMillis();long next = now+ (1000 - System.currentTimeMillis() % 1000);mHandler.postAtTime(mTicker, next);}}};mTicker.run();}private TimelineCallback timelinecallback;/*** @param timelinecallback*            the timelinecallback to set*/public void setTimelinecallback(TimelineCallback timelinecallback) {this.timelinecallback = timelinecallback;}}

2.4项目下载

http://download.csdn.net/detail/zhounanzhaode/8902951

Android会议室管理app相关推荐

  1. android 时间管理app,时间管理app

    时间管理app是一款日常生活应用软件,时间管理app可以帮助大家规划自己每日的时间表,无论是工作还是生活,都可以当作是一份备忘录使用,如有重要的会议.社交活动时,时间管理可以将你一天二十四小时分为若干 ...

  2. android 时间管理app,时间管理达人必备的10款APP

    摘自:http://www.360doc.com/content/18/0328/05/50030440_740764371.shtml 工具永远是工具. 我们要做工具的主人,而不是成为工具的奴隶. ...

  3. Android 物品管理 APP,智能云仓库存管理APP

    智能云仓库存管理APP是一款服务商家的应用,平台利用云服务管理技术,了解每个商品的入库.出库.销售等一系列数据,用户可在手机端清晰的了解到商品销售的情况,再对销售进行管理,巧妙的运用数据,提高店铺的销 ...

  4. 基于android停车管理app,基于Android的城市智能停车APP设计与研究

    摘要: 伴随智慧城市进程的推进,人们追求生活智能化.道路拥堵,交通堵塞以及停车难等城市交通问题让"有车一族"头疼不已,降低了人们的停车体验.本文综合运用了移动定位技术,Androi ...

  5. android 油耗管理app,油耗记录app下载-油耗记录 安卓版v1.0.0-PC6安卓网

    油耗记录软件是一款油耗软件,油耗记录app能够帮助车主记录油耗,油耗记录小软件了解车子的状况,客观反映油耗情况,采用两种科学计算方法,还能够记录消费. 软件介绍 油耗记录软件是一款简单而又全面的应用, ...

  6. android 油耗管理app,油耗记录软件下载-油耗记录appv1.0.0 安卓版-腾牛安卓网

    油耗记录app是一款可以准确测算油耗的软件,能够帮助车主详细的记录油耗,了解车子的状况,客观反映油耗情况,还有记录消费功能.有需要的欢迎前来下载使用! 应用介绍: 这是一款简单而又全面的应用,用于跟踪 ...

  7. android 笔记管理app,安卓有什么记笔记的软件?安卓平台好用的笔记app

    原标题:安卓有什么记笔记的软件?安卓平台好用的笔记app 物极必反的道理,我每年放寒暑假的时候都深有体会,刚开始放假那几天,我每天都觉得很开心,日子久了之后,该玩的也都玩了,该见的人也都见了,快乐的事 ...

  8. Android窗口管理服务WindowManagerService切换Activity窗口(App Transition)的过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8596449 在Android系统中,同一时刻只 ...

  9. 基于Android的时间管理源码,基于安卓的手机时间管理APP系统

    随着生活环境节奏的加快,人们反而对时间的概念不强,对时间的有效利用率在降低,特别是对于自制能力差的人来说尤为严重,针对自制能力差的人,设计一款关于时间管理的手机APP是很有必要的,有利于合理有效的利用 ...

  10. 基于Android的班级管理APP的设计与实现

    选题背景 在当代大学生的日常学习和生活中,手机已经成为必不可少的工具,这导致大学学习生活中的各种日常生活及学习事务需要通过手机作为媒介进行通知及处理.而目前市场上存在的各种社交软件(如QQ.微信等)并 ...

最新文章

  1. NLP入门必知必会(一):Word Vectors
  2. 捷讯技术分享SSH 无法远程登录问题的处理办法汇总
  3. python wlile
  4. wxWidgets:wxFileType类用法
  5. Python程序员的30个常见错误
  6. python字符串字面量有哪四种定义方式_python中字符串连接的四种方式
  7. Impala的安装(含使用CM安装 和 手动安装)(图文详解)
  8. img src SVG使用CSS更改样式
  9. RightFont 5字体管理工具新手使用指南
  10. 微信小程序生成海报页面
  11. crashdumpandroid_Android Stability - crash 和 ramdump
  12. 【GDB】__stack_chk_fail 栈溢出问题定位
  13. 【C语言】街区最短路径问题解题思路
  14. hugo使用katex
  15. Code::Blocks 的配色方案
  16. N97mini用什么杀毒软件最好?机器容易中毒吗 我已经删了网秦
  17. 一台电脑上idea+webstorm使用nginx配置前后端分离
  18. 英语总结——新的开始
  19. 迷你TXT小说阅读器 V2.85 发布!
  20. EasyExcel快捷导出

热门文章

  1. C++ Const 初步总结(《C++程序设计语言》读后感)
  2. EXCLE为什么双击横杠日期才能变成斜杠日期
  3. ChucK初步(3)
  4. 120. Triangle(三角矩阵)
  5. 软件工程师工作经历_我学会成为高级软件工程师的经历
  6. 水冷计算机配置单,新手水冷电脑组装的详细图文教程
  7. 盘点7款常用的数据分析工具
  8. android ipad 传视频播放器,三种将本地视频导入到iPad中的方法
  9. 实验一:MongoDB的基本操作
  10. 使用npm安装下载jQuery