1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.deskclock.data; 18 19 /** 20 * Data that must be coordinated across all notifications is accessed via this model. 21 */ 22 final class NotificationModel { 23 24 private boolean mApplicationInForeground; 25 26 /** 27 * @param inForeground {@code true} to indicate the application is open in the foreground 28 */ setApplicationInForeground(boolean inForeground)29 void setApplicationInForeground(boolean inForeground) { 30 mApplicationInForeground = inForeground; 31 } 32 33 /** 34 * @return {@code true} while the application is open in the foreground 35 */ isApplicationInForeground()36 boolean isApplicationInForeground() { 37 return mApplicationInForeground; 38 } 39 40 // 41 // Notification IDs 42 // 43 // Used elsewhere: 44 // Integer.MAX_VALUE - 4 45 // Integer.MAX_VALUE - 5 46 // Integer.MAX_VALUE - 7 47 // 48 49 /** 50 * @return a value that identifies the stopwatch notification 51 */ getStopwatchNotificationId()52 int getStopwatchNotificationId() { 53 return Integer.MAX_VALUE - 1; 54 } 55 56 /** 57 * @return a value that identifies the notification for running/paused timers 58 */ getUnexpiredTimerNotificationId()59 int getUnexpiredTimerNotificationId() { 60 return Integer.MAX_VALUE - 2; 61 } 62 63 /** 64 * @return a value that identifies the notification for expired timers 65 */ getExpiredTimerNotificationId()66 int getExpiredTimerNotificationId() { 67 return Integer.MAX_VALUE - 3; 68 } 69 70 /** 71 * @return a value that identifies the notification for missed timers 72 */ getMissedTimerNotificationId()73 int getMissedTimerNotificationId() { 74 return Integer.MAX_VALUE - 6; 75 } 76 77 // 78 // Notification Group keys 79 // 80 // Used elsewhere: 81 // "1" 82 // "4" 83 84 /** 85 * @return the group key for the stopwatch notification 86 */ getStopwatchNotificationGroupKey()87 String getStopwatchNotificationGroupKey() { 88 return "3"; 89 } 90 91 /** 92 * @return the group key for the timer notification 93 */ getTimerNotificationGroupKey()94 String getTimerNotificationGroupKey() { 95 return "2"; 96 } 97 98 // 99 // Notification Sort keys 100 // 101 102 /** 103 * @return the sort key for the timer notification 104 */ getTimerNotificationSortKey()105 String getTimerNotificationSortKey() { 106 return "0"; 107 } 108 109 /** 110 * @return the sort key for the missed timer notification 111 */ getTimerNotificationMissedSortKey()112 String getTimerNotificationMissedSortKey() { 113 return "1"; 114 } 115 }