Android会议室管理app
来源:互联网 发布:win10声音优化软件 编辑:程序博客网 时间:2024/04/25 19:02
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
0 0
- Android会议室管理app
- 基于Android平台的会议室管理系统详细设计说明书
- Android --- App缓存管理
- Android--App缓存管理
- Android--App缓存管理
- android App 缓存管理
- android App缓存管理
- Android--App缓存管理
- android app 缓存管理
- Android App 缓存管理
- Android管理App的内存
- 管理Android APP的内存
- Android App堆栈内存管理
- linux下搭建mrbs会议室预定管理系统
- openfire Android学习(三)----会议室创建、加入以及查询会议室中所有成员等
- Android IM(三)会议室创建、加入以及查询会议室中所有成员
- openfire,smack,XMPP,android下的会议室,聊天室的实现
- Android——APP缓存管理
- Linux 服务器安全技巧
- bzoj2179: FFT快速傅立叶
- connect(9, {sa_family=AF_LOCAL, sun_path="/var/run/dbus/system_bus_socket"}, 33) = -1 ENOENT (No suc
- C/C++:函数的编译方式与调用约定以及extern “C”的使用
- 南阳理工86 找球号
- Android会议室管理app
- 欢迎使用CSDN-markdown编辑器
- CS0016: 未能写入(A compilation error has occurred.HttpCompileException: error CS0016: Could not write to
- 实现两个N*N矩阵的乘法 矩阵用一维数组表示
- C语言统计输入的单词个数
- 什么情况下不会执行finally中的代码?
- Unity3D 游戏架构脚本该如何来写
- CoreData封装工具类
- 图解SSIS批量导入Excel文件