blob: 424e422916339b0cfbe106218d5bbaac45b2e5f3 [file] [log] [blame]
The Android Open Source Project146de362009-03-03 19:32:18 -08001/*
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
17package com.android.calendar;
18
19import android.app.Application;
20import android.preference.PreferenceManager;
21import android.util.Log;
22
23public 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 */
Michael Chan98ab9de2009-05-14 16:09:13 -070035 static class Screen {
The Android Open Source Project146de362009-03-03 19:32:18 -080036 public int id;
37 public Screen next;
38 public Screen previous;
39
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
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.
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
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 PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
82 }
83
84}