• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 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.calendar;
18 
19 import android.app.Application;
20 import android.content.Context;
21 import android.preference.PreferenceManager;
22 
23 public class CalendarApplication extends Application {
24 
25     // TODO: get rid of this global member.
26     public Event currentEvent = null;
27 
28     /**
29      * The Screen class defines a node in a linked list.  This list contains
30      * the screens that were visited, with the more recently visited screens
31      * coming earlier in the list.  The "next" pointer of the head node
32      * points to the first element in the list (the most recently visited
33      * screen).
34      */
35     static class Screen {
36         public int id;
37         public Screen next;
38         public Screen previous;
39 
Screen(int id)40         public Screen(int id) {
41             this.id = id;
42             next = this;
43             previous = this;
44         }
45 
46         // Adds the given node to the list after this one
insert(Screen node)47         public void insert(Screen node) {
48             node.next = next;
49             node.previous = this;
50             next.previous = node;
51             next = node;
52         }
53 
54         // Removes this node from the list it is in.
unlink()55         public void unlink() {
56             next.previous = previous;
57             previous.next = next;
58         }
59     }
60 
61     public static final int MONTH_VIEW_ID = 0;
62     public static final int WEEK_VIEW_ID = 1;
63     public static final int DAY_VIEW_ID = 2;
64     public static final int AGENDA_VIEW_ID = 3;
65 
66     public static final String[] ACTIVITY_NAMES = new String[] {
67         MonthActivity.class.getName(),
68         WeekActivity.class.getName(),
69         DayActivity.class.getName(),
70         AgendaActivity.class.getName(),
71     };
72 
73     @Override
onCreate()74     public void onCreate() {
75         super.onCreate();
76 
77         /*
78          * Ensure the default values are set for any receiver, activity,
79          * service, etc. of Calendar
80          */
81         CalendarPreferenceActivity.setDefaultValues(this);
82     }
83 
84 }
85