2 * Copyright (C) 2011 Morphoss Ltd
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package com
.morphoss
.acal
;
21 import java
.util
.regex
.Pattern
;
23 import com
.morphoss
.acal
.xml
.DavParserFactory
;
24 import com
.morphoss
.acal
.xml
.DavParserFactory
.PARSEMETHOD
;
26 import android
.os
.Environment
;
27 import android
.util
.Log
;
30 * Constants class for keeping Global constant values.
32 * @author Morphoss Ltd
35 public class Constants
{
37 public static final String PUBLIC_DATA_DIR
= Environment
.getExternalStorageDirectory()+"/acal/";
38 public static final String COPY_DB_TARGET
= PUBLIC_DATA_DIR
+"acal.db"; //File path and name of copy
39 public static final long MAXIMUM_SERVICE_WORKER_DELAY_MS
= 1000*60*60*24; //maximum time between worker thread runs in ms
40 public static final long SERVICE_WORKER_GRACE_PERIOD
= 1000*60*60*1; //Amount of time we will allow worker to be 'late' before assuming its hung
42 /** Generally useful patterns */
43 public static final Pattern lineSplitter
= Pattern
.compile("\r?\n");
44 public static final Pattern rfc5545UnWrapper
= Pattern
.compile("\r?\n ");
45 public static final Pattern tzOlsonExtractor
= Pattern
.compile(".*((?:Antarctica|America|Africa|Atlantic|Asia|Australia|Indian|Europe|Pacific|US)/(?:(?:[^/\"]+)/)?[^/\"]+)\"?");
46 public final static Pattern splitOnCommas
= Pattern
.compile(",");
47 public static final Pattern matchSegmentName
= Pattern
.compile("([^/]+)$");
49 /** Set this to false and all debug logging is turned off */
50 public static final boolean DEBUG_MODE
= false;
52 /** How much stuff to spit out into the logs */
53 public static final boolean LOG_VERBOSE
= false && DEBUG_MODE
; //Very verbose play by play execution information
54 public static final boolean LOG_DEBUG
= false && DEBUG_MODE
; //Information relevant to debugging tasks.
55 public static final boolean DEBUG_SETTINGS
= false && DEBUG_MODE
; // Does the debugging menu appear in Settings
57 /** Since Andrew's device won't display logs at DEBUG level he needs a way to fake that! */
58 public static final int LOGV
= Log
.VERBOSE
; // Normally should be Log.VERBOSE of course.
59 public static final int LOGD
= Log
.DEBUG
; // Normally should be Log.DEBUG of course.
60 public static final int LOGI
= Log
.INFO
; // Normally should be Log.INFO of course.
61 public static final int LOGW
= Log
.WARN
; // Normally should be Log.WARN of course.
62 public static final int LOGE
= Log
.ERROR
; // Normally should be Log.ERROR of course.
64 /** And sometimes we want to really deeply debug specific bits */
65 public static final boolean debugRepeatRule
= false && DEBUG_MODE
;
66 public static final boolean debugCalendar
= false && DEBUG_MODE
;
67 public static final boolean debugSyncCollectionContents
= false && DEBUG_MODE
;
68 public static final boolean debugCalendarDataService
= false && DEBUG_MODE
;
69 public static final boolean debugMonthView
= false && DEBUG_MODE
;
70 public static final boolean debugWeekView
= false && DEBUG_MODE
;
71 public static final boolean debugVComponent
= false && DEBUG_MODE
;
72 public static final boolean debugDateTime
= false && DEBUG_MODE
;
73 public static final boolean debugDavCommunication
= false && DEBUG_MODE
;
74 public static final boolean debugAlarms
= false && DEBUG_MODE
;
75 public static final boolean debugHeap
= false && DEBUG_MODE
;
76 public static final boolean debugCheckServerDialog
= false && DEBUG_MODE
;
78 public static final long DEFAULT_MAX_AGE_WIFI
= 1000*60*30; // The default to use when initialising a new collection
79 public static final long DEFAULT_MAX_AGE_3G
= 1000*60*60*2; // The default to use when initialising a new collection
81 public static final String NS_DAV
= "DAV:";
82 public static final String NS_CALDAV
= "urn:ietf:params:xml:ns:caldav";
83 public static final String NS_CARDDAV
= "urn:ietf:params:xml:ns:carddav";
84 public static final String NS_ACAL
= "urn:com:morphoss:acal";
85 public static final String NS_CALENDARSERVER
= "http://calendarserver.org/ns/";
86 public static final String NS_ACALCONFIG
= "urn:com:morphoss:acalconfig";
87 public static final String NS_ICAL
= "http://apple.com/ns/ical/";
89 public static final String CRLF
= "\r\n";
91 public static final String URLEncoding
= "utf-8";
93 public static final String lastRevisionPreference
= "prefLastRevision";
94 public static final PARSEMETHOD XMLParseMethod
= DavParserFactory
.PARSEMETHOD
.SAX
;