• java课程之团队开发冲刺阶段2.5


      总结昨天进度:

      1.昨天对课前提醒的基本框架已经搭好,剩下的就是对如何提醒进行设置

      遇到的困难:

      1.在一些细节地方,代码有点犯浑,将Preferences的文件写错了,导致在用switch开关得到时候一直启动有错误。

      今天的任务:

      1,完成课前提醒功能

      当日总结:

    1.最后的决定是用activity来实现闹钟的功能,即在到达时间的时候,启动一个新的activity,并添加弹窗提示,添加背景音乐,点击确认之后关闭音乐,关闭震动,关闭activity,但是还没有全部完成

    public class SetRemindService extends Service {
    
        @Override
        public IBinder onBind(Intent intent) {
            return null;
        }
    
        @Override
        public void onCreate() {
            super.onCreate();
        }
        public int onStartCommand(Intent intent, int flags, int startId) {
            final int sum=Preferences.getInt("TodayLessonSum",0);
            if(sum>0)
            {
                Log.d("课前提醒","..");
                new Timer().schedule(new TimerTask() {
                    @Override
                    public void run() {
                    int nowTime=TimeUtils.getSetQuietTime();
                    Log.d("当前时间数值",nowTime+"");
                    for(int i=1;i<=sum;i++)
                    {
                        int setRemindTime=changeRemindTimeSummer(Preferences.getInt(i+"-1",1));
                        if(nowTime==setRemindTime)
                        {
                            Intent alarm=new Intent(getApplicationContext(),AlarmActivity.class);
                            alarm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
                            startActivity(alarm);
                        }
                    }
    
    
                    }
                }, 0, 60000);
            }
            return super.onStartCommand(intent, flags, startId);
        }
        public int changeRemindTimeSummer(int time)
        {
            switch (time)
            {
                case 1:
                    return 750;
                case 2:
                    return 840;
                case 3:
                    return 940;
                case 4:
                    return 1030;
                case 5:
                    return 1120;
                case 6:
                    return 1420;
                case 7:
                    return 1510;
                case 8:
                    return 1610;
                case 9:
                    return 1700;
                case 10:
                    return 1850;
                case 11:
                    return 1940;
                case 12:
                    return 2030;
            }
            return 0;
        }
    }
  • 相关阅读:
    计算机网络 学习笔记-传输层:TCP协议简介
    C/C++里的const(2)
    C语言变量声明加冒号的用法
    CTL_CODE说明
    FreeImage.lib库的配置和简单使用 转
    WSASocket()与Socket()的区别 转
    Win7下运行VC程序UAC权限问题 VC2010设置UAC权限方法
    MFC通过URL下载并保存文件代码 转载
    opencv 数据类型转换:CvArr, Mat, CvMat, IplImage, BYTE 转
    ISIS Scanner Errors codes
  • 原文地址:https://www.cnblogs.com/heiyang/p/11006130.html
Copyright © 2020-2023  润新知