The Android Open Source Project | 146de36 | 2009-03-03 19:32:18 -0800 | [diff] [blame] | 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.preference.PreferenceManager; |
| 21 | import android.util.Log; |
| 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 | */ |
Michael Chan | 98ab9de | 2009-05-14 16:09:13 -0700 | [diff] [blame] | 35 | static class Screen { |
The Android Open Source Project | 146de36 | 2009-03-03 19:32:18 -0800 | [diff] [blame] | 36 | 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 | } |