예제 #1
0
  public static long GetMillisecondsOfDay(int hour, int minute, int second) {
    Calendar calendar = Calendar.getInstance();

    while (minute > 60) {
      minute -= 60;
      hour++;
    }

    hour = hour % 24;

    calendar.set(Calendar.HOUR_OF_DAY, hour);
    calendar.set(Calendar.MINUTE, minute);
    calendar.set(Calendar.SECOND, second);
    calendar.set(Calendar.MILLISECOND, 0);

    return calendar.getTimeInMillis() - Util.GetMillisecondsOfDay();
  }
예제 #2
0
  public static void CleanupApplication(Activity context) {
    context.stopService(new Intent(context, SpeechRecognition.class));

    Util.RemoveDeviceNotificationEntry(context);

    try {
      BluetoothConnection bluetoothConnection = BluetoothConnection.CreateInstance(context);

      bluetoothConnection.cleanup();
    } catch (Exception e) {
      Log.e("ContextMenu.java", "Unable to cleanup the Bluetooth connection", e);
    }

    try {
      EventScheduler eventScheduler = EventScheduler.CreateInstance(context, null);

      eventScheduler.cleanup();
    } catch (Exception e) {
      Log.e("ContextMenu.java", "Unable to cleanup the EventScheduler", e);
    }
  }
예제 #3
0
  public static String GetPrintableTimeOfDay(long timeOfDay) {
    Date date = new Date(Util.GetMillisecondsOfDay() + timeOfDay);

    return GetTimeOfDatePrintableFormat(date);
  }