diff --git a/CalendarCloner FREE/.classpath b/CalendarCloner FREE/.classpath
deleted file mode 100644
index 5176974..0000000
--- a/CalendarCloner FREE/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/.project b/CalendarCloner FREE/.project
deleted file mode 100644
index 7a80ef8..0000000
--- a/CalendarCloner FREE/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- CalendarCloner FREE
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/CalendarCloner FREE/.settings/org.eclipse.jdt.core.prefs b/CalendarCloner FREE/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2d..0000000
--- a/CalendarCloner FREE/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/CalendarCloner FREE/AndroidManifest.xml b/CalendarCloner FREE/AndroidManifest.xml
deleted file mode 100644
index 23964f1..0000000
--- a/CalendarCloner FREE/AndroidManifest.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/bin/AndroidManifest.xml b/CalendarCloner FREE/bin/AndroidManifest.xml
deleted file mode 100644
index 01eed30..0000000
--- a/CalendarCloner FREE/bin/AndroidManifest.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/bin/classes.dex b/CalendarCloner FREE/bin/classes.dex
deleted file mode 100644
index 47db1a0..0000000
Binary files a/CalendarCloner FREE/bin/classes.dex and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/android-support-v4-6a6bfa4341d7e672478c952dde80b49a.jar b/CalendarCloner FREE/bin/dexedLibs/android-support-v4-6a6bfa4341d7e672478c952dde80b49a.jar
deleted file mode 100644
index 6fadea2..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/android-support-v4-6a6bfa4341d7e672478c952dde80b49a.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/android-support-v4-fa776ecd9a50bc8394d10a5e75b68f65.jar b/CalendarCloner FREE/bin/dexedLibs/android-support-v4-fa776ecd9a50bc8394d10a5e75b68f65.jar
deleted file mode 100644
index 21087ef..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/android-support-v4-fa776ecd9a50bc8394d10a5e75b68f65.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/annotations-c5b94f64b90f3a49148c0528c5c72d35.jar b/CalendarCloner FREE/bin/dexedLibs/annotations-c5b94f64b90f3a49148c0528c5c72d35.jar
deleted file mode 100644
index 37af4b1..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/annotations-c5b94f64b90f3a49148c0528c5c72d35.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-6f3990c93d397380fb6bbed9aecfbf58.jar b/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-6f3990c93d397380fb6bbed9aecfbf58.jar
deleted file mode 100644
index df306b7..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-6f3990c93d397380fb6bbed9aecfbf58.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-a425f9769934006179bf0351945eb6e3.jar b/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-a425f9769934006179bf0351945eb6e3.jar
deleted file mode 100644
index b14569c..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/commons-lang-2.6-a425f9769934006179bf0351945eb6e3.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/dexedLibs/joda-time-2.4-9383225b9929d092b04c316914a21e7d.jar b/CalendarCloner FREE/bin/dexedLibs/joda-time-2.4-9383225b9929d092b04c316914a21e7d.jar
deleted file mode 100644
index 4e7e027..0000000
Binary files a/CalendarCloner FREE/bin/dexedLibs/joda-time-2.4-9383225b9929d092b04c316914a21e7d.jar and /dev/null differ
diff --git a/CalendarCloner FREE/bin/jarlist.cache b/CalendarCloner FREE/bin/jarlist.cache
deleted file mode 100644
index 0565465..0000000
--- a/CalendarCloner FREE/bin/jarlist.cache
+++ /dev/null
@@ -1,3 +0,0 @@
-# cache for current jar dependency. DO NOT EDIT.
-# format is
-# Encoding is UTF-8
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-hdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/crunch/drawable-hdpi/ic_calendarcloner.png
deleted file mode 100644
index 4f3c713..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-hdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-ldpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/crunch/drawable-ldpi/ic_calendarcloner.png
deleted file mode 100644
index 1b8d563..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-ldpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-mdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/crunch/drawable-mdpi/ic_calendarcloner.png
deleted file mode 100644
index d91c243..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-mdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/edittext_clear.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/edittext_clear.png
deleted file mode 100644
index ad7aaf7..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/edittext_clear.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_exception.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_exception.png
deleted file mode 100644
index 52c17ca..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_exception.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_recurring.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_recurring.png
deleted file mode 100644
index a8af865..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_recurring.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_single.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_single.png
deleted file mode 100644
index 76c4560..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/event_single.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/handle.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/handle.png
deleted file mode 100644
index 75ebe4f..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/handle.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/ic_calendarcloner.png
deleted file mode 100644
index 4f3c713..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/refresh.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/refresh.png
deleted file mode 100644
index bc66777..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/refresh.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_fail.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_fail.png
deleted file mode 100644
index 3afa903..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_fail.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_needmoretime.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_needmoretime.png
deleted file mode 100644
index ec824f7..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_needmoretime.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_none.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_none.png
deleted file mode 100644
index df7ad42..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_none.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_success.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_success.png
deleted file mode 100644
index 4b49346..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/status_success.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/trashcan.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/trashcan.png
deleted file mode 100644
index 18c857f..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/trashcan.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_contracted_16.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_contracted_16.png
deleted file mode 100644
index e293202..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_contracted_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_expanded_16.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_expanded_16.png
deleted file mode 100644
index dec2134..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_expanded_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_none_16.png b/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_none_16.png
deleted file mode 100644
index f93b2e2..0000000
Binary files a/CalendarCloner FREE/bin/res/crunch/drawable-xhdpi/tree_none_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-hdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/drawable-hdpi/ic_calendarcloner.png
deleted file mode 100644
index 4f3c713..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-hdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-ldpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/drawable-ldpi/ic_calendarcloner.png
deleted file mode 100644
index 1b8d563..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-ldpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-mdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/drawable-mdpi/ic_calendarcloner.png
deleted file mode 100644
index d91c243..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-mdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/edittext_clear.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/edittext_clear.png
deleted file mode 100644
index ad7aaf7..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/edittext_clear.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_exception.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/event_exception.png
deleted file mode 100644
index 52c17ca..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_exception.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_recurring.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/event_recurring.png
deleted file mode 100644
index a8af865..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_recurring.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_single.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/event_single.png
deleted file mode 100644
index 76c4560..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/event_single.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/handle.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/handle.png
deleted file mode 100644
index 75ebe4f..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/handle.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/ic_calendarcloner.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/ic_calendarcloner.png
deleted file mode 100644
index 4f3c713..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/refresh.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/refresh.png
deleted file mode 100644
index bc66777..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/refresh.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_fail.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/status_fail.png
deleted file mode 100644
index 3afa903..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_fail.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_needmoretime.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/status_needmoretime.png
deleted file mode 100644
index ec824f7..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_needmoretime.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_none.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/status_none.png
deleted file mode 100644
index df7ad42..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_none.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_success.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/status_success.png
deleted file mode 100644
index 4b49346..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/status_success.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/trashcan.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/trashcan.png
deleted file mode 100644
index 18c857f..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/trashcan.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_contracted_16.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_contracted_16.png
deleted file mode 100644
index e293202..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_contracted_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_expanded_16.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_expanded_16.png
deleted file mode 100644
index dec2134..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_expanded_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_none_16.png b/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_none_16.png
deleted file mode 100644
index f93b2e2..0000000
Binary files a/CalendarCloner FREE/bin/res/drawable-xhdpi/tree_none_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/bin/resources.ap_ b/CalendarCloner FREE/bin/resources.ap_
deleted file mode 100644
index f914e3b..0000000
Binary files a/CalendarCloner FREE/bin/resources.ap_ and /dev/null differ
diff --git a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/BuildConfig.java b/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/BuildConfig.java
deleted file mode 100644
index ebe1e63..0000000
--- a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/BuildConfig.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/*___Generated_by_IDEA___*/
-
-package com.dizzl.android.CalendarClonerFree;
-
-/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
-public final class BuildConfig {
- public final static boolean DEBUG = Boolean.parseBoolean(null);
-}
\ No newline at end of file
diff --git a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/Manifest.java b/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/Manifest.java
deleted file mode 100644
index a75225e..0000000
--- a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/Manifest.java
+++ /dev/null
@@ -1,7 +0,0 @@
-/*___Generated_by_IDEA___*/
-
-package com.dizzl.android.CalendarClonerFree;
-
-/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
-public final class Manifest {
-}
\ No newline at end of file
diff --git a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/R.java b/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/R.java
deleted file mode 100644
index 5edac7c..0000000
--- a/CalendarCloner FREE/gen/com/dizzl/android/CalendarClonerFree/R.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.dizzl.android.CalendarClonerFree;
-
-public final class R {
- public static final class anim {
- public static final int animation_enter_left=0x7f040000;
- public static final int animation_enter_right=0x7f040001;
- public static final int animation_leave_left=0x7f040002;
- public static final int animation_leave_right=0x7f040003;
- }
- public static final class attr {
- }
- public static final class dimen {
- public static final int expanded_height=0x7f060001;
- public static final int normal_height=0x7f060000;
- }
- public static final class drawable {
- public static final int edittext_clear=0x7f020000;
- public static final int event_exception=0x7f020001;
- public static final int event_recurring=0x7f020002;
- public static final int event_single=0x7f020003;
- public static final int grablines=0x7f020004;
- public static final int handle=0x7f020005;
- public static final int ic_calendarcloner=0x7f020006;
- public static final int refresh=0x7f020007;
- public static final int status_fail=0x7f020008;
- public static final int status_needmoretime=0x7f020009;
- public static final int status_none=0x7f02000a;
- public static final int status_success=0x7f02000b;
- public static final int trashcan=0x7f02000c;
- public static final int tree_contracted_16=0x7f02000d;
- public static final int tree_expanded_16=0x7f02000e;
- public static final int tree_none_16=0x7f02000f;
- }
- public static final class id {
- public static final int aboutAppAuthor=0x7f0a0003;
- public static final int aboutAppTitle=0x7f0a0001;
- public static final int aboutAppVersion=0x7f0a0002;
- public static final int aboutTextView=0x7f0a0005;
- public static final int browse_calendar=0x7f0a0007;
- public static final int browse_clone_source=0x7f0a000e;
- public static final int browse_event_type=0x7f0a000c;
- public static final int browse_filter=0x7f0a0009;
- public static final int cc_logo=0x7f0a0000;
- public static final int clearSearchKey=0x7f0a000b;
- public static final int column0=0x7f0a0027;
- public static final int column1=0x7f0a0028;
- public static final int column2=0x7f0a0029;
- public static final int duplicates_calendar=0x7f0a0012;
- public static final int elvLog=0x7f0a0024;
- public static final int eventException=0x7f0a0017;
- public static final int eventList=0x7f0a0011;
- public static final int eventRecurring=0x7f0a0016;
- public static final int eventSingle=0x7f0a0018;
- public static final int eventrow=0x7f0a0013;
- public static final int eventtext=0x7f0a001a;
- public static final int filler=0x7f0a002b;
- public static final int help_view=0x7f0a001f;
- public static final int keyvalue_list=0x7f0a001e;
- public static final int logIcon=0x7f0a0025;
- public static final int logLevelLine=0x7f0a0021;
- public static final int logLevelTextView=0x7f0a0022;
- public static final int logLevelView=0x7f0a0023;
- public static final int logPrefix2=0x7f0a0026;
- public static final int menu_rules=0x7f0a0031;
- public static final int progressIcon=0x7f0a002c;
- public static final int purchaseButton=0x7f0a0004;
- public static final int ruleIcon=0x7f0a002d;
- public static final int rulerow=0x7f0a002a;
- public static final int searchCalendar=0x7f0a0008;
- public static final int searchCloneSourceCalendar=0x7f0a000f;
- public static final int searchCount=0x7f0a0010;
- public static final int searchEventType=0x7f0a000d;
- public static final int searchKey=0x7f0a000a;
- public static final int search_filters=0x7f0a0006;
- public static final int subline1=0x7f0a001b;
- public static final int subline2=0x7f0a001d;
- public static final int subtitle=0x7f0a002e;
- public static final int table=0x7f0a0015;
- public static final int title=0x7f0a001c;
- public static final int topline=0x7f0a0014;
- public static final int trashcan=0x7f0a0019;
- public static final int tvLogName=0x7f0a0020;
- public static final int tvText=0x7f0a0030;
- public static final int tvTitle=0x7f0a002f;
- }
- public static final class layout {
- public static final int aboutactivity_layout=0x7f030000;
- public static final int actionbar_indeterminate_progress=0x7f030001;
- public static final int browseactivity_layout=0x7f030002;
- public static final int duplicatesactivity_layout=0x7f030003;
- public static final int duplicatesrow_layout=0x7f030004;
- public static final int eventrow_layout=0x7f030005;
- public static final int eventviewactivity_layout=0x7f030006;
- public static final int helpactivity_layout=0x7f030007;
- public static final int logactivity_layout=0x7f030008;
- public static final int logline_layout=0x7f030009;
- public static final int rulesactivity_layout=0x7f03000a;
- public static final int rulesrow_layout=0x7f03000b;
- public static final int textviewactivity_layout=0x7f03000c;
- }
- public static final class menu {
- public static final int activity_rulelistprefs=0x7f090000;
- }
- public static final class string {
- public static final int about_activity_title=0x7f0700e8;
- public static final int about_by=0x7f0700e9;
- public static final int about_debug_mode=0x7f0700ed;
- public static final int about_description_end=0x7f0700ec;
- public static final int about_description_free=0x7f0700eb;
- public static final int about_description_text=0x7f0700ea;
- public static final int about_purchase1=0x7f0700ee;
- public static final int about_purchase2=0x7f0700ef;
- public static final int about_version=0x7f0700f0;
- public static final int access_level_confidential=0x7f070179;
- public static final int access_level_default=0x7f070177;
- public static final int access_level_private=0x7f070178;
- public static final int access_level_public=0x7f07017a;
- public static final int app_author=0x7f070003;
- public static final int app_language=0x7f070000;
- public static final int app_name=0x7f070001;
- public static final int app_version_x=0x7f070002;
- public static final int ask_delete_all_clones=0x7f070172;
- public static final int ask_delete_n_events=0x7f070173;
- public static final int ask_delete_related_clones=0x7f070174;
- public static final int ask_delete_rule=0x7f070175;
- public static final int ask_load_settings_from_file=0x7f070176;
- public static final int attendee_relationship_attendee=0x7f07017b;
- public static final int attendee_relationship_none=0x7f07017c;
- public static final int attendee_relationship_organizer=0x7f07017d;
- public static final int attendee_relationship_performer=0x7f07017e;
- public static final int attendee_relationship_speaker=0x7f07017f;
- public static final int attendee_status_accepted=0x7f070183;
- public static final int attendee_status_declined=0x7f070184;
- public static final int attendee_status_invited=0x7f070181;
- public static final int attendee_status_none=0x7f070180;
- public static final int attendee_status_tentative=0x7f070182;
- public static final int attendee_type_none=0x7f070185;
- public static final int attendee_type_optional=0x7f070186;
- public static final int attendee_type_required=0x7f070187;
- public static final int availability_busy=0x7f07018a;
- public static final int availability_free=0x7f070188;
- public static final int availability_out_of_office=0x7f07018b;
- public static final int availability_tentative=0x7f070189;
- public static final int browse_activity_title=0x7f0700c8;
- public static final int browse_all_calendars=0x7f0700c9;
- public static final int browse_all_rules=0x7f0700ca;
- public static final int browse_delete_event=0x7f0700cb;
- public static final int browse_event_details=0x7f0700cc;
- public static final int browse_event_is_being_deleted=0x7f0700cd;
- public static final int browse_menu_delete_all_events=0x7f0700ce;
- public static final int browse_menu_delete_all_events_title=0x7f0700cf;
- public static final int browse_textview_calendar=0x7f0700d0;
- public static final int browse_textview_clone_source=0x7f0700d3;
- public static final int browse_textview_event_count=0x7f0700d4;
- public static final int browse_textview_event_type=0x7f0700d2;
- public static final int browse_textview_filter=0x7f0700d1;
- public static final int browse_type_all_events=0x7f0700d5;
- public static final int browse_type_clones_and_partial_moves=0x7f0700d9;
- public static final int browse_type_clones_only=0x7f0700d7;
- public static final int browse_type_originals=0x7f0700d6;
- public static final int browse_type_partial_moves_only=0x7f0700d8;
- public static final int calendar_destination=0x7f0700f1;
- public static final int calendar_generic=0x7f0700f2;
- public static final int calendar_source=0x7f0700f3;
- public static final int cancel=0x7f070008;
- public static final int clonedevent_andmore=0x7f0700f4;
- public static final int cloner_log_attendee_added=0x7f0700f5;
- public static final int cloner_log_attendee_added_dummy=0x7f0700f6;
- public static final int cloner_log_attendee_added_extra=0x7f0700f7;
- public static final int cloner_log_attendee_added_self=0x7f0700f8;
- public static final int cloner_log_attendee_limit_reached=0x7f0700f9;
- public static final int cloner_log_attendee_removed=0x7f0700fa;
- public static final int cloner_log_attendee_status_updated=0x7f0700fb;
- public static final int cloner_log_attendee_status_updated_automatically=0x7f0700fc;
- public static final int cloner_log_attendee_updated=0x7f0700fd;
- public static final int cloner_log_attendees_unchanged=0x7f0700fe;
- public static final int cloner_log_attendees_updated=0x7f0700ff;
- public static final int cloner_log_cloned_event=0x7f070100;
- public static final int cloner_log_could_not_acquire_lock=0x7f070101;
- public static final int cloner_log_deleted=0x7f070102;
- public static final int cloner_log_delta=0x7f070103;
- public static final int cloner_log_done=0x7f070104;
- public static final int cloner_log_event_limit_reached=0x7f070105;
- public static final int cloner_log_executing_readonly_rule=0x7f070106;
- public static final int cloner_log_filter_x=0x7f070107;
- public static final int cloner_log_ignored=0x7f070108;
- public static final int cloner_log_inserted=0x7f070109;
- public static final int cloner_log_insync=0x7f07010a;
- public static final int cloner_log_limit_reached=0x7f07010b;
- public static final int cloner_log_marked_deleted=0x7f07010c;
- public static final int cloner_log_moved=0x7f07010d;
- public static final int cloner_log_moved_partially=0x7f07010e;
- public static final int cloner_log_old_clone_deleted=0x7f07010f;
- public static final int cloner_log_original_attendee_added=0x7f070110;
- public static final int cloner_log_processed=0x7f070111;
- public static final int cloner_log_reminder_deleted=0x7f070112;
- public static final int cloner_log_reminders_updated=0x7f070113;
- public static final int cloner_log_skipped=0x7f070114;
- public static final int cloner_log_updated=0x7f070115;
- public static final int cloner_log_valid_clone=0x7f070116;
- public static final int cloner_process_checking_for_deleted_events=0x7f07011e;
- public static final int cloner_process_cloning_recurring_event_exception=0x7f07011f;
- public static final int cloner_process_exiting_after_x_events=0x7f070120;
- public static final int cloner_process_generating_aggregate_events=0x7f070121;
- public static final int cloner_process_initializing=0x7f070122;
- public static final int cloner_process_updated_x_events=0x7f070123;
- public static final int cloner_state_finished_after_x_events=0x7f07011a;
- public static final int cloner_state_interrupted=0x7f070117;
- public static final int cloner_state_moved=0x7f07011d;
- public static final int cloner_state_partially_cloned=0x7f070118;
- public static final int cloner_state_partially_cloned_info=0x7f070119;
- public static final int cloner_state_syncing=0x7f07011b;
- public static final int cloner_state_unchanged=0x7f07011c;
- public static final int dateformat=0x7f070004;
- public static final int db_deleted=0x7f070140;
- public static final int db_inserted=0x7f070141;
- public static final int db_updated=0x7f070142;
- public static final int dummy=0x7f070124;
- public static final int duplicates_activity_title=0x7f0700da;
- public static final int duplicates_all_calendars=0x7f0700db;
- public static final int duplicates_delete_event=0x7f0700dc;
- public static final int duplicates_loading=0x7f0700dd;
- public static final int duplicates_menu_delete_all_duplicate_events=0x7f0700de;
- public static final int duplicates_menu_delete_all_duplicate_events_title=0x7f0700df;
- public static final int duplicates_refresh=0x7f0700e0;
- public static final int duplicates_textview_calendar=0x7f0700e1;
- public static final int duplicates_textview_clone_source=0x7f0700e4;
- public static final int duplicates_textview_event_count=0x7f0700e5;
- public static final int duplicates_textview_event_type=0x7f0700e3;
- public static final int duplicates_textview_filter=0x7f0700e2;
- public static final int duplicates_view_title=0x7f0700e6;
- public static final int error_calendar_x_not_accessible=0x7f070125;
- public static final int error_calendar_x_not_found=0x7f070126;
- public static final int error_calendar_x_not_set=0x7f070127;
- public static final int error_calendar_x_not_synchronized=0x7f070128;
- public static final int error_calendar_x_not_writeable=0x7f070129;
- public static final int error_could_not_load_settings_from_file=0x7f07012a;
- public static final int error_could_not_save_settings_to_file=0x7f07012b;
- public static final int error_deleting_clones=0x7f07012e;
- public static final int error_deleting_events=0x7f07012f;
- public static final int error_duplicate_calendar_name=0x7f07012c;
- public static final int error_duplicate_server_id=0x7f07012d;
- public static final int error_no_unique_id=0x7f070130;
- public static final int error_processing_event=0x7f070131;
- public static final int event_status_canceled=0x7f07018e;
- public static final int event_status_confirmed=0x7f07018d;
- public static final int event_status_tentative=0x7f07018c;
- public static final int help_activity_title=0x7f0700e7;
- public static final int log_cloner_resync_request_source=0x7f070132;
- public static final int log_cursor_not_closed=0x7f070133;
- public static final int log_exception=0x7f070134;
- public static final int log_exception_at=0x7f070135;
- public static final int log_info_see_rulelog=0x7f070136;
- public static final int log_message=0x7f070137;
- public static final int log_processing_task_queue=0x7f070138;
- public static final int log_stacktrace=0x7f070139;
- public static final int log_textview_filter=0x7f07013a;
- public static final int log_timer_set=0x7f07013b;
- public static final int log_type_error=0x7f07013f;
- public static final int log_type_info=0x7f07013c;
- public static final int log_type_update=0x7f07013e;
- public static final int log_type_warning=0x7f07013d;
- public static final int main_about=0x7f070031;
- public static final int main_about_info=0x7f070032;
- public static final int main_activity=0x7f07000c;
- public static final int main_activity_title=0x7f07000b;
- public static final int main_browse_events=0x7f070027;
- public static final int main_browse_events_summary=0x7f070028;
- public static final int main_cloning_interval=0x7f070014;
- public static final int main_configuration=0x7f07000e;
- public static final int main_duplicate_events=0x7f070029;
- public static final int main_duplicate_events_summary=0x7f07002a;
- public static final int main_enabled=0x7f07000d;
- public static final int main_extra=0x7f070024;
- public static final int main_general_settings=0x7f070013;
- public static final int main_help=0x7f07002f;
- public static final int main_help_info=0x7f070030;
- public static final int main_limit_attendee_limit=0x7f070018;
- public static final int main_limit_attendee_limit_summary=0x7f070019;
- public static final int main_limit_event_limit=0x7f070016;
- public static final int main_limit_event_limit_summary=0x7f070017;
- public static final int main_limits=0x7f070015;
- public static final int main_load_settings_from_file=0x7f07002b;
- public static final int main_load_settings_from_file_summary=0x7f07002c;
- public static final int main_log_logcat=0x7f07001b;
- public static final int main_log_logcat_off_summary=0x7f07001c;
- public static final int main_log_logcat_on_summary=0x7f07001d;
- public static final int main_log_memory=0x7f07001e;
- public static final int main_log_memory_off_summary=0x7f07001f;
- public static final int main_log_memory_on_summary=0x7f070020;
- public static final int main_logging=0x7f07001a;
- public static final int main_logtype=0x7f070021;
- public static final int main_logtype_extended=0x7f070023;
- public static final int main_logtype_summary=0x7f070022;
- public static final int main_maintenance=0x7f070025;
- public static final int main_maintenance_summary=0x7f070026;
- public static final int main_resync_disabled=0x7f070033;
- public static final int main_resync_in_x_time=0x7f070034;
- public static final int main_resync_not_running=0x7f070035;
- public static final int main_resync_running=0x7f070036;
- public static final int main_resync_running_soon=0x7f070037;
- public static final int main_rules=0x7f07000f;
- public static final int main_rules_info=0x7f070010;
- public static final int main_save_settings_to_file=0x7f07002d;
- public static final int main_save_settings_to_file_summary=0x7f07002e;
- public static final int main_settings=0x7f070011;
- public static final int main_settings_summary=0x7f070012;
- public static final int msg_all=0x7f070143;
- public static final int msg_app_expired=0x7f070144;
- public static final int msg_cloner_still_enabled=0x7f070145;
- public static final int msg_cloner_still_enabled_info=0x7f070146;
- public static final int msg_clones_deleted=0x7f070147;
- public static final int msg_clones_deleted_info=0x7f070148;
- public static final int msg_delete=0x7f070149;
- public static final int msg_deleting_events=0x7f07014a;
- public static final int msg_dont_delete=0x7f07014b;
- public static final int msg_dont_load_settings=0x7f07014c;
- public static final int msg_events_deleted=0x7f07014d;
- public static final int msg_events_deleted_info=0x7f07014e;
- public static final int msg_found_x_events_in_source_calendar=0x7f07014f;
- public static final int msg_free_version_limitation=0x7f070150;
- public static final int msg_free_version_limitation_info=0x7f070151;
- public static final int msg_infinite=0x7f070152;
- public static final int msg_load_settings=0x7f070153;
- public static final int msg_n_day_back=0x7f070154;
- public static final int msg_n_day_forward=0x7f070156;
- public static final int msg_n_days_back=0x7f070155;
- public static final int msg_n_days_forward=0x7f070157;
- public static final int msg_n_hour=0x7f070158;
- public static final int msg_n_hours=0x7f070159;
- public static final int msg_n_max_updates_per_hour=0x7f07015a;
- public static final int msg_n_minute=0x7f07015b;
- public static final int msg_n_minutes=0x7f07015c;
- public static final int msg_n_month_back=0x7f07015d;
- public static final int msg_n_month_forward=0x7f07015f;
- public static final int msg_n_months_back=0x7f07015e;
- public static final int msg_n_months_forward=0x7f070160;
- public static final int msg_n_week_back=0x7f070161;
- public static final int msg_n_week_forward=0x7f070163;
- public static final int msg_n_weeks_back=0x7f070162;
- public static final int msg_n_weeks_forward=0x7f070164;
- public static final int msg_n_year_back=0x7f070165;
- public static final int msg_n_year_forward=0x7f070167;
- public static final int msg_n_years_back=0x7f070166;
- public static final int msg_n_years_forward=0x7f070168;
- public static final int msg_paid_version_only=0x7f070169;
- public static final int msg_rule_busy=0x7f07016a;
- public static final int msg_rule_disabled=0x7f07016b;
- public static final int msg_rule_still_active=0x7f07016c;
- public static final int msg_rule_still_active_info=0x7f07016d;
- public static final int msg_settings_loaded_from_file=0x7f07016e;
- public static final int msg_settings_saved_to_file=0x7f07016f;
- public static final int msg_unlimited=0x7f070170;
- public static final int msg_you=0x7f070171;
- public static final int no=0x7f070006;
- public static final int off=0x7f07000a;
- public static final int ok=0x7f070007;
- public static final int on=0x7f070009;
- public static final int relationship_attendees=0x7f070192;
- public static final int relationship_organizer=0x7f07018f;
- public static final int relationship_performers=0x7f070191;
- public static final int relationship_speakers=0x7f070190;
- public static final int reminder_method_alert=0x7f070193;
- public static final int reminder_method_default=0x7f070194;
- public static final int reminder_method_email=0x7f070195;
- public static final int reminder_method_sms=0x7f070196;
- public static final int rule_access_level_filter=0x7f07006c;
- public static final int rule_activity_title=0x7f070042;
- public static final int rule_additional_options=0x7f0700b5;
- public static final int rule_additional_options_info=0x7f0700b6;
- public static final int rule_advanced_options=0x7f0700ba;
- public static final int rule_advanced_options_info=0x7f0700bb;
- public static final int rule_attendance_filter=0x7f07006d;
- public static final int rule_attendance_options=0x7f070086;
- public static final int rule_attendee_options=0x7f070090;
- public static final int rule_attendee_options_info=0x7f070091;
- public static final int rule_attendees_as_text=0x7f07009a;
- public static final int rule_attendees_as_text_off_summary=0x7f07009b;
- public static final int rule_attendees_as_text_on_summary=0x7f07009c;
- public static final int rule_availability_filter=0x7f07006e;
- public static final int rule_calendar_with_no_name=0x7f07004a;
- public static final int rule_clone_attendees=0x7f070092;
- public static final int rule_clone_attendees_off_summary=0x7f070093;
- public static final int rule_clone_attendees_on_summary=0x7f070094;
- public static final int rule_clone_description=0x7f07007c;
- public static final int rule_clone_description_off_summary=0x7f07007d;
- public static final int rule_clone_description_on_summary=0x7f07007e;
- public static final int rule_clone_location=0x7f070078;
- public static final int rule_clone_location_off_summary=0x7f070079;
- public static final int rule_clone_location_on_summary=0x7f07007a;
- public static final int rule_clone_reminders=0x7f0700a5;
- public static final int rule_clone_reminders_off_summary=0x7f0700a6;
- public static final int rule_clone_reminders_on_summary=0x7f0700a7;
- public static final int rule_clone_selection_options=0x7f070058;
- public static final int rule_clone_self_attendee_status=0x7f070087;
- public static final int rule_clone_self_attendee_status_off_summary=0x7f070088;
- public static final int rule_clone_self_attendee_status_on_summary=0x7f070089;
- public static final int rule_clone_self_attendee_status_reverse=0x7f07008a;
- public static final int rule_clone_self_attendee_status_reverse_off_summary=0x7f07008b;
- public static final int rule_clone_self_attendee_status_reverse_on_summary=0x7f07008c;
- public static final int rule_clone_title=0x7f070074;
- public static final int rule_clone_title_off_summary=0x7f070075;
- public static final int rule_clone_title_on_summary=0x7f070076;
- public static final int rule_content_options=0x7f070071;
- public static final int rule_content_options_info=0x7f070072;
- public static final int rule_content_selection_options=0x7f07005c;
- public static final int rule_custom_access_level=0x7f070084;
- public static final int rule_custom_access_level_source=0x7f070085;
- public static final int rule_custom_attendee=0x7f07009e;
- public static final int rule_custom_attendee_email=0x7f0700a2;
- public static final int rule_custom_attendee_name=0x7f0700a1;
- public static final int rule_custom_attendee_off_summary=0x7f07009f;
- public static final int rule_custom_attendee_on_summary=0x7f0700a0;
- public static final int rule_custom_attendee_options=0x7f07009d;
- public static final int rule_custom_availability=0x7f070082;
- public static final int rule_custom_availability_source=0x7f070083;
- public static final int rule_custom_description=0x7f07007f;
- public static final int rule_custom_location=0x7f07007b;
- public static final int rule_custom_reminder=0x7f0700a9;
- public static final int rule_custom_reminder_default_minutes=0x7f0700b4;
- public static final int rule_custom_reminder_method=0x7f0700ac;
- public static final int rule_custom_reminder_method_alert=0x7f0700af;
- public static final int rule_custom_reminder_method_default=0x7f0700b0;
- public static final int rule_custom_reminder_method_email=0x7f0700b1;
- public static final int rule_custom_reminder_method_no_calendar=0x7f0700ad;
- public static final int rule_custom_reminder_method_no_methods=0x7f0700ae;
- public static final int rule_custom_reminder_method_sms=0x7f0700b2;
- public static final int rule_custom_reminder_minutes=0x7f0700b3;
- public static final int rule_custom_reminder_off_summary=0x7f0700aa;
- public static final int rule_custom_reminder_on_summary=0x7f0700ab;
- public static final int rule_custom_reminder_options=0x7f0700a8;
- public static final int rule_custom_title=0x7f070077;
- public static final int rule_description_must_contain=0x7f07006a;
- public static final int rule_description_must_not_contain=0x7f07006b;
- public static final int rule_destination_calendar=0x7f070050;
- public static final int rule_dummy_email_domain=0x7f070098;
- public static final int rule_dummy_email_domain_summary=0x7f070099;
- public static final int rule_enabled=0x7f070044;
- public static final int rule_event_selection_options=0x7f070052;
- public static final int rule_event_selection_options_info=0x7f070053;
- public static final int rule_event_status_filter=0x7f07006f;
- public static final int rule_event_text_filters=0x7f070064;
- public static final int rule_event_text_filters_info=0x7f070065;
- public static final int rule_event_type_all=0x7f070061;
- public static final int rule_event_type_filter=0x7f070060;
- public static final int rule_event_type_recurring=0x7f070063;
- public static final int rule_event_type_simple=0x7f070062;
- public static final int rule_field_options=0x7f070073;
- public static final int rule_general_settings=0x7f070043;
- public static final int rule_hash=0x7f0700c0;
- public static final int rule_hash_method=0x7f0700bc;
- public static final int rule_hash_method_manual=0x7f0700bf;
- public static final int rule_hash_method_rule_id=0x7f0700be;
- public static final int rule_hash_method_source_calendar=0x7f0700bd;
- public static final int rule_include_clones=0x7f070059;
- public static final int rule_include_clones_off_summary=0x7f07005a;
- public static final int rule_include_clones_on_summary=0x7f07005b;
- public static final int rule_location_must_contain=0x7f070068;
- public static final int rule_location_must_not_contain=0x7f070069;
- public static final int rule_method=0x7f07004b;
- public static final int rule_method_aggregate=0x7f07004c;
- public static final int rule_method_clone=0x7f07004d;
- public static final int rule_method_move=0x7f07004e;
- public static final int rule_name=0x7f070045;
- public static final int rule_name_info=0x7f070046;
- public static final int rule_no_calendars_found=0x7f070049;
- public static final int rule_no_selection=0x7f070048;
- public static final int rule_not_relevant_for_move_rules=0x7f07008d;
- public static final int rule_options=0x7f070051;
- public static final int rule_period_selection_options=0x7f070054;
- public static final int rule_readonly=0x7f0700c1;
- public static final int rule_readonly_off_summary=0x7f0700c2;
- public static final int rule_readonly_on_summary=0x7f0700c3;
- public static final int rule_reminder_options=0x7f0700a3;
- public static final int rule_reminder_options_info=0x7f0700a4;
- public static final int rule_reserve_after=0x7f070081;
- public static final int rule_reserve_before=0x7f070080;
- public static final int rule_retain_clones_outside_source_event_window=0x7f0700b7;
- public static final int rule_retain_clones_outside_source_event_window_off_summary=0x7f0700b8;
- public static final int rule_retain_clones_outside_source_event_window_on_summary=0x7f0700b9;
- public static final int rule_select_calendar=0x7f070047;
- public static final int rule_self_attendee_name=0x7f07008e;
- public static final int rule_self_attendee_name_info=0x7f07008f;
- public static final int rule_source_calendar=0x7f07004f;
- public static final int rule_sync_period_after=0x7f070056;
- public static final int rule_sync_period_before=0x7f070055;
- public static final int rule_sync_period_limited=0x7f070057;
- public static final int rule_title_must_contain=0x7f070066;
- public static final int rule_title_must_not_contain=0x7f070067;
- public static final int rule_use_dummy_attendee_addresses=0x7f070095;
- public static final int rule_use_dummy_attendee_addresses_off_summary=0x7f070096;
- public static final int rule_use_dummy_attendee_addresses_on_summary=0x7f070097;
- public static final int rule_use_event_filters=0x7f07005d;
- public static final int rule_use_event_filters_off_summary=0x7f07005e;
- public static final int rule_use_event_filters_on_summary=0x7f07005f;
- public static final int rule_weekday_filter=0x7f070070;
- public static final int rulelog_activity_title=0x7f0700c4;
- public static final int rulelog_details=0x7f0700c7;
- public static final int rulelog_rule=0x7f0700c5;
- public static final int rulelog_status=0x7f0700c6;
- public static final int rules_activity_title=0x7f070038;
- public static final int rules_add_new_rule=0x7f070039;
- public static final int rules_add_new_rule_info=0x7f07003a;
- public static final int rules_listrow_rulename=0x7f07003b;
- public static final int rules_menu_add_new_rule=0x7f07003c;
- public static final int rules_menu_clone_now=0x7f07003d;
- public static final int rules_menu_clone_this_rule=0x7f07003e;
- public static final int rules_menu_delete_related_clones=0x7f07003f;
- public static final int rules_menu_delete_rule=0x7f070040;
- public static final int rules_menu_rule_log=0x7f070041;
- public static final int weekday_friday=0x7f07019b;
- public static final int weekday_monday=0x7f070197;
- public static final int weekday_saturday=0x7f07019c;
- public static final int weekday_sunday=0x7f07019d;
- public static final int weekday_thursday=0x7f07019a;
- public static final int weekday_tuesday=0x7f070198;
- public static final int weekday_wednesday=0x7f070199;
- public static final int yes=0x7f070005;
- }
- public static final class style {
- public static final int AppTheme=0x7f080000;
- }
- public static final class xml {
- public static final int main_preferences=0x7f050000;
- public static final int rule_preferences=0x7f050001;
- }
-}
diff --git a/CalendarCloner FREE/libs/android-support-v4.jar b/CalendarCloner FREE/libs/android-support-v4.jar
deleted file mode 100644
index feaf44f..0000000
Binary files a/CalendarCloner FREE/libs/android-support-v4.jar and /dev/null differ
diff --git a/CalendarCloner FREE/libs/commons-lang-2.6.jar b/CalendarCloner FREE/libs/commons-lang-2.6.jar
deleted file mode 100644
index 98467d3..0000000
Binary files a/CalendarCloner FREE/libs/commons-lang-2.6.jar and /dev/null differ
diff --git a/CalendarCloner FREE/libs/joda-time-2.4.jar b/CalendarCloner FREE/libs/joda-time-2.4.jar
deleted file mode 100644
index ace67d7..0000000
Binary files a/CalendarCloner FREE/libs/joda-time-2.4.jar and /dev/null differ
diff --git a/CalendarCloner FREE/proguard-project.txt b/CalendarCloner FREE/proguard-project.txt
deleted file mode 100644
index f2fe155..0000000
--- a/CalendarCloner FREE/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/CalendarCloner FREE/project.properties b/CalendarCloner FREE/project.properties
deleted file mode 100644
index 3409f08..0000000
--- a/CalendarCloner FREE/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-20
diff --git a/CalendarCloner FREE/res/anim/animation_enter_left.xml b/CalendarCloner FREE/res/anim/animation_enter_left.xml
deleted file mode 100644
index 39b0903..0000000
--- a/CalendarCloner FREE/res/anim/animation_enter_left.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/anim/animation_enter_right.xml b/CalendarCloner FREE/res/anim/animation_enter_right.xml
deleted file mode 100644
index 39420aa..0000000
--- a/CalendarCloner FREE/res/anim/animation_enter_right.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/anim/animation_leave_left.xml b/CalendarCloner FREE/res/anim/animation_leave_left.xml
deleted file mode 100644
index 76b93c2..0000000
--- a/CalendarCloner FREE/res/anim/animation_leave_left.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/anim/animation_leave_right.xml b/CalendarCloner FREE/res/anim/animation_leave_right.xml
deleted file mode 100644
index a9a2745..0000000
--- a/CalendarCloner FREE/res/anim/animation_leave_right.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/drawable-hdpi/ic_calendarcloner.png b/CalendarCloner FREE/res/drawable-hdpi/ic_calendarcloner.png
deleted file mode 100644
index 1aecc9e..0000000
Binary files a/CalendarCloner FREE/res/drawable-hdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-ldpi/ic_calendarcloner.png b/CalendarCloner FREE/res/drawable-ldpi/ic_calendarcloner.png
deleted file mode 100644
index 9f4a954..0000000
Binary files a/CalendarCloner FREE/res/drawable-ldpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-mdpi/ic_calendarcloner.png b/CalendarCloner FREE/res/drawable-mdpi/ic_calendarcloner.png
deleted file mode 100644
index 7a87c9b..0000000
Binary files a/CalendarCloner FREE/res/drawable-mdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/edittext_clear.png b/CalendarCloner FREE/res/drawable-xhdpi/edittext_clear.png
deleted file mode 100644
index 3ad14de..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/edittext_clear.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/event_exception.png b/CalendarCloner FREE/res/drawable-xhdpi/event_exception.png
deleted file mode 100644
index e3d8da6..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/event_exception.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/event_recurring.png b/CalendarCloner FREE/res/drawable-xhdpi/event_recurring.png
deleted file mode 100644
index b82f11a..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/event_recurring.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/event_single.png b/CalendarCloner FREE/res/drawable-xhdpi/event_single.png
deleted file mode 100644
index a5e74f6..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/event_single.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/grablines.xml b/CalendarCloner FREE/res/drawable-xhdpi/grablines.xml
deleted file mode 100644
index e3e8b89..0000000
--- a/CalendarCloner FREE/res/drawable-xhdpi/grablines.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/handle.png b/CalendarCloner FREE/res/drawable-xhdpi/handle.png
deleted file mode 100644
index 9911a76..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/handle.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/ic_calendarcloner.png b/CalendarCloner FREE/res/drawable-xhdpi/ic_calendarcloner.png
deleted file mode 100644
index 1aecc9e..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/ic_calendarcloner.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/refresh.png b/CalendarCloner FREE/res/drawable-xhdpi/refresh.png
deleted file mode 100644
index 418b940..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/refresh.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/status_fail.png b/CalendarCloner FREE/res/drawable-xhdpi/status_fail.png
deleted file mode 100644
index 9df648c..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/status_fail.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/status_needmoretime.png b/CalendarCloner FREE/res/drawable-xhdpi/status_needmoretime.png
deleted file mode 100644
index 8ae4fca..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/status_needmoretime.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/status_none.png b/CalendarCloner FREE/res/drawable-xhdpi/status_none.png
deleted file mode 100644
index 424319c..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/status_none.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/status_success.png b/CalendarCloner FREE/res/drawable-xhdpi/status_success.png
deleted file mode 100644
index 8c1d7bd..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/status_success.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/trashcan.png b/CalendarCloner FREE/res/drawable-xhdpi/trashcan.png
deleted file mode 100644
index def532d..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/trashcan.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/tree_contracted_16.png b/CalendarCloner FREE/res/drawable-xhdpi/tree_contracted_16.png
deleted file mode 100644
index 4c36c19..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/tree_contracted_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/tree_expanded_16.png b/CalendarCloner FREE/res/drawable-xhdpi/tree_expanded_16.png
deleted file mode 100644
index 85c0e56..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/tree_expanded_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/drawable-xhdpi/tree_none_16.png b/CalendarCloner FREE/res/drawable-xhdpi/tree_none_16.png
deleted file mode 100644
index 9c8a27b..0000000
Binary files a/CalendarCloner FREE/res/drawable-xhdpi/tree_none_16.png and /dev/null differ
diff --git a/CalendarCloner FREE/res/layout/aboutactivity_layout.xml b/CalendarCloner FREE/res/layout/aboutactivity_layout.xml
deleted file mode 100644
index 2c3a639..0000000
--- a/CalendarCloner FREE/res/layout/aboutactivity_layout.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/actionbar_indeterminate_progress.xml b/CalendarCloner FREE/res/layout/actionbar_indeterminate_progress.xml
deleted file mode 100644
index 8901afd..0000000
--- a/CalendarCloner FREE/res/layout/actionbar_indeterminate_progress.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/browseactivity_layout.xml b/CalendarCloner FREE/res/layout/browseactivity_layout.xml
deleted file mode 100644
index 258299e..0000000
--- a/CalendarCloner FREE/res/layout/browseactivity_layout.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/duplicatesactivity_layout.xml b/CalendarCloner FREE/res/layout/duplicatesactivity_layout.xml
deleted file mode 100644
index 84b3a68..0000000
--- a/CalendarCloner FREE/res/layout/duplicatesactivity_layout.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/duplicatesrow_layout.xml b/CalendarCloner FREE/res/layout/duplicatesrow_layout.xml
deleted file mode 100644
index 068e86f..0000000
--- a/CalendarCloner FREE/res/layout/duplicatesrow_layout.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/eventrow_layout.xml b/CalendarCloner FREE/res/layout/eventrow_layout.xml
deleted file mode 100644
index ab7d658..0000000
--- a/CalendarCloner FREE/res/layout/eventrow_layout.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/eventviewactivity_layout.xml b/CalendarCloner FREE/res/layout/eventviewactivity_layout.xml
deleted file mode 100644
index 6869556..0000000
--- a/CalendarCloner FREE/res/layout/eventviewactivity_layout.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/helpactivity_layout.xml b/CalendarCloner FREE/res/layout/helpactivity_layout.xml
deleted file mode 100644
index 6c0ee63..0000000
--- a/CalendarCloner FREE/res/layout/helpactivity_layout.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/logactivity_layout.xml b/CalendarCloner FREE/res/layout/logactivity_layout.xml
deleted file mode 100644
index b20c30b..0000000
--- a/CalendarCloner FREE/res/layout/logactivity_layout.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/logline_layout.xml b/CalendarCloner FREE/res/layout/logline_layout.xml
deleted file mode 100644
index e24a9ab..0000000
--- a/CalendarCloner FREE/res/layout/logline_layout.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/rulesactivity_layout.xml b/CalendarCloner FREE/res/layout/rulesactivity_layout.xml
deleted file mode 100644
index 3fc7496..0000000
--- a/CalendarCloner FREE/res/layout/rulesactivity_layout.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/rulesrow_layout.xml b/CalendarCloner FREE/res/layout/rulesrow_layout.xml
deleted file mode 100644
index 09a508d..0000000
--- a/CalendarCloner FREE/res/layout/rulesrow_layout.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/layout/textviewactivity_layout.xml b/CalendarCloner FREE/res/layout/textviewactivity_layout.xml
deleted file mode 100644
index 4ec27da..0000000
--- a/CalendarCloner FREE/res/layout/textviewactivity_layout.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/menu/activity_rulelistprefs.xml b/CalendarCloner FREE/res/menu/activity_rulelistprefs.xml
deleted file mode 100644
index b3533ea..0000000
--- a/CalendarCloner FREE/res/menu/activity_rulelistprefs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/CalendarCloner FREE/res/values-nl/strings.xml b/CalendarCloner FREE/res/values-nl/strings.xml
deleted file mode 100644
index ec17ffa..0000000
--- a/CalendarCloner FREE/res/values-nl/strings.xml
+++ /dev/null
@@ -1,418 +0,0 @@
-
-
- Nederlands
- Calendar Cloner FREE
- Versie {1}
- Jeroen van Disseldorp
- dd-MM-yyyy HH:mm
- Ja
- Nee
- OK
- Annuleer
- Aan
- Uit
- Calendar Cloner FREE
- Activiteit
- Actief
- Configuratie
- Regels
- Stel hier je eigen regels in
- Instellingen
- Stel het gedrag van de app in
- Algemeen
- Synchronisatieinterval
- Limieten
- Afspraaklimiet
- Maximum afspraakwijzigingen per uur
- Gastenlimiet
- Maximum gastwijzigingen per uur
- Logging
- Log naar systeemlog
- Informatie wordt niet naar logcat gestuurd
- Informatie wordt naar logcat gestuurd
- Log naar regelhistorie
- Regelhistorie is niet actief
- Regelhistorie is actief
- Logwijze
- Bondig
- Gedetailleerd
- Extra
- Onderhoudsfuncties
- Hulpmiddelen voor uw agenda\'s
- Lijst afspraken
- Doorzoek en bekijk uw afspraken
- Verwijder dubbele afspraken
- Gebruik indien CC foutmeldingen geeft voor dubbele afspraken
- Laad instellingen
- Laad alle instellingen van sdcard
- Bewaar instellingen
- Schrijf alle instellingen naar sdcard
- Hulp
- Korte introductie
- Over
- Over Calendar Cloner FREE
- Dienst is niet actief
- Start over {1}
- Agenda\'s ongewijzigd
- Aan het synchroniseren
- Synchronisatie start
- Synchonisatieregels
- Nieuwe regel toevoegen
- Gebruik menu om een nieuwe regel toe te voegen
- Regelnaam
- Nieuwe regel toevoegen
- Synchroniseer nu
- Voer deze regel uit
- Verwijder gerelateerde klonen
- Verwijder regel
- Toon regelhistorie
- Regelinstellingen
- Algemene instellingen
- Actief
- Regelnaam
- Geef deze regel een naam
- Selecteer agenda
- Geen selectie
- Geen geschikte agenda\'s gevonden
- Naamloze agenda
- Methodiek
- Samenvatten
- Kopieren
- Verplaatsen
- Bronagenda
- Doelagenda
- Opties
- Selecteer afspraken
- Selecteer welke afspraken gekloond worden
- Periode
- Afspraken uit het verleden
- Toekomstige afspraken
- De maximale periode is beperkt voor dit type regel
- Speciaal
- Klonen uit andere agenda\'s
- Enkel originele afspraken worden meegenomen
- Ook klonen uit andere agenda\'s worden meegenomen
- Afspraakinhoud
- Gebruik filters
- Kloon alle afspraken
- Kloon gefilterde afspraken
- Type afspraak
- Alle afspraken
- Alleen enkele afspraken
- Alleen herhalende afspraken
- Tekstfilters
- Selecteer afspraken op inhoud
- Titel bevat
- Titel bevat niet
- Locatie bevat
- Locatie bevat niet
- Omschrijving bevat
- Omschrijving bevat niet
- Privacy filter
- Aanwezigheidsfilter
- Beschikbaarheidsfilter
- Afspraakstatusfilter
- Weekdagfilter
- Bepaal inhoud
- Stel de inhoud van gekloonde afspraken in
- Standaardvelden
- Kopieer titel
- Geef klonen eigen titel
- Kopieer originele titel
- Titel
- Kopieer locatie
- Geef klonen eigen locatie
- Kopieer originele locatie
- Locatie
- Kopieer omschrijving
- Geef klonen eigen omschrijving
- Kopieer originele omschrijving
- Omschrijving
- Extra tijd vooraf
- Extra tijd nadien
- Beschikbaarheid
- Als in originele afspraak
- Privacy
- Als in originele afspraak
- Aanwezigheid
- Kopieer aanwezigheidsstatus
- De gekloonde afspraak is standaard geaccepteerd
- Uw aanwezigheid/acceptatie wordt overgenomen naar de kloon
- Acceptatie van kloon leidend
- Statusinformatie in de originele afspraak wordt niet overschreven
- Indien u de kloon accepteert of afwijst zal CC deze status overnemen naar uw originele afspraak
- Niet van toepassing voor verplaatsregels
- Uw naam in bronagenda
- Wordt gebruikt bij bevestiging van uw originele afspraak
- Gastenlijsten
- Opties om gastenlijsten te klonen
- Kloon gastenlijst
- Gastenlijst wordt niet gekloond
- Gastenlijst wordt gekloond
- Stuur geen uitnodigingen
- Gasten krijgen een uitnodiging vanuit uw doelagenda
- Gebruik nep e-mailadressen zodat niemand uitnodigingen ontvangt
- Domein voor nep e-mailadressen
- Uitnodigingen voor gekloonde events gaan naar nepgebruiker@{1}
- Gastenlijst als tekst
- Gastenlijst wordt niet als tekst gekopieerd
- Gastenlijst wordt als tekst opgenomen in de omschrijving van de afspraak
- Extra gast
- Voeg extra gast toe
- Geen extra gast
- Een extra gast wordt toegevoegd aan iedere kloon
- Naam extra gast
- E-mail extra gast
- Herinneringen
- Opties om herinneringen te klonen
- Kopieer herinneringen
- Herinneringen worden niet gekloond
- Herinneringen worden gekloond
- Eigen herinnering
- Voeg eigen herinnering toe
- Geen extra herinnering
- Een extra herinnering wordt toegevoegd aan iedere kloon
- Herinneringsmethode
- Doelagenda niet ingesteld
- Doelagenda staat geen herinneringen toe
- Melding
- Standaard
- E-mail
- SMS
- Herinneringstijd
- Agenda standaardtijd
- Aanvullende opties
- Extra instellingen voor synchronisatie
- Behoud klonen buiten tijdspanne
- Klonen buiten de tijdspanne van bronagenda worden automatisch verwijderd
- Klonen buiten de tijdspanne van bronagenda blijven behouden
- Geavanceerde opties
- Opties voor extra flexibiliteit
- Hash methode
- Gebruik bronagenda
- Unieke hash voor deze regel
- Handmatige hash
- Hash waarde
- Testmodus
- Uitvoeren van deze regel wijzigt de agenda
- Testmodus actief: uitvoeren van deze regel toont alleen voorgestelde wijzigingen
- Regelhistorie
- Regel
- Status
- Details
- Bekijk afspraken
- Alle agenda\'s
- Alle regels
- Verwijder afspraak
- Afspraakdetails
- WORDT VERWIJDERD
- Verwijder getoonde afspraken
- Bevestig verwijderen
- Agenda
- Filter
- Type afspraak
- Klonen van
- {1} afspraken gevonden
- Alle afspraken
- Originele afspraken
- Gekloonde afspraken
- Deels verplaatste afspraken
- Gekloond of deels verplaatst
- Zoek dubbele afspraken
- Alle agenda\'s
- Verwijder afspraak
- Bezig met zoeken/laden…
- Verwijder dubbele afspraken
- Bevestig verwijderen
- Ververs
- Agenda
- Filter
- Afspraaktype
- Klonen van
- {1} afspraken gevonden
- Bekijk dubbele afspraken
- Handleiding
- Over
- door
- Deze app is bedoeld voor mensen die meerdere agenda\'s synchroon willen houden. Agenda\'s waarin anderen vaak afspraken plannen door te kijken naar ieders beschikbaarheid volgens die agenda. Zonder zich te beseffen dat je er wellicht nog meerdere agenda\'s op na houdt waarin andere relevante afspraken staan. Calendar Cloner FREE kopieert (\"kloont\") afspraken van de ene naar de andere agenda, zodat uw agenda\'s altijd correct weergeven wanneer u echt beschikbaar bent.\n\nU kunt afspraken klonen met volledige titel/omschrijving, alleen met titel/locatie of anoniem. Door middel van regels kunt u zelf opgeven welke afspraken van/naar welke agenda\'s gekloond worden. Het proces is altijd eenrichtingsverkeer. Calendar Cloner FREE zal NOOIT uw originele afspraken aanpassen. Tweewegsynchronisatie wordt bereikt door twee regels in te stellen.\n\nProbeer het uit en laat me weten wat u van deze app vindt via support@dizzl.com.\n
- Laat zien dat u deze app waardeert door de betaalde versie te kopen in Google Play.\n
- Veel kloonplezier!\n
- Debug modus: {1}
- Koop {1}
- Toon uw waardering
- Versie {1}
- Doelagenda
- Agenda
- Bronagenda
- …en {1} anderen…
- Gast toegevoegd: {1} <{2}>
- Nepgast toegevoegd: {1} <{2}>
- Extra gast toegevoegd: {1} <{2}>
- Uzelf toegevoegd: {1} <{2}>
- Gastenlimiet bereikt
- Gast verwijderd: {1} <{2}>
- Status van {1} is bijgewerkt naar {2} in agenda {3}
- Status van {1} is automatisch bijgewerkt naar {2} in agenda {3} (afspraak uit verleden)
- Gast bijgewerkt: {1} <{2}>
- Gastenlijst onveranderd
- Gastenlijst bijgewerkt
- Kloon
- Kon benodigde lock niet verkrijgen
- Verwijderd
- Gewijzigde velden
- Klaar
- Afspraaklimiet bereikt
- Testmodes aan: agenda\'s worden niet aangepast
- Filter: {1}
- Genegeerd
- Ingevoegd
- Aan het synchroniseren
- Limiet bereikt
- Wordt reeds verwijderd
- Verplaatst
- Gedeeltelijk verplaatst
- Oude kloon niet herbruikbaar, verwijderd
- {1} is toegevoegd als gast
- Verwerkt
- Herinnering verwijderd
- Herinneringen bijgewerkt
- Overgeslagen
- Bijgewerkt
- Valide kloon
- Synchronisatie onderbroken
- Gedeeltelijk gesynchroniseerd
- Gepauzeerd gedurende server synchronisatie
- Klaar, {1} afspraken bijgewerkt"
- Synchroniseren
- Ongewijzigd
- Verplaatst
- Nakijken of er afspraken verwijderd zijn
- Herhalingsuitzondering
- Gestopt na het bijwerken van {1} afspraken
- Afspraken worden gegenereerd
- Initialiseren
- {1} afspraken bijgewerkt
- Lorem ipsum dolor sit amet
- {1} is niet leesbaar
- {1} niet gevonden
- {1} niet ingesteld
- {1} is niet gesynchroniseerd
- {1} is niet wijzigbaar
- Kon instellingen niet laden van SDCard: {1}
- Kon instellingen niet opslaan op SDCard: {1}
- Agendanaam is niet uniek
- Dubbel server id voor afspraak
- Fout bij verwijderen gekloonde afspraken
- Fout bij verwijderen afspraken
- Afspraak heeft geen unieke id
- Fout bij het bewerken van de afspraak
- Synchronisatieverzoek van {1}
- Cursor niet afgesloten
- Exception
- op
- Fout. Zie regelhistorie voor details
- Bericht
- Taaklijst wordt uitgevoerd
- Stack trace
- Log niveau
- Timer gezet om opnieuw te synchroniseren over {1} milliseconden
- Alle informatie
- Waarschuwingen
- Wijzigingen
- Foutmeldingen
- Verwijderd
- Ingevoegd
- Bijgewerkt
- Alles
- App is verlopen
- Cloner nog actief
- Stop eerst de cloner via de instelling in het hoofdmenu.
- {1} gekloonde afspraken verwijderd
- Hou er rekening mee dat sommige afspraken nog te zien kunnen zijn totdat server synchronisatie heeft plaatsgevonden.
- Verwijderen
- Afspraken worden verwijderd
- Niet verwijderen
- Niet laden
- {1} afspraken verwijderd
- Hou er rekening mee dat sommige afspraken nog te zien kunnen zijn totdat server synchronisatie heeft plaatsgevonden.
- {1} afspraken gevonden in bronagenda
- Regellimiet bereikt
- De FREE versie biedt u enkel de mogelijkheid om {1} regels aan te maken. Indien u meer regels wilt, of u wilt simpelweg de auteur van de app wilt bedanken, koop dan de betaalde versie van de app in de Google Play store.
- Oneindig
- Laad instellingen
- {1} dag terug
- {1} dagen terug
- {1} dag vooruit
- {1} dagen vooruit
- {1} uur
- {1} uur
- {1} wijzigingen per uur
- {1} minuut
- {1} minuten
- {1} maand terug
- {1} maanden terug
- {1} maand vooruit
- {1} maanden vooruit
- {1} week terug
- {1} weken terug
- {1} week vooruit
- {1} weken vooruit
- {1} jaar terug
- {1} jaar terug
- {1} jaar vooruit
- {1} jaar vooruit
- Deze functionaliteit is niet beschikbaar in de FREE versie.
- De regel kan niet worden aangepast zolang hij wordt uitgevoerd.
- Regel gedeactiveerd voor wijziging
- Regel is nog actief
- Wacht tot de cloner klaar is met het verwerken van deze regel.
- Instellingen geladen van SDCard: {1}
- Instellingen opgeslagen op SDCard: {1}
- Onbeperkt
- Uzelf
- Wilt u alle gekloonde afspraken verwijderen uit de doelagenda?
- Wilt u deze {1} afspraken verwijderen?
- Wilt u alle gerelateerde kloonafspraken verwijderen?
- Wilt u echt deze regel verwijderen?
- Wilt u echt de instellingen laden van SDCard?
- Standaard
- Prive
- Vertrouwelijk
- Openbaar
- Gast
- Geen
- Organisator
- Optreder
- Spreker
- Geen
- Uitgenodigd
- Voorlopig
- Geaccepteerd
- Afgewezen
- Geen
- Optioneel
- Benodigd
- Niet bezet
- Voorlopig bezet
- Bezet
- Niet op kantoor
- Voorlopig
- Bevestigd
- Afgelast
- Organisator
- Sprekers
- Optredens
- Gasten
- Melding
- Standaard
- E-mail
- SMS
- Maandag
- Dinsdag
- Woensdag
- Donderdag
- Vrijdag
- Zaterdag
- Zondag
-
-
diff --git a/CalendarCloner FREE/res/values-v11/styles.xml b/CalendarCloner FREE/res/values-v11/styles.xml
deleted file mode 100644
index a09b732..0000000
--- a/CalendarCloner FREE/res/values-v11/styles.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/values-v14/styles.xml b/CalendarCloner FREE/res/values-v14/styles.xml
deleted file mode 100644
index 58735fa..0000000
--- a/CalendarCloner FREE/res/values-v14/styles.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/values/dimens.xml b/CalendarCloner FREE/res/values/dimens.xml
deleted file mode 100644
index cfec712..0000000
--- a/CalendarCloner FREE/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 60dp
- 120dp
-
diff --git a/CalendarCloner FREE/res/values/strings.xml b/CalendarCloner FREE/res/values/strings.xml
deleted file mode 100644
index 08c52db..0000000
--- a/CalendarCloner FREE/res/values/strings.xml
+++ /dev/null
@@ -1,418 +0,0 @@
-
-
- English
- Calendar Cloner FREE
- Version {1}
- Jeroen van Disseldorp
- yyyy-MM-dd hh:mm aa
- Yes
- No
- OK
- Cancel
- On
- Off
- Calendar Cloner FREE
- Activity
- Run
- Configuration
- Rules
- Set up your rules here
- Settings
- Set up the app behavior
- General
- Cloning interval
- Limits
- Event limit
- Maximize event updates per hour
- Guest limit
- Maximize guest updates per hour
- Logging
- Log to system log (logcat)
- Information is not sent to logcat
- Information is sent to logcat
- Log to rule log
- Rule log is not active
- Rule log is active
- Log type
- Summary
- Extended logging
- Extra
- Maintenance
- Calendar utilities
- List of events
- Search and view your calendar events
- Remove duplicate events
- Use when CC gives duplicate event errors
- Load settings
- Load preferences from sdcard
- Save settings
- Save preferences to sdcard
- Help
- Brief introduction
- About
- About Calendar Cloner FREE
- Service is disabled
- Starts in {1}
- Calendars unchanged
- Synchronization running
- Synchronization starting
- Cloner rules
- Add new rule
- Press menu to create new rules
- Rule name
- Add new rule
- Clone now
- Execute this rule
- Delete related clones
- Delete rule
- Show rule log
- Rule settings
- General settings
- Enabled
- Rule name
- Give this rule a name
- Select calendar
- No selection
- No suitable calendars found
- Unnamed calendar
- Method
- Aggregate
- Clone
- Move
- Source calendar
- Destination calendar
- Options
- Select events
- Select which events to clone
- Period
- Past events
- Future events
- The sync period is limited for this rule type
- Special
- Clones from other rules
- Only original events are processed
- Clones from other calendars are also processed
- Event content
- Use event selection
- Clone all events
- Clone only filtered events
- Event type
- All events
- Only simple events
- Only recurring events
- Text filters
- Select events based on their contents
- Title contains
- Title does not contain
- Location contains
- Location does not contain
- Description contains
- Description does not contain
- Privacy filter
- Attendance filter
- Availability filter
- Event status filter
- Weekday filter
- Content options
- Set content for cloned events
- Event fields
- Clone title
- Give clones custom title
- Copy original title
- Title
- Clone location
- Give clones custom location
- Copy original location
- Location
- Clone description
- Give clones custom description
- Copy original description
- Description
- Reserve before
- Reserve after
- Availability
- Same as source event
- Privacy
- Same as source event
- Attendance
- Clone attendance status
- The cloned event is always marked as accepted
- Your attendance/acceptance is copied to the clone
- Attendance of clone prevails
- Never accept/reject source event
- When you accept or reject the cloned event, that status is copied back to the source event
- Not applicable to move rules
- Your name in source calendar
- This name is used when accepting your original event
- Guest lists
- Options for cloning guest lists
- Clone guest list
- Guest list is not cloned
- Guest list is cloned
- Don\'t send invites
- Guests will receive an invitation from your destination calendar
- Use fake email addresses to prevent guests from receiving invitations
- Domain for fake email addresses
- Invites to cloned events are sent to fakeuser@{1}
- Guest list as text
- Guest list is not copied as text
- Guest list is included as text in the description of the clone
- Extra guest
- Add custom guest
- No extra guest
- An extra guest will be invited to each clone
- Custom guest name
- Custom guest email
- Reminders
- Select whether to clone reminders
- Clone reminders
- Reminders are not cloned
- Reminders are cloned
- Custom reminder
- Add custom reminder
- No extra reminder
- An extra reminder will be added to each clone
- Custom reminder method
- Destination calendar not set
- Destination calendar does not allow reminders
- Alert
- Default
- Email
- SMS
- Custom reminder minutes
- Calendar default
- Additional options
- Extra cloning parameters
- Retain clones outside event window
- Clones outside the time windows of source calendar will be automatically removed
- Clones outside the time window of source calendar will be retained
- Advanced options
- Options that allow for extra flexibility
- Hash method
- Use source calendar
- Unique hash for this rule
- Manual hash
- Hash value
- Test mode
- Executing this rule changed the calendar
- Test mode active: executing this rule only shows proposed changes
- Rule log
- Rule
- Status
- Details
- Browse events
- All calendars
- All rules
- Delete event
- Event details
- BEING DELETED
- Delete shown events
- Confirm deletion
- Calendar
- Filter
- Event type
- Clones from
- {1} events found
- All events
- Only original events
- Cloned events only
- Partially moved events
- Cloned or partially moved
- Browse duplicates
- All calendars
- Delete event
- Loading…
- Delete shown events
- Confirm deletion
- Refresh
- Calendar
- Filter
- Event type
- Clones from
- {1} events found
- View duplicate events
- Help
- About
- by
- This program is for people who have to keep multiple agendas in sync. Agendas in which other people often schedule meetings, without regarding the fact that they only see part of your real agenda. Calendar Cloner FREE \"clones\" events from one calendar to the other, so people can at least see when you are busy.\n\nYou can clone events with full title/description, with title/location only, or anonymously. Multiple rules allow you to clone events from one calendar to the next. Cloning events is always one-way and deterministic. Calendar Cloner FREE will NEVER touch your original (ie. non-cloned) events. Two-way synchronization is accomplished by setting up two rules.\n\nTry it out and let me know what your thoughts are at support@dizzl.com.\n\nHappy cloning!\n
- If you like this app, please consider purchasing the paid version in Google Play.\n
- Happy cloning!\n
- Debug mode: {1}
- Buy {1}
- Show your appreciation
- Version {1}
- Destination calendar
- Calendar
- Source calendar
- …and {1} more…
- Guest added: {1}<{2}>
- Guest added: {1}<{2}>
- Extra guest added: {1} <{2}>
- Self added: {1} <{2}>
- Attendee limit reached
- Guest removed: {1} <{2}>
- Updated status of {1} to {2} in calendar {3}
- Updated default status of {1} to {2} in calendar {3} (past event)
- Guest updated: {1} <{2}>
- Guest list unchanged
- Updated attendees
- Clone
- Could not acquire synchronization lock
- Deleted
- Updated fields
- Done
- Event limit reached
- Test mode on: calendars changes are not applied
- Filter: {1}
- Ignored
- Inserted
- In sync
- Limit reached
- Already being deleted
- Moved
- Partially moved
- Old clone not reusable, deleted
- Inserted {1} as attendee
- Processed
- Reminder removed
- Updated reminders
- Skipped
- Updated
- Valid clone
- Cloning interrupted
- Partially cloned
- Cloning paused during server sync
- Cloning finished, updated {1} clones"
- Cloning
- Unchanged
- Moved
- Checking for deleted events
- Cloning exception
- Exiting cloner after updating {1} events
- Generating aggregate events
- Initializing
- Updated {1} events
- Lorem ipsum dolor sit amet
- {1} is not accessible
- {1} not found
- {1} not selected
- {1} not synchronized
- {1} calendar not writeable
- Could not load settings from SDCard: {1}
- Could not save settings to SDCard: {1}
- Agendanaam is niet uniek
- Duplicate server id for event
- Error deleting clones
- Error deleting events
- Event has no unique id
- Error processing the event
- Resync requested from {1}
- Cursor not closed
- Exception
- at
- Error. See rule log for details
- Message
- Processing task queue
- Stack trace
- Log level
- Setting timer for resync in {1} milliseconds
- All information
- Warnings
- Updates
- Errors
- Deleted
- Inserted
- Updated
- All
- App has expired
- Cloner still enabled
- Disable the cloner service on the main settings screen first.
- {1} clones deleted
- Please note that events may still appear until your calendar sync catches up.
- Delete
- Deleting events
- Don\'t delete
- Don\'t load
- {1} events deleted
- Please note that events may still appear until your calendar sync catches up.
- Found {1} events in source calendar
- Rule limit reached
- The FREE version only allows you to create {1} rules. Please buy the paid version from Google Play to add additional rules.
- Infinite
- Load settings
- {1} day back
- {1} days back
- {1} day forward
- {1} days forward
- {1} hour
- {1} hours
- {1} updates per hour
- {1} minute
- {1} minutes
- {1} month back
- {1} months back
- {1} month forward
- {1} months forward
- {1} week back
- {1} weeks back
- {1} week forward
- {1} weeks forward
- {1} year back
- {1} years back
- {1} year forward
- {1} years forward
- This feature is not available in the FREE version.
- Can not edit rule while it is executed
- Rule disabled for editing
- Rule still active
- Wait until rule is done processing.
- Settings loaded from SDCard: {1}
- Settings saved to SDCard: {1}
- Unlimited
- You
- Do you want to delete all cloned events from the destination calendar?
- Do you want to delete these {1} events?
- Do you want to delete all related cloned events?
- Do you want to delete this rule?
- Do you really want to load settings from SDCard?
- Default
- Private
- Confidential
- Public
- Attendee
- None
- Organizer
- Performer
- Speaker
- None
- Invited
- Tentative
- Accepted
- Declined
- None
- Optional
- Required
- Free
- Tentative
- Busy
- Out of office
- Tentative
- Confirmed
- Canceled
- Organizer
- Speakers
- Performers
- Attendees
- Alert
- Default
- Email
- SMS
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
-
-
diff --git a/CalendarCloner FREE/res/values/styles.xml b/CalendarCloner FREE/res/values/styles.xml
deleted file mode 100644
index 0264f5d..0000000
--- a/CalendarCloner FREE/res/values/styles.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/xml/main_preferences.xml b/CalendarCloner FREE/res/xml/main_preferences.xml
deleted file mode 100644
index 6ca53fa..0000000
--- a/CalendarCloner FREE/res/xml/main_preferences.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/res/xml/rule_preferences.xml b/CalendarCloner FREE/res/xml/rule_preferences.xml
deleted file mode 100644
index 8bc86b7..0000000
--- a/CalendarCloner FREE/res/xml/rule_preferences.xml
+++ /dev/null
@@ -1,281 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AboutActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AboutActivity.java
deleted file mode 100644
index 69bbe52..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AboutActivity.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class AboutActivity extends Activity {
- private int mLongPressCounter = 0;
- private Button mPurchaseButton = null;
- private int mPurchaseCounter = 0;
- private final Handler mHandler = new Handler();
- private Timer mTimer = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.aboutactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
- this.getActionBar().setTitle(R.string.about_activity_title);
-
- TextView versionView = (TextView) findViewById(R.id.aboutAppVersion);
- String version = ClonerApp.getVersion();
- if (!version.contentEquals("")) {
- versionView.setText(ClonerApp.translate(R.string.app_version_x, new String[] { ClonerApp.getVersion() }));
- } else {
- versionView.setText("");
- }
- // Look up the purchase button
- mPurchaseButton = (Button) findViewById(R.id.purchaseButton);
- if (ClonerVersion.IS_FREE_VERSION()) {
- mPurchaseButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View arg0) {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(Uri.parse("market://details?id=" + ClonerVersion.PAID_VERSION_PACKAGENAME()));
- startActivity(intent);
- }
- });
- } else {
- mPurchaseButton.setVisibility(View.GONE);
- mPurchaseButton = null;
- }
-
- // Set the correct text for the view
- String text = ClonerApp.translate(R.string.about_description_text) + "\n";
- if (ClonerVersion.IS_FREE_VERSION()) {
- text += ClonerApp.translate(R.string.about_description_free) + "\n";
- }
- text += ClonerApp.translate(R.string.about_description_end);
- TextView tv = (TextView) findViewById(R.id.aboutTextView);
- tv.setText(text);
-
- // Debug easter egg: listen for 4 long presses to activate debug mode
- ImageView logo = (ImageView) findViewById(R.id.cc_logo);
- logo.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- boolean toggle = false;
- if (!ClonerApp.isDebugMode()) {
- mLongPressCounter = (mLongPressCounter + 1) % 4;
- if (mLongPressCounter == 0) {
- toggle = true;
- }
- } else {
- toggle = true;
- }
- if (toggle) {
- ClonerApp.toggleDebugMode();
- ClonerApp.toast(ClonerApp.translate(R.string.about_debug_mode, new String[] { (ClonerApp
- .isDebugMode() ? ClonerApp.translate(R.string.on) : ClonerApp.translate(R.string.off)) }));
- }
- return true;
- }
- });
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (mPurchaseButton != null) {
- // Activate a timer to update the resync menu item
- mTimer = new Timer("About purchase timer", false);
- mTimer.scheduleAtFixedRate(new TimerTask() {
- @Override
- public void run() {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- onUpdatePurchaseButton();
- }
- });
- }
- }, 0, 2000);
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if (mTimer != null) {
- mTimer.cancel();
- mTimer = null;
- }
- }
-
- private void onUpdatePurchaseButton() {
- if (mPurchaseCounter == 0) {
- mPurchaseButton.setText(ClonerApp.translate(R.string.about_purchase1,
- new String[] { ClonerVersion.paidVersionName() }));
- } else {
- mPurchaseButton.setText(ClonerApp.translate(R.string.about_purchase2));
- }
- mPurchaseCounter = (mPurchaseCounter + 1) % 2;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- finish();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AccessLevels.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AccessLevels.java
deleted file mode 100644
index a0a2d75..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AccessLevels.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Events;
-
-public class AccessLevels extends SelectList {
- public static final int ACCESS_CONFIDENTIAL = Events.ACCESS_CONFIDENTIAL;
- public static final int ACCESS_DEFAULT = Events.ACCESS_DEFAULT;
- public static final int ACCESS_PRIVATE = Events.ACCESS_PRIVATE;
- public static final int ACCESS_PUBLIC = Events.ACCESS_PUBLIC;
-
- public static final int[] mKeys = new int[] { ACCESS_DEFAULT, ACCESS_PRIVATE, ACCESS_CONFIDENTIAL, ACCESS_PUBLIC };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.access_level_default),
- ClonerApp.translate(R.string.access_level_private),
- ClonerApp.translate(R.string.access_level_confidential), ClonerApp.translate(R.string.access_level_public) };
-
- public AccessLevels(boolean allSelected) {
- super(allSelected);
- }
-
- public AccessLevels clone() {
- AccessLevels other = new AccessLevels(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AlarmReceiver.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AlarmReceiver.java
deleted file mode 100644
index bb3aea4..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AlarmReceiver.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Handler;
-
-public class AlarmReceiver extends BroadcastReceiver {
- private static Handler mHandler = null;
- private static Runnable mRunnable = null;
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (mHandler != null && mRunnable != null) {
- mHandler.post(mRunnable);
- }
- }
-
- public static void setCallback(Handler handler, Runnable runnable) {
- mHandler = handler;
- mRunnable = runnable;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AsyncLoader.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AsyncLoader.java
deleted file mode 100644
index 45628af..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AsyncLoader.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.AsyncTaskLoader;
-import android.content.Context;
-
-public abstract class AsyncLoader extends AsyncTaskLoader {
- private D data;
-
- public AsyncLoader(Context context) {
- super(context);
- }
-
- @Override
- public void deliverResult(D data) {
- if (isReset()) {
- // An async query came in while the loader is stopped
- return;
- }
-
- this.data = data;
-
- super.deliverResult(data);
- }
-
- @Override
- protected void onStartLoading() {
- if (data != null) {
- deliverResult(data);
- }
-
- if (takeContentChanged() || data == null) {
- forceLoad();
- }
- }
-
- @Override
- protected void onStopLoading() {
- // Attempt to cancel the current load task if possible.
- cancelLoad();
- }
-
- @Override
- protected void onReset() {
- super.onReset();
-
- // Ensure the loader is stopped
- onStopLoading();
-
- data = null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Attendee.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Attendee.java
deleted file mode 100644
index 2ba8c01..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Attendee.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public interface Attendee {
- public long getId();
- public String getName();
- public String getEmail();
- public int getRelationship();
- public int getType();
- public int getStatus();
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCVMap.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCVMap.java
deleted file mode 100644
index a6038dc..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCVMap.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import android.content.ContentValues;
-
-public class AttendeeCVMap {
- private Map mMap = new HashMap();
-
- public ContentValues get(String name, String email) {
- return mMap.get(AttendeeId.map(0, name, email));
- }
-
- public void put(String name, String email, ContentValues values) {
- mMap.put(AttendeeId.map(0, name, email), values);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCloner.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCloner.java
deleted file mode 100644
index 1703778..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeCloner.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Attendees;
-
-public class AttendeeCloner extends Processor {
- private final AttendeesTable mAttendeesTable;
- private final Rule mRule;
- private final DbCalendar mDstCalendar;
- private final DbCalendar mSrcCalendar;
- private final AttendeeDiffer mDiffer = new AttendeeDiffer();
-
- protected class AttendeeCloneResult {
- int updateCount = 0;
- boolean completed = true;
- protected AttendeeDeltas deltas = new AttendeeDeltas();
- }
-
- protected static class AttendeeCloneContext {
- protected LogLines logLines = null;
- protected Set processedAttendees = new HashSet();
- }
-
- public AttendeeCloner(Rule rule, DbCalendar srcCalendar, DbCalendar dstCalendar, AttendeesTable table) {
- mRule = rule;
- mSrcCalendar = srcCalendar;
- mDstCalendar = dstCalendar;
- mAttendeesTable = table;
- }
-
- private String mapSourceAttendeeEmail(Attendee attendee, boolean self, boolean customAttendee) {
- String email = attendee.getEmail() != null ? attendee.getEmail() : "";
- if (self) {
- email = mDstCalendar.getOwnerAccount();
- } else if (mRule.getUseDummyEmailAddresses() && !customAttendee) {
- email = EmailObfuscator.generateDummyEmailFrom(email, mRule.getDummyEmailDomain());
- }
- return email;
- }
-
- private boolean isSourceSelf(String email) {
- return email != null ? mSrcCalendar.getOwnerAccount().contentEquals(email) : false;
- }
-
- private boolean isDestinationSelf(String email) {
- return email != null ? mDstCalendar.getOwnerAccount().contentEquals(email) : false;
- }
-
- private void prepareSrcAttendeeList(AttendeeMap attendees) {
- // Find SELF in the source list of attendees
- Attendee self = attendees.get(mRule.getSelfAttendeeName(), mSrcCalendar.getOwnerAccount());
-
- // If we clone the attendee list
- if (mRule.getCloneAttendees()) {
- // Make sure SELF is on the attendee list
- if (self == null) {
- // Add SELF to list of source attendees
- MemoryAttendee selfAtt = new MemoryAttendee();
- selfAtt.setName(mRule.getSelfAttendeeName());
- selfAtt.setEmail(mSrcCalendar.getOwnerAccount());
- selfAtt.setRelationship(Attendees.RELATIONSHIP_ATTENDEE);
- selfAtt.setType(Attendees.TYPE_REQUIRED);
- attendees.put(selfAtt.getName(), selfAtt.getEmail(), selfAtt);
- }
- } else {
- // Clear the list to clone
- attendees.clear();
- }
- }
-
- private void diffAttendee(Attendee attendee, Attendee clone, boolean selfOrganizer, boolean customAttendee,
- boolean resetCloneSelfAttendeeStatus, ContentValues delta) {
- delta.clear();
- // Find out if we're diffing SELF
- final boolean self = this.isSourceSelf(attendee.getEmail());
-
- if (self) {
- mDiffer.compare(
- new ClonedAttendeeSelf(attendee, mDstCalendar.getDisplayName(), mDstCalendar.getOwnerAccount(),
- selfOrganizer, mRule.getCloneSelfAttendeeStatus(), resetCloneSelfAttendeeStatus), clone,
- resetCloneSelfAttendeeStatus, mRule.getCloneSelfAttendeeStatusReverse(), delta);
- } else {
- mDiffer.compare(new ClonedAttendeeOther(attendee, !customAttendee && mRule.getUseDummyEmailAddresses(),
- mRule.getDummyEmailDomain()), clone, false, mRule.getCloneSelfAttendeeStatusReverse(), delta);
- }
- }
-
- private boolean processedAttendeeBefore(String name, String email, AttendeeCloneContext attendeeCloneContext) {
- // This method ensures that we don't overcount attendees when adhering
- // to invite limits
- boolean result = false;
- if (attendeeCloneContext != null && attendeeCloneContext.processedAttendees != null) {
- String attId = AttendeeId.map(0, name, email);
- if (attendeeCloneContext.processedAttendees.contains(attId)) {
- // We've seen this attendee before
- result = true;
- } else {
- // We haven't seen it before, so add it here
- attendeeCloneContext.processedAttendees.add(attId);
- }
- }
-
- return result;
- }
-
- private boolean canModifyAttendee(String name, String email, boolean self, AttendeeCloneContext atc) {
- boolean result = self || this.processedAttendeeBefore(name, email, atc)
- || Limits.canModify(Limits.TYPE_ATTENDEE);
- if (!result) {
- this.log(ClonerLog.LOG_WARNING, ClonerApp.translate(R.string.cloner_log_attendee_limit_reached));
- }
- return result;
- }
-
- public AttendeeCloneResult process(Event event, long cloneId, boolean resetClonedSelfAttendeeStatus,
- AttendeeCloneContext attendeeCloneContext) {
- this.useLogLines(attendeeCloneContext.logLines);
- AttendeeCloneResult result = new AttendeeCloneResult();
-
- // Load the event's attendees
- AttendeeMap eventAttendees = DbAttendee.getByEventHashed(mAttendeesTable, event.getId());
- // Load the clone's attendees
- AttendeeMap cloneAttendees = DbAttendee.getByEventHashed(mAttendeesTable, cloneId);
- boolean selfOrganizer = event.getOrganizer() != null ? event.getOrganizer().contentEquals(
- mSrcCalendar.getOwnerAccount()) : true;
-
- // Calculate the cloned list of attendees
- this.prepareSrcAttendeeList(eventAttendees);
-
- // Try to find matches between event attendees and clone attendees in
- // terms of name/email
- for (Attendee eventAttendee : eventAttendees.getSet()) {
- final boolean self = this.isSourceSelf(eventAttendee.getEmail());
- // Clone the attendee email
- String cloneAttendeeEmail = this.mapSourceAttendeeEmail(eventAttendee, self, false);
-
- // Lookup the clone attendee
- final Attendee cloneAttendee = cloneAttendees.get(eventAttendee.getName(), cloneAttendeeEmail);
- if (cloneAttendee != null) {
- ContentValues delta = new ContentValues();
- this.diffAttendee(eventAttendee, cloneAttendee, selfOrganizer, false, resetClonedSelfAttendeeStatus,
- delta);
- if (delta.size() > 0) {
- // Check to see if we can update within limits
- if (!this.canModifyAttendee(cloneAttendee.getName(), cloneAttendee.getEmail(), self,
- attendeeCloneContext)) {
- result.completed = false;
- return result;
- }
-
- // Update the attendee
- mAttendeesTable.update(cloneAttendee.getId(), delta);
- result.updateCount++;
- result.deltas.put(cloneAttendee.getName(), cloneAttendee.getEmail(), delta);
- log(ClonerLog.LOG_UPDATE,
- ClonerApp.translate(R.string.cloner_log_attendee_updated,
- new String[] { cloneAttendee.getName(), cloneAttendee.getEmail() }));
- }
- cloneAttendees.remove(eventAttendee.getName(), cloneAttendeeEmail);
- } else {
- // Check to see if we can insert within limits
- if (!this.canModifyAttendee(eventAttendee.getName(), cloneAttendeeEmail, self, attendeeCloneContext)) {
- result.completed = false;
- return result;
- }
-
- // We didn't find a match, so insert a new attendee
- ContentValues delta = new ContentValues();
- this.diffAttendee(eventAttendee, new MemoryAttendee(), selfOrganizer, false,
- resetClonedSelfAttendeeStatus, delta);
- delta.put(Attendees.EVENT_ID, cloneId);
- mAttendeesTable.insert(delta);
- result.updateCount++;
- result.deltas.put(delta.getAsString(Attendees.ATTENDEE_NAME),
- delta.getAsString(Attendees.ATTENDEE_EMAIL), delta);
- int resourceId = self ? R.string.cloner_log_attendee_added_self
- : mRule.getUseDummyEmailAddresses() ? R.string.cloner_log_attendee_added_dummy
- : R.string.cloner_log_attendee_added;
- log(ClonerLog.LOG_UPDATE,
- ClonerApp.translate(resourceId, new String[] { delta.getAsString(Attendees.ATTENDEE_NAME),
- delta.getAsString(Attendees.ATTENDEE_EMAIL) }));
- }
- }
-
- // If the rule specifies a custom attendee, add it here
- if (mRule.getCustomAttendee()) {
- Attendee customAttendee = cloneAttendees.get(mRule.getCustomAttendeeName(), mRule.getCustomAttendeeEmail());
- if (customAttendee == null) {
- // Check to see if we can insert within limits
- if (!this.canModifyAttendee(mRule.getCustomAttendeeName(), mRule.getCustomAttendeeEmail(), false,
- attendeeCloneContext)) {
- result.completed = false;
- return result;
- }
-
- MemoryAttendee att = new MemoryAttendee();
- att.setName(mRule.getCustomAttendeeName());
- att.setEmail(mRule.getCustomAttendeeEmail());
- att.setRelationship(Attendees.RELATIONSHIP_ATTENDEE);
- att.setType(Attendees.TYPE_REQUIRED);
- att.setStatus(Attendees.ATTENDEE_STATUS_INVITED);
- customAttendee = att;
-
- ContentValues delta = new ContentValues();
- this.diffAttendee(customAttendee, new MemoryAttendee(), selfOrganizer, true,
- resetClonedSelfAttendeeStatus, delta);
- delta.put(Attendees.EVENT_ID, cloneId);
- mAttendeesTable.insert(delta);
- result.updateCount++;
- result.deltas.put(customAttendee.getName(), customAttendee.getEmail(), delta);
- log(ClonerLog.LOG_UPDATE,
- ClonerApp.translate(R.string.cloner_log_attendee_added_extra,
- new String[] { mRule.getCustomAttendeeName(), mRule.getCustomAttendeeEmail() }));
- } else {
- cloneAttendees.remove(mRule.getCustomAttendeeName(), mRule.getCustomAttendeeEmail());
- }
- }
-
- // Remove all remaining attendees from the cloned event
- for (final Attendee cloneAttendee : cloneAttendees.getSet()) {
- final boolean self = this.isDestinationSelf(cloneAttendee.getEmail());
- if (!self) {
- // Check to see if we can delete within limits
- if (!this.canModifyAttendee(cloneAttendee.getName(), cloneAttendee.getEmail(), false,
- attendeeCloneContext)) {
- result.completed = false;
- return result;
- }
-
- mAttendeesTable.delete(cloneAttendee.getId());
- log(ClonerLog.LOG_UPDATE,
- ClonerApp.translate(R.string.cloner_log_attendee_removed,
- new String[] { cloneAttendee.getName(), cloneAttendee.getEmail() }));
- result.updateCount++;
- } else {
- // Don't remove self if neutral (added automatically by most
- // calendars)
- if (cloneAttendee.getStatus() != Attendees.ATTENDEE_STATUS_NONE
- && cloneAttendee.getStatus() != Attendees.ATTENDEE_STATUS_ACCEPTED) {
- if (mAttendeesTable.delete(cloneAttendee.getId()) != 1) {
- result.completed = false;
- return result;
- }
- log(ClonerLog.LOG_UPDATE,
- ClonerApp.translate(R.string.cloner_log_attendee_removed,
- new String[] { cloneAttendee.getName(), cloneAttendee.getEmail() }));
- result.updateCount++;
- }
- }
- }
-
- return result;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDeltas.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDeltas.java
deleted file mode 100644
index d039b20..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDeltas.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import android.content.ContentValues;
-
-public class AttendeeDeltas {
- private Map mMap = new HashMap();
-
- public ContentValues get(String name, String email) {
- return mMap.get(AttendeeId.map(0, name, email));
- }
-
- public void put(String name, String email, ContentValues values) {
- mMap.put(AttendeeId.map(0, name, email), values);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDiffer.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDiffer.java
deleted file mode 100644
index 1a138a6..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeDiffer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-
-public class AttendeeDiffer extends Differ {
- private AttendeesTable mAttendeeTable = new AttendeesTable(ClonerApp.getDb(true));
-
- public void compare(Attendee att, Attendee clone,
- boolean resetStatus, boolean cloneStatusReverse,
- ContentValues delta) {
- if (clone.getId() == 0) {
- // Compare regular event fields
- this.compareField(mAttendeeTable.ATTENDEE_NAME, att.getName(),
- clone.getName(), true, delta);
- this.compareField(mAttendeeTable.ATTENDEE_EMAIL, att.getEmail(),
- clone.getEmail(), true, delta);
- this.compareField(mAttendeeTable.ATTENDEE_RELATIONSHIP,
- "" + att.getRelationship(), "" + clone.getRelationship(),
- true, delta);
- this.compareField(mAttendeeTable.ATTENDEE_TYPE, "" + att.getType(),
- "" + clone.getType(), true, delta);
- }
- if (clone.getId() == 0
- || resetStatus
- || (!cloneStatusReverse && att.getStatus() != clone.getStatus())
- || (DbAttendee.attendeeStatusIsAResponse(att.getStatus()) && !DbAttendee
- .attendeeStatusIsAResponse(clone.getStatus()))) {
- this.compareField(mAttendeeTable.ATTENDEE_STATUS,
- "" + att.getStatus(), "" + clone.getStatus(),
- clone.getId() == 0, delta);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeId.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeId.java
deleted file mode 100644
index c2c0891..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeId.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class AttendeeId {
- public static String map(long id, String name, String email) {
- if (email != null && !email.contentEquals("")) {
- return "Email: "+email;
- }
- if (name != null && !name.contentEquals("")) {
- return "Name: "+name;
- }
- return "Id: "+id;
- }
-
- public static String map(String name, String email) {
- return map(0, name, email);
- }
-
- public static String map(String email) {
- return map(0, "", email);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeMap.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeMap.java
deleted file mode 100644
index b0a1916..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeMap.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-public class AttendeeMap {
- private Map mMap = new HashMap();
-
- public void clear() {
- mMap.clear();
- }
-
- public Attendee get(String name, String email) {
- return mMap.get(AttendeeId.map(0, name, email));
- }
-
- public Set getSet() {
- Set result = new HashSet();
- for (Entry entry : mMap.entrySet()) {
- result.add(entry.getValue());
- }
- return result;
- }
-
- public void put(String name, String email, Attendee att) {
- mMap.put(AttendeeId.map(name, email), att);
- }
-
- public void remove(String name, String email) {
- mMap.remove(AttendeeId.map(name, email));
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeRelationships.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeRelationships.java
deleted file mode 100644
index dc9239b..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeRelationships.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class AttendeeRelationships extends SelectList {
- public static final int ATTENDEE_RELATIONSHIP_ATTENDEE = Attendees.RELATIONSHIP_ATTENDEE;
- public static final int ATTENDEE_RELATIONSHIP_NONE = Attendees.RELATIONSHIP_NONE;
- public static final int ATTENDEE_RELATIONSHIP_ORGANIZER = Attendees.RELATIONSHIP_ORGANIZER;
- public static final int ATTENDEE_RELATIONSHIP_PERFORMER = Attendees.RELATIONSHIP_PERFORMER;
- public static final int ATTENDEE_RELATIONSHIP_SPEAKER = Attendees.RELATIONSHIP_SPEAKER;
-
- public static final int[] mKeys = new int[] { ATTENDEE_RELATIONSHIP_ATTENDEE, ATTENDEE_RELATIONSHIP_NONE,
- ATTENDEE_RELATIONSHIP_ORGANIZER, ATTENDEE_RELATIONSHIP_PERFORMER, ATTENDEE_RELATIONSHIP_SPEAKER };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.attendee_relationship_attendee),
- ClonerApp.translate(R.string.attendee_relationship_none),
- ClonerApp.translate(R.string.attendee_relationship_organizer),
- ClonerApp.translate(R.string.attendee_relationship_performer),
- ClonerApp.translate(R.string.attendee_relationship_speaker) };
-
- public AttendeeRelationships(boolean allSelected) {
- super(allSelected);
- }
-
- public AttendeeRelationships clone() {
- AttendeeRelationships other = new AttendeeRelationships(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeStatuses.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeStatuses.java
deleted file mode 100644
index 3dc7944..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeStatuses.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class AttendeeStatuses extends SelectList {
- public static final int ATTENDEE_STATUS_ACCEPTED = Attendees.ATTENDEE_STATUS_ACCEPTED;
- public static final int ATTENDEE_STATUS_DECLINED = Attendees.ATTENDEE_STATUS_DECLINED;
- public static final int ATTENDEE_STATUS_INVITED = Attendees.ATTENDEE_STATUS_INVITED;
- public static final int ATTENDEE_STATUS_NONE = Attendees.ATTENDEE_STATUS_NONE;
- public static final int ATTENDEE_STATUS_TENTATIVE = Attendees.ATTENDEE_STATUS_TENTATIVE;
-
- public static final int[] mKeys = new int[] { ATTENDEE_STATUS_NONE, ATTENDEE_STATUS_INVITED,
- ATTENDEE_STATUS_TENTATIVE, ATTENDEE_STATUS_ACCEPTED, ATTENDEE_STATUS_DECLINED };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.attendee_status_none),
- ClonerApp.translate(R.string.attendee_status_invited),
- ClonerApp.translate(R.string.attendee_status_tentative),
- ClonerApp.translate(R.string.attendee_status_accepted),
- ClonerApp.translate(R.string.attendee_status_declined) };
-
- public AttendeeStatuses(boolean allSelected) {
- super(allSelected);
- }
-
- public AttendeeStatuses clone() {
- AttendeeStatuses other = new AttendeeStatuses(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeTypes.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeTypes.java
deleted file mode 100644
index bca2e9a..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeeTypes.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class AttendeeTypes extends SelectList {
- public static final int ATTENDEE_TYPE_NONE = Attendees.TYPE_NONE;
- public static final int ATTENDEE_TYPE_OPTIONAL = Attendees.TYPE_OPTIONAL;
- public static final int ATTENDEE_TYPE_REQUIRED = Attendees.TYPE_REQUIRED;
-
- public static final int[] mKeys = new int[] { ATTENDEE_TYPE_NONE, ATTENDEE_TYPE_OPTIONAL, ATTENDEE_TYPE_REQUIRED };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.attendee_type_none),
- ClonerApp.translate(R.string.attendee_type_optional), ClonerApp.translate(R.string.attendee_type_required) };
-
- public AttendeeTypes(boolean allSelected) {
- super(allSelected);
- }
-
- public AttendeeTypes clone() {
- AttendeeTypes other = new AttendeeTypes(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeesTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeesTable.java
deleted file mode 100644
index ab0c3f5..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AttendeesTable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class AttendeesTable extends ClonerTable {
- // CalendarContract columns
- public Column _ID = new Column(Attendees._ID);
- public Column EVENT_ID = new Column(Attendees.EVENT_ID);
- public Column ATTENDEE_NAME = new Column(Attendees.ATTENDEE_NAME);
- public Column ATTENDEE_EMAIL = new Column(Attendees.ATTENDEE_EMAIL);
- public Column ATTENDEE_RELATIONSHIP = new Column(Attendees.ATTENDEE_RELATIONSHIP);
- public Column ATTENDEE_STATUS = new Column(Attendees.ATTENDEE_STATUS);
- public Column ATTENDEE_TYPE = new Column(Attendees.ATTENDEE_TYPE);
-
- public AttendeesTable(ClonerDb db) {
- super(db, Attendees.CONTENT_URI);
- // Add CalendarContract columns
- this.addColumn(_ID);
- this.addColumn(EVENT_ID);
- this.addColumn(ATTENDEE_NAME);
- this.addColumn(ATTENDEE_EMAIL);
- this.addColumn(ATTENDEE_RELATIONSHIP);
- this.addColumn(ATTENDEE_STATUS);
- this.addColumn(ATTENDEE_TYPE);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Availabilities.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Availabilities.java
deleted file mode 100644
index 63a2a33..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Availabilities.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Events;
-
-public class Availabilities extends SelectList {
- public static final int AVAILABILITY_FREE = Events.AVAILABILITY_FREE;
- public static final int AVAILABILITY_BUSY = Events.AVAILABILITY_BUSY;
- public static final int AVAILABILITY_TENTATIVE = 2;
- public static final int AVAILABILITY_OUT_OF_OFFICE = 3;
-
- private static final int[] mKeys = new int[] { AVAILABILITY_FREE, AVAILABILITY_TENTATIVE, AVAILABILITY_BUSY };
- private static final int[] mKeysSamsung = new int[] { AVAILABILITY_FREE, AVAILABILITY_TENTATIVE, AVAILABILITY_BUSY,
- AVAILABILITY_OUT_OF_OFFICE };
-
- private static final String[] mNames = new String[] { ClonerApp.translate(R.string.availability_free),
- ClonerApp.translate(R.string.availability_tentative), ClonerApp.translate(R.string.availability_busy), };
- private static final String[] mNamesSamsung = new String[] { ClonerApp.translate(R.string.availability_free),
- ClonerApp.translate(R.string.availability_tentative), ClonerApp.translate(R.string.availability_busy),
- ClonerApp.translate(R.string.availability_out_of_office) };
-
- public Availabilities(boolean allSelected) {
- super(allSelected);
- }
-
- public Availabilities clone() {
- Availabilities other = new Availabilities(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- if (ClonerApp.getDevice().supportsAvailabilitySamsung()) {
- this.init(mKeysSamsung, mNamesSamsung);
- } else {
- this.init(mKeys, mNames);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AvailabilitiesSamsung.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AvailabilitiesSamsung.java
deleted file mode 100644
index 32c7217..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/AvailabilitiesSamsung.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class AvailabilitiesSamsung extends SelectList {
- public static final int AVAILABILITY_FREE = Device.Samsung.AVAILABILITY_FREE;
- public static final int AVAILABILITY_BUSY = Device.Samsung.AVAILABILITY_BUSY;
- public static final int AVAILABILITY_TENTATIVE = Device.Samsung.AVAILABILITY_TENTATIVE;
- public static final int AVAILABILITY_OUT_OF_OFFICE = Device.Samsung.AVAILABILITY_OUT_OF_OFFICE;
-
- public static final int[] mKeys = new int[] { AVAILABILITY_FREE, AVAILABILITY_TENTATIVE, AVAILABILITY_BUSY,
- AVAILABILITY_OUT_OF_OFFICE };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.availability_free),
- ClonerApp.translate(R.string.availability_tentative), ClonerApp.translate(R.string.availability_busy),
- ClonerApp.translate(R.string.availability_out_of_office) };
-
- public AvailabilitiesSamsung(boolean allSelected) {
- super(allSelected);
- }
-
- public Availabilities clone() {
- Availabilities other = new Availabilities(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/BrowseActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/BrowseActivity.java
deleted file mode 100644
index 079e909..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/BrowseActivity.java
+++ /dev/null
@@ -1,486 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.LoaderManager.LoaderCallbacks;
-import android.content.Context;
-import android.content.Intent;
-import android.content.Loader;
-import android.database.Cursor;
-import android.os.Bundle;
-import android.provider.CalendarContract.Events;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnCreateContextMenuListener;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.CursorAdapter;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-public class BrowseActivity extends Activity implements LoaderCallbacks {
- List mCalendarRefs = CalendarLoader.getValidRefs();
- CalendarsTable mCalendarsTable = new CalendarsTable(ClonerApp.getDb(true));
- EventsTable mEventsTable = new EventsTable(ClonerApp.getDb(true));
-
- CursorAdapter mAdapter;
- long mRowCount = 0;
-
- Spinner mSearchCloneSourceView;
-
- static final int SEARCH_ALL_EVENTS = 0;
- static final int SEARCH_ONLY_NORMAL = 1;
- static final int SEARCH_ONLY_CLONES = 2;
-
- long mSearchCalendarId = -1;
- String mSearchFilter = "";
- int mSearchEventType = SEARCH_ALL_EVENTS;
- Rule mSearchCloneSourceRule = null;
-
- String mDuplicatesSelection = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.browseactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
-
- final EditText searchFilterView = (EditText) findViewById(R.id.searchKey);
- final Spinner searchCalendarView = (Spinner) findViewById(R.id.searchCalendar);
- final Spinner searchEventTypeView = (Spinner) findViewById(R.id.searchEventType);
- mSearchCloneSourceView = (Spinner) findViewById(R.id.searchCloneSourceCalendar);
-
- Bundle params = this.getIntent().getExtras();
- if (params == null || !params.containsKey("duplicatesSelection")) {
- this.getActionBar().setTitle(R.string.browse_activity_title);
-
- // Prepare the calendar adapter
- String[] calNames = new String[mCalendarRefs.size() + 1];
- calNames[0] = ClonerApp.translate(R.string.browse_all_calendars);
- for (int index = 0; index < mCalendarRefs.size(); index++) {
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mCalendarRefs.get(index));
- if (info.getCalendar() != null) {
- calNames[index + 1] = info.getCalendar().getDisplayName();
- } else {
- calNames[index + 1] = "###";
- }
- }
- ArrayAdapter calendarAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item,
- calNames);
- calendarAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
- searchCalendarView.setAdapter(calendarAdapter);
- searchCalendarView.setSelection(0);
- searchCalendarView.setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> view, View item, int position, long id) {
- if (position > 0) {
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mCalendarRefs
- .get(position - 1));
- if (info.getCalendar() != null) {
- mSearchCalendarId = info.getCalendar().getId();
- } else {
- mSearchCalendarId = -1;
- }
- } else {
- mSearchCalendarId = -1;
- }
- updateQuery();
- }
-
- @Override
- public void onNothingSelected(AdapterView> arg0) {
- mSearchCalendarId = -1;
- updateQuery();
- }
- });
-
- // Prepare the search filter
- searchFilterView.addTextChangedListener(new TextWatcher() {
- @Override
- public void afterTextChanged(Editable arg0) {
- mSearchFilter = arg0.toString();
- updateQuery();
- }
-
- @Override
- public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
- }
-
- @Override
- public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
- }
- });
-
- // Prepare the event type filter
- String[] eventTypes = new String[] { ClonerApp.translate(R.string.browse_type_all_events),
- ClonerApp.translate(R.string.browse_type_originals),
- ClonerApp.translate(R.string.browse_type_clones_only) };
- ArrayAdapter eventTypeAdapter = new ArrayAdapter(this,
- android.R.layout.simple_spinner_item, eventTypes);
- eventTypeAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
- searchEventTypeView.setAdapter(eventTypeAdapter);
- searchEventTypeView.setSelection(0);
- searchEventTypeView.setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> view, View item, int position, long id) {
- mSearchEventType = position;
- updateQuery();
- }
-
- @Override
- public void onNothingSelected(AdapterView> arg0) {
- mSearchCalendarId = -1;
- updateQuery();
- }
- });
-
- Button clear = (Button) findViewById(R.id.clearSearchKey);
- clear.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View arg0) {
- searchFilterView.setText("");
- }
- });
-
- final Settings settings = ClonerApp.getSettings();
- String[] ruleNames = new String[settings.getNumberOfRules() + 1];
- ruleNames[0] = ClonerApp.translate(R.string.browse_all_rules);
- for (int index = 0; index < settings.getNumberOfRules(); index++) {
- ruleNames[index + 1] = settings.getRule(index).getName();
- }
- // Prepare the source rule filter
- ArrayAdapter ruleAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item,
- ruleNames);
- ruleAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
- mSearchCloneSourceView.setAdapter(ruleAdapter);
- mSearchCloneSourceView.setSelection(0);
- mSearchCloneSourceView.setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> view, View item, int position, long id) {
- if (position > 0) {
- mSearchCloneSourceRule = settings.getRule(position - 1);
- } else {
- mSearchCloneSourceRule = null;
- }
- updateQuery();
- }
-
- @Override
- public void onNothingSelected(AdapterView> arg0) {
- mSearchCloneSourceRule = null;
- updateQuery();
- }
- });
- } else {
- // Initialize for the viewing of duplicate events
- this.getActionBar().setTitle(R.string.duplicates_view_title);
- mDuplicatesSelection = params.getString("duplicatesSelection");
- View filters = findViewById(R.id.search_filters);
- filters.setVisibility(View.GONE);
- }
-
- final LayoutInflater inflater = LayoutInflater.from(this);
- ListView lv = (ListView) findViewById(R.id.eventList);
- mAdapter = new CursorAdapter(this, null, 0) {
- @Override
- public void bindView(View view, Context context, Cursor cur) {
- ImageView recurringIcon = (ImageView) view.findViewById(R.id.eventRecurring);
- ImageView exceptionIcon = (ImageView) view.findViewById(R.id.eventException);
- ImageView singleIcon = (ImageView) view.findViewById(R.id.eventSingle);
- ImageView trashcanIcon = (ImageView) view.findViewById(R.id.trashcan);
-
- TextView title = (TextView) view.findViewById(R.id.title);
- TextView subline1 = (TextView) view.findViewById(R.id.subline1);
- TextView subline2 = (TextView) view.findViewById(R.id.subline2);
- Event event = new DbEvent(mEventsTable, new DbObject(cur));
-
- recurringIcon.setVisibility(event.isRecurringEvent() ? View.VISIBLE : View.GONE);
- exceptionIcon.setVisibility(event.isRecurringEventException() ? View.VISIBLE : View.GONE);
- singleIcon.setVisibility(!event.isRecurringEvent() && !event.isRecurringEventException() ? View.VISIBLE
- : View.GONE);
- trashcanIcon.setVisibility(event.isDeleted() ? View.VISIBLE : View.GONE);
-
- String calendarName = CalendarLoader.getCalendarNameOrErrorMessage(event.getCalendarId());
- title.setText(event.getTitle());
- String originalStartTime = event.isRecurringEventException() ? " (from: "
- + Utilities.dateTimeToString(event.getOriginalInstanceTime()) + ")" : "";
- subline1.setText(event.getId() + " " + calendarName + " "
- + Utilities.dateTimeToString(event.getStartTime()) + originalStartTime);
- if (event.getLocation() != null) {
- subline2.setText(event.getLocation());
- } else {
- subline2.setText("");
- }
- }
-
- @Override
- public View newView(Context context, Cursor cur, ViewGroup parent) {
- return inflater.inflate(R.layout.eventrow_layout, parent, false);
- }
- };
-
- lv.setAdapter(mAdapter);
- lv.setOnItemClickListener(new OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> view, View item, int position, long id) {
- Event event = DbEvent.get(mEventsTable, id);
- if (event != null) {
- ClonerLog log = new LogMemory(event.getTitle(), ClonerLog.TYPE_EXTENDED);
- logEvent(log, event, event.getTitle());
-
- List clones = getClonesOf(event);
- if (clones.size() > 0) {
- // Add empty line
- log.log(log.createLogLine(ClonerLog.LOG_INFO, null, ""), null);
- }
- for (Event clone : clones) {
- String ruleHash = null;
- EventMarker.Marker marker = EventMarker.parseCloneEventHash(clone);
- if (marker != null) {
- ruleHash = marker.ruleHash;
- }
- String ruleName = ruleHash != null ? findRule(ruleHash, clone.getCalendarId()) : "";
- if (!ruleName.contentEquals("")) {
- ruleName = " (" + ruleName + ")";
- }
- logEvent(log, clone, ClonerApp.translate(R.string.cloner_log_cloned_event) + ruleName + ": "
- + clone.getTitle());
- }
-
- ClonerApp.setParameter("log", log);
- Intent i = new Intent(BrowseActivity.this, LogActivity.class);
- i.putExtra("expand", true);
- i.putExtra("uselevel", false);
- i.putExtra("title", ClonerApp.translate(R.string.browse_event_details));
- i.putExtra("displayHeader", false);
- startActivity(i);
- }
- }
- });
- lv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
- @Override
- public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
- final ListView.AdapterContextMenuInfo info = (ListView.AdapterContextMenuInfo) menuInfo;
-
- MenuItem mi = menu.add(ClonerApp.translate(R.string.browse_delete_event));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- long eventId = info.id;
- getContentResolver().delete(Events.CONTENT_URI, "((" + Events._ID + "=?))",
- new String[] { "" + eventId });
- updateQuery();
- return false;
- }
- });
- }
- });
-
- getLoaderManager().initLoader(0, null, this);
- }
-
- private List getClonesOf(Event event) {
- List result = new LinkedList();
- List args = new LinkedList();
- String selection = EventMarker.buildDbSelect(EventMarker.TYPE_CLONE, null, Hasher.hash(event.getUniqueId()),
- args);
- Cursor cur = mEventsTable.query(selection, args.toArray(new String[args.size()]), null);
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- DbEvent clone = new DbEvent(mEventsTable, new DbObject(cur));
- clone.loadAll();
- result.add(clone);
- }
- } finally {
- cur.close();
- }
- }
- return result;
- }
-
- private String findRule(String ruleHash, long calendarId) {
- String result = "";
- Settings settings = ClonerApp.getSettings();
- for (int index = 0; index < settings.getNumberOfRules(); index++) {
- Rule rule = settings.getRule(index);
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(rule.getDstCalendarRef());
- if (info.getCalendar() != null && info.getCalendar().getId() == calendarId) {
- if (rule.getHash().contentEquals(ruleHash)) {
- if (!result.contentEquals("")) {
- result += ", ";
- }
- result += rule.getName();
- }
- }
- }
- return result;
- }
-
- private void logEvent(ClonerLog log, Event event, String title) {
- LogLines logLines = log.createLogLines();
- if (logLines != null) {
- logLines.logEvent(event);
- List atts = DbAttendee.getByEvent(new AttendeesTable(ClonerApp.getDb(true)), event.getId());
- if (atts.size() > 0) {
- logLines.addEmptyLine();
- logLines.logAttendees(ClonerLog.LOG_INFO, atts);
- }
- List rems = DbReminder.getReminders(new RemindersTable(ClonerApp.getDb(true)), event.getId());
- if (rems.size() > 0) {
- logLines.addEmptyLine();
- logLines.logReminders(ClonerLog.LOG_INFO, rems, null, null);
- }
- }
- LogLine summary = log.createLogLine(ClonerLog.LOG_INFO, null, title);
- log.log(summary, logLines);
- }
-
- private void updateQuery() {
- mSearchCloneSourceView.setEnabled(mSearchEventType != SEARCH_ALL_EVENTS
- && mSearchEventType != SEARCH_ONLY_NORMAL);
- getLoaderManager().restartLoader(0, null, this);
- }
-
- private class QueryParams {
- String selection = "";
- ArrayList args = new ArrayList();
- }
-
- private QueryParams getQueryParams() {
- QueryParams result = new QueryParams();
- if (mDuplicatesSelection == null) {
- result.selection = "";
- if (!mSearchFilter.contentEquals("")) {
- if (!result.selection.contentEquals("")) {
- result.selection += " AND ";
- }
- result.selection += "(" + Events._ID + "=? OR " + Events.TITLE + " LIKE ? OR " + Events.EVENT_LOCATION
- + " LIKE ? OR " + Events.DESCRIPTION + " LIKE ? OR " + Events.ORIGINAL_ID + " LIKE ?)";
- result.args.add(mSearchFilter);
- result.args.add("%" + mSearchFilter + "%");
- result.args.add("%" + mSearchFilter + "%");
- result.args.add("%" + mSearchFilter + "%");
- result.args.add("%" + mSearchFilter + "%");
- }
- if (mSearchCalendarId >= 0) {
- if (!result.selection.contentEquals("")) {
- result.selection += " AND ";
- }
- result.selection += Events.CALENDAR_ID + " = ?";
- result.args.add("" + mSearchCalendarId);
- }
- if (mSearchEventType == SEARCH_ONLY_NORMAL) {
- if (!result.selection.contentEquals("")) {
- result.selection += " AND ";
- }
- result.selection += EventMarker.buildDbSelect(EventMarker.TYPE_NORMAL, null, null, result.args);
- }
-
- // For all other types we need the ruleHash
- String ruleHash = mSearchCloneSourceRule != null ? mSearchCloneSourceRule.getHash() : null;
- if (mSearchEventType == SEARCH_ONLY_CLONES) {
- if (!result.selection.contentEquals("")) {
- result.selection += " AND ";
- }
- result.selection += EventMarker.buildDbSelect(EventMarker.TYPE_CLONE, ruleHash, null, result.args);
- }
- } else {
- result.selection = mDuplicatesSelection;
- }
- return result;
- }
-
- @Override
- public Loader onCreateLoader(int arg0, Bundle arg1) {
- QueryParams query = this.getQueryParams();
- return mEventsTable.getLoader(this, query.selection, query.args.toArray(new String[query.args.size()]),
- Events.DTSTART + " ASC, " + Events.ORIGINAL_INSTANCE_TIME + " ASC");
- }
-
- @Override
- public void onLoadFinished(Loader loader, Cursor data) {
- mAdapter.swapCursor(data);
- if (data != null) {
- mRowCount = data.getCount();
- TextView counter = (TextView) findViewById(R.id.searchCount);
- counter.setText(ClonerApp.translate(R.string.browse_textview_event_count, new String[] { "" + mRowCount }));
- }
- }
-
- @Override
- public void onLoaderReset(Loader loader) {
- mAdapter.swapCursor(null);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuItem mi = menu.add(ClonerApp.translate(R.string.browse_menu_delete_all_events));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- QueryParams query = getQueryParams();
- EventRemover remover = new EventRemover();
- remover.init(null, query.selection, query.args,
- ClonerApp.translate(R.string.browse_menu_delete_all_events_title),
- ClonerApp.translate(R.string.ask_delete_n_events, new String[] { "" + mRowCount }));
- remover.setOnDoneListener(new EventRemover.OnDoneListener() {
- @Override
- public void onDone(boolean removed, boolean success, long removeCount, String errorMessage) {
- AlertDialog.Builder builder = new AlertDialog.Builder(BrowseActivity.this);
- if (removed) {
- if (success) {
- builder.setTitle(
- ClonerApp.translate(R.string.msg_events_deleted, new String[] { ""
- + removeCount }))
- .setMessage(ClonerApp.translate(R.string.msg_events_deleted_info))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true)
- .show();
- } else {
- builder.setTitle(ClonerApp.translate(R.string.error_deleting_events))
- .setMessage(errorMessage)
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true)
- .show();
- }
- }
- }
- });
- remover.execute(BrowseActivity.this);
- return true;
- }
- });
- return true;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarChangedReceiver.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarChangedReceiver.java
deleted file mode 100644
index eada23b..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarChangedReceiver.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Handler;
-
-public class CalendarChangedReceiver extends BroadcastReceiver {
- private static Handler mHandler = null;
- private static Runnable mRunnable = null;
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (mHandler != null && mRunnable != null) {
- mHandler.post(mRunnable);
- }
- }
-
- public static void setCallback(Handler handler, Runnable runnable) {
- mHandler = handler;
- mRunnable = runnable;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarLoader.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarLoader.java
deleted file mode 100644
index 2f1fd8c..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarLoader.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.annotation.SuppressLint;
-import android.database.Cursor;
-import android.provider.CalendarContract.Calendars;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-@SuppressLint("UseSparseArrays")
-public class CalendarLoader {
- private static Map mCalendars = new HashMap();
- private static Map mCalendarInfoByRef = new HashMap();
- private static CalendarsTable mCalendarsTable = new CalendarsTable(ClonerApp.getDb(true));
- private static long mLastReloadTime = 0;
-
- public static final int CALENDAR_LOADED = 0;
- public static final int CALENDAR_NOT_FOUND = 1;
- public static final int CALENDAR_NOT_SET_UP = 2;
- public static final int CALENDAR_REF_AMBIGUOUS = 3;
-
- public static class CalendarInfo {
- private DbCalendar mCalendar = null;
- private int mError = CALENDAR_LOADED;
-
- public DbCalendar getCalendar() {
- return mCalendar;
- }
-
- public int getError() {
- return mError;
- }
- }
-
- private static final Map loadAll() {
- Map calendars = new HashMap();
- Cursor cur = mCalendarsTable.query(null, null, Calendars.CALENDAR_DISPLAY_NAME + " ASC, "
- + Calendars.ACCOUNT_NAME + " ASC, " + Calendars.ACCOUNT_TYPE + " ASC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- DbCalendar cal = new DbCalendar(mCalendarsTable, new DbObject(cur));
- cal.loadAll();
- calendars.put(cal.getId(), cal);
- }
- } finally {
- cur.close();
- }
- }
- return calendars;
- }
-
- private static void reloadIfNecessary() {
- if (System.currentTimeMillis() - mLastReloadTime > 60 * 1000) {
- mCalendars = loadAll();
- mCalendarInfoByRef.clear();
-
- for (Entry entry : mCalendars.entrySet()) {
- DbCalendar cal = entry.getValue();
- if (!mCalendarInfoByRef.containsKey(cal.getRef())) {
- CalendarInfo info = new CalendarInfo();
- info.mCalendar = cal;
- mCalendarInfoByRef.put(cal.getRef(), info);
- } else {
- CalendarInfo info = mCalendarInfoByRef.get(cal.getRef());
- info.mCalendar = null;
- info.mError = CALENDAR_REF_AMBIGUOUS;
- }
- }
- mLastReloadTime = System.currentTimeMillis();
- }
- }
-
- public static CalendarInfo getCalendarByRef(String ref) {
- if (ref != null && !ref.contentEquals("")) {
- reloadIfNecessary();
- if (mCalendarInfoByRef.containsKey(ref)) {
- return mCalendarInfoByRef.get(ref);
- }
-
- CalendarInfo info = new CalendarInfo();
- info.mError = CALENDAR_NOT_FOUND;
- return info;
- }
-
- CalendarInfo info = new CalendarInfo();
- info.mError = CALENDAR_NOT_SET_UP;
- return info;
- }
-
- public static DbCalendar getCalendar(long calendarId) {
- return mCalendars.get(calendarId);
- }
-
- public static String getCalendarNameOrErrorMessage(long calendarId) {
- reloadIfNecessary();
- if (mCalendars.containsKey(calendarId)) {
- return mCalendars.get(calendarId).getDisplayName();
- }
- return ClonerApp.translate(R.string.error_calendar_x_not_found,
- new String[] { ClonerApp.translate(R.string.calendar_generic) });
- }
-
- public static String getErrorString(int error, String calendar) {
- switch (error) {
- case CALENDAR_NOT_FOUND:
- return ClonerApp.translate(R.string.error_calendar_x_not_found, new String[] { calendar });
- case CALENDAR_NOT_SET_UP:
- return ClonerApp.translate(R.string.error_calendar_x_not_set, new String[] { calendar });
- case CALENDAR_REF_AMBIGUOUS:
- return ClonerApp.translate(R.string.error_duplicate_calendar_name, new String[] { calendar });
- }
- return "";
- }
-
- public static List getValidRefs() {
- reloadIfNecessary();
- List refs = new ArrayList();
- for (Entry entry : mCalendars.entrySet()) {
- DbCalendar cal = entry.getValue();
- CalendarInfo info = mCalendarInfoByRef.get(cal.getRef());
- if (info.mCalendar != null) {
- refs.add(cal.getRef());
- }
- }
- return refs;
- }
-
- public static String guessCalendarRefByUri(String uri) {
- reloadIfNecessary();
- for (Entry entry : mCalendars.entrySet()) {
- DbCalendar cal = entry.getValue();
- if (mCalendarInfoByRef.get(cal.getRef()).mCalendar == cal) {
- String ref = cal.getRef();
- if (ref.contentEquals(uri)) {
- return cal.getRef();
- }
- }
- }
- return "";
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarsTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarsTable.java
deleted file mode 100644
index 99d5977..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CalendarsTable.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Calendars;
-
-public class CalendarsTable extends ClonerTable {
- // CalendarContract columns
- public Column _ID = new Column(Calendars._ID);
- public Column NAME = new Column(Calendars.NAME);
- public Column CALENDAR_DISPLAY_NAME = new Column(Calendars.CALENDAR_DISPLAY_NAME);
- public Column CALENDAR_TIME_ZONE = new Column(Calendars.CALENDAR_TIME_ZONE);
- public Column ACCOUNT_NAME = new Column(Calendars.ACCOUNT_NAME);
- public Column ACCOUNT_TYPE = new Column(Calendars.ACCOUNT_TYPE);
- public Column OWNER_ACCOUNT = new Column(Calendars.OWNER_ACCOUNT);
- public Column CALENDAR_ACCESS_LEVEL = new Column(Calendars.CALENDAR_ACCESS_LEVEL);
- public Column SYNC_EVENTS = new Column(Calendars.SYNC_EVENTS);
- public Column VISIBLE = new Column(Calendars.VISIBLE);
- public Column CAN_ORGANIZER_RESPOND = new Column(Calendars.CAN_ORGANIZER_RESPOND);
- public Column ALLOWED_REMINDERS = new Column(Calendars.ALLOWED_REMINDERS);
- public Column MAX_REMINDERS = new Column(Calendars.MAX_REMINDERS);
- public Column CAL_SYNC1 = new Column(Calendars.CAL_SYNC1);
-
- public CalendarsTable(ClonerDb db) {
- super(db, Calendars.CONTENT_URI);
- // Add CalendarContract columns
- this.addColumn(_ID);
- this.addColumn(NAME);
- this.addColumn(CALENDAR_DISPLAY_NAME);
- this.addColumn(CALENDAR_TIME_ZONE);
- this.addColumn(ACCOUNT_NAME);
- this.addColumn(ACCOUNT_TYPE);
- this.addColumn(OWNER_ACCOUNT);
- this.addColumn(CALENDAR_ACCESS_LEVEL);
- this.addColumn(SYNC_EVENTS);
- this.addColumn(VISIBLE);
- this.addColumn(CAN_ORGANIZER_RESPOND);
- this.addColumn(ALLOWED_REMINDERS);
- this.addColumn(MAX_REMINDERS);
- this.addColumn(CAL_SYNC1);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIdIndex.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIdIndex.java
deleted file mode 100644
index ad6e467..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIdIndex.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-public class CloneIdIndex {
- private Set mCloneIds = new HashSet();
- private Map mEventHashes = new HashMap();
-
- public void add(Event event, long cloneId) {
- if (cloneId != 0) {
- mCloneIds.add(cloneId);
- String eventHash = EventMarker.getEventHash(event.getUniqueId());
- mEventHashes.put(eventHash, cloneId);
- }
- }
-
- public boolean containsId(long id) {
- return mCloneIds.contains(id);
- }
-
- public boolean containsHash(String eventHash) {
- return mEventHashes.containsKey(eventHash);
- }
-
- public long getCloneId(String eventHash) {
- return mEventHashes.get(eventHash);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIndex.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIndex.java
deleted file mode 100644
index 1cefb3e..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneIndex.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import android.database.Cursor;
-
-public class CloneIndex {
- private final EventsTable mEventsTable;
- private final HashMap mIndex = new HashMap();
- private String mRuleHash;
- private String mRuleBackupHash;
-
- public class IndexResult {
- private final boolean mSuccess;
- private final String mErrorMessage;
- private final int mUpdateCount;
-
- public IndexResult(boolean success, String errorMessage, int updateCount) {
- mSuccess = success;
- mErrorMessage = errorMessage;
- mUpdateCount = updateCount;
- }
-
- public boolean isSuccess() {
- return mSuccess;
- }
-
- public String getErrorMessage() {
- return mErrorMessage;
- }
-
- public int getUpdateCount() {
- return mUpdateCount;
- }
- }
-
- public CloneIndex(EventsTable eventsTable) {
- mEventsTable = eventsTable;
- }
-
- protected boolean matchRuleHash(String ruleHash) {
- // Event marked by rule id
- if (mRuleHash.contentEquals(ruleHash)) {
- return true;
- }
-
- // Event marked by source calendar ref
- if (mRuleBackupHash != null && !mRuleBackupHash.contentEquals("") && mRuleBackupHash.contentEquals(ruleHash)) {
- return true;
- }
-
- // The rulehash did not stem from the rule
- return false;
- }
-
- protected String parseEventHash(Event clone) {
- EventMarker.Marker marker = EventMarker.parseCloneEventHash(clone);
- if (marker != null && this.matchRuleHash(marker.ruleHash)) {
- return marker.eventHash;
- }
- return null;
- }
-
- public IndexResult index(long calendarId, String ruleHash, String ruleBackupHash, ClonerLog log) {
- mRuleHash = ruleHash;
- mRuleBackupHash = ruleBackupHash;
- // Set up an events table for projection of just id and description
- EventsTable clonesTable = new EventsTable(ClonerApp.getDb(true));
- // Keep track of events to delete (duplicate clones)
- LinkedList deleteClones = new LinkedList();
- // Add title for verbose logging in rule log screen
- clonesTable.setProjection(new ClonerTable.Column[] { clonesTable._ID, clonesTable.CALENDAR_ID,
- clonesTable.DELETED, clonesTable.DESCRIPTION, clonesTable.ALL_DAY, clonesTable.DTSTART,
- clonesTable.EVENT_TIMEZONE, clonesTable.TITLE });
- // Query for all events in the destination calendar
- Cursor cloneCur = clonesTable.query("((" + clonesTable.CALENDAR_ID.getName() + "=?))", new String[] { ""
- + calendarId }, null);
-
- if (cloneCur == null) {
- return new IndexResult(false, ClonerApp.translate(R.string.error_calendar_x_not_accessible,
- new String[] { ClonerApp.translate(R.string.calendar_destination) }), 0);
- }
- try {
- while (cloneCur.moveToNext()) {
- DbEvent clone = new DbEvent(clonesTable, new DbObject(cloneCur));
- if (!clone.isDeleted()) {
- String eventHash = this.parseEventHash(clone);
- if (eventHash != null) {
- // Load existing clone's values from the cursor
- clone.loadAll();
- if (!mIndex.containsKey(eventHash)) {
- // Add to list of existing clones for quick
- // lookup during cloning process
- mIndex.put(eventHash, clone);
- } else {
- // If we reach this point, we found a duplicate
- // "CloneOf:" string. We delete the clone
- // immediately since it can interfere with the sync
- // process.
- deleteClones.add(clone);
- }
- }
- }
- }
- } finally {
- cloneCur.close();
- }
-
- // Delete all duplicate clones (without interfering with a cursor)
- int eventNr = 0;
- int updateCount = 0;
- for (Event clone : deleteClones) {
- if (Limits.canModify(Limits.TYPE_EVENT)) {
- if (clone.isRecurringEventException()) {
- mEventsTable.delete(clone.getOriginalID());
- }
- mEventsTable.delete(clone.getId());
- String title = Utilities.dateTimeToString(clone.getStartTime()) + " - " + clone.getTitle();
- log.log(log.createLogLine(ClonerLog.LOG_UPDATE, "" + ++eventNr,
- ClonerApp.translate(R.string.cloner_log_deleted), title), null);
- updateCount++;
- }
- }
-
- return new IndexResult(true, "", updateCount);
- }
-
- public boolean containsClone(String eventHash) {
- return mIndex.containsKey(eventHash);
- }
-
- public Event getCloneOf(Event event) {
- final String eventHash = EventMarker.getEventHash(event.getUniqueId());
- if (mIndex.containsKey(eventHash)) {
- return DbEvent.get(mEventsTable, mIndex.get(eventHash).getId());
- }
- return null;
- }
-
- public Set getAllClones() {
- Set result = new HashSet();
- Set> clones = mIndex.entrySet();
- for (Entry entry : clones) {
- result.add(entry.getValue());
- }
- return result;
- }
-
- public void removeClone(String eventHash) {
- mIndex.remove(eventHash);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneRemover.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneRemover.java
deleted file mode 100644
index 63fde1c..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CloneRemover.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-
-public class CloneRemover extends EventRemover {
-
- public void init(Rule rule, String question) {
- String calRef = rule.getDstCalendarRef();
- String selection;
- ArrayList args = new ArrayList();
- // Default: remove all clones from the destination calendar
- selection = EventMarker.buildDbSelect(EventMarker.TYPE_CLONE, rule.getHash(), null, args);
-
- super.init(calRef, selection, args, rule.getName(), question);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeOther.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeOther.java
deleted file mode 100644
index f33e9af..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeOther.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class ClonedAttendeeOther extends ProxyAttendee {
- private final boolean mDummyEmail;
- private final String mDummyEmailDomain;
-
- public ClonedAttendeeOther(Attendee source, boolean dummyEmail, String dummyEmailDomain) {
- super(source);
- mDummyEmail = dummyEmail;
- mDummyEmailDomain = dummyEmailDomain;
- }
-
- @Override
- public String getEmail() {
- if (mDummyEmail) {
- return EmailObfuscator.generateDummyEmailFrom(super.getEmail(), mDummyEmailDomain);
- }
- return super.getEmail();
- }
-
- @Override
- public int getRelationship() {
- int relationship = super.getRelationship();
- if (relationship == Attendees.RELATIONSHIP_ORGANIZER) {
- relationship = Attendees.RELATIONSHIP_ATTENDEE;
- }
- return relationship;
- }
-
- @Override
- public int getStatus() {
- int status = super.getStatus();
- if (status == Attendees.ATTENDEE_STATUS_NONE) {
- status = Attendees.ATTENDEE_STATUS_INVITED;
- }
- return status;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeSelf.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeSelf.java
deleted file mode 100644
index ede2c87..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedAttendeeSelf.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class ClonedAttendeeSelf extends ProxyAttendee {
- private String mSelfDisplayName;
- private String mSelfEmail;
- private boolean mSelfOrganizer;
- private boolean mCloneAttendeeStatus;
- private boolean mResetStatus;
-
- public ClonedAttendeeSelf(Attendee source, String selfDisplayName, String selfEmail, boolean selfOrganizer,
- boolean cloneAttendeeStatus, boolean resetStatus) {
- super(source);
- mSelfDisplayName = selfDisplayName;
- mSelfEmail = selfEmail;
- mSelfOrganizer = selfOrganizer;
- mCloneAttendeeStatus = cloneAttendeeStatus;
- mResetStatus = resetStatus;
- }
-
- @Override
- public String getName() {
- if (mSelfDisplayName == null || mSelfDisplayName.contentEquals("")) {
- return ClonerApp.translate(R.string.msg_you);
- }
- return mSelfDisplayName;
- }
-
- @Override
- public String getEmail() {
- return mSelfEmail;
- }
-
- @Override
- public int getRelationship() {
- return Attendees.RELATIONSHIP_ORGANIZER;
- }
-
- @Override
- public int getStatus() {
- int attendeeStatus = mCloneAttendeeStatus ? super.getStatus() : Attendees.ATTENDEE_STATUS_ACCEPTED;
-
- if (!mSelfOrganizer) {
- // Convert NONE to INVITED
- if (attendeeStatus == Attendees.ATTENDEE_STATUS_NONE) {
- attendeeStatus = Attendees.ATTENDEE_STATUS_INVITED;
- }
- // Reset status (e.g. when times of the original event changed)
- if (mResetStatus) {
- attendeeStatus = Attendees.ATTENDEE_STATUS_INVITED;
- }
- } else {
- // Convert NONE to ACCEPTED
- if (attendeeStatus == Attendees.ATTENDEE_STATUS_NONE) {
- attendeeStatus = Attendees.ATTENDEE_STATUS_ACCEPTED;
- }
- // Reset status (e.g. when times of the original event changed)
- if (mResetStatus) {
- attendeeStatus = Attendees.ATTENDEE_STATUS_ACCEPTED;
- }
- }
- return attendeeStatus;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedEvent.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedEvent.java
deleted file mode 100644
index 298cbeb..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonedEvent.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.joda.time.DateTime;
-
-import android.provider.CalendarContract.Attendees;
-import android.provider.CalendarContract.Events;
-
-public class ClonedEvent extends ProxyEvent {
- private final static long ONE_MINUTE = 60 * 1000;
- private final Rule mRule;
- private final AttendeesTable mAttendeesTable = new AttendeesTable(ClonerApp.getDb(true));
-
- public ClonedEvent(Event source, Rule rule) {
- super(source);
- mRule = rule;
- }
-
- @Override
- public String getTitle() {
- // Clone the event's title
- if (!mRule.getCloneTitle()) {
- return mRule.getCustomTitle();
- }
- return super.getTitle();
- }
-
- @Override
- public String getLocation() {
- // Clone the event's location
- if (!mRule.getCloneLocation()) {
- return mRule.getCustomLocation();
- }
- return super.getLocation();
- }
-
- protected String getRelationshipsString(List attendees, int relationship, String indent) {
- String result = "";
- final int MAXNAMES = 15;
- int maxNames = MAXNAMES;
-
- Iterator iterator = attendees.iterator();
- while (iterator.hasNext() && maxNames-- > 0) {
- DbAttendee att = iterator.next();
- if (att.getRelationship() == relationship) {
- if (att.getName() != null) {
- result += indent + att.getName() + " <" + att.getEmail() + ">\n";
- } else {
- result += indent + att.getEmail() + "\n";
- }
- }
- }
- int remaining = 0;
- while (iterator.hasNext()) {
- DbAttendee att = iterator.next();
- if (att.getRelationship() == relationship) {
- remaining++;
- }
- }
- if (remaining > 0) {
- result += indent + ClonerApp.translate(R.string.clonedevent_andmore, new String[] { "" + remaining })
- + "\n";
- }
- return result;
- }
-
- protected String headerString(String header, String content) {
- if (!content.contentEquals("")) {
- return header + "\n" + content;
- }
- return "";
- }
-
- protected String getAttendeesString(long eventId) {
- List attendees = DbAttendee.getByEvent(mAttendeesTable, eventId);
- String result = headerString(ClonerApp.translate(R.string.relationship_organizer) + ":",
- getRelationshipsString(attendees, Attendees.RELATIONSHIP_ORGANIZER, " "));
- result += headerString(
- "",
- headerString(ClonerApp.translate(R.string.relationship_speakers) + ":",
- getRelationshipsString(attendees, Attendees.RELATIONSHIP_SPEAKER, " ")));
- result += headerString(
- "",
- headerString(ClonerApp.translate(R.string.relationship_performers) + ":",
- getRelationshipsString(attendees, Attendees.RELATIONSHIP_PERFORMER, " ")));
- result += headerString(
- "",
- headerString(ClonerApp.translate(R.string.relationship_attendees) + ":",
- getRelationshipsString(attendees, Attendees.RELATIONSHIP_ATTENDEE, " ")));
- return result;
- }
-
- public String markEventDescription(String descr, Event event) {
- return EventMarker.markEventDescription(descr, EventMarker.TYPE_CLONE, mRule.getHash(), event.getUniqueId());
- }
-
- @Override
- public String getDescription() {
- // Clone the event's description and append the CloneOf marker
- String description = Utilities.emptyWhenNull(super.getDescription());
- description = EventMarker.neutralizeEventDescription(description);
-
- if (mRule.getCloneDescription()) {
- // Remove leading returns
- while (description.length() > 0 && description.substring(0, 1).contentEquals("\n")) {
- description = description.substring(1);
- }
- // Include attendee details in paid version
- if (ClonerVersion.shouldAddAttendees() && mRule.getAttendeesAsText()) {
- // Include descriptive attendee information
- String attendeeInfo = getAttendeesString(this.getId());
- if (!attendeeInfo.contentEquals("")) {
- description = "\n" + description;
- }
- description = attendeeInfo + description;
- }
- description = this.markEventDescription(description, this);
- } else {
- description = this.markEventDescription(mRule.getCustomDescription(), this);
- }
-
- return description;
- }
-
- @Override
- public DateTime getStartTime() {
- // If not an all-day event, reserve proper time before the event
- DateTime startTime = super.getStartTime();
- if (!this.isAllDay()) {
- startTime = startTime.minus(mRule.getReserveBefore() * ONE_MINUTE);
- }
- return startTime;
- }
-
- @Override
- public DateTime getEndTime() {
- // If not an all-day event, reserve proper time after the event
- DateTime endTime = super.getEndTime();
- if (!this.isAllDay()) {
- endTime = endTime.plus(mRule.getReserveAfter() * ONE_MINUTE);
- }
- return endTime;
- }
-
- @Override
- public String getDuration() {
- // If not an all-day event, reserve proper time extra for the
- // duration
- String duration = super.getDuration();
- if (!this.isAllDay()) {
- long extra = (mRule.getReserveBefore() + mRule.getReserveAfter()) * ONE_MINUTE;
- if (extra > 0) {
- long dur = Duration.parseDuration(duration);
- return Duration.encodeDuration(dur + extra);
- }
- }
- return duration;
- }
-
- @Override
- public DateTime getOriginalInstanceTime() {
- // If not an all-day event, reserve proper time before the event
- DateTime originalInstanceTime = super.getOriginalInstanceTime();
- if (!this.isAllDay()) {
- originalInstanceTime = originalInstanceTime.minus(mRule.getReserveBefore() * ONE_MINUTE);
- }
- return originalInstanceTime;
- }
-
- @Override
- public int getAccessLevel() {
- switch (mRule.getCustomAccessLevel()) {
- case Rule.CUSTOM_ACCESS_LEVEL_DEFAULT:
- return Events.ACCESS_DEFAULT;
- case Rule.CUSTOM_ACCESS_LEVEL_PRIVATE:
- return Events.ACCESS_PRIVATE;
- case Rule.CUSTOM_ACCESS_LEVEL_CONFIDENTIAL:
- return Events.ACCESS_CONFIDENTIAL;
- case Rule.CUSTOM_ACCESS_LEVEL_PUBLIC:
- return Events.ACCESS_PUBLIC;
- }
- return super.getAccessLevel();
- }
-
- @Override
- public int getAvailability() {
- switch (mRule.getCustomAvailability()) {
- case Rule.CUSTOM_AVAILABILITY_BUSY:
- return Events.AVAILABILITY_BUSY;
- case Rule.CUSTOM_AVAILABILITY_FREE:
- return Events.AVAILABILITY_FREE;
- }
- return super.getAvailability();
- }
-
- @Override
- public int getAvailabilitySamsung() {
- switch (mRule.getCustomAvailability()) {
- case Rule.CUSTOM_AVAILABILITY_BUSY:
- return Device.Samsung.AVAILABILITY_BUSY;
- case Rule.CUSTOM_AVAILABILITY_FREE:
- return Device.Samsung.AVAILABILITY_FREE;
- case Rule.CUSTOM_AVAILABILITY_OUT_OF_OFFICE:
- return Device.Samsung.AVAILABILITY_OUT_OF_OFFICE;
- }
- return super.getAvailabilitySamsung();
- }
-
- @Override
- public boolean hasAvailabilitySamsung() {
- switch (mRule.getCustomAvailability()) {
- case Rule.CUSTOM_AVAILABILITY_BUSY:
- case Rule.CUSTOM_AVAILABILITY_FREE:
- case Rule.CUSTOM_AVAILABILITY_OUT_OF_OFFICE:
- return true;
- }
- return super.hasAvailabilitySamsung();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerApp.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerApp.java
deleted file mode 100644
index dd30856..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerApp.java
+++ /dev/null
@@ -1,332 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import android.app.AlarmManager;
-import android.app.Application;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.os.AsyncTask;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.support.v4.app.TaskStackBuilder;
-import android.widget.Toast;
-
-public class ClonerApp extends Application {
- // Debug constants
- private static boolean mDebug = true;
- public static final boolean PROFILE = false;
-
- // Create a handler to handle messages to this thread
- private static Handler mHandler = new Handler();
- // Cloner thread variable
- private static ClonerThread mClonerThread = null;
-
- // Databases
- private ClonerDb mReadOnlyDb = null;
- private ClonerDb mReadWriteDb = null;
-
- // Event registration
- private HashMap mOnTimerSignalHandlers = new HashMap();
- private long mClonerStateOrResyncTime = ClonerStateRunnable.CLONER_NOT_RUNNING;
-
- // Parameter passing variables
- private HashMap mParams = new HashMap();
-
- // The singleton app variable
- private static ClonerApp mApp = null;
- // The time at which the app was created
- private long mTimeCreated = 0;
- // This app's settings
- private Settings mSettings = null;
-
- // Variables for error notification
- private int mFailCount = 0;
- private static final int ID_SYNC_FAILED = 13;
-
- // Device variable
- private Device mDevice;
-
- @Override
- public void onCreate() {
- super.onCreate();
- mApp = this;
- mTimeCreated = System.currentTimeMillis();
- mReadOnlyDb = new ClonerDb(this.getContentResolver(), true);
- mReadWriteDb = new ClonerDb(this.getContentResolver(), false);
- mDevice = new Device();
-
- SettingsMap map = SettingsMapStreamer.loadFromSharedPrefs(this);
- mSettings = new Settings();
- mSettings.loadfromMap(map);
-
- mSettings.registerSettingsChangeHandler(new Runnable() {
- @Override
- public void run() {
- saveSettingsToSharedPrefs();
- }
- }, false);
-
- // Automatically save preferences when the cloner stops, effectively
- // saving all rules' source calendar hashes
- ClonerApp.registerClonerStateRunnable(new ClonerStateRunnable() {
- @Override
- public void run(long clonerStateOrResyncTime) {
- if (clonerStateOrResyncTime != ClonerStateRunnable.CLONER_RUNNING) {
- saveSettingsToSharedPrefs();
- }
- }
- }, false);
-
- // Make sure the background instance is running!
- Intent serviceIntent = new Intent(this, ClonerService.class);
- this.startService(serviceIntent);
- }
-
- private void saveSettingsToSharedPrefs() {
- // Store settings in settings map
- final SettingsMap map = new SettingsMap();
- mSettings.saveToMap(map);
- // Save settings to SharedPreferences in the background
- new AsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- SettingsMapStreamer.saveToSharedPrefs(ClonerApp.this, map);
- return null;
- }
- }.execute();
- }
-
- public static ClonerApp getInstance() {
- return mApp;
- }
-
- public static long getRunTime() {
- return System.currentTimeMillis() - mApp.mTimeCreated;
- }
-
- public static Settings getSettings() {
- if (mApp != null) {
- return mApp.mSettings;
- }
- return null;
- }
-
- public static String translate(int resourceId) {
- if (mApp != null) {
- return mApp.getString(resourceId);
- }
- return "RES: " + resourceId;
- }
-
- public static String translate(int resourceId, String[] replacements) {
- String result = ClonerApp.translate(resourceId);
- for (int index = 1; index <= replacements.length; index++) {
- if (replacements[index - 1] != null) {
- result = result.replace("{" + index + "}", replacements[index - 1]);
- } else {
- result = result.replace("{" + index + "}", "");
- }
- }
- return result;
- }
-
- public static void toast(String message) {
- if (mApp != null) {
- Toast.makeText(mApp, message, Toast.LENGTH_SHORT).show();
- }
- }
-
- public static void toggleDebugMode() {
- mDebug = !mDebug;
- }
-
- public static boolean isDebugMode() {
- return mDebug;
- }
-
- public static void scheduleWakeup(long delay, Handler handler, Runnable runnable) {
- if (mApp != null) {
- AlarmReceiver.setCallback(handler, runnable);
- AlarmManager mgr = (AlarmManager) mApp.getSystemService(Context.ALARM_SERVICE);
- Intent i = new Intent(mApp, AlarmReceiver.class);
- PendingIntent pi = PendingIntent.getBroadcast(mApp, 0, i, 0);
-
- mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + delay, pi);
- }
- }
-
- public static void registerClonerStateRunnable(ClonerStateRunnable runnable, boolean runImmediate) {
- if (mApp != null) {
- mApp.mOnTimerSignalHandlers.put(runnable, new Handler());
- if (runImmediate) {
- runnable.run(mApp.mClonerStateOrResyncTime);
- }
- }
- }
-
- public static void unregisterClonerStateRunnable(ClonerStateRunnable runnable) {
- if (mApp != null) {
- mApp.mOnTimerSignalHandlers.remove(runnable);
- }
- }
-
- public static void notifyClonerStateChange(long clonerStateOrResyncTime) {
- if (mApp != null) {
- mApp.mClonerStateOrResyncTime = clonerStateOrResyncTime;
-
- // Call all registered listeners
- Set> entries = mApp.mOnTimerSignalHandlers.entrySet();
- for (Entry entry : entries) {
- final ClonerStateRunnable csr = entry.getKey();
- entry.getValue().post(new Runnable() {
- @Override
- public void run() {
- csr.run(mApp.mClonerStateOrResyncTime);
- }
- });
- }
- }
- }
-
- public static void decreaseFailCount() {
- if (mApp != null) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- doDecreaseFailCount();
- }
- });
- }
- }
-
- private static void doDecreaseFailCount() {
- if (mApp != null && mApp.mFailCount > 0) {
- mApp.mFailCount--;
- if (mApp.mFailCount == 0) {
- NotificationManager notificationManager = (NotificationManager) mApp
- .getSystemService(Context.NOTIFICATION_SERVICE);
- // mId allows you to update the notification later on.
- notificationManager.cancel(ID_SYNC_FAILED);
- }
- }
- }
-
- public static void increaseFailCount() {
- if (mApp != null) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- doIncreaseFailCount();
- }
- });
- }
- }
-
- private static void doIncreaseFailCount() {
- if (mApp.mFailCount == 0) {
- ClonerApp.displayFailNotification();
- }
- mApp.mFailCount++;
- }
-
- private static void displayFailNotification() {
- Bitmap logo = Bitmap.createScaledBitmap(
- BitmapFactory.decodeResource(mApp.getResources(), R.drawable.ic_calendarcloner), 192, 192, false);
- Notification.Builder builder = new Notification.Builder(mApp).setSmallIcon(R.drawable.status_fail)
- .setLargeIcon(logo).setContentTitle("Cloning process failed")
- .setContentText("See rule history for more details");
- // Creates an explicit intent for an Activity in your app
- Intent resultIntent = new Intent(mApp, RulesActivity.class);
-
- // The stack builder object will contain an artificial back stack for
- // the
- // started Activity.
- // This ensures that navigating backward from the Activity leads out of
- // your application to the Home screen.
- TaskStackBuilder stackBuilder = TaskStackBuilder.create(mApp);
- // Adds the back stack for the Intent (but not the Intent itself)
- stackBuilder.addParentStack(RulesActivity.class);
- // Adds the Intent that starts the Activity to the top of the stack
- stackBuilder.addNextIntent(resultIntent);
- PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
-
- builder.setContentIntent(resultPendingIntent);
- NotificationManager notificationManager = (NotificationManager) mApp
- .getSystemService(Context.NOTIFICATION_SERVICE);
- // mId allows you to update the notification later on.
- notificationManager.notify(ID_SYNC_FAILED, builder.getNotification());
- }
-
- public static void startClonerThread() {
- if (mClonerThread == null) {
- // Start a new thread for cloning
- mClonerThread = new ClonerThread(mHandler, new Runnable() {
- @Override
- public void run() {
- onStopClonerThread();
- }
- });
- mClonerThread.start();
- }
- }
-
- private static void onStopClonerThread() {
- if (mClonerThread != null) {
- mClonerThread = null;
- }
- }
-
- public static void resync(String source) {
- if (mClonerThread != null) {
- mClonerThread.resync(source, true, true);
- }
- }
-
- public static void setParameter(String name, Object value) {
- if (mApp != null) {
- mApp.mParams.put(name, value);
- }
- }
-
- public static Object getParameter(String name) {
- if (mApp != null) {
- return mApp.mParams.get(name);
- }
- return null;
- }
-
- public static String getVersion() {
- if (mApp != null) {
- try {
- return mApp.getPackageManager().getPackageInfo(mApp.getPackageName(), 0).versionName;
- } catch (Exception e) {
- }
- }
- return "";
- }
-
- public static Device getDevice() {
- if (mApp != null) {
- return mApp.mDevice;
- }
- return null;
- }
-
- public static ClonerDb getDb(boolean readOnly) {
- if (mApp != null) {
- if (readOnly) {
- return mApp.mReadOnlyDb;
- }
- return mApp.mReadWriteDb;
- }
- return null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerCursor.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerCursor.java
deleted file mode 100644
index 623fa28..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerCursor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.database.Cursor;
-import android.database.CursorWrapper;
-
-public class ClonerCursor extends CursorWrapper {
- private static ClonerLog mLog = new LogLogcat("ClonerCursor", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_WARNING);
- private boolean mCloseCalled = false;
- private String mName;
-
- public ClonerCursor(Cursor cur, String name) {
- super(cur);
- mName = name;
- }
-
- @Override
- public void close() {
- super.close();
- mCloseCalled = true;
- }
-
- @Override
- protected void finalize() {
- // Copy log as local variable since finalize may clean it up
- ClonerLog log = mLog;
- if (!mCloseCalled) {
- log.warning(ClonerApp.translate(R.string.log_cursor_not_closed) + ": " + mName);
- }
- try {
- super.finalize();
- } catch (Throwable e) {
- log.stacktrace(e);
- }
- }
-
- @Override
- public String toString() {
- return mName;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerDb.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerDb.java
deleted file mode 100644
index 6cf8491..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerDb.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-
-public class ClonerDb {
- // Application behavior settings
- private static final ClonerLog mLog = new LogLogcat("ClonerDb", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_WARNING);
- private ContentResolver mCr;
- private boolean mIsReadOnly;
-
- public ClonerDb(ContentResolver cr, boolean readOnly) {
- mCr = cr;
- mIsReadOnly = readOnly;
- }
-
- public boolean isReadOnly() {
- return mIsReadOnly;
- }
-
- public int delete(Uri uri, String where, String[] selectionArgs) {
- mLog.debug(ClonerApp.translate(R.string.db_deleted) + " " + uri.toString());
- if (!mIsReadOnly) {
- try {
- return mCr.delete(uri, where, selectionArgs);
- } catch (Exception e) {
- mLog.stacktrace(e);
- }
- }
- return 0;
- }
-
- public Uri insert(Uri uri, ContentValues values) {
- if (!mIsReadOnly) {
- try {
- Uri insertUri = mCr.insert(uri, values);
- mLog.debug(ClonerApp.translate(R.string.db_inserted) + " " + insertUri.toString());
- return insertUri;
- } catch (Exception e) {
- mLog.stacktrace(e);
- }
- } else {
- mLog.debug(" " + values.toString());
- }
- return null;
- }
-
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
- try {
- return mCr.query(uri, projection, selection, selectionArgs, sortOrder);
- } catch (Exception e) {
- mLog.stacktrace(e);
- }
- return null;
- }
-
- public int update(Uri uri, ContentValues values, String where, String[] selectionArgs) {
- mLog.debug(ClonerApp.translate(R.string.db_updated) + " " + uri.toString());
- if (!mIsReadOnly) {
- try {
- return mCr.update(uri, values, where, selectionArgs);
- } catch (Exception e) {
- mLog.stacktrace(e);
- }
- } else {
- mLog.debug(" " + values.toString());
- }
- return 1;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerLog.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerLog.java
deleted file mode 100644
index 5dfcf1e..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerLog.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class ClonerLog {
- public static final int TYPE_SUMMARY = 0;
- public static final int TYPE_EXTENDED = 1;
-
- private LogLineFactory mLogLineFactory;
- private int mLogType;
- private int mMaxLevel = LOG_INFO;
- private String mTitle;
-
- public static final int LOG_INFO = 0;
- public static final int LOG_WARNING = 1;
- public static final int LOG_UPDATE = 2;
- public static final int LOG_ERROR = 3;
- public static final int NUM_LOG_LEVELS = 4;
-
- public ClonerLog(String title, int logType, LogLineFactory logLineFactory) {
- mTitle = title;
- mLogType = logType;
- mLogLineFactory = logLineFactory;
- }
-
- public String getTitle() {
- return mTitle;
- }
-
- public int getLogType() {
- return mLogType;
- }
-
- public LogLineFactory getLogLineFactory() {
- return mLogLineFactory;
- }
-
- public int getMaxLevel() {
- return mMaxLevel;
- }
-
- public LogLine createLogLine(int level, String logPrefix, String col0) {
- return mLogLineFactory.createLogLine(level, logPrefix, col0);
- }
-
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1) {
- return mLogLineFactory.createLogLine(level, logPrefix, col0, col1);
- }
-
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1, String col2) {
- return mLogLineFactory.createLogLine(level, logPrefix, col0, col1, col2);
- }
-
- public LogLines createLogLines() {
- return new LogLines(mLogLineFactory);
- }
-
- public void log(LogLine summary, LogLines lines) {
- // Keep track of max log level
- if (summary != null && summary.getLevel() > mMaxLevel) {
- mMaxLevel = summary.getLevel();
- }
- if (lines != null && lines.getMaxLevel() > mMaxLevel) {
- mMaxLevel = lines.getMaxLevel();
- }
- }
-
- public void debug(String message) {
- LogLine line = mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, null, message);
- this.log(line, null);
- }
-
- public void error(String message) {
- LogLine line = mLogLineFactory.createLogLine(ClonerLog.LOG_ERROR, null, message);
- this.log(line, null);
- }
-
- public void stacktrace(Throwable e) {
- StackTraceElement[] stack = e.getStackTrace();
- LogLines logLines = this.createLogLines();
- LogLine summary = mLogLineFactory.createLogLine(
- ClonerLog.LOG_ERROR,
- null,
- ClonerApp.translate(R.string.log_exception) + ": " + e.getClass().getCanonicalName() + "\n"
- + ClonerApp.translate(R.string.log_message) + ": " + e.getMessage() + "\n");
- if (logLines != null) {
- logLines.log(ClonerLog.LOG_ERROR, null, ClonerApp.translate(R.string.log_stacktrace) + ":\n");
- for (int index = 0; index < stack.length; index++) {
- logLines.log(ClonerLog.LOG_ERROR, null,
- " " + stack[index].getMethodName() + " " + ClonerApp.translate(R.string.log_exception_at)
- + " " + stack[index].getFileName() + ":" + stack[index].getLineNumber() + "\n");
- }
- }
- this.log(summary, logLines);
- }
-
- public void info(String message) {
- LogLine line = mLogLineFactory.createLogLine(ClonerLog.LOG_UPDATE, null, message);
- this.log(line, null);
- }
-
- public void warning(String message) {
- LogLine line = mLogLineFactory.createLogLine(ClonerLog.LOG_WARNING, null, message);
- this.log(line, null);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerService.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerService.java
deleted file mode 100644
index e4186f3..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-
-public class ClonerService extends Service {
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- ClonerApp.startClonerThread();
- return START_STICKY;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerStateRunnable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerStateRunnable.java
deleted file mode 100644
index 9f50e5c..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerStateRunnable.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public abstract class ClonerStateRunnable {
- // Both constants are defined as negative numbers to not conflict with possible resync times
- public static final long CLONER_RUNNING = -1;
- public static final long CLONER_NOT_RUNNING = -2;
-
- public abstract void run(long clonerStateOrResyncTime);
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerTable.java
deleted file mode 100644
index 6c2ceb0..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerTable.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.CursorLoader;
-import android.database.Cursor;
-import android.net.Uri;
-import android.util.Log;
-
-public class ClonerTable {
- public class Column {
- private String mName;
- private int mIndex = -1;
- private boolean mPresent = false;
-
- public Column(String name) {
- mName = name;
- }
-
- public String getName() {
- return mName;
- }
-
- public int getColumnIndex() {
- return mIndex;
- }
-
- public boolean isPresent() {
- return mPresent;
- }
- }
-
- private ClonerDb mDb;
- private Uri mUri;
- protected String[] mProjection;
- private ArrayList mColumns = new ArrayList();
- private boolean mColumnsDirty = true;
- private boolean mReadOnly = false;
-
- public ClonerTable(ClonerDb db, Uri uri) {
- mDb = db;
- if (db == null) {
- Log.e("ClonerTable", this.getClass().getCanonicalName());
- try {
- throw new Exception();
- } catch (Exception e) {
- new LogLogcat("title", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_INFO).stacktrace(e);
- }
- }
- mUri = uri;
- mProjection = null;
- }
-
- public ClonerDb getDb() {
- return mDb;
- }
-
- protected void addColumn(Column col) {
- mColumns.add(col);
- mColumnsDirty = true;
- }
-
- public void setProjection(Column[] cols) {
- if (cols != null) {
- mProjection = new String[cols.length];
- for (int index = 0; index < cols.length; index++) {
- mProjection[index] = cols[index].mName;
- }
- } else {
- mProjection = null;
- }
- mColumnsDirty = true;
- }
-
- public void setReadOnly(boolean readOnly) {
- mReadOnly = readOnly;
- }
-
- protected Cursor getById(long id) {
- Uri uri = ContentUris.withAppendedId(mUri, id);
- Cursor cur = mDb.query(uri, mProjection, null, null, null);
- this.indexColumnsFromCursor(cur);
- return cur;
- }
-
- protected void indexColumnsFromCursor(Cursor cur) {
- if (cur != null) {
- if (mColumnsDirty) {
- for (int index = 0; index < mColumns.size(); index++) {
- Column col = mColumns.get(index);
- col.mIndex = cur.getColumnIndex(col.mName);
- col.mPresent = col.mIndex >= 0;
- }
- mColumnsDirty = false;
- }
- }
- }
-
- public Cursor query(String selection, String[] selectionArgs, String sortOrder) {
- return this.rawQuery(mUri, selection, selectionArgs, sortOrder);
- }
-
- public Cursor rawQuery(Uri uri, String selection, String[] selectionArgs, String sortOrder) {
- Cursor cur = mDb.query(uri, mProjection, selection, selectionArgs, sortOrder);
- if (cur != null) {
- this.indexColumnsFromCursor(cur);
- return new ClonerCursor(cur, "Query " + uri.toString() + " WHERE " + selection + " ARGS "
- + (selectionArgs != null ? selectionArgs.toString() : "null") + " SORTBY " + sortOrder);
- }
- return null;
- }
-
- public CursorLoader getLoader(Context context, String selection, String[] selectionArgs, String sortOrder) {
- return new CursorLoader(context, mUri, mProjection, selection, selectionArgs, sortOrder) {
- @Override
- public void deliverResult(Cursor cur) {
- indexColumnsFromCursor(cur);
- super.deliverResult(cur);
- }
- };
- }
-
- protected boolean supportsColumn(Column col) {
- boolean result = false;
- Cursor cur = this.getById(0);
- try {
- result = col.isPresent();
- } finally {
- cur.close();
- }
- return result;
- }
-
- public long insert(ContentValues values) {
- if (!mReadOnly) {
- Uri uri = mDb.insert(mUri, values);
- if (uri != null && uri != Uri.EMPTY) {
- return ContentUris.parseId(uri);
- }
- }
- return 0;
- }
-
- public int update(long id, ContentValues values) {
- if (!mReadOnly) {
- final Uri uri = ContentUris.withAppendedId(mUri, id);
- return mDb.update(uri, values, null, null);
- }
- return 1;
- }
-
- public int delete(long id) {
- if (!mReadOnly) {
- final Uri uri = ContentUris.withAppendedId(mUri, id);
- return mDb.delete(uri, null, null);
- }
- return 1;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerThread.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerThread.java
deleted file mode 100644
index 68ba9a1..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerThread.java
+++ /dev/null
@@ -1,359 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.LinkedList;
-import java.util.List;
-import android.os.AsyncTask;
-import android.os.Handler;
-import android.os.Looper;
-
-public class ClonerThread extends Thread {
- private static final long ONE_MINUTE = 60 * 1000;
- private static ClonerLog mLog = new LogLogcat("ClonerThread", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_INFO);
-
- private boolean mEnabled = false;
- private long mLastResyncTime = 0;
- private List mRules = new LinkedList();
- private boolean mRulesChanged = false;
- private boolean mSyncAgainAfterTaskQueue = false;
- private boolean mSyncAgainForce = false;
- private boolean mSyncAgainAll = false;
- private Boolean mTaskExecuting = false;
- private List mTasks = new LinkedList();
- private Runnable mLastTimedRunnable = null;
- private long mTimeWait = 120;
-
- private Handler mHandler = null;
- private Handler mParentHandler = null;
- private Runnable mOnExit = null;
- private static Looper mThreadLooper = null;
-
- private class ReloadConfigRunnable implements Runnable {
- @Override
- public void run() {
- Settings settings = ClonerApp.getSettings();
-
- if (settings.isClonerEnabled()) {
- // Reload the TimeWait amount
- mTimeWait = settings.getClonerTimeWait();
- // Reload the rules from configuration
- mRules.clear();
- for (int index = 0; index < settings.getNumberOfRules(); index++) {
- mRules.add(settings.getRule(index));
- }
- mRulesChanged = true;
-
- // Check to see if we are (re)enabling
- if (!mEnabled) {
- // Set enabled
- mEnabled = true;
- // Force resync on all rules
- requestResync("Service enabled", true, true);
- } else {
- // Force resync on dirty rules
- requestResync("Config reload", true, false);
- }
- } else {
- if (mEnabled) {
- // Set disabled
- mEnabled = false;
- }
- }
- }
- }
-
- public ClonerThread(Handler parentHandler, Runnable onExit) {
- mParentHandler = parentHandler;
- mOnExit = onExit;
- }
-
- public synchronized void initLooper() {
- if (ClonerThread.mThreadLooper == null) {
- ClonerThread.mThreadLooper = Looper.myLooper();
- }
- }
-
- public synchronized void endLooper() {
- if (ClonerThread.mThreadLooper != null) {
- ClonerThread.mThreadLooper.quit();
- ClonerThread.mThreadLooper = null;
- }
- }
-
- @Override
- public void run() {
- // Background thread runs at lower priority
- this.setPriority(MIN_PRIORITY);
- Looper.prepare();
-
- // Register stuff
- mHandler = new Handler();
-
- // Register callback for calendar changes
- CalendarChangedReceiver.setCallback(mHandler, new Runnable() {
- @Override
- public void run() {
- // Resync request on all rules
- requestResync("CalendarProvider", false, true);
- }
- });
-
- // Load the preferences and start if enabled
- ReloadConfigRunnable rcr = new ReloadConfigRunnable();
- Settings settings = ClonerApp.getSettings();
- settings.registerSettingsChangeHandler(rcr, true);
-
- this.initLooper();
- Looper.loop(); // loop until "quit()" is called.
-
- // Unregister the change handler
- settings.unregisterSettingsChangeHandler(rcr);
- // Remove the callback for calendar changes
- CalendarChangedReceiver.setCallback(null, null);
- // Signal parent that we've stopped execution
- mParentHandler.post(mOnExit);
- }
-
- private void setWakeupTimer(long delay) {
- // Set the timed runnable now
- mLastTimedRunnable = new Runnable() {
- @Override
- public void run() {
- if (this == mLastTimedRunnable) {
- mLastTimedRunnable = null;
- // Resync request on all rules
- requestResync("TimedRunnable", false, true);
- }
- }
- };
- ClonerApp.scheduleWakeup(delay, mHandler, mLastTimedRunnable);
- mLog.info(ClonerApp.translate(R.string.log_timer_set, new String[] { "" + delay }));
- ClonerApp.notifyClonerStateChange(System.currentTimeMillis() + delay);
- }
-
- private void requestResync(String source, boolean forceRun, boolean forceAll) {
- mLog.info(ClonerApp.translate(R.string.log_cloner_resync_request_source, new String[] { source }));
-
- // Only process if cloner is enabled
- if (!mEnabled) {
- return;
- }
-
- // If a timer has been set and no force is applied, then exit straight
- // away
- if (mLastTimedRunnable != null && !forceRun) {
- return;
- }
-
- // If the device just booted up
- if (StartupReceiver.startupReceived()) {
- // Delay the initial run for one minute to allow the device to start
- // normally (prevent boot hog)
- long runTime = ClonerApp.getRunTime();
- if (runTime < ONE_MINUTE) {
- this.setWakeupTimer(ONE_MINUTE - runTime);
- return;
- }
- }
-
- // If a task is already executing, then mark for resync and exit
- if (mTaskExecuting) {
- // If rules have changed, don't bother executing the old rules
- if (mRulesChanged) {
- while (mTasks.size() > 1) {
- mTasks.remove(1);
- }
- mRulesChanged = false;
- }
- mSyncAgainAfterTaskQueue = true;
- mSyncAgainForce |= forceRun;
- return;
- }
-
- // If no force, then calculate delay timer interval
- if (!forceRun) {
- // If we ran too recently then set a timer and wait some more
- long now = System.currentTimeMillis();
- long delay = (mTimeWait * 1000) - (now - mLastResyncTime);
-
- if (delay > 0) {
- this.setWakeupTimer(delay);
- return;
- }
- }
-
- // If a timed resync is pending in the queue, disable it by setting
- // mLastTimedRunnable to null (disables executing requestResync in its
- // run() method
- mLastTimedRunnable = null;
-
- // Resync process starts here
- ClonerApp.notifyClonerStateChange(ClonerStateRunnable.CLONER_RUNNING);
-
- // Initialize current time for cloner limits
- Limits.startRun();
-
- // If we need to execute all rules, mark them dirty here
- if (forceAll) {
- for (int index = 0; index < mRules.size(); index++) {
- mRules.get(index).markDirty();
- }
- }
-
- mTasks.clear();
- // Copy all dirty rules into a queue of cloner tasks
- for (int index = 0; index < mRules.size(); index++) {
- Rule r = mRules.get(index);
- if (r.isDirty()) {
- mTasks.add(new ClonerTask(r));
- }
- }
-
- // No rule changed as of last task queuing
- mRulesChanged = false;
-
- mLog.info(ClonerApp.translate(R.string.log_processing_task_queue));
- processTaskQueue();
- }
-
- private void onResyncDone() {
- mLastResyncTime = System.currentTimeMillis();
- ClonerApp.notifyClonerStateChange(ClonerStateRunnable.CLONER_NOT_RUNNING);
-
- // In the FREE_VERSION we sync every timer interval. In the PAID_VERSION we allow quiet times by listening to
- // calendar changes. This makes battery saving an added feature of the paid version.
- if (ClonerVersion.shouldResyncAfterEachInterval()) {
- mSyncAgainAfterTaskQueue = true;
- }
-
- // If we received a signal during resync, we immediately request a resync here
- if (mSyncAgainAfterTaskQueue) {
- mSyncAgainAfterTaskQueue = false;
- boolean forceRun = mSyncAgainForce;
- boolean forceAll = mSyncAgainAll;
- mSyncAgainForce = false;
- mSyncAgainAll = false;
- this.requestResync("SyncAgain flag", forceRun, forceAll);
- }
- }
-
- private void processTaskQueue() {
- // Always check to see if cloning is enabled
- if (mEnabled) {
- // Process the next task
- if (!mTaskExecuting && mTasks.size() > 0) {
- mTaskExecuting = true;
- mTasks.get(0).execute(new Void[] {});
- }
- } else {
- // Clear task queue if cloning is disabled
- mTasks.clear();
- }
- }
-
- private void onTaskFinished(final Boolean completed) {
- try {
- if (!completed) {
- // Resync request on this rule
- mTasks.get(0).mRule.markDirty();
- this.requestResync("Not completed", false, false);
- }
- mTasks.remove(0);
- mTaskExecuting = false;
- processTaskQueue();
- if (!mTaskExecuting) {
- this.onResyncDone();
- }
- } catch (Exception e) {
- mLog.stacktrace(e);
- }
- }
-
- class ClonerTask extends AsyncTask {
- private Rule mRule;
-
- public ClonerTask(Rule rule) {
- // Clone the rule itself to prevent users altering it while cloning
- mRule = rule;
- }
-
- @Override
- protected Boolean doInBackground(Void... arg0) {
- boolean completed = true;
- Settings settings = ClonerApp.getSettings();
- int lockSecret = mRule.tryLock();
- if (lockSecret != 0) {
- if (mRule.isEnabled()) {
- mRule.startExecution(ClonerApp.translate(R.string.cloner_state_syncing) + "...");
- settings.notifyRuleStatusChange();
-
- final ClonerLog log;
- if (settings.getLogToLogcat() && settings.getLogToMemory()) {
- log = new LogSplitter(mRule.getName(), settings.getLogType(), ClonerLog.LOG_INFO);
- } else if (settings.getLogToLogcat()) {
- log = new LogLogcat(mRule.getName(), settings.getLogType(), ClonerLog.LOG_INFO);
- } else if (settings.getLogToMemory()) {
- log = new LogMemory(mRule.getName(), settings.getLogType());
- } else {
- log = new LogNull(mRule.getName());
- }
-
- mRule.setLog(log);
- try {
- // If rule failed before, decrease fail count
- if (mRule.hasExecuted() && mRule.getStatus() == RuleExecutor.Result.STATUS_FAIL) {
- ClonerApp.decreaseFailCount();
- }
- // Clone here
- RuleExecutor executor = new RuleExecutor();
- RuleExecutor.Result result = executor.execute(mRule);
- mRule.finishExecution(
- // RuleExecutor.Result.STATUS_FAIL,
- result.getStatus(), result.getSummary());
- if (mRule.getStatus() == RuleExecutor.Result.STATUS_NOT_COMPLETED) {
- completed = false;
- }
- if (mRule.getStatus() == RuleExecutor.Result.STATUS_FAIL) {
- ClonerApp.increaseFailCount();
- }
- } catch (Exception e) {
- mRule.getLog().stacktrace(e);
- mRule.finishExecution(RuleExecutor.Result.STATUS_FAIL,
- ClonerApp.translate(R.string.log_exception) + ": " + e.toString());
- }
- settings.notifyRuleStatusChange();
- }
- mRule.tryRelease(lockSecret);
- } else {
- mRule.finishExecution(RuleExecutor.Result.STATUS_FAIL, ClonerApp.translate(R.string.cloner_log_skipped));
- settings.notifyRuleStatusChange();
- }
- return completed;
- }
-
- @Override
- protected void onPostExecute(final Boolean completed) {
- // Make sure onTaskFinished is executed in the parent thread (necessary since JELLY BEAN and later force
- // execution of onPostExecute in main thread)
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- onTaskFinished(completed);
- }
- });
- }
- }
-
- public void resync(final String source, final boolean forceRun, final boolean forceAll) {
- // Can be called from outside the thread, so schedule a message to be delivered in the execution thread
- if (mHandler != null) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- // Simulate a rule change so resync starts from the top
- mRulesChanged = true;
- requestResync(source, forceRun, forceAll);
- }
- });
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerVersion.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerVersion.java
deleted file mode 100644
index c666401..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ClonerVersion.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class ClonerVersion {
- // Free version limitations
- private static int FREE_VERSION_MAX_RULES = 2;
-
- // Expiration constants
- private static final boolean mExpires = false;
- private static final long TIMESTAMP_2013 = 1356994800000L;
- private static final long TIMESTAMP_1_MONTH = (long) (30.42 * 24 * 3600 * 1000);
- private static final long mExpirationTime = TIMESTAMP_2013 + TIMESTAMP_1_MONTH * (12 + 5);
-
- public static String PAID_VERSION_PACKAGENAME() {
- return "com" + "." + "dizzl" + "." + "android" + "." + "CalendarCloner";
- }
-
- // Version functions
- public static boolean IS_PAID_VERSION() {
- // Break up string to prevent renaming by cc_free
- String packageName = ClonerApp.class.getPackage().getName();
- return packageName.contentEquals(PAID_VERSION_PACKAGENAME());
- }
-
- public static boolean IS_FREE_VERSION() {
- return !IS_PAID_VERSION();
- }
-
- public static String paidVersionName() {
- return "Calendar" + " Cloner";
- }
-
- public static String freeVersionName() {
- return "Calendar" + " Cloner" + " FREE";
- }
-
- public static String thisVersionName() {
- if (IS_PAID_VERSION()) {
- return paidVersionName();
- }
- return freeVersionName();
- }
-
- public static void msgPaidVersionOnly() {
- ClonerApp.toast(ClonerApp.translate(R.string.msg_paid_version_only));
- }
-
- private static boolean inPaidVersionOnly(boolean enabled) {
- if (!ClonerVersion.IS_PAID_VERSION() && enabled) {
- msgPaidVersionOnly();
- enabled = false;
- }
- return enabled;
- }
-
- public static boolean isExpired() {
- long currentTime = System.currentTimeMillis();
- if (currentTime > mExpirationTime) {
- return mExpires;
- }
- return false;
- }
-
- public static int setNumRules(int numRules) {
- if (!ClonerVersion.IS_PAID_VERSION() && numRules > FREE_VERSION_MAX_RULES) {
- return FREE_VERSION_MAX_RULES;
- }
- return numRules;
- }
-
- public static int setRuleMethod(int method) {
- if (!ClonerVersion.IS_PAID_VERSION() && method != Rule.METHOD_CLONE) {
- msgPaidVersionOnly();
- return Rule.METHOD_CLONE;
- }
- return method;
- }
-
- public static boolean setUseEventFilters(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setIncludeClones(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setCloneSelfAttendeeStatus(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static int setCustomAccessLevel(int customAccessLevel) {
- if (customAccessLevel != Rule.CUSTOM_ACCESS_LEVEL_SOURCE) {
- if (!inPaidVersionOnly(true)) {
- return Rule.CUSTOM_ACCESS_LEVEL_SOURCE;
- }
- }
- return customAccessLevel;
- }
-
- public static int setCustomAvailability(int customAvailability) {
- if (customAvailability != Rule.CUSTOM_AVAILABILITY_SOURCE) {
- if (!inPaidVersionOnly(true)) {
- return Rule.CUSTOM_AVAILABILITY_SOURCE;
- }
- }
- return customAvailability;
- }
-
- public static boolean setCloneAttendees(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setAttendeesAsText(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setCustomAttendee(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setCloneReminders(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setCustomReminder(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean setRetainClonesOutsideSourceEventWindow(boolean enabled) {
- return inPaidVersionOnly(enabled);
- }
-
- public static boolean shouldAddAttendees() {
- return ClonerVersion.IS_PAID_VERSION();
- }
-
- public static boolean shouldResyncAfterEachInterval() {
- return ClonerVersion.IS_FREE_VERSION();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CursorDumper.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CursorDumper.java
deleted file mode 100644
index 54e89f0..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/CursorDumper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.database.Cursor;
-
-public class CursorDumper {
- static ClonerLog mLog = new LogLogcat("CursorDumper", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_INFO);
-
- public static String dump(Cursor cur) {
- String log = "";
- for (int index = 0; index < cur.getColumnCount(); index++) {
- String line = cur.getColumnName(index) + ": " + cur.getString(index) + "\n";
- mLog.info(line);
- log += line;
- }
- String separator = "________\n";
- mLog.info(separator);
- log += separator;
- return log;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbAttendee.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbAttendee.java
deleted file mode 100644
index f5ffc7a..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbAttendee.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.provider.CalendarContract.Attendees;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class DbAttendee implements Attendee {
- private DbObject mObject;
- private AttendeesTable mTable;
-
- // Attendee fields
- private DbObject.LongField mId, mEventId;
- private DbObject.StringField mName, mEmail;
- private DbObject.IntegerField mRelationship, mStatus, mType;
-
- public static DbAttendee getByEmail(AttendeesTable table, long eventId, String attendeeEmail) {
- DbAttendee result = null;
- Cursor cur = table.query("((" + table.EVENT_ID.getName() + "=? AND " + table.ATTENDEE_EMAIL.getName() + "=?))",
- new String[] { "" + eventId, attendeeEmail }, table.ATTENDEE_NAME.getName() + " ASC");
- if (cur != null) {
- try {
- if (cur.moveToNext()) {
- result = new DbAttendee(table, new DbObject(cur));
- result.loadAll();
- }
- } finally {
- cur.close();
- }
- }
- return result;
- }
-
- public static List getByEvent(AttendeesTable table, long eventId, AttendeeDeltas deltas) {
- List attendees = new LinkedList();
- Cursor cur = table.query("((" + table.EVENT_ID.getName() + "=?))", new String[] { "" + eventId },
- table.ATTENDEE_NAME.getName() + " ASC, " + table.ATTENDEE_EMAIL.getName() + " ASC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- String name = cur.getString(table.ATTENDEE_NAME.getColumnIndex());
- String email = cur.getString(table.ATTENDEE_EMAIL.getColumnIndex());
- ContentValues delta = deltas != null ? deltas.get(name, email) : null;
- DbObject obj = delta != null ? new DbObjectWithDelta(cur, delta) : new DbObject(cur);
- DbAttendee attendee = new DbAttendee(table, obj);
- attendee.loadAll();
- attendees.add(attendee);
- }
- } finally {
- cur.close();
- }
- }
- return attendees;
- }
-
- public static List getByEvent(AttendeesTable table, long eventId) {
- return DbAttendee.getByEvent(table, eventId, null);
- }
-
- public static AttendeeMap getByEventHashed(AttendeesTable table, long eventId) {
- AttendeeMap attendees = new AttendeeMap();
- Cursor cur = table.query("((" + table.EVENT_ID.getName() + "=?))", new String[] { "" + eventId },
- table._ID.getName() + " DESC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- DbAttendee attendee = new DbAttendee(table, new DbObject(cur));
- attendee.loadAll();
- attendees.put(attendee.getName(), attendee.getEmail(), attendee);
- }
- } finally {
- cur.close();
- }
- }
- return attendees;
- }
-
- public static DbAttendee getById(AttendeesTable table, long attendeeId, ContentValues delta) {
- Cursor cur = table.getById(attendeeId);
- if (cur != null) {
- try {
- if (cur.moveToNext()) {
- DbObject obj = delta != null ? new DbObjectWithDelta(cur, delta) : new DbObject(cur);
- DbAttendee result = new DbAttendee(table, obj);
- result.loadAll();
- return result;
- }
- } finally {
- cur.close();
- }
- }
-
- if (delta != null) {
- return new DbAttendee(table, new DbObjectWithDelta(null, delta));
- }
-
- return null;
- }
-
- public static DbAttendee getById(AttendeesTable table, long attendeeId) {
- return DbAttendee.getById(table, attendeeId, null);
- }
-
- public static boolean attendeeStatusIsAResponse(int status) {
- return (status != Attendees.ATTENDEE_STATUS_NONE && status != Attendees.ATTENDEE_STATUS_INVITED);
- }
-
- public DbAttendee(AttendeesTable table, DbObject obj) {
- mTable = table;
- mObject = obj;
- }
-
- @Override
- public String toString() {
- String result = "";
- if (mName != null) {
- result = Utilities.appendToString(result, mName.isLoaded, mName.value);
- }
- if (mEmail != null) {
- result = Utilities.appendToString(result, mEmail.isLoaded, mEmail.value);
- }
- if (mRelationship != null) {
- result = Utilities.appendToString(result, mRelationship.isLoaded,
- new AttendeeRelationships(true).getKeyName(mRelationship.value));
- }
- if (mType != null) {
- result = Utilities.appendToString(result, mType.isLoaded, new AttendeeTypes(true).getKeyName(mType.value));
- }
- if (mStatus != null) {
- result = Utilities.appendToString(result, mStatus.isLoaded,
- new AttendeeStatuses(true).getKeyName(mStatus.value));
- }
- return result;
- }
-
- public void loadAll() {
- try {
- this.getId();
- this.getName();
- this.getEmail();
- this.getRelationship();
- this.getType();
- this.getStatus();
- } finally {
- // Release cursor
- mObject.releaseCursor();
- }
- }
-
- public long getId() {
- if (mId == null) {
- mId = new DbObject.LongField(mTable._ID);
- }
- return mObject.loadField(mId);
- }
-
- public long getEventId() {
- if (mEventId == null) {
- mEventId = new DbObject.LongField(mTable.EVENT_ID);
- }
- return mObject.loadField(mEventId);
- }
-
- public String getName() {
- if (mName == null) {
- mName = new DbObject.StringField(mTable.ATTENDEE_NAME);
- }
- return mObject.loadField(mName);
- }
-
- public String getEmail() {
- if (mEmail == null) {
- mEmail = new DbObject.StringField(mTable.ATTENDEE_EMAIL);
- }
- return mObject.loadField(mEmail);
- }
-
- public int getRelationship() {
- if (mRelationship == null) {
- mRelationship = new DbObject.IntegerField(mTable.ATTENDEE_RELATIONSHIP);
- }
- return mObject.loadField(mRelationship);
- }
-
- public int getType() {
- if (mType == null) {
- mType = new DbObject.IntegerField(mTable.ATTENDEE_TYPE);
- }
- return mObject.loadField(mType);
- }
-
- public int getStatus() {
- if (mStatus == null) {
- mStatus = new DbObject.IntegerField(mTable.ATTENDEE_STATUS);
- }
- return mObject.loadField(mStatus);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbCalendar.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbCalendar.java
deleted file mode 100644
index b3b988e..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbCalendar.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTimeZone;
-
-import android.provider.CalendarContract;
-import android.provider.CalendarContract.Calendars;
-
-import com.dizzl.android.CalendarClonerFree.DbObject.StringField;
-
-public class DbCalendar {
- private final DbObject mObject;
- private final CalendarsTable mTable;
-
- // Calendar fields
- private DbObject.LongField mId;
- private DbObject.StringField mName, mDisplayName;
- private DateTimeZone mTimeZone;
- private DbObject.StringField mAccountName, mAccountType, mOwnerAccount;
- private DbObject.IntegerField mAccessLevel;
- private DbObject.BooleanField mIsSynchronized, mIsVisible;
- private DbObject.BooleanField mCanOrganizerRespond;
- private ReminderMethods mAllowedReminders;
- private DbObject.IntegerField mMaxReminders;
- private DbObject.StringField mCalSync1;
-
- public DbCalendar(CalendarsTable table, DbObject obj) {
- mTable = table;
- mObject = obj;
- }
-
- public void loadAll() {
- try {
- this.getId();
- this.getName();
- this.getDisplayName();
- this.getTimeZone();
- this.getAccountName();
- this.getAccountType();
- this.getOwnerAccount();
- this.getAccessLevel();
- this.isSynchronized();
- this.isVisible();
- this.getCanOrganizerRespond();
- this.getAllowedReminders();
- this.getMaxReminders();
- this.getCalSync1();
- } finally {
- // Release cursor
- mObject.releaseCursor();
- }
- }
-
- public long getId() {
- if (mId == null) {
- mId = new DbObject.LongField(mTable._ID);
- }
- return mObject.loadField(mId);
- }
-
- public String getName() {
- if (mName == null) {
- mName = new DbObject.StringField(mTable.NAME);
- }
- return mObject.loadField(mName);
- }
-
- public String getDisplayName() {
- if (mDisplayName == null) {
- mDisplayName = new DbObject.StringField(mTable.CALENDAR_DISPLAY_NAME);
- }
- return mObject.loadField(mDisplayName);
- }
-
- public DateTimeZone getTimeZone() {
- if (mTimeZone == null) {
- StringField tzField = new DbObject.StringField(mTable.CALENDAR_TIME_ZONE);
- String tz = mObject.loadField(tzField);
- try {
- mTimeZone = DateTimeZone.forID(tz);
- } catch (IllegalArgumentException e) {
- // Set to default when timezone not found
- mTimeZone = DateTimeZone.getDefault();
- }
- }
-
- return mTimeZone;
- }
-
- public String getAccountName() {
- if (mAccountName == null) {
- mAccountName = new DbObject.StringField(mTable.ACCOUNT_NAME);
- }
- return mObject.loadField(mAccountName);
- }
-
- public String getAccountType() {
- if (mAccountType == null) {
- mAccountType = new DbObject.StringField(mTable.ACCOUNT_TYPE);
- }
- return mObject.loadField(mAccountType);
- }
-
- public String getOwnerAccount() {
- if (mOwnerAccount == null) {
- mOwnerAccount = new DbObject.StringField(mTable.OWNER_ACCOUNT);
- }
- return mObject.loadField(mOwnerAccount);
- }
-
- public int getAccessLevel() {
- if (mAccessLevel == null) {
- mAccessLevel = new DbObject.IntegerField(mTable.CALENDAR_ACCESS_LEVEL);
- }
- return mObject.loadField(mAccessLevel);
- }
-
- public boolean isLocal() {
- return this.getAccountType().contentEquals(CalendarContract.ACCOUNT_TYPE_LOCAL);
- }
-
- public boolean isSynchronized() {
- if (mIsSynchronized == null) {
- mIsSynchronized = new DbObject.BooleanField(mTable.SYNC_EVENTS);
- }
- return mObject.loadField(mIsSynchronized);
- }
-
- public boolean isVisible() {
- if (mIsVisible == null) {
- mIsVisible = new DbObject.BooleanField(mTable.VISIBLE);
- }
- return mObject.loadField(mIsVisible);
- }
-
- public boolean getCanOrganizerRespond() {
- if (mCanOrganizerRespond == null) {
- mCanOrganizerRespond = new DbObject.BooleanField(mTable.CAN_ORGANIZER_RESPOND);
- }
- return mObject.loadField(mCanOrganizerRespond);
- }
-
- public ReminderMethods getAllowedReminders() {
- if (mAllowedReminders == null) {
- mAllowedReminders = new ReminderMethods(false);
- DbObject.StringField field = new DbObject.StringField(mTable.ALLOWED_REMINDERS);
- String codedAllowedReminders = mObject.loadField(field);
- String[] ars = codedAllowedReminders.split(",");
- for (int index = 0; index < ars.length; index++) {
- try {
- int key = Integer.parseInt(ars[index]);
- mAllowedReminders.selectByKey(key, true);
- } catch (NumberFormatException e) {
- }
- }
- }
- return mAllowedReminders;
- }
-
- public int getMaxReminders() {
- if (mMaxReminders == null) {
- mMaxReminders = new DbObject.IntegerField(mTable.MAX_REMINDERS);
- }
- return mObject.loadField(mMaxReminders);
- }
-
- public String getCalSync1() {
- if (mCalSync1 == null) {
- mCalSync1 = new DbObject.StringField(mTable.CAL_SYNC1);
- }
- return mObject.loadField(mCalSync1);
- }
-
- public boolean isReadable() {
- int accessLevel = this.getAccessLevel();
- return (accessLevel != Calendars.CAL_ACCESS_NONE && accessLevel != Calendars.CAL_ACCESS_OVERRIDE);
- }
-
- public boolean isWriteable() {
- if (this.isLocal()) {
- return true;
- }
-
- int accessLevel = this.getAccessLevel();
- return (accessLevel == Calendars.CAL_ACCESS_CONTRIBUTOR || accessLevel == Calendars.CAL_ACCESS_EDITOR
- || accessLevel == Calendars.CAL_ACCESS_OWNER || accessLevel == Calendars.CAL_ACCESS_ROOT);
- }
-
- public String getRef() {
- return this.getAccountName() + "/" + this.getDisplayName();
- }
-
- public boolean canAccess(boolean needWriteAccess) {
- if (!this.isLocal() && !this.isSynchronized()) {
- return false;
- }
- if (!needWriteAccess) {
- return this.isReadable();
- }
- return this.isWriteable();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEvent.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEvent.java
deleted file mode 100644
index 5ed70bc..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEvent.java
+++ /dev/null
@@ -1,570 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class DbEvent implements Event {
- private DbObject mObject = null;
- private final EventsTable mTable;
- private static final DateTimeZone UTC_ZONE = DateTimeZone.forID("UTC");
-
- // Event meta fields
- private DbObject.LongField mId, mCalendarId;
- private DbObject.StringField mSyncId;
- private DbObject.BooleanField mLastSynced, mDeleted, mDirty;
- private DbObject.StringField mAccountType;
- private DbObject.StringField mSyncData2;
- private DbObject.StringField mUid2445;
-
- // Event fields
- private DbObject.StringField mOrganizer;
- private DbObject.StringField mTitle, mLocation, mDescription;
- private DbObject.LongField mStartTimeLong, mEndTimeLong;
- private DateTime mStartTime, mEndTime;
- private DbObject.StringField mDuration;
- private DbObject.BooleanField mAllDay;
- private DbObject.StringField mStartTimeZoneStr, mEndTimeZoneStr;
- private DateTimeZone mStartTimeZone, mEndTimeZone;
- private DbObject.StringField mRecurrenceRule, mRecurrenceDate;
- private DbObject.StringField mRecurrenceExRule, mRecurrenceExDate;
- private DbObject.LongField mLastDateLong;
- private DateTime mLastDate;
- private DbObject.LongField mOriginalID;
- private DbObject.BooleanField mOriginalAllDay;
- private DbObject.LongField mOriginalInstanceTimeLong;
- private DateTime mOriginalInstanceTime;
- private DbObject.IntegerField mAccessLevel;
- private DbObject.IntegerFieldWithNull mAvailability, mAvailabilitySamsung;
- private DbObject.IntegerFieldWithNull mStatus;
- private DbObject.IntegerField mSelfAttendeeStatus;
-
- // HTC fields
- private DbObject.StringField mHtcIcalGuid;
-
- public static List getAll(EventsTable table) {
- List events = new LinkedList();
- Cursor cur = table.query(null, null, null);
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- DbEvent event = new DbEvent(table, new DbObject(cur));
- event.loadAll();
- events.add(event);
- }
- } finally {
- cur.close();
- }
- }
- return events;
- }
-
- public static Event get(EventsTable table, long id, ContentValues delta) {
- Cursor cur = table.getById(id);
- if (cur != null) {
- try {
- if (cur.moveToNext()) {
- DbObject obj = delta != null ? new DbObjectWithDelta(cur, delta) : new DbObject(cur);
- DbEvent result = new DbEvent(table, obj);
- result.loadAll();
- return result;
- }
- } finally {
- cur.close();
- }
- }
-
- if (delta != null) {
- return new DbEvent(table, new DbObjectWithDelta(null, delta));
- }
-
- return null;
- }
-
- public static Event get(EventsTable table, long id) {
- return DbEvent.get(table, id, null);
- }
-
- public DbEvent(EventsTable table, DbObject obj) {
- mTable = table;
- mObject = obj;
- }
-
- public DbEvent(EventsTable table, DbCalendar parent) {
- mTable = table;
- mObject = new DbObject(null);
- mAccountType = new DbObject.StringField(mTable.ACCOUNT_TYPE);
- mAccountType.isLoaded = true;
- mAccountType.value = parent.getAccountType();
- }
-
- @Override
- public String toString() {
- String result = "";
- if (mId.isLoaded) {
- result += "Id: " + mId.value + "\n";
- }
- if (mTitle.isLoaded) {
- result += "Title: " + mTitle.value + "\n";
- }
- if (mStartTimeLong.isLoaded) {
- result += "Start: " + mStartTimeLong.value + "\n";
- }
- if (mLocation.isLoaded) {
- result += "Location: " + mLocation.value + "\n";
- }
- return result;
- }
-
- public void loadAll() {
- try {
- this.getId();
- this.getCalendarId();
- this.getSyncId();
- this.isLastSynced();
- this.isDeleted();
- this.isDirty();
- this.getAccountType();
- this.getSyncData2();
- this.getUid2445();
-
- this.getOrganizer();
- this.getTitle();
- this.getLocation();
- this.getDescription();
- this.getStartTime();
- this.getEndTime();
- this.getDuration();
- this.isAllDay();
- this.getStartTimeZone(true);
- this.getEndTimeZone();
- this.getRecurrenceRule();
- this.getRecurrenceDate();
- this.getRecurrenceExRule();
- this.getRecurrenceExDate();
- this.getLastDate();
- this.getOriginalID();
- this.isOriginalAllDay();
- this.getOriginalInstanceTime();
- this.getAccessLevel();
- this.getAvailability();
- this.getAvailabilitySamsung();
- this.getStatus();
- this.getSelfAttendeeStatus();
-
- this.getHtcIcalGuid();
- } finally {
- // Release cursor
- mObject.releaseCursor();
- }
- }
-
- @Override
- public long getId() {
- if (mId == null) {
- mId = new DbObject.LongField(mTable._ID);
- }
- return mObject.loadField(mId);
- }
-
- @Override
- public long getCalendarId() {
- if (mCalendarId == null) {
- mCalendarId = new DbObject.LongField(mTable.CALENDAR_ID);
- }
- return mObject.loadField(mCalendarId);
- }
-
- public String getSyncId() {
- if (mSyncId == null) {
- mSyncId = new DbObject.StringField(mTable._SYNC_ID);
- }
- return mObject.loadField(mSyncId);
- }
-
- public boolean isLastSynced() {
- if (mLastSynced == null) {
- mLastSynced = new DbObject.BooleanField(mTable.LAST_SYNCED);
- }
- return mObject.loadField(mLastSynced);
- }
-
- @Override
- public boolean isDeleted() {
- if (mDeleted == null) {
- mDeleted = new DbObject.BooleanField(mTable.DELETED);
- }
- return mObject.loadField(mDeleted);
- }
-
- @Override
- public boolean isDirty() {
- if (mDirty == null) {
- mDirty = new DbObject.BooleanField(mTable.DIRTY);
- }
- return mObject.loadField(mDirty);
- }
-
- public String getAccountType() {
- if (mAccountType == null) {
- mAccountType = new DbObject.StringField(mTable.ACCOUNT_TYPE);
- }
- return mObject.loadField(mAccountType);
- }
-
- public String getSyncData2() {
- if (mSyncData2 == null) {
- mSyncData2 = new DbObject.StringField(mTable.SYNC_DATA2);
- }
- return mObject.loadField(mSyncData2);
- }
-
- public String getUid2445() {
- if (mUid2445 == null) {
- mUid2445 = new DbObject.StringField(mTable.UID_2445);
- }
- return mObject.loadField(mUid2445);
- }
-
- @Override
- public String getOrganizer() {
- if (mOrganizer == null) {
- mOrganizer = new DbObject.StringField(mTable.ORGANIZER);
- }
- return mObject.loadField(mOrganizer);
- }
-
- @Override
- public String getTitle() {
- if (mTitle == null) {
- mTitle = new DbObject.StringField(mTable.TITLE);
- }
- return mObject.loadField(mTitle);
- }
-
- @Override
- public String getLocation() {
- if (mLocation == null) {
- mLocation = new DbObject.StringField(mTable.EVENT_LOCATION);
- }
- return mObject.loadField(mLocation);
- }
-
- @Override
- public String getDescription() {
- if (mDescription == null) {
- mDescription = new DbObject.StringField(mTable.DESCRIPTION);
- }
- return mObject.loadField(mDescription);
- }
-
- @Override
- public DateTime getStartTime() {
- if (mStartTime == null) {
- mStartTimeLong = new DbObject.LongField(mTable.DTSTART);
- long startTimeLong = mObject.loadField(mStartTimeLong);
-
- if (this.isAllDay()) {
- // Convert to start of day in the calendar's time zone
- DateTime date = new DateTime(startTimeLong, UTC_ZONE);
- mStartTime = new DateTime(date.year().get(), date.monthOfYear().get(), date.dayOfMonth().get(), 0, 0,
- getCalendarTimeZone());
- } else {
- mStartTime = new DateTime(startTimeLong, getStartTimeZone(false));
- }
- }
-
- return mStartTime;
- }
-
- @Override
- public DateTime getEndTime() {
- if (mEndTime == null) {
- mEndTimeLong = new DbObject.LongField(mTable.DTEND);
- long endTimeLong = mObject.loadField(mEndTimeLong);
-
- if (this.isAllDay()) {
- DateTime date = new DateTime(endTimeLong, UTC_ZONE);
- mEndTime = new DateTime(date.year().get(), date.monthOfYear().get(), date.dayOfMonth().get(), 0, 0,
- getCalendarTimeZone());
- } else {
- mEndTime = new DateTime(endTimeLong, getEndTimeZone() != null ? getEndTimeZone() : getStartTimeZone(false));
- }
- }
-
- return mEndTime;
- }
-
- @Override
- public String getDuration() {
- if (mDuration == null) {
- mDuration = new DbObject.StringField(mTable.DURATION);
- }
- return mObject.loadField(mDuration);
- }
-
- @Override
- public boolean isAllDay() {
- if (mAllDay == null) {
- mAllDay = new DbObject.BooleanField(mTable.ALL_DAY);
- }
- return mObject.loadField(mAllDay);
- }
-
- @Override
- public DateTimeZone getStartTimeZone(boolean allowNull) {
- if (mStartTimeZone == null) {
- if (mStartTimeZoneStr == null) {
- mStartTimeZoneStr = new DbObject.StringField(mTable.EVENT_TIMEZONE);
- }
- String startTZ = mObject.loadField(mStartTimeZoneStr);
-
- if (startTZ != null && !startTZ.contentEquals("")) {
- mStartTimeZone = DateTimeZone.forID(startTZ);
- }
- }
-
- if (mStartTimeZone == null && !allowNull) {
- return DateTimeZone.getDefault();
- }
-
- return mStartTimeZone;
- }
-
- @Override
- public DateTimeZone getEndTimeZone() {
- if (mEndTimeZone == null && mEndTimeZoneStr == null) {
- mEndTimeZoneStr = new DbObject.StringField(mTable.EVENT_END_TIMEZONE);
- String endTZ = mObject.loadField(mEndTimeZoneStr);
-
- if (endTZ != null && !endTZ.contentEquals("")) {
- mEndTimeZone = DateTimeZone.forID(endTZ);
- }
- }
-
- return mEndTimeZone;
- }
-
- @Override
- public String getRecurrenceRule() {
- if (mRecurrenceRule == null) {
- mRecurrenceRule = new DbObject.StringField(mTable.RRULE);
- }
- return mObject.loadField(mRecurrenceRule);
- }
-
- @Override
- public String getRecurrenceDate() {
- if (mRecurrenceDate == null) {
- mRecurrenceDate = new DbObject.StringField(mTable.RDATE);
- }
- return mObject.loadField(mRecurrenceDate);
- }
-
- @Override
- public String getRecurrenceExRule() {
- if (mRecurrenceExRule == null) {
- mRecurrenceExRule = new DbObject.StringField(mTable.EXRULE);
- }
- return mObject.loadField(mRecurrenceExRule);
- }
-
- @Override
- public String getRecurrenceExDate() {
- if (mRecurrenceExDate == null) {
- mRecurrenceExDate = new DbObject.StringField(mTable.EXDATE);
- }
- return mObject.loadField(mRecurrenceExDate);
- }
-
- @Override
- public DateTime getLastDate() {
- if (mLastDate == null) {
- if (mLastDateLong == null) {
- mLastDateLong = new DbObject.LongField(mTable.LAST_DATE);
- }
- mLastDate = new DateTime(mObject.loadField(mLastDateLong), getEndTimeZone() != null ? getEndTimeZone()
- : getStartTimeZone(false));
- }
-
- return mLastDate;
- }
-
- @Override
- public long getOriginalID() {
- if (mOriginalID == null) {
- mOriginalID = new DbObject.LongField(mTable.ORIGINAL_ID);
- }
- return mObject.loadField(mOriginalID);
- }
-
- @Override
- public boolean isOriginalAllDay() {
- if (mOriginalAllDay == null) {
- mOriginalAllDay = new DbObject.BooleanField(mTable.ORIGINAL_ALL_DAY);
- }
- return mObject.loadField(mOriginalAllDay);
- }
-
- @Override
- public DateTime getOriginalInstanceTime() {
- if (mOriginalInstanceTime == null) {
- mOriginalInstanceTimeLong = new DbObject.LongField(mTable.ORIGINAL_INSTANCE_TIME);
- long oitLong = mObject.loadField(mOriginalInstanceTimeLong);
-
- mOriginalInstanceTime = new DateTime(oitLong, getStartTimeZone(false));
- }
-
- return mOriginalInstanceTime;
- }
-
- @Override
- public int getAccessLevel() {
- if (mAccessLevel == null) {
- mAccessLevel = new DbObject.IntegerField(mTable.ACCESS_LEVEL);
- }
- return mObject.loadField(mAccessLevel);
- }
-
- @Override
- public int getAvailability() {
- if (mAvailability == null) {
- mAvailability = new DbObject.IntegerFieldWithNull(mTable.AVAILABILITY);
- }
- return mObject.loadField(mAvailability);
- }
-
- @Override
- public int getAvailabilitySamsung() {
- if (mAvailabilitySamsung == null) {
- mAvailabilitySamsung = new DbObject.IntegerFieldWithNull(mTable.AVAILABILITY_SAMSUNG);
- }
- return mObject.loadField(mAvailabilitySamsung);
- }
-
- @Override
- public boolean hasAvailabilitySamsung() {
- if (!Device.Samsung.supportsAvailabilitySamsung(this.getAccountType())) {
- return false;
- }
- this.getAvailabilitySamsung();
- return mAvailabilitySamsung.isLoaded && !mAvailabilitySamsung.isNull && this.getId() > 0;
- }
-
- @Override
- public int getStatus() {
- if (mStatus == null) {
- mStatus = new DbObject.IntegerFieldWithNull(mTable.STATUS);
- }
- return mObject.loadField(mStatus);
- }
-
- @Override
- public boolean hasStatus() {
- this.getStatus();
- return mStatus.isLoaded && !mStatus.isNull && this.getId() > 0;
- }
-
- @Override
- public int getSelfAttendeeStatus() {
- if (mSelfAttendeeStatus == null) {
- mSelfAttendeeStatus = new DbObject.IntegerField(mTable.SELF_ATTENDEE_STATUS);
- }
- return mObject.loadField(mSelfAttendeeStatus);
- }
-
- public String getHtcIcalGuid() {
- if (mHtcIcalGuid == null) {
- mHtcIcalGuid = new DbObject.StringField(mTable.HTC_ICAL_GUID);
- }
- return mObject.loadField(mHtcIcalGuid);
- }
-
- @Override
- public String getUniqueId() {
- if (this.isDeleted()) {
- return "";
- }
-
- // Try to get reasonably static ids for events across devices/OSes
- String accountType = this.getAccountType();
- if (accountType != null && accountType.contentEquals("com.google")) {
- String possibleId = this.getSyncId();
- if (possibleId != null) {
- return possibleId;
- }
- return "";
- }
- if (accountType != null && accountType.contentEquals("com.android.exchange")) {
- String possibleId = this.getSyncData2();
- if (possibleId != null && possibleId.length() > 2) {
- return possibleId;
- }
- possibleId = this.getSyncId();
- if (possibleId != null) {
- return possibleId;
- }
- return "";
- }
-
- // Try HTC fields, but not for recurring exceptions (same id as parent)
- if (!this.isRecurringEventException()) {
- String possibleId = this.getHtcIcalGuid();
- if (possibleId != null) {
- return possibleId;
- }
- }
-
- // Try Uid2445 field (Jelly Bean MR1+)
- String possibleId = this.getUid2445();
- if (possibleId != null) {
- return possibleId;
- }
-
- if (this.getId() > 0) {
- return "" + this.getId();
- }
- return "";
- }
-
- @Override
- public boolean isRecurringEvent() {
- return this.getDuration() != null;
- }
-
- @Override
- public boolean isRecurringEventException() {
- return this.getOriginalID() != 0;
- }
-
- @Override
- public boolean isSingleEvent() {
- return !this.isRecurringEvent() && !this.isRecurringEventException();
- }
-
- @Override
- public Period getPeriod() {
- if (!this.isRecurringEvent()) {
- // Simplest case: event period is from start to end
- return new Period(this.getStartTime(), this.getEndTime());
- }
-
- if (this.getLastDate() != null) {
- // Return period between start time and last date
- return new Period(this.getStartTime(), this.getLastDate());
- }
-
- return new Period(this.getStartTime(), Utilities.INFINITY);
- }
-
- @Override
- public DateTimeZone getCalendarTimeZone() {
- DbCalendar cal = CalendarLoader.getCalendar(this.getCalendarId());
- return cal != null ? cal.getTimeZone() : null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEventIterator.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEventIterator.java
deleted file mode 100644
index 1b0ee06..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbEventIterator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.database.Cursor;
-import android.provider.CalendarContract.Events;
-
-public class DbEventIterator extends EventIterator {
- private EventsTable mEventsTable = new EventsTable(ClonerApp.getDb(true));
-
- public DbEventIterator(ClonerLog log) {
- super(log);
- }
-
- @Override
- protected Cursor doQuery(long sourceCalendarId) {
- return mEventsTable.query("((" + Events.CALENDAR_ID + "=? AND " + Events.ORIGINAL_ID + " ISNULL))",
- new String[] { "" + sourceCalendarId }, Events.DTSTART + " ASC");
- }
-
- @Override
- protected DbEvent getEvent(Cursor cur) {
- return new DbEvent(mEventsTable, new DbObject(cur));
- }
-
- @Override
- protected EventsTable getTable() {
- return mEventsTable;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstance.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstance.java
deleted file mode 100644
index 18bbae9..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstance.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public class DbInstance extends DbEvent {
- private final DbObject mObject;
- private final InstancesTable mTable;
- private static final DateTimeZone UTC_ZONE = DateTimeZone.forID("UTC");
-
- // Instance fields
- private DbObject.LongField mBeginLong, mEndLong;
- private DateTime mBegin, mEnd;
- private DbObject.IntegerField mStartDay, mStartMinute, mEndDay, mEndMinute;
- private DbObject.LongField mEventId;
-
- public DbInstance(InstancesTable table, DbObject obj) {
- super(table, obj);
- mTable = table;
- mObject = obj;
- }
-
- @Override
- public void loadAll() {
- try {
- this.getBegin();
- this.getEnd();
- this.getStartDay();
- this.getStartMinute();
- this.getEndDay();
- this.getEndMinute();
- this.getEventId();
- } finally {
- // Load super and release cursor
- super.loadAll();
- }
- }
-
- public DateTime getBegin() {
- if (mBegin == null) {
- mBeginLong = new DbObject.LongField(mTable.BEGIN);
- long beginLong = mObject.loadField(mBeginLong);
-
- if (this.isAllDay()) {
- // Convert to start of day in the calendar's time zone
- DateTime date = new DateTime(beginLong, UTC_ZONE);
- mBegin = new DateTime(date.year().get(), date.monthOfYear().get(), date.dayOfMonth().get(), 0, 0,
- getCalendarTimeZone());
- } else {
- mBegin = new DateTime(beginLong, getStartTimeZone(false));
- }
- }
-
- return mBegin;
- }
-
- public DateTime getEnd() {
- if (mEnd == null) {
- if (this.isAllDay()) {
- mEnd = getBegin().plusDays(1);
- } else {
- mEndLong = new DbObject.LongField(mTable.END);
- mEnd = new DateTime(mObject.loadField(mEndLong), getEndTimeZone() != null ? getEndTimeZone()
- : getStartTimeZone(false));
- }
- }
-
- return mEnd;
- }
-
- public int getStartDay() {
- if (mStartDay == null) {
- mStartDay = new DbObject.IntegerField(mTable.START_DAY);
- }
- return mObject.loadField(mStartDay);
- }
-
- public int getStartMinute() {
- if (mStartMinute == null) {
- mStartMinute = new DbObject.IntegerField(mTable.START_MINUTE);
- }
- return mObject.loadField(mStartMinute);
- }
-
- public int getEndDay() {
- if (mEndDay == null) {
- mEndDay = new DbObject.IntegerField(mTable.END_DAY);
- }
- return mObject.loadField(mEndDay);
- }
-
- public int getEndMinute() {
- if (mEndMinute == null) {
- mEndMinute = new DbObject.IntegerField(mTable.END_MINUTE);
- }
- return mObject.loadField(mEndMinute);
- }
-
- public long getEventId() {
- if (mEventId == null) {
- mEventId = new DbObject.LongField(mTable.EVENT_ID);
- }
- return mObject.loadField(mEventId);
- }
-
- @Override
- public DateTime getStartTime() {
- return this.getBegin();
- }
-
- @Override
- public DateTime getEndTime() {
- return this.getEnd();
- }
-
- @Override
- public boolean isRecurringEvent() {
- return false;
- }
-
- @Override
- public boolean isRecurringEventException() {
- return false;
- }
-
- @Override
- public String getUniqueId() {
- if (super.isRecurringEvent()) {
- // Generate unique ids for each instance of a recurring event
- return super.getUniqueId() + "@" + Utilities.dateTimeToTimeString(this.getBegin());
- }
- return super.getUniqueId();
- }
-
- @Override
- public String toString() {
- return super.toString();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstanceIterator.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstanceIterator.java
deleted file mode 100644
index 818fc5b..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbInstanceIterator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.database.Cursor;
-
-public class DbInstanceIterator extends EventIterator {
- private final InstancesTable mInstancesTable = new InstancesTable(ClonerApp.getDb(true));
- private final Period mPeriod;
-
- public DbInstanceIterator(Period period, ClonerLog log) {
- super(log);
- mPeriod = period;
- }
-
- @Override
- protected Cursor doQuery(long sourceCalendarId) {
- return mInstancesTable.queryByDay(sourceCalendarId, mPeriod.getStart().getMillis(), mPeriod.getEnd()
- .getMillis());
- }
-
- @Override
- protected DbEvent getEvent(Cursor cur) {
- return new DbInstance(mInstancesTable, new DbObject(cur));
- }
-
- @Override
- protected EventsTable getTable() {
- return mInstancesTable;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObject.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObject.java
deleted file mode 100644
index e00a61a..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObject.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.database.Cursor;
-
-public class DbObject {
- private Cursor mCur;
-
- protected static class Field {
- ClonerTable.Column column;
- boolean isLoaded = false;
-
- public Field(ClonerTable.Column col) {
- column = col;
- }
- }
-
- protected static class BooleanField extends Field {
- boolean value;
-
- public BooleanField(ClonerTable.Column column) {
- super(column);
- }
- }
-
- protected static class IntegerField extends Field {
- int value;
-
- public IntegerField(ClonerTable.Column column) {
- super(column);
- }
- }
-
- protected static class IntegerFieldWithNull extends IntegerField {
- boolean isNull;
-
- public IntegerFieldWithNull(ClonerTable.Column column) {
- super(column);
- }
- }
-
- protected static class LongField extends Field {
- long value;
-
- public LongField(ClonerTable.Column column) {
- super(column);
- }
- }
-
- protected static class StringField extends Field {
- String value;
-
- public StringField(ClonerTable.Column column) {
- super(column);
- }
- }
-
- public DbObject(Cursor cur) {
- mCur = cur;
- }
-
- public boolean hasCursor() {
- return mCur != null;
- }
-
- public boolean hasColumn(ClonerTable.Column col) {
- if (this.hasCursor()) {
- return col.isPresent();
- }
- return false;
- }
-
- public boolean hasFilledColumn(ClonerTable.Column col) {
- if (this.hasColumn(col)) {
- return mCur.getString(col.getColumnIndex()) != null;
- }
- return false;
- }
-
- public void releaseCursor() {
- mCur = null;
- }
-
- public boolean loadField(BooleanField field) {
- if (!field.isLoaded) {
- if (this.hasCursor() && field.column.isPresent()) {
- final int columnIndex = field.column.getColumnIndex();
- try {
- field.value = mCur.getInt(columnIndex) != 0;
- } catch (NumberFormatException e) {
- field.value = false;
- }
- field.isLoaded = true;
- } else {
- field.value = false;
- }
- }
- return field.value;
- }
-
- public int loadField(IntegerField field) {
- if (!field.isLoaded) {
- if (this.hasCursor() && field.column.isPresent()) {
- final int columnIndex = field.column.getColumnIndex();
- try {
- field.value = mCur.getInt(columnIndex);
- } catch (NumberFormatException e) {
- field.value = 0;
- }
- field.isLoaded = true;
- } else {
- field.value = 0;
- }
- }
- return field.value;
- }
-
- public int loadField(IntegerFieldWithNull field) {
- if (!field.isLoaded) {
- if (this.hasCursor() && field.column.isPresent()) {
- final int columnIndex = field.column.getColumnIndex();
- field.isNull = mCur.isNull(columnIndex);
- if (!field.isNull) {
- try {
- field.value = mCur.getInt(columnIndex);
- } catch (NumberFormatException e) {
- field.value = 0;
- }
- } else {
- field.value = 0;
- }
- field.isLoaded = true;
- } else {
- field.value = 0;
- }
- }
- return field.value;
- }
-
- public long loadField(LongField field) {
- if (!field.isLoaded) {
- if (this.hasCursor() && field.column.isPresent()) {
- final int columnIndex = field.column.getColumnIndex();
- try {
- field.value = mCur.getLong(columnIndex);
- } catch (Exception e) {
- field.value = 0;
- }
- field.isLoaded = true;
- } else {
- field.value = 0;
- }
- }
- return field.value;
- }
-
- public String loadField(StringField field) {
- if (!field.isLoaded) {
- if (this.hasCursor() && field.column.isPresent()) {
- String value = mCur.getString(field.column.getColumnIndex());
- field.value = value;
- field.isLoaded = true;
- } else {
- field.value = null;
- }
- }
- return field.value;
- }
-
- public int getInt(ClonerTable.Column col) {
- if (mCur != null) {
- if (col.isPresent()) {
- return mCur.getInt(col.getColumnIndex());
- }
- }
- return 0;
- }
-
- public long getLong(ClonerTable.Column col) {
- if (mCur != null) {
- if (col.isPresent()) {
- return mCur.getLong(col.getColumnIndex());
- }
- }
- return 0;
- }
-
- public String getString(ClonerTable.Column col) {
- if (mCur != null) {
- if (col.isPresent()) {
- return mCur.getString(col.getColumnIndex());
- }
- }
- return null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObjectWithDelta.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObjectWithDelta.java
deleted file mode 100644
index 1921507..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbObjectWithDelta.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-
-public class DbObjectWithDelta extends DbObject {
- ContentValues mDelta;
-
- public DbObjectWithDelta(Cursor cur, ContentValues delta) {
- super(cur);
- mDelta = delta;
- }
-
- @Override
- public boolean loadField(BooleanField field) {
- if (mDelta != null && mDelta.containsKey(field.column.getName())) {
- field.isLoaded = true;
- field.value = mDelta.getAsInteger(field.column.getName()) != 0;
- return field.value;
- }
- return super.loadField(field);
- }
-
- public int loadField(IntegerField field) {
- if (mDelta != null && mDelta.containsKey(field.column.getName())) {
- field.isLoaded = true;
- field.value = mDelta.getAsInteger(field.column.getName());
- return field.value;
- }
- return super.loadField(field);
- }
-
- public int loadField(IntegerFieldWithNull field) {
- if (mDelta != null && mDelta.containsKey(field.column.getName())) {
- field.isLoaded = true;
- field.isNull = false;
- field.value = mDelta.getAsInteger(field.column.getName());
- return field.value;
- }
- return super.loadField(field);
- }
-
- public long loadField(LongField field) {
- if (mDelta != null && mDelta.containsKey(field.column.getName())) {
- field.isLoaded = true;
- field.value = mDelta.getAsLong(field.column.getName());
- return field.value;
- }
- return super.loadField(field);
- }
-
- public String loadField(StringField field) {
- if (mDelta != null && mDelta.containsKey(field.column.getName())) {
- field.isLoaded = true;
- field.value = mDelta.getAsString(field.column.getName());
- return field.value;
- }
- return super.loadField(field);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbReminder.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbReminder.java
deleted file mode 100644
index 915d455..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DbReminder.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class DbReminder {
- private DbObject mObject;
- private RemindersTable mTable;
-
- // Reminder fields
- private long mId, mEventId;
- private int mMethod, mMinutes;
-
- // Reminder field indicators
- private boolean mIdLoaded = false;
- private boolean mEventIdLoaded = false;
- private boolean mMethodLoaded = false;
- private boolean mMinutesLoaded = false;
-
- public static List getReminders(RemindersTable table, long eventId, Map deltas) {
- List reminders = new LinkedList();
- Cursor cur = table.query("((" + table.EVENT_ID.getName() + "=?))", new String[] { "" + eventId },
- table._ID.getName() + " ASC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- ContentValues delta = deltas != null ? deltas.get(cur.getLong(table._ID.getColumnIndex())) : null;
- DbObject obj = delta != null ? new DbObjectWithDelta(cur, delta) : new DbObject(cur);
- DbReminder reminder = new DbReminder(table, obj);
- reminder.loadAll();
- reminders.add(reminder);
- }
- } finally {
- cur.close();
- }
- }
- return reminders;
- }
-
- public static List getReminders(RemindersTable table, long eventId) {
- return DbReminder.getReminders(table, eventId, null);
- }
-
- public DbReminder(RemindersTable table, DbObject obj) {
- mTable = table;
- mObject = obj;
- }
-
- public DbReminder(RemindersTable table, int method, int minutes) {
- mTable = table;
- mObject = new DbObject(null);
- mId = 0;
- mIdLoaded = true;
- mEventId = 0;
- mEventIdLoaded = true;
- mMethod = method;
- mMethodLoaded = true;
- mMinutes = minutes;
- mMinutesLoaded = true;
- }
-
- public void loadAll() {
- try {
- this.getId();
- this.getEventId();
- this.getMethod();
- this.getMinutes();
- } finally {
- // Release cursor
- mObject.releaseCursor();
- }
- }
-
- public long getId() {
- if (!mIdLoaded) {
- mId = mObject.getLong(mTable._ID);
- mIdLoaded = true;
- }
- return mId;
- }
-
- public long getEventId() {
- if (!mEventIdLoaded) {
- mEventId = mObject.getLong(mTable.EVENT_ID);
- mEventIdLoaded = true;
- }
- return mEventId;
- }
-
- public int getMethod() {
- if (!mMethodLoaded) {
- mMethod = mObject.getInt(mTable.METHOD);
- mMethodLoaded = true;
- }
- return mMethod;
- }
-
- public int getMinutes() {
- if (!mMinutesLoaded) {
- mMinutes = mObject.getInt(mTable.MINUTES);
- mMinutesLoaded = true;
- }
- return mMinutes;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Device.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Device.java
deleted file mode 100644
index 330296f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Device.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class Device {
- public static class Samsung {
- public static final String AVAILABILITY = "availabilityStatus";
- public static final int AVAILABILITY_FREE = 0;
- public static final int AVAILABILITY_TENTATIVE = 1;
- public static final int AVAILABILITY_BUSY = 2;
- public static final int AVAILABILITY_OUT_OF_OFFICE = 3;
-
- public static boolean supportsAvailabilitySamsung(String accountType) {
- if (!ClonerApp.getDevice().supportsAvailabilitySamsung()) {
- return false;
- }
- if (accountType != null && accountType.contentEquals("com.android.exchange")) {
- return true;
- }
- return false;
- }
-
- public static int fromRegularAvailability(int availability) {
- switch (availability) {
- case Availabilities.AVAILABILITY_FREE:
- return AVAILABILITY_FREE;
- case Availabilities.AVAILABILITY_TENTATIVE:
- return AVAILABILITY_TENTATIVE;
- case Availabilities.AVAILABILITY_BUSY:
- default:
- return AVAILABILITY_BUSY;
- }
- }
-
- public static int toRegularAvailability(int availability) {
- switch (availability) {
- case AVAILABILITY_FREE:
- return Availabilities.AVAILABILITY_FREE;
- case AVAILABILITY_TENTATIVE:
- return Availabilities.AVAILABILITY_TENTATIVE;
- case AVAILABILITY_BUSY:
- case AVAILABILITY_OUT_OF_OFFICE:
- default:
- return Availabilities.AVAILABILITY_BUSY;
- }
- }
- }
-
- private boolean mSupportsAvailabilitySamsung;
-
- public Device() {
- EventsTable table = new EventsTable(ClonerApp.getDb(true));
- mSupportsAvailabilitySamsung = table.supportsColumn(table.AVAILABILITY_SAMSUNG);
- }
-
- public boolean supportsAvailabilitySamsung() {
- return mSupportsAvailabilitySamsung;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Differ.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Differ.java
deleted file mode 100644
index 660dffc..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Differ.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-
-public class Differ {
- protected void compareField(ClonerTable.Column field, String newValue, String oldValue, boolean mandatoryField,
- ContentValues delta) {
- if (newValue != null) {
- newValue = newValue.trim();
- } else {
- newValue = "";
- }
- if (oldValue != null) {
- oldValue = oldValue.trim();
- } else {
- oldValue = "";
- }
-
- // If mandatory field or the new value differs from the old value
- if (mandatoryField || !newValue.contentEquals(oldValue)) {
- // Add field to the delta
- delta.put(field.getName(), newValue);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesActivity.java
deleted file mode 100644
index 8822827..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesActivity.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.LoaderManager.LoaderCallbacks;
-import android.content.Intent;
-import android.content.Loader;
-import android.os.Bundle;
-import android.provider.CalendarContract.Events;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-public class DuplicatesActivity extends Activity implements LoaderCallbacks {
- CalendarsTable mCalendarsTable = new CalendarsTable(ClonerApp.getDb(true));
- List mCalendarRefs = CalendarLoader.getValidRefs();
- DuplicatesAdapter mAdapter;
- Spinner mSearchCalendarView;
- MenuItem mRefresh;
- long mRowCount = 0;
-
- long mSearchCalendarId = -1;
- Loader mLastLoader = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
-
- setContentView(R.layout.duplicatesactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
- this.getActionBar().setTitle(R.string.duplicates_activity_title);
-
- String[] calNames = new String[mCalendarRefs.size() + 1];
- calNames[0] = ClonerApp.translate(R.string.duplicates_all_calendars);
- for (int index = 0; index < mCalendarRefs.size(); index++) {
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mCalendarRefs.get(index));
- if (info.getCalendar() != null) {
- calNames[index + 1] = info.getCalendar().getDisplayName();
- } else {
- calNames[index + 1] = "###";
- }
- }
-
- mSearchCalendarView = (Spinner) findViewById(R.id.searchCalendar);
- ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, calNames);
- adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
- mSearchCalendarView.setAdapter(adapter);
- mSearchCalendarView.setSelection(0);
- mSearchCalendarView.setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> view, View item, int position, long id) {
- long newCalId;
- if (position > 0) {
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mCalendarRefs.get(position - 1));
- if (info.getCalendar() != null) {
- newCalId = info.getCalendar().getId();
- } else {
- newCalId = -1;
- }
- } else {
- newCalId = -1;
- }
- if (newCalId != mSearchCalendarId) {
- mSearchCalendarId = newCalId;
- updateQuery();
- }
- }
-
- @Override
- public void onNothingSelected(AdapterView> arg0) {
- mSearchCalendarId = -1;
- updateQuery();
- }
- });
-
- ListView lv = (ListView) findViewById(R.id.eventList);
- mAdapter = new DuplicatesAdapter(this, R.layout.duplicatesrow_layout, null);
- lv.setAdapter(mAdapter);
- lv.setOnItemClickListener(new OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> view, View item, int position, long id) {
- Intent i = new Intent(DuplicatesActivity.this, BrowseActivity.class);
- String selection = "";
- ArrayList events = mAdapter.getDuplicates()[position].events;
- for (int index = 0; index < events.size(); index++) {
- if (index > 0) {
- selection += " OR ";
- }
- selection += Events._ID + "=" + events.get(index).eventId;
- }
- i.putExtra("duplicatesSelection", selection);
- startActivity(i);
- }
- });
- }
-
- @Override
- public void onStart() {
- getLoaderManager().initLoader(0, null, this);
- super.onStart();
- }
-
- private void updateQuery() {
- getLoaderManager().restartLoader(0, null, this);
- }
-
- private class QueryParams {
- String selection = "";
- ArrayList args = new ArrayList();
- }
-
- private QueryParams getQueryParams() {
- QueryParams result = new QueryParams();
- result.selection = "";
- if (mSearchCalendarId >= 0) {
- if (!result.selection.contentEquals("")) {
- result.selection += " AND ";
- }
- result.selection += Events.CALENDAR_ID + " = ?";
- result.args.add("" + mSearchCalendarId);
- }
- return result;
- }
-
- @Override
- public Loader onCreateLoader(int arg0, Bundle arg1) {
- this.updateRefresh(true);
- TextView counter = (TextView) findViewById(R.id.searchCount);
- counter.setText(ClonerApp.translate(R.string.duplicates_loading));
-
- QueryParams query = this.getQueryParams();
- mLastLoader = new DuplicatesLoader(this, query.selection, query.args.toArray(new String[query.args.size()]));
- return mLastLoader;
- }
-
- @Override
- public void onLoadFinished(Loader loader, DuplicatesEntry[] data) {
- DuplicatesLoader dupLoader = (DuplicatesLoader) loader;
- if (!dupLoader.isReset()) {
- mAdapter.swapData(data);
- if (loader == mLastLoader && data != null) {
- this.updateRefresh(false);
- mRowCount = data.length;
- TextView counter = (TextView) findViewById(R.id.searchCount);
- counter.setText(ClonerApp.translate(R.string.duplicates_textview_event_count, new String[] { ""
- + mRowCount }));
- }
- }
- }
-
- @Override
- public void onLoaderReset(Loader loader) {
- mAdapter.swapData(null);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- private void updateRefresh(boolean refresh) {
- if (mRefresh == null) {
- return;
- }
-
- LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext().getSystemService(
- LAYOUT_INFLATER_SERVICE);
- if (refresh) {
- mRefresh.setActionView(inflater.inflate(R.layout.actionbar_indeterminate_progress, null));
- mRefresh.setOnMenuItemClickListener(null);
- } else {
- mRefresh.setActionView(null);
- mRefresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem arg0) {
- updateQuery();
- return true;
- }
- });
- // refreshView = inflater.inflate(R.layout.actionbar_refresh_button, null);
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- mRefresh = menu.add(0, R.id.browse_calendar, 0, ClonerApp.translate(R.string.duplicates_refresh));
- mRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
- this.updateRefresh(true);
- return super.onCreateOptionsMenu(menu);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesAdapter.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesAdapter.java
deleted file mode 100644
index affef76..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesAdapter.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-public class DuplicatesAdapter extends ArrayAdapter {
- LayoutInflater mLi = null;
- DuplicatesEntry[] mDuplicates = null;
- Resources mResources = null;
- int mResourceId;
- int mMaxDuplicates = 0;
- SparseArray mBitmaps = new SparseArray();
- private final static int MAX_ROWS = 32;
-
- public DuplicatesAdapter(Context context, int resourceId, DuplicatesEntry[] duplicates) {
- super(context, resourceId, duplicates != null ? duplicates : new DuplicatesEntry[0]);
- mLi = LayoutInflater.from(context);
- mResources = context.getResources();
- mResourceId = resourceId;
- this.setDuplicates(duplicates);
- }
-
- private void setDuplicates(DuplicatesEntry[] duplicates) {
- if (duplicates == null) {
- duplicates = new DuplicatesEntry[0];
- }
- mDuplicates = duplicates;
- mMaxDuplicates = 0;
- for (int index = 0; index < mDuplicates.length; index++) {
- if (mMaxDuplicates <= mDuplicates[index].events.size()) {
- mMaxDuplicates = mDuplicates[index].events.size();
- }
- }
- }
-
- public DuplicatesEntry[] getDuplicates() {
- return mDuplicates;
- }
-
- public void swapData(DuplicatesEntry[] data) {
- this.setDuplicates(data);
- this.notifyDataSetChanged();
- }
-
- private int getRowCount(int position) {
- int rowCount = mDuplicates[position].events.size();
- if (rowCount > MAX_ROWS) {
- rowCount = MAX_ROWS;
- }
- return rowCount;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View view = convertView;
- if (view == null) {
- view = mLi.inflate(mResourceId, parent, false);
- }
-
- LinearLayout table = (LinearLayout) view.findViewById(R.id.table);
- int rowCount = this.getRowCount(position);
- while (table.getChildCount() < rowCount) {
- mLi.inflate(R.layout.eventrow_layout, table, true);
- }
- while (table.getChildCount() > rowCount) {
- table.removeViewAt(table.getChildCount() - 1);
- }
-
- TextView topline = (TextView) view.findViewById(R.id.topline);
- topline.setText("ID: " + mDuplicates[position].events.get(0).uniqueId);
- for (int index = 0; index < rowCount; index++) {
- View subview = table.getChildAt(index);
- DuplicatesEntry.Entry entry = mDuplicates[position].events.get(index);
- TextView title = (TextView) subview.findViewById(R.id.title);
- TextView subline1 = (TextView) subview.findViewById(R.id.subline1);
- TextView subline2 = (TextView) subview.findViewById(R.id.subline2);
-
- String calendarName = CalendarLoader.getCalendarNameOrErrorMessage(entry.calendarId);
- title.setText(entry.title);
- subline1.setText(entry.eventId + " " + calendarName + " " + Utilities.dateTimeToString(entry.startTime));
- if (entry.location != null) {
- subline2.setText(entry.location);
- } else {
- subline2.setText("");
- }
-
- ImageView recurringIcon = (ImageView) subview.findViewById(R.id.eventRecurring);
- ImageView exceptionIcon = (ImageView) subview.findViewById(R.id.eventException);
- ImageView singleIcon = (ImageView) subview.findViewById(R.id.eventSingle);
- ImageView trashcanIcon = (ImageView) subview.findViewById(R.id.trashcan);
- recurringIcon.setVisibility(entry.isRecurring ? View.VISIBLE : View.GONE);
- exceptionIcon.setVisibility(entry.isException ? View.VISIBLE : View.GONE);
- singleIcon.setVisibility(!entry.isRecurring && !entry.isException ? View.VISIBLE : View.GONE);
- trashcanIcon.setVisibility(entry.isDeleted ? View.VISIBLE : View.GONE);
- }
- return view;
- }
-
- @Override
- public int getCount() {
- if (mDuplicates != null) {
- if (mDuplicates.length > 0) {
- return mDuplicates.length;
- }
- }
- return 0;
- }
-
- @Override
- public DuplicatesEntry getItem(int idx) {
- return (mDuplicates != null) ? mDuplicates[idx] : null;
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public boolean hasStableIds() {
- return true;
- }
-
- @Override
- public int getItemViewType(int pos) {
- return this.getRowCount(pos) - 2;
- }
-
- @Override
- public int getViewTypeCount() {
- return MAX_ROWS;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesEntry.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesEntry.java
deleted file mode 100644
index 3fe2199..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesEntry.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-
-import org.joda.time.DateTime;
-
-public class DuplicatesEntry {
- public static class Entry {
- String uniqueId;
- long eventId;
- DateTime startTime;
- String title;
- long calendarId;
- String location;
- boolean isRecurring;
- boolean isException;
- boolean isDeleted;
- }
-
- public ArrayList events = new ArrayList();
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesLoader.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesLoader.java
deleted file mode 100644
index 505a073..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/DuplicatesLoader.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.provider.CalendarContract.Events;
-
-public class DuplicatesLoader extends AsyncLoader {
- private boolean mCancelled = false;
- private String mSelection;
- private String[] mSelectionArgs;
-
- public DuplicatesLoader(Context context, String selection, String[] selectionArgs) {
- super(context);
- mSelection = selection;
- mSelectionArgs = selectionArgs;
- }
-
- private String getUniqueId(Event event) {
- return "" + event.getCalendarId() + ":" + event.getUniqueId();
- }
-
- @Override
- public DuplicatesEntry[] loadInBackground() {
- mCancelled = false;
- Set uniqueIds = new HashSet();
- Set duplicateIds = new HashSet();
- HashMap duplicates = new HashMap();
-
- EventsTable table = new EventsTable(ClonerApp.getDb(true));
- Cursor cur = table.query(mSelection, mSelectionArgs, Events.DTSTART + " ASC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- if (mCancelled) {
- return null;
- }
-
- Event event = new DbEvent(table, new DbObject(cur));
- // Skip deleted or dirty events
- if (!event.isDeleted() && !event.isDirty()) {
- // Only evaluate normal events (no clones or forwards)
- if (EventMarker.getEventType(event) == EventMarker.TYPE_NORMAL) {
- String uniqueId = this.getUniqueId(event);
- if (uniqueIds.contains(uniqueId)) {
- duplicateIds.add(uniqueId);
- } else {
- uniqueIds.add(uniqueId);
- }
- }
- }
- }
- } finally {
- cur.close();
- }
- }
-
- cur = table.query(mSelection, mSelectionArgs, Events.DTSTART + " ASC");
- if (cur != null) {
- try {
- while (cur.moveToNext()) {
- if (mCancelled) {
- return null;
- }
-
- Event event = new DbEvent(table, new DbObject(cur));
- if (!event.isDeleted() && !event.isDirty()) {
- if (EventMarker.getEventType(event) == EventMarker.TYPE_NORMAL) {
- String uniqueId = this.getUniqueId(event);
- if (duplicateIds.contains(uniqueId)) {
- DuplicatesEntry.Entry entry = new DuplicatesEntry.Entry();
- entry.eventId = event.getId();
- entry.startTime = event.getStartTime();
- entry.title = event.getTitle();
- entry.uniqueId = event.getUniqueId();
- entry.location = event.getLocation();
- entry.calendarId = event.getCalendarId();
- entry.isRecurring = event.isRecurringEvent();
- entry.isException = event.isRecurringEventException();
- entry.isDeleted = event.isDeleted();
-
- DuplicatesEntry duplicate = null;
- if (!duplicates.containsKey(uniqueId)) {
- duplicate = new DuplicatesEntry();
- duplicates.put(uniqueId, duplicate);
- } else {
- duplicate = duplicates.get(uniqueId);
- }
- duplicate.events.add(entry);
- }
- }
- }
- }
- } finally {
- cur.close();
- }
- }
-
- // Clean up
- if (mCancelled) {
- return null;
- }
-
- // Now put all duplicate entries into a sorted array
- DuplicatesEntry[] dups = new DuplicatesEntry[duplicates.size()];
- int index = 0;
- for (DuplicatesEntry entry : duplicates.values()) {
- if (mCancelled) {
- return null;
- }
- dups[index++] = entry;
- }
- return dups;
- }
-
- @Override
- public boolean cancelLoad() {
- mCancelled = true;
- return super.cancelLoad();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Duration.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Duration.java
deleted file mode 100644
index b1f828f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Duration.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class Duration {
- private static class ParseState {
- public String str = "";
- public int pos = 0;
- }
-
- private static char parseToken(ParseState state) {
- if (state != null && state.str.length() > state.pos) {
- return state.str.charAt(state.pos++);
- }
- return '\0';
- }
-
- // Return the duration in milliseconds
- public static long parseDuration(String duration) {
- if (duration == null || duration.length() == 0) {
- // Don't further parse empty string
- return 0;
- }
-
- long result = 0;
- boolean negativeDuration = false;
- ParseState state = new ParseState();
- state.str = duration;
-
- char token = parseToken(state);
- if (token == '+' || token == '-') {
- if (token == '-') {
- negativeDuration = true;
- }
- token = parseToken(state);
- }
-
- if (token != 'P') {
- // Should never happen
- return 0;
- }
-
- // Keep parsing until done, adding up lengths in seconds
- token = parseToken(state);
- while (token != '\0') {
- // Ignore time indicators (superfluous characters in spec)
- if (token == 'T') {
- token = parseToken(state);
- continue;
- }
-
- // Parse a number
- long subresult = 0;
- while (token >= '0' && token <= '9') {
- subresult = subresult * 10 + ((byte) token - (byte) '0');
- token = parseToken(state);
- }
-
- // Parse length
- switch (token) {
- case 'W':
- result += subresult * 60 * 60 * 24 * 7;
- break;
- case 'D':
- result += subresult * 60 * 60 * 24;
- break;
- case 'H':
- result += subresult * 60 * 60;
- break;
- case 'M':
- result += subresult * 60;
- break;
- case 'S':
- result += subresult;
- break;
- default:
- // Error situation
- return 0;
- }
-
- token = parseToken(state);
- }
-
- // Convert to milliseconds
- result *= 1000;
-
- if (negativeDuration) {
- return -result;
- }
- return result;
- }
-
- // Encode a duration in milliseconds to string
- public static String encodeDuration(long duration) {
- String result = "";
- if (duration < 0) {
- result += "-";
- duration = -duration;
- }
-
- // Convert to seconds
- duration /= 1000;
-
- result += "P";
- if (duration > 0) {
- if (duration >= 24 * 60 * 60) {
- long days = duration / (24 * 60 * 60);
- duration = duration % (24 * 60 * 60);
- result += "" + days + "D";
- }
- if (duration > 0) {
- result += "T";
- if (duration >= 60 * 60) {
- long hours = duration / (60 * 60);
- duration = duration % (60 * 60);
- result += "" + hours + "H";
- }
- if (duration >= 60) {
- long minutes = duration / 60;
- duration = duration % 60;
- result += "" + minutes + "M";
- }
- if (duration > 0) {
- result += "" + duration + "S";
- }
- }
- } else {
- result += "T0S";
- }
- return result;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EmailObfuscator.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EmailObfuscator.java
deleted file mode 100644
index 5c3c3ba..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EmailObfuscator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.Locale;
-
-public class EmailObfuscator {
- private static String dummyMethod1(String orgEmail, String dummyEmailDomain) {
- if (orgEmail == null || orgEmail.contentEquals("")) {
- orgEmail = "null";
- }
- // Replace @ with _at_ and append default domain
- while (orgEmail.contains("@")) {
- int pos = orgEmail.indexOf("@");
- orgEmail = orgEmail.substring(0, pos) + "_at_" + orgEmail.substring(pos + 1, orgEmail.length());
- }
-
- return (orgEmail + "@" + dummyEmailDomain).toLowerCase(Locale.getDefault());
- }
-
- @SuppressWarnings("unused")
- private static String dummyMethod2(String orgEmail, String dummyEmailDomain) {
- final char zeroWidthSpace = '\u200b';
- final String insertString = "" + zeroWidthSpace + zeroWidthSpace;
-
- if (orgEmail == null || orgEmail.contentEquals("")) {
- orgEmail = "null@" + dummyEmailDomain;
- }
- for (int index = orgEmail.length() - 1; index >= 0; index--) {
- char c = orgEmail.charAt(index);
- if (c == zeroWidthSpace) {
- // Remove Zero Width Space
- orgEmail = orgEmail.substring(0, index) + orgEmail.substring(index + 1);
- }
- if (c == '@') {
- // Insert string after @-sign
- orgEmail = orgEmail.substring(0, index + 1) + insertString + orgEmail.substring(index + 1);
- }
- }
- return orgEmail;
- }
-
- public static String generateDummyEmailFrom(String orgEmail, String dummyEmailDomain) {
- return dummyMethod1(orgEmail, dummyEmailDomain);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Event.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Event.java
deleted file mode 100644
index 46e1a6a..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Event.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public interface Event {
- public long getId();
- public long getCalendarId();
- public boolean isDeleted();
- public boolean isDirty();
- public String getOrganizer();
- public String getTitle();
- public String getLocation();
- public String getDescription();
- public DateTime getStartTime();
- public DateTime getEndTime();
- public String getDuration();
- public boolean isAllDay();
- public DateTimeZone getStartTimeZone(boolean allowNull);
- public DateTimeZone getEndTimeZone();
- public String getRecurrenceRule();
- public String getRecurrenceDate();
- public String getRecurrenceExRule();
- public String getRecurrenceExDate();
- public DateTime getLastDate();
- public long getOriginalID();
- public boolean isOriginalAllDay();
- public DateTime getOriginalInstanceTime();
- public int getAccessLevel();
- public int getAvailability();
- public int getAvailabilitySamsung();
- public boolean hasAvailabilitySamsung();
- public int getStatus();
- public boolean hasStatus();
- public int getSelfAttendeeStatus();
- public String getUniqueId();
- public boolean isRecurringEvent();
- public boolean isRecurringEventException();
- public boolean isSingleEvent();
- public Period getPeriod();
- public DateTimeZone getCalendarTimeZone();
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventAggregator.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventAggregator.java
deleted file mode 100644
index f9b91ee..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventAggregator.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Events;
-
-import com.dizzl.android.CalendarClonerFree.CalendarLoader.CalendarInfo;
-
-public class EventAggregator extends EventProcessor {
- private final EventDiffer mEventDiffer;
- private final boolean mInvertPeriods;
- private final Period mPeriod;
- private Periods mPeriods = new Periods();
-
- private final EventsTable mEventsTable;
- private final CloneIndex mExistingClones;
- private final CloneIdIndex mValidClones = new CloneIdIndex();
-
- public EventAggregator(Rule rule) {
- super(rule);
- mEventsTable = new EventsTable(ClonerApp.getDb(rule.isReadOnly()));
- mExistingClones = new CloneIndex(mEventsTable);
-
- CalendarInfo info = CalendarLoader.getCalendarByRef(mRule.getDstCalendarRef());
- DateTimeZone tz = info.getCalendar() != null ? info.getCalendar().getTimeZone() : null;
- DateTime startOfToday = new DateTime(tz).withTime(0, 0, 0, 0);
- DateTime start = startOfToday.minus(mRule.getSyncPeriodBefore()).withTime(0, 0, 0, 0);
- DateTime end = startOfToday.plus(mRule.getSyncPeriodAfter()).plusDays(1).withTime(0, 0, 0, 0);
- mPeriod = new Period(start, end);
- mInvertPeriods = false;
-
- mEventDiffer = new EventDiffer(tz);
- }
-
- public Period getPeriod() {
- return mPeriod.clone();
- }
-
- @Override
- protected EventResult processSingleEvent(Event event) {
- EventResult result = super.processSingleEvent(event);
- if (result.completed) {
- Period eventPeriod = event.getPeriod();
- mPeriods.merge(new Period(eventPeriod.getStart().minusMinutes(mRule.getReserveBefore()), eventPeriod
- .getEnd().plusMinutes(mRule.getReserveAfter())));
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_processed), event);
- }
-
- return result;
- }
-
- @Override
- public InitResult init(ClonerLog log) {
- InitResult result = super.init(log);
- if (!result.isSuccess()) {
- return result;
- }
-
- // Prepare index for clone matching
- CloneIndex.IndexResult indexResult = mExistingClones.index(mDstCalendar.getId(), mRule.getHash(),
- mRule.getSrcCalendarHash(), log);
- if (!indexResult.isSuccess()) {
- return new Processor.InitResult(false, indexResult.getErrorMessage(), result.getUpdateCount()
- + indexResult.getUpdateCount());
- }
-
- return new Processor.InitResult(true, "", result.getUpdateCount() + indexResult.getUpdateCount());
- }
-
- private void invertPeriods() {
- Periods neg = new Periods();
- neg.merge(mPeriod);
- for (Period p : mPeriods.getPeriods()) {
- neg.subtract(p);
- }
- mPeriods = neg;
- }
-
- private boolean insertAggregateEvent(Period p, ClonerLog log, String logPrefix) {
- boolean updated = false;
- // Initialize the logging context
- this.initLogLines(log, logPrefix);
-
- // Create the in-memory event
- MemoryEvent event = new MemoryEvent(mDstCalendar.getTimeZone());
- event.setUniqueId("Aggr@" + Utilities.dateTimeToTimeString(p.getStart()));
- event.setStartTime(p.getStart());
- event.setEndTime(p.getEnd());
- event.setTimeZone(mDstCalendar.getTimeZone());
- // event.setTimezone("UTC");
- event.setTitle(mRule.getCustomTitle());
- event.setLocation(mRule.getCustomLocation());
- event.setDescription(EventMarker.markEventDescription(mRule.getCustomDescription(), EventMarker.TYPE_CLONE,
- mRule.getHash(), event.getUniqueId()));
-
- // Set proper access level
- switch (mRule.getCustomAccessLevel()) {
- case Rule.CUSTOM_ACCESS_LEVEL_PRIVATE:
- event.setAccessLevel(Events.ACCESS_PRIVATE);
- break;
- case Rule.CUSTOM_ACCESS_LEVEL_CONFIDENTIAL:
- event.setAccessLevel(Events.ACCESS_CONFIDENTIAL);
- break;
- case Rule.CUSTOM_ACCESS_LEVEL_PUBLIC:
- event.setAccessLevel(Events.ACCESS_PUBLIC);
- break;
- default:
- event.setAccessLevel(Events.ACCESS_DEFAULT);
- }
-
- // Set both regular and Samsung's proprietary availability
- switch (mRule.getCustomAvailability()) {
- case Rule.CUSTOM_AVAILABILITY_FREE:
- event.setAvailability(Events.AVAILABILITY_FREE);
- event.setAvailabilitySamsung(Device.Samsung.AVAILABILITY_FREE);
- break;
- case Rule.CUSTOM_AVAILABILITY_OUT_OF_OFFICE:
- event.setAvailability(Events.AVAILABILITY_BUSY);
- event.setAvailabilitySamsung(Device.Samsung.AVAILABILITY_OUT_OF_OFFICE);
- break;
- case Rule.CUSTOM_AVAILABILITY_BUSY:
- default:
- event.setAvailability(Events.AVAILABILITY_BUSY);
- event.setAvailabilitySamsung(Device.Samsung.AVAILABILITY_BUSY);
- break;
- }
-
- // Look up an existing clone
- Event clone = mExistingClones.getCloneOf(event);
- if (clone == null) {
- clone = new DbEvent(mEventsTable, mDstCalendar);
- }
- long cloneId = clone.getId();
- ContentValues delta = new ContentValues();
- mEventDiffer.compare(event, clone, delta);
- if (delta.size() > 0) {
- if (clone.getId() == 0) {
- delta.put(mEventsTable.CALENDAR_ID.getName(), mDstCalendar.getId());
- cloneId = mEventsTable.insert(delta);
- if (cloneId > 0) {
- Event logClone = mEventsTable.getDb().isReadOnly() ? DbEvent.get(mEventsTable, cloneId, delta)
- : DbEvent.get(mEventsTable, cloneId);
- this.logEvent(logClone, delta);
- }
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_inserted), event);
- } else {
- mEventsTable.update(clone.getId(), delta);
- Event logClone = mEventsTable.getDb().isReadOnly() ? DbEvent.get(mEventsTable, cloneId, delta)
- : DbEvent.get(mEventsTable, cloneId);
- this.logEvent(logClone, delta);
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_updated), event);
- }
- updated = true;
- } else {
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_state_unchanged), event);
- }
- mValidClones.add(event, cloneId);
- return updated;
- }
-
- @Override
- public EventResult roundup(ClonerLog log) {
- log.log(log.createLogLine(ClonerLog.LOG_INFO, null,
- ClonerApp.translate(R.string.cloner_process_generating_aggregate_events)), null);
-
- EventResult result = new EventResult();
- if (mInvertPeriods) {
- this.invertPeriods();
- }
-
- int eventNr = 0;
- for (Period eventPeriod : mPeriods.getPeriods()) {
- if (!eventPeriod.isNull()) {
- DateTime startOfDay = eventPeriod.getStart().withZone(mDstCalendar.getTimeZone()).withTime(0, 0, 0, 0);
- DateTime startOfEvent = eventPeriod.getStart();
-
- // For multiple day periods, create events that run to midnight
- while (eventPeriod.getEnd().isAfter(startOfDay.plusDays(1))) {
- if (this.insertAggregateEvent(new Period(startOfEvent, startOfDay.plusDays(1)), log, "" + ++eventNr)) {
- result.updateCount++;
- }
- startOfDay = startOfDay.plusDays(1);
- startOfEvent = startOfDay;
- }
-
- // Create the aggregate event for the last day of the period
- if (this.insertAggregateEvent(new Period(startOfEvent, eventPeriod.getEnd()), log, "" + ++eventNr)) {
- result.updateCount++;
- }
- }
- }
-
- Set cloneIds = this.getRemainingCloneIds();
-
- for (long cloneId : cloneIds) {
- eventNr++;
- Event clone = DbEvent.get(mEventsTable, cloneId);
- if (clone != null) {
- if (!clone.isDeleted()) {
- if (this.shouldDeleteClone(clone)) {
- this.initLogLines(log, "" + eventNr);
- // Check to see if we can delete within limits
- if (!Limits.canModify(Limits.TYPE_EVENT)) {
- this.log(ClonerLog.LOG_WARNING,
- ClonerApp.translate(R.string.cloner_log_event_limit_reached));
- result.completed = false;
- return result;
- }
-
- // The event must be deleted, because it represents
- // a clone of an already deleted event from this
- // calendar
- mEventsTable.delete(clone.getId());
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_deleted), clone);
- result.updateCount++;
- } else {
- // The event is a valid clone
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_skipped), clone,
- ClonerApp.translate(R.string.cloner_log_valid_clone));
- }
- } else {
- // The event is already being deleted
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_skipped), clone,
- ClonerApp.translate(R.string.cloner_log_marked_deleted));
- }
- }
- }
-
- return result;
- }
-
- public Set getRemainingCloneIds() {
- // Return the list of unprocessed clones
- Set result = new HashSet();
- Set clones = mExistingClones.getAllClones();
- for (Event clone : clones) {
- if (!mValidClones.containsId(clone.getId())) {
- result.add(clone.getId());
- }
- }
- return result;
- }
-
- private boolean shouldDeleteClone(Event clone) {
- // Check if clone is a valid one, if not delete
- EventMarker.Marker marker = EventMarker.parseCloneEventHash(clone);
- if (marker != null) {
- if (mValidClones.containsHash(marker.eventHash)) {
- Long validCloneId = mValidClones.getCloneId(marker.eventHash);
- if (clone.getId() != validCloneId) {
- // Probably an overriden clone, so delete it
- return true;
- }
- }
- } else {
- // Should never reach here (invalidly marked as clone)
- return true;
- }
-
- // Valid clone that we don't need to retain
- return true;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventCloner.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventCloner.java
deleted file mode 100644
index 017a5ee..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventCloner.java
+++ /dev/null
@@ -1,738 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.joda.time.DateTime;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.provider.CalendarContract.Attendees;
-import android.provider.CalendarContract.Events;
-
-class EventCloner extends EventProcessor {
- private final long ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000;
- protected final EventsTable mEventsTable;
- private AttendeeCloner mAttendeeCloner = null;
- private ReminderCloner mReminderCloner = null;
- protected EventDiffer mDiffer;
- private final CloneIdIndex mValidClones = new CloneIdIndex();
- private final CloneIndex mExistingClones;
-
- protected Period mSrcSingleEventWindow = new Period(new DateTime().minusDays(1).withTime(0, 0, 0, 0),
- new DateTime().plusDays(1).withTime(0, 0, 0, 0));
-
- protected static final int RESULT_EVENT_UNCHANGED = -1;
- protected static final int RESULT_EVENT_INSERTED = -2;
- protected static final int RESULT_EVENT_UPDATED = -3;
- protected static final int RESULT_EVENT_ERROR = -4;
-
- protected class PartialCloneResult {
- int result = RESULT_EVENT_UNCHANGED;
- long cloneId = 0;
- boolean completed = true;
- }
-
- protected class EventContext {
- private long mOriginalId = 0;
- private final AttendeeCloner.AttendeeCloneContext mAttendeeCloneContext = new AttendeeCloner.AttendeeCloneContext();
- private final ReminderCloner.ReminderCloneContext mReminderCloneContext = new ReminderCloner.ReminderCloneContext();
- }
-
- protected class CloneResult extends EventResult {
- long cloneId = 0;
- }
-
- public EventCloner(Rule rule) {
- super(rule);
- ClonerDb db = ClonerApp.getDb(rule.isReadOnly());
- mEventsTable = new EventsTable(db);
- mExistingClones = new CloneIndex(mEventsTable);
- }
-
- protected List getExceptions(Event event) {
- // Set up the result list
- LinkedList result = new LinkedList();
-
- // Query the database for all event exceptions
- Cursor exceptionCur = mEventsTable.query("((" + Events.ORIGINAL_ID + "=?))",
- new String[] { "" + event.getId() }, Events.ORIGINAL_INSTANCE_TIME + " ASC, " + Events._ID + " ASC");
- if (exceptionCur != null) {
- try {
- DateTime lastOriginalInstanceTime = null;
- while (exceptionCur.moveToNext()) {
- DbEvent exception = new DbEvent(mEventsTable, new DbObject(exceptionCur));
- // If the exception was not marked deleted
- if (!exception.isDeleted()) {
- // Skip events which have the same original instance
- // time
- // (Technically a db issue, but solve it here by
- // skipping duplicates)
- if (lastOriginalInstanceTime == null
- || exception.getOriginalInstanceTime() != lastOriginalInstanceTime) {
- // Remember this exception's original instance time
- lastOriginalInstanceTime = exception.getOriginalInstanceTime();
- exception.loadAll();
- result.add(exception);
- }
- }
- }
- } finally {
- exceptionCur.close();
- }
- }
- return result;
- }
-
- protected void registerValidClone(Event event, long cloneId) {
- if (event.isSingleEvent()) {
- // Merge source single event window with event's window
- mSrcSingleEventWindow.merge(event.getPeriod());
- }
- // Add clone id to list of valid clone ids
- mValidClones.add(event, cloneId);
- }
-
- private boolean setEventSelfAttendeeStatus(Event event, int status, AttendeeDeltas deltas) {
- // Figure out the attendee status of the original event
- int originalStatus = event.getSelfAttendeeStatus();
- if (!DbAttendee.attendeeStatusIsAResponse(originalStatus)) {
- originalStatus = Attendees.ATTENDEE_STATUS_INVITED;
- }
- // And prepare the status to set
- if (!DbAttendee.attendeeStatusIsAResponse(status)) {
- status = Attendees.ATTENDEE_STATUS_INVITED;
- }
-
- // If the status is a response, and the status differs from the
- // selfAttendeeStatus of the event, update the latter
- if (DbAttendee.attendeeStatusIsAResponse(status) && status != originalStatus) {
- // Update the original event's status
- DbAttendee eventAttendee = DbAttendee.getByEmail(mAttendeesTable, event.getId(),
- mSrcCalendar.getOwnerAccount());
- // If the original event does not have the calendar owner
- // listed as an explicit attendee (group invites), add him/her,
- // otherwise simply update the attendee status
- if (eventAttendee == null) {
- // Add yourself as attendee
- ContentValues delta = new ContentValues();
- delta.put(Attendees.ATTENDEE_EMAIL, mSrcCalendar.getOwnerAccount());
- delta.put(Attendees.ATTENDEE_NAME, mRule.getSelfAttendeeName());
- delta.put(Attendees.ATTENDEE_RELATIONSHIP, Attendees.RELATIONSHIP_ATTENDEE);
- delta.put(Attendees.ATTENDEE_STATUS, status);
- delta.put(Attendees.ATTENDEE_TYPE, Attendees.TYPE_REQUIRED);
- delta.put(Attendees.EVENT_ID, event.getId());
- mAttendeesTable.insert(delta);
- deltas.put(mRule.getSelfAttendeeName(), mSrcCalendar.getOwnerAccount(), delta);
- this.log(
- ClonerLog.LOG_UPDATE,
- ClonerApp.translate(R.string.cloner_log_original_attendee_added,
- new String[] { mSrcCalendar.getOwnerAccount() }));
- } else {
- // Update the original attendee's status
- ContentValues delta = new ContentValues();
- delta.put(Attendees.ATTENDEE_STATUS, status);
- mAttendeesTable.update(eventAttendee.getId(), delta);
- deltas.put(eventAttendee.getName(), eventAttendee.getEmail(), delta);
- }
- this.log(
- ClonerLog.LOG_UPDATE,
- ClonerApp.translate(
- R.string.cloner_log_attendee_status_updated,
- new String[] { mSrcCalendar.getOwnerAccount(),
- new AttendeeStatuses(true).getKeyName(status), mSrcCalendar.getDisplayName() }));
- return true;
- }
-
- return false;
- }
-
- private boolean setSelfAttendeeToStatusNone(DbAttendee cloneAttendee, Event event, AttendeeDeltas deltas) {
- // If the attendee hasn't responded explicitly, set him to STATUS_NONE
- if (cloneAttendee != null && cloneAttendee.getStatus() == Attendees.ATTENDEE_STATUS_INVITED) {
- ContentValues delta = new ContentValues();
- int status = Attendees.ATTENDEE_STATUS_NONE;
- delta.put(Attendees.ATTENDEE_STATUS, status);
- mAttendeesTable.update(cloneAttendee.getId(), delta);
- deltas.put(cloneAttendee.getName(), cloneAttendee.getEmail(), delta);
- this.log(
- ClonerLog.LOG_UPDATE,
- ClonerApp.translate(
- R.string.cloner_log_attendee_status_updated_automatically,
- new String[] { mDstCalendar.getOwnerAccount(),
- new AttendeeStatuses(true).getKeyName(status), mDstCalendar.getDisplayName() }));
- return true;
- }
-
- return false;
- }
-
- public boolean cloneSelfAttendeeStatus(Event event, Event clone, AttendeeDeltas deltas) {
- // Return true if attendees or statuses were updated
- boolean updated = false;
-
- // Figure out if the event is older than a day
- DateTime now = new DateTime();
- Period eventPeriod = event.getPeriod();
- boolean eventFromDistantPast = eventPeriod.endsBefore(now) && eventPeriod.distanceTo(now) >= ONE_DAY_IN_MILLIS;
-
- // Check if we are the organizer of the event
- boolean selfOrganizer = event.getOrganizer() != null ? event.getOrganizer().contentEquals(
- mSrcCalendar.getOwnerAccount()) : true;
- String clonedSelfEmail = mDstCalendar.getOwnerAccount();
-
- // Get the cloned SELF attendee
- DbAttendee clonedAttendee = DbAttendee.getByEmail(mAttendeesTable, clone.getId(), clonedSelfEmail);
-
- // Exit if there is no cloned SELF
- if (clonedAttendee == null) {
- return updated;
- }
-
- // If we're not the organizer
- if (!selfOrganizer) {
- // The event is eligible for an attendee status update if and only
- // if the event is in the future or has only recently passed
- if (!eventFromDistantPast) {
- // Now copy the status of the destination calendar owner to the
- // source event
- updated = this.setEventSelfAttendeeStatus(event, clonedAttendee.getStatus(), deltas) || updated;
- } else {
- // Set all events from the distant past to NONE if the user
- // did not already respond, but without touching the source
- // event
- updated = this.setSelfAttendeeToStatusNone(clonedAttendee, event, deltas) || updated;
- }
- }
- return updated;
- }
-
- private EventResult cloneAttendees(Event event, Event clone, boolean resetCloneSelfAttendeeStatus,
- EventContext eventContext, boolean addEmptyLine) {
- EventResult result = new EventResult();
-
- // Initialize the proper context for cloning attendees
- AttendeeCloner.AttendeeCloneContext attCloneContext = eventContext != null ? eventContext.mAttendeeCloneContext
- : new AttendeeCloner.AttendeeCloneContext();
- attCloneContext.logLines = this.getLogLines();
-
- // Clone the guest list
- AttendeeCloner.AttendeeCloneResult attendeeResult = mAttendeeCloner.process(event, clone.getId(),
- resetCloneSelfAttendeeStatus, attCloneContext);
- result.completed &= attendeeResult.completed;
-
- if (attendeeResult.updateCount > 0) {
- result.updateCount = 1;
- }
-
- // Check if the attendee statuses of the event and its clone should be
- // synced
- if (mRule.getCloneSelfAttendeeStatusReverse()
- && this.cloneSelfAttendeeStatus(event, clone, attendeeResult.deltas)) {
- result.updateCount = 1;
- }
-
- if (result.updateCount > 0) {
- if (addEmptyLine) {
- this.log(ClonerLog.LOG_UPDATE, "");
- }
- // Log the updated guest list
- this.log(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_attendees_updated));
- // Only pass along deltas if we're in readonly mode
- AttendeeDeltas deltas = mAttendeesTable.getDb().isReadOnly() ? attendeeResult.deltas : null;
- this.logAttendees(DbAttendee.getByEvent(mAttendeesTable, event.getId(), deltas),
- DbAttendee.getByEvent(mAttendeesTable, clone.getId(), deltas), mSrcCalendar, mDstCalendar,
- attendeeResult.deltas, mRule.getDummyEmailDomain());
- } else {
- // Message only makes sense if we wanted to clone the attendees
- if (mRule.getCloneAttendees()) {
- if (addEmptyLine) {
- this.log(ClonerLog.LOG_UPDATE, "");
- }
- this.log(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_attendees_unchanged));
- }
- }
-
- return result;
- }
-
- private boolean cloneReminders(Event event, long cloneId, EventContext eventContext, boolean addEmptyLine) {
- // Initialize the proper context for cloning reminders
- ReminderCloner.ReminderCloneContext remCloneContext = eventContext != null ? eventContext.mReminderCloneContext
- : new ReminderCloner.ReminderCloneContext();
- remCloneContext.logLines = this.getLogLines();
-
- // Clone the necessary reminders
- boolean updated = mReminderCloner.process(event, cloneId, remCloneContext);
-
- if (updated) {
- if (addEmptyLine) {
- this.log(ClonerLog.LOG_UPDATE, "");
- }
- this.log(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_reminders_updated));
- // Only pass along reminder deltas if we're in readonly mode
- Map deltas = mRemindersTable.getDb().isReadOnly() ? remCloneContext.reminderDeltas
- : null;
- this.logReminders(ClonerLog.LOG_UPDATE, DbReminder.getReminders(mRemindersTable, event.getId(), deltas),
- DbReminder.getReminders(mRemindersTable, cloneId, deltas), remCloneContext.mappedReminders);
- }
-
- return updated;
- }
-
- private boolean compareEventExcludeFields(Event event, Event clone, String[] fields) {
- ContentValues delta = new ContentValues();
- mDiffer.compare(new ClonedEvent(event, mRule), clone, delta);
- if (fields != null) {
- for (int i = 0; i < fields.length; i++) {
- delta.remove(fields[i]);
- }
- }
- return delta.size() == 0;
- }
-
- private boolean canReuseClone(Event event, Event clone) {
- // Don't reuse if the clone is not owned by the destination calendar
- if (clone.getOrganizer() != null && !clone.getOrganizer().contentEquals(mDstCalendar.getOwnerAccount())) {
- return false;
- }
-
- // Don't reuse if deleted
- if (clone.isDeleted()) {
- return false;
- }
-
- // Events can never change type, so don't reuse if this is the case
- if (event.isRecurringEvent() != clone.isRecurringEvent()
- || event.isRecurringEventException() != clone.isRecurringEventException()) {
- return false;
- }
-
- if (event.isRecurringEvent()) {
- // Compare the event. If something has changed, don't reuse
- if (!this.canReuseRecurringClone(event, clone)) {
- return false;
- }
- }
-
- return true;
- }
-
- // Returns true if the structure of the recurring event is similar
- private boolean canReuseRecurringClone(Event event, Event clone) {
- String[] fields = new String[] { Events.TITLE, Events.DESCRIPTION, Events.EVENT_LOCATION };
- // First compare the event and its clone
- if (!compareEventExcludeFields(event, clone, fields)) {
- // If not similar, don't reuse (safety)
- return false;
- }
-
- // Then compare all exceptions to all exception clones
- List exceptions = this.getExceptions(event);
- for (Event exception : exceptions) {
- Event exceptionClone = mExistingClones.getCloneOf(exception);
- if (exceptionClone == null) {
- // Inserting new exceptions proves tricky! So if we need to
- // add/remove one, recreate the entire recurring event
- return false;
- }
- if (!this.canReuseClone(exception, exceptionClone)
- || !this.canReuseExceptionClone(exception, exceptionClone, clone.getId())) {
- // We can't reuse the cloned exception
- return false;
- }
- if (!compareEventExcludeFields(exception, exceptionClone, fields)) {
- // If not similar, don't reuse (safety)
- return false;
- }
- }
-
- return true;
- }
-
- private boolean canReuseExceptionClone(Event exception, Event exceptionClone, long cloneOriginalId) {
- // Only reuse the exception clone if original id matches
- return exceptionClone.getOriginalID() == cloneOriginalId;
- }
-
- protected boolean canModifyEvent(EventContext eventContext) {
- if ((eventContext == null || eventContext.mOriginalId == 0) && !Limits.canModify(Limits.TYPE_EVENT)) {
- return false;
- }
- return true;
- }
-
- private boolean deleteEvent(Event event) {
- if (event.isRecurringEventException()) {
- if (mEventsTable.delete(event.getOriginalID()) != 1) {
- return false;
- }
- }
- return mEventsTable.delete(event.getId()) == 1;
- }
-
- private PartialCloneResult cloneEvent(final Event event, Event clone, EventContext eventContext) {
- // Keep track of whether we updated the cloned event
- PartialCloneResult result = new PartialCloneResult();
-
- boolean eventWasRescheduled = false;
- final ContentValues delta = new ContentValues();
- if (clone != null) {
- // Find out if we can reuse the clone
- if (!this.canReuseClone(event, clone)) {
- // We can not reuse the clone, so delete it first so it doesn't
- // interfere with the rest of the process
- if (!this.canModifyEvent(eventContext)) {
- this.log(ClonerLog.LOG_WARNING, ClonerApp.translate(R.string.cloner_log_event_limit_reached));
- result.completed = false;
- return result;
- }
-
- // Delete the unreusable clone
- if (!mRule.isReadOnly() && !this.deleteEvent(clone)) {
- this.log(ClonerLog.LOG_ERROR, ClonerApp.translate(R.string.error_processing_event));
- result.result = RESULT_EVENT_ERROR;
- return result;
- }
-
- this.log(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_old_clone_deleted));
-
- // Create a new empty clone and reclone all fields
- clone = new DbEvent(mEventsTable, mDstCalendar);
- } else {
- // Check if the event was rescheduled (requires user status
- // reset later)
- eventWasRescheduled = mDiffer.eventWasRescheduled(new ClonedEvent(event, mRule), clone);
- }
- } else {
- // If we don't reuse an existing clone, create an empty one
- clone = new DbEvent(mEventsTable, mDstCalendar);
- }
-
- result.cloneId = clone.getId();
-
- // Calculate the delta between the event and existing clone
- mDiffer.compare(new ClonedEvent(event, mRule), clone, delta);
- // Only save when some values were changed
- if (delta.size() > 0) {
- // If there was a clone already, update the clone. Otherwise insert
- // a new event with the given data
- if (clone.getId() > 0) {
- // Check to see if we can update within limits
- if (!this.canModifyEvent(eventContext)) {
- this.log(ClonerLog.LOG_WARNING, ClonerApp.translate(R.string.cloner_log_event_limit_reached));
- result.completed = false;
- return result;
- }
-
- // Update the clone's fields
- if (!mRule.isReadOnly() && mEventsTable.update(clone.getId(), delta) != 1) {
- this.log(ClonerLog.LOG_ERROR, ClonerApp.translate(R.string.error_processing_event));
- result.result = RESULT_EVENT_ERROR;
- return result;
- }
-
- result.result = RESULT_EVENT_UPDATED;
- } else {
- // Check to see if we can insert within limits
- if (!this.canModifyEvent(eventContext)) {
- this.log(ClonerLog.LOG_WARNING, ClonerApp.translate(R.string.cloner_log_event_limit_reached));
- result.completed = false;
- return result;
- }
-
- // Insert the new clone into the destination calendar
- delta.put(Events.CALENDAR_ID, mDstCalendar.getId());
- if (eventContext != null && eventContext.mOriginalId > 0) {
- delta.put(Events.ORIGINAL_ID, eventContext.mOriginalId);
- }
- result.cloneId = mEventsTable.insert(delta);
- if (!mRule.isReadOnly() && result.cloneId <= 0) {
- this.log(ClonerLog.LOG_ERROR, ClonerApp.translate(R.string.error_processing_event));
- result.result = RESULT_EVENT_ERROR;
- return result;
- }
-
- result.result = RESULT_EVENT_INSERTED;
- }
-
- // Reload clone or fake its change with a DbEventWithDelta instance
- if (mEventsTable.getDb().isReadOnly()) {
- clone = DbEvent.get(mEventsTable, result.cloneId, delta);
- } else {
- clone = DbEvent.get(mEventsTable, result.cloneId);
- }
- this.logEvents(event, clone, delta);
- }
-
- // Add clone's id to list of valid clones
- this.registerValidClone(event, result.cloneId);
-
- // Clone attendees
- EventResult attCloneResult = this.cloneAttendees(event, clone, eventWasRescheduled, eventContext,
- result.result != RESULT_EVENT_UNCHANGED);
- result.completed &= attCloneResult.completed;
- if (attCloneResult.updateCount > 0) {
- if (result.result != RESULT_EVENT_INSERTED) {
- result.result = RESULT_EVENT_UPDATED;
- }
- }
-
- // Clone reminders
- if (this.cloneReminders(event, result.cloneId, eventContext, result.result != RESULT_EVENT_UNCHANGED)) {
- if (result.result != RESULT_EVENT_INSERTED) {
- result.result = RESULT_EVENT_UPDATED;
- }
- }
-
- return result;
- }
-
- @Override
- protected void skipSingleEvent(Event event) {
- super.skipSingleEvent(event);
- // The original event can not be cloned at this time, so add its known
- // clone to the list of valid clones so we don't delete it later
- Event clone = mExistingClones.getCloneOf(event);
- if (clone != null && clone.getId() > 0) {
- this.registerValidClone(event, clone.getId());
- }
- }
-
- @Override
- protected void skipRecurringEvent(Event event) {
- super.skipRecurringEvent(event);
- // The original event can not be cloned at this time, so add its known
- // clone to the list of valid clones so we
- // don't delete it later
- Event clone = mExistingClones.getCloneOf(event);
- this.registerValidClone(event, clone != null ? clone.getId() : 0);
-
- // Register all exceptions
- List exceptions = this.getExceptions(event);
- for (Event exception : exceptions) {
- Event exceptionClone = mExistingClones.getCloneOf(exception);
- this.registerValidClone(exception, exceptionClone != null ? exceptionClone.getId() : 0);
- }
- }
-
- protected void logCloneSummary(Event event, PartialCloneResult cloneResult, EventResult result) {
- if (result.completed) {
- switch (cloneResult.result) {
- case RESULT_EVENT_UNCHANGED:
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_state_unchanged), event);
- break;
- case RESULT_EVENT_INSERTED:
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_inserted), event);
- break;
- case RESULT_EVENT_UPDATED:
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_updated), event);
- break;
- case RESULT_EVENT_ERROR:
- this.logSummary(ClonerLog.LOG_ERROR, ClonerApp.translate(R.string.error_processing_event), event);
- }
- } else {
- this.logSummary(ClonerLog.LOG_WARNING, ClonerApp.translate(R.string.cloner_log_limit_reached), event);
- result.completed = false;
- }
- }
-
- @Override
- protected EventResult createEventResult() {
- return new CloneResult();
- }
-
- @Override
- protected EventResult processSingleEvent(Event event) {
- // Keep track of whether we updated the cloned event
- CloneResult result = (CloneResult) super.processSingleEvent(event);
- PartialCloneResult mainCloneResult = this.cloneEvent(event, mExistingClones.getCloneOf(event), null);
- result.completed &= mainCloneResult.completed;
- if (mainCloneResult.result != RESULT_EVENT_UNCHANGED) {
- result.updateCount++;
- }
- result.cloneId = mainCloneResult.cloneId;
- this.logCloneSummary(event, mainCloneResult, result);
- return result;
- }
-
- @Override
- protected EventResult processRecurringEvent(Event event) {
- // Keep track of whether we updated the cloned event
- CloneResult result = (CloneResult) super.processRecurringEvent(event);
- // Initialize the differ to this event's duration
- mDiffer.setDefaultDuration(Duration.parseDuration(event.getDuration()));
- // Create an event context for this recurring event
- EventContext eventContext = new EventContext();
- // First clone the main recurring event itself
- PartialCloneResult mainCloneResult = this.cloneEvent(event, mExistingClones.getCloneOf(event), eventContext);
- result.completed &= mainCloneResult.completed;
- if (mainCloneResult.result != RESULT_EVENT_UNCHANGED) {
- result.updateCount++;
- }
- result.cloneId = mainCloneResult.cloneId;
- this.logCloneSummary(event, mainCloneResult, result);
- if (mainCloneResult.result == RESULT_EVENT_ERROR) {
- return result;
- }
-
- // Then clone all exceptions
- eventContext.mOriginalId = mainCloneResult.cloneId;
- int exceptionNr = 0;
- for (Event exception : this.getExceptions(event)) {
- // Start a new log entry
- this.startNewLogLines(this.getOriginalLogPrefix() + "." + ++exceptionNr);
-
- // Get the cloned exception event
- Event exceptionClone = mExistingClones.getCloneOf(exception);
- // Check if we can reuse this exception
- if (exceptionClone != null) {
- if (!this.canReuseClone(exception, exceptionClone)
- || !this.canReuseExceptionClone(exception, exceptionClone, mainCloneResult.cloneId)) {
- exceptionClone = null;
- }
- }
-
- // Clone the exception
- PartialCloneResult exceptionCloneResult = this.cloneEvent(exception, exceptionClone, eventContext);
- result.completed &= exceptionCloneResult.completed;
- if (exceptionCloneResult.result != RESULT_EVENT_UNCHANGED) {
- result.updateCount++;
- }
- this.logCloneSummary(exception, exceptionCloneResult, result);
- if (exceptionCloneResult.result == RESULT_EVENT_ERROR) {
- return result;
- }
- }
-
- // Return true signals we updated clones
- return result;
- }
-
- @Override
- public InitResult init(ClonerLog log) {
- InitResult result = super.init(log);
- if (!result.isSuccess()) {
- return result;
- }
-
- mDiffer = new EventDiffer(mDstCalendar.getTimeZone());
-
- // Prepare index for clone matching
- CloneIndex.IndexResult indexResult = mExistingClones.index(mDstCalendar.getId(), mRule.getHash(),
- mRule.getSrcCalendarHash(), log);
- if (!indexResult.isSuccess()) {
- return new Processor.InitResult(false, indexResult.getErrorMessage(), result.getUpdateCount()
- + indexResult.getUpdateCount());
- }
- // Set up an attendee cloner
- mAttendeeCloner = new AttendeeCloner(mRule, mSrcCalendar, mDstCalendar, mAttendeesTable);
- // Set up a reminder cloner
- mReminderCloner = new ReminderCloner(mRule, mRemindersTable, mDstCalendar.getMaxReminders());
- return new Processor.InitResult(true, "", result.getUpdateCount() + indexResult.getUpdateCount());
- }
-
- public Set getRemainingCloneIds() {
- // Return the list of unprocessed clones
- Set result = new HashSet();
- Set clones = mExistingClones.getAllClones();
- for (Event clone : clones) {
- if (!mValidClones.containsId(clone.getId())) {
- result.add(clone.getId());
- }
- }
- return result;
- }
-
- private boolean shouldDeleteClone(Event clone) {
- // Check if clone is a valid one, if not delete
- EventMarker.Marker marker = EventMarker.parseCloneEventHash(clone);
- if (marker != null) {
- if (mValidClones.containsHash(marker.eventHash)) {
- Long validCloneId = mValidClones.getCloneId(marker.eventHash);
- if (clone.getId() != validCloneId) {
- // Probably an overriden clone, so delete it
- return true;
- }
- }
- } else {
- // Should never reach here (invalidly marked as clone)
- return true;
- }
-
- // Check if we need to retain clone
- if (mRule.getRetainClonesOutsideSourceEventWindow()) {
- // Delete exceptions only if their parent event needs to be deleted
- if (clone.isRecurringEventException()) {
- Event parentEvent = DbEvent.get(mEventsTable, clone.getOriginalID());
- return parentEvent != null ? this.shouldDeleteClone(parentEvent) : true;
- }
-
- Period clonePeriod = clone.getPeriod();
- if (clone.isRecurringEvent()) {
- // Delete the recurring event if it overlaps with the event
- // window. Rationale is that the source event would have
- // overlapped with the event window too and therefore should
- // have existed.
- return clonePeriod.overlaps(mSrcSingleEventWindow);
- }
-
- // For single events, we check if they start before or end after the
- // event window
- return !clonePeriod.startsBeforeStartOf(mSrcSingleEventWindow)
- && !clonePeriod.endsAfterEndOf(mSrcSingleEventWindow);
- }
-
- // Valid clone that we don't need to retain
- return true;
- }
-
- @Override
- public EventResult roundup(ClonerLog log) {
- log.log(log.createLogLine(ClonerLog.LOG_INFO, null,
- ClonerApp.translate(R.string.cloner_process_checking_for_deleted_events)), null);
-
- EventResult result = new EventResult();
- Set cloneIds = this.getRemainingCloneIds();
-
- int eventNr = 0;
- for (long cloneId : cloneIds) {
- eventNr++;
- Event clone = DbEvent.get(mEventsTable, cloneId);
- if (clone != null) {
- this.initLogLines(log, "" + eventNr);
- if (!clone.isDeleted()) {
- if (this.shouldDeleteClone(clone)) {
- // Check to see if we can delete within limits
- if (!Limits.canModify(Limits.TYPE_EVENT)) {
- this.log(ClonerLog.LOG_WARNING,
- ClonerApp.translate(R.string.cloner_log_event_limit_reached));
- result.completed = false;
- return result;
- }
-
- // The event must be deleted, because it represents
- // a clone of an already deleted event from this
- // calendar
- this.deleteEvent(clone);
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_deleted), clone);
- result.updateCount++;
- } else {
- // The event is a valid clone
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_skipped), clone,
- ClonerApp.translate(R.string.cloner_log_valid_clone));
- }
- } else {
- // The event is already being deleted
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_skipped), clone,
- ClonerApp.translate(R.string.cloner_log_marked_deleted));
- }
- }
- }
-
- return result;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventDiffer.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventDiffer.java
deleted file mode 100644
index 82e7f5c..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventDiffer.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Events;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public class EventDiffer extends Differ {
- private static final long ONE_DAY = 24 * 3600 * 1000;
- private static final DateTimeZone UTC_ZONE = DateTimeZone.forID("UTC");
- private long mDefaultDuration;
- protected EventsTable mEventsTable = new EventsTable(ClonerApp.getDb(true));
- private final DateTimeZone calendarTimeZone;
-
- public EventDiffer(DateTimeZone calendarTimeZone) {
- this.calendarTimeZone = calendarTimeZone;
- }
-
- public void setDefaultDuration(long defaultDuration) {
- mDefaultDuration = defaultDuration;
- }
-
- private String toLocalMillis(DateTime time) {
- return "" + time.withZone(calendarTimeZone).getMillis();
- }
-
- private String toUTCMillis(DateTime time) {
- return ""
- + new DateTime(time.year().get(), time.monthOfYear().get(), time.dayOfMonth().get(), 0, 0, UTC_ZONE)
- .getMillis();
- }
-
- protected void compareStartTime(Event event, Event clone, ContentValues delta) {
- // Sometimes calendar sync sets start time and end time of a canceled
- // meeting to the time of the first occurence. This kills certain syncs
- // though, for example Google sync deletes such events. The code below
- // prevents that.
- if (event.isRecurringEventException() && event.getStatus() == Events.STATUS_CANCELED) {
- // Only set the clone's start time if not initialized yet
- if (clone.getId() == 0) {
- DateTime startTime = event.getOriginalInstanceTime();
- this.compareField(mEventsTable.DTSTART, toLocalMillis(startTime), toLocalMillis(clone.getStartTime()),
- true, delta);
- }
- return;
- }
-
- if (!event.isAllDay()) {
- this.compareField(mEventsTable.DTSTART, toLocalMillis(event.getStartTime()),
- toLocalMillis(clone.getStartTime()), clone.getId() == 0, delta);
- } else {
- this.compareField(mEventsTable.DTSTART, toUTCMillis(event.getStartTime()),
- toUTCMillis(clone.getStartTime()), clone.getId() == 0, delta);
- }
- }
-
- protected void compareEndTime(Event event, Event clone, ContentValues delta) {
- if (event.isRecurringEventException() && event.getStatus() == Events.STATUS_CANCELED) {
- // Only set the clone's start time if not initialized yet
- if (clone.getEndTime().year().get() < 1980) {
- // For some reason Google sync does not accept all end times for
- // canceled exceptions of a recurring
- // event. It does seem to accept the end time when set to
- // originalStart plus its parent duration (ie.
- // the original slot), so that's what we simulate here.
- DateTime endTime = event.getOriginalInstanceTime().plus(mDefaultDuration);
- this.compareField(mEventsTable.DTEND, toLocalMillis(endTime), toLocalMillis(clone.getEndTime()), true,
- delta);
- }
-
- return;
- }
-
- if (!event.isAllDay()) {
- this.compareField(mEventsTable.DTEND, toLocalMillis(event.getEndTime()), toLocalMillis(clone.getEndTime()),
- clone.getId() == 0, delta);
- } else {
- this.compareField(mEventsTable.DTEND, toUTCMillis(event.getEndTime()), toUTCMillis(clone.getEndTime()),
- clone.getId() == 0, delta);
- }
- }
-
- protected void compareTimeZone(ClonerTable.Column field, DateTimeZone tzEvent, DateTimeZone tzClone,
- boolean mandatory, ContentValues delta) {
- if (tzEvent == null || tzClone == null || !tzEvent.equals(tzClone)) {
- this.compareField(field, tzEvent != null ? tzEvent.getID() : "", tzClone != null ? tzClone.getID() : "",
- mandatory, delta);
- }
- }
-
- protected void compareAvailability(Event event, Event clone, ContentValues delta) {
- // Availability is tricky, because on Samsung devices with Exchange
- // calendars the availability status is stored
- // in a non-standard field. To compensate for this case, we have to
- // check both source and destination event and
- // copy respective fields properly.
- if (ClonerApp.getDevice().supportsAvailabilitySamsung() && event.hasAvailabilitySamsung()) {
- // Since we are the organizer of the clone, we can not mark ourself
- // as TENTATIVE
- int eventAvailability = event.getAvailabilitySamsung();
- if (eventAvailability == Device.Samsung.AVAILABILITY_TENTATIVE) {
- eventAvailability = Device.Samsung.AVAILABILITY_BUSY;
- }
- // Copy Samsung field
- this.compareField(mEventsTable.AVAILABILITY_SAMSUNG, "" + eventAvailability,
- "" + clone.getAvailabilitySamsung(), clone.getId() == 0, delta);
- // Convert Samsung availability to regular availability
- this.compareField(mEventsTable.AVAILABILITY, "" + Device.Samsung.toRegularAvailability(eventAvailability),
- "" + clone.getAvailability(), clone.getId() == 0, delta);
- } else {
- // Since we are the organizer of the clone, we can not mark ourself
- // as TENTATIVE
- int eventAvailability = event.getAvailability();
- if (eventAvailability != Events.AVAILABILITY_FREE) {
- eventAvailability = Events.AVAILABILITY_BUSY;
- }
- // Copy regular availability field
- this.compareField(mEventsTable.AVAILABILITY, "" + eventAvailability, "" + clone.getAvailability(),
- clone.getId() == 0, delta);
- // Check if we need to set the Samsung availabilty field
- if (clone.hasAvailabilitySamsung()) {
- // Convert from regular availability to Samsung availability
- this.compareField(mEventsTable.AVAILABILITY_SAMSUNG,
- "" + Device.Samsung.fromRegularAvailability(eventAvailability),
- "" + clone.getAvailabilitySamsung(), clone.getId() == 0, delta);
- }
- }
- }
-
- protected boolean compareInts(int[] a, int[] b) {
- if ((a == null && b == null) || (a == null && b.length > 0) || (b == null && a.length > 0)
- || (a.length == 0 && b.length == 0)) {
- return true;
- }
- if (a.length != b.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
- return true;
- }
-
- protected void compareStatus(Event event, Event clone, ContentValues delta) {
- // Compensate for Exchange appointments, which set eventStatus to null
- if (event.hasStatus()) {
- int eventStatus = event.getStatus() != Events.STATUS_CANCELED ? Events.STATUS_CONFIRMED
- : Events.STATUS_CANCELED;
- this.compareField(mEventsTable.STATUS, "" + eventStatus, "" + clone.getStatus(), !clone.hasStatus(), delta);
- }
- }
-
- protected void compareDuration(Event event, Event clone, ContentValues delta) {
- // For recurring events, calculate the duration in seconds and then
- // transpose to the destination calendar's
- // preferred units
-
- // Parse the event's duration
- String eventDuration = event.getDuration();
- if (eventDuration == null && event.isAllDay()) {
- eventDuration = Duration.encodeDuration(ONE_DAY);
- }
- long newDuration = Duration.parseDuration(eventDuration);
- // Parse the clone's duration
- long oldDuration = Duration.parseDuration(clone.getDuration());
-
- // Only copy if they are semantically different or clone needs to be
- // initialized
- if (newDuration != oldDuration || clone.getDuration() == null) {
- this.compareField(mEventsTable.DURATION, Duration.encodeDuration(newDuration), null, true, delta);
- }
- }
-
- protected void compareRecurrenceRule(ClonerTable.Column field, String eventRule, String cloneRule,
- ContentValues delta) {
- // Perform semantic comparison to allow for server rrule rewrite
- if (!RecurrenceRule.compareRules(eventRule, cloneRule)) {
- // If not equal, copy syntactically
- this.compareField(field, eventRule, cloneRule, true, delta);
- }
- }
-
- public void compare(Event event, Event clone, ContentValues delta) {
- // Compare regular event fields
- this.compareStatus(event, clone, delta);
- this.compareField(mEventsTable.TITLE, event.getTitle(), clone.getTitle(), clone.getId() == 0, delta);
- this.compareField(mEventsTable.EVENT_LOCATION, event.getLocation(), clone.getLocation(), clone.getId() == 0,
- delta);
- this.compareField(mEventsTable.DESCRIPTION, event.getDescription(), clone.getDescription(), clone.getId() == 0,
- delta);
- this.compareStartTime(event, clone, delta);
- this.compareField(mEventsTable.ALL_DAY, event.isAllDay() ? "1" : "0", clone.isAllDay() ? "1" : "0",
- clone.getId() == 0, delta);
- this.compareTimeZone(mEventsTable.EVENT_TIMEZONE, event.getStartTimeZone(true), clone.getStartTimeZone(true), true,
- delta);
- this.compareTimeZone(mEventsTable.EVENT_END_TIMEZONE, event.getEndTimeZone(), clone.getEndTimeZone(), false,
- delta);
- this.compareField(mEventsTable.ACCESS_LEVEL, "" + event.getAccessLevel(), "" + clone.getAccessLevel(),
- clone.getId() == 0, delta);
- this.compareAvailability(event, clone, delta);
-
- if (event.isRecurringEvent()) {
- // Compare recurring event fields
- this.compareDuration(event, clone, delta);
- this.compareRecurrenceRule(mEventsTable.RRULE, event.getRecurrenceRule(), clone.getRecurrenceRule(), delta);
- this.compareField(mEventsTable.RDATE, event.getRecurrenceDate(), clone.getRecurrenceDate(), false, delta);
- this.compareRecurrenceRule(mEventsTable.EXRULE, event.getRecurrenceExRule(), clone.getRecurrenceExRule(),
- delta);
- this.compareField(mEventsTable.EXDATE, event.getRecurrenceExDate(), clone.getRecurrenceExDate(), false,
- delta);
- } else if (event.isRecurringEventException()) {
- // Compare recurring event exception fields
- this.compareEndTime(event, clone, delta);
- this.compareField(mEventsTable.ORIGINAL_ALL_DAY, event.isOriginalAllDay() ? "1" : "0",
- clone.isOriginalAllDay() ? "1" : "0", clone.getId() == 0, delta);
- this.compareField(mEventsTable.ORIGINAL_INSTANCE_TIME, "" + event.getOriginalInstanceTime(),
- "" + clone.getOriginalInstanceTime(), clone.getId() == 0, delta);
- } else {
- // Compare regular event fields
- this.compareEndTime(event, clone, delta);
- }
- }
-
- protected boolean eventWasRescheduled(Event event, Event clone) {
- // Check if start/end times have changed (required user accept)
- ContentValues delta = new ContentValues();
- this.compareStartTime(event, clone, delta);
- if (!event.isRecurringEvent()) {
- this.compareEndTime(event, clone, delta);
- } else {
- // Should never occur since superclass returns false for all changed
- // recurring events
- this.compareDuration(event, clone, delta);
- }
-
- return delta.size() > 0;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventIterator.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventIterator.java
deleted file mode 100644
index 089ad50..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventIterator.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.dizzl.android.CalendarClonerFree.EventProcessor.EventResult;
-
-import android.database.Cursor;
-import android.provider.CalendarContract.Events;
-
-public abstract class EventIterator {
- protected static final String FAKE_EVENT_TITLE = "Fake event to work around a calendar issue.";
- private Set mSrcServerIds = new HashSet();
-
- private ClonerLog mLog;
-
- public class Result {
- public static final int STATUS_SUCCESS = 0;
- public static final int STATUS_NOT_COMPLETED = 1;
- public static final int STATUS_FAIL = 2;
-
- private int mStatus;
- private String mSummary;
-
- public Result(int status, String summary) {
- mStatus = status;
- mSummary = summary;
- }
-
- public int getStatus() {
- return mStatus;
- }
-
- public String getSummary() {
- return mSummary;
- }
- }
-
- public EventIterator(ClonerLog log) {
- mLog = log;
- }
-
- protected boolean isRealEvent(DbEvent event) {
- // Don't clone events that are marked as fake (administrative events
- // used during sync)
- if (event.isLastSynced()) {
- return false;
- }
-
- String syncId = event.getSyncId();
- if (event.getSyncId() != null && syncId.matches(".*fakeevent")) {
- return false;
- }
-
- String title = event.getTitle();
- if (title != null && title.contentEquals(FAKE_EVENT_TITLE)) {
- return false;
- }
-
- // Always ignore single canceled events with null titles (trouble in
- // Google calendars)
- if (event.getStatus() == Events.STATUS_CANCELED) {
- if (event.isSingleEvent() && (event.getTitle() == null || event.getTitle().contentEquals(""))) {
- return false;
- }
- }
-
- return true;
- }
-
- protected void assertServerEventIdUniqueness(DbEvent event) throws Exception {
- // The calendar cloning works under the assumption that all serverIds
- // are unique (per calendar). Here we check
- // if that assumption remains true. If not, we skip this event.
- String uniqueId = event.getUniqueId();
- if (uniqueId.contentEquals("")) {
- event.loadAll();
- throw new Exception(ClonerApp.translate(R.string.error_no_unique_id) + ": " + event.getTitle());
- }
- if (mSrcServerIds.contains(uniqueId)) {
- // Error in assumption that all server ids are unique (per calendar)
- throw new Exception(ClonerApp.translate(R.string.error_duplicate_server_id) + ": " + event.getTitle()
- + ", Account type: " + event.getAccountType() + ", UniqueID: " + uniqueId + ", ID: "
- + event.getId());
- }
- mSrcServerIds.add(uniqueId);
- }
-
- abstract protected Cursor doQuery(long sourceCalendarId);
-
- abstract protected DbEvent getEvent(Cursor cur);
-
- abstract protected EventsTable getTable();
-
- public Result execute(EventProcessor processor) throws Exception {
- boolean completed = true;
-
- // Perform the actual cloning
- mLog.log(
- mLog.createLogLine(ClonerLog.LOG_INFO, null, ClonerApp.translate(R.string.cloner_process_initializing)),
- null);
- Processor.InitResult initResult = processor.init(mLog);
- if (!initResult.isSuccess()) {
- return new Result(Result.STATUS_FAIL, initResult.getErrorMessage());
- }
-
- // Count the number of events processed and updates
- int updateCount = initResult.getUpdateCount();
- // Iterate through all the non-recurring events from the source calendar
- Cursor cur = this.doQuery(processor.getSrcCalendarId());
- if (cur == null) {
- return new Result(Result.STATUS_FAIL, ClonerApp.translate(R.string.error_calendar_x_not_accessible,
- new String[] { ClonerApp.translate(R.string.calendar_source) }));
- }
- try {
- mLog.log(
- mLog.createLogLine(
- ClonerLog.LOG_INFO,
- null,
- ClonerApp.translate(R.string.msg_found_x_events_in_source_calendar,
- new String[] { "" + cur.getCount() })), null);
-
- int eventNr = 0;
- while (cur.moveToNext() && ClonerApp.getSettings().isClonerEnabled()) {
- eventNr++;
- DbEvent event = this.getEvent(cur);
-
- if (!event.getUniqueId().contentEquals("") && this.isRealEvent(event) && !event.isDeleted()
- && !event.isRecurringEventException()) {
- // Make sure all server event ids are unique
- this.assertServerEventIdUniqueness(event);
-
- try {
- // Process the event
- EventResult result = processor.process(event, mLog, "" + eventNr);
- completed &= result.completed;
- if (result.updateCount > 0) {
- // Count as one logical update for the user
- updateCount++;
- }
- } catch (Exception e) {
- // eat and progress to next event
- mLog.stacktrace(e);
- }
- }
- }
- } finally {
- cur.close();
- }
-
- mLog.log(
- mLog.createLogLine(
- ClonerLog.LOG_INFO,
- null,
- ClonerApp.translate(R.string.cloner_state_finished_after_x_events, new String[] { ""
- + updateCount })), null);
-
- // Now that all events were cloned, check if there are events that need
- // to be deleted because the source event
- // is gone
- if (ClonerApp.getSettings().isClonerEnabled()) {
- EventResult roundupResult = processor.roundup(mLog);
- completed &= roundupResult.completed;
- updateCount += roundupResult.updateCount;
- }
-
- // If cloning was aborted by user (by disabling cloning in main
- // settings), exit here
- if (!ClonerApp.getSettings().isClonerEnabled()) {
- return new Result(Result.STATUS_NOT_COMPLETED, ClonerApp.translate(R.string.cloner_state_interrupted)
- + ": " + Utilities.getNowString());
- }
-
- mLog.log(mLog.createLogLine(ClonerLog.LOG_INFO, null, ClonerApp.translate(R.string.cloner_log_done)), null);
-
- // If limit was reached, exit with state signaling that
- if (!completed) {
- if (updateCount > 0) {
- return new Result(Result.STATUS_NOT_COMPLETED, ClonerApp.translate(
- R.string.cloner_process_updated_x_events, new String[] { "" + updateCount })
- + ": "
- + Utilities.getNowString());
- }
- return new Result(Result.STATUS_NOT_COMPLETED, ClonerApp.translate(R.string.cloner_state_unchanged) + ": "
- + Utilities.getNowString());
- }
-
- // Exit with proper description, based on number of updates
- if (updateCount > 0) {
- return new Result(Result.STATUS_SUCCESS, ClonerApp.translate(R.string.cloner_process_updated_x_events,
- new String[] { "" + updateCount }) + ": " + Utilities.getNowString());
- }
- return new Result(Result.STATUS_SUCCESS, ClonerApp.translate(R.string.cloner_state_unchanged) + ": "
- + Utilities.getNowString());
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMarker.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMarker.java
deleted file mode 100644
index 819e7fa..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMarker.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.provider.CalendarContract.Events;
-
-public class EventMarker {
- public static final int TYPE_NORMAL = 0;
- public static final int TYPE_CLONE = 1;
-
- private static final String MERGE_CHAR = "/";
- private static final String CLONE_HEADER = "CloneOf: ";
- private static final String FORWARD_HEADER = "ForwardOf: ";
-
- private static final int DESCRIPTION_MAX_LENGTH = 8180;
- private static final String DESCRIPTION_PREFIX = "\n~~~~\n";
-
- public static class Marker {
- public String ruleHash;
- public String eventHash;
- }
-
- public static final String HASH_PATTERN = "([0-9a-f]{32,})";
- private static final Pattern mClonePattern = Pattern.compile(CLONE_HEADER + HASH_PATTERN + "\\/" + HASH_PATTERN);
-
- private static String buildEventTypeParam(String[] headers, String ruleHash, String eventHash, List args) {
- String result = "";
- for (String header : headers) {
- if (ruleHash != null) {
- if (!result.contentEquals("")) {
- result += " OR ";
- }
- result += Events.DESCRIPTION + " LIKE ?";
- String arg = "%" + header + ruleHash + "/";
- if (eventHash != null) {
- arg += eventHash;
- }
- arg += "%";
- args.add(arg);
- } else {
- if (!result.contentEquals("")) {
- result += " OR ";
- }
- result += Events.DESCRIPTION + " LIKE ?";
- String arg = "%" + header + "%/";
- if (eventHash != null) {
- arg += eventHash;
- }
- arg += "%";
- args.add(arg);
- }
- }
- return result;
- }
-
- public static String buildDbSelect(int type, String ruleHash, String eventHash, List args) {
- switch (type) {
- case TYPE_NORMAL:
- return "(" + Events.DESCRIPTION + " ISNULL OR (NOT "
- + EventMarker.buildDbSelect(TYPE_CLONE, ruleHash, eventHash, args) + "))";
- case TYPE_CLONE:
- return "("
- + EventMarker.buildEventTypeParam(new String[] { CLONE_HEADER, FORWARD_HEADER }, ruleHash,
- eventHash, args) + ")";
- }
- return "";
- }
-
- public static int getEventType(Event event) {
- if (parseCloneEventHash(event) != null) {
- return TYPE_CLONE;
- }
- return TYPE_NORMAL;
- }
-
- public static String getEventHash(String eventUniqueId) {
- return Hasher.hash(eventUniqueId);
- }
-
- protected static String getCloneEventHash(String ruleHash, String eventUniqueId) {
- // Calculate the unique hash to put in the clone's description
- return CLONE_HEADER + ruleHash + MERGE_CHAR + getEventHash(eventUniqueId);
- }
-
- private static int[] locateEventHash(String descr, Pattern pattern) {
- if (descr != null && !descr.contentEquals("")) {
- Matcher m = pattern.matcher(descr);
- if (m.find()) {
- return new int[] { m.start(), m.end() };
- }
- }
- return null;
- }
-
- public static String markEventDescription(String descr, int type, String ruleHash, String eventUniqueId) {
- String marker = "";
- switch (type) {
- case TYPE_CLONE:
- marker = EventMarker.getCloneEventHash(ruleHash, eventUniqueId);
- break;
- }
- if (!descr.contentEquals("")) {
- marker = DESCRIPTION_PREFIX + marker;
- }
- if (descr.length() + marker.length() > DESCRIPTION_MAX_LENGTH) {
- descr = descr.substring(0, DESCRIPTION_MAX_LENGTH - marker.length());
- }
- return descr + marker;
- }
-
- private static String neutralizePattern(String descr, Pattern pattern) {
- int[] pos = EventMarker.locateEventHash(descr, pattern);
- while (pos != null) {
- // Remove the prefix if found
- if (pos[0] >= DESCRIPTION_PREFIX.length()
- && descr.substring(pos[0] - DESCRIPTION_PREFIX.length(), pos[0]).contentEquals(DESCRIPTION_PREFIX)) {
- pos[0] -= DESCRIPTION_PREFIX.length();
- }
- descr = descr.substring(0, pos[0]) + descr.substring(pos[1], descr.length());
- pos = EventMarker.locateEventHash(descr, pattern);
- }
- return descr;
- }
-
- public static String neutralizeEventDescription(String descr) {
- if (descr != null) {
- descr = EventMarker.neutralizePattern(descr, mClonePattern);
- }
- return descr;
- }
-
- private static Marker parseEventHash(String descr, Pattern pattern) {
- if (descr != null && !descr.contentEquals("")) {
- Matcher m = pattern.matcher(descr);
- if (m.find()) {
- Marker result = new Marker();
- result.ruleHash = m.group(1);
- result.eventHash = m.group(2);
- return result;
- }
- }
- return null;
- }
-
- public static Marker parseCloneEventHash(Event event) {
- Marker m = EventMarker.parseEventHash(event.getDescription(), mClonePattern);
- return m;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMover.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMover.java
deleted file mode 100644
index 2b46e6f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventMover.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.List;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Events;
-
-public class EventMover extends EventCloner {
- public EventMover(Rule rule) {
- super(rule);
- }
-
- protected boolean neutralizeEventType(Event event) {
- if (event != null) {
- // Remove PARTIAL_MOVE_HEADER
- ContentValues delta = new ContentValues();
- delta.put(Events.DESCRIPTION, EventMarker.neutralizeEventDescription(event.getDescription()));
- mEventsTable.update(event.getId(), delta);
- return true;
- }
-
- return false;
- }
-
- @Override
- protected void logCloneSummary(Event event, PartialCloneResult cloneResult, EventResult result) {
- if (!cloneResult.completed || !Limits.canModify(Limits.TYPE_EVENT)) {
- // Needs more time in the next iteration
- cloneResult.completed = false;
- // Log the appropriate message
- switch (cloneResult.result) {
- case RESULT_EVENT_INSERTED:
- case RESULT_EVENT_UPDATED:
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_moved_partially), event);
- default:
- super.logCloneSummary(event, cloneResult, result);
- }
- return;
- }
-
- // The move was fully finished and we reserved 1 more event modification. Actual modifications are done in
- // processSingleEvent and processRecurringEvent.
-
- // Log the appropriate message
- switch (cloneResult.result) {
- case RESULT_EVENT_INSERTED:
- case RESULT_EVENT_UPDATED:
- this.logSummary(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_moved), event);
- return;
- default:
- super.logCloneSummary(event, cloneResult, result);
- }
- }
-
- @Override
- protected EventResult processSingleEvent(Event event) {
- CloneResult result = (CloneResult) super.processSingleEvent(event);
- if (result.completed) {
- // Clone was successfully created and we reserved two more modifications. So now all we have to do is remove
- // the PARTIAL_MOVE_HEADER from the description and delete the source event.
- Event clone = DbEvent.get(mEventsTable, result.cloneId);
- if (clone != null) {
- if (this.neutralizeEventType(clone)) {
- // Delete original event
- mEventsTable.delete(event.getId());
- // Increase the update counter
- result.updateCount++;
- } else {
- result.completed = false;
- }
- } else {
- result.completed = false;
- }
- }
-
- return result;
- }
-
- @Override
- protected EventResult processRecurringEvent(Event event) {
- CloneResult result = (CloneResult) super.processRecurringEvent(event);
- if (result.completed) {
- // Clone was successfully created and we reserved one more modification for the main event and for each
- // exception. So now all we have to do is remove the PARTIAL_MOVE_HEADER from the events' descriptions and
- // delete the source event.
- Event clone = DbEvent.get(mEventsTable, result.cloneId);
- if (clone != null) {
- // Get the list of cloned exceptions
- List exceptions = this.getExceptions(clone);
- // Neutralize all exceptions one by one
- for (Event exception : exceptions) {
- if (result.completed == true && this.neutralizeEventType(exception)) {
- // Increase the update counter
- result.updateCount++;
- } else {
- result.completed = false;
- }
- }
-
- // Exceptions were all neutralized, so now neutralize the main event
- if (result.completed == true && this.neutralizeEventType(clone)) {
- // Delete original event
- mEventsTable.delete(event.getId());
- // Increase the update counter
- result.updateCount++;
- }
- } else {
- result.completed = false;
- }
- }
-
- return result;
- }
-
- @Override
- public InitResult init(ClonerLog log) {
- InitResult result = super.init(log);
- if (!result.isSuccess()) {
- return result;
- }
-
- // Check for source calendar write access
- if (!mSrcCalendar.isWriteable()) {
- return new InitResult(false, ClonerApp.translate(R.string.error_calendar_x_not_writeable,
- new String[] { ClonerApp.translate(R.string.calendar_source) }), result.getUpdateCount());
- }
- return new InitResult(true, "", result.getUpdateCount());
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventProcessor.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventProcessor.java
deleted file mode 100644
index e8fb211..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventProcessor.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-
-public class EventProcessor extends Processor {
- private static final long ONE_DAY = 24L * 3600 * 1000;
- private static final long INFINITY = 1000 * 365 * ONE_DAY;
-
- protected AttendeesTable mAttendeesTable = null;
- protected RemindersTable mRemindersTable = null;
-
- // The source calendar
- protected DbCalendar mSrcCalendar = null;
-
- // The destination calendar
- protected DbCalendar mDstCalendar = null;
-
- private Period mSyncPeriod = null;
-
- protected Rule mRule;
-
- protected int mEventNr = 0;
-
- public class EventResult {
- protected boolean completed = true;
- protected int updateCount = 0;
- }
-
- public EventProcessor(Rule rule) {
- mRule = rule;
- ClonerDb db = ClonerApp.getDb(rule.isReadOnly());
- mAttendeesTable = new AttendeesTable(db);
- mRemindersTable = new RemindersTable(db);
- }
-
- public long getDstCalendarId() {
- if (mDstCalendar != null) {
- return mDstCalendar.getId();
- }
- return -1;
- }
-
- public long getSrcCalendarId() {
- if (mSrcCalendar != null) {
- return mSrcCalendar.getId();
- }
- return -1;
- }
-
- private boolean isAvailabilitySelected(Availabilities avs, int availability) {
- // Map Availability to Availabilities values
- switch (availability) {
- case Availabilities.AVAILABILITY_FREE:
- case Availabilities.AVAILABILITY_TENTATIVE:
- case Availabilities.AVAILABILITY_BUSY:
- return avs.isKeySelected(availability);
- }
- return false;
- }
-
- private boolean isAvailabilitySamsungSelected(Availabilities avs, int availability) {
- // Map Samsung Availability to Availabilities values
- switch (availability) {
- case Device.Samsung.AVAILABILITY_FREE:
- return avs.isKeySelected(Availabilities.AVAILABILITY_FREE);
- case Device.Samsung.AVAILABILITY_TENTATIVE:
- return avs.isKeySelected(Availabilities.AVAILABILITY_TENTATIVE);
- case Device.Samsung.AVAILABILITY_BUSY:
- return avs.isKeySelected(Availabilities.AVAILABILITY_BUSY);
- case Device.Samsung.AVAILABILITY_OUT_OF_OFFICE:
- return avs.isKeySelected(Availabilities.AVAILABILITY_OUT_OF_OFFICE);
- }
- return false;
- }
-
- private String isEventSelectedByRule(Event event) {
- // Event Type filter
- if ((mRule.getEventTypeFilter() == Rule.EVENT_TYPE_SIMPLE && event.isRecurringEvent())
- || (mRule.getEventTypeFilter() == Rule.EVENT_TYPE_RECURRING && !event.isRecurringEvent())) {
- return ClonerApp.translate(R.string.rule_event_type_filter);
- }
-
- // Title Must Contain filter
- if (!mRule.getTitleMustContain().contentEquals("")) {
- if (event.getTitle() == null || !event.getTitle().contains(mRule.getTitleMustContain())) {
- return ClonerApp.translate(R.string.rule_title_must_contain);
- }
- }
-
- // Title Must Not Contain filter
- if (!mRule.getTitleMustNotContain().contentEquals("")) {
- if (event.getTitle() != null && event.getTitle().contains(mRule.getTitleMustNotContain())) {
- return ClonerApp.translate(R.string.rule_title_must_not_contain);
- }
- }
-
- // Location Must Contain filter
- if (!mRule.getLocationMustContain().contentEquals("")) {
- if (event.getLocation() == null || !event.getLocation().contains(mRule.getLocationMustContain())) {
- return ClonerApp.translate(R.string.rule_location_must_contain);
- }
- }
-
- // Location Must Not Contain filter
- if (!mRule.getLocationMustNotContain().contentEquals("")) {
- if (event.getLocation() != null && event.getLocation().contains(mRule.getLocationMustNotContain())) {
- return ClonerApp.translate(R.string.rule_location_must_not_contain);
- }
- }
-
- // Description Must Contain filter
- if (!mRule.getDescriptionMustContain().contentEquals("")) {
- if (event.getDescription() == null || !event.getDescription().contains(mRule.getDescriptionMustContain())) {
- return ClonerApp.translate(R.string.rule_description_must_contain);
- }
- }
-
- // Description Must Not Contain filter
- if (!mRule.getDescriptionMustNotContain().contentEquals("")) {
- if (event.getDescription() != null || event.getDescription().contains(mRule.getDescriptionMustNotContain())) {
- return ClonerApp.translate(R.string.rule_description_must_not_contain);
- }
- }
-
- // Access Level filter
- int accessLevel = event.getAccessLevel();
- if (!mRule.getAccessLevels().isKeySelected(accessLevel)) {
- return ClonerApp.translate(R.string.rule_access_level_filter);
- }
-
- // Attendance filter
- int attendeeStatus = event.getSelfAttendeeStatus();
- if (!mRule.getAttendeeStatuses().isKeySelected(attendeeStatus)) {
- return ClonerApp.translate(R.string.rule_attendance_filter);
- }
-
- // Availability filter
- if (event.hasAvailabilitySamsung()) {
- if (!this.isAvailabilitySamsungSelected(mRule.getAvailabilities(), event.getAvailabilitySamsung())) {
- return ClonerApp.translate(R.string.rule_availability_filter);
- }
- } else {
- if (!this.isAvailabilitySelected(mRule.getAvailabilities(), event.getAvailability())) {
- return ClonerApp.translate(R.string.rule_availability_filter);
- }
- }
-
- // Event Status filter
- int eventStatus = event.getStatus();
- if (!mRule.getEventStatuses().isKeySelected(eventStatus)) {
- return ClonerApp.translate(R.string.rule_event_status_filter);
- }
-
- if (!event.isRecurringEvent()) {
- // Find out if the event falls on one of the weekdays to process
- // events for
- DateTime start = event.getStartTime();
- DateTime end = event.getEndTime();
-
- boolean cloneableWeekday = false;
- while (!cloneableWeekday && !start.isAfter(end)) {
- int weekday = start.getDayOfWeek();
- cloneableWeekday = mRule.getWeekdays().isKeySelected(weekday);
- start = start.plusDays(1);
- }
-
- if (!cloneableWeekday) {
- return ClonerApp.translate(R.string.rule_weekday_filter);
- }
- }
-
- return null;
- }
-
- protected String isEventSelected(Event event) {
- // Check if the type of event is selected
- if (!mRule.getIncludeClones()) {
- if (EventMarker.getEventType(event) != EventMarker.TYPE_NORMAL) {
- return ClonerApp.translate(R.string.rule_include_clones);
- }
- }
-
- // Check if the event lies within the sync period
- Period eventPeriod = event.getPeriod();
-
- if (!eventPeriod.overlaps(mSyncPeriod)) {
- if (eventPeriod.endsBeforeStartOf(mSyncPeriod)) {
- return ClonerApp.translate(R.string.rule_sync_period_before);
- }
- if (eventPeriod.startsAfterEndOf(mSyncPeriod)) {
- return ClonerApp.translate(R.string.rule_sync_period_after);
- }
- }
-
- // Filter out events according to the rule's filters
- if (mRule.useEventFilters()) {
- String selectedMsg = this.isEventSelectedByRule(event);
- if (selectedMsg != null) {
- return selectedMsg;
- }
- }
-
- return null;
- }
-
- protected void skipSingleEvent(Event event) {
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_insync), event);
- }
-
- protected void skipRecurringEvent(Event event) {
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_insync), event);
- }
-
- protected EventResult createEventResult() {
- return new EventResult();
- }
-
- protected EventResult processSingleEvent(Event event) {
- return this.createEventResult();
- }
-
- protected EventResult processRecurringEvent(Event event) {
- return this.createEventResult();
- }
-
- public EventResult process(Event event, ClonerLog log, String logPrefix) {
- // Initialize the logging context
- this.initLogLines(log, logPrefix);
- // Keep track of whether the clone of the event is updated
- EventResult result = null;
- // Check if we need to clone this event
- String selectedMsg = this.isEventSelected(event);
- if (selectedMsg == null) {
- if (!event.isRecurringEvent()) {
- // Copy all the relevant fields from the source event to the
- // destination event
- result = this.processSingleEvent(event);
- } else {
- // Copy all the relevant fields from the source event to the
- // destination event
- result = this.processRecurringEvent(event);
- }
-
- // Event is now processed
- } else {
- this.logSummary(ClonerLog.LOG_INFO, ClonerApp.translate(R.string.cloner_log_skipped), event,
- ClonerApp.translate(R.string.cloner_log_filter_x, new String[] { selectedMsg }));
- }
-
- return result != null ? result : new EventResult();
- }
-
- @Override
- public InitResult init(ClonerLog log) {
- InitResult result = super.init(log);
- if (!result.isSuccess()) {
- return result;
- }
-
- // Find the source calendar
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mRule.getSrcCalendarRef());
- if (info.getCalendar() == null) {
- return new InitResult(false, CalendarLoader.getErrorString(info.getError(),
- ClonerApp.translate(R.string.calendar_source)), result.getUpdateCount());
- }
- mSrcCalendar = info.getCalendar();
- if (!mSrcCalendar.isLocal() && !mSrcCalendar.isSynchronized()) {
- return new InitResult(false, ClonerApp.translate(R.string.error_calendar_x_not_synchronized,
- new String[] { ClonerApp.translate(R.string.calendar_source) }), result.getUpdateCount());
- }
-
- // Find the destination calendar
- info = CalendarLoader.getCalendarByRef(mRule.getDstCalendarRef());
- if (info.getCalendar() == null) {
- return new InitResult(false, CalendarLoader.getErrorString(info.getError(),
- ClonerApp.translate(R.string.calendar_destination)), result.getUpdateCount());
- }
- mDstCalendar = info.getCalendar();
- if (!mDstCalendar.isLocal() && !mDstCalendar.isSynchronized()) {
- return new InitResult(false, ClonerApp.translate(R.string.error_calendar_x_not_synchronized,
- new String[] { ClonerApp.translate(R.string.calendar_destination) }), result.getUpdateCount());
- }
- if (!mDstCalendar.isWriteable()) {
- return new InitResult(false, ClonerApp.translate(R.string.error_calendar_x_not_writeable,
- new String[] { ClonerApp.translate(R.string.calendar_destination) }), result.getUpdateCount());
- }
-
- // Save current time for event period selection
- DateTime periodStart = new DateTime().minus(
- mRule.getSyncPeriodBefore() != 0 ? mRule.getSyncPeriodBefore() : INFINITY).withTime(0, 0, 0, 0);
- DateTime periodEnd = new DateTime()
- .plus(mRule.getSyncPeriodAfter() != 0 ? mRule.getSyncPeriodAfter() : INFINITY).plusDays(1)
- .withTime(0, 0, 0, 0);
- mSyncPeriod = new Period(periodStart, periodEnd);
-
- return result;
- }
-
- public EventResult roundup(ClonerLog log) {
- return this.createEventResult();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventRemover.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventRemover.java
deleted file mode 100644
index 040ed2b..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventRemover.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import android.app.AlertDialog;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.database.Cursor;
-import android.os.AsyncTask;
-
-public class EventRemover {
- private EventsTable mEventsTable = new EventsTable(ClonerApp.getDb(false));
-
- private CalendarLoader.CalendarInfo mCalendar = null;
- private String mSelection;
- private ArrayList mSelectionArgs;
-
- private Context mContext = null;
- private String mQuestion = "";
- private String mTitle = "";
- private OnDoneListener mOnDoneListener = null;
-
- private ClonerLog mLog = new LogLogcat("EventRemover", ClonerLog.TYPE_EXTENDED, ClonerLog.LOG_WARNING);
-
- public static abstract class OnDoneListener {
- public abstract void onDone(boolean removed, boolean success, long removeCount, String errorMessage);
- }
-
- public void init(String calRef, String selection, ArrayList selectionArgs, String title, String question) {
- mCalendar = CalendarLoader.getCalendarByRef(calRef);
- mSelection = selection;
- mSelectionArgs = selectionArgs;
- mTitle = title;
- mQuestion = question;
- }
-
- public void setOnDoneListener(OnDoneListener listener) {
- mOnDoneListener = listener;
- }
-
- private void done(boolean removed, boolean success, long count, String errorMessage) {
- if (mOnDoneListener != null) {
- mOnDoneListener.onDone(removed, success, count, errorMessage);
- }
- }
-
- private void removeEvents() {
- final ProgressDialog pd = ProgressDialog.show(mContext, "",
- ClonerApp.translate(R.string.msg_deleting_events, new String[] { mTitle }));
-
- new AsyncTask() {
- int mEventCount = 0;
-
- class QueryParams {
- String selection = mSelection;
- ArrayList args = mSelectionArgs;
- }
-
- private QueryParams getQueryParams() {
- QueryParams result = new QueryParams();
- if (mCalendar.getCalendar() != null) {
- if (!mSelection.contentEquals("")) {
- result.selection = "(" + mEventsTable.CALENDAR_ID.getName() + "=? AND (" + result.selection
- + "))";
- result.args.add(0, "" + mCalendar.getCalendar().getId());
- } else {
- result.selection = "(" + mEventsTable.CALENDAR_ID.getName() + "=?)";
- result.args = new ArrayList();
- result.args.add("" + mCalendar.getCalendar().getId());
- }
- }
- return result;
- }
-
- private void doRemoveEvents() {
- QueryParams query = this.getQueryParams();
- List ids = new LinkedList();
- Cursor cur = mEventsTable.query(query.selection, query.args.toArray(new String[] {}), null);
- try {
- while (cur.moveToNext()) {
- Event event = new DbEvent(mEventsTable, new DbObject(cur));
- ids.add(event.getId());
- }
- } finally {
- cur.close();
- }
- for (Long id : ids) {
- // Delete the event
- mLog.debug("Deleting event " + id);
- mEventsTable.delete(id);
- }
- mEventCount = ids.size();
- }
-
- @Override
- protected String doInBackground(Void... arg0) {
- String response = "";
- try {
- // Remove events here
- doRemoveEvents();
- } catch (Exception e) {
- mLog.stacktrace(e);
- response = ClonerApp.translate(R.string.log_exception) + ": " + e.toString();
- }
- return response;
- }
-
- @Override
- protected void onPostExecute(String result) {
- try {
- pd.dismiss();
- } catch (Exception e) {
- // eat
- }
- done(true, result == "", mEventCount, result);
- }
- }.execute();
- }
-
- public void execute(Context context) {
- DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- // Yes button clicked
- removeEvents();
- } else {
- done(false, false, 0, "");
- }
- }
- };
-
- mContext = context;
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(mTitle).setMessage(mQuestion)
- .setNegativeButton(ClonerApp.translate(R.string.msg_dont_delete), listener)
- .setPositiveButton(ClonerApp.translate(R.string.msg_delete), listener).show();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventStatuses.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventStatuses.java
deleted file mode 100644
index df296fe..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventStatuses.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Events;
-
-public class EventStatuses extends SelectList {
- public static final int STATUS_TENTATIVE = Events.STATUS_TENTATIVE;
- public static final int STATUS_CONFIRMED = Events.STATUS_CONFIRMED;
- public static final int STATUS_CANCELED = Events.STATUS_CANCELED;
-
- public static final int[] mKeys = new int[] { STATUS_TENTATIVE, STATUS_CONFIRMED, STATUS_CANCELED };
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.event_status_tentative),
- ClonerApp.translate(R.string.event_status_confirmed), ClonerApp.translate(R.string.event_status_canceled) };
-
- public EventStatuses(boolean allSelected) {
- super(allSelected);
- }
-
- public EventStatuses clone() {
- EventStatuses other = new EventStatuses(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventsTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventsTable.java
deleted file mode 100644
index 6355e5e..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/EventsTable.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.net.Uri;
-import android.provider.CalendarContract.Events;
-
-public class EventsTable extends ClonerTable {
- // CalendarContract columns
- public Column _ID = new Column(Events._ID);
- public Column CALENDAR_ID = new Column(Events.CALENDAR_ID);
- public Column _SYNC_ID = new Column(Events._SYNC_ID);
- public Column LAST_SYNCED = new Column(Events.LAST_SYNCED);
- public Column DELETED = new Column(Events.DELETED);
- public Column DIRTY = new Column(Events.DIRTY);
- public Column ACCOUNT_TYPE = new Column(Events.ACCOUNT_TYPE);
- public Column SYNC_DATA2 = new Column(Events.SYNC_DATA2);
- public Column UID_2445 = new Column("uid2445");
-
- public Column TITLE = new Column(Events.TITLE);
- public Column EVENT_LOCATION = new Column(Events.EVENT_LOCATION);
- public Column DESCRIPTION = new Column(Events.DESCRIPTION);
- public Column ORGANIZER = new Column(Events.ORGANIZER);
- public Column DTSTART = new Column(Events.DTSTART);
- public Column DTEND = new Column(Events.DTEND);
- public Column DURATION = new Column(Events.DURATION);
- public Column ALL_DAY = new Column(Events.ALL_DAY);
- public Column EVENT_TIMEZONE = new Column(Events.EVENT_TIMEZONE);
- public Column EVENT_END_TIMEZONE = new Column(Events.EVENT_END_TIMEZONE);
- public Column RRULE = new Column(Events.RRULE);
- public Column RDATE = new Column(Events.RDATE);
- public Column EXRULE = new Column(Events.EXRULE);
- public Column EXDATE = new Column(Events.EXDATE);
- public Column LAST_DATE = new Column(Events.LAST_DATE);
- public Column ORIGINAL_ID = new Column(Events.ORIGINAL_ID);
- public Column ORIGINAL_ALL_DAY = new Column(Events.ORIGINAL_ALL_DAY);
- public Column ORIGINAL_INSTANCE_TIME = new Column(Events.ORIGINAL_INSTANCE_TIME);
- public Column ACCESS_LEVEL = new Column(Events.ACCESS_LEVEL);
- public Column AVAILABILITY = new Column(Events.AVAILABILITY);
- public Column AVAILABILITY_SAMSUNG = new Column(Device.Samsung.AVAILABILITY);
- public Column STATUS = new Column(Events.STATUS);
- public Column SELF_ATTENDEE_STATUS = new Column(Events.SELF_ATTENDEE_STATUS);
-
- // HTC special columns
- public Column HTC_ICAL_GUID = new Column("iCalGUID");
-
- public EventsTable(ClonerDb db) {
- super(db, Events.CONTENT_URI);
- this.initColumns();
- }
-
- public EventsTable(ClonerDb db, Uri uri) {
- super(db, uri);
- this.initColumns();
- }
-
- private void initColumns() {
- // Add CalendarContract columns
- this.addColumn(_ID);
- this.addColumn(CALENDAR_ID);
- this.addColumn(_SYNC_ID);
- this.addColumn(LAST_SYNCED);
- this.addColumn(DELETED);
- this.addColumn(DIRTY);
- this.addColumn(ACCOUNT_TYPE);
- this.addColumn(SYNC_DATA2);
- this.addColumn(UID_2445);
-
- this.addColumn(TITLE);
- this.addColumn(EVENT_LOCATION);
- this.addColumn(DESCRIPTION);
- this.addColumn(ORGANIZER);
- this.addColumn(DTSTART);
- this.addColumn(DTEND);
- this.addColumn(DURATION);
- this.addColumn(ALL_DAY);
- this.addColumn(EVENT_TIMEZONE);
- this.addColumn(EVENT_END_TIMEZONE);
- this.addColumn(RRULE);
- this.addColumn(RDATE);
- this.addColumn(EXRULE);
- this.addColumn(EXDATE);
- this.addColumn(LAST_DATE);
- this.addColumn(ORIGINAL_ID);
- this.addColumn(ORIGINAL_ALL_DAY);
- this.addColumn(ORIGINAL_INSTANCE_TIME);
- this.addColumn(ACCESS_LEVEL);
- this.addColumn(AVAILABILITY);
- this.addColumn(AVAILABILITY_SAMSUNG);
- this.addColumn(STATUS);
- this.addColumn(SELF_ATTENDEE_STATUS);
-
- // Special columns
- this.addColumn(HTC_ICAL_GUID);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Hasher.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Hasher.java
deleted file mode 100644
index 73bbf30..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Hasher.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.security.MessageDigest;
-
-public class Hasher {
- private static MessageDigest mDigest = null;
- private static final char mHexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
- 'e', 'f' };
-
- private static void getDigest() {
- try {
- mDigest = java.security.MessageDigest.getInstance("MD5");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static String bytesToHex(byte[] bytes) {
- final char[] hexArray = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- char[] hexChars = new char[bytes.length * 2];
- int v;
- for (int j = 0; j < bytes.length; j++) {
- v = bytes[j] & 0xff;
- hexChars[j * 2] = hexArray[v >>> 4];
- hexChars[j * 2 + 1] = hexArray[v & 0x0f];
- }
- return new String(hexChars);
- }
-
- public static String hash(String s) {
- if (mDigest == null) {
- getDigest();
- }
- if (mDigest != null) {
- mDigest.update(s.getBytes());
- byte messageDigest[] = mDigest.digest();
- return bytesToHex(messageDigest);
- }
- return "";
- }
-
- public static String shortHash(String s) {
- if (mDigest == null) {
- getDigest();
- }
- if (mDigest != null) {
- mDigest.update(s.getBytes());
- byte messageDigest[] = mDigest.digest();
- if (messageDigest.length == 16) {
- StringBuilder hexString = new StringBuilder("00000000000000000000000000000000");
- for (int i = 0; i < messageDigest.length; i++) {
- int b = messageDigest[i] & 0xff;
- if (b >= 0x10) {
- hexString.setCharAt(i * 2, mHexChars[b >> 4]);
- }
- hexString.setCharAt(i * 2 + 1, mHexChars[b & 0xf]);
- }
- return hexString.toString();
- } else {
- // Create Hex String
- StringBuffer hexString = new StringBuffer(32);
- for (int i = 0; i < messageDigest.length; i++) {
- int b = messageDigest[i] & 0xff;
- if (b <= 0xf) {
- hexString.append("0");
- }
- hexString.append(Integer.toHexString(b));
- }
- return hexString.toString();
- }
- }
- return "";
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/HelpActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/HelpActivity.java
deleted file mode 100644
index 5e47209..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/HelpActivity.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-
-import java.util.Locale;
-
-public class HelpActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.helpactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
-
- WebView view = (WebView) findViewById(R.id.help_view);
- view.getSettings().setLoadWithOverviewMode(true);
- view.getSettings().setUseWideViewPort(true);
- view.getSettings().setBuiltInZoomControls(true);
- view.setWebViewClient(new WebViewClient() {
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- view.loadUrl(url);
- return true;
- }
- });
-
- String lang = Locale.getDefault().getLanguage();
- view.loadUrl("http://dizzl.com/apps/calendarcloner/index.php?lang=" + lang);
- }
-
- @Override
- public void onBackPressed() {
- this.finish();
- super.onBackPressed();
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.onBackPressed();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/InstancesTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/InstancesTable.java
deleted file mode 100644
index afec6f4..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/InstancesTable.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentUris;
-import android.database.Cursor;
-import android.net.Uri;
-import android.provider.CalendarContract.Instances;
-
-public class InstancesTable extends EventsTable {
- public Column EVENT_ID = new Column(Instances.EVENT_ID);
- public Column BEGIN = new Column(Instances.BEGIN);
- public Column END = new Column(Instances.END);
- public Column END_DAY = new Column(Instances.END_DAY);
- public Column END_MINUTE = new Column(Instances.END_MINUTE);
- public Column START_DAY = new Column(Instances.START_DAY);
- public Column START_MINUTE = new Column(Instances.START_MINUTE);
-
- public InstancesTable(ClonerDb db) {
- super(db, Instances.CONTENT_URI);
- this.initColumns();
- }
-
- private void initColumns() {
- // Add CalendarContract columns
- this.addColumn(EVENT_ID);
- this.addColumn(BEGIN);
- this.addColumn(END);
- this.addColumn(END_DAY);
- this.addColumn(END_MINUTE);
- this.addColumn(START_DAY);
- this.addColumn(START_MINUTE);
- }
-
- public Cursor queryByDay(long calendarId, long begin, long end) {
- Uri.Builder eventsUriBuilder = Instances.CONTENT_URI.buildUpon();
- ContentUris.appendId(eventsUriBuilder, begin);
- ContentUris.appendId(eventsUriBuilder, end);
- Uri eventsUri = eventsUriBuilder.build();
- return this.rawQuery(eventsUri, Instances.CALENDAR_ID + " =?", new String[] { "" + calendarId },
- Instances.DTSTART + " ASC");
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Limits.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Limits.java
deleted file mode 100644
index 69815ad..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Limits.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.util.SparseArray;
-
-public class Limits {
- public static final int TYPE_EVENT = 0;
- public static final int TYPE_ATTENDEE = 1;
- public static final int EVENT_LIMITS[] = { 50, 100, 250, 500, 1000, 2000, 4000, 10000, 0 };
- public static final int ATTENDEE_LIMITS[] = { 25, 50, 100, 150, 200, 300, 500, 1000, 0 };
-
- private static int mAttendeeLimit;
- private static int mEventLimit;
-
- private static long mCurrentTime = 0;
-
- // The registration for all modifications
- public static class TypeCounter {
- private int mCount = 0;
- private boolean mLimitReached = false;
- private long mStartTime = 0;
-
- public int getCount() {
- return mCount;
- }
-
- public boolean getLimitReached() {
- return mLimitReached;
- }
-
- public long getStartTime() {
- return mStartTime;
- }
-
- public void setCount(int count) {
- mCount = count;
- }
-
- public void setStartTime(long startTime) {
- mStartTime = startTime;
- }
- }
-
- private static SparseArray mTypeCounters = new SparseArray();
-
- public static boolean canModify(int type) {
- return Limits.canModify(type, 1);
- }
-
- public static boolean canModify(int type, int number) {
- // Find the relevant counter
- TypeCounter counter = Limits.getTypeCounter(type);
-
- // Initialize the counter time if not set
- if (counter.mStartTime == 0) {
- counter.mStartTime = mCurrentTime;
- }
-
- // If more than an hour has passed, reset the counter
- long inBetween = mCurrentTime - counter.mStartTime;
- if (inBetween > 60 * 60 * 1000) {
- counter.mCount = 0;
- counter.mLimitReached = false;
- counter.mStartTime = mCurrentTime;
- }
-
- int limit = Limits.getTypeLimit(type);
- if (limit == 0 || counter.mCount <= limit - number) {
- counter.mCount += number;
- return true;
- }
-
- counter.mLimitReached = true;
- return false;
- }
-
- public static TypeCounter getTypeCounter(int type) {
- TypeCounter counter = mTypeCounters.get(type);
- if (counter != null) {
- return counter;
- }
-
- // Create a new counter and add it to the array
- counter = new TypeCounter();
- mTypeCounters.put(type, counter);
- return counter;
- }
-
- public static int getTypeLimit(int type) {
- int limit = 0;
- switch (type) {
- case TYPE_EVENT:
- limit = mEventLimit;
- break;
- case TYPE_ATTENDEE:
- limit = mAttendeeLimit;
- break;
- }
- return limit;
- }
-
- public static void setTypeCounter(int type, TypeCounter counter) {
- mTypeCounters.put(type, counter);
- }
-
- public static boolean setTypeLimit(int type, int limit) {
- switch (type) {
- case TYPE_EVENT:
- int mOldEventLimit = mEventLimit;
- if (ClonerVersion.IS_PAID_VERSION()) {
- mEventLimit = Utilities.getSelectionFromArray(EVENT_LIMITS, limit, EVENT_LIMITS[0]);
- } else {
- mEventLimit = EVENT_LIMITS[0];
- }
- return mEventLimit != mOldEventLimit;
- case TYPE_ATTENDEE:
- int mOldAttendeeLimit = mAttendeeLimit;
- if (ClonerVersion.IS_PAID_VERSION()) {
- mAttendeeLimit = Utilities.getSelectionFromArray(ATTENDEE_LIMITS, limit, ATTENDEE_LIMITS[0]);
- } else {
- mAttendeeLimit = ATTENDEE_LIMITS[0];
- }
- return mAttendeeLimit != mOldAttendeeLimit;
- }
- return false;
- }
-
- public static void startRun() {
- mCurrentTime = System.currentTimeMillis();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogActivity.java
deleted file mode 100644
index 61ddd12..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogActivity.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.BaseExpandableListAdapter;
-import android.widget.ExpandableListView;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-
-public class LogActivity extends Activity {
- private LogAdapter mAdapter;
- private ClonerLog mLog = null;
- private boolean mUseLogLevel = true;
- private int mLogLevel = ClonerLog.LOG_UPDATE;
- private boolean mDisplayHeader = true;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.logactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
-
- mLog = (ClonerLog) ClonerApp.getParameter("log");
-
- Intent i = this.getIntent();
- if (i.getExtras() != null) {
- mDisplayHeader = i.getExtras().getBoolean("displayHeader");
- this.getActionBar().setTitle(
- i.getExtras().getString("title", ClonerApp.translate(R.string.rulelog_activity_title)));
- mUseLogLevel = i.getExtras().getBoolean("uselevel", true);
- } else {
- this.getActionBar().setTitle(ClonerApp.translate(R.string.rulelog_activity_title));
- }
-
- // Prepare the event type filter
- final Spinner logFilterView = (Spinner) findViewById(R.id.logLevelView);
- String[] eventTypes = new String[] { ClonerApp.translate(R.string.log_type_info),
- ClonerApp.translate(R.string.log_type_warning), ClonerApp.translate(R.string.log_type_update),
- ClonerApp.translate(R.string.log_type_error) };
- ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, eventTypes);
- adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
- logFilterView.setAdapter(adapter);
- logFilterView.setSelection(mLogLevel);
- logFilterView.setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> view, View item, int position, long id) {
- mLogLevel = position;
- updateView();
- }
-
- @Override
- public void onNothingSelected(AdapterView> arg0) {
- mLogLevel = 0;
- updateView();
- }
- });
-
- // Disable filter if not used
- if (!mUseLogLevel) {
- mLogLevel = ClonerLog.LOG_INFO;
- View filter = findViewById(R.id.logLevelLine);
- filter.setVisibility(View.GONE);
- }
- this.updateView();
- }
-
- private void updateView() {
- TextView tv = (TextView) findViewById(R.id.tvLogName);
- ExpandableListView elv = (ExpandableListView) findViewById(R.id.elvLog);
-
- // Remove default icons
- elv.setGroupIndicator(null);
-
- if (mLog != null) {
- if (mLog.getTitle() != null && !mLog.getTitle().contentEquals("") && mDisplayHeader) {
- tv.setText(ClonerApp.translate(R.string.rulelog_rule) + ": " + mLog.getTitle());
- tv.setVisibility(View.VISIBLE);
- } else {
- tv.setVisibility(View.GONE);
- }
-
- if (mLog instanceof LogMemory) {
- LogMemory log = (LogMemory) mLog;
- LogLine[] summaries = new LogLine[log.size()];
- log.getSummaries(summaries);
- LogLines[] lineSets = new LogLines[log.size()];
- log.getLineSets(lineSets);
- mAdapter = new LogAdapter(this, summaries, lineSets, mLogLevel);
- } else {
- mAdapter = new LogAdapter(this, new LogLine[0], new LogLines[0], mLogLevel);
- }
- elv.setAdapter(mAdapter);
-
- // Expand if requested by caller
- Intent i = this.getIntent();
- if (i.getExtras() != null && i.getExtras().getBoolean("expand", false)) {
- for (int index = 0; index < mAdapter.getGroupCount(); index++) {
- elv.expandGroup(index);
- }
- }
- } else {
- tv.setText("");
- elv.setAdapter((BaseExpandableListAdapter) null);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogAdapter.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogAdapter.java
deleted file mode 100644
index 84329e5..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogAdapter.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseExpandableListAdapter;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class LogAdapter extends BaseExpandableListAdapter {
- private static int mLogLineResourceId = R.layout.logline_layout;
-
- private LayoutInflater mLi = null;
- private LogLine[] mSummaries = null;
- private LogLines[] mLogLines = null;
- private Bitmap mBitmapContracted;
- private Bitmap mBitmapExpanded;
- private Bitmap mBitmapNone;
-
- public LogAdapter(Context context, LogLine[] summaries, LogLines[] logLines, int logLevel) {
- super();
- mLi = LayoutInflater.from(context);
-
- // Count the number of log entries with level >= logLevel
- int count = 0;
- for (int i = 0; i < summaries.length; i++) {
- if (summaries[i].getLevel() >= logLevel || (logLines[i] != null && logLines[i].getMaxLevel() >= logLevel)) {
- count++;
- }
- }
-
- // Copy the summaries and lines into our local arrays
- mSummaries = new LogLine[count];
- mLogLines = new LogLines[count];
- for (int i = summaries.length - 1; i >= 0; i--) {
- if (summaries[i].getLevel() >= logLevel || (logLines[i] != null && logLines[i].getMaxLevel() >= logLevel)) {
- mSummaries[--count] = summaries[i];
- mLogLines[count] = logLines[i];
- }
- }
-
- mBitmapContracted = BitmapFactory.decodeResource(context.getResources(), R.drawable.tree_contracted_16);
- mBitmapExpanded = BitmapFactory.decodeResource(context.getResources(), R.drawable.tree_expanded_16);
- mBitmapNone = BitmapFactory.decodeResource(context.getResources(), R.drawable.tree_none_16);
- }
-
- @Override
- public Object getChild(int groupPosition, int childPosition) {
- return mLogLines[groupPosition].getLines().get(childPosition);
- }
-
- @Override
- public long getChildId(int groupPosition, int childPosition) {
- return childPosition;
- }
-
- @Override
- public int getChildrenCount(int groupPosition) {
- if (mLogLines[groupPosition] != null) {
- return mLogLines[groupPosition].getLines().size();
- }
- return 0;
- }
-
- public View getView(LogLine logLine, boolean isGroup, boolean groupIsExpanded, boolean groupHasChildren,
- View convertView, ViewGroup parent) {
- View view = convertView;
- if (view == null) {
- view = mLi.inflate(mLogLineResourceId, parent, false);
- }
-
- // Determine the text color
- int textColor = Color.WHITE;
- switch (logLine.getLevel()) {
- case ClonerLog.LOG_INFO:
- textColor = Color.LTGRAY;
- break;
- case ClonerLog.LOG_WARNING:
- textColor = Color.YELLOW;
- break;
- case ClonerLog.LOG_UPDATE:
- textColor = Color.GREEN;
- break;
- case ClonerLog.LOG_ERROR:
- textColor = Color.RED;
- break;
- default:
- textColor = Color.WHITE;
- }
-
- // Set the logPrefix
- TextView logPrefix = (TextView) view.findViewById(R.id.logPrefix2);
- if (logLine.getLogPrefix() != null) {
- logPrefix.setVisibility(View.VISIBLE);
- logPrefix.setText(logLine.getLogPrefix());
- logPrefix.setTextColor(textColor);
- } else {
- logPrefix.setVisibility(View.GONE);
- }
-
- // Set the icon
- ImageView icon = (ImageView) view.findViewById(R.id.logIcon);
- if (isGroup) {
- icon.setVisibility(View.VISIBLE);
- icon.setImageBitmap(groupHasChildren ? (groupIsExpanded ? mBitmapExpanded : mBitmapContracted)
- : mBitmapNone);
- } else {
- icon.setVisibility(View.GONE);
- }
-
- // Set the text columns
- TextView column0 = (TextView) view.findViewById(R.id.column0);
- TextView column1 = (TextView) view.findViewById(R.id.column1);
- TextView column2 = (TextView) view.findViewById(R.id.column2);
- switch (logLine.getColumnCount()) {
- case 1:
- column0.setVisibility(View.GONE);
- column1.setVisibility(View.VISIBLE);
- column2.setVisibility(View.GONE);
- column1.setText(logLine.getColumn(0));
- column1.setTextColor(textColor);
- column1.setWidth((int) (parent.getWidth() - column1.getX()));
- break;
- case 2:
- column0.setVisibility(View.VISIBLE);
- column1.setVisibility(View.VISIBLE);
- column2.setVisibility(View.GONE);
- column0.setText(logLine.getColumn(0));
- column0.setTextColor(textColor);
- column1.setText(logLine.getColumn(1));
- column1.setTextColor(textColor);
- break;
- case 3:
- column0.setVisibility(View.VISIBLE);
- column1.setVisibility(View.VISIBLE);
- column2.setVisibility(View.VISIBLE);
- column0.setText(logLine.getColumn(0));
- column0.setTextColor(textColor);
- column1.setText(logLine.getColumn(1));
- column1.setTextColor(textColor);
- column2.setText(logLine.getColumn(2));
- column2.setTextColor(textColor);
- column1.setWidth((int) (parent.getWidth() - column1.getX()) / 2);
- column2.setWidth((int) (parent.getWidth() - column1.getX()) / 2);
- break;
- }
- return view;
- }
-
- @Override
- public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
- ViewGroup parent) {
- return this.getView(mLogLines[groupPosition].getLines().get(childPosition), false, false, false, convertView,
- parent);
- }
-
- @Override
- public Object getGroup(int groupPosition) {
- return mSummaries[groupPosition];
- }
-
- @Override
- public int getGroupCount() {
- return mSummaries.length;
- }
-
- @Override
- public long getGroupId(int groupPosition) {
- return groupPosition;
- }
-
- @Override
- public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
- return this.getView(mSummaries[groupPosition], true, isExpanded, mLogLines[groupPosition] != null
- && !mLogLines[groupPosition].empty(), convertView, parent);
- }
-
- @Override
- public boolean isChildSelectable(int groupPosition, int childPosition) {
- return true;
- }
-
- @Override
- public boolean hasStableIds() {
- return true;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLine.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLine.java
deleted file mode 100644
index e1b741d..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLine.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class LogLine {
- private String[] mColumns;
- private int mColumnCount = 0;
- private int mLogLevel;
- private String mLogPrefix;
-
- public LogLine(boolean dummy, int level, String logPrefix, String col0) {
- mLogLevel = level;
- mLogPrefix = logPrefix;
- mColumnCount = 1;
- mColumns = new String[mColumnCount];
- mColumns[0] = col0;
- }
-
- public LogLine(boolean dummy, int level, String logPrefix, String col0, String col1) {
- mLogLevel = level;
- mLogPrefix = logPrefix;
- mColumnCount = 2;
- mColumns = new String[mColumnCount];
- mColumns[0] = col0;
- mColumns[1] = col1;
- }
-
- public LogLine(boolean dummy, int level, String logPrefix, String col0, String col1, String col2) {
- mLogLevel = level;
- mLogPrefix = logPrefix;
- mColumnCount = 3;
- mColumns = new String[mColumnCount];
- mColumns[0] = col0;
- mColumns[1] = col1;
- mColumns[2] = col2;
- }
-
- public int getLevel() {
- return mLogLevel;
- }
-
- public String getLogPrefix() {
- return mLogPrefix;
- }
-
- public int getColumnCount() {
- return mColumnCount;
- }
-
- public String getColumn(int index) {
- return mColumns[index];
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactory.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactory.java
deleted file mode 100644
index 1b8bca0..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactory.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public abstract class LogLineFactory {
- public abstract LogLine createLogLine(int level, String logPrefix, String col0);
- public abstract LogLine createLogLine(int level, String logPrefix, String col0, String col1);
- public abstract LogLine createLogLine(int level, String logPrefix, String col0, String col1, String col2);
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryMemory.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryMemory.java
deleted file mode 100644
index c3a0b68..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryMemory.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class LogLineFactoryMemory extends LogLineFactory {
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0) {
- return new LogLine(false, level, logPrefix, col0);
- }
-
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1) {
- return new LogLine(false, level, logPrefix, col0, col1);
- }
-
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1, String col2) {
- return new LogLine(false, level, logPrefix, col0, col1, col2);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryNull.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryNull.java
deleted file mode 100644
index eb30c72..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLineFactoryNull.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class LogLineFactoryNull extends LogLineFactory {
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0) {
- return null;
- }
-
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1) {
- return null;
- }
-
- @Override
- public LogLine createLogLine(int level, String logPrefix, String col0, String col1, String col2) {
- return null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLines.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLines.java
deleted file mode 100644
index c9e28cb..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLines.java
+++ /dev/null
@@ -1,453 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Attendees;
-import android.provider.CalendarContract.Events;
-
-import org.joda.time.DateTime;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-public class LogLines {
- private static final String NULL = "null";
- private final List mLines = new ArrayList();
- private final LogLineFactory mLogLineFactory;
- private int mMaxLevel = 0;
-
- public LogLines(LogLineFactory logLineFactory) {
- mLogLineFactory = logLineFactory;
- }
-
- public boolean empty() {
- return mLines.size() == 0;
- }
-
- public List getLines() {
- return mLines;
- }
-
- public int getMaxLevel() {
- return mMaxLevel;
- }
-
- private String timeToString(DateTime time) {
- return Utilities.dateTimeToString(time) + " (" + time.getMillis() + ")";
- }
-
- private void add(LogLine line) {
- mLines.add(line);
- if (line != null && line.getLevel() > mMaxLevel) {
- mMaxLevel = line.getLevel();
- }
- }
-
- public void addEmptyLine() {
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, null, "", "", ""));
- }
-
- public boolean isUsed() {
- return mLines.size() > 0;
- }
-
- public void log(int level, String logPrefix, String message) {
- this.add(mLogLineFactory.createLogLine(level, logPrefix, message));
- }
-
- public void log(int level, String logPrefix, String message, String eventTitle) {
- int size = 10;
- if (message != null) {
- size += message.length();
- }
- if (eventTitle != null) {
- size += eventTitle.length();
- }
- StringBuffer buf = new StringBuffer(size);
- buf.append(" ");
- if (message != null) {
- buf.append(message);
- }
- if (eventTitle != null) {
- buf.append(": ");
- buf.append(eventTitle);
- }
- this.add(mLogLineFactory.createLogLine(level, logPrefix, buf.toString()));
- }
-
- public int getLevel(String key, ContentValues delta) {
- if (delta != null && delta.containsKey(key)) {
- return ClonerLog.LOG_UPDATE;
- }
- return ClonerLog.LOG_INFO;
- }
-
- public int getLevel(String key, ContentValues srcDelta, ContentValues dstDelta) {
- if (srcDelta != null && srcDelta.containsKey(key)) {
- return ClonerLog.LOG_UPDATE;
- }
- if (dstDelta != null && dstDelta.containsKey(key)) {
- return ClonerLog.LOG_UPDATE;
- }
- return ClonerLog.LOG_INFO;
- }
-
- private String getAvailabilityDescription(Event event) {
- if (event.hasAvailabilitySamsung()) {
- int availability = event.getAvailabilitySamsung();
- return new AvailabilitiesSamsung(true).getKeyName(availability) + " (" + availability + "S)";
- }
- return new Availabilities(true).getKeyNameAndValue(event.getAvailability());
- }
-
- public void logEvent(Event event, ContentValues changedFields) {
- String logPrefix = null;
-
- if (event == null) {
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_WARNING, logPrefix, "Logging null event"));
- return;
- }
-
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events._ID, changedFields), logPrefix, "Id",
- "" + event.getId()));
- if (event instanceof DbEvent) {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events._SYNC_ID, changedFields), logPrefix, "Sync id",
- ((DbEvent) event).getSyncId()));
- }
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "CC UID", event.getUniqueId()));
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "Event hash",
- EventMarker.getEventHash(event.getUniqueId())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DELETED, changedFields), logPrefix, "Deleted",
- event.isDeleted() ? "Yes" : "No"));
- this.addEmptyLine();
-
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "Calendar",
- CalendarLoader.getCalendarNameOrErrorMessage(event.getCalendarId()) + " (Id: " + event.getCalendarId()
- + ")"));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.TITLE, changedFields), logPrefix, "Title",
- event.getTitle()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_LOCATION, changedFields), logPrefix,
- "Location", event.getLocation()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DTSTART, changedFields), logPrefix, "StartTime",
- this.timeToString(event.getStartTime())));
- // if (!event.isAllDay()) {
- if (!event.isRecurringEvent()) {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DTEND, changedFields), logPrefix, "End time",
- this.timeToString(event.getEndTime())));
- } else {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DURATION, changedFields), logPrefix,
- "Duration", event.getDuration()));
- }
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ALL_DAY, changedFields), logPrefix, "All day",
- event.isAllDay() ? "Yes" : "No"));
-
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORGANIZER, changedFields), logPrefix, "Organizer",
- event.getOrganizer()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DESCRIPTION, changedFields), logPrefix,
- "Description", event.getDescription()));
-
- if (event.isRecurringEvent()) {
- // Clone recurring event fields
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.RRULE, changedFields), logPrefix, "RRule",
- event.getRecurrenceRule()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.RDATE, changedFields), logPrefix, "RDate",
- event.getRecurrenceDate()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EXRULE, changedFields), logPrefix, "ExRule",
- event.getRecurrenceExRule()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EXDATE, changedFields), logPrefix, "ExDate",
- event.getRecurrenceExDate()));
- this.add(mLogLineFactory.createLogLine(
- this.getLevel(Events.LAST_DATE, changedFields),
- logPrefix,
- "LastDate",
- event.getLastDate() != null ? this.timeToString(event.getLastDate()) : ClonerApp
- .translate(R.string.msg_infinite) + " (0)"));
- }
- if (event.isRecurringEventException()) {
- // Log recurring event exception fields
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_ID, changedFields), logPrefix,
- "Original ID", "" + event.getOriginalID()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_ALL_DAY, changedFields), logPrefix,
- "Original all day", event.isOriginalAllDay() ? "Yes" : "No"));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_INSTANCE_TIME, changedFields),
- logPrefix, "Original instance time", this.timeToString(event.getOriginalInstanceTime())));
- }
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_TIMEZONE, changedFields), logPrefix,
- "Start Timezone", event.getStartTimeZone(true) != null ? event.getStartTimeZone(false).toString() : NULL));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_END_TIMEZONE, changedFields), logPrefix,
- "End timezone", event.getEndTimeZone() != null ? event.getEndTimeZone().toString() : NULL));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ACCESS_LEVEL, changedFields), logPrefix,
- "Access level", new AccessLevels(true).getKeyNameAndValue(event.getAccessLevel())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.AVAILABILITY, changedFields), logPrefix,
- "Availability", this.getAvailabilityDescription(event)));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.STATUS, changedFields), logPrefix, "Status",
- new EventStatuses(true).getKeyNameAndValue(event.getStatus())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.SELF_ATTENDEE_STATUS, changedFields), logPrefix,
- "SelfAttendeeStatus", new AttendeeStatuses(true).getKeyNameAndValue(event.getSelfAttendeeStatus())));
- }
-
- public void logEvent(Event event) {
- this.logEvent(event, null);
- }
-
- public void logEvents(Event src, Event dst, ContentValues changedFields) {
- if (src == null) {
- this.logEvent(dst, changedFields);
- return;
- }
- if (dst == null) {
- this.logEvent(src, changedFields);
- return;
- }
-
- String logPrefix = null;
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events._ID, changedFields), logPrefix, "Id",
- "" + src.getId(), "" + dst.getId()));
- if (src instanceof DbEvent && dst instanceof DbEvent) {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events._SYNC_ID, changedFields), logPrefix, "Sync id",
- ((DbEvent) src).getSyncId(), ((DbEvent) dst).getSyncId()));
- }
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "CC UID", src.getUniqueId(),
- dst.getUniqueId()));
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "Event hash",
- EventMarker.getEventHash(src.getUniqueId()), EventMarker.getEventHash(dst.getUniqueId())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DELETED, changedFields), logPrefix, "Deleted",
- src.isDeleted() ? "Yes" : "No", dst.isDeleted() ? "Yes" : "No"));
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "", "", ""));
-
- this.add(mLogLineFactory.createLogLine(ClonerLog.LOG_INFO, logPrefix, "Calendar",
- CalendarLoader.getCalendarNameOrErrorMessage(src.getCalendarId()) + " (Id: " + src.getCalendarId()
- + ")",
- CalendarLoader.getCalendarNameOrErrorMessage(dst.getCalendarId()) + " (Id: " + dst.getCalendarId()
- + ")"));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.TITLE, changedFields), logPrefix, "Title",
- src.getTitle(), dst.getTitle()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_LOCATION, changedFields), logPrefix,
- "Location", src.getLocation(), dst.getLocation()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DTSTART, changedFields), logPrefix, "StartTime",
- this.timeToString(src.getStartTime()), this.timeToString(dst.getStartTime())));
- if (!src.isRecurringEvent() || !dst.isRecurringEvent()) {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DTEND, changedFields), logPrefix, "End time",
- !src.isRecurringEvent() ? this.timeToString(src.getEndTime()) : "",
- !dst.isRecurringEvent() ? this.timeToString(dst.getEndTime()) : ""));
- }
- if (src.isRecurringEvent() || dst.isRecurringEvent()) {
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DURATION, changedFields), logPrefix,
- "Duration", src.isRecurringEvent() ? src.getDuration() : "",
- dst.isRecurringEvent() ? dst.getDuration() : ""));
- }
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ALL_DAY, changedFields), logPrefix, "All day",
- src.isAllDay() ? "Yes" : "No", dst.isAllDay() ? "Yes" : "No"));
-
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORGANIZER, changedFields), logPrefix, "Organizer",
- src.getOrganizer(), dst.getOrganizer()));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.DESCRIPTION, changedFields), logPrefix,
- "Description", src.getDescription(), dst.getDescription()));
-
- if (src.isRecurringEvent() || dst.isRecurringEvent()) {
- // Clone recurring event fields
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.RRULE, changedFields), logPrefix, "RRule",
- src.isRecurringEvent() ? src.getRecurrenceRule() : "",
- dst.isRecurringEvent() ? dst.getRecurrenceRule() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.RDATE, changedFields), logPrefix, "RDate",
- src.isRecurringEvent() ? src.getRecurrenceDate() : "",
- dst.isRecurringEvent() ? dst.getRecurrenceDate() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EXRULE, changedFields), logPrefix, "ExRule",
- src.isRecurringEvent() ? src.getRecurrenceExRule() : "",
- dst.isRecurringEvent() ? dst.getRecurrenceExRule() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EXDATE, changedFields), logPrefix, "ExDate",
- src.isRecurringEvent() ? src.getRecurrenceExDate() : "",
- dst.isRecurringEvent() ? dst.getRecurrenceExDate() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.LAST_DATE, changedFields), logPrefix,
- "LastDate",
- src.isRecurringEvent() ? (src.getLastDate() != null ? this.timeToString(src.getLastDate())
- : ClonerApp.translate(R.string.msg_infinite) + " (0)") : "",
- dst.isRecurringEvent() ? (dst.getLastDate() != null ? this.timeToString(dst.getLastDate())
- : ClonerApp.translate(R.string.msg_infinite) + " (0)") : ""));
- }
- if (src.isRecurringEventException() || dst.isRecurringEventException()) {
- // Log recurring event exception fields
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_ID, changedFields), logPrefix,
- "Original ID", src.isRecurringEventException() ? "" + src.getOriginalID() : "",
- dst.isRecurringEventException() ? "" + dst.getOriginalID() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_ALL_DAY, changedFields), logPrefix,
- "Original all day", src.isRecurringEventException() ? (src.isOriginalAllDay() ? "Yes" : "No") : "",
- dst.isRecurringEventException() ? (dst.isOriginalAllDay() ? "Yes" : "No") : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ORIGINAL_INSTANCE_TIME, changedFields),
- logPrefix, "Original instance time",
- src.isRecurringEventException() ? this.timeToString(src.getOriginalInstanceTime()) : "",
- dst.isRecurringEventException() ? this.timeToString(dst.getOriginalInstanceTime()) : ""));
- }
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_TIMEZONE, changedFields), logPrefix,
- "Start Timezone",
- src.getStartTimeZone(true) != null ? src.getStartTimeZone(false).toString() : NULL,
- dst.getStartTimeZone(true) != null ? dst.getStartTimeZone(false).toString() : NULL));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.EVENT_END_TIMEZONE, changedFields), logPrefix,
- "End timezone", src.getEndTimeZone() != null ? src.getEndTimeZone().toString() : NULL,
- dst.getEndTimeZone() != null ? dst.getEndTimeZone().toString() : NULL));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.ACCESS_LEVEL, changedFields), logPrefix,
- "Access level", new AccessLevels(true).getKeyNameAndValue(src.getAccessLevel()),
- new AccessLevels(true).getKeyNameAndValue(dst.getAccessLevel())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(dst.hasAvailabilitySamsung() ? Device.Samsung.AVAILABILITY
- : Events.AVAILABILITY, changedFields), logPrefix, "Availability", this.getAvailabilityDescription(src),
- this.getAvailabilityDescription(dst)));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.STATUS, changedFields), logPrefix, "Status",
- new EventStatuses(true).getKeyNameAndValue(src.getStatus()),
- new EventStatuses(true).getKeyNameAndValue(dst.getStatus())));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Events.SELF_ATTENDEE_STATUS, changedFields), logPrefix,
- "SelfAttendeeStatus", new AttendeeStatuses(true).getKeyNameAndValue(src.getSelfAttendeeStatus()),
- new AttendeeStatuses(true).getKeyNameAndValue(dst.getSelfAttendeeStatus())));
- }
-
- public void logAttendees(int level, List attendees) {
- String logPrefix = null;
- for (int index = 0; index < attendees.size(); index++) {
- if (index > 0) {
- this.addEmptyLine();
- }
- DbAttendee att = attendees.get(index);
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Attendee " + (index + 1), "" + att.getId()));
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Name", att.getName()));
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Email", att.getEmail()));
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Relationship",
- new AttendeeRelationships(true).getKeyNameAndValue(att.getRelationship())));
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Type",
- new AttendeeTypes(true).getKeyNameAndValue(att.getType())));
- this.add(mLogLineFactory.createLogLine(level, logPrefix, "Status",
- new AttendeeStatuses(true).getKeyNameAndValue(att.getStatus())));
- }
- }
-
- private void logAttendees(int index, DbAttendee eventAttendee, DbAttendee cloneAttendee, ContentValues srcDelta,
- ContentValues dstDelta) {
- String logPrefix = null;
- this.add(mLogLineFactory.createLogLine(this.getLevel(Attendees._ID, srcDelta, dstDelta), logPrefix, "Attendee "
- + (index), eventAttendee != null ? "" + eventAttendee.getId() : "", cloneAttendee != null ? ""
- + cloneAttendee.getId() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Attendees.ATTENDEE_NAME, srcDelta, dstDelta), logPrefix,
- "Name", eventAttendee != null ? eventAttendee.getName() : "",
- cloneAttendee != null ? cloneAttendee.getName() : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Attendees.ATTENDEE_EMAIL, srcDelta, dstDelta), logPrefix,
- "Email", eventAttendee != null ? eventAttendee.getEmail() : "",
- cloneAttendee != null ? cloneAttendee.getEmail() : ""));
- this.add(mLogLineFactory.createLogLine(
- this.getLevel(Attendees.ATTENDEE_RELATIONSHIP, srcDelta, dstDelta),
- logPrefix,
- "Relationship",
- eventAttendee != null ? new AttendeeRelationships(true).getKeyNameAndValue(eventAttendee
- .getRelationship()) : "",
- cloneAttendee != null ? new AttendeeRelationships(true).getKeyNameAndValue(cloneAttendee
- .getRelationship()) : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Attendees.ATTENDEE_TYPE, srcDelta, dstDelta), logPrefix,
- "Type", eventAttendee != null ? new AttendeeTypes(true).getKeyNameAndValue(eventAttendee.getType())
- : "",
- cloneAttendee != null ? new AttendeeTypes(true).getKeyNameAndValue(cloneAttendee.getType()) : ""));
- this.add(mLogLineFactory.createLogLine(this.getLevel(Attendees.ATTENDEE_STATUS, srcDelta, dstDelta), logPrefix,
- "Status",
- eventAttendee != null ? new AttendeeStatuses(true).getKeyNameAndValue(eventAttendee.getStatus()) : "",
- cloneAttendee != null ? new AttendeeStatuses(true).getKeyNameAndValue(cloneAttendee.getStatus()) : ""));
- }
-
- public void logAttendees(List eventAttendees, List cloneAttendees, DbCalendar srcCalendar,
- DbCalendar dstCalendar, AttendeeDeltas deltas, String dummyEmailDomain) {
- HashMap clones = new HashMap();
- if (cloneAttendees != null) {
- for (DbAttendee clone : cloneAttendees) {
- clones.put(AttendeeId.map(clone.getName(), clone.getEmail()), clone);
- }
- }
-
- int index = 0;
- for (DbAttendee eventAttendee : eventAttendees) {
- if (index > 0) {
- this.addEmptyLine();
- }
- // Look up the cloned attendee
- DbAttendee clone;
- // If SELF then look up destination account
- if (srcCalendar != null
- && dstCalendar != null
- && AttendeeId.map(srcCalendar.getOwnerAccount()).contentEquals(
- AttendeeId.map(eventAttendee.getEmail()))) {
- clone = clones.get(AttendeeId.map(dstCalendar.getOwnerAccount()));
- } else {
- // Look up by source attendee
- clone = clones.get(AttendeeId.map(eventAttendee.getName(), eventAttendee.getEmail()));
- }
- // If still not found
- if (clone == null) {
- // Look up by dummy email address
- clone = clones.get(AttendeeId.map(eventAttendee.getName(),
- EmailObfuscator.generateDummyEmailFrom(eventAttendee.getEmail(), dummyEmailDomain)));
- }
- this.logAttendees(
- ++index,
- eventAttendee,
- clone,
- eventAttendee != null && deltas != null ? deltas.get(eventAttendee.getName(),
- eventAttendee.getEmail()) : null,
- clone != null && deltas != null ? deltas.get(clone.getName(), clone.getEmail()) : null);
- if (clone != null) {
- clones.remove(AttendeeId.map(clone.getName(), clone.getEmail()));
- }
- }
-
- // Log remaining cloned attendees
- for (Entry cloneEntry : clones.entrySet()) {
- final DbAttendee clone = cloneEntry.getValue();
- this.logAttendees(++index, null, clone, null,
- deltas != null ? deltas.get(clone.getName(), clone.getEmail()) : null);
- }
- }
-
- public void logReminders(int level, List eventReminders, List cloneReminders,
- Map mappedReminders) {
- String logPrefix = null;
- int index = 0;
- for (DbReminder eventReminder : eventReminders) {
- if (index++ > 0) {
- this.addEmptyLine();
- }
-
- if (cloneReminders != null && mappedReminders != null) {
- DbReminder cloneReminder = null;
-
- long cloneReminderId = mappedReminders.containsKey(eventReminder.getId()) ? mappedReminders
- .get(eventReminder.getId()) : 0;
- for (DbReminder cr : cloneReminders) {
- if (cr.getId() == cloneReminderId) {
- cloneReminder = cr;
- }
- }
-
- if (cloneReminder != null) {
- this.add(mLogLineFactory.createLogLine(
- level,
- logPrefix,
- "Reminder " + (index + 1),
- eventReminder != null ? new ReminderMethods(true).getKeyNameAndValue(eventReminder
- .getMethod())
- + " ("
- + ClonerApp.translate(R.string.msg_n_minutes,
- new String[]{"" + eventReminder.getMinutes()}) + ")" : "",
- cloneReminder != null ? new ReminderMethods(true).getKeyNameAndValue(cloneReminder
- .getMethod())
- + " ("
- + ClonerApp.translate(R.string.msg_n_minutes,
- new String[]{"" + cloneReminder.getMinutes()}) + ")" : ""));
- }
- } else {
- this.add(mLogLineFactory.createLogLine(
- level,
- logPrefix,
- "Reminder " + (index + 1),
- eventReminder != null ? new ReminderMethods(true).getKeyNameAndValue(eventReminder.getMethod())
- + " ("
- + ClonerApp.translate(R.string.msg_n_minutes,
- new String[]{"" + eventReminder.getMinutes()}) + ")" : ""));
- }
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLogcat.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLogcat.java
deleted file mode 100644
index 8cca937..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogLogcat.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.util.Log;
-
-public class LogLogcat extends ClonerLog {
- private int mFromLevel;
-
- public LogLogcat(String title, int logType, int fromLevel) {
- super(title, logType, new LogLineFactoryMemory());
- mFromLevel = fromLevel;
- }
-
- private void logToLogcat(LogLine line) {
- if (line.getLevel() >= mFromLevel) {
- String logMessage = "";
- for (int index = 0; index < line.getColumnCount(); index++) {
- logMessage += " | " + line.getColumn(index);
- }
- if (!this.getTitle().contentEquals("")) {
- logMessage += ": " + this.getTitle();
- }
- switch (line.getLevel()) {
- case ClonerLog.LOG_WARNING:
- Log.w("Cloner", logMessage);
- break;
- case ClonerLog.LOG_UPDATE:
- Log.i("Cloner", logMessage);
- break;
- case ClonerLog.LOG_ERROR:
- Log.e("Cloner", logMessage);
- break;
- default:
- Log.d("Cloner", logMessage);
- }
- }
- }
-
- @Override
- public void log(LogLine summary, LogLines lines) {
- super.log(summary, lines);
- // Log to logcat
- if (summary != null) {
- this.logToLogcat(summary);
- }
- if (lines != null) {
- if (this.getLogType() == ClonerLog.TYPE_EXTENDED
- || (summary != null && summary.getLevel() == ClonerLog.LOG_ERROR)
- || lines.getMaxLevel() == ClonerLog.LOG_ERROR) {
- for (LogLine line : lines.getLines()) {
- this.logToLogcat(line);
- }
- }
- }
- }
-
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogMemory.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogMemory.java
deleted file mode 100644
index 008b874..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogMemory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-
-public class LogMemory extends ClonerLog {
- private ArrayList mLineSets = new ArrayList();
- private ArrayList mSummaries = new ArrayList();
-
- public LogMemory(String title, int logType) {
- super(title, logType, new LogLineFactoryMemory());
- }
-
- @Override
- public void log(LogLine summary, LogLines lines) {
- super.log(summary, lines);
- // Log to memory
- mSummaries.add(summary);
- if (this.getLogType() == ClonerLog.TYPE_EXTENDED
- || (summary != null && summary.getLevel() == ClonerLog.LOG_ERROR)
- || (lines != null && lines.getMaxLevel() == ClonerLog.LOG_ERROR)) {
- mLineSets.add(lines);
- } else {
- mLineSets.add(null);
- }
- }
-
- public int size() {
- return mSummaries.size();
- }
-
- public void getLineSets(LogLines[] lineSets) {
- mLineSets.toArray(lineSets);
- }
-
- public void getSummaries(LogLine[] summaries) {
- mSummaries.toArray(summaries);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogNull.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogNull.java
deleted file mode 100644
index 33cc059..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogNull.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class LogNull extends ClonerLog {
- public LogNull(String title) {
- super(title, ClonerLog.TYPE_SUMMARY, new LogLineFactoryNull());
- }
-
- @Override
- public void log(LogLine summary, LogLines lines) {
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogSplitter.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogSplitter.java
deleted file mode 100644
index d542e4f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/LogSplitter.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class LogSplitter extends LogMemory {
- private LogLogcat mLogcat;
-
- public LogSplitter(String title, int logType, int fromLevel) {
- super(title, logType);
- mLogcat = new LogLogcat(title, logType, fromLevel);
- }
-
- @Override
- public void log(LogLine summary, LogLines lines) {
- mLogcat.log(summary, lines);
- super.log(summary, lines);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MainActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MainActivity.java
deleted file mode 100644
index d0c2ffd..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MainActivity.java
+++ /dev/null
@@ -1,434 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.preference.CheckBoxPreference;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceFragment;
-import android.preference.SwitchPreference;
-
-public class MainActivity extends PreferenceActivity {
- static final String CC_SETTINGS_FILENAME = ClonerVersion.thisVersionName() + " Settings.txt";
-
- public static class GeneralPrefsFragment extends PreferenceFragment {
- private long mClonerStateOrResyncTime = ClonerStateRunnable.CLONER_NOT_RUNNING;
- private final Handler mHandler = new Handler();
- private Preference mEnabled = null;
- private Timer mTimer = null;
- private final ClonerStateRunnable mTimerSignalRunnable = new ClonerStateRunnable() {
- @Override
- public void run(long clonerStateOrResyncTime) {
- mClonerStateOrResyncTime = clonerStateOrResyncTime;
- }
- };
-
- private void fillCheckBox(String name, boolean checked, String checkedSummary, String uncheckedSummary,
- boolean enabled) {
- CheckBoxPreference cbp = (CheckBoxPreference) findPreference(name);
- cbp.setChecked(checked);
- cbp.setSummary(checked ? checkedSummary : uncheckedSummary);
- cbp.setEnabled(enabled);
- }
-
- private void setSummary(Preference pref, String value, String[] keys, String[] names) {
- String summary = null;
- for (int index = 0; index < keys.length; index++) {
- if (keys[index].contentEquals(value)) {
- summary = names[index];
- }
- }
- pref.setSummary(summary != null ? summary : "");
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.main_preferences);
-
- final Settings settings = ClonerApp.getSettings();
-
- SwitchPreference sp = (SwitchPreference) findPreference("clonerEnabled");
- sp.setChecked(settings.isClonerEnabled());
- sp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- settings.setClonerEnabled((Boolean) newValue);
- return true;
- }
-
- });
- mEnabled = sp;
-
- final ListPreference ctw = (ListPreference) findPreference("clonerTimeWait");
- final String[] ctwKeys = new String[] { "60", "120", "300", "600", "900", "1800", "3600", "7200", "14400",
- "28800", "86400" };
- final String[] ctwNames = new String[] { ClonerApp.translate(R.string.msg_n_minute, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_minutes, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_minutes, new String[] { "5" }),
- ClonerApp.translate(R.string.msg_n_minutes, new String[] { "10" }),
- ClonerApp.translate(R.string.msg_n_minutes, new String[] { "15" }),
- ClonerApp.translate(R.string.msg_n_minutes, new String[] { "30" }),
- ClonerApp.translate(R.string.msg_n_hour, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_hours, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_hours, new String[] { "4" }),
- ClonerApp.translate(R.string.msg_n_hours, new String[] { "8" }),
- ClonerApp.translate(R.string.msg_n_hours, new String[] { "24" }) };
- ctw.setEntries(ctwNames);
- ctw.setEntryValues(ctwKeys);
- ctw.setValue(((Integer) settings.getClonerTimeWait()).toString());
- this.setSummary(ctw, "" + settings.getClonerTimeWait(), ctwKeys, ctwNames);
-
- ctw.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- settings.setClonerTimeWait(Integer.parseInt((String) newValue));
- setSummary(ctw, "" + settings.getClonerTimeWait(), ctwKeys, ctwNames);
- return true;
- }
-
- });
-
- final ListPreference elp = (ListPreference) findPreference("eventLimit");
- final String[] elpKeys = new String[Limits.EVENT_LIMITS.length];
- final String[] elpNames = new String[Limits.EVENT_LIMITS.length];
- for (int index = 0; index < Limits.EVENT_LIMITS.length; index++) {
- elpKeys[index] = "" + Limits.EVENT_LIMITS[index];
- if (Limits.EVENT_LIMITS[index] != 0) {
- elpNames[index] = ClonerApp.translate(R.string.msg_n_max_updates_per_hour, new String[] { ""
- + Limits.EVENT_LIMITS[index] });
- } else {
- elpNames[index] = ClonerApp.translate(R.string.msg_unlimited);
- }
- }
- elp.setEntries(elpNames);
- elp.setEntryValues(elpKeys);
- elp.setValue(((Integer) Limits.getTypeLimit(Limits.TYPE_EVENT)).toString());
- this.setSummary(elp, "" + Limits.getTypeLimit(Limits.TYPE_EVENT), elpKeys, elpNames);
-
- elp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- if (settings.setTypeLimit(Limits.TYPE_EVENT, Integer.parseInt((String) newValue))) {
- setSummary(elp, "" + Limits.getTypeLimit(Limits.TYPE_EVENT), elpKeys, elpNames);
- return true;
- } else {
- ClonerVersion.msgPaidVersionOnly();
- return false;
- }
- }
-
- });
-
- final ListPreference alp = (ListPreference) findPreference("attendeeLimit");
- final String[] alpKeys = new String[Limits.ATTENDEE_LIMITS.length];
- final String[] alpNames = new String[Limits.ATTENDEE_LIMITS.length];
- for (int index = 0; index < Limits.ATTENDEE_LIMITS.length; index++) {
- alpKeys[index] = "" + Limits.ATTENDEE_LIMITS[index];
- if (Limits.ATTENDEE_LIMITS[index] != 0) {
- alpNames[index] = ClonerApp.translate(R.string.msg_n_max_updates_per_hour, new String[] { ""
- + Limits.ATTENDEE_LIMITS[index] });
- } else {
- alpNames[index] = ClonerApp.translate(R.string.msg_unlimited);
- }
- }
- alp.setEntries(alpNames);
- alp.setEntryValues(alpKeys);
- alp.setValue(((Integer) Limits.getTypeLimit(Limits.TYPE_ATTENDEE)).toString());
- this.setSummary(alp, "" + Limits.getTypeLimit(Limits.TYPE_ATTENDEE), alpKeys, alpNames);
-
- alp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- if (settings.setTypeLimit(Limits.TYPE_ATTENDEE, Integer.parseInt((String) newValue))) {
- setSummary(alp, "" + Limits.getTypeLimit(Limits.TYPE_ATTENDEE), alpKeys, alpNames);
- return true;
- } else {
- ClonerVersion.msgPaidVersionOnly();
- return false;
- }
- }
-
- });
-
- final ListPreference ltp = (ListPreference) findPreference("logType");
- final String[] ltpKeys = new String[] { "" + ClonerLog.TYPE_SUMMARY, "" + ClonerLog.TYPE_EXTENDED };
- final String[] ltpNames = new String[] { ClonerApp.translate(R.string.main_logtype_summary),
- ClonerApp.translate(R.string.main_logtype_extended) };
- ltp.setEntries(ltpNames);
- ltp.setEntryValues(ltpKeys);
- ltp.setValue("" + settings.getLogType());
- this.setSummary(ltp, "" + settings.getLogType(), ltpKeys, ltpNames);
-
- ltp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- settings.setLogType(Integer.parseInt((String) newValue));
- setSummary(ltp, "" + settings.getLogType(), ltpKeys, ltpNames);
- return true;
- }
-
- });
-
- final CheckBoxPreference llp = (CheckBoxPreference) findPreference("logToLogcat");
- this.fillCheckBox("logToLogcat", settings.getLogToLogcat(),
- ClonerApp.translate(R.string.main_log_logcat_on_summary),
- ClonerApp.translate(R.string.main_log_logcat_off_summary), true);
- llp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- settings.setLogToLogcat((Boolean) newValue);
- fillCheckBox("logToLogcat", settings.getLogToLogcat(),
- ClonerApp.translate(R.string.main_log_logcat_on_summary),
- ClonerApp.translate(R.string.main_log_logcat_off_summary), true);
- return true;
- }
- });
-
- final CheckBoxPreference lmp = (CheckBoxPreference) findPreference("logToMemory");
- this.fillCheckBox("logToMemory", settings.getLogToMemory(),
- ClonerApp.translate(R.string.main_log_memory_on_summary),
- ClonerApp.translate(R.string.main_log_memory_off_summary), true);
- lmp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- settings.setLogToMemory((Boolean) newValue);
- fillCheckBox("logToMemory", settings.getLogToMemory(),
- ClonerApp.translate(R.string.main_log_memory_on_summary),
- ClonerApp.translate(R.string.main_log_memory_off_summary), true);
- return true;
- }
- });
-
- final Preference rp = findPreference("rules");
- rp.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference arg0) {
- Intent i = new Intent(rp.getContext(), RulesActivity.class);
- startActivity(i);
- return false;
- }
-
- });
-
- final Preference be = findPreference("browseEvents");
- if (be != null) {
- be.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent i = new Intent(be.getContext(), BrowseActivity.class);
- startActivity(i);
- return false;
- }
- });
- }
-
- final Preference de = findPreference("duplicateEvents");
- if (de != null) {
- de.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Settings settings = ClonerApp.getSettings();
- if (!settings.isClonerEnabled()) {
- Intent i = new Intent(de.getContext(), DuplicatesActivity.class);
- startActivity(i);
- return true;
- }
- showClonerStillEnabledMessage();
- return false;
- }
- });
- }
-
- final Preference ls = findPreference("loadSettingsFromFile");
- ls.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference arg0) {
- DialogInterface.OnClickListener loadSettingsFromFileListener = new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- // Yes button clicked
- Settings settings = ClonerApp.getSettings();
- if (!settings.isClonerEnabled()) {
- SettingsMap map = SettingsMapStreamer.loadFromFile(CC_SETTINGS_FILENAME);
- // Always disable the cloner when loading
- // new settings from file
- if (map != null) {
- map.put("clonerEnabled", false);
- settings.loadfromMap(map);
- ClonerApp.toast(ClonerApp.translate(R.string.msg_settings_loaded_from_file,
- new String[] { CC_SETTINGS_FILENAME }));
- } else {
- ClonerApp.toast(ClonerApp.translate(
- R.string.error_could_not_load_settings_from_file,
- new String[] { CC_SETTINGS_FILENAME }));
- }
- } else {
- showClonerStillEnabledMessage();
- }
- }
- }
- };
-
- AlertDialog.Builder builder = new AlertDialog.Builder(GeneralPrefsFragment.this.getActivity());
- builder.setTitle("Load settings")
- .setMessage(
- ClonerApp.translate(R.string.ask_load_settings_from_file,
- new String[] { CC_SETTINGS_FILENAME }))
- .setNegativeButton(ClonerApp.translate(R.string.msg_dont_load_settings),
- loadSettingsFromFileListener)
- .setPositiveButton(ClonerApp.translate(R.string.msg_load_settings),
- loadSettingsFromFileListener).show();
-
- return true;
- }
- });
-
- final Preference ss = findPreference("saveSettingsToFile");
- ss.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference arg0) {
- Settings settings = ClonerApp.getSettings();
- if (!settings.isClonerEnabled()) {
- SettingsMap map = new SettingsMap();
- settings.saveToMap(map);
- if (SettingsMapStreamer.saveToFile(CC_SETTINGS_FILENAME, map)) {
- ClonerApp.toast(ClonerApp.translate(R.string.msg_settings_saved_to_file,
- new String[] { CC_SETTINGS_FILENAME }));
- } else {
- ClonerApp.toast(ClonerApp.translate(R.string.error_could_not_save_settings_to_file,
- new String[] { CC_SETTINGS_FILENAME }));
- }
- } else {
- showClonerStillEnabledMessage();
- }
- return true;
- }
- });
-
- final Preference hp = findPreference("help");
- hp.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent i = new Intent(hp.getContext(), HelpActivity.class);
- startActivity(i);
- return true;
- }
- });
-
- final Preference ap = findPreference("about");
- ap.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent i = new Intent(ap.getContext(), AboutActivity.class);
- startActivity(i);
- return false;
- }
- });
- }
-
- private void showClonerStillEnabledMessage() {
- AlertDialog.Builder builder = new AlertDialog.Builder(GeneralPrefsFragment.this.getActivity());
- builder.setTitle(ClonerApp.translate(R.string.msg_cloner_still_enabled))
- .setMessage(ClonerApp.translate(R.string.msg_cloner_still_enabled_info))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
-
- @Override
- public void onStart() {
- super.onStart();
- // Register for resync timer signals
- ClonerApp.registerClonerStateRunnable(mTimerSignalRunnable, true);
- // Activate a timer to update the resync menu item
- mTimer = new Timer("Resync timer display", false);
- mTimer.scheduleAtFixedRate(new TimerTask() {
- @Override
- public void run() {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- onUpdateResyncTimer();
- }
- });
- }
- }, 0, 1000);
- }
-
- @Override
- public void onStop() {
- mTimer.cancel();
- mTimer = null;
- ClonerApp.unregisterClonerStateRunnable(mTimerSignalRunnable);
- super.onStop();
- }
-
- private void onUpdateResyncTimer() {
- Settings settings = ClonerApp.getSettings();
- if (!settings.isClonerEnabled()) {
- mEnabled.setSummary(ClonerApp.translate(R.string.main_resync_disabled));
- return;
- }
- if (mClonerStateOrResyncTime == ClonerStateRunnable.CLONER_RUNNING) {
- mEnabled.setSummary(ClonerApp.translate(R.string.main_resync_running));
- return;
- }
- if (mClonerStateOrResyncTime == ClonerStateRunnable.CLONER_NOT_RUNNING) {
- mEnabled.setSummary(ClonerApp.translate(R.string.main_resync_not_running));
- return;
- }
-
- long timeRemaining = mClonerStateOrResyncTime - System.currentTimeMillis();
- if (timeRemaining < 0) {
- mEnabled.setSummary(ClonerApp.translate(R.string.main_resync_running_soon));
- return;
- }
-
- long hours = timeRemaining / (3600 * 1000);
- timeRemaining -= hours * (3600 * 1000);
- long minutes = timeRemaining / (60 * 1000);
- long seconds = (timeRemaining % (60 * 1000)) / 1000;
- String time = "";
- if (hours > 0) {
- time += "" + hours + ":";
- }
- if (minutes < 10 && hours > 0) {
- time += "0";
- }
- time += "" + minutes + ":";
- if (seconds < 10) {
- time += "0";
- }
- time += "" + seconds;
- mEnabled.setSummary(ClonerApp.translate(R.string.main_resync_in_x_time, new String[] { time }));
- }
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPrefsFragment()).commit();
- }
-
- @Override
- public void onBuildHeaders(List target) {
- super.onBuildHeaders(target);
- // loadHeadersFromResource(R.xml.pref_headers, target);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- this.overridePendingTransition(R.anim.animation_enter_left, R.anim.animation_leave_right);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryAttendee.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryAttendee.java
deleted file mode 100644
index d4b21d7..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryAttendee.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-
-public class MemoryAttendee implements Attendee {
- private String mName = "";
- private String mEmail = "";
- private int mRelationship = Attendees.RELATIONSHIP_NONE;
- private int mType = Attendees.TYPE_NONE;
- private int mStatus = Attendees.ATTENDEE_STATUS_NONE;
-
- public long getId() {
- return 0;
- }
-
- public String getName() {
- return mName;
- }
-
- public String getEmail() {
- return mEmail;
- }
-
- public int getRelationship() {
- return mRelationship;
- }
-
- public int getType() {
- return mType;
- }
-
- public int getStatus() {
- return mStatus;
- }
-
- public void setName(String name) {
- mName = name;
- }
-
- public void setEmail(String email) {
- mEmail = email;
- }
-
- public void setRelationship(int relationship) {
- mRelationship = relationship;
- }
-
- public void setType(int type) {
- mType = type;
- }
-
- public void setStatus(int status) {
- mStatus = status;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryEvent.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryEvent.java
deleted file mode 100644
index 47debcd..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/MemoryEvent.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Attendees;
-import android.provider.CalendarContract.Events;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public class MemoryEvent implements Event {
- private long mCalendarId;
- private String mTitle, mLocation, mDescription;
- private DateTime mStartTime;
- private DateTime mEndTime;
- private final DateTimeZone mCalendarTimeZone;
- private DateTimeZone mTimeZone;
- private int mAccessLevel = Events.ACCESS_DEFAULT;
- private int mAvailability = Events.AVAILABILITY_BUSY;
- private int mAvailabilitySamsung = Device.Samsung.AVAILABILITY_BUSY;
- private String mUniqueId;
-
- public MemoryEvent(DateTimeZone calendarTimeZone) {
- mCalendarTimeZone = calendarTimeZone;
- }
-
- @Override
- public long getId() {
- return 0;
- }
-
- @Override
- public long getCalendarId() {
- return mCalendarId;
- }
-
- @Override
- public boolean isDeleted() {
- return false;
- }
-
- @Override
- public boolean isDirty() {
- return false;
- }
-
- @Override
- public String getOrganizer() {
- return null;
- }
-
- @Override
- public String getTitle() {
- return mTitle;
- }
-
- @Override
- public String getLocation() {
- return mLocation;
- }
-
- @Override
- public String getDescription() {
- return mDescription;
- }
-
- @Override
- public DateTime getStartTime() {
- if (mStartTime == null) {
- mStartTime = new DateTime();
- }
- return mStartTime;
- }
-
- @Override
- public DateTime getEndTime() {
- if (mEndTime == null) {
- mEndTime = new DateTime();
- }
- return mEndTime;
- }
-
- @Override
- public String getDuration() {
- return null;
- }
-
- @Override
- public boolean isAllDay() {
- return false;
- }
-
- @Override
- public DateTimeZone getStartTimeZone(boolean allowNull) {
- if (mTimeZone == null && !allowNull) {
- return DateTimeZone.getDefault();
- }
- return mTimeZone;
- }
-
- @Override
- public DateTimeZone getEndTimeZone() {
- return mTimeZone;
- }
-
- @Override
- public String getRecurrenceRule() {
- return null;
- }
-
- @Override
- public String getRecurrenceDate() {
- return null;
- }
-
- @Override
- public String getRecurrenceExRule() {
- return null;
- }
-
- @Override
- public String getRecurrenceExDate() {
- return null;
- }
-
- @Override
- public DateTime getLastDate() {
- return null;
- }
-
- @Override
- public long getOriginalID() {
- return 0;
- }
-
- @Override
- public boolean isOriginalAllDay() {
- return false;
- }
-
- @Override
- public DateTime getOriginalInstanceTime() {
- return null;
- }
-
- @Override
- public int getAccessLevel() {
- return mAccessLevel;
- }
-
- @Override
- public int getAvailability() {
- return mAvailability;
- }
-
- @Override
- public int getAvailabilitySamsung() {
- return mAvailabilitySamsung;
- }
-
- @Override
- public boolean hasAvailabilitySamsung() {
- return true;
- }
-
- @Override
- public int getStatus() {
- return Events.STATUS_CONFIRMED;
- }
-
- @Override
- public boolean hasStatus() {
- return false;
- }
-
- @Override
- public int getSelfAttendeeStatus() {
- return Attendees.ATTENDEE_STATUS_ACCEPTED;
- }
-
- @Override
- public String getUniqueId() {
- return mUniqueId;
- }
-
- @Override
- public boolean isRecurringEvent() {
- return false;
- }
-
- @Override
- public boolean isRecurringEventException() {
- return false;
- }
-
- @Override
- public boolean isSingleEvent() {
- return true;
- }
-
- @Override
- public Period getPeriod() {
- return new Period(this.getStartTime(), this.getEndTime());
- }
-
- @Override
- public DateTimeZone getCalendarTimeZone() {
- return mCalendarTimeZone;
- }
-
- public void setCalendarId(long calendarId) {
- mCalendarId = calendarId;
- }
-
- public void setTitle(String title) {
- mTitle = title;
- }
-
- public void setLocation(String location) {
- mLocation = location;
- }
-
- public void setDescription(String description) {
- mDescription = description;
- }
-
- public void setStartTime(DateTime startTime) {
- mStartTime = startTime;
- }
-
- public void setEndTime(DateTime endTime) {
- mEndTime = endTime;
- }
-
- public void setTimeZone(DateTimeZone timeZone) {
- mTimeZone = timeZone;
- }
-
- public void setAccessLevel(int accessLevel) {
- mAccessLevel = accessLevel;
- }
-
- public void setAvailability(int availability) {
- mAvailability = availability;
- }
-
- public void setAvailabilitySamsung(int availabilitySamsung) {
- mAvailabilitySamsung = availabilitySamsung;
- }
-
- public void setUniqueId(String uniqueId) {
- mUniqueId = uniqueId;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Period.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Period.java
deleted file mode 100644
index 3abb01d..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Period.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public class Period {
- private DateTime mStart;
- private DateTime mEnd;
-
- public Period(DateTime start, DateTime end) {
- if (start.isBefore(end)) {
- mStart = start;
- mEnd = end;
- } else {
- mStart = end;
- mEnd = start;
- }
- }
-
- public Period(DateTime point) {
- mStart = point;
- mEnd = point;
- }
-
- @Override
- public String toString() {
- if (!this.isNull()) {
- return mStart + " - " + mEnd;
- }
- return "Null";
- }
-
- public DateTime getStart() {
- return mStart;
- }
-
- public DateTime getEnd() {
- return mEnd;
- }
-
- @Override
- public Period clone() {
- return new Period(mStart, mEnd);
- }
-
- public boolean isNull() {
- return mStart == mEnd;
- }
-
- public long distanceTo(DateTime time) {
- return this.distanceTo(new Period(time, time));
- }
-
- public long distanceTo(Period other) {
- if (other.mStart.isAfter(mEnd)) {
- return other.mStart.getMillis() - mEnd.getMillis();
- }
- if (other.mEnd.isBefore(mStart)) {
- return mStart.getMillis() - other.mEnd.getMillis();
- }
- return 0;
- }
-
- public Period getOverlap(Period other) {
- if (!other.mEnd.isBefore(mStart) && !mEnd.isBefore(other.mStart)) {
- DateTime start = mStart.isAfter(other.mStart) ? mStart : other.mStart;
- DateTime end = mEnd.isBefore(other.mEnd) ? mEnd : other.mEnd;
- Period overlap = new Period(start, end);
- return overlap;
- }
- return null;
- }
-
- public boolean startsAtOrAfter(DateTime time) {
- return !mStart.isBefore(time);
- }
-
- public boolean endsBefore(DateTime time) {
- return mEnd.isBefore(time);
- }
-
- public void merge(Period other) {
- if (this.isNull()) {
- mStart = other.mStart;
- mEnd = other.mEnd;
- return;
- }
-
- if (other.mStart.isBefore(mStart)) {
- mStart = other.mStart;
- }
- if (other.mEnd.isAfter(mEnd)) {
- mEnd = other.mEnd;
- }
- }
-
- public Period[] subtract(Period other) {
- // If the other period doesn't overlap, return ourselves
- if (!this.overlaps(other)) {
- Period result[] = new Period[1];
- result[0] = this.clone();
- return result;
- }
-
- // If the other period splits this period in two, return the two
- // halves
- if (other.startsAfterStartOf(this) && other.endsBeforeEndOf(this)) {
- Period result[] = new Period[2];
- result[0] = new Period(mStart, other.mStart);
- result[1] = new Period(other.mEnd, mEnd);
- return result;
- }
-
- // If the subtracted period overlaps this period in full, return an
- // empty array of periods
- if (!other.startsAfterStartOf(this) && !other.endsBeforeEndOf(this)) {
- Period result[] = new Period[0];
- return result;
- }
-
- // If the other period overlaps at the beginning, return a new period
- // that starts at the end of the subtracted period
- if (!other.startsAfterStartOf(this)) {
- Period result[] = new Period[1];
- result[0] = new Period(other.mEnd, mEnd);
- return result;
- }
-
- // The other period overlaps at the end, so return a new period that
- // ends at the start of the subtracted period
- Period result[] = new Period[1];
- result[0] = new Period(mStart, other.mStart);
- return result;
- }
-
- public void subtractAfter(DateTime time) {
- if (mEnd.isAfter(time)) {
- if (mStart.isBefore(time)) {
- mEnd = time;
- } else {
- mEnd = mStart;
- }
- }
- }
-
- public void subtractBefore(DateTime time) {
- if (mStart.isBefore(time)) {
- if (mEnd.isAfter(time)) {
- mStart = time;
- } else {
- mStart = mEnd;
- }
- }
- }
-
- public static Period now(DateTimeZone zone) {
- DateTime now = new DateTime(zone);
- return new Period(now, now);
- }
-
- public boolean overlaps(Period other) {
- if (mStart.isAfter(other.mEnd) || other.mStart.isAfter(mEnd)) {
- return false;
- }
- return true;
- }
-
- public boolean startsAfterEndOf(Period other) {
- // mStart >= other.mEnd
- return !other.mEnd.isAfter(mStart);
- }
-
- public boolean startsAfterStartOf(Period other) {
- // mStart > other.mStart
- return mStart.isAfter(other.mStart);
- }
-
- public boolean startsBeforeEndOf(Period other) {
- // mStart <= other.mEnd
- return !other.mEnd.isBefore(mStart);
- }
-
- public boolean startsBeforeStartOf(Period other) {
- // mStart < other.mStart
- return mStart.isBefore(other.mStart);
- }
-
- public boolean endsAfterEndOf(Period other) {
- // mEnd > other.mEnd
- return mEnd.isAfter(other.mEnd);
- }
-
- public boolean endsAfterStartOf(Period other) {
- // mEnd > other.mStart
- return mEnd.isAfter(other.mStart);
- }
-
- public boolean endsBeforeEndOf(Period other) {
- // mEnd < other.mEnd
- return mEnd.isBefore(other.mEnd);
- }
-
- public boolean endsBeforeStartOf(Period other) {
- // mEnd <= other.mStart
- return !other.mStart.isBefore(mEnd);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Periods.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Periods.java
deleted file mode 100644
index bde4251..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Periods.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.joda.time.DateTime;
-
-public class Periods {
- // List of incrementally sorted non-overlapping periods
- private final ArrayList mPeriods = new ArrayList();
-
- public Periods() {
- }
-
- List getPeriods() {
- return mPeriods;
- }
-
- public void merge(Period period) {
- if (mPeriods.size() > 0) {
- int firstOverlap = -1;
- int lastOverlap = -1;
- int firstStartAfter = mPeriods.size();
-
- for (int index = 0; index < mPeriods.size(); index++) {
- Period p = mPeriods.get(index);
- if (index < firstStartAfter && p.startsAfterEndOf(period)) {
- firstStartAfter = index;
- break;
- }
- if (p.overlaps(period)) {
- if (firstOverlap < 0) {
- firstOverlap = index;
- }
- lastOverlap = index;
- } else {
- if (firstOverlap >= 0) {
- // We don't need to traverse the rest of the list
- break;
- }
- }
- }
-
- // Check to see if we found periods overlapping the new period
- if (firstOverlap >= 0) {
- // New period overlaps from firstOverlap to lastOverlap, so
- // we replace those periods here with one new period that
- // merges them all
- Period newPeriod = mPeriods.get(firstOverlap);
- newPeriod.merge(mPeriods.get(lastOverlap));
- newPeriod.merge(period);
- // Set the new period at index "firstOverlap"
- mPeriods.set(firstOverlap, newPeriod);
- // Remove all following periods up to lastOverlap
- for (int index = firstOverlap + 1; index <= lastOverlap; index++) {
- mPeriods.remove(firstOverlap + 1);
- }
- } else {
- // New period does not overlap, so insert as new period before
- // the first period that starts after it
- mPeriods.add(firstStartAfter, period.clone());
- }
- } else {
- // Add first period
- mPeriods.add(period);
- }
-
- // Merge adjacent periods into one
- int index = 0;
- while (index < mPeriods.size() - 1) {
- if (mPeriods.get(index).getEnd() == mPeriods.get(index + 1).getStart()) {
- mPeriods.get(index).merge(mPeriods.get(index + 1));
- mPeriods.remove(index + 1);
- } else {
- index++;
- }
- }
- }
-
- public void subtract(Period period) {
- int index = 0;
- boolean processedOverlap = false;
- while (index < mPeriods.size()) {
- Period p = mPeriods.get(index);
- if (p.overlaps(period)) {
- Period newPeriods[] = p.subtract(period);
- if (newPeriods.length == 0) {
- mPeriods.remove(index);
- index--;
- }
- if (newPeriods.length == 1) {
- mPeriods.set(index, newPeriods[0]);
- }
- if (newPeriods.length == 2) {
- mPeriods.set(index, newPeriods[0]);
- mPeriods.add(index + 1, newPeriods[1]);
- index++;
- }
- processedOverlap = true;
- } else {
- if (processedOverlap) {
- return;
- }
- }
- index++;
- }
- }
-
- public void subtractBefore(DateTime time) {
- for (Period p : mPeriods) {
- p.subtractBefore(time);
- }
- }
-
- public void subtractAfter(DateTime time) {
- for (Period p : mPeriods) {
- p.subtractAfter(time);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Processor.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Processor.java
deleted file mode 100644
index 75f18bd..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Processor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.List;
-import java.util.Map;
-
-import android.content.ContentValues;
-
-public class Processor {
- private ClonerLog mLog;
- private LogLines mLogLines = null;
- private String mLogPrefix;
- private String mOriginalLogPrefix;
-
- public class InitResult {
- private final boolean mSuccess;
- private final String mErrorMessage;
- private final int mUpdateCount;
-
- public InitResult(boolean success, String errorMessage, int updateCount) {
- mSuccess = success;
- mErrorMessage = errorMessage;
- mUpdateCount = updateCount;
- }
-
- public boolean isSuccess() {
- return mSuccess;
- }
-
- public String getErrorMessage() {
- return mErrorMessage;
- }
-
- public int getUpdateCount() {
- return mUpdateCount;
- }
- }
-
- public InitResult init(ClonerLog log) {
- return new InitResult(true, "", 0);
- }
-
- protected void initLogLines(ClonerLog log, String logPrefix) {
- mLog = log;
- this.startNewLogLines(logPrefix);
- mOriginalLogPrefix = logPrefix;
- }
-
- protected void startNewLogLines(String logPrefix) {
- mLogLines = mLog.createLogLines();
- mLogPrefix = logPrefix;
- }
-
- protected void useLogLines(LogLines logLines) {
- mLog = null;
- mLogLines = logLines;
- mLogPrefix = null;
- mOriginalLogPrefix = null;
- }
-
- protected LogLines getLogLines() {
- return mLogLines;
- }
-
- protected String getOriginalLogPrefix() {
- return mOriginalLogPrefix;
- }
-
- protected void log(int level, String message) {
- if (mLogLines != null) {
- mLogLines.log(level, null, message);
- }
- }
-
- protected void log(int level, String message, String value) {
- if (mLogLines != null) {
- mLogLines.log(level, null, message, value);
- }
- }
-
- protected void logEvent(Event event) {
- if (mLogLines != null) {
- mLogLines.logEvent(event);
- }
- }
-
- protected void logEvent(Event event, ContentValues delta) {
- if (mLogLines != null) {
- mLogLines.logEvent(event, delta);
- }
- }
-
- protected void logEvents(Event event, Event clone, ContentValues delta) {
- if (mLogLines != null) {
- mLogLines.logEvents(event, clone, delta);
- }
- }
-
- protected void logAttendees(List eventAttendees, List cloneAttendees,
- DbCalendar srcCalendar, DbCalendar dstCalendar, AttendeeDeltas deltas, String dummyEmailDomain) {
- if (mLogLines != null) {
- mLogLines.logAttendees(eventAttendees, cloneAttendees, srcCalendar, dstCalendar, deltas, dummyEmailDomain);
- }
- }
-
- protected void logReminders(int level, List eventReminders, List cloneReminders,
- Map mappedReminders) {
- if (mLogLines != null) {
- mLogLines.logReminders(level, eventReminders, cloneReminders, mappedReminders);
- }
- }
-
- protected void logSummary(int level, String message, Event event) {
- this.logSummary(level, message, event, null);
- }
-
- protected void logSummary(int level, String message, Event event, String additionalInfo) {
- String title = Utilities.dateTimeToString(event.getStartTime()) + " - " + event.getTitle();
- if (mLog != null && mLog.getLogType() == ClonerLog.TYPE_EXTENDED && additionalInfo != null && mLogLines != null) {
- mLogLines.log(ClonerLog.LOG_INFO, "", additionalInfo);
- }
- this.logSummary(level, message, title);
- }
-
- protected void logSummary(int level, String message, String title) {
- if (mLogLines != null && level < mLogLines.getMaxLevel()) {
- level = mLogLines.getMaxLevel();
- }
- mLog.log(mLog.createLogLine(level, mLogPrefix, message, title), mLogLines);
- mLogLines = null;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyAttendee.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyAttendee.java
deleted file mode 100644
index 6002533..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyAttendee.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class ProxyAttendee implements Attendee {
- private Attendee mSource;
-
- public ProxyAttendee(Attendee source) {
- mSource = source;
- }
-
- public String toString() {
- String result = this.getClass().getCanonicalName() + ":\n";
- result += "Name: " + this.getName() + "\n";
- result += "Email: " + this.getEmail() + "\n";
- result += "Status: " + this.getStatus() + "\n";
- return result;
- }
-
- @Override
- public long getId() {
- return mSource.getId();
- }
-
- @Override
- public String getName() {
- return mSource.getName();
- }
-
- @Override
- public String getEmail() {
- return mSource.getEmail();
- }
-
- @Override
- public int getRelationship() {
- return mSource.getRelationship();
- }
-
- @Override
- public int getType() {
- return mSource.getType();
- }
-
- @Override
- public int getStatus() {
- return mSource.getStatus();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyEvent.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyEvent.java
deleted file mode 100644
index c1eb815..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ProxyEvent.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-
-public class ProxyEvent implements Event {
- private final Event mSource;
-
- public ProxyEvent(Event source) {
- mSource = source;
- }
-
- public Event getSource() {
- return mSource;
- }
-
- @Override
- public String toString() {
- String result = this.getClass().getCanonicalName() + ":\n";
- result += "Title: " + this.getTitle() + "\n";
- result += "Location: " + this.getLocation() + "\n";
- result += "Status: " + this.getStatus() + "\n";
- return result;
- }
-
- @Override
- public long getId() {
- return mSource.getId();
- }
-
- @Override
- public long getCalendarId() {
- return mSource.getCalendarId();
- }
-
- @Override
- public boolean isDeleted() {
- return mSource.isDeleted();
- }
-
- @Override
- public boolean isDirty() {
- return mSource.isDirty();
- }
-
- @Override
- public String getOrganizer() {
- return mSource.getOrganizer();
- }
-
- @Override
- public String getTitle() {
- return mSource.getTitle();
- }
-
- @Override
- public String getLocation() {
- return mSource.getLocation();
- }
-
- @Override
- public String getDescription() {
- return mSource.getDescription();
- }
-
- @Override
- public DateTime getStartTime() {
- return mSource.getStartTime();
- }
-
- @Override
- public DateTime getEndTime() {
- return mSource.getEndTime();
- }
-
- @Override
- public String getDuration() {
- return mSource.getDuration();
- }
-
- @Override
- public boolean isAllDay() {
- return mSource.isAllDay();
- }
-
- @Override
- public DateTimeZone getStartTimeZone(boolean allowNull) {
- return mSource.getStartTimeZone(allowNull);
- }
-
- @Override
- public DateTimeZone getEndTimeZone() {
- return mSource.getEndTimeZone();
- }
-
- @Override
- public String getRecurrenceRule() {
- return mSource.getRecurrenceRule();
- }
-
- @Override
- public String getRecurrenceDate() {
- return mSource.getRecurrenceDate();
- }
-
- @Override
- public String getRecurrenceExRule() {
- return mSource.getRecurrenceExRule();
- }
-
- @Override
- public String getRecurrenceExDate() {
- return mSource.getRecurrenceExDate();
- }
-
- @Override
- public DateTime getLastDate() {
- return mSource.getLastDate();
- }
-
- @Override
- public long getOriginalID() {
- return mSource.getOriginalID();
- }
-
- @Override
- public boolean isOriginalAllDay() {
- return mSource.isOriginalAllDay();
- }
-
- @Override
- public DateTime getOriginalInstanceTime() {
- return mSource.getOriginalInstanceTime();
- }
-
- @Override
- public int getAccessLevel() {
- return mSource.getAccessLevel();
- }
-
- @Override
- public int getAvailability() {
- return mSource.getAvailability();
- }
-
- @Override
- public int getAvailabilitySamsung() {
- return mSource.getAvailabilitySamsung();
- }
-
- @Override
- public boolean hasAvailabilitySamsung() {
- return mSource.hasAvailabilitySamsung();
- }
-
- @Override
- public int getStatus() {
- return mSource.getStatus();
- }
-
- @Override
- public boolean hasStatus() {
- return mSource.hasStatus();
- }
-
- @Override
- public int getSelfAttendeeStatus() {
- return mSource.getSelfAttendeeStatus();
- }
-
- @Override
- public String getUniqueId() {
- return mSource.getUniqueId();
- }
-
- @Override
- public boolean isRecurringEvent() {
- return mSource.isRecurringEvent();
- }
-
- @Override
- public boolean isRecurringEventException() {
- return mSource.isRecurringEventException();
- }
-
- @Override
- public boolean isSingleEvent() {
- return mSource.isSingleEvent();
- }
-
- @Override
- public Period getPeriod() {
- return mSource.getPeriod();
- }
-
- @Override
- public DateTimeZone getCalendarTimeZone() {
- return mSource.getCalendarTimeZone();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RecurrenceRule.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RecurrenceRule.java
deleted file mode 100644
index 8e900f9..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RecurrenceRule.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-public class RecurrenceRule {
- public static Map parseRule(String rule) {
- if (rule == null || rule.contentEquals("")) {
- return null;
- }
- HashMap result = new HashMap();
- String[] parts = rule.split(";");
- for (int index = 0; index < parts.length; index++) {
- int pos = parts[index].indexOf("=");
- if (pos > 0) {
- String key = parts[index].substring(0, pos);
- String value = parts[index].substring(pos + 1, parts[index].length());
- result.put(key, value);
- }
- }
- return result;
- }
-
- public static boolean compareRules(String rule1, String rule2) {
- // Parse the rules
- Map map1 = RecurrenceRule.parseRule(rule1);
- Map map2 = RecurrenceRule.parseRule(rule2);
- // Perform first quick checking
- if ((map1 == null && map2 == null)) {
- return true;
- }
- if (map1 == null || map2 == null) {
- return false;
- }
- // Determine which is the larger map
- Map biggest = (map1.size() > map2.size() ? map1 : map2);
- Map smallest = (map1.size() > map2.size() ? map2 : map1);
- // Compare elements from both maps
- for (Entry element : biggest.entrySet()) {
- String key = element.getKey();
- if (smallest.containsKey(key)) {
- String value = element.getValue();
- if (!value.contentEquals(smallest.get(key))) {
- return false;
- }
- } else {
- // Accept difference on WKST element
- if (!key.contentEquals("WKST")) {
- return false;
- }
- }
- }
- return true;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderCloner.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderCloner.java
deleted file mode 100644
index e0d0c9d..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderCloner.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import android.content.ContentValues;
-import android.provider.CalendarContract.Reminders;
-
-public class ReminderCloner extends Processor {
- int mMaxReminders;
- Rule mRule;
- RemindersTable mRemindersTable;
-
- public static class ReminderCloneContext {
- protected LogLines logLines = null;
- protected Map mappedReminders = new HashMap();
- protected Map reminderDeltas = new HashMap();
- }
-
- public ReminderCloner(Rule rule, RemindersTable table, int maxReminders) {
- mRule = rule;
- mRemindersTable = table;
- mMaxReminders = maxReminders;
- }
-
- private boolean compareReminders(DbReminder eventReminder, DbReminder cloneReminder) {
- // Return true if both reminders are similar
- return eventReminder.getMethod() == cloneReminder.getMethod()
- && eventReminder.getMinutes() == cloneReminder.getMinutes();
- }
-
- private void prepareSrcReminderList(List reminders) {
- // If we do not need to clone original reminders, clear the list
- if (!mRule.getCloneReminders()) {
- reminders.clear();
- }
- // If the rule specifies a custom reminder, add it here
- if (mRule.getCustomReminder()) {
- DbReminder reminder = new DbReminder(mRemindersTable, mRule.getCustomReminderMethod(),
- mRule.getCustomReminderMinutes());
- reminders.add(reminder);
- }
- // Remove duplicate reminders (get filtered out in sync most of the
- // times anyway)
- for (int i = 0; i < reminders.size() - 1; i++) {
- int j = i + 1;
- while (j < reminders.size()) {
- if (compareReminders(reminders.get(i), reminders.get(j))) {
- reminders.remove(j);
- } else {
- j++;
- }
- }
- }
- // Trim the list of reminders down to the maximum number
- while (reminders.size() > mMaxReminders) {
- reminders.remove(reminders.size() - 1);
- }
- }
-
- private void cloneReminderFields(DbReminder reminder, ContentValues delta) {
- delta.put(Reminders.METHOD, reminder.getMethod());
- delta.put(Reminders.MINUTES, reminder.getMinutes());
- }
-
- public boolean process(Event event, long cloneId, ReminderCloneContext reminderCloneContext) {
- this.useLogLines(reminderCloneContext.logLines);
- boolean updated = false;
-
- // Load the event's and clone's reminders
- List eventReminders = DbReminder.getReminders(mRemindersTable, event.getId());
- List cloneReminders = DbReminder.getReminders(mRemindersTable, cloneId);
- // Calculate the cloned list of reminders
- this.prepareSrcReminderList(eventReminders);
-
- // Try to find exact matches between event reminders and clone reminders
- List unclonedReminders = new LinkedList();
- for (DbReminder eventReminder : eventReminders) {
- // Find an exact match in the list of cloned reminders
- boolean matchFound = false;
- for (DbReminder cloneReminder : cloneReminders) {
- if (compareReminders(eventReminder, cloneReminder)) {
- matchFound = true;
- cloneReminders.remove(cloneReminder);
- // Register mapping from event reminder to clone reminder
- reminderCloneContext.mappedReminders.put(eventReminder.getId(), cloneReminder.getId());
- break;
- }
- }
- // Move the reminder to a list of reminders to (re)clone
- if (!matchFound) {
- unclonedReminders.add(eventReminder);
- }
- }
-
- // Clone all remaining reminders
- for (DbReminder unclonedReminder : unclonedReminders) {
- long cloneReminderId = 0;
- // If we have reminder entries left on the clonedReminder list,
- // reuse those to clone this reminder
- if (cloneReminders.size() > 0) {
- DbReminder cloneReminder = cloneReminders.get(0);
- cloneReminderId = cloneReminder.getId();
- cloneReminders.remove(cloneReminder);
- }
-
- ContentValues delta = new ContentValues();
- this.cloneReminderFields(unclonedReminder, delta);
- if (cloneReminderId > 0) {
- mRemindersTable.update(cloneReminderId, delta);
- } else {
- delta.put(Reminders.EVENT_ID, cloneId);
- cloneReminderId = mRemindersTable.insert(delta);
- }
- // Register mapping from event reminder to clone reminder
- reminderCloneContext.mappedReminders.put(unclonedReminder.getId(), cloneReminderId);
- // Register clone reminder delta
- reminderCloneContext.reminderDeltas.put(cloneReminderId, delta);
- updated = true;
- }
-
- // Remove all remaining reminders from the cloned event
- for (DbReminder cloneReminder : cloneReminders) {
- this.log(ClonerLog.LOG_UPDATE, ClonerApp.translate(R.string.cloner_log_reminder_deleted));
- mRemindersTable.delete(cloneReminder.getId());
- updated = true;
- }
-
- return updated;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderMethods.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderMethods.java
deleted file mode 100644
index d8453d8..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/ReminderMethods.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Reminders;
-
-public class ReminderMethods extends SelectList {
- public static final int REMINDER_METHOD_ALERT = Reminders.METHOD_ALERT;
- public static final int REMINDER_METHOD_DEFAULT = Reminders.METHOD_DEFAULT;
- public static final int REMINDER_METHOD_EMAIL = Reminders.METHOD_EMAIL;
- public static final int REMINDER_METHOD_SMS = Reminders.METHOD_SMS;
-
- public static final int[] mKeys = new int[] { REMINDER_METHOD_ALERT, REMINDER_METHOD_DEFAULT,
- REMINDER_METHOD_EMAIL, REMINDER_METHOD_SMS };
-
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.reminder_method_alert),
- ClonerApp.translate(R.string.reminder_method_default), ClonerApp.translate(R.string.reminder_method_email),
- ClonerApp.translate(R.string.reminder_method_sms) };
-
- public ReminderMethods(boolean allSelected) {
- super(allSelected);
- }
-
- public ReminderMethods clone() {
- ReminderMethods other = new ReminderMethods(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RemindersTable.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RemindersTable.java
deleted file mode 100644
index 4c22c8d..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RemindersTable.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.provider.CalendarContract.Reminders;
-
-public class RemindersTable extends ClonerTable {
- // CalendarContract columns
- public Column _ID = new Column(Reminders._ID);
- public Column EVENT_ID = new Column(Reminders.EVENT_ID);
- public Column METHOD = new Column(Reminders.METHOD);
- public Column MINUTES = new Column(Reminders.MINUTES);
-
- public RemindersTable(ClonerDb db) {
- super(db, Reminders.CONTENT_URI);
- // Add CalendarContract columns
- this.addColumn(_ID);
- this.addColumn(EVENT_ID);
- this.addColumn(METHOD);
- this.addColumn(MINUTES);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Rule.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Rule.java
deleted file mode 100644
index 81c0692..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Rule.java
+++ /dev/null
@@ -1,827 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.provider.CalendarContract.Reminders;
-
-public class Rule {
- public final static int CURRENT_RULE_VERSION = 2;
-
- public final static int METHOD_CLONE = 0;
- public final static int METHOD_LEGACY_FORWARD = 1;
- public final static int METHOD_MOVE = 2;
- public final static int METHOD_AGGREGATE = 3;
-
- public final static int EVENT_TYPE_ALL = 0;
- public final static int EVENT_TYPE_SIMPLE = 1;
- public final static int EVENT_TYPE_RECURRING = 2;
-
- public final static int DETAIL_ALLDETAILS = 0;
- public final static int DETAIL_TITLELOCATION = 1;
- public final static int DETAIL_FREEBUSY = 2;
-
- public final static int CUSTOM_ACCESS_LEVEL_SOURCE = 0;
- public final static int CUSTOM_ACCESS_LEVEL_DEFAULT = 1;
- public final static int CUSTOM_ACCESS_LEVEL_PRIVATE = 2;
- public final static int CUSTOM_ACCESS_LEVEL_CONFIDENTIAL = 3;
- public final static int CUSTOM_ACCESS_LEVEL_PUBLIC = 4;
-
- public final static int CUSTOM_AVAILABILITY_SOURCE = 0;
- public final static int CUSTOM_AVAILABILITY_FREE = 1;
- public final static int CUSTOM_AVAILABILITY_BUSY = 2;
- public final static int CUSTOM_AVAILABILITY_OUT_OF_OFFICE = 3;
-
- public final static int HASH_METHOD_SOURCE_CALENDAR = 0;
- public final static int HASH_METHOD_RULE_ID = 1;
- public final static int HASH_METHOD_MANUAL = 2;
-
- private final static long ONE_DAY = 24L * 3600 * 1000;
- private final static long MAX_AGGREGATE_RULE_PERIOD = 365 * ONE_DAY;
- public final static long SYNC_PERIODS[] = { ONE_DAY, 3 * ONE_DAY, 7 * ONE_DAY, 14 * ONE_DAY, 30 * ONE_DAY,
- 90 * ONE_DAY, MAX_AGGREGATE_RULE_PERIOD, 2 * 365 * ONE_DAY, 5 * 365 * ONE_DAY, Utilities.INFINITY_MILLIS };
-
- // Dummy domains
- public final static String DEFAULT_DUMMY_DOMAIN = "cc.dizzl.com";
- public final static String BLACKHOLE_DOMAIN = "blackhole.io";
-
- // Rule identifier
- private String mId = "";
- private String mHash = "";
-
- // Basic rule settings
- private boolean mEnabled = false;
- private String mName = "";
- private int mMethod = ClonerVersion.setRuleMethod(METHOD_CLONE);
- private String mSrcCalendarRef = "";
- private String mDstCalendarRef = "";
- private String mSrcCalendarHash = "";
- private boolean mReadOnly = false;
-
- // Rule event selection
- private long mSyncPeriodBefore = Utilities.INFINITY_MILLIS;
- private long mSyncPeriodAfter = Utilities.INFINITY_MILLIS;
- private boolean mIncludeClones = ClonerVersion.setIncludeClones(false);
- private boolean mUseEventFilters = ClonerVersion.setUseEventFilters(false);
- private int mEventTypeFilter = EVENT_TYPE_ALL;
- private String mTitleMustContain = "";
- private String mTitleMustNotContain = "";
- private String mLocationMustContain = "";
- private String mLocationMustNotContain = "";
- private String mDescriptionMustContain = "";
- private String mDescriptionMustNotContain = "";
- private AccessLevels mAccessLevels = new AccessLevels(true);
- private AttendeeStatuses mAttendeeStatuses = new AttendeeStatuses(true);
- private Availabilities mAvailabilities = new Availabilities(true);
- private EventStatuses mEventStatuses = new EventStatuses(true);
- private Weekdays mWeekdays = new Weekdays(true);
-
- // Detail options
- private boolean mCloneTitle = true;
- private String mCustomTitle = "";
- private boolean mCloneLocation = true;
- private String mCustomLocation = "";
- private boolean mCloneDescription = true;
- private String mCustomDescription = "";
- private boolean mCloneSelfAttendeeStatus = false;
- private boolean mCloneSelfAttendeeStatusReverse = false;
- private String mSelfAttendeeName = "";
- private int mReserveBefore = 0;
- private int mReserveAfter = 0;
- private int mCustomAccessLevel = CUSTOM_ACCESS_LEVEL_SOURCE;
- private int mCustomAvailability = CUSTOM_AVAILABILITY_SOURCE;
-
- // Guest list options
- private boolean mCloneAttendees = ClonerVersion.setCloneAttendees(false);
- private boolean mUseDummyEmailAddresses = true;
- private String mDummyEmailDomain = DEFAULT_DUMMY_DOMAIN;
- private boolean mAttendeesAsText = false;
- private boolean mCustomAttendee = ClonerVersion.setCustomAttendee(false);
- private String mCustomAttendeeName = "";
- private String mCustomAttendeeEmail = "";
-
- // Reminder options
- private boolean mCloneReminders = ClonerVersion.setCloneReminders(false);
- private boolean mCustomReminder = ClonerVersion.setCustomReminder(false);
- private int mCustomReminderMethod = Reminders.METHOD_DEFAULT;
- private int mCustomReminderMinutes = Reminders.MINUTES_DEFAULT;
-
- // Additional rule options
- private boolean mRetainClonesOutsideSourceEventWindow = false;
-
- // Advanced parameters
- private int mHashMethod = HASH_METHOD_SOURCE_CALENDAR;
-
- private final static int LOCK_SECRET = 1955824592;
- private int mLocked = 0;
- private boolean mExecuting = false;
- private boolean mExecuted = false;
- private int mStatus = RuleExecutor.Result.STATUS_SUCCESS;
- private boolean mIsDirty = false;
- private ClonerLog mLog = null;
- private String mSummary = "";
-
- public Rule() {
- this.setId("");
- }
-
- public Rule(CalendarsTable table, String id, boolean enabled, String name, int method, String srcCalendarRef,
- String dstCalendarRef, String srcCalendarHash, boolean readOnly, long syncPeriodBefore,
- long syncPeriodAfter, boolean includeClones, boolean useEventFilters, int eventTypeFilter,
- String titleMustContain, String titleMustNotContain, String locationMustContain,
- String locationMustNotContain, String descriptionMustContain, String descriptionMustNotContain,
- AccessLevels accessLevels, AttendeeStatuses attendeeStatuses, Availabilities availabilities,
- EventStatuses eventStatuses, Weekdays weekdays, boolean cloneTitle, String customTitle,
- boolean cloneLocation, String customLocation, boolean cloneDescription, String customDescription,
- boolean cloneSelfAttendeeStatus, boolean cloneSelfAttendeeStatusReverse, String selfAttendeeName,
- int reserveBefore, int reserveAfter, int accessLevelOverride, int availabilityOverride,
- boolean cloneAttendees, boolean useDummyEmailAddresses, String dummyEmailDomain, boolean attendeesAsText,
- boolean customAttendee, String customAttendeeName, String customAttendeeEmail, boolean cloneReminders,
- boolean customReminder, int customReminderMethod, int customReminderMinutes,
- boolean retainClonesOutsideSourceEventWindow, int hashMethod, String hash) {
- // Basic rule settings
- this.setId(id);
- this.setEnabled(enabled);
- this.setName(name);
- this.setMethod(method);
- this.setSrcCalendarRef(srcCalendarRef);
- this.setDstCalendarRef(dstCalendarRef);
- mSrcCalendarHash = srcCalendarHash;
- this.setReadOnly(readOnly);
-
- // Event filters
- this.setSyncPeriodBefore(syncPeriodBefore);
- this.setSyncPeriodAfter(syncPeriodAfter);
- this.setIncludeClones(includeClones);
- this.setUseEventFilters(useEventFilters);
- this.setEventTypeFilter(eventTypeFilter);
- this.setTitleMustContain(titleMustContain);
- this.setTitleMustNotContain(titleMustNotContain);
- this.setLocationMustContain(locationMustContain);
- this.setLocationMustNotContain(locationMustNotContain);
- this.setDescriptionMustContain(descriptionMustContain);
- this.setDescriptionMustNotContain(descriptionMustNotContain);
- this.setAccessLevels(accessLevels);
- this.setAttendeeStatuses(attendeeStatuses);
- this.setAvailabilities(availabilities);
- this.setEventStatuses(eventStatuses);
- this.setWeekdays(weekdays);
-
- // Detail settings
- this.setCloneTitle(cloneTitle);
- this.setCustomTitle(customTitle);
- this.setCloneLocation(cloneLocation);
- this.setCustomLocation(customLocation);
- this.setCloneDescription(cloneDescription);
- this.setCustomDescription(customDescription);
- this.setCloneSelfAttendeeStatus(cloneSelfAttendeeStatus);
- this.setCloneSelfAttendeeStatusReverse(cloneSelfAttendeeStatusReverse);
- this.setSelfAttendeeName(selfAttendeeName);
- this.setReserveBefore(reserveBefore);
- this.setReserveAfter(reserveAfter);
- this.setCustomAccessLevel(accessLevelOverride);
- this.setCustomAvailability(availabilityOverride);
-
- // Attendees
- this.setCloneAttendees(cloneAttendees);
- this.setUseDummyEmailAddresses(useDummyEmailAddresses);
- this.setDummyEmailDomain(dummyEmailDomain);
- this.setAttendeesAsText(attendeesAsText);
- this.setCustomAttendee(customAttendee);
- this.setCustomAttendeeName(customAttendeeName);
- this.setCustomAttendeeEmail(customAttendeeEmail);
-
- // Reminders
- this.setCloneReminders(cloneReminders);
- this.setCustomReminder(customReminder);
- this.setCustomReminderMethod(customReminderMethod);
- this.setCustomReminderMinutes(customReminderMinutes);
-
- // Additional parameters
- this.setRetainClonesOutsideSourceEventWindow(retainClonesOutsideSourceEventWindow);
-
- // Advanced settings
- this.setHash(hashMethod, hash);
- }
-
- public String getId() {
- return mId;
- }
-
- public String getHash() {
- return mHash;
- }
-
- public int getVersion() {
- return CURRENT_RULE_VERSION;
- }
-
- public boolean isEnabled() {
- return mEnabled;
- }
-
- public String getName() {
- return mName;
- }
-
- public int getMethod() {
- return mMethod;
- }
-
- public String getDstCalendarRef() {
- return mDstCalendarRef;
- }
-
- public String getSrcCalendarRef() {
- return mSrcCalendarRef;
- }
-
- public String getSrcCalendarHash() {
- return mSrcCalendarHash;
- }
-
- public boolean isReadOnly() {
- return mReadOnly;
- }
-
- public boolean getIncludeClones() {
- return mIncludeClones;
- }
-
- public boolean useEventFilters() {
- return mUseEventFilters;
- }
-
- public int getEventTypeFilter() {
- return mEventTypeFilter;
- }
-
- public String getTitleMustContain() {
- return mTitleMustContain;
- }
-
- public String getTitleMustNotContain() {
- return mTitleMustNotContain;
- }
-
- public String getLocationMustContain() {
- return mLocationMustContain;
- }
-
- public String getLocationMustNotContain() {
- return mLocationMustNotContain;
- }
-
- public String getDescriptionMustContain() {
- return mDescriptionMustContain;
- }
-
- public String getDescriptionMustNotContain() {
- return mDescriptionMustNotContain;
- }
-
- public AccessLevels getAccessLevels() {
- return mAccessLevels;
- }
-
- public AttendeeStatuses getAttendeeStatuses() {
- return mAttendeeStatuses;
- }
-
- public Availabilities getAvailabilities() {
- return mAvailabilities;
- }
-
- public EventStatuses getEventStatuses() {
- return mEventStatuses;
- }
-
- public Weekdays getWeekdays() {
- return mWeekdays;
- }
-
- public boolean getCloneTitle() {
- return mCloneTitle;
- }
-
- public String getCustomTitle() {
- return mCustomTitle;
- }
-
- public boolean getCloneLocation() {
- return mCloneLocation;
- }
-
- public String getCustomLocation() {
- return mCustomLocation;
- }
-
- public boolean getCloneDescription() {
- return mCloneDescription;
- }
-
- public String getCustomDescription() {
- return mCustomDescription;
- }
-
- public boolean getCloneSelfAttendeeStatus() {
- return mCloneSelfAttendeeStatus;
- }
-
- public boolean getCloneSelfAttendeeStatusReverse() {
- return mCloneSelfAttendeeStatusReverse;
- }
-
- public String getSelfAttendeeName() {
- return mSelfAttendeeName;
- }
-
- public long getSyncPeriodBefore() {
- return mSyncPeriodBefore;
- }
-
- public long getSyncPeriodAfter() {
- return mSyncPeriodAfter;
- }
-
- public int getReserveBefore() {
- return mReserveBefore;
- }
-
- public int getReserveAfter() {
- return mReserveAfter;
- }
-
- public int getCustomAccessLevel() {
- return mCustomAccessLevel;
- }
-
- public int getCustomAvailability() {
- return mCustomAvailability;
- }
-
- public boolean getCloneAttendees() {
- return mCloneAttendees;
- }
-
- public boolean getUseDummyEmailAddresses() {
- return mUseDummyEmailAddresses;
- }
-
- public String getDummyEmailDomain() {
- return mDummyEmailDomain;
- }
-
- public boolean getAttendeesAsText() {
- return mAttendeesAsText;
- }
-
- public boolean getCustomAttendee() {
- return mCustomAttendee;
- }
-
- public String getCustomAttendeeName() {
- return mCustomAttendeeName;
- }
-
- public String getCustomAttendeeEmail() {
- return mCustomAttendeeEmail;
- }
-
- public boolean getCloneReminders() {
- return mCloneReminders;
- }
-
- public boolean getCustomReminder() {
- return mCustomReminder;
- }
-
- public int getCustomReminderMethod() {
- return mCustomReminderMethod;
- }
-
- public int getCustomReminderMinutes() {
- return mCustomReminderMinutes;
- }
-
- public boolean getRetainClonesOutsideSourceEventWindow() {
- return mRetainClonesOutsideSourceEventWindow;
- }
-
- public int getHashMethod() {
- return mHashMethod;
- }
-
- public synchronized int tryLock() {
- if (mLocked == 0) {
- mLocked = LOCK_SECRET;
- return mLocked;
- }
- return 0;
- }
-
- public synchronized boolean tryRelease(int secret) {
- if (secret == LOCK_SECRET) {
- mLocked = 0;
- return true;
- }
- return false;
- }
-
- public boolean isExecuting() {
- return mExecuting;
- }
-
- public boolean hasExecuted() {
- return mExecuted;
- }
-
- public int getStatus() {
- return mStatus;
- }
-
- public boolean isDirty() {
- return mIsDirty;
- }
-
- public ClonerLog getLog() {
- return mLog;
- }
-
- public String getSummary() {
- return mSummary;
- }
-
- public void setLog(ClonerLog log) {
- mLog = log;
- }
-
- public void startExecution(String summary) {
- mExecuting = true;
- mSummary = summary;
- }
-
- public void finishExecution(int status, String summary) {
- mExecuting = false;
- mExecuted = true;
- mStatus = status;
- mSummary = summary;
- mIsDirty = false;
- }
-
- public void markDirty() {
- mIsDirty = true;
- }
-
- private void validateConsistency() {
- // This method is called after each setter
-
- // Correct impossible values for Samsung devices
- if (mCustomAvailability == Rule.CUSTOM_AVAILABILITY_OUT_OF_OFFICE) {
- // Check if the destination calendar supports OUT_OF_OFFICE
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mDstCalendarRef);
- if (info.getCalendar() != null
- && !Device.Samsung.supportsAvailabilitySamsung(info.getCalendar().getAccountType())) {
- mCustomAvailability = Rule.CUSTOM_AVAILABILITY_SOURCE;
- }
- }
-
- // Correct impossible values for AGGREGATE rules
- if (mMethod == METHOD_AGGREGATE) {
- // Selection options
- if (mSyncPeriodBefore > MAX_AGGREGATE_RULE_PERIOD) {
- mSyncPeriodBefore = MAX_AGGREGATE_RULE_PERIOD;
- }
- if (mSyncPeriodAfter > MAX_AGGREGATE_RULE_PERIOD) {
- mSyncPeriodAfter = MAX_AGGREGATE_RULE_PERIOD;
- }
- // Override options
- mCloneTitle = false;
- mCloneLocation = false;
- mCloneDescription = false;
- mCloneSelfAttendeeStatus = false;
- if (mCustomAccessLevel == Rule.CUSTOM_ACCESS_LEVEL_SOURCE) {
- mCustomAccessLevel = Rule.CUSTOM_ACCESS_LEVEL_DEFAULT;
- }
- if (mCustomAvailability == Rule.CUSTOM_AVAILABILITY_SOURCE) {
- mCustomAvailability = Rule.CUSTOM_AVAILABILITY_BUSY;
- }
- // Guest list options
- mCloneAttendees = false;
- mAttendeesAsText = false;
- // Reminder options
- mCloneReminders = false;
- }
- }
-
- private void setId(String id) {
- if (id.contentEquals("")) {
- id = UUID.randomUUID().toString();
- }
- mId = id;
- this.setHash(mHashMethod, mHash);
- this.validateConsistency();
- }
-
- public void setEnabled(boolean enabled) {
- mEnabled = enabled;
- this.validateConsistency();
- }
-
- public void setName(String name) {
- mName = name;
- this.validateConsistency();
- }
-
- public void setMethod(int method) {
- mMethod = ClonerVersion.setRuleMethod(method);
- this.validateConsistency();
- }
-
- public void clearSrcCalendarRef() {
- mSrcCalendarRef = "";
- this.validateConsistency();
- }
-
- public void clearDstCalendarRef() {
- mDstCalendarRef = "";
- this.validateConsistency();
- }
-
- public void setDstCalendarRef(String ref) {
- mDstCalendarRef = ref;
- this.validateConsistency();
- }
-
- public void setSrcCalendarRef(String ref) {
- if (!mSrcCalendarRef.contentEquals(ref)) {
- // Update source calendar reference
- mSrcCalendarRef = ref;
- // Calculate new hash
- this.setHash(mHashMethod, mHash);
- // Reset source calendar hash
- this.clearSrcCalendarHash();
- this.validateConsistency();
- }
- }
-
- public void clearSrcCalendarHash() {
- mSrcCalendarHash = "";
- this.validateConsistency();
- }
-
- public void setReadOnly(boolean readOnly) {
- mReadOnly = readOnly;
- }
-
- public boolean setSyncPeriodBefore(long periodBefore) {
- mSyncPeriodBefore = Utilities.getSelectionFromArray(SYNC_PERIODS, periodBefore, SYNC_PERIODS[0]);
- this.validateConsistency();
- return mSyncPeriodBefore == periodBefore;
- }
-
- public boolean setSyncPeriodAfter(long periodAfter) {
- mSyncPeriodAfter = Utilities.getSelectionFromArray(SYNC_PERIODS, periodAfter, SYNC_PERIODS[0]);
- this.validateConsistency();
- return mSyncPeriodAfter == periodAfter;
- }
-
- public void setIncludeClones(boolean enabled) {
- mIncludeClones = ClonerVersion.setIncludeClones(enabled);
- this.validateConsistency();
- }
-
- public void setUseEventFilters(boolean enabled) {
- mUseEventFilters = ClonerVersion.setUseEventFilters(enabled);
- this.validateConsistency();
- }
-
- public void setEventTypeFilter(int eventTypeFilter) {
- mEventTypeFilter = eventTypeFilter;
- this.validateConsistency();
- }
-
- public void setTitleMustContain(String titleMustContain) {
- mTitleMustContain = titleMustContain;
- this.validateConsistency();
- }
-
- public void setTitleMustNotContain(String titleMustNotContain) {
- mTitleMustNotContain = titleMustNotContain;
- this.validateConsistency();
- }
-
- public void setLocationMustContain(String locationMustContain) {
- mLocationMustContain = locationMustContain;
- this.validateConsistency();
- }
-
- public void setLocationMustNotContain(String locationMustNotContain) {
- mLocationMustNotContain = locationMustNotContain;
- this.validateConsistency();
- }
-
- public void setDescriptionMustContain(String descriptionMustContain) {
- mDescriptionMustContain = descriptionMustContain;
- this.validateConsistency();
- }
-
- public void setDescriptionMustNotContain(String descriptionMustNotContain) {
- mDescriptionMustNotContain = descriptionMustNotContain;
- this.validateConsistency();
- }
-
- public void setAccessLevels(AccessLevels accessLevels) {
- mAccessLevels = accessLevels.clone();
- this.validateConsistency();
- }
-
- public void setAttendeeStatuses(AttendeeStatuses attendeeStatuses) {
- mAttendeeStatuses = attendeeStatuses.clone();
- this.validateConsistency();
- }
-
- public void setAvailabilities(Availabilities availabilities) {
- mAvailabilities = availabilities.clone();
- this.validateConsistency();
- }
-
- public void setEventStatuses(EventStatuses eventStatuses) {
- mEventStatuses = eventStatuses.clone();
- this.validateConsistency();
- }
-
- public void setWeekdays(Weekdays weekdays) {
- mWeekdays = weekdays.clone();
- this.validateConsistency();
- }
-
- public void setCloneTitle(boolean enabled) {
- mCloneTitle = enabled;
- this.validateConsistency();
- }
-
- public void setCustomTitle(String title) {
- mCustomTitle = title;
- this.validateConsistency();
- }
-
- public void setCloneLocation(boolean enabled) {
- mCloneLocation = enabled;
- this.validateConsistency();
- }
-
- public void setCustomLocation(String location) {
- mCustomLocation = location;
- this.validateConsistency();
- }
-
- public void setCloneDescription(boolean enabled) {
- mCloneDescription = enabled;
- this.validateConsistency();
- }
-
- public void setCustomDescription(String description) {
- mCustomDescription = description;
- this.validateConsistency();
- }
-
- public void setCloneSelfAttendeeStatus(boolean enabled) {
- mCloneSelfAttendeeStatus = ClonerVersion.setCloneSelfAttendeeStatus(enabled);
- this.validateConsistency();
- }
-
- public void setCloneSelfAttendeeStatusReverse(boolean enabled) {
- mCloneSelfAttendeeStatusReverse = enabled;
- this.validateConsistency();
- }
-
- public void setSelfAttendeeName(String name) {
- mSelfAttendeeName = name;
- this.validateConsistency();
- }
-
- public void setReserveBefore(int reserveBefore) {
- mReserveBefore = reserveBefore;
- this.validateConsistency();
- }
-
- public void setReserveAfter(int reserveAfter) {
- mReserveAfter = reserveAfter;
- this.validateConsistency();
- }
-
- public void setCustomAccessLevel(int customAccessLevel) {
- mCustomAccessLevel = ClonerVersion.setCustomAccessLevel(customAccessLevel);
- this.validateConsistency();
- }
-
- public void setCustomAvailability(int customAvailability) {
- mCustomAvailability = ClonerVersion.setCustomAvailability(customAvailability);
- this.validateConsistency();
- }
-
- public void setCloneAttendees(boolean enabled) {
- mCloneAttendees = ClonerVersion.setCloneAttendees(enabled);
- this.validateConsistency();
- }
-
- public void setUseDummyEmailAddresses(boolean enabled) {
- mUseDummyEmailAddresses = enabled;
- this.validateConsistency();
- }
-
- public void setDummyEmailDomain(String domain) {
- if (BLACKHOLE_DOMAIN.contentEquals(domain)) {
- mDummyEmailDomain = BLACKHOLE_DOMAIN;
- } else {
- mDummyEmailDomain = DEFAULT_DUMMY_DOMAIN;
- }
- this.validateConsistency();
- }
-
- public void setAttendeesAsText(boolean enabled) {
- mAttendeesAsText = ClonerVersion.setAttendeesAsText(enabled);
- this.validateConsistency();
- }
-
- public void setCustomAttendee(boolean enabled) {
- mCustomAttendee = ClonerVersion.setCustomAttendee(enabled);
- this.validateConsistency();
- }
-
- public void setCustomAttendeeName(String name) {
- mCustomAttendeeName = name;
- this.validateConsistency();
- }
-
- public void setCustomAttendeeEmail(String email) {
- mCustomAttendeeEmail = email;
- this.validateConsistency();
- }
-
- public void setCloneReminders(boolean enabled) {
- mCloneReminders = ClonerVersion.setCloneReminders(enabled);
- this.validateConsistency();
- }
-
- public void setCustomReminder(boolean enabled) {
- mCustomReminder = ClonerVersion.setCustomReminder(enabled);
- this.validateConsistency();
- }
-
- public void setCustomReminderMethod(int method) {
- mCustomReminderMethod = method;
- this.validateConsistency();
- }
-
- public void setCustomReminderMinutes(int minutes) {
- mCustomReminderMinutes = minutes;
- this.validateConsistency();
- }
-
- public void setRetainClonesOutsideSourceEventWindow(boolean enabled) {
- mRetainClonesOutsideSourceEventWindow = ClonerVersion.setRetainClonesOutsideSourceEventWindow(enabled);
- this.validateConsistency();
- }
-
- public void setHash(int hashMethod, String hash) {
- if (hashMethod == HASH_METHOD_MANUAL) {
- if (hash != null && hash.length() == 32) {
- Pattern pattern = Pattern.compile(EventMarker.HASH_PATTERN);
- Matcher m = pattern.matcher(hash);
- if (!m.find()) {
- hashMethod = HASH_METHOD_SOURCE_CALENDAR;
- }
- } else {
- hashMethod = HASH_METHOD_SOURCE_CALENDAR;
- }
- }
-
- mHashMethod = hashMethod;
- switch (hashMethod) {
- case HASH_METHOD_SOURCE_CALENDAR:
- mHash = Hasher.hash(mSrcCalendarRef);
- break;
- case HASH_METHOD_RULE_ID:
- mHash = Hasher.hash(mId);
- break;
- case HASH_METHOD_MANUAL:
- mHash = hash;
- break;
- }
- this.validateConsistency();
- }
-
- public void setHash(String hash) {
- if (mHashMethod == HASH_METHOD_MANUAL) {
- mHash = hash;
- }
- }
-
- @Override
- public String toString() {
- return mName;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleActivity.java
deleted file mode 100644
index 62933fe..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleActivity.java
+++ /dev/null
@@ -1,1023 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.EditTextPreference;
-import android.preference.ListPreference;
-import android.preference.MultiSelectListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceFragment;
-import android.preference.SwitchPreference;
-import android.provider.CalendarContract.Reminders;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
-
-public class RuleActivity extends PreferenceActivity {
- private boolean mChanged = false;
- private boolean mNewRule = true;
- private Rule mRule = null;
-
- static final String[] mMethodNames = new String[] { ClonerApp.translate(R.string.rule_method_clone),
- ClonerApp.translate(R.string.rule_method_move), ClonerApp.translate(R.string.rule_method_aggregate) };
- static final String[] mMethodKeys = new String[] { "" + Rule.METHOD_CLONE, "" + Rule.METHOD_MOVE,
- "" + Rule.METHOD_AGGREGATE };
- static final String mOn = ClonerApp.translate(R.string.rule_clone_self_attendee_status_reverse_on_summary);
- static final String mOff = ClonerApp.translate(R.string.rule_clone_self_attendee_status_reverse_off_summary);
- static final String[] mSyncPeriodBeforeNames = new String[] {
- ClonerApp.translate(R.string.msg_n_day_back, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_days_back, new String[] { "3" }),
- ClonerApp.translate(R.string.msg_n_week_back, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_weeks_back, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_month_back, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_months_back, new String[] { "3" }),
- ClonerApp.translate(R.string.msg_n_year_back, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_years_back, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_years_back, new String[] { "5" }), ClonerApp.translate(R.string.msg_all) };
- static final String[] mSyncPeriodAfterNames = new String[] {
- ClonerApp.translate(R.string.msg_n_day_forward, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_days_forward, new String[] { "3" }),
- ClonerApp.translate(R.string.msg_n_week_forward, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_weeks_forward, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_month_forward, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_months_forward, new String[] { "3" }),
- ClonerApp.translate(R.string.msg_n_year_forward, new String[] { "1" }),
- ClonerApp.translate(R.string.msg_n_years_forward, new String[] { "2" }),
- ClonerApp.translate(R.string.msg_n_years_forward, new String[] { "5" }),
- ClonerApp.translate(R.string.msg_all) };
- static final String[] mEventTypeFilterKeys = { "" + Rule.EVENT_TYPE_ALL, "" + Rule.EVENT_TYPE_SIMPLE,
- "" + Rule.EVENT_TYPE_RECURRING };
- static final String[] mEventTypeFilterNames = { ClonerApp.translate(R.string.rule_event_type_all),
- ClonerApp.translate(R.string.rule_event_type_simple),
- ClonerApp.translate(R.string.rule_event_type_recurring) };
- static final String[] mHashMethodKeys = { "" + Rule.HASH_METHOD_SOURCE_CALENDAR, "" + Rule.HASH_METHOD_RULE_ID,
- "" + Rule.HASH_METHOD_MANUAL };
- static final String[] mHashMethodNames = { ClonerApp.translate(R.string.rule_hash_method_source_calendar),
- ClonerApp.translate(R.string.rule_hash_method_rule_id),
- ClonerApp.translate(R.string.rule_hash_method_manual) };
-
- public static class RuleSettingsFragment extends PreferenceFragment {
- private RuleActivity mActivity = null;
- private Rule mRule = null;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.rule_preferences);
- mActivity = (RuleActivity) this.getActivity();
- mRule = mActivity.mRule;
- this.fillFields();
- }
-
- private final OnPreferenceChangeListener mChangeListener = new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- // Try to get a lock on the rule. Can only be done if it is not
- // processed in the background
- int lockSecret = mRule.tryLock();
- if (lockSecret == 0) {
- // Rule is busy so we can't edit
- ClonerApp.toast(ClonerApp.translate(R.string.msg_rule_busy));
- return false;
- }
-
- boolean updated = true;
- // We have the lock, so not edit the rule as the user indicated
- try {
- // Rule settings
- final String key = preference.getKey();
- if (key.contentEquals("ruleEnabled")) {
- mRule.setEnabled((Boolean) newValue);
- } else {
- if (ClonerApp.getSettings().isClonerEnabled() && mRule.isEnabled()) {
- // Disable the rule any time someone changes a
- // preference and the cloner is enabled
- mRule.setEnabled(false);
- ClonerApp.toast(ClonerApp.translate(R.string.msg_rule_disabled));
- }
- }
- if (key.contentEquals("ruleName")) {
- mRule.setName((String) newValue);
- }
- if (key.contentEquals("ruleMethod")) {
- try {
- int method = Integer.parseInt((String) newValue);
- mRule.setMethod(method);
- updated = mRule.getMethod() == method;
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleSrcCalendar")) {
- mRule.setSrcCalendarRef((String) newValue);
- // Reset destination if equal to source
- if (mRule.getDstCalendarRef().contentEquals((String) newValue)) {
- mRule.clearDstCalendarRef();
- }
- }
- if (key.contentEquals("ruleDstCalendar")) {
- mRule.setDstCalendarRef((String) newValue);
- // Reset source if equal to destination
- if (mRule.getSrcCalendarRef().contentEquals((String) newValue)) {
- mRule.clearSrcCalendarRef();
- }
- }
-
- // Event selection settings
- if (key.contentEquals("ruleSyncPeriodBefore")) {
- updated = mRule.setSyncPeriodBefore(Long.parseLong((String) newValue));
- if (!updated) {
- ClonerApp.toast(ClonerApp.translate(R.string.rule_sync_period_limited));
- updated = mRule.getSyncPeriodBefore() != Long.parseLong((String) newValue);
- }
- }
- if (key.contentEquals("ruleSyncPeriodAfter")) {
- updated = mRule.setSyncPeriodAfter(Long.parseLong((String) newValue));
- if (!updated) {
- ClonerApp.toast(ClonerApp.translate(R.string.rule_sync_period_limited));
- updated = mRule.getSyncPeriodAfter() != Long.parseLong((String) newValue);
- }
- }
- if (key.contentEquals("ruleIncludeClones")) {
- mRule.setIncludeClones((Boolean) newValue);
- updated = mRule.getIncludeClones() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleUseEventFilters")) {
- mRule.setUseEventFilters((Boolean) newValue);
- updated = mRule.useEventFilters() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleEventTypeFilter")) {
- try {
- mRule.setEventTypeFilter(Integer.parseInt((String) newValue));
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleTitleMustContain")) {
- mRule.setTitleMustContain((String) newValue);
- }
- if (key.contentEquals("ruleTitleMustNotContain")) {
- mRule.setTitleMustNotContain((String) newValue);
- }
- if (key.contentEquals("ruleLocationMustContain")) {
- mRule.setLocationMustContain((String) newValue);
- }
- if (key.contentEquals("ruleLocationMustNotContain")) {
- mRule.setLocationMustNotContain((String) newValue);
- }
- if (key.contentEquals("ruleDescriptionMustContain")) {
- mRule.setDescriptionMustContain((String) newValue);
- }
- if (key.contentEquals("ruleDescriptionMustNotContain")) {
- mRule.setDescriptionMustNotContain((String) newValue);
- }
- if (key.contentEquals("ruleAccessLevels")) {
- @SuppressWarnings("unchecked")
- Set keys = (Set) newValue;
- AccessLevels accessLevels = new AccessLevels(false);
- for (int index = 0; index < accessLevels.getCount(); index++) {
- accessLevels.selectByKey(accessLevels.getKey(index),
- keys.contains("" + accessLevels.getKey(index)));
- }
- mRule.setAccessLevels(accessLevels);
- }
- if (key.contentEquals("ruleAttendeeStatuses")) {
- @SuppressWarnings("unchecked")
- Set keys = (Set) newValue;
- AttendeeStatuses attendeeStatuses = new AttendeeStatuses(false);
- for (int index = 0; index < attendeeStatuses.getCount(); index++) {
- attendeeStatuses.selectByKey(attendeeStatuses.getKey(index),
- keys.contains("" + attendeeStatuses.getKey(index)));
- }
- mRule.setAttendeeStatuses(attendeeStatuses);
- }
- if (key.contentEquals("ruleAvailabilities")) {
- @SuppressWarnings("unchecked")
- Set keys = (Set) newValue;
- Availabilities availabilities = new Availabilities(false);
- for (int index = 0; index < availabilities.getCount(); index++) {
- availabilities.selectByKey(availabilities.getKey(index),
- keys.contains("" + availabilities.getKey(index)));
- }
- mRule.setAvailabilities(availabilities);
- }
- if (key.contentEquals("ruleEventStatuses")) {
- @SuppressWarnings("unchecked")
- Set keys = (Set) newValue;
- EventStatuses eventStatuses = new EventStatuses(false);
- for (int index = 0; index < eventStatuses.getCount(); index++) {
- eventStatuses.selectByKey(eventStatuses.getKey(index),
- keys.contains("" + eventStatuses.getKey(index)));
- }
- mRule.setEventStatuses(eventStatuses);
- }
- if (key.contentEquals("ruleWeekdays")) {
- @SuppressWarnings("unchecked")
- Set keys = (Set) newValue;
- Weekdays weekdays = new Weekdays(false);
- for (int index = 0; index < weekdays.getCount(); index++) {
- weekdays.selectByKey(weekdays.getKey(index), keys.contains("" + weekdays.getKey(index)));
- }
- mRule.setWeekdays(weekdays);
- }
-
- // Content settings
- if (key.contentEquals("ruleCloneTitle")) {
- mRule.setCloneTitle((Boolean) newValue);
- updated = mRule.getCloneTitle() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomTitle")) {
- mRule.setCustomTitle((String) newValue);
- }
- if (key.contentEquals("ruleCloneLocation")) {
- mRule.setCloneLocation((Boolean) newValue);
- updated = mRule.getCloneLocation() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomLocation")) {
- mRule.setCustomLocation((String) newValue);
- }
- if (key.contentEquals("ruleCloneDescription")) {
- mRule.setCloneDescription((Boolean) newValue);
- updated = mRule.getCloneDescription() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomDescription")) {
- mRule.setCustomDescription((String) newValue);
- }
- if (key.contentEquals("ruleCloneSelfAttendeeStatus")) {
- mRule.setCloneSelfAttendeeStatus((Boolean) newValue);
- updated = mRule.getCloneSelfAttendeeStatus() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCloneSelfAttendeeStatusReverse")) {
- mRule.setCloneSelfAttendeeStatusReverse((Boolean) newValue);
- }
- if (key.contentEquals("ruleSelfAttendeeName")) {
- mRule.setSelfAttendeeName((String) newValue);
- }
- if (key.contentEquals("ruleReserveBefore")) {
- try {
- int rb = Integer.parseInt((String) newValue);
- mRule.setReserveBefore(rb >= 0 ? rb : 0);
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleReserveAfter")) {
- try {
- int ra = Integer.parseInt((String) newValue);
- mRule.setReserveAfter(ra >= 0 ? ra : 0);
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleCustomAccessLevel")) {
- try {
- mRule.setCustomAccessLevel(Integer.parseInt((String) newValue));
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleCustomAvailability")) {
- try {
- mRule.setCustomAvailability(Integer.parseInt((String) newValue));
- } catch (Exception e) {
- }
- }
-
- // Attendee options
- if (key.contentEquals("ruleCloneAttendees")) {
- mRule.setCloneAttendees((Boolean) newValue);
- updated = mRule.getCloneAttendees() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleUseDummyEmailAddresses")) {
- mRule.setUseDummyEmailAddresses((Boolean) newValue);
- }
- if (key.contentEquals("ruleDummyEmailDomain")) {
- mRule.setDummyEmailDomain((String) newValue);
- }
- if (key.contentEquals("ruleAttendeesAsText")) {
- mRule.setAttendeesAsText((Boolean) newValue);
- updated = mRule.getAttendeesAsText() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomAttendee")) {
- mRule.setCustomAttendee((Boolean) newValue);
- updated = mRule.getCustomAttendee() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomAttendeeName")) {
- mRule.setCustomAttendeeName((String) newValue);
- }
- if (key.contentEquals("ruleCustomAttendeeEmail")) {
- mRule.setCustomAttendeeEmail((String) newValue);
- }
-
- // Reminder options
- if (key.contentEquals("ruleCloneReminders")) {
- mRule.setCloneReminders((Boolean) newValue);
- updated = mRule.getCloneReminders() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomReminder")) {
- mRule.setCustomReminder((Boolean) newValue);
- updated = mRule.getCustomReminder() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleCustomReminderMethod")) {
- mRule.setCustomReminderMethod(Integer.parseInt((String) newValue));
- }
- if (key.contentEquals("ruleCustomReminderMinutes")) {
- try {
- String val = (String) newValue;
- if (val.contentEquals("")) {
- mRule.setCustomReminderMinutes(Reminders.MINUTES_DEFAULT);
- } else {
- int crm = Integer.parseInt((String) newValue);
- mRule.setCustomReminderMinutes(crm >= 0 ? crm : 0);
- }
- } catch (Exception e) {
- }
- }
-
- // Additional options
- if (key.contentEquals("ruleRetainClonesOutsideSourceEventWindow")) {
- mRule.setRetainClonesOutsideSourceEventWindow((Boolean) newValue);
- updated = mRule.getRetainClonesOutsideSourceEventWindow() == (Boolean) newValue;
- }
- if (key.contentEquals("ruleHashMethod")) {
- try {
- mRule.setHash(Integer.parseInt((String) newValue), mRule.getHash());
- } catch (Exception e) {
- }
- }
- if (key.contentEquals("ruleHash")) {
- mRule.setHash(mRule.getHashMethod(), (String) newValue);
- }
- if (key.contentEquals("ruleReadOnly")) {
- mRule.setReadOnly((Boolean) newValue);
- }
-
- if (updated) {
- fillFields();
- }
- } finally {
- mRule.tryRelease(lockSecret);
- mActivity.mChanged = true;
- }
- return updated;
- }
- };
-
- private String getDisplayName(DbCalendar cal) {
- String result = cal.getDisplayName();
- if (result == null) {
- result = "<" + ClonerApp.translate(R.string.rule_calendar_with_no_name) + ">";
- }
- return result;
- }
-
- private void fillCalendarPreference(String ref, ListPreference calPref, String[] excludeRefs,
- boolean needWriteAccess) {
- DbCalendar selected = null;
- List calendarRefs = CalendarLoader.getValidRefs();
- List cals = new LinkedList();
- for (int index = 0; index < calendarRefs.size(); index++) {
- CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(calendarRefs.get(index));
- DbCalendar cal = info.getCalendar();
- if (cal != null) {
- boolean excluded = false;
- for (int i = 0; i < excludeRefs.length; i++) {
- if (cal.getRef().contentEquals(excludeRefs[i])) {
- excluded = true;
- }
- }
- if (!excluded && cal.canAccess(needWriteAccess)) {
- cals.add(cal);
- if (cal.getRef().contentEquals(ref)) {
- selected = cal;
- }
- }
- }
- }
-
- String[] keys;
- String[] values;
- int count = 0;
- if (selected != null) {
- keys = new String[cals.size()];
- values = new String[cals.size()];
- } else {
- keys = new String[cals.size() + 1];
- values = new String[cals.size() + 1];
- keys[0] = "<" + ClonerApp.translate(R.string.rule_select_calendar) + ">";
- values[0] = "";
- count++;
- }
-
- for (DbCalendar cal : cals) {
- keys[count] = this.getDisplayName(cal);
- values[count] = cal.getRef();
- count++;
- }
-
- calPref.setEntries(keys);
- calPref.setEntryValues(values);
- if (cals.size() > 0) {
- if (selected != null) {
- calPref.setEnabled(true);
- calPref.setValue(selected.getRef());
- calPref.setSummary(this.getDisplayName(selected));
- } else {
- calPref.setEnabled(true);
- calPref.setValue("");
- calPref.setSummary("<" + ClonerApp.translate(R.string.rule_select_calendar) + ">");
- }
- } else {
- calPref.setEnabled(false);
- calPref.setValue("");
- calPref.setSummary(ClonerApp.translate(R.string.rule_no_calendars_found));
- }
- }
-
- private void fillCheckBox(String name, boolean checked, String checkedSummary, String uncheckedSummary,
- boolean enabled) {
- CheckBoxPreference cbp = (CheckBoxPreference) findPreference(name);
- cbp.setChecked(checked);
- cbp.setSummary(checked ? checkedSummary : uncheckedSummary);
- cbp.setEnabled(enabled);
- cbp.setOnPreferenceChangeListener(mChangeListener);
- }
-
- private void fillRadioSelect(String name, String value, final String[] keys, final String[] names,
- boolean enabled) {
- final ListPreference lp = (ListPreference) findPreference(name);
- lp.setEntries(names);
- lp.setEntryValues(keys);
- lp.setValue(value);
- this.setSummary(lp, value, keys, names);
- lp.setEnabled(enabled);
- lp.setOnPreferenceChangeListener(mChangeListener);
- }
-
- private void fillMultiSelect(String name, SelectList list, boolean enabled) {
- MultiSelectListPreference mslp;
- mslp = (MultiSelectListPreference) findPreference(name);
-
- String[] names = new String[list.getCount()];
- String[] keys = new String[list.getCount()];
- for (int index = 0; index < list.getCount(); index++) {
- names[index] = list.getName(index);
- keys[index] = "" + list.getKey(index);
- }
-
- mslp.setEntries(names);
- mslp.setEntryValues(keys);
- Set set = new HashSet();
- String summary = "";
- for (int index = 0; index < keys.length; index++) {
- if (list.isKeySelected(Integer.parseInt(keys[index]))) {
- set.add("" + keys[index]);
- if (!summary.contentEquals("")) {
- summary += ", ";
- }
- summary += names[index];
- }
- }
- mslp.setValues(set);
- if (summary.contentEquals("")) {
- mslp.setSummary(ClonerApp.translate(R.string.rule_no_selection));
- } else {
- mslp.setSummary(summary);
- }
- mslp.setEnabled(enabled);
- mslp.setOnPreferenceChangeListener(mChangeListener);
- }
-
- private void setSummary(Preference pref, String value, String[] keys, String[] names) {
- String summary = null;
- for (int index = 0; index < keys.length; index++) {
- if (keys[index].contentEquals(value)) {
- summary = names[index];
- }
- }
- pref.setSummary(summary != null ? summary : "");
- }
-
- private String[] getCustomAccessLevelKeys() {
- int count = mRule.getMethod() != Rule.METHOD_AGGREGATE ? 1 : 0;
- count += 4;
- String[] result = new String[count];
- count = 0;
- if (mRule.getMethod() != Rule.METHOD_AGGREGATE) {
- result[count++] = "" + Rule.CUSTOM_ACCESS_LEVEL_SOURCE;
- }
- result[count++] = "" + Rule.CUSTOM_ACCESS_LEVEL_DEFAULT;
- result[count++] = "" + Rule.CUSTOM_ACCESS_LEVEL_PRIVATE;
- result[count++] = "" + Rule.CUSTOM_ACCESS_LEVEL_CONFIDENTIAL;
- result[count++] = "" + Rule.CUSTOM_ACCESS_LEVEL_PUBLIC;
- return result;
- }
-
- private String[] getCustomAccessLevelNames() {
- int count = mRule.getMethod() != Rule.METHOD_AGGREGATE ? 1 : 0;
- count += 4;
- String[] result = new String[count];
- count = 0;
- if (mRule.getMethod() != Rule.METHOD_AGGREGATE) {
- result[count++] = ClonerApp.translate(R.string.rule_custom_access_level_source);
- }
- result[count++] = ClonerApp.translate(R.string.access_level_default);
- result[count++] = ClonerApp.translate(R.string.access_level_private);
- result[count++] = ClonerApp.translate(R.string.access_level_confidential);
- result[count++] = ClonerApp.translate(R.string.access_level_public);
- return result;
- }
-
- private String[] getCustomAvailabilityKeys(boolean hasAvailabilitySamsung) {
- int count = mRule.getMethod() != Rule.METHOD_AGGREGATE ? 1 : 0;
- count += 2;
- count += hasAvailabilitySamsung ? 1 : 0;
- String[] result = new String[count];
- count = 0;
- if (mRule.getMethod() != Rule.METHOD_AGGREGATE) {
- result[count++] = "" + Rule.CUSTOM_AVAILABILITY_SOURCE;
- }
- result[count++] = "" + Rule.CUSTOM_AVAILABILITY_BUSY;
- result[count++] = "" + Rule.CUSTOM_AVAILABILITY_FREE;
- if (hasAvailabilitySamsung) {
- result[count++] = "" + Rule.CUSTOM_AVAILABILITY_OUT_OF_OFFICE;
- }
- return result;
- }
-
- private String[] getCustomAvailabilityNames(boolean hasAvailabilitySamsung) {
- int count = mRule.getMethod() != Rule.METHOD_AGGREGATE ? 1 : 0;
- count += 2;
- count += hasAvailabilitySamsung ? 1 : 0;
- String[] result = new String[count];
- count = 0;
- if (mRule.getMethod() != Rule.METHOD_AGGREGATE) {
- result[count++] = ClonerApp.translate(R.string.rule_custom_availability_source);
- }
- result[count++] = ClonerApp.translate(R.string.availability_busy);
- result[count++] = ClonerApp.translate(R.string.availability_free);
- if (hasAvailabilitySamsung) {
- result[count++] = ClonerApp.translate(R.string.availability_out_of_office);
- }
- return result;
- }
-
- private void fillFields() {
- // Set the rule enable switch
- SwitchPreference ruleEnabled = (SwitchPreference) findPreference("ruleEnabled");
- ruleEnabled.setChecked(mRule.isEnabled());
- ruleEnabled.setSummary("Hash: " + mRule.getHash().substring(0, 10) + "...");
- ruleEnabled.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the rule name
- EditTextPreference ruleName = (EditTextPreference) findPreference("ruleName");
- ruleName.setText(mRule.getName());
- ruleName.setSummary(mRule.getName());
- ruleName.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the method
- ListPreference ruleMethod = (ListPreference) findPreference("ruleMethod");
- ruleMethod.setEntries(mMethodNames);
- ruleMethod.setEntryValues(mMethodKeys);
- ruleMethod.setValue("" + mRule.getMethod());
- this.setSummary(ruleMethod, "" + mRule.getMethod(), mMethodKeys, mMethodNames);
- ruleMethod.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the source calendar
- ListPreference ruleSrcCalendar = (ListPreference) findPreference("ruleSrcCalendar");
- this.fillCalendarPreference(mRule.getSrcCalendarRef(), ruleSrcCalendar,
- new String[] { mRule.getDstCalendarRef() }, mRule.getMethod() == Rule.METHOD_MOVE);
- ruleSrcCalendar.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the destination calendar
- ListPreference ruleDstCalendar = (ListPreference) findPreference("ruleDstCalendar");
- this.fillCalendarPreference(mRule.getDstCalendarRef(), ruleDstCalendar,
- new String[] { mRule.getSrcCalendarRef() }, true);
- ruleDstCalendar.setOnPreferenceChangeListener(mChangeListener);
-
- // Load the destination calendar for multiple purposes below
- final CalendarLoader.CalendarInfo info = CalendarLoader.getCalendarByRef(mRule.getDstCalendarRef());
-
- // Set the time period before
- String syncPeriodKeys[] = new String[Rule.SYNC_PERIODS.length];
- for (int index = 0; index < Rule.SYNC_PERIODS.length; index++) {
- syncPeriodKeys[index] = "" + Rule.SYNC_PERIODS[index];
- }
- this.fillRadioSelect("ruleSyncPeriodBefore", "" + mRule.getSyncPeriodBefore(), syncPeriodKeys,
- mSyncPeriodBeforeNames, true);
-
- // Set the time period after
- this.fillRadioSelect("ruleSyncPeriodAfter", "" + mRule.getSyncPeriodAfter(), syncPeriodKeys,
- mSyncPeriodAfterNames, true);
-
- // Set include clones checkbox
- this.fillCheckBox("ruleIncludeClones", mRule.getIncludeClones(),
- ClonerApp.translate(R.string.rule_include_clones_on_summary),
- ClonerApp.translate(R.string.rule_include_clones_off_summary), true);
-
- // Set the use event filters checkbox
- this.fillCheckBox("ruleUseEventFilters", mRule.useEventFilters(),
- ClonerApp.translate(R.string.rule_use_event_filters_on_summary),
- ClonerApp.translate(R.string.rule_use_event_filters_off_summary), true);
-
- // Set event type filter
- this.fillRadioSelect("ruleEventTypeFilter", "" + mRule.getEventTypeFilter(), mEventTypeFilterKeys,
- mEventTypeFilterNames, mRule.useEventFilters());
-
- // Set title must contain filter
- EditTextPreference ruleTitleMustContain = (EditTextPreference) findPreference("ruleTitleMustContain");
- ruleTitleMustContain.setText(mRule.getTitleMustContain());
- ruleTitleMustContain.setSummary(mRule.getTitleMustContain());
- ruleTitleMustContain.setEnabled(mRule.useEventFilters());
- ruleTitleMustContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set title must not contain filter
- EditTextPreference ruleTitleMustNotContain = (EditTextPreference) findPreference("ruleTitleMustNotContain");
- ruleTitleMustNotContain.setText(mRule.getTitleMustNotContain());
- ruleTitleMustNotContain.setSummary(mRule.getTitleMustNotContain());
- ruleTitleMustNotContain.setEnabled(mRule.useEventFilters());
- ruleTitleMustNotContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set location must contain filter
- EditTextPreference ruleLocationMustContain = (EditTextPreference) findPreference("ruleLocationMustContain");
- ruleLocationMustContain.setText(mRule.getLocationMustContain());
- ruleLocationMustContain.setSummary(mRule.getLocationMustContain());
- ruleLocationMustContain.setEnabled(mRule.useEventFilters());
- ruleLocationMustContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set location must not contain filter
- EditTextPreference ruleLocationMustNotContain = (EditTextPreference) findPreference("ruleLocationMustNotContain");
- ruleLocationMustNotContain.setText(mRule.getLocationMustNotContain());
- ruleLocationMustNotContain.setSummary(mRule.getLocationMustNotContain());
- ruleLocationMustNotContain.setEnabled(mRule.useEventFilters());
- ruleLocationMustNotContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set description must contain filter
- EditTextPreference ruleDescriptionMustContain = (EditTextPreference) findPreference("ruleDescriptionMustContain");
- ruleDescriptionMustContain.setText(mRule.getDescriptionMustContain());
- ruleDescriptionMustContain.setSummary(mRule.getDescriptionMustContain());
- ruleDescriptionMustContain.setEnabled(mRule.useEventFilters());
- ruleDescriptionMustContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set description must not contain filter
- EditTextPreference ruleDescriptionMustNotContain = (EditTextPreference) findPreference("ruleDescriptionMustNotContain");
- ruleDescriptionMustNotContain.setText(mRule.getDescriptionMustNotContain());
- ruleDescriptionMustNotContain.setSummary(mRule.getDescriptionMustNotContain());
- ruleDescriptionMustNotContain.setEnabled(mRule.useEventFilters());
- ruleDescriptionMustNotContain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set access level selection
- this.fillMultiSelect("ruleAccessLevels", mRule.getAccessLevels(), mRule.useEventFilters());
-
- // Set attendee status selection
- this.fillMultiSelect("ruleAttendeeStatuses", mRule.getAttendeeStatuses(), mRule.useEventFilters());
-
- // Set availability selection
- this.fillMultiSelect("ruleAvailabilities", mRule.getAvailabilities(), mRule.useEventFilters());
-
- // Set event status selection
- this.fillMultiSelect("ruleEventStatuses", mRule.getEventStatuses(), mRule.useEventFilters());
-
- // Set weekday selection
- this.fillMultiSelect("ruleWeekdays", mRule.getWeekdays(), mRule.useEventFilters());
-
- // Set the clone title checkbox
- this.fillCheckBox("ruleCloneTitle", mRule.getCloneTitle(),
- ClonerApp.translate(R.string.rule_clone_title_on_summary),
- ClonerApp.translate(R.string.rule_clone_title_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the custom title
- EditTextPreference ruleCustomTitle = (EditTextPreference) findPreference("ruleCustomTitle");
- ruleCustomTitle.setText(mRule.getCustomTitle());
- ruleCustomTitle.setSummary(mRule.getCustomTitle());
- ruleCustomTitle.setEnabled(!mRule.getCloneTitle());
- ruleCustomTitle.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the clone location checkbox
- this.fillCheckBox("ruleCloneLocation", mRule.getCloneLocation(),
- ClonerApp.translate(R.string.rule_clone_location_on_summary),
- ClonerApp.translate(R.string.rule_clone_location_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the custom location
- EditTextPreference ruleCustomLocation = (EditTextPreference) findPreference("ruleCustomLocation");
- ruleCustomLocation.setText(mRule.getCustomLocation());
- ruleCustomLocation.setSummary(mRule.getCustomLocation());
- ruleCustomLocation.setEnabled(!mRule.getCloneLocation());
- ruleCustomLocation.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the clone description checkbox
- this.fillCheckBox("ruleCloneDescription", mRule.getCloneDescription(),
- ClonerApp.translate(R.string.rule_clone_description_on_summary),
- ClonerApp.translate(R.string.rule_clone_description_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the custom description
- EditTextPreference ruleCustomDescription = (EditTextPreference) findPreference("ruleCustomDescription");
- ruleCustomDescription.setText(mRule.getCustomDescription());
- ruleCustomDescription.setSummary(mRule.getCustomDescription());
- ruleCustomDescription.setEnabled(!mRule.getCloneDescription());
- ruleCustomDescription.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the clone status checkbox
- this.fillCheckBox("ruleCloneSelfAttendeeStatus", mRule.getCloneSelfAttendeeStatus(),
- ClonerApp.translate(R.string.rule_clone_self_attendee_status_on_summary),
- ClonerApp.translate(R.string.rule_clone_self_attendee_status_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the clone status reverse checkbox
- String on = mOn;
- String off = mOff;
- if (mRule.getMethod() == Rule.METHOD_MOVE) {
- on = off = ClonerApp.translate(R.string.rule_not_relevant_for_move_rules);
- }
- this.fillCheckBox("ruleCloneSelfAttendeeStatusReverse", mRule.getCloneSelfAttendeeStatusReverse(), on, off,
- mRule.getCloneSelfAttendeeStatus() && mRule.getMethod() != Rule.METHOD_MOVE);
-
- // Set the self attendee name
- EditTextPreference ruleSelfAttendeeName = (EditTextPreference) findPreference("ruleSelfAttendeeName");
- ruleSelfAttendeeName.setText(mRule.getSelfAttendeeName());
- if (!mRule.getSelfAttendeeName().contentEquals("")) {
- ruleSelfAttendeeName.setSummary(mRule.getSelfAttendeeName());
- } else {
- ruleSelfAttendeeName.setSummary(ClonerApp.translate(R.string.rule_self_attendee_name_info));
- }
- ruleSelfAttendeeName.setEnabled(mRule.getCloneSelfAttendeeStatus()
- && mRule.getCloneSelfAttendeeStatusReverse());
- ruleSelfAttendeeName.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the custom access level
- ListPreference ruleCustomAccessLevel = (ListPreference) findPreference("ruleCustomAccessLevel");
- String[] customAccessLevelKeys = this.getCustomAccessLevelKeys();
- String[] customAccessLevelNames = this.getCustomAccessLevelNames();
- ruleCustomAccessLevel.setEntries(customAccessLevelNames);
- ruleCustomAccessLevel.setEntryValues(customAccessLevelKeys);
- ruleCustomAccessLevel.setValue("" + mRule.getCustomAccessLevel());
- this.setSummary(ruleCustomAccessLevel, "" + mRule.getCustomAccessLevel(), customAccessLevelKeys,
- customAccessLevelNames);
- ruleCustomAccessLevel.setEnabled(true);
- ruleCustomAccessLevel.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the custom availability, depending on the destination
- // calendar type
- ListPreference ruleCustomAvailability = (ListPreference) findPreference("ruleCustomAvailability");
- boolean hasAvailabilitySamsung = info.getCalendar() != null
- && Device.Samsung.supportsAvailabilitySamsung(info.getCalendar().getAccountType());
- String[] customavailabilityKeys = this.getCustomAvailabilityKeys(hasAvailabilitySamsung);
- String[] customavailabilityNames = this.getCustomAvailabilityNames(hasAvailabilitySamsung);
- ruleCustomAvailability.setEntries(customavailabilityNames);
- ruleCustomAvailability.setEntryValues(customavailabilityKeys);
- ruleCustomAvailability.setValue("" + mRule.getCustomAvailability());
- this.setSummary(ruleCustomAvailability, "" + mRule.getCustomAvailability(), customavailabilityKeys,
- customavailabilityNames);
- ruleCustomAvailability.setEnabled(true);
- ruleCustomAvailability.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the clone attendees checkbox
- this.fillCheckBox("ruleCloneAttendees", mRule.getCloneAttendees(),
- ClonerApp.translate(R.string.rule_clone_attendees_on_summary),
- ClonerApp.translate(R.string.rule_clone_attendees_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the prevent attendee invites checkbox
- this.fillCheckBox("ruleUseDummyEmailAddresses", mRule.getUseDummyEmailAddresses(),
- ClonerApp.translate(R.string.rule_use_dummy_attendee_addresses_on_summary),
- ClonerApp.translate(R.string.rule_use_dummy_attendee_addresses_off_summary),
- mRule.getCloneAttendees());
-
- // Set the dummy email domain
- ListPreference ruleDummyEmailDomain = (ListPreference) findPreference("ruleDummyEmailDomain");
- final String[] dummyEmailDomainKeys = new String[] { Rule.DEFAULT_DUMMY_DOMAIN, Rule.BLACKHOLE_DOMAIN };
- final String[] dummyEmailDomainNames = new String[] { Rule.DEFAULT_DUMMY_DOMAIN, Rule.BLACKHOLE_DOMAIN };
- ruleDummyEmailDomain.setEntries(dummyEmailDomainNames);
- ruleDummyEmailDomain.setEntryValues(dummyEmailDomainKeys);
- ruleDummyEmailDomain.setValue(mRule.getDummyEmailDomain());
- ruleDummyEmailDomain.setSummary(ClonerApp.translate(R.string.rule_dummy_email_domain_summary,
- new String[] { mRule.getDummyEmailDomain() }));
- ruleDummyEmailDomain.setEnabled(mRule.getUseDummyEmailAddresses());
- ruleDummyEmailDomain.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the attendees as text checkbox
- this.fillCheckBox("ruleAttendeesAsText", mRule.getAttendeesAsText(),
- ClonerApp.translate(R.string.rule_attendees_as_text_on_summary),
- ClonerApp.translate(R.string.rule_attendees_as_text_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the custom attendee checkbox
- this.fillCheckBox("ruleCustomAttendee", mRule.getCustomAttendee(),
- ClonerApp.translate(R.string.rule_custom_attendee_on_summary),
- ClonerApp.translate(R.string.rule_custom_attendee_off_summary), true);
-
- // Set the custom attendee name
- EditTextPreference ruleCustomAttendeeName = (EditTextPreference) findPreference("ruleCustomAttendeeName");
- ruleCustomAttendeeName.setText(mRule.getCustomAttendeeName());
- ruleCustomAttendeeName.setSummary(mRule.getCustomAttendeeName());
- ruleCustomAttendeeName.setEnabled(mRule.getCustomAttendee());
- ruleCustomAttendeeName.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the custom attendee email
- EditTextPreference ruleCustomAttendeeEmail = (EditTextPreference) findPreference("ruleCustomAttendeeEmail");
- ruleCustomAttendeeEmail.setText(mRule.getCustomAttendeeEmail());
- ruleCustomAttendeeEmail.setSummary(mRule.getCustomAttendeeEmail());
- ruleCustomAttendeeEmail.setEnabled(mRule.getCustomAttendee());
- ruleCustomAttendeeEmail.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the clone reminders checkbox
- this.fillCheckBox("ruleCloneReminders", mRule.getCloneReminders(),
- ClonerApp.translate(R.string.rule_clone_reminders_on_summary),
- ClonerApp.translate(R.string.rule_clone_reminders_off_summary),
- mRule.getMethod() != Rule.METHOD_AGGREGATE);
-
- // Set the custom reminder checkbox
- this.fillCheckBox("ruleCustomReminder", mRule.getCustomReminder(),
- ClonerApp.translate(R.string.rule_custom_reminder_on_summary),
- ClonerApp.translate(R.string.rule_custom_reminder_off_summary), true);
-
- // Set custom reminder method
- String disabledMessage = "";
- ReminderMethods methods = new ReminderMethods(false);
- // Calendar already loaded above, so reuse here
- DbCalendar cal = info.getCalendar();
- if (cal != null) {
- methods = cal.getAllowedReminders();
- // Remove DEFAULT method from selection
- methods.selectByKey(Reminders.METHOD_DEFAULT, false);
- methods.sort();
- disabledMessage = ClonerApp.translate(R.string.rule_custom_reminder_method_no_methods);
- } else {
- disabledMessage = CalendarLoader.getErrorString(info.getError(),
- ClonerApp.translate(R.string.calendar_destination));
- }
-
- ListPreference ruleCustomReminderMethod = (ListPreference) findPreference("ruleCustomReminderMethod");
- if (methods.getSelectedCount() > 0) {
- String[] names = methods.getSelectedNames();
- int[] keys = methods.getSelectedKeys();
- String[] values = new String[names.length];
- int selectedIndex = -1;
- for (int index = 0; index < values.length; index++) {
- values[index] = "" + keys[index];
- if (mRule.getCustomReminderMethod() == keys[index]) {
- selectedIndex = index;
- }
- }
- ruleCustomReminderMethod.setEntries(names);
- ruleCustomReminderMethod.setEntryValues(values);
- ruleCustomReminderMethod.setValue("" + mRule.getCustomReminderMethod());
- ruleCustomReminderMethod.setEnabled(mRule.getCustomReminder());
- ruleCustomReminderMethod.setSummary(selectedIndex >= 0 ? names[selectedIndex] : "");
- } else {
- ruleCustomReminderMethod.setEntries(new String[] {});
- ruleCustomReminderMethod.setEntryValues(new String[] {});
- ruleCustomReminderMethod.setValue("");
- ruleCustomReminderMethod.setEnabled(false);
- ruleCustomReminderMethod.setSummary(disabledMessage);
- }
- ruleCustomReminderMethod.setOnPreferenceChangeListener(mChangeListener);
-
- // Set custom reminder minutes
- EditTextPreference ruleCustomReminderMinutes = (EditTextPreference) findPreference("ruleCustomReminderMinutes");
- if (mRule.getCustomReminderMinutes() == Reminders.MINUTES_DEFAULT) {
- ruleCustomReminderMinutes.setText("");
- ruleCustomReminderMinutes
- .setSummary(ClonerApp.translate(R.string.rule_custom_reminder_default_minutes));
- } else {
- ruleCustomReminderMinutes.setText("" + mRule.getCustomReminderMinutes());
- ruleCustomReminderMinutes.setSummary(ClonerApp.translate(R.string.msg_n_minutes, new String[] { ""
- + mRule.getCustomReminderMinutes() }));
- }
- ruleCustomReminderMinutes.setEnabled(mRule.getCustomReminder());
- ruleCustomReminderMinutes.setOnPreferenceChangeListener(mChangeListener);
-
- // Set reserve before
- EditTextPreference ruleReserveBefore = (EditTextPreference) findPreference("ruleReserveBefore");
- ruleReserveBefore.setText("" + mRule.getReserveBefore());
- ruleReserveBefore.setSummary(ClonerApp.translate(R.string.msg_n_minutes,
- new String[] { "" + mRule.getReserveBefore() }));
- ruleReserveBefore.setOnPreferenceChangeListener(mChangeListener);
-
- // Set reserve after
- ruleReserveBefore = (EditTextPreference) findPreference("ruleReserveAfter");
- ruleReserveBefore.setText("" + mRule.getReserveAfter());
- ruleReserveBefore.setSummary(ClonerApp.translate(R.string.msg_n_minutes,
- new String[] { "" + mRule.getReserveAfter() }));
- ruleReserveBefore.setOnPreferenceChangeListener(mChangeListener);
-
- // Set retain clones outside source event window
- on = ClonerApp.translate(R.string.rule_retain_clones_outside_source_event_window_on_summary);
- off = ClonerApp.translate(R.string.rule_retain_clones_outside_source_event_window_off_summary);
- if (mRule.getMethod() == Rule.METHOD_MOVE) {
- on = off = ClonerApp.translate(R.string.rule_not_relevant_for_move_rules);
- }
- this.fillCheckBox("ruleRetainClonesOutsideSourceEventWindow",
- mRule.getRetainClonesOutsideSourceEventWindow(), on, off, mRule.getMethod() != Rule.METHOD_MOVE);
-
- // Set hash method
- this.fillRadioSelect("ruleHashMethod", "" + mRule.getHashMethod(), mHashMethodKeys, mHashMethodNames, true);
-
- // Set the hash value
- EditTextPreference ruleHash = (EditTextPreference) findPreference("ruleHash");
- ruleHash.setText(mRule.getHash());
- ruleHash.setSummary(mRule.getHash());
- ruleHash.setEnabled(mRule.getHashMethod() == Rule.HASH_METHOD_MANUAL);
- ruleHash.setOnPreferenceChangeListener(mChangeListener);
-
- // Set the test mode
- on = ClonerApp.translate(R.string.rule_readonly_on_summary);
- off = ClonerApp.translate(R.string.rule_readonly_off_summary);
- this.fillCheckBox("ruleReadOnly", mRule.isReadOnly(), on, off, true);
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- // Find out which rule to edit
- Bundle params = this.getIntent().getExtras();
- String ruleId = params.getString("ruleid");
-
- if (ruleId != null && !ruleId.contentEquals("")) {
- // Get the rule
- Settings settings = ClonerApp.getSettings();
- mRule = settings.getRuleById(ruleId);
- if (mRule != null) {
- mNewRule = false;
- }
- }
-
- if (mRule == null) {
- mRule = Settings.createNewRule();
- }
-
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
- this.getActionBar().setTitle(ClonerApp.translate(R.string.rule_activity_title));
- // Edit away
- getFragmentManager().beginTransaction().replace(android.R.id.content, new RuleSettingsFragment()).commit();
- }
-
- @Override
- public void onBackPressed() {
- this.finishActivity(true);
- super.onBackPressed();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // We can only cancel an insert, updates to existing rules are permanent
- // because we directly edit the rule
- if (mNewRule) {
- MenuItem mi = menu.add(ClonerApp.translate(R.string.cancel));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- finishActivity(false);
- return true;
-
- }
- });
- }
-
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.finishActivity(true);
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- private void finishActivity(boolean save) {
- if (save && mChanged) {
- final Settings settings = ClonerApp.getSettings();
- int count = settings.getNumberOfRules();
- if (mNewRule) {
- count++;
- }
- Rule[] rules = new Rule[count];
- for (int index = 0; index < count; index++) {
- rules[index] = settings.getRule(index);
- }
- if (mNewRule) {
- // Append the new rule
- rules[count - 1] = mRule;
- }
- mRule.markDirty();
- settings.setRules(rules, false);
- }
- Intent returnIntent = new Intent();
- returnIntent.putExtra("changed", save && mChanged);
- setResult(RESULT_OK, returnIntent);
- finish();
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleAdapter.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleAdapter.java
deleted file mode 100644
index 6d4ef97..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleAdapter.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.Typeface;
-import android.text.SpannableString;
-import android.text.style.StyleSpan;
-import android.text.style.UnderlineSpan;
-import android.util.SparseArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-public class RuleAdapter extends ArrayAdapter {
- private static int mResourceId = R.layout.rulesrow_layout;
-
- private Bitmap mEmptyBitmap = null;
- private SparseArray mBitmaps = new SparseArray();
- private LayoutInflater mLi = null;
- private Rule[] mRules = null;
- private Resources mResources = null;
-
- public RuleAdapter(Context context, Rule[] rules) {
- super(context, mResourceId, rules);
- mLi = LayoutInflater.from(context);
- mResources = context.getResources();
- mRules = rules;
- }
-
- private Bitmap getBitmap(boolean executed, int executionStatus) {
- if (!executed) {
- if (mEmptyBitmap == null) {
- mEmptyBitmap = BitmapFactory.decodeResource(mResources, R.drawable.status_none);
- }
- return mEmptyBitmap;
- }
- Bitmap result = mBitmaps.get(executionStatus);
- if (result == null) {
- if (executionStatus == RuleExecutor.Result.STATUS_SUCCESS) {
- result = BitmapFactory.decodeResource(mResources, R.drawable.status_success);
- }
- if (executionStatus == RuleExecutor.Result.STATUS_NOT_COMPLETED) {
- result = BitmapFactory.decodeResource(mResources, R.drawable.status_needmoretime);
- }
- if (executionStatus == RuleExecutor.Result.STATUS_FAIL) {
- result = BitmapFactory.decodeResource(mResources, R.drawable.status_fail);
- }
- mBitmaps.put(executionStatus, result);
- }
- return result;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View view = convertView;
- if (view == null) {
- view = mLi.inflate(mResourceId, parent, false);
- }
-
- TextView title = (TextView) view.findViewById(R.id.title);
- TextView subTitle = (TextView) view.findViewById(R.id.subtitle);
- ImageView icon = (ImageView) view.findViewById(R.id.ruleIcon);
- ProgressBar pb = (ProgressBar) view.findViewById(R.id.progressIcon);
-
- if (mRules.length > 0) {
- Rule rule = mRules[position];
- if (rule.isEnabled()) {
- title.setTextColor(Color.WHITE);
- } else {
- title.setTextColor(Color.GRAY);
- }
- if (rule.isReadOnly()) {
- SpannableString str = new SpannableString(rule.getName());
- str.setSpan(new UnderlineSpan(), 0, str.length(), 0);
- str.setSpan(new StyleSpan(Typeface.ITALIC), 0, str.length(), 0);
- title.setText(str);
- } else {
- title.setText(rule.getName());
- }
- if (rule.isExecuting()) {
- icon.setVisibility(View.GONE);
- pb.setVisibility(View.VISIBLE);
- } else {
- icon.setImageBitmap(getBitmap(rule.hasExecuted(), rule.getStatus()));
- pb.setVisibility(View.GONE);
- icon.setVisibility(View.VISIBLE);
- }
- subTitle.setText(rule.getSummary());
- } else {
- title.setText(ClonerApp.translate(R.string.rules_add_new_rule));
- title.setTextColor(Color.WHITE);
- subTitle.setText(ClonerApp.translate(R.string.rules_add_new_rule_info));
- icon.setImageBitmap(getBitmap(false, RuleExecutor.Result.STATUS_FAIL));
- icon.setVisibility(View.VISIBLE);
- pb.setVisibility(View.GONE);
- }
- return view;
- }
-
- @Override
- public int getCount() {
- if (mRules != null) {
- if (mRules.length > 0) {
- return mRules.length;
- }
- }
- return 1;
- }
-
- @Override
- public Rule getItem(int idx) {
- return (mRules != null) ? mRules[idx] : null;
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public boolean hasStableIds() {
- return true;
- }
-
- @Override
- public int getItemViewType(int pos) {
- return 0;
- }
-
- @Override
- public int getViewTypeCount() {
- return 1;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleExecutor.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleExecutor.java
deleted file mode 100644
index 8e908f1..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RuleExecutor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.os.Debug;
-
-public class RuleExecutor {
- public class Result {
- public static final int STATUS_SUCCESS = 0;
- public static final int STATUS_NOT_COMPLETED = 1;
- public static final int STATUS_FAIL = 2;
-
- private final int mStatus;
- private final String mSummary;
-
- public Result(int status, String summary) {
- mStatus = status;
- mSummary = summary;
- }
-
- public int getStatus() {
- return mStatus;
- }
-
- public String getSummary() {
- return mSummary;
- }
- }
-
- private Result run(Rule rule) throws Exception {
- EventProcessor processor = null;
- EventIterator iterator = null;
- if (rule.getMethod() == Rule.METHOD_CLONE) {
- processor = new EventCloner(rule);
- iterator = new DbEventIterator(rule.getLog());
- }
- if (rule.getMethod() == Rule.METHOD_MOVE) {
- processor = new EventMover(rule);
- iterator = new DbEventIterator(rule.getLog());
- }
- if (rule.getMethod() == Rule.METHOD_AGGREGATE) {
- EventAggregator aggregator = new EventAggregator(rule);
- processor = aggregator;
- iterator = new DbInstanceIterator(aggregator.getPeriod(), rule.getLog());
- }
- if (processor == null) {
- return new Result(Result.STATUS_FAIL, "Unknown method");
- }
-
- // Log if rule is in readonly mode
- if (rule.isReadOnly()) {
- rule.getLog().log(
- rule.getLog().createLogLine(ClonerLog.LOG_INFO, "",
- ClonerApp.translate(R.string.cloner_log_executing_readonly_rule)), null);
- }
-
- DbEventIterator.Result result = iterator.execute(processor);
- int status = rule.getLog().getMaxLevel() != ClonerLog.LOG_ERROR ? result.getStatus() : ClonerLog.LOG_ERROR;
- switch (status) {
- case DbEventIterator.Result.STATUS_SUCCESS:
- // Update the source calendar hash in the rule
- rule.clearSrcCalendarHash();
- return new Result(Result.STATUS_SUCCESS, result.getSummary());
- case DbEventIterator.Result.STATUS_NOT_COMPLETED:
- return new Result(Result.STATUS_NOT_COMPLETED, result.getSummary());
- default:
- return new Result(Result.STATUS_FAIL, result.getSummary());
- }
- }
-
- public Result execute(Rule rule) {
- try {
- if (ClonerVersion.isExpired()) {
- return new Result(Result.STATUS_FAIL, ClonerApp.translate(R.string.msg_app_expired));
- }
- if (ClonerApp.PROFILE) {
- Debug.startMethodTracing("ClonerRule " + rule.getName(), 64 * 1024 * 1024);
- // Debug.startAllocCounting();
- }
- return this.run(rule);
- } catch (IllegalStateException e) {
- // Weird stuff happening here. Probably the query is open too long
- // while syncing, so we decide here to leave for now and proceed
- // next iteration
- ClonerLog log = rule.getLog();
- log.stacktrace(e);
- log.log(log.createLogLine(ClonerLog.LOG_ERROR, null,
- ClonerApp.translate(R.string.cloner_state_partially_cloned_info)), null);
- return new Result(Result.STATUS_NOT_COMPLETED, ClonerApp.translate(R.string.cloner_state_partially_cloned)
- + ": " + Utilities.getNowString());
- } catch (Exception e) {
- rule.getLog().stacktrace(e);
- return new Result(Result.STATUS_FAIL, ClonerApp.translate(R.string.log_info_see_rulelog));
- } finally {
- if (ClonerApp.PROFILE) {
- // Debug.stopAllocCounting();
- try {
- Debug.dumpHprofData("/storage/sdcard0/ClonerRule hprof " + rule.getName());
- } catch (Exception e) {
- rule.getLog().stacktrace(e);
- }
- Debug.stopMethodTracing();
- }
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RulesActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RulesActivity.java
deleted file mode 100644
index 7f75dc2..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/RulesActivity.java
+++ /dev/null
@@ -1,361 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.app.AlertDialog;
-import android.app.ListActivity;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MenuItem.OnMenuItemClickListener;
-import android.view.View;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-
-public class RulesActivity extends ListActivity {
- private boolean mPaused = false;
- private Rule[] mRules = null;
-
- private int mRetainedIndex = 0;
- private int mRetainedTop = 0;
-
- private TouchInterceptor mList;
- private TouchInterceptor.DropListener mDropListener = new TouchInterceptor.DropListener() {
- public void drop(int from, int to) {
- // Ignore people that move the helper list item on empy list
- if (mRules.length > 0) {
- // Assuming that item is moved up the list
- int direction = -1;
- int loop_start = from;
- int loop_end = to;
-
- // For instance where the item is dragged down the list
- if (from < to) {
- direction = 1;
- }
-
- // Move the items
- Rule target = mRules[from];
- for (int i = loop_start; i != loop_end; i = i + direction) {
- mRules[i] = mRules[i + direction];
- }
- mRules[to] = target;
-
- RulesActivity.this.saveRules(null);
- ((BaseAdapter) mList.getAdapter()).notifyDataSetChanged();
- }
- }
- };
-
- private Runnable mRuleStatusChangeRunnable = new Runnable() {
- @Override
- public void run() {
- onRuleStatusChange();
- }
- };
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mPaused = false;
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.rulesactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
- this.getActionBar().setTitle(ClonerApp.translate(R.string.rules_activity_title));
- }
-
- @Override
- public void onResume() {
- super.onResume();
- // Clear the log parameter for the LogActivity
- ClonerApp.setParameter("log", null);
-
- // Update view
- this.updateListView();
- if (mPaused) {
- this.restoreTopPosition();
- this.overridePendingTransition(R.anim.animation_enter_left, R.anim.animation_leave_right);
- mPaused = false;
- }
-
- // Register for rule update notifications
- Settings settings = ClonerApp.getSettings();
- settings.registerRuleStatusChangeHandler(mRuleStatusChangeRunnable, true);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mPaused = true;
- this.retainTopPosition();
- Settings settings = ClonerApp.getSettings();
- settings.unregisterRuleStatusChangeHandler(mRuleStatusChangeRunnable);
- }
-
- public void retainTopPosition() {
- mRetainedIndex = mList.getFirstVisiblePosition();
- View v = mList.getChildAt(0);
- mRetainedTop = (v == null) ? 0 : v.getTop();
- }
-
- public void restoreTopPosition() {
- mList.setSelectionFromTop(mRetainedIndex, mRetainedTop);
- }
-
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- if (mRules.length > 0) {
- // Start RuleActivity
- Intent i = new Intent(this, RuleActivity.class);
- i.putExtra("ruleid", mRules[position].getId());
- startActivityForResult(i, 1);
- }
- }
-
- private void onRuleInfoClick(int rulenr) {
- Intent i = new Intent(this, LogActivity.class);
- ClonerApp.setParameter("log", mRules[rulenr].getLog());
- i.putExtra("title", ClonerApp.translate(R.string.rulelog_activity_title));
- startActivity(i);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- Settings settings = ClonerApp.getSettings();
- if (requestCode == 1 && data != null) {
- if (data.getBooleanExtra("changed", false)) {
- settings.notifyRuleStatusChange();
- }
- }
- if (requestCode == 2) {
- settings.notifyRuleStatusChange();
- }
- }
-
- private void removeRule(int ruleIndex) {
- Rule[] rules = new Rule[mRules.length - 1];
- for (int index = 0; index < ruleIndex; index++) {
- rules[index] = mRules[index];
- }
- for (int index = ruleIndex + 1; index < mRules.length; index++) {
- rules[index - 1] = mRules[index];
- }
- mRules = rules;
-
- // Save the rules to preferences and notify changes
- this.saveRules(null);
- updateListView();
- }
-
- private void askUserToRemoveRule(final int ruleIndex) {
- final EventRemover.OnDoneListener listener = new EventRemover.OnDoneListener() {
- @Override
- public void onDone(boolean removed, boolean success, long removeCount, String errorMessage) {
- removeRule(ruleIndex);
- }
- };
-
- DialogInterface.OnClickListener removeRuleClickListener = new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- switch (which) {
- case DialogInterface.BUTTON_POSITIVE:
- // Yes button clicked
- askUserToRemoveRelatedClones(ruleIndex, ClonerApp.translate(R.string.ask_delete_related_clones),
- listener);
- break;
- }
- }
- };
-
- AlertDialog.Builder builder = new AlertDialog.Builder(RulesActivity.this);
- builder.setTitle(mRules[ruleIndex].getName()).setMessage(ClonerApp.translate(R.string.ask_delete_rule))
- .setNegativeButton(ClonerApp.translate(R.string.msg_dont_delete), removeRuleClickListener)
- .setPositiveButton(ClonerApp.translate(R.string.msg_delete), removeRuleClickListener).show();
- }
-
- private void askUserToRemoveRelatedClones(int ruleIndex, String question, EventRemover.OnDoneListener onDoneListener) {
- Settings settings = ClonerApp.getSettings();
- if (!settings.isClonerEnabled()) {
- Rule rule = mRules[ruleIndex];
- if (!rule.isExecuting()) {
- CloneRemover remover = new CloneRemover();
- try {
- remover.init(rule, question);
- remover.setOnDoneListener(onDoneListener);
- remover.execute(this);
- } catch (Exception e) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(ClonerApp.translate(R.string.error_deleting_events))
- .setMessage(e.getClass().getName() + ": " + e.getMessage())
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
- } else {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(ClonerApp.translate(R.string.msg_rule_still_active))
- .setMessage(ClonerApp.translate(R.string.msg_rule_still_active_info))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
- } else {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(ClonerApp.translate(R.string.msg_cloner_still_enabled))
- .setMessage(ClonerApp.translate(R.string.msg_cloner_still_enabled_info))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
- }
-
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
- // If there is only a dummy menu item, exit here
- if (mRules.length == 0) {
- return;
- }
-
- final ListView.AdapterContextMenuInfo info = (ListView.AdapterContextMenuInfo) menuInfo;
- menu.setHeaderTitle(mRules[info.position].getName());
-
- MenuItem mi = menu.add(ClonerApp.translate(R.string.rules_menu_clone_this_rule));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- ClonerApp.getSettings().executeRule(info.position);
- return true;
- }
- });
- mi.setEnabled(ClonerApp.getSettings().isClonerEnabled());
-
- final EventRemover.OnDoneListener listener = new EventRemover.OnDoneListener() {
- @Override
- public void onDone(boolean removed, boolean success, long removeCount, String errorMessage) {
- AlertDialog.Builder builder = new AlertDialog.Builder(RulesActivity.this);
- if (removed) {
- if (success) {
- builder.setTitle(
- ClonerApp.translate(R.string.msg_clones_deleted, new String[] { "" + removeCount }))
- .setMessage(ClonerApp.translate(R.string.msg_clones_deleted_info))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- } else {
- builder.setTitle(ClonerApp.translate(R.string.error_deleting_clones)).setMessage(errorMessage)
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
- }
- }
- };
-
- mi = menu.add(ClonerApp.translate(R.string.rules_menu_delete_related_clones));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- askUserToRemoveRelatedClones(info.position, ClonerApp.translate(R.string.ask_delete_related_clones),
- listener);
- return true;
- }
- });
-
- mi = menu.add(ClonerApp.translate(R.string.rules_menu_delete_rule));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- askUserToRemoveRule(info.position);
- return true;
- }
- });
-
- mi = menu.add(ClonerApp.translate(R.string.rules_menu_rule_log));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem arg0) {
- onRuleInfoClick(info.position);
- return true;
- }
- });
- }
-
- @Override
- public void onBackPressed() {
- this.finish();
- super.onBackPressed();
- }
-
- private void addNewRule() {
- if (ClonerVersion.setNumRules(mRules.length + 1) > mRules.length) {
- Intent i = new Intent(RulesActivity.this, RuleActivity.class);
- i.putExtra("rulenr", -1);
- startActivityForResult(i, 2);
- } else {
- AlertDialog.Builder builder = new AlertDialog.Builder(RulesActivity.this);
- builder.setTitle(ClonerApp.translate(R.string.msg_free_version_limitation))
- .setMessage(
- ClonerApp.translate(R.string.msg_free_version_limitation_info, new String[] { ""
- + ClonerVersion.setNumRules(999999999) }))
- .setPositiveButton(ClonerApp.translate(R.string.ok), null).setCancelable(true).show();
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuItem mi = menu.add(ClonerApp.translate(R.string.rules_menu_add_new_rule));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- addNewRule();
- return true;
- }
- });
-
- mi = menu.add(ClonerApp.translate(R.string.rules_menu_clone_now));
- mi.setOnMenuItemClickListener(new OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- ClonerApp.resync("Clone now");
- return true;
- }
- });
- mi.setEnabled(ClonerApp.getSettings().isClonerEnabled());
-
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.onBackPressed();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- private void updateListView() {
- Settings settings = ClonerApp.getSettings();
- mRules = new Rule[settings.getNumberOfRules()];
- for (int index = 0; index < settings.getNumberOfRules(); index++) {
- mRules[index] = settings.getRule(index);
- }
-
- RuleAdapter adp = new RuleAdapter(this, mRules);
- setListAdapter(adp);
- mList = (TouchInterceptor) getListView();
- mList.setDropListener(mDropListener);
- registerForContextMenu(mList);
- }
-
- private void onRuleStatusChange() {
- final RuleAdapter ra = (RuleAdapter) mList.getAdapter();
- ra.notifyDataSetChanged();
- }
-
- private void saveRules(Rule updatedRule) {
- if (updatedRule != null) {
- updatedRule.markDirty();
- }
- Settings settings = ClonerApp.getSettings();
- settings.setRules(mRules, false);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SelectList.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SelectList.java
deleted file mode 100644
index 10af134..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SelectList.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-public class SelectList {
- private int mCount = 0;
- private int[] mKeys = null;
- private String[] mNames = null;
- private boolean[] mSelected = null;
-
- public SelectList() {
- this.init();
- for (int index = 0; index < this.getCount(); index++) {
- this.selectByIndex(index, false);
- }
- }
-
- public SelectList(boolean allSelected) {
- this.init();
- this.selectAll(allSelected);
- }
-
- public SelectList(String encoded) {
- this.init();
- this.decode(encoded);
- }
-
- protected void init() {
- this.init(new int[] {}, new String[] {});
- }
-
- protected void init(int[] keys, String[] names) {
- mCount = keys.length;
- mKeys = keys;
- mNames = names;
- mSelected = new boolean[mCount];
-
- for (int index = 0; index < mCount; index++) {
- mSelected[index] = false;
- }
- }
-
- public void sort() {
- for (int i = 0; i < mKeys.length - 1; i++) {
- for (int j = i + 1; j < mKeys.length; j++) {
- if (mNames[i].compareTo(mNames[j]) > 0) {
- int key = mKeys[i];
- String name = mNames[i];
- boolean selected = mSelected[i];
- mKeys[i] = mKeys[j];
- mNames[i] = mNames[j];
- mSelected[i] = mSelected[j];
- mKeys[j] = key;
- mNames[j] = name;
- mSelected[j] = selected;
- }
- }
- }
- }
-
- public int getCount() {
- return mCount;
- }
-
- public int getKey(int index) {
- return mKeys[index];
- }
-
- public String getKeyName(int key) {
- for (int index = 0; index < mCount; index++) {
- if (mKeys[index] == key) {
- return mNames[index];
- }
- }
- return "" + key;
- }
-
- public String getKeyNameAndValue(int key) {
- return getKeyName(key) + " (" + key + ")";
- }
-
- public String getName(int index) {
- return mNames[index];
- }
-
- public void selectByKey(int key, boolean selected) {
- for (int index = 0; index < mCount; index++) {
- if (mKeys[index] == key) {
- mSelected[index] = selected;
- }
- }
- }
-
- public void selectByIndex(int index, boolean selected) {
- mSelected[index] = selected;
- }
-
- public void selectAll(boolean allSelected) {
- for (int index = 0; index < mCount; index++) {
- mSelected[index] = allSelected;
- }
- }
-
- public boolean isIndexSelected(int index) {
- return mSelected[index];
- }
-
- public boolean isKeySelected(int key) {
- for (int index = 0; index < mCount; index++) {
- if (mKeys[index] == key) {
- return mSelected[index];
- }
- }
- return false;
- }
-
- public int indexOf(int key) {
- for (int index = 0; index < mCount; index++) {
- if (mKeys[index] == key) {
- return index;
- }
- }
- return -1;
- }
-
- protected void decode(String encoded) {
- if (encoded == null) {
- encoded = "";
- }
-
- if (encoded.length() == mCount) {
- for (int index = 0; index < mCount; index++) {
- mSelected[index] = encoded.substring(index, index + 1).contentEquals("1");
- }
- } else {
- for (int index = 0; index < mCount; index++) {
- mSelected[index] = false;
- }
-
- String[] parts = encoded.split(",");
- for (int partindex = 0; partindex < parts.length; partindex++) {
- String[] elements = parts[partindex].split("=");
- if (elements.length == 2) {
- for (int index = 0; index < mCount; index++) {
- if (elements[0].contentEquals("" + mKeys[index])) {
- mSelected[index] = (elements[1].contentEquals("1"));
- }
- }
- }
- }
- }
- }
-
- public String toString() {
- String result = "";
- for (int index = 0; index < mCount; index++) {
- if (!result.contentEquals("")) {
- result += ",";
- }
- result += mKeys[index] + "=" + (mSelected[index] ? "1" : "0");
- }
- return result;
- }
-
- public int getSelectedCount() {
- int count = 0;
- for (int index = 0; index < mCount; index++) {
- if (mSelected[index]) {
- count++;
- }
- }
- return count;
- }
-
- public int[] getSelectedKeys() {
- int[] result = new int[this.getSelectedCount()];
- int count = 0;
- for (int index = 0; index < mCount; index++) {
- if (mSelected[index]) {
- result[count++] = mKeys[index];
- }
- }
- return result;
- }
-
- public String[] getSelectedNames() {
- String[] result = new String[this.getSelectedCount()];
- int count = 0;
- for (int index = 0; index < mCount; index++) {
- if (mSelected[index]) {
- result[count++] = mNames[index];
- }
- }
- return result;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Settings.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Settings.java
deleted file mode 100644
index b4a30e3..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Settings.java
+++ /dev/null
@@ -1,467 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Map.Entry;
-
-import android.os.Handler;
-import android.provider.CalendarContract.Reminders;
-
-public class Settings {
- private static String RULE_PREFIX = "rule";
- private final HashMap mOnChangeRunnables = new HashMap();
- private final HashMap mOnRuleStatusChangeRunnables = new HashMap();
-
- private final CalendarsTable mCalendarsTable = new CalendarsTable(ClonerApp.getDb(true));
- private boolean mClonerEnabled = false;
- private int mClonerTimeWait = 120;
- private int mLogType = ClonerLog.TYPE_SUMMARY;
- private boolean mLogToLogcat = false;
- private boolean mLogToMemory = true;
- private Rule[] mRules = null;
-
- public void registerRuleStatusChangeHandler(Runnable runnable, boolean runImmediate) {
- mOnRuleStatusChangeRunnables.put(runnable, new Handler());
- if (runImmediate) {
- // Run once
- runnable.run();
- }
- }
-
- public void registerSettingsChangeHandler(Runnable runnable, boolean runImmediate) {
- mOnChangeRunnables.put(runnable, new Handler());
- if (runImmediate) {
- // Run once
- runnable.run();
- }
- }
-
- public void unregisterRuleStatusChangeHandler(Runnable runnable) {
- mOnRuleStatusChangeRunnables.remove(runnable);
- }
-
- public void unregisterSettingsChangeHandler(Runnable runnable) {
- mOnChangeRunnables.remove(runnable);
- }
-
- private void notifySettingsChange(boolean markAllDirty) {
- if (markAllDirty) {
- for (int index = 0; index < mRules.length; index++) {
- mRules[index].markDirty();
- }
- }
- for (Entry entry : mOnChangeRunnables.entrySet()) {
- entry.getValue().post(entry.getKey());
- }
- }
-
- public void notifyRuleStatusChange() {
- for (Entry entry : mOnRuleStatusChangeRunnables.entrySet()) {
- entry.getValue().post(entry.getKey());
- }
- }
-
- public static Rule createNewRule() {
- Rule rule = new Rule();
- rule.setAccessLevels(new AccessLevels(true));
- rule.setAttendeeStatuses(new AttendeeStatuses(true));
- rule.setAvailabilities(new Availabilities(true));
- rule.setEventStatuses(new EventStatuses(true));
- rule.setWeekdays(new Weekdays(true));
- return rule;
- }
-
- private String getCalendarRef(SettingsMap map, int index, String refKey, String uriKey) {
- String ref = map.getString(ruleKey(index, refKey), "");
- if (ref.contentEquals("")) {
- String uri = map.getString(ruleKey(index, uriKey), "");
- ref = CalendarLoader.guessCalendarRefByUri(uri);
- }
- return ref;
- }
-
- private void loadLimitFromMap(SettingsMap map, int type, int defaultLimit) {
- // Load the type limit
- int limit = map.getInt("limit." + type, defaultLimit);
- Limits.setTypeLimit(type, limit);
-
- // Load the type counter
- int count = map.getInt("limit." + type + ".count", 0);
- long startTime = map.getLong("limit." + type + ".startTime", 0);
- Limits.TypeCounter counter = new Limits.TypeCounter();
- counter.setCount(count);
- counter.setStartTime(startTime);
- Limits.setTypeCounter(type, counter);
- }
-
- private void migrateRuleSettings(SettingsMap map, int index, int fromVersion) {
- // Migration fromVersion to fromVersion+1
- if (fromVersion == 1) {
- // Field name migration
- map.put(ruleKey(index, "customTitle"), map.getString(ruleKey(index, "cloneTitle"), ""));
- map.put(ruleKey(index, "customLocation"), map.getString(ruleKey(index, "cloneLocation"), ""));
- map.put(ruleKey(index, "customDescription"), "");
-
- // Move away from detail settings to content settings
- int detail = map.contains(ruleKey(index, "detail")) ? map.getInt(ruleKey(index, "detail"),
- Rule.DETAIL_ALLDETAILS) : map.getInt(ruleKey(index, "action"), Rule.DETAIL_ALLDETAILS);
- map.put(ruleKey(index, "cloneTitle"), detail != Rule.DETAIL_FREEBUSY);
- map.put(ruleKey(index, "cloneLocation"), detail != Rule.DETAIL_FREEBUSY);
- map.put(ruleKey(index, "cloneDescription"), detail == Rule.DETAIL_ALLDETAILS);
-
- map.put(ruleKey(index, "cloneSelfAttendeeStatus"), map.getBoolean(ruleKey(index, "cloneStatus"), false));
- map.put(ruleKey(index, "cloneSelfAttendeeStatusReverse"),
- map.getBoolean(ruleKey(index, "cloneStatusReverse"), false));
- }
- }
-
- public synchronized void loadfromMap(SettingsMap map) {
- mClonerEnabled = map.getBoolean("clonerEnabled", false);
- mClonerTimeWait = map.getInt("clonerTimeWait", 120);
- this.loadLimitFromMap(map, Limits.TYPE_EVENT, 50);
- this.loadLimitFromMap(map, Limits.TYPE_ATTENDEE, 25);
- mLogToLogcat = map.getBoolean("clonerLogToLogcat", false);
- mLogToMemory = map.getBoolean("clonerLogToMemory", true);
- mLogType = map.getInt("clonerLogType", ClonerLog.TYPE_SUMMARY);
-
- // Load all rules from settings
- int numRules = ClonerVersion.setNumRules(map.getInt("numRules", 0));
- mRules = new Rule[numRules];
- for (int index = 0; index < numRules; index++) {
- // Load basic rule settings
- int version = map.getInt(ruleKey(index, "version"), 1);
- for (int fromVersion = version; fromVersion < Rule.CURRENT_RULE_VERSION; fromVersion++) {
- this.migrateRuleSettings(map, index, fromVersion);
- }
- String id = map.getString(ruleKey(index, "id"), "");
- boolean enabled = map.getBoolean(ruleKey(index, "enabled"), true);
- String name = map.getString(ruleKey(index, "name"), "");
- int method = map.getInt(ruleKey(index, "method"), Rule.METHOD_CLONE);
- String srcCalendarRef = this.getCalendarRef(map, index, "srcCalendar", "srcCalendarUri");
- String dstCalendarRef = this.getCalendarRef(map, index, "dstCalendar", "dstCalendarUri");
- String fwdCalendarRef = this.getCalendarRef(map, index, "fwdCalendar", "fwdCalendarUri");
- String srcCalendarHash = map.getString(ruleKey(index, "srcCalendarHash"), "");
- boolean readOnly = map.getBoolean(ruleKey(index, "readOnly"), false);
-
- // Event selection settings
- long eventPeriodBefore = map.getLong(ruleKey(index, "syncWindowBefore"), 365L * 24 * 3600 * 1000);
- long eventPeriodAfter = map.getLong(ruleKey(index, "syncWindowAfter"), 365L * 24 * 3600 * 1000);
- boolean includeClones = map.getBoolean(ruleKey(index, "includeClones"), false);
- boolean useEventFilters = false;
- int eventTypeFilter = map.getInt(ruleKey(index, "eventTypeFilter"), Rule.EVENT_TYPE_ALL);
- String titleMustContain = map.getString(ruleKey(index, "titleMustContain"), "");
- String titleMustNotContain = map.getString(ruleKey(index, "titleMustNotContain"), "");
- String locationMustContain = map.getString(ruleKey(index, "locationMustContain"), "");
- String locationMustNotContain = map.getString(ruleKey(index, "locationMustNotContain"), "");
- String descriptionMustContain = map.getString(ruleKey(index, "descriptionMustContain"), "");
- String descriptionMustNotContain = map.getString(ruleKey(index, "descriptionMustNotContain"), "");
-
- AccessLevels accessLevels = new AccessLevels(true);
- AttendeeStatuses attendeeStatuses = new AttendeeStatuses(true);
- Availabilities availabilities = new Availabilities(true);
- EventStatuses eventStatuses = new EventStatuses(true);
- Weekdays weekdays = new Weekdays(true);
-
- accessLevels.decode(map.getString(ruleKey(index, "accessLevels"), accessLevels.toString()));
-
- if (map.contains(ruleKey(index, "ignoreDeclined"))
- && !map.getBoolean(ruleKey(index, "ignoreDeclined"), true)) {
- useEventFilters = true;
- attendeeStatuses.selectByKey(AttendeeStatuses.ATTENDEE_STATUS_DECLINED, true);
- }
-
- if (map.contains(ruleKey(index, "weekdays"))) {
- weekdays.decode(map.getString(ruleKey(index, "weekdays"), ""));
- boolean allSelected = true;
- for (int i = 0; i < weekdays.getCount(); i++) {
- allSelected &= weekdays.isIndexSelected(i);
- }
- if (!allSelected) {
- // Mark custom selection, will be overwritten below if
- // disabled
- useEventFilters = true;
- }
- }
-
- if (map.contains(ruleKey(index, "useEventFilters")) || map.contains(ruleKey(index, "useEventSelection"))
- || map.contains(ruleKey(index, "customEventSelection"))) {
- useEventFilters = map.getBoolean(
- ruleKey(index, "useEventFilters"),
- map.getBoolean(ruleKey(index, "useEventSelection"),
- map.getBoolean(ruleKey(index, "customEventSelection"), useEventFilters)));
-
- attendeeStatuses.decode(map.getString(ruleKey(index, "attendeeStatuses"), attendeeStatuses.toString()));
- availabilities.decode(map.getString(ruleKey(index, "availabilities"), availabilities.toString()));
- eventStatuses.decode(map.getString(ruleKey(index, "eventStatuses"), eventStatuses.toString()));
- }
-
- // Content settings
- boolean cloneTitle = map.getBoolean(ruleKey(index, "cloneTitle"), true);
- String customTitle = map.getString(ruleKey(index, "customTitle"), "");
- boolean cloneLocation = map.getBoolean(ruleKey(index, "cloneLocation"), true);
- String customLocation = map.getString(ruleKey(index, "customLocation"), "");
- boolean cloneDescription = map.getBoolean(ruleKey(index, "cloneDescription"), true);
- String customDescription = map.getString(ruleKey(index, "customDescription"), "");
- boolean cloneSelfAttendeeStatus = map.getBoolean(ruleKey(index, "cloneSelfAttendeeStatus"), false);
- boolean cloneSelfAttendeeStatusReverse = map.getBoolean(ruleKey(index, "cloneSelfAttendeeStatusReverse"),
- false);
- int reserveBefore = map.getInt(ruleKey(index, "reserveBefore"), 0);
- int reserveAfter = map.getInt(ruleKey(index, "reserveAfter"), 0);
- int customAccessLevel = map.getInt(ruleKey(index, "customAccessLevel"), Rule.CUSTOM_ACCESS_LEVEL_SOURCE);
- int customAvailability = map.getInt(ruleKey(index, "customAvailability"), Rule.CUSTOM_AVAILABILITY_SOURCE);
-
- // Attendee settings
- boolean cloneAttendees = map.getBoolean(ruleKey(index, "cloneAttendees"), false);
- boolean useDummyEmailAddresses = map.getBoolean(ruleKey(index, "useDummyEmailAddresses"), false);
- String dummyEmailDomain = map.getString(ruleKey(index, "dummyEmailDomain"), Rule.DEFAULT_DUMMY_DOMAIN);
- String selfAttendeeName = map.getString(ruleKey(index, "selfAttendeeName"), "");
- boolean attendeesAsText = map.getBoolean(ruleKey(index, "attendeesAsText"), false);
- boolean customAttendee = map.getBoolean(ruleKey(index, "customAttendee"), false);
- String customAttendeeName = map.getString(ruleKey(index, "customAttendeeName"), "");
- String customAttendeeEmail = map.getString(ruleKey(index, "customAttendeeEmail"), "");
-
- // Reminder settings
- boolean cloneReminders = map.getBoolean(ruleKey(index, "cloneReminders"), false);
- boolean customReminder = map.getBoolean(ruleKey(index, "customReminder"), false);
- int customReminderMethod = map.getInt(ruleKey(index, "customReminderMethod"), Reminders.METHOD_DEFAULT);
- int customReminderMinutes = map.getInt(ruleKey(index, "customReminderMinutes"), Reminders.MINUTES_DEFAULT);
-
- // Additional options
- boolean retainClonesOutsideSourceEventWindow = map.getBoolean(
- ruleKey(index, "retainClonesOutsideSourceEventWindow"), false);
-
- // Advanced options
- int hashMethod = map.getInt(ruleKey(index, "hashMethod"), Rule.HASH_METHOD_SOURCE_CALENDAR);
- String hash = map.getString(ruleKey(index, "hash"), "");
-
- // Convert FORWARD to CLONE rules
- if (method == Rule.METHOD_LEGACY_FORWARD) {
- enabled = false;
- method = Rule.METHOD_CLONE;
- DbCalendar fwdCal = CalendarLoader.getCalendarByRef(fwdCalendarRef).getCalendar();
- if (fwdCal != null) {
- customAttendee = true;
- customAttendeeName = fwdCal.getDisplayName();
- customAttendeeEmail = fwdCal.getOwnerAccount();
- }
- }
-
- if (version < Rule.CURRENT_RULE_VERSION) {
- // DO VERSION CONVERSION HERE
- }
-
- // Create the rule
- mRules[index] = new Rule(mCalendarsTable, id, enabled, name, method, srcCalendarRef, dstCalendarRef,
- srcCalendarHash, readOnly, eventPeriodBefore, eventPeriodAfter, includeClones, useEventFilters,
- eventTypeFilter, titleMustContain, titleMustNotContain, locationMustContain,
- locationMustNotContain, descriptionMustContain, descriptionMustNotContain, accessLevels,
- attendeeStatuses, availabilities, eventStatuses, weekdays, cloneTitle, customTitle, cloneLocation,
- customLocation, cloneDescription, customDescription, cloneSelfAttendeeStatus,
- cloneSelfAttendeeStatusReverse, selfAttendeeName, reserveBefore, reserveAfter, customAccessLevel,
- customAvailability, cloneAttendees, useDummyEmailAddresses, dummyEmailDomain, attendeesAsText,
- customAttendee, customAttendeeName, customAttendeeEmail, cloneReminders, customReminder,
- customReminderMethod, customReminderMinutes, retainClonesOutsideSourceEventWindow, hashMethod, hash);
- }
- }
-
- private void saveLimitToMap(SettingsMap map, int type) {
- // Save the type limit
- map.put("limit." + type, Limits.getTypeLimit(type));
-
- // Save the type counter
- Limits.TypeCounter counter = Limits.getTypeCounter(type);
- map.put("limit." + type + ".count", counter.getCount());
- map.put("limit." + type + ".startTime", counter.getStartTime());
- }
-
- public synchronized void saveToMap(SettingsMap map) {
- map.put("clonerEnabled", mClonerEnabled);
- map.put("clonerTimeWait", mClonerTimeWait);
- this.saveLimitToMap(map, Limits.TYPE_EVENT);
- this.saveLimitToMap(map, Limits.TYPE_ATTENDEE);
- map.put("clonerLogToLogcat", mLogToLogcat);
- map.put("clonerLogToMemory", mLogToMemory);
- map.put("clonerLogType", mLogType);
-
- // Save all rules to settings
- int numRules = ClonerVersion.setNumRules(mRules.length);
- for (int index = 0; index < numRules; index++) {
- Rule rule = mRules[index];
- // Basic rule settings
- map.put(ruleKey(index, "id"), rule.getId());
- map.put(ruleKey(index, "version"), rule.getVersion());
- map.put(ruleKey(index, "enabled"), rule.isEnabled());
- map.put(ruleKey(index, "name"), rule.getName());
- map.put(ruleKey(index, "method"), rule.getMethod());
- map.put(ruleKey(index, "srcCalendar"), rule.getSrcCalendarRef());
- map.put(ruleKey(index, "dstCalendar"), rule.getDstCalendarRef());
- map.put(ruleKey(index, "srcCalendarHash"), rule.getSrcCalendarHash());
- map.put(ruleKey(index, "readOnly"), rule.isReadOnly());
-
- // Event filters
- map.put(ruleKey(index, "syncWindowBefore"), rule.getSyncPeriodBefore());
- map.put(ruleKey(index, "syncWindowAfter"), rule.getSyncPeriodAfter());
- map.put(ruleKey(index, "includeClones"), rule.getIncludeClones());
- map.put(ruleKey(index, "useEventFilters"), rule.useEventFilters());
- map.put(ruleKey(index, "eventTypeFilter"), rule.getEventTypeFilter());
- map.put(ruleKey(index, "titleMustContain"), rule.getTitleMustContain());
- map.put(ruleKey(index, "titleMustNotContain"), rule.getTitleMustNotContain());
- map.put(ruleKey(index, "locationMustContain"), rule.getLocationMustContain());
- map.put(ruleKey(index, "locationMustNotContain"), rule.getLocationMustNotContain());
- map.put(ruleKey(index, "descriptionMustContain"), rule.getDescriptionMustContain());
- map.put(ruleKey(index, "descriptionMustNotContain"), rule.getDescriptionMustNotContain());
-
- map.put(ruleKey(index, "accessLevels"), rule.getAccessLevels().toString());
- map.put(ruleKey(index, "attendeeStatuses"), rule.getAttendeeStatuses().toString());
- map.put(ruleKey(index, "availabilities"), rule.getAvailabilities().toString());
- map.put(ruleKey(index, "eventStatuses"), rule.getEventStatuses().toString());
- map.put(ruleKey(index, "weekdays"), rule.getWeekdays().toString());
-
- // Content settings
- map.put(ruleKey(index, "cloneTitle"), rule.getCloneTitle());
- map.put(ruleKey(index, "customTitle"), rule.getCustomTitle());
- map.put(ruleKey(index, "cloneLocation"), rule.getCloneLocation());
- map.put(ruleKey(index, "customLocation"), rule.getCustomLocation());
- map.put(ruleKey(index, "cloneDescription"), rule.getCloneDescription());
- map.put(ruleKey(index, "customDescription"), rule.getCustomDescription());
- map.put(ruleKey(index, "reserveBefore"), rule.getReserveBefore());
- map.put(ruleKey(index, "reserveAfter"), rule.getReserveAfter());
- map.put(ruleKey(index, "customAvailability"), rule.getCustomAvailability());
- map.put(ruleKey(index, "customAccessLevel"), rule.getCustomAccessLevel());
- map.put(ruleKey(index, "cloneSelfAttendeeStatus"), rule.getCloneSelfAttendeeStatus());
- map.put(ruleKey(index, "cloneSelfAttendeeStatusReverse"), rule.getCloneSelfAttendeeStatusReverse());
- map.put(ruleKey(index, "selfAttendeeName"), rule.getSelfAttendeeName());
-
- // Attendee options
- map.put(ruleKey(index, "cloneAttendees"), rule.getCloneAttendees());
- map.put(ruleKey(index, "useDummyEmailAddresses"), rule.getUseDummyEmailAddresses());
- map.put(ruleKey(index, "dummyEmailDomain"), rule.getDummyEmailDomain());
- map.put(ruleKey(index, "attendeesAsText"), rule.getAttendeesAsText());
- map.put(ruleKey(index, "customAttendee"), rule.getCustomAttendee());
- map.put(ruleKey(index, "customAttendeeName"), rule.getCustomAttendeeName());
- map.put(ruleKey(index, "customAttendeeEmail"), rule.getCustomAttendeeEmail());
-
- // Reminder options
- map.put(ruleKey(index, "cloneReminders"), rule.getCloneReminders());
- map.put(ruleKey(index, "customReminder"), rule.getCustomReminder());
- map.put(ruleKey(index, "customReminderMethod"), rule.getCustomReminderMethod());
- map.put(ruleKey(index, "customReminderMinutes"), rule.getCustomReminderMinutes());
-
- // Additional options
- map.put(ruleKey(index, "retainClonesOutsideSourceEventWindow"),
- rule.getRetainClonesOutsideSourceEventWindow());
-
- // Advanced options
- map.put(ruleKey(index, "hashMethod"), rule.getHashMethod());
- map.put(ruleKey(index, "hash"), rule.getHash());
-
- // Legacy key removal
- map.remove(ruleKey(index, "action"));
- map.remove(ruleKey(index, "ignoreDeclined"));
- map.remove(ruleKey(index, "srcCalendarUri"));
- map.remove(ruleKey(index, "dstCalendarUri"));
- map.remove(ruleKey(index, "fwdCalendarUri"));
- map.remove(ruleKey(index, "fwdCalendar"));
- map.remove(ruleKey(index, "useEventSelection"));
-
- // Version 1 key removal
- map.remove(ruleKey(index, "detail"));
- map.remove(ruleKey(index, "cloneStatus"));
- map.remove(ruleKey(index, "cloneStatusReverse"));
- }
- map.put("numRules", numRules);
- }
-
- public int getClonerTimeWait() {
- return mClonerTimeWait;
- }
-
- public int getLogType() {
- return mLogType;
- }
-
- public boolean getLogToLogcat() {
- return mLogToLogcat;
- }
-
- public boolean getLogToMemory() {
- return mLogToMemory;
- }
-
- public int getNumberOfRules() {
- return mRules.length;
- }
-
- public Rule getRule(int index) {
- if (index >= 0 && index < mRules.length) {
- return mRules[index];
- }
- return null;
- }
-
- public Rule getRuleById(String id) {
- for (Rule rule : mRules) {
- if (rule.getId().contentEquals(id)) {
- return rule;
- }
- }
- return null;
- }
-
- public boolean isClonerEnabled() {
- return mClonerEnabled;
- }
-
- private String ruleKey(int index, String key) {
- return RULE_PREFIX + index + "." + key;
- }
-
- public synchronized void setClonerEnabled(boolean enabled) {
- mClonerEnabled = enabled;
- this.notifySettingsChange(true);
- }
-
- public void setClonerTimeWait(int seconds) {
- mClonerTimeWait = seconds;
- this.notifySettingsChange(true);
- }
-
- public synchronized void setRules(Rule[] rules, boolean markAllDirty) {
- int numRules = ClonerVersion.setNumRules(rules.length);
-
- mRules = new Rule[numRules];
- for (int index = 0; index < numRules; index++) {
- mRules[index] = rules[index];
- }
- this.notifySettingsChange(markAllDirty);
- }
-
- public void executeRule(int index) {
- if (index < mRules.length) {
- mRules[index].markDirty();
- this.notifySettingsChange(false);
- }
- }
-
- public boolean setTypeLimit(int type, int limit) {
- if (Limits.setTypeLimit(type, limit)) {
- this.notifySettingsChange(true);
- return true;
- }
- return false;
- }
-
- public void setLogType(int logtype) {
- mLogType = logtype;
- this.notifySettingsChange(false);
- }
-
- public void setLogToLogcat(boolean enabled) {
- mLogToLogcat = enabled;
- this.notifySettingsChange(false);
- }
-
- public void setLogToMemory(boolean enabled) {
- mLogToMemory = enabled;
- this.notifySettingsChange(false);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMap.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMap.java
deleted file mode 100644
index faeeac1..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMap.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class SettingsMap {
- private HashMap mMap = new HashMap();
-
- public boolean contains(String key) {
- return mMap.containsKey(key);
- }
-
- public void clear() {
- mMap.clear();
- }
-
- public boolean getBoolean(String key, boolean defaultValue) {
- String value = mMap.get(key);
- if (value == null) {
- return defaultValue;
- }
- if (value.contentEquals("true")) {
- return true;
- }
- if (value.contentEquals("false")) {
- return false;
- }
- return defaultValue;
- }
-
- public int getInt(String key, int defaultValue) {
- String value = mMap.get(key);
- if (value == null) {
- return defaultValue;
- }
- try {
- return Integer.parseInt(value);
- } catch (Exception e) {
- // Eat
- }
- return defaultValue;
- }
-
- public long getLong(String key, long defaultValue) {
- String value = mMap.get(key);
- if (value == null) {
- return defaultValue;
- }
- try {
- return Long.parseLong(value);
- } catch (Exception e) {
- // Eat
- }
- return defaultValue;
- }
-
- public String getString(String key, String defaultValue) {
- String result = mMap.get(key);
- if (result == null) {
- return defaultValue;
- }
- return result;
- }
-
- public void put(String key, boolean value) {
- this.put(key, value ? "true" : "false");
- }
-
- public void put(String key, int value) {
- this.put(key, "" + value);
- }
-
- public void put(String key, long value) {
- this.put(key, "" + value);
- }
-
- public void put(String key, String value) {
- mMap.put(key, value);
- }
-
- public Map getAll() {
- return mMap;
- }
-
- public void remove(String key) {
- mMap.remove(key);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMapStreamer.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMapStreamer.java
deleted file mode 100644
index 8b3764f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/SettingsMapStreamer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.Map;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-
-public class SettingsMapStreamer {
- public static synchronized SettingsMap loadFromSharedPrefs(Context context) {
- SettingsMap result = new SettingsMap();
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
-
- for (Map.Entry entry : prefs.getAll().entrySet()) {
- result.put(entry.getKey(), entry.getValue().toString());
- }
-
- return result;
- }
-
- public static synchronized SettingsMap loadFromFile(String filename) {
- try {
- SettingsMap result = new SettingsMap();
- File file = new File(Environment.getExternalStorageDirectory(), filename);
-
- FileReader fr = new FileReader(file);
- BufferedReader buffer = new BufferedReader(fr);
- String line = buffer.readLine();
- while (line != null) {
- int pos = line.indexOf("=");
- if (pos >= 0) {
- String key = line.substring(0, pos);
- String value = line.substring(pos + 1, line.length());
- result.put(key, value);
- }
- line = buffer.readLine();
- }
- buffer.close();
- return result;
- } catch (Exception e) {
- return null;
- }
- }
-
- public static synchronized boolean saveToSharedPrefs(Context context, SettingsMap map) {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- try {
- Editor edit = prefs.edit();
- for (Map.Entry entry : map.getAll().entrySet()) {
- edit.putString(entry.getKey(), entry.getValue());
- }
- edit.commit();
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- public static synchronized boolean saveToFile(String filename, SettingsMap map) {
- try {
- File file = new File(Environment.getExternalStorageDirectory(), filename);
- FileWriter fw = new FileWriter(file);
- PrintWriter pw = new PrintWriter(fw);
-
- Map mapping = map.getAll();
- String[] keys = mapping.keySet().toArray(new String[] { "" });
- for (int i = 0; i < keys.length - 1; i++) {
- for (int j = i + 1; j < keys.length; j++) {
- if (keys[j].compareTo(keys[i]) < 0) {
- String temp = keys[i];
- keys[i] = keys[j];
- keys[j] = temp;
- }
- }
- }
-
- for (String key : keys) {
- pw.println(key + "=" + mapping.get(key));
- }
-
- pw.close();
- fw.close();
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/StartupReceiver.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/StartupReceiver.java
deleted file mode 100644
index d89b59e..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/StartupReceiver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-public class StartupReceiver extends BroadcastReceiver {
- private static boolean mStartupReceived = false;
-
- public static boolean startupReceived() {
- return mStartupReceived;
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- mStartupReceived = true;
- Intent serviceIntent = new Intent(context, ClonerService.class);
- context.startService(serviceIntent);
- }
-
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TextViewActivity.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TextViewActivity.java
deleted file mode 100644
index 709e0d0..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TextViewActivity.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.widget.TextView;
-
-public class TextViewActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.overridePendingTransition(R.anim.animation_enter_right, R.anim.animation_leave_left);
- setContentView(R.layout.textviewactivity_layout);
- this.getActionBar().setDisplayHomeAsUpEnabled(true);
-
- Bundle params = this.getIntent().getExtras();
- String title = params.getString("title");
- String text = params.getString("text");
-
- this.getActionBar().setTitle(title);
- TextView tv = (TextView) findViewById(R.id.tvTitle);
- tv.setText(title);
- tv = (TextView) findViewById(R.id.tvText);
- tv.setText(text);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // app icon in action bar clicked; go back
- this.finish();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TouchInterceptor.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TouchInterceptor.java
deleted file mode 100644
index 40b0a11..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/TouchInterceptor.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.dizzl.android.CalendarClonerFree;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.GestureDetector;
-import android.view.Gravity;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.AdapterView;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-
-public class TouchInterceptor extends ListView {
- private ImageView mDragView;
- private WindowManager mWindowManager;
- private WindowManager.LayoutParams mWindowParams;
- /**
- * At which position is the item currently being dragged. Note that this takes into account header items.
- */
- private int mDragPos;
- /**
- * At which position was the item being dragged originally
- */
- private int mSrcDragPos;
- private int mDragPointX; // at what x offset inside the item did the user grab it
- private int mDragPointY; // at what y offset inside the item did the user grab it
- private int mXOffset; // the difference between screen coordinates and coordinates in this view
- private int mYOffset; // the difference between screen coordinates and coordinates in this view
- private DragListener mDragListener;
- private DropListener mDropListener;
- private int mUpperBound;
- private int mLowerBound;
- private int mHeight;
- private GestureDetector mGestureDetector;
- private Rect mTempRect = new Rect();
- private Bitmap mDragBitmap;
- private final int mTouchSlop;
- private int mItemHeightNormal;
- private int mItemHeightExpanded;
- private int mItemHeightHalf;
-
- public TouchInterceptor(Context context, AttributeSet attrs) {
- super(context, attrs);
- mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
- Resources res = getResources();
- mItemHeightNormal = res.getDimensionPixelSize(R.dimen.normal_height);
- mItemHeightHalf = mItemHeightNormal / 2;
- mItemHeightExpanded = res.getDimensionPixelSize(R.dimen.expanded_height);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (mDragListener != null || mDropListener != null) {
- switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- int x = (int) ev.getX();
- int y = (int) ev.getY();
- int itemnum = pointToPosition(x, y);
- if (itemnum == AdapterView.INVALID_POSITION) {
- break;
- }
- LinearLayout item = (LinearLayout) getChildAt(itemnum - getFirstVisiblePosition());
- mDragPointX = x - item.getLeft();
- mDragPointY = y - item.getTop();
- mXOffset = ((int) ev.getRawX()) - x;
- mYOffset = ((int) ev.getRawY()) - y;
- // The right side of the item is the grabber for dragging the
- // item
- if (item.getRight() - x < 100) {
- // Invalidate the item's cache (prevents drawing old rows)
- item.invalidate();
- item.setDrawingCacheEnabled(true);
- // Create a copy of the drawing cache so that it does not
- // get recycled by the framework when the list tries to
- // clean up memory
- Bitmap bitmap = Bitmap.createBitmap(item.getDrawingCache());
- startDragging(bitmap, x, y);
- mDragPos = itemnum;
- mSrcDragPos = mDragPos;
- mHeight = getHeight();
- int touchSlop = mTouchSlop;
- mUpperBound = Math.min(y - touchSlop, mHeight / 3);
- mLowerBound = Math.max(y + touchSlop, mHeight * 2 / 3);
- return false;
- }
- stopDragging();
- break;
- }
- }
- return super.onInterceptTouchEvent(ev);
- }
-
- /*
- * pointToPosition() doesn't consider invisible views, but we need to, so implement a slightly different version.
- */
- private int myPointToPosition(int x, int y) {
-
- if (y < 0) {
- // when dragging off the top of the screen, calculate position by going back from a visible item
- int pos = myPointToPosition(x, y + mItemHeightNormal);
- if (pos > 0) {
- return pos - 1;
- }
- }
-
- Rect frame = mTempRect;
- final int count = getChildCount();
- for (int i = count - 1; i >= 0; i--) {
- final View child = getChildAt(i);
- child.getHitRect(frame);
- if (frame.contains(x, y)) {
- return getFirstVisiblePosition() + i;
- }
- }
- return INVALID_POSITION;
- }
-
- private int getItemForPosition(int y) {
- int adjustedy = y - mDragPointY - mItemHeightHalf;
- int pos = myPointToPosition(0, adjustedy);
- if (pos >= 0) {
- if (pos <= mSrcDragPos) {
- pos += 1;
- }
- } else if (adjustedy < 0) {
- // this shouldn't happen anymore now that myPointToPosition deals with this situation
- pos = 0;
- }
- return pos;
- }
-
- private void adjustScrollBounds(int y) {
- if (y >= mHeight / 3) {
- mUpperBound = mHeight / 3;
- }
- if (y <= mHeight * 2 / 3) {
- mLowerBound = mHeight * 2 / 3;
- }
- }
-
- /*
- * Restore size and visibility for all listitems
- */
- private void unExpandViews(boolean deletion) {
- for (int i = 0;; i++) {
- View v = getChildAt(i);
- if (v == null) {
- if (deletion) {
- // HACK force update of mItemCount
- int position = getFirstVisiblePosition();
- int y = getChildAt(0).getTop();
- setAdapter(getAdapter());
- setSelectionFromTop(position, y);
- // end hack
- }
- try {
- layoutChildren(); // force children to be recreated where needed
- v = getChildAt(i);
- } catch (IllegalStateException ex) {
- // layoutChildren throws this sometimes, presumably because we're in the process of being torn down
- // but are still getting touch
- // events
- }
- if (v == null) {
- return;
- }
- }
- ViewGroup.LayoutParams params = v.getLayoutParams();
- params.height = mItemHeightNormal;
- v.setLayoutParams(params);
- v.setVisibility(View.VISIBLE);
- }
- }
-
- /*
- * Adjust visibility and size to make it appear as though an item is being dragged around and other items are making
- * room for it: If dropping the item would result in it still being in the same place, then make the dragged
- * listitem's size normal, but make the item invisible. Otherwise, if the dragged listitem is still on screen, make
- * it as small as possible and expand the item below the insert point. If the dragged item is not on screen, only
- * expand the item below the current insertpoint.
- */
- @SuppressWarnings("unused")
- private void doExpansion() {
- int childnum = mDragPos - getFirstVisiblePosition();
- if (mDragPos > mSrcDragPos) {
- childnum++;
- }
- int numheaders = getHeaderViewsCount();
-
- View first = getChildAt(mSrcDragPos - getFirstVisiblePosition());
- for (int i = 0;; i++) {
- View vv = getChildAt(i);
- if (vv == null) {
- break;
- }
-
- int height = mItemHeightNormal;
- int visibility = View.VISIBLE;
- if (mDragPos < numheaders && i == numheaders) {
- // dragging on top of the header item, so adjust the item below
- // instead
- if (vv.equals(first)) {
- visibility = View.INVISIBLE;
- } else {
- height = mItemHeightExpanded;
- }
- } else if (vv.equals(first)) {
- // processing the item that is being dragged
- if (mDragPos == mSrcDragPos || getPositionForView(vv) == getCount() - 1) {
- // hovering over the original location
- visibility = View.INVISIBLE;
- } else {
- // not hovering over it
- // Ideally the item would be completely gone, but neither
- // setting its size to 0 nor settings visibility to GONE
- // has the desired effect.
- height = 1;
- }
- } else if (i == childnum) {
- if (mDragPos >= numheaders && mDragPos < getCount() - 1) {
- height = mItemHeightExpanded;
- }
- }
- ViewGroup.LayoutParams params = vv.getLayoutParams();
- params.height = height;
- vv.setLayoutParams(params);
- vv.setVisibility(visibility);
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (mGestureDetector != null) {
- mGestureDetector.onTouchEvent(ev);
- }
- if ((mDragListener != null || mDropListener != null) && mDragView != null) {
- int action = ev.getAction();
- switch (action) {
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- Rect r = mTempRect;
- mDragView.getDrawingRect(r);
- stopDragging();
- if (mDropListener != null && mDragPos >= 0 && mDragPos < getCount()) {
- mDropListener.drop(mSrcDragPos, mDragPos);
- }
- unExpandViews(false);
- break;
-
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_MOVE:
- int x = (int) ev.getX();
- int y = (int) ev.getY();
- dragView(x, y);
- int itemnum = getItemForPosition(y);
- if (itemnum >= 0) {
- if (action == MotionEvent.ACTION_DOWN || itemnum != mDragPos) {
- if (mDragListener != null) {
- mDragListener.drag(mDragPos, itemnum);
- }
- mDragPos = itemnum;
- // doExpansion();
- }
- int speed = 0;
- adjustScrollBounds(y);
- if (y > mLowerBound) {
- // scroll the list up a bit
- if (getLastVisiblePosition() < getCount() - 1) {
- speed = y > (mHeight + mLowerBound) / 2 ? 16 : 4;
- } else {
- speed = 1;
- }
- } else if (y < mUpperBound) {
- // scroll the list down a bit
- speed = y < mUpperBound / 2 ? -16 : -4;
- if (getFirstVisiblePosition() == 0 && getChildAt(0).getTop() >= getPaddingTop()) {
- // if we're already at the top, don't try to scroll, because it causes the framework to do
- // some extra drawing that messes up our animation
- speed = 0;
- }
- }
- if (speed != 0) {
- smoothScrollBy(speed, 30);
- }
- }
- break;
- }
- return true;
- }
- return super.onTouchEvent(ev);
- }
-
- private void startDragging(Bitmap bm, int x, int y) {
- stopDragging();
-
- mWindowParams = new WindowManager.LayoutParams();
- mWindowParams.gravity = Gravity.TOP | Gravity.LEFT;
- mWindowParams.x = x - mDragPointX + mXOffset;
- mWindowParams.y = y - mDragPointY + mYOffset;
-
- mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
- mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
- mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
- | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
- mWindowParams.format = PixelFormat.TRANSLUCENT;
- mWindowParams.windowAnimations = 0;
-
- mWindowParams.alpha = 0.5f;
-
- Context context = getContext();
- ImageView v = new ImageView(context);
- // int backGroundColor =
- // context.getResources().getColor(R.color.dragndrop_background);
- // v.setBackgroundColor(backGroundColor);
- // v.setBackgroundResource(R.drawable.playlist_tile_drag);
- v.setPadding(0, 0, 0, 0);
- v.setImageBitmap(bm);
- mDragBitmap = bm;
-
- mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- mWindowManager.addView(v, mWindowParams);
- mDragView = v;
- }
-
- private void dragView(int x, int y) {
- mWindowParams.x = 0;
- mWindowParams.y = y - mDragPointY + mYOffset;
- mWindowManager.updateViewLayout(mDragView, mWindowParams);
- }
-
- private void stopDragging() {
- if (mDragView != null) {
- mDragView.setVisibility(GONE);
- WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
- wm.removeView(mDragView);
- mDragView.setImageDrawable(null);
- mDragView = null;
- }
- if (mDragBitmap != null) {
- mDragBitmap.recycle();
- mDragBitmap = null;
- }
- }
-
- public void setDragListener(DragListener l) {
- mDragListener = l;
- }
-
- public void setDropListener(DropListener l) {
- mDropListener = l;
- }
-
- public interface DragListener {
- void drag(int from, int to);
- }
-
- public interface DropListener {
- void drop(int from, int to);
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Utilities.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Utilities.java
deleted file mode 100644
index add13af..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Utilities.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-import android.annotation.SuppressLint;
-
-public class Utilities {
- // Set infinity to approximately 500 years in milliseconds
- public static long INFINITY_MILLIS = 500L * 365 * 24 * 60 * 60 * 1000;
- public static DateTime INFINITY = new DateTime(INFINITY_MILLIS);
-
- // Last date formatter
- private static DateTimeFormatter mFormatter = null;
- private static String mLastFormat = null;
-
- public static String emptyWhenNull(String value) {
- return value != null ? value : "";
- }
-
- @SuppressLint("SimpleDateFormat")
- public static String dateTimeToString(String format, DateTime time) {
- // Check to see if we need to get a new formatter
- if (mLastFormat == null || mLastFormat != format || mFormatter == null) {
- // Create a DateFormatter object for displaying date in specified
- // format.
- mFormatter = DateTimeFormat.forPattern(format);
- mLastFormat = format;
- }
- return mFormatter.print(time);
- }
-
- public static String dateTimeToString(DateTime time) {
- return dateTimeToString(ClonerApp.translate(R.string.dateformat), time);
- }
-
- public static String dateTimeToTimeString(DateTime time) {
- return dateTimeToString("yyyyMMdd", time) + "T" + dateTimeToString("HHmmssSSS", time);
- }
-
- public static String getNowString() {
- // Finally, return in text what we've just done
- return dateTimeToString(new DateTime());
- }
-
- public static int getSelectionFromArray(int[] possibleValues, int value, int defaultValue) {
- for (int index = 0; index < possibleValues.length; index++) {
- if (value == possibleValues[index]) {
- return value;
- }
- }
- return defaultValue;
- }
-
- public static long getSelectionFromArray(long[] possibleValues, long value, long defaultValue) {
- for (int index = 0; index < possibleValues.length; index++) {
- if (value == possibleValues[index]) {
- return value;
- }
- }
- return defaultValue;
- }
-
- public static String appendToString(String prefix, boolean condition, String postfix) {
- if (condition) {
- if (prefix != null && !prefix.contentEquals("")) {
- prefix += ", ";
- }
- return prefix + postfix;
- }
- return prefix;
- }
-}
diff --git a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Weekdays.java b/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Weekdays.java
deleted file mode 100644
index 7155d6f..0000000
--- a/CalendarCloner FREE/src/com/dizzl/android/CalendarClonerFree/Weekdays.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.dizzl.android.CalendarClonerFree;
-
-import java.util.Calendar;
-
-public class Weekdays extends SelectList {
- public static final int MONDAY = Calendar.MONDAY;
- public static final int TUESDAY = Calendar.TUESDAY;
- public static final int WEDNESDAY = Calendar.WEDNESDAY;
- public static final int THURSDAY = Calendar.THURSDAY;
- public static final int FRIDAY = Calendar.FRIDAY;
- public static final int SATURDAY = Calendar.SATURDAY;
- public static final int SUNDAY = Calendar.SUNDAY;
-
- public static final int[] mKeys = new int[] { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY };
- public static final String[] mNames = new String[] { ClonerApp.translate(R.string.weekday_monday),
- ClonerApp.translate(R.string.weekday_tuesday), ClonerApp.translate(R.string.weekday_wednesday),
- ClonerApp.translate(R.string.weekday_thursday), ClonerApp.translate(R.string.weekday_friday),
- ClonerApp.translate(R.string.weekday_saturday), ClonerApp.translate(R.string.weekday_sunday) };
-
- public Weekdays(boolean sunday, boolean monday, boolean tuesday, boolean wednesday, boolean thursday,
- boolean friday, boolean saturday) {
- super();
- this.selectByKey(SUNDAY, sunday);
- this.selectByKey(MONDAY, monday);
- this.selectByKey(TUESDAY, tuesday);
- this.selectByKey(WEDNESDAY, wednesday);
- this.selectByKey(THURSDAY, thursday);
- this.selectByKey(FRIDAY, friday);
- this.selectByKey(SATURDAY, saturday);
- }
-
- public Weekdays(boolean allSelected) {
- super(allSelected);
- }
-
- public Weekdays clone() {
- Weekdays other = new Weekdays(false);
- other.decode(this.toString());
- return other;
- }
-
- @Override
- protected void init() {
- this.init(mKeys, mNames);
- }
-
- @Override
- protected void decode(String encoded) {
- if (encoded == null) {
- encoded = "";
- }
-
- if (encoded.length() == 7) {
- int[] keys = new int[] { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY };
- for (int index = 0; index < 7; index++) {
- this.selectByKey(keys[index], encoded.substring(index, index + 1).contentEquals("1"));
- }
- } else {
- super.decode(encoded);
- }
- }
-}