zoukankan      html  css  js  c++  java
  • 结对项目:一寸时光APP(日程管理)三

    日程倒计时界面:主界面主要实现的是倒计时的功能,输入倒计时的时间后点击确定按钮,下方的方块即会显示倒计时时间,时间到后手机会震动及振铃。点击方块后取消提醒。

    图片:

    int hour = 0, minute = 0, second = 0;
    if (!TextUtils.isEmpty(etHour.getText().toString())) {
    hour = Integer.valueOf(etHour.getText().toString());
    }
    if (!TextUtils.isEmpty(etMinute.getText().toString())) {
    minute = Integer.valueOf(etMinute.getText().toString());
    }
    if (!TextUtils.isEmpty(etSecond.getText().toString())) {
    second = Integer.valueOf(etSecond.getText().toString());
    }
    int sum = hour * 1000 * 3600 + minute * 1000 * 60 + second * 1000;
    if (sum == 0) {
    Toast.makeText(getActivity(), "请输入倒计时时间!", Toast.LENGTH_SHORT).show();
    } else {
    mc = new MyCount(sum, 1000);
    mc.start();
    }
    etMinute.setText("");
    etHour.setText("");
    etSecond.setText("");

    通知栏提醒界面:主界面主要实现的是在日程提醒的状态下通知栏展示提醒的日程,点击该通知栏后可进入日程查看界面。

    图片:

    Notification.Builder builder = new Notification.Builder(this);
    notificationManager = (NotificationManager) this
    .getSystemService(NOTIFICATION_SERVICE);
    Intent clickIntent = new Intent(NotificationService.this, MyReceiver.class);
    clickIntent.putExtra("id", id);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(NotificationService.this, 1, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
    builder.setTicker("您有设定日程已到时间").setDefaults(Notification.DEFAULT_VIBRATE).setContentIntent(pendingIntent).setSmallIcon(R.mipmap.android).setContentTitle("日程提示")
    .setContentText("点击查看日程: " + title);
    Notification notification = builder.build();
    notificationManager.notify(1, notification);

  • 相关阅读:
    战略威慑 51nod提高组试题
    赛艇表演 51nod提高组模拟试题
    Emiya家今天的饭 NOIP2019 (CSP?) 类DP好题 luoguP5664
    华容道题解 NOIP2013 思路题!
    (板子) 最小生成树 买礼物 luogu P1194
    (板子)并查集(递归+循环)
    校园网络 luogu P2812 (又是强联通)
    货车运输 noip2013 luogu P1967 (最大生成树+倍增LCA)
    Codeforces Round #684 (Div. 2)
    Codeforces Round #683 (Div. 2, by Meet IT)
  • 原文地址:https://www.cnblogs.com/feibingyu/p/7018702.html
Copyright © 2011-2022 走看看