diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5bc55d0..75c1ad4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -65,7 +65,7 @@ android:value=".Search" /> @@ -124,7 +124,7 @@ android:enabled="true" > - + @@ -133,7 +133,8 @@ + android:theme="@android:style/Theme.NoTitleBar" + android:screenOrientation="portrait" > diff --git a/UML/DefaultView.ucls b/UML/DefaultView.ucls index 2bd195d..a9e2caf 100644 --- a/UML/DefaultView.ucls +++ b/UML/DefaultView.ucls @@ -29,7 +29,7 @@ - - @@ -71,7 +71,7 @@ - @@ -81,7 +81,7 @@ - - diff --git a/UML/ModifyEvent.ucls b/UML/ModifyEvent.ucls index a50b097..48b2176 100644 --- a/UML/ModifyEvent.ucls +++ b/UML/ModifyEvent.ucls @@ -39,7 +39,7 @@ - diff --git a/UML/Search.ucls b/UML/Search.ucls index 54072f4..c4fc1b5 100644 --- a/UML/Search.ucls +++ b/UML/Search.ucls @@ -1,8 +1,8 @@ - + diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml index 5bc55d0..75c1ad4 100644 --- a/bin/AndroidManifest.xml +++ b/bin/AndroidManifest.xml @@ -65,7 +65,7 @@ android:value=".Search" /> @@ -124,7 +124,7 @@ android:enabled="true" > - + @@ -133,7 +133,8 @@ + android:theme="@android:style/Theme.NoTitleBar" + android:screenOrientation="portrait" > diff --git a/bin/EventCal.apk b/bin/EventCal.apk index 6fc0289..1b5d42d 100644 Binary files a/bin/EventCal.apk and b/bin/EventCal.apk differ diff --git a/bin/R.txt b/bin/R.txt index 10ebefc..f4ed77f 100644 --- a/bin/R.txt +++ b/bin/R.txt @@ -230,32 +230,33 @@ int drawable ic_action_google_event 0x7f020046 int drawable ic_action_personal 0x7f020047 int drawable ic_action_uw_event 0x7f020048 int drawable ic_launcher 0x7f020049 -int drawable lighter 0x7f02004a -int drawable navigation_back 0x7f02004b -int drawable navigation_forward 0x7f02004c -int drawable nine 0x7f02004d -int drawable nine_pm 0x7f02004e -int drawable one 0x7f02004f -int drawable one_pm 0x7f020050 -int drawable seven 0x7f020051 -int drawable seven_pm 0x7f020052 -int drawable six 0x7f020053 -int drawable six_pm 0x7f020054 -int drawable ten 0x7f020055 -int drawable ten_pm 0x7f020056 -int drawable three 0x7f020057 -int drawable three_pm 0x7f020058 -int drawable twelve 0x7f020059 -int drawable twelve_pm 0x7f02005a -int drawable two 0x7f02005b -int drawable two_pm 0x7f02005c -int drawable vpi__tab_indicator 0x7f02005d -int drawable vpi__tab_selected_focused_holo 0x7f02005e -int drawable vpi__tab_selected_holo 0x7f02005f -int drawable vpi__tab_selected_pressed_holo 0x7f020060 -int drawable vpi__tab_unselected_focused_holo 0x7f020061 -int drawable vpi__tab_unselected_holo 0x7f020062 -int drawable vpi__tab_unselected_pressed_holo 0x7f020063 +int drawable ic_stat_alerts 0x7f02004a +int drawable lighter 0x7f02004b +int drawable navigation_back 0x7f02004c +int drawable navigation_forward 0x7f02004d +int drawable nine 0x7f02004e +int drawable nine_pm 0x7f02004f +int drawable one 0x7f020050 +int drawable one_pm 0x7f020051 +int drawable seven 0x7f020052 +int drawable seven_pm 0x7f020053 +int drawable six 0x7f020054 +int drawable six_pm 0x7f020055 +int drawable ten 0x7f020056 +int drawable ten_pm 0x7f020057 +int drawable three 0x7f020058 +int drawable three_pm 0x7f020059 +int drawable twelve 0x7f02005a +int drawable twelve_pm 0x7f02005b +int drawable two 0x7f02005c +int drawable two_pm 0x7f02005d +int drawable vpi__tab_indicator 0x7f02005e +int drawable vpi__tab_selected_focused_holo 0x7f02005f +int drawable vpi__tab_selected_holo 0x7f020060 +int drawable vpi__tab_selected_pressed_holo 0x7f020061 +int drawable vpi__tab_unselected_focused_holo 0x7f020062 +int drawable vpi__tab_unselected_holo 0x7f020063 +int drawable vpi__tab_unselected_pressed_holo 0x7f020064 int id action_goto 0x7f06004d int id action_settings 0x7f06004c int id bottom 0x7f060009 diff --git a/bin/classes.dex b/bin/classes.dex index 47da04d..3a1ee56 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$1.class b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$1.class index d757ca9..846b04d 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$1.class and b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$1.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$2.class b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$2.class index 8cc2a9c..b0bef65 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$2.class and b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$2.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$3.class b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$3.class index 307ca4c..c131d53 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$3.class and b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity$3.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity.class b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity.class index 7b7ad56..e0d068e 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity.class and b/bin/classes/cs/softwarearchitecture/eventcal/AgendaActivity.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.class b/bin/classes/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.class index 6d209a8..bb410b1 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.class and b/bin/classes/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncAlarmRunner.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncAlarmRunner.class index a1cc0d9..afc0737 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncAlarmRunner.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncAlarmRunner.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncServiceRunner.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncServiceRunner.class index 1741b8b..387c783 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncServiceRunner.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$AsyncServiceRunner.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$CalendarPagerAdapter.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$CalendarPagerAdapter.class index 778e817..3f9e17d 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$CalendarPagerAdapter.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$CalendarPagerAdapter.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment$1.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment$1.class index aa3e980..56fbe24 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment$1.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment$1.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment.class index f98c711..dd7a9d8 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView$DayViewFragment.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView.class b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView.class index fbcc6a2..ec5f6a5 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/DefaultView.class and b/bin/classes/cs/softwarearchitecture/eventcal/DefaultView.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$1.class b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$1.class index 0466e94..9c8a1b4 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$1.class and b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$1.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$EventListAdapter.class b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$EventListAdapter.class index b2774e2..99a6a73 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$EventListAdapter.class and b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity$EventListAdapter.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity.class b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity.class index 1614431..7439b31 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity.class and b/bin/classes/cs/softwarearchitecture/eventcal/MonthActivity.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$id.class b/bin/classes/cs/softwarearchitecture/eventcal/R$id.class index e3d7e2e..0a69b64 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$id.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$id.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$integer.class b/bin/classes/cs/softwarearchitecture/eventcal/R$integer.class index 1fc8047..f82a0d4 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$integer.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$integer.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$layout.class b/bin/classes/cs/softwarearchitecture/eventcal/R$layout.class index 87e6754..024cd90 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$layout.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$layout.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$menu.class b/bin/classes/cs/softwarearchitecture/eventcal/R$menu.class index bb64613..b8ab1e9 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$menu.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$menu.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$string.class b/bin/classes/cs/softwarearchitecture/eventcal/R$string.class index d3f6338..41d1161 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$string.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$string.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$style.class b/bin/classes/cs/softwarearchitecture/eventcal/R$style.class index b3a7ec1..6b8570a 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$style.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$style.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$styleable.class b/bin/classes/cs/softwarearchitecture/eventcal/R$styleable.class index 1bef09b..f9dfdeb 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$styleable.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$styleable.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/R$xml.class b/bin/classes/cs/softwarearchitecture/eventcal/R$xml.class index 10b251c..063e2cd 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/R$xml.class and b/bin/classes/cs/softwarearchitecture/eventcal/R$xml.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/Search.class b/bin/classes/cs/softwarearchitecture/eventcal/Search.class index c72e9fb..3105f07 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/Search.class and b/bin/classes/cs/softwarearchitecture/eventcal/Search.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LoginDialogListener.class b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LoginDialogListener.class index 7ac8fe5..818a439 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LoginDialogListener.class and b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LoginDialogListener.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LogoutRequestListener.class b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LogoutRequestListener.class index 1841ca4..0795bd1 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LogoutRequestListener.class and b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity$LogoutRequestListener.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity.class b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity.class index eed96a1..ed91060 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity.class and b/bin/classes/cs/softwarearchitecture/eventcal/SettingsActivity.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.class b/bin/classes/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.class index 8defe8e..9cd89e0 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.class and b/bin/classes/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$1.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$1.class index 1d22505..ca59eed 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$1.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$1.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$2.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$2.class index 8cb443c..425be86 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$2.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent$2.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent.class index ea56422..1216287 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/AddEvent.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$1.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$1.class index 680d13a..1a153a5 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$1.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$1.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$2.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$2.class index 0fa972d..682cd45 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$2.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent$2.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent.class b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent.class index 29e1c18..1edfa38 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent.class and b/bin/classes/cs/softwarearchitecture/eventcal/modify/EditEvent.class differ diff --git a/bin/classes/cs/softwarearchitecture/eventcal/services/FacebookService$EventRequenstListener.class b/bin/classes/cs/softwarearchitecture/eventcal/services/FacebookService$EventRequenstListener.class index a914941..b521ed1 100644 Binary files a/bin/classes/cs/softwarearchitecture/eventcal/services/FacebookService$EventRequenstListener.class and b/bin/classes/cs/softwarearchitecture/eventcal/services/FacebookService$EventRequenstListener.class differ diff --git a/bin/dexedLibs/facebooksdk-8a96b4ad08b6667d27a21d33a1e35f5a.jar b/bin/dexedLibs/facebooksdk-8a96b4ad08b6667d27a21d33a1e35f5a.jar index 5e69ecc..586a1c4 100644 Binary files a/bin/dexedLibs/facebooksdk-8a96b4ad08b6667d27a21d33a1e35f5a.jar and b/bin/dexedLibs/facebooksdk-8a96b4ad08b6667d27a21d33a1e35f5a.jar differ diff --git a/bin/dexedLibs/google-play-services_lib-d39019ac62e2420196d4ffcb9bab70fc.jar b/bin/dexedLibs/google-play-services_lib-d39019ac62e2420196d4ffcb9bab70fc.jar index b8eed8e..498f8e1 100644 Binary files a/bin/dexedLibs/google-play-services_lib-d39019ac62e2420196d4ffcb9bab70fc.jar and b/bin/dexedLibs/google-play-services_lib-d39019ac62e2420196d4ffcb9bab70fc.jar differ diff --git a/bin/dexedLibs/library-3e971dced1ece8da5f5f108d1f751ec1.jar b/bin/dexedLibs/library-3e971dced1ece8da5f5f108d1f751ec1.jar index 2e5e3bf..24b5dce 100644 Binary files a/bin/dexedLibs/library-3e971dced1ece8da5f5f108d1f751ec1.jar and b/bin/dexedLibs/library-3e971dced1ece8da5f5f108d1f751ec1.jar differ diff --git a/bin/eventcal.jar b/bin/eventcal.jar new file mode 100644 index 0000000..375fdcb Binary files /dev/null and b/bin/eventcal.jar differ diff --git a/bin/res/drawable-hdpi/ic_stat_alerts.png b/bin/res/drawable-hdpi/ic_stat_alerts.png new file mode 100644 index 0000000..77112b0 Binary files /dev/null and b/bin/res/drawable-hdpi/ic_stat_alerts.png differ diff --git a/bin/res/drawable-mdpi/ic_stat_alerts.png b/bin/res/drawable-mdpi/ic_stat_alerts.png new file mode 100644 index 0000000..936cbfd Binary files /dev/null and b/bin/res/drawable-mdpi/ic_stat_alerts.png differ diff --git a/bin/res/drawable-xhdpi/ic_stat_alerts.png b/bin/res/drawable-xhdpi/ic_stat_alerts.png new file mode 100644 index 0000000..6f60923 Binary files /dev/null and b/bin/res/drawable-xhdpi/ic_stat_alerts.png differ diff --git a/bin/res/drawable-xxhdpi/ic_stat_alerts.png b/bin/res/drawable-xxhdpi/ic_stat_alerts.png new file mode 100644 index 0000000..3181025 Binary files /dev/null and b/bin/res/drawable-xxhdpi/ic_stat_alerts.png differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index 514c50d..8ccfcc5 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/gen/cs/softwarearchitecture/eventcal/R.java b/gen/cs/softwarearchitecture/eventcal/R.java index d7c7e39..7020f90 100644 --- a/gen/cs/softwarearchitecture/eventcal/R.java +++ b/gen/cs/softwarearchitecture/eventcal/R.java @@ -782,32 +782,33 @@ public static final class drawable { public static final int ic_action_personal=0x7f020047; public static final int ic_action_uw_event=0x7f020048; public static final int ic_launcher=0x7f020049; - public static final int lighter=0x7f02004a; - public static final int navigation_back=0x7f02004b; - public static final int navigation_forward=0x7f02004c; - public static final int nine=0x7f02004d; - public static final int nine_pm=0x7f02004e; - public static final int one=0x7f02004f; - public static final int one_pm=0x7f020050; - public static final int seven=0x7f020051; - public static final int seven_pm=0x7f020052; - public static final int six=0x7f020053; - public static final int six_pm=0x7f020054; - public static final int ten=0x7f020055; - public static final int ten_pm=0x7f020056; - public static final int three=0x7f020057; - public static final int three_pm=0x7f020058; - public static final int twelve=0x7f020059; - public static final int twelve_pm=0x7f02005a; - public static final int two=0x7f02005b; - public static final int two_pm=0x7f02005c; - public static final int vpi__tab_indicator=0x7f02005d; - public static final int vpi__tab_selected_focused_holo=0x7f02005e; - public static final int vpi__tab_selected_holo=0x7f02005f; - public static final int vpi__tab_selected_pressed_holo=0x7f020060; - public static final int vpi__tab_unselected_focused_holo=0x7f020061; - public static final int vpi__tab_unselected_holo=0x7f020062; - public static final int vpi__tab_unselected_pressed_holo=0x7f020063; + public static final int ic_stat_alerts=0x7f02004a; + public static final int lighter=0x7f02004b; + public static final int navigation_back=0x7f02004c; + public static final int navigation_forward=0x7f02004d; + public static final int nine=0x7f02004e; + public static final int nine_pm=0x7f02004f; + public static final int one=0x7f020050; + public static final int one_pm=0x7f020051; + public static final int seven=0x7f020052; + public static final int seven_pm=0x7f020053; + public static final int six=0x7f020054; + public static final int six_pm=0x7f020055; + public static final int ten=0x7f020056; + public static final int ten_pm=0x7f020057; + public static final int three=0x7f020058; + public static final int three_pm=0x7f020059; + public static final int twelve=0x7f02005a; + public static final int twelve_pm=0x7f02005b; + public static final int two=0x7f02005c; + public static final int two_pm=0x7f02005d; + public static final int vpi__tab_indicator=0x7f02005e; + public static final int vpi__tab_selected_focused_holo=0x7f02005f; + public static final int vpi__tab_selected_holo=0x7f020060; + public static final int vpi__tab_selected_pressed_holo=0x7f020061; + public static final int vpi__tab_unselected_focused_holo=0x7f020062; + public static final int vpi__tab_unselected_holo=0x7f020063; + public static final int vpi__tab_unselected_pressed_holo=0x7f020064; } public static final class id { public static final int action_goto=0x7f06004d; diff --git a/project.properties b/project.properties index 67a133e..7110952 100644 --- a/project.properties +++ b/project.properties @@ -14,14 +14,7 @@ target=Google Inc.:Google APIs:17 -android.library.reference.1=..\\..\\facebook-android-sdk-3.0.1\\facebook -android.library.reference.2=..\\android-times-square\\library -android.library.reference.3=..\\..\\..\\..\\Workspace\\facebook-android-sdk-3.0.1\\facebook -android.library.reference.4=..\\..\\..\\..\\Workspace\\android-times-square-master\\library -android.library.reference.6=..\\..\\..\\Desktop\\adt-bundle-windows-x86_64-20130514\\android-times-square-master\\library -android.library.reference.5=..\\..\\..\\Desktop\\adt-bundle-windows-x86_64-20130514\\facebook-android-sdk-3.0.1\\facebook -android.library.reference.8=../../../Desktop/adt-bundle-windows-x86_64-20130514/facebook-android-sdk-3.0.1/facebook -android.library.reference.7=../../../Desktop/adt-bundle-windows-x86_64-20130514/android-times-square-master/library -android.library.reference.10=../../../../Workspace/android-times-square-master/library -android.library.reference.9=../../../../Workspace/facebook-android-sdk-3.0.1/facebook -android.library.reference.11=../../../../../../../Applications/adt-bundle-mac-x86_64/sdk/extras/google/google_play_services/libproject/google-play-services_lib +android.library.reference.1=../../../../Workspace/facebook-android-sdk-3.0.1/facebook +android.library.reference.2=../../../../Workspace/android-times-square-master/library +android.library.reference.3=../../../../../../../Applications/adt-bundle-mac-x86_64/sdk/extras/google/google_play_services/libproject/google-play-services_lib +android.library=false diff --git a/res/drawable-hdpi/ic_stat_alerts.png b/res/drawable-hdpi/ic_stat_alerts.png new file mode 100644 index 0000000..78224aa Binary files /dev/null and b/res/drawable-hdpi/ic_stat_alerts.png differ diff --git a/res/drawable-mdpi/ic_stat_alerts.png b/res/drawable-mdpi/ic_stat_alerts.png new file mode 100644 index 0000000..a7f0786 Binary files /dev/null and b/res/drawable-mdpi/ic_stat_alerts.png differ diff --git a/res/drawable-xhdpi/ic_stat_alerts.png b/res/drawable-xhdpi/ic_stat_alerts.png new file mode 100644 index 0000000..03becb6 Binary files /dev/null and b/res/drawable-xhdpi/ic_stat_alerts.png differ diff --git a/res/drawable-xxhdpi/ic_stat_alerts.png b/res/drawable-xxhdpi/ic_stat_alerts.png new file mode 100644 index 0000000..bb287da Binary files /dev/null and b/res/drawable-xxhdpi/ic_stat_alerts.png differ diff --git a/res/menu/default_view.xml b/res/menu/default_view.xml index 6893717..560393a 100644 --- a/res/menu/default_view.xml +++ b/res/menu/default_view.xml @@ -13,23 +13,23 @@ diff --git a/res/xml/pref_data_sync.xml b/res/xml/pref_data_sync.xml index a86434d..ae7a672 100644 --- a/res/xml/pref_data_sync.xml +++ b/res/xml/pref_data_sync.xml @@ -1,10 +1,5 @@ - - - - - - diff --git a/res/xml/pref_notification.xml b/res/xml/pref_notification.xml index 8f6743f..d6453cd 100644 --- a/res/xml/pref_notification.xml +++ b/res/xml/pref_notification.xml @@ -1,17 +1,10 @@ - - - - - + - , OnItemClickListener { @@ -274,6 +276,7 @@ public void onItemClick(AdapterView parent, View view, int position, long id) editEventIntent.putExtra("group", group); editEventIntent.putExtra("id", _id); editEventIntent.putExtra("location", location); + Log.d("Location", "Location: " + location); cursor.moveToNext(); } diff --git a/src/cs/softwarearchitecture/eventcal/DefaultView.java b/src/cs/softwarearchitecture/eventcal/DefaultView.java index 9931f1f..58fd1a1 100644 --- a/src/cs/softwarearchitecture/eventcal/DefaultView.java +++ b/src/cs/softwarearchitecture/eventcal/DefaultView.java @@ -22,7 +22,6 @@ import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.graphics.Color; -import android.graphics.PorterDuff; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; @@ -55,16 +54,18 @@ import com.facebook.android.Facebook; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; +import cs.softwarearchitecture.eventcal.extras.Event; +import cs.softwarearchitecture.eventcal.extras.Values; import cs.softwarearchitecture.eventcal.modify.AddEvent; import cs.softwarearchitecture.eventcal.modify.EditEvent; +import cs.softwarearchitecture.eventcal.services.EventbriteEventService; import cs.softwarearchitecture.eventcal.services.FacebookService; import cs.softwarearchitecture.eventcal.services.GoogleService; -import cs.softwarearchitecture.eventcal.services.EventbriteEventService; import cs.softwarearchitecture.eventcal.services.UWEventService; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; -import cs.softwarearchitecture.eventcal.utility.Event; -import cs.softwarearchitecture.eventcal.utility.Values; +import cs.softwarearchitecture.eventcal.utility.EventNotificationReceiver; +import cs.softwarearchitecture.eventcal.utility.SettingsActivity; import cs.softwarearchitecture.eventcal.viewpagerindicator.TitlePageIndicator; public class DefaultView extends FragmentActivity { @@ -198,7 +199,7 @@ protected Void doInBackground(Void... arg0) { if(settingsPreference.getBoolean("notifications_new_message", false)) { Log.d("NOTIFICATION", "notification enabled"); - + // Calculate current date mCalendarChanging.add(Calendar.DAY_OF_MONTH, 0); @@ -299,6 +300,7 @@ protected void onPreExecute() { // Setup Facebook Session mFacebook = new Facebook(getString(R.string.app_id)); mAsyncRunnner = new AsyncFacebookRunner(mFacebook); + } @SuppressWarnings("deprecation") @@ -335,9 +337,11 @@ protected Void doInBackground(Void... params) { startService(intent); } - // UW service kickoff - Intent intent = new Intent(DefaultView.this, UWEventService.class); - startService(intent); + if(settingsPreference.getBoolean("uw_login", false)) { + // UW service kickoff + Intent intent = new Intent(DefaultView.this, UWEventService.class); + startService(intent); + } return null; } @@ -653,7 +657,7 @@ protected static ArrayList getCurrentDayEvents() { DBEventsContentProvider.CONTENT_URI, null, "START_DATE =? AND END_TIME NOT NULL", dateString, ColumnNames.COLUMN_START_TIME + " ASC"); - + //Log.v(TAG, "loading events"); if (cursor.moveToFirst()) { while(!cursor.isAfterLast()){ @@ -752,7 +756,7 @@ public void onClick(View v) { editEventIntent.putExtra("group", group); editEventIntent.putExtra("id", _id); editEventIntent.putExtra("location", location); - + editEventIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(editEventIntent); } @@ -766,26 +770,26 @@ public void onClick(View v) { */ private void eventColorSelection(Button button, String type) { if (type.equals("PERSONAL")) { - button.getBackground().setColorFilter(Color.parseColor("#690 "), PorterDuff.Mode.DARKEN); + button.setBackgroundColor(0xa0db8e00); } if (type.equals("FACEBOOK")) { - button.getBackground().setColorFilter(Color.parseColor("#09c"), PorterDuff.Mode.DARKEN); + button.setBackgroundColor(Color.CYAN); } if (type.equals("EVENTBRITE")) { - button.getBackground().setColorFilter(Color.parseColor("#f80"), PorterDuff.Mode.DARKEN); //setBackgroundColor(0xfbf2a300); + button.setBackgroundColor(0xfbf2a300); } if (type.equals("UW")) { - button.getBackground().setColorFilter(Color.parseColor("#a6c"), PorterDuff.Mode.DARKEN); + button.setBackgroundColor(0xdee4fa00); } if (type.equals("GOOGLE")) { - button.getBackground().setColorFilter(Color.parseColor("#7e572a "), PorterDuff.Mode.DARKEN); + button.setBackgroundColor(Color.YELLOW); } } - + /** * Calculates the time difference in time (in terms of minutes) * @param start_time diff --git a/src/cs/softwarearchitecture/eventcal/MapActivity.java b/src/cs/softwarearchitecture/eventcal/MapActivity.java index 0378d75..2187d12 100644 --- a/src/cs/softwarearchitecture/eventcal/MapActivity.java +++ b/src/cs/softwarearchitecture/eventcal/MapActivity.java @@ -25,8 +25,8 @@ import com.google.cloud.backend.android.CloudQuery.Order; import com.google.cloud.backend.android.CloudQuery.Scope; -import cs.softwarearchitecture.eventcal.utility.Geohasher; -import cs.softwarearchitecture.eventcal.utility.User; +import cs.softwarearchitecture.eventcal.extras.Geohasher; +import cs.softwarearchitecture.eventcal.extras.User; public class MapActivity extends CloudBackendActivity implements OnMyLocationChangeListener{ @@ -117,8 +117,13 @@ protected CloudEntity doInBackground(Void... cEntity) { @Override protected void onPostExecute(CloudEntity resultEntity) { Log.d("MAP", "Location Sent!"); - mLocSent = true; - mSelfID = resultEntity.getId(); + try { + mSelfID = resultEntity.getId(); + mLocSent = true; + } + catch (Exception e) { + Log.e(DefaultView.TAG, "Exception caught: " + e.getMessage()); + } Log.d("MAP", "Self ID: " + mSelfID); saveState(); } diff --git a/src/cs/softwarearchitecture/eventcal/MonthActivity.java b/src/cs/softwarearchitecture/eventcal/MonthActivity.java index a8da8c1..c6f8df9 100644 --- a/src/cs/softwarearchitecture/eventcal/MonthActivity.java +++ b/src/cs/softwarearchitecture/eventcal/MonthActivity.java @@ -12,6 +12,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.ContextThemeWrapper; @@ -20,6 +21,8 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.DatePicker; import android.widget.ImageView; @@ -31,9 +34,12 @@ import com.squareup.timessquare.CalendarPickerView.OnDateSelectedListener; import com.squareup.timessquare.CalendarPickerView.SelectionMode; -import cs.softwarearchitecture.eventcal.database.DBSQLiteHelper; +import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.Event; import cs.softwarearchitecture.eventcal.modify.AddEvent; -import cs.softwarearchitecture.eventcal.utility.Event; +import cs.softwarearchitecture.eventcal.modify.EditEvent; +import cs.softwarearchitecture.eventcal.utility.SettingsActivity; public class MonthActivity extends DefaultView { @@ -234,10 +240,10 @@ public View getView(int position, View convertView, ViewGroup parent) { // Seperator not needed for this view seperatorDate.setVisibility(View.GONE); - eventTitle.setText(((Event) events.get(position)).getTitle()); + eventTitle.setText(events.get(position).getTitle()); - String startTime = ((Event) events.get(position)).getStartTime(); - String endTime = ((Event) events.get(position)).getEndTime(); + String startTime = events.get(position).getStartTime(); + String endTime = events.get(position).getEndTime(); if(endTime != null) eventTime.setText(timeFormatted(startTime) + "-" @@ -245,7 +251,7 @@ public View getView(int position, View convertView, ViewGroup parent) { else eventTime.setText(timeFormatted(startTime)); - String imageResourceType = ((Event) events.get(position)).getGroup(); + String imageResourceType = events.get(position).getGroup(); // Image selection if (imageResourceType.equals("PERSONAL")) { diff --git a/src/cs/softwarearchitecture/eventcal/Search.java b/src/cs/softwarearchitecture/eventcal/Search.java index 1440d28..e3f17f1 100644 --- a/src/cs/softwarearchitecture/eventcal/Search.java +++ b/src/cs/softwarearchitecture/eventcal/Search.java @@ -12,8 +12,8 @@ import android.widget.ArrayAdapter; import android.widget.ListView; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; import cs.softwarearchitecture.eventcal.modify.EditEvent; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; public class Search extends ListActivity { @@ -63,6 +63,7 @@ public void onListItemClick(ListView l, View v, int position, long id) { String date = cursor.getString(cursor.getColumnIndex(ColumnNames.COLUMN_START_DATE)); String group = cursor.getString(cursor.getColumnIndex(ColumnNames.COLUMN_TABLE)); int reminder = cursor.getInt(cursor.getColumnIndex(ColumnNames.COLUMN_REMINDER_TIME)); + String location = cursor.getString(cursor.getColumnIndex(ColumnNames.COLUMN_LOCATION)); editEventIntent.putExtra("title", title); editEventIntent.putExtra("start_time", start_time); @@ -71,6 +72,7 @@ public void onListItemClick(ListView l, View v, int position, long id) { editEventIntent.putExtra("reminder", reminder); editEventIntent.putExtra("group", group); editEventIntent.putExtra("id", _id); + editEventIntent.putExtra("location", location); cursor.moveToNext(); } diff --git a/src/cs/softwarearchitecture/eventcal/contentprovider/DBEventsContentProvider.java b/src/cs/softwarearchitecture/eventcal/contentprovider/DBEventsContentProvider.java index 3d6100e..ebfed4c 100644 --- a/src/cs/softwarearchitecture/eventcal/contentprovider/DBEventsContentProvider.java +++ b/src/cs/softwarearchitecture/eventcal/contentprovider/DBEventsContentProvider.java @@ -16,7 +16,7 @@ import android.util.Log; import cs.softwarearchitecture.eventcal.DefaultView; import cs.softwarearchitecture.eventcal.database.DBSQLiteHelper; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; /** * @author nitishagarwal diff --git a/src/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.java b/src/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.java index c6d7ad2..95d1d11 100644 --- a/src/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.java +++ b/src/cs/softwarearchitecture/eventcal/database/DBSQLiteHelper.java @@ -6,7 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import cs.softwarearchitecture.eventcal.DefaultView; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; /** * @author nitishagarwal diff --git a/src/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.java b/src/cs/softwarearchitecture/eventcal/extras/AgendaCursorAdapter.java similarity index 93% rename from src/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.java rename to src/cs/softwarearchitecture/eventcal/extras/AgendaCursorAdapter.java index a173153..e5286f6 100644 --- a/src/cs/softwarearchitecture/eventcal/AgendaCursorAdapter.java +++ b/src/cs/softwarearchitecture/eventcal/extras/AgendaCursorAdapter.java @@ -1,7 +1,9 @@ /** * */ -package cs.softwarearchitecture.eventcal; +package cs.softwarearchitecture.eventcal.extras; + +import java.text.DateFormatSymbols; import android.content.Context; import android.database.Cursor; @@ -12,7 +14,8 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; +import cs.softwarearchitecture.eventcal.DefaultView; +import cs.softwarearchitecture.eventcal.R; /** * @author nitishagarwal @@ -148,8 +151,10 @@ protected void seperatorImplementation(Cursor cursor, TextView seperatorDate) { String dateRaw = Integer.toString(cursor.getInt( cursor.getColumnIndex(ColumnNames.COLUMN_START_DATE))); - seperatorDate.setText(dateRaw.substring(1, 3) + "-" + dateRaw.substring(3,5) + "-" - + dateRaw.substring(5, dateRaw.length())); + String month = new DateFormatSymbols().getMonths()[Integer.parseInt(dateRaw.substring(3,5)) - 1]; + String day = dateRaw.substring(1, 3); + String year = dateRaw.substring(5, dateRaw.length()); + seperatorDate.setText(day + "-" + month + "-" + year); seperatorDate.setVisibility(View.VISIBLE); } else { diff --git a/src/cs/softwarearchitecture/eventcal/utility/ColumnNames.java b/src/cs/softwarearchitecture/eventcal/extras/ColumnNames.java similarity index 93% rename from src/cs/softwarearchitecture/eventcal/utility/ColumnNames.java rename to src/cs/softwarearchitecture/eventcal/extras/ColumnNames.java index bde4c16..3982d6a 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/ColumnNames.java +++ b/src/cs/softwarearchitecture/eventcal/extras/ColumnNames.java @@ -1,4 +1,4 @@ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; public interface ColumnNames { diff --git a/src/cs/softwarearchitecture/eventcal/utility/CurrentDateTimeConverter.java b/src/cs/softwarearchitecture/eventcal/extras/CurrentDateTimeConverter.java similarity index 98% rename from src/cs/softwarearchitecture/eventcal/utility/CurrentDateTimeConverter.java rename to src/cs/softwarearchitecture/eventcal/extras/CurrentDateTimeConverter.java index 97dfa0b..57cdc52 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/CurrentDateTimeConverter.java +++ b/src/cs/softwarearchitecture/eventcal/extras/CurrentDateTimeConverter.java @@ -1,7 +1,7 @@ /** * */ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -9,10 +9,9 @@ import java.util.Date; import java.util.TimeZone; -import cs.softwarearchitecture.eventcal.DefaultView; - import android.annotation.SuppressLint; import android.util.Log; +import cs.softwarearchitecture.eventcal.DefaultView; /** * @author nitishagarwal diff --git a/src/cs/softwarearchitecture/eventcal/utility/Event.java b/src/cs/softwarearchitecture/eventcal/extras/Event.java similarity index 97% rename from src/cs/softwarearchitecture/eventcal/utility/Event.java rename to src/cs/softwarearchitecture/eventcal/extras/Event.java index 6dc0108..7a31021 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/Event.java +++ b/src/cs/softwarearchitecture/eventcal/extras/Event.java @@ -1,4 +1,4 @@ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; public class Event { diff --git a/src/cs/softwarearchitecture/eventcal/utility/Geohasher.java b/src/cs/softwarearchitecture/eventcal/extras/Geohasher.java similarity index 99% rename from src/cs/softwarearchitecture/eventcal/utility/Geohasher.java rename to src/cs/softwarearchitecture/eventcal/extras/Geohasher.java index e4fdea9..ff9ff1f 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/Geohasher.java +++ b/src/cs/softwarearchitecture/eventcal/extras/Geohasher.java @@ -1,4 +1,4 @@ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; import java.util.BitSet; import java.util.HashMap; diff --git a/src/cs/softwarearchitecture/eventcal/utility/User.java b/src/cs/softwarearchitecture/eventcal/extras/User.java similarity index 95% rename from src/cs/softwarearchitecture/eventcal/utility/User.java rename to src/cs/softwarearchitecture/eventcal/extras/User.java index 3a46592..357c689 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/User.java +++ b/src/cs/softwarearchitecture/eventcal/extras/User.java @@ -1,4 +1,4 @@ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; import java.util.ArrayList; import java.util.Date; diff --git a/src/cs/softwarearchitecture/eventcal/utility/Values.java b/src/cs/softwarearchitecture/eventcal/extras/Values.java similarity index 99% rename from src/cs/softwarearchitecture/eventcal/utility/Values.java rename to src/cs/softwarearchitecture/eventcal/extras/Values.java index 5999533..72ceadc 100644 --- a/src/cs/softwarearchitecture/eventcal/utility/Values.java +++ b/src/cs/softwarearchitecture/eventcal/extras/Values.java @@ -1,4 +1,4 @@ -package cs.softwarearchitecture.eventcal.utility; +package cs.softwarearchitecture.eventcal.extras; public class Values { diff --git a/src/cs/softwarearchitecture/eventcal/modify/AddEvent.java b/src/cs/softwarearchitecture/eventcal/modify/AddEvent.java index 1756abb..9005216 100644 --- a/src/cs/softwarearchitecture/eventcal/modify/AddEvent.java +++ b/src/cs/softwarearchitecture/eventcal/modify/AddEvent.java @@ -45,9 +45,9 @@ import cs.softwarearchitecture.eventcal.DefaultView; import cs.softwarearchitecture.eventcal.R; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; -import cs.softwarearchitecture.eventcal.utility.Geohasher; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; +import cs.softwarearchitecture.eventcal.extras.Geohasher; public class AddEvent extends FragmentActivity implements OnClickListener, OnMyLocationChangeListener { @@ -386,7 +386,8 @@ private void popupListViewForSearchResults(List searchResults) { final String[] resultsString = searchResults.toArray(new String[0]); builder.setTitle(R.string.location_results_) .setItems(resultsString, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int arrayIndex) { + @Override + public void onClick(DialogInterface dialog, int arrayIndex) { InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/src/cs/softwarearchitecture/eventcal/modify/EditEvent.java b/src/cs/softwarearchitecture/eventcal/modify/EditEvent.java index a6df01d..bfc6aa5 100644 --- a/src/cs/softwarearchitecture/eventcal/modify/EditEvent.java +++ b/src/cs/softwarearchitecture/eventcal/modify/EditEvent.java @@ -43,16 +43,16 @@ import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener; +import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; -import com.google.android.gms.maps.SupportMapFragment; import cs.softwarearchitecture.eventcal.DefaultView; import cs.softwarearchitecture.eventcal.R; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; -import cs.softwarearchitecture.eventcal.utility.Geohasher; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; +import cs.softwarearchitecture.eventcal.extras.Geohasher; @SuppressLint("SimpleDateFormat") public class EditEvent extends FragmentActivity implements OnClickListener, OnMyLocationChangeListener { @@ -561,7 +561,8 @@ private void popUpListViewForSearchResults(List searchResults) { final String[] resultsString = searchResults.toArray(new String[0]); builder.setTitle(R.string.location_results_) .setItems(resultsString, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int arrayIndex) { + @Override + public void onClick(DialogInterface dialog, int arrayIndex) { InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/src/cs/softwarearchitecture/eventcal/services/EventbriteEventService.java b/src/cs/softwarearchitecture/eventcal/services/EventbriteEventService.java index c8b4239..d8df831 100644 --- a/src/cs/softwarearchitecture/eventcal/services/EventbriteEventService.java +++ b/src/cs/softwarearchitecture/eventcal/services/EventbriteEventService.java @@ -3,114 +3,99 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; -import java.util.List; -import android.app.IntentService; -import android.content.ContentValues; +import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.util.JsonReader; import android.util.Log; -import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; - - -public class EventbriteEventService extends IntentService { - public class Event{ - String title; - String location; - Integer startTime; - Integer startDate; - Integer endTime; - Integer endDate; - } - /** - * A constructor is required, and must call the super IntentService(String) - * constructor with a name for the worker thread. - */ - public EventbriteEventService() { - super("getEventBriteEventService"); - } - - private static final String TAG = "getEventBriteEventService"; - InputStream in; - List EventBriteEvents = new ArrayList(); - //private ListView eventsListView; - //private ArrayAdapter arrayAdapter; - URL url; - HttpURLConnection urlConnection; - String EventBriteAPIKey = "SCGKMFBZ2BGVSH5XL2"; - - public void parseEventBriteEvents(InputStream in) throws IOException { +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; + + +public class EventbriteEventService extends TemplateService { + + private String mEventbriteID; + + + /** + * A constructor is required, and must call the super IntentService(String) + * constructor with a name for the worker thread. + */ + public EventbriteEventService() { + super(); + } + + private static final String TAG = "EventbriteEventService"; + + @Override + protected void parseEvent(InputStream in) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8")); - // try { - - parseEventBriteEventsArray(reader); - //} - //finally { - reader.close(); - // } + + parseEventsArray(reader); + + reader.close(); + } - public void parseEventBriteEventsArray(JsonReader reader) throws IOException { - //List eventList = new ArrayList(); - Log.d(EventbriteEventService.TAG, "i'm here"); - reader.beginObject(); - reader.nextName();// events - reader.beginArray(); - reader.skipValue(); - while (reader.hasNext()) { - EventBriteEvents.add(getEventBriteEvents(reader)); - } - Log.d(EventbriteEventService.TAG, "i'm here 4"); - - reader.endArray(); - reader.endObject(); - //return eventList; + @Override + protected void parseEventsArray(JsonReader reader) throws IOException { + Log.d(EventbriteEventService.TAG, "i'm here"); + reader.beginObject(); + reader.nextName();// events + reader.beginArray(); + reader.skipValue(); + while (reader.hasNext()) { + mEvents.add(getEventBriteEvents(reader)); + } + Log.d(EventbriteEventService.TAG, "i'm here 4"); + + reader.endArray(); + reader.endObject(); } - - - - public Event getEventBriteEvents(JsonReader reader) throws IOException { + + + + protected Event getEventBriteEvents(JsonReader reader) throws IOException { Event event = new Event(); - - reader.beginObject(); - Log.d(EventbriteEventService.TAG, "i'm here 88"); - reader.nextName(); - reader.beginObject(); - while (reader.hasNext()) { - String name = reader.nextName(); - Log.d(EventbriteEventService.TAG, name); - if (name.equals("title")) { - event.title = reader.nextString(); - Log.d(EventbriteEventService.TAG, event.title); - } else if(name.equals("venue")){ - event.location = getLoc(reader); - Log.d(EventbriteEventService.TAG, event.location); - } - else if(name.equals("start_date")){ - ArrayList startTimeAndDate = formatTimeAndDate(reader.nextString()); - event.startTime = startTimeAndDate.get(0); - event.startDate = startTimeAndDate.get(1); - } - else if(name.equals("end_date")){ - ArrayList endTimeAndDate = formatTimeAndDate(reader.nextString()); - event.endTime = endTimeAndDate.get(0); - event.endDate = endTimeAndDate.get(1); - } - else { - reader.skipValue(); - } - } - reader.endObject(); - reader.endObject(); - return event; + + reader.beginObject(); + Log.d(EventbriteEventService.TAG, "i'm here 88"); + reader.nextName(); + reader.beginObject(); + while (reader.hasNext()) { + String name = reader.nextName(); + Log.d(EventbriteEventService.TAG, name); + if (name.equals("title")) { + event.title = reader.nextString(); + Log.d(EventbriteEventService.TAG, event.title); + } else if(name.equals("venue")){ + event.location = getLocation(reader); + Log.d(EventbriteEventService.TAG, event.location); + } + else if(name.equals("start_date")){ + ArrayList startTimeAndDate = formatTimeAndDate(reader.nextString()); + event.startTime = startTimeAndDate.get(0); + event.startDate = startTimeAndDate.get(1); + } + else if(name.equals("end_date")){ + ArrayList endTimeAndDate = formatTimeAndDate(reader.nextString()); + event.endTime = endTimeAndDate.get(0); + event.endDate = endTimeAndDate.get(1); + } + else { + reader.skipValue(); + } + } + reader.endObject(); + reader.endObject(); + event.valid = 1; + return event; } - public String getLoc(JsonReader reader) throws IOException{ + + protected String getLocation(JsonReader reader) throws IOException{ String location = ""; reader.beginObject(); while (reader.hasNext()) { @@ -125,7 +110,9 @@ public String getLoc(JsonReader reader) throws IOException{ reader.endObject(); return location; } - public ArrayList formatTimeAndDate(String timeDate){ + + + protected ArrayList formatTimeAndDate(String timeDate){ Log.d(EventbriteEventService.TAG, timeDate); ArrayList returnFormatted = new ArrayList(); String[] splitTimeDate = timeDate.split(" "); // [0] = date, [1] = time @@ -133,60 +120,28 @@ public ArrayList formatTimeAndDate(String timeDate){ String[] splitTime = splitTimeDate[1].split(":"); Integer date = CurrentDateTimeConverter.timeDateFormatter(Integer.parseInt(splitDate[2]), Integer.parseInt(splitDate[1]),splitDate[0]); Integer time = CurrentDateTimeConverter.timeDateFormatter(Integer.parseInt(splitTime[0]), Integer.parseInt(splitTime[1]),splitTime[2]); - //String date = splitDate[1] + splitDate[2] + splitDate[0]; - //String time = splitTime[0] + splitTime[1] + splitTime[2]; - //Log.d(getEventBriteEventService.TAG, time); - //Log.d(getEventBriteEventService.TAG, date); returnFormatted.add(time); returnFormatted.add(date); return returnFormatted; } - /** - * The IntentService calls this method from the default worker thread with - * the intent that started the service. When this method returns, IntentService - * stops the service, as appropriate. - */ - @Override - protected void onHandleIntent(Intent intent) { - Log.d(EventbriteEventService.TAG, "I'm here"); - + /** + * The IntentService calls this method from the default worker thread with + * the intent that started the service. When this method returns, IntentService + * stops the service, as appropriate. + */ + @Override + protected void onHandleIntent(Intent intent) { + SharedPreferences eventbritePreference = getSharedPreferences("eventbrite-session", Context.MODE_PRIVATE); + mEventbriteID = eventbritePreference.getString("user_id", null); + + Log.d(EventbriteEventService.TAG, "I'm here"); + mAPIKey = "SCGKMFBZ2BGVSH5XL2"; try { - url = new URL("https://www.eventbrite.com/json/event_search?app_key=" + EventBriteAPIKey + "&city=Waterloo&country=CA"); - urlConnection = (HttpURLConnection)url.openConnection(); - in = urlConnection.getInputStream(); - parseEventBriteEvents(in); - int i = EventBriteEvents.size(); - int j = 0; - - - while (j < i){ - ContentValues values = new ContentValues(); - Event insertEvent = EventBriteEvents.get(j); - /*Log.d(getEventBriteEventService.TAG, insertEvent.title); - Log.d(getEventBriteEventService.TAG, insertEvent.location); - Log.d(getEventBriteEventService.TAG, insertEvent.startTime); - Log.d(getEventBriteEventService.TAG, insertEvent.startDate); - Log.d(getEventBriteEventService.TAG, insertEvent.endTime); - Log.d(getEventBriteEventService.TAG, insertEvent.endDate); - int insertStartTime = Integer.parseInt(insertEvent.startTime); - int insertStartDate = Integer.parseInt(insertEvent.startDate); - int insertEndTime = Integer.parseInt(insertEvent.endTime); - int insertEndDate = Integer.parseInt(insertEvent.endDate);*/ - - values.put(ColumnNames.COLUMN_TABLE, "EVENTBRITE"); - values.put(ColumnNames.COLUMN_TITLE, insertEvent.title); - values.put(ColumnNames.COLUMN_START_DATE, insertEvent.startDate); - values.put(ColumnNames.COLUMN_START_TIME, insertEvent.startTime); - values.put(ColumnNames.COLUMN_END_TIME, insertEvent.endTime); - values.put(ColumnNames.COLUMN_END_DATE, insertEvent.endDate); - values.put(ColumnNames.COLUMN_LOCATION, insertEvent.location); - - getContentResolver().insert(DBEventsContentProvider.CONTENT_URI, values); - j += 1; - } - + mEventURL = new URL("https://www.eventbrite.com/json/event_search?app_key=" + mAPIKey + "&user_key=" + mEventbriteID + "&city=Waterloo&country=CA"); + feedingDatabase("EVENTBRITE", mEventURL); + } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -195,15 +150,10 @@ protected void onHandleIntent(Intent intent) { e.printStackTrace(); } finally{ - urlConnection.disconnect(); + mURLConnection.disconnect(); } - - - /* eventsListView = (ListView) findViewById(R.id.calendarEvent_list); - - arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, UWEvents); - - eventsListView.setAdapter(arrayAdapter); - */ - } + + + + } } \ No newline at end of file diff --git a/src/cs/softwarearchitecture/eventcal/services/FacebookService.java b/src/cs/softwarearchitecture/eventcal/services/FacebookService.java index 1385e37..aae505c 100644 --- a/src/cs/softwarearchitecture/eventcal/services/FacebookService.java +++ b/src/cs/softwarearchitecture/eventcal/services/FacebookService.java @@ -23,8 +23,8 @@ import cs.softwarearchitecture.eventcal.DefaultView; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; /** * @author nitishagarwal diff --git a/src/cs/softwarearchitecture/eventcal/services/GoogleService.java b/src/cs/softwarearchitecture/eventcal/services/GoogleService.java index f061cb4..165f6f7 100644 --- a/src/cs/softwarearchitecture/eventcal/services/GoogleService.java +++ b/src/cs/softwarearchitecture/eventcal/services/GoogleService.java @@ -9,14 +9,15 @@ import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; +import android.provider.BaseColumns; import android.provider.CalendarContract.Calendars; import android.provider.CalendarContract.Events; import android.provider.CalendarContract.Reminders; import android.text.format.DateFormat; import android.util.Log; import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; +import cs.softwarearchitecture.eventcal.extras.CurrentDateTimeConverter; /** * @author nitishagarwal @@ -59,7 +60,7 @@ protected void onHandleIntent(Intent intent) { EVENT_PROJECTION, Calendars.VISIBLE + " = 1", null, - Calendars._ID + " ASC"); + BaseColumns._ID + " ASC"); if (calCursor.moveToFirst()) { do { long id = calCursor.getLong(0); @@ -72,7 +73,7 @@ protected void onHandleIntent(Intent intent) { String[] proj = new String[]{ - Events._ID, + BaseColumns._ID, Events.DTSTART, Events.DTEND, Events.TITLE, @@ -111,14 +112,14 @@ protected void onHandleIntent(Intent intent) { // For reminder time we have to see another table String[] reminder_projection = new String[]{ - Reminders._ID, + BaseColumns._ID, Reminders.MINUTES}; Cursor cursor_reminder = getContentResolver(). query( Reminders.CONTENT_URI, reminder_projection, - Reminders._ID + " = ? ", + BaseColumns._ID + " = ? ", new String[]{Long.toString(event_id)}, null); int reminder = 0; diff --git a/src/cs/softwarearchitecture/eventcal/services/TemplateService.java b/src/cs/softwarearchitecture/eventcal/services/TemplateService.java new file mode 100644 index 0000000..8b49e65 --- /dev/null +++ b/src/cs/softwarearchitecture/eventcal/services/TemplateService.java @@ -0,0 +1,88 @@ +package cs.softwarearchitecture.eventcal.services; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import android.app.IntentService; +import android.content.ContentValues; +import android.content.Intent; +import android.util.JsonReader; +import android.util.Log; +import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; +import cs.softwarearchitecture.eventcal.extras.ColumnNames; + +class TemplateService extends IntentService { + + public class Event{ + String title; + String location; + Integer startTime; + Integer startDate; + Integer endTime; + Integer endDate; + int valid; + } + + InputStream mInputStream; + List mEvents = new ArrayList(); + URL mEventURL; + HttpURLConnection mURLConnection; + String mAPIKey; + + /** + * A constructor is required, and must call the super IntentService(String) + * constructor with a name for the worker thread. + */ + public TemplateService() { + super("TemplateService"); + } + + protected void parseEventsArray(JsonReader reader) throws IOException { + } + + protected void parseEvent(InputStream in) throws IOException { + } + + /** + * The IntentService calls this method from the default worker thread with + * the intent that started the service. When this method returns, IntentService + * stops the service, as appropriate. + */ + @Override + protected void onHandleIntent(Intent intent) { + + } + + /** + * Database fed with the data + * @param eventType + * @throws IOException + */ + protected void feedingDatabase(String eventType, URL eventURL) throws IOException { + mEventURL = eventURL; + mURLConnection = (HttpURLConnection)mEventURL.openConnection(); + mInputStream = mURLConnection.getInputStream(); + parseEvent(mInputStream); + int eventSize = mEvents.size(); + int iter = 0; + while (iter < eventSize){ + ContentValues values = new ContentValues(); + Event insertEvent = mEvents.get(iter); + values.put(ColumnNames.COLUMN_TABLE, eventType); + values.put(ColumnNames.COLUMN_TITLE, insertEvent.title); + values.put(ColumnNames.COLUMN_START_DATE, insertEvent.startDate); + values.put(ColumnNames.COLUMN_START_TIME, insertEvent.startTime); + values.put(ColumnNames.COLUMN_END_TIME, insertEvent.endTime); + values.put(ColumnNames.COLUMN_END_DATE, insertEvent.endDate); + values.put(ColumnNames.COLUMN_LOCATION, insertEvent.location); + values.put(ColumnNames.COLUMN_REMINDER_TIME,""); + getContentResolver().insert(DBEventsContentProvider.CONTENT_URI, values); + iter += 1; + } + } + +} \ No newline at end of file diff --git a/src/cs/softwarearchitecture/eventcal/services/UWEventService.java b/src/cs/softwarearchitecture/eventcal/services/UWEventService.java index b9e14fe..d84fc0b 100644 --- a/src/cs/softwarearchitecture/eventcal/services/UWEventService.java +++ b/src/cs/softwarearchitecture/eventcal/services/UWEventService.java @@ -1,175 +1,110 @@ package cs.softwarearchitecture.eventcal.services; -import java.io.IOException; - import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; -import java.util.List; -import android.app.IntentService; -import android.content.ContentValues; import android.content.Intent; import android.util.JsonReader; import android.util.Log; -import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; -import cs.softwarearchitecture.eventcal.utility.ColumnNames; -import cs.softwarearchitecture.eventcal.utility.CurrentDateTimeConverter; +public class UWEventService extends TemplateService { + + private static final String TAG = "UWEventService"; + + /** + * A constructor is required, and must call the super IntentService(String) + * constructor with a name for the worker thread. + */ + public UWEventService() { + super(); + } -public class UWEventService extends IntentService { - public class Event{ - String title; - String location; - Integer startTime; - Integer startDate; - Integer endTime; - Integer endDate; - int valid; - } - /** - * A constructor is required, and must call the super IntentService(String) - * constructor with a name for the worker thread. - */ - public UWEventService() { - super("getUWEventService"); - } - - private static final String TAG = "getUWEventService"; - InputStream in; - List UWEvents = new ArrayList(); - //private ListView eventsListView; - //private ArrayAdapter arrayAdapter; - URL url; - HttpURLConnection urlConnection; - String UWAPIKey = "caeecfb4db9804ec82b9adbfbdd151a3"; - - public void parseUWEvents(InputStream in) throws IOException { + @Override + protected void parseEvent(InputStream in) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8")); - // try { - - parseUWEventsArray(reader); - //} - //finally { - reader.close(); - // } + + parseEventsArray(reader); + reader.close(); } - public void parseUWEventsArray(JsonReader reader) throws IOException { - //List eventList = new ArrayList(); - Log.d(UWEventService.TAG, "i'm here"); - reader.beginObject(); //start - reader.nextName();// response" - reader.beginObject(); - reader.nextName();// meta - /* - reader.beginObject(); - reader.nextName();// request - reader.nextString(); - reader.nextName();// timestamp - reader.nextString(); - reader.nextName();// status - reader.nextString(); - reader.nextName();// message - reader.nextString(); - reader.nextName();// version - reader.nextString(); - - - Log.d(getUWEventService.TAG, "i'm here 2"); - reader.endObject(); - */ - reader.skipValue(); - Log.d(UWEventService.TAG, "i'm here 11"); - reader.nextName();// data - Log.d(UWEventService.TAG, "i'm here 5"); - reader.beginObject(); - Log.d(UWEventService.TAG, "i'm here 6"); - reader.nextName();//result - Log.d(UWEventService.TAG, "i'm here 7"); - reader.beginArray(); - - while (reader.hasNext()) { - Log.d(UWEventService.TAG, "i'm here 3"); - Event addEvent = getUWEvents(reader); - if (addEvent.valid == 1){ - UWEvents.add(addEvent); - } - Log.d(UWEventService.TAG, "i'm here 77"); - //eventList.add("New Event"); - } - Log.d(UWEventService.TAG, "i'm here 4"); - reader.endArray(); - reader.endObject(); - reader.endObject(); - reader.endObject(); - //return eventList; + @Override + protected void parseEventsArray(JsonReader reader) throws IOException { + Log.d(UWEventService.TAG, "i'm here"); + reader.beginObject(); //start + reader.nextName();// response" + reader.beginObject(); + reader.nextName();// meta + reader.skipValue(); + Log.d(UWEventService.TAG, "i'm here 11"); + reader.nextName();// data + Log.d(UWEventService.TAG, "i'm here 5"); + reader.beginObject(); + Log.d(UWEventService.TAG, "i'm here 6"); + reader.nextName();//result + Log.d(UWEventService.TAG, "i'm here 7"); + reader.beginArray(); + + while (reader.hasNext()) { + Log.d(UWEventService.TAG, "i'm here 3"); + Event addEvent = getUWEvents(reader); + if (addEvent.valid == 1){ + mEvents.add(addEvent); + } + Log.d(UWEventService.TAG, "i'm here 77"); + } + Log.d(UWEventService.TAG, "i'm here 4"); + reader.endArray(); + reader.endObject(); + reader.endObject(); + reader.endObject(); } - /*public String getUWEvents(JsonReader reader) throws IOException { - String event = ""; - - reader.beginObject(); - while (reader.hasNext()) { - String name = reader.nextName(); - if (name.equals("Title") || name.equals("When")) { - event += " "; - event += reader.nextString(); - } else { - reader.skipValue(); - } - } - reader.endObject(); - return event; - }*/ - - - public Event getUWEvents(JsonReader reader) throws IOException { + protected Event getUWEvents(JsonReader reader) throws IOException { Event event = new Event(); - reader.beginObject(); - Log.d(UWEventService.TAG, "i'm here 88"); - while (reader.hasNext()) { - String name = reader.nextName(); - Log.d(UWEventService.TAG, name); - if (name.equals("Title")) { - event.title = reader.nextString(); - Log.d(UWEventService.TAG, event.title); - } else if(name.equals("Where")){ - event.location = reader.nextString(); - Log.d(UWEventService.TAG, event.location); - } - else if(name.equals("When")){ - String timeDate = reader.nextString(); - if (timeDate.equals("")){ - event.startTime = 0; - event.startDate = 0; - event.endTime = 0; - event.endDate = 0; - event.valid = 0; - } - else { - ArrayList timeAndDate = parseEventTime(timeDate); - event.startTime = timeAndDate.get(0); - event.startDate = timeAndDate.get(1); - event.endTime = timeAndDate.get(2); - event.endDate = timeAndDate.get(3); - event.valid = 1; - } - } - else { - reader.skipValue(); - } - } - reader.endObject(); - return event; + reader.beginObject(); + Log.d(UWEventService.TAG, "i'm here 88"); + while (reader.hasNext()) { + String name = reader.nextName(); + Log.d(UWEventService.TAG, name); + if (name.equals("Title")) { + event.title = reader.nextString(); + Log.d(UWEventService.TAG, event.title); + } else if(name.equals("Where")){ + event.location = reader.nextString(); + Log.d(UWEventService.TAG, event.location); + } + else if(name.equals("When")){ + String timeDate = reader.nextString(); + if (timeDate.equals("")){ + event.startTime = 0; + event.startDate = 0; + event.endTime = 0; + event.endDate = 0; + event.valid = 0; + } + else { + ArrayList timeAndDate = parseEventTime(timeDate); + event.startTime = timeAndDate.get(0); + event.startDate = timeAndDate.get(1); + event.endTime = timeAndDate.get(2); + event.endDate = timeAndDate.get(3); + event.valid = 1; + } + } + else { + reader.skipValue(); + } + } + reader.endObject(); + return event; } - - public ArrayList parseEventTime(String timeString){ + + protected ArrayList parseEventTime(String timeString){ Log.d(UWEventService.TAG, timeString); ArrayList returnTime = new ArrayList(); String[] splitString = timeString.split(" "); @@ -198,12 +133,8 @@ public ArrayList parseEventTime(String timeString){ Log.d(UWEventService.TAG, startTimeSplit[0]); Log.d(UWEventService.TAG, startTimeSplit[1]); String[] endTimeSplit = splitString[12].split(":"); - startTime = Integer.parseInt(findTime(startTimeSplit[0], startTimeSplit[1], splitString[5])); - - startDate = Integer.parseInt(findDate(splitString[1],splitString[2],splitString[3])); - //String startDate = splitString[1]+splitString[2]+splitString[3]; endTime = Integer.parseInt(findTime(endTimeSplit[0], endTimeSplit[1] , splitString[13])); endDate = Integer.parseInt(findDate(splitString[9],splitString[10],splitString[11])); } @@ -215,11 +146,8 @@ public ArrayList parseEventTime(String timeString){ Log.d(UWEventService.TAG, splitString[2]); Log.d(UWEventService.TAG, splitString[3]); startDate = Integer.parseInt(findDate(splitString[1],splitString[2],splitString[3])); - //String startDate = splitString[1]+splitString[2]+splitString[3]; endTime = Integer.parseInt("1" + endTimeSplit[0] + endTimeSplit[1] + endTimeSplit[2]); endDate = Integer.parseInt(findDate(splitString[8],splitString[9],splitString[10])); - //String endDate = splitString[8]+splitString[9]+splitString[10]; - } returnTime.add(startTime); returnTime.add(startDate); @@ -228,9 +156,9 @@ public ArrayList parseEventTime(String timeString){ Log.d(UWEventService.TAG, "lalala"); return returnTime; } - - public String findTime(String hour, String minutes, String amOrPm){ - + + protected String findTime(String hour, String minutes, String amOrPm){ + String returnTime; if (amOrPm.equals("pm") && !hour.equals("12")){ int intHour = Integer.parseInt(hour); @@ -247,7 +175,7 @@ public String findTime(String hour, String minutes, String amOrPm){ } Log.d(UWEventService.TAG, returnTime); return returnTime; - + } public String findDate(String day, String month, String year){ @@ -281,45 +209,20 @@ public String findDate(String day, String month, String year){ Log.d(UWEventService.TAG, date); return date; } - /** - * The IntentService calls this method from the default worker thread with - * the intent that started the service. When this method returns, IntentService - * stops the service, as appropriate. - */ - @Override - protected void onHandleIntent(Intent intent) { - Log.d(UWEventService.TAG, "I'm here"); - + + /** + * The IntentService calls this method from the default worker thread with + * the intent that started the service. When this method returns, IntentService + * stops the service, as appropriate. + */ + @Override + protected void onHandleIntent(Intent intent) { + Log.d(UWEventService.TAG, "I'm here"); + mAPIKey = "caeecfb4db9804ec82b9adbfbdd151a3"; try { - url = new URL("http://api.uwaterloo.ca/public/v1/?key=" + UWAPIKey + "&service=CalendarEvents&output=json"); - urlConnection = (HttpURLConnection)url.openConnection(); - in = urlConnection.getInputStream(); - parseUWEvents(in); - int i = UWEvents.size(); - int j = 0; - //while (i > 0){ - // Log.d(getUWEventService.TAG, UWEvents.get(i)); - // i += 1; - //} - while (j < i){ - ContentValues values = new ContentValues(); - Event insertEvent = UWEvents.get(j); - //int insertStartTime = Integer.parseInt(insertEvent.startTime); - //int insertStartDate = Integer.parseInt(insertEvent.startDate); - //int insertEndTime = Integer.parseInt(insertEvent.endTime); - //int insertEndDate = Integer.parseInt(insertEvent.endDate); - values.put(ColumnNames.COLUMN_TABLE, "UW"); - values.put(ColumnNames.COLUMN_TITLE, insertEvent.title); - values.put(ColumnNames.COLUMN_START_DATE, insertEvent.startDate); - values.put(ColumnNames.COLUMN_START_TIME, insertEvent.startTime); - values.put(ColumnNames.COLUMN_END_TIME, insertEvent.endTime); - values.put(ColumnNames.COLUMN_END_DATE, insertEvent.endDate); - values.put(ColumnNames.COLUMN_LOCATION, insertEvent.location); - values.put(ColumnNames.COLUMN_REMINDER_TIME,""); - getContentResolver().insert(DBEventsContentProvider.CONTENT_URI, values); - j += 1; - } - + mEventURL = new URL("http://api.uwaterloo.ca/public/v1/?key=" + mAPIKey + "&service=CalendarEvents&output=json"); + feedingDatabase("UW", mEventURL); + } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -328,15 +231,9 @@ protected void onHandleIntent(Intent intent) { e.printStackTrace(); } finally{ - urlConnection.disconnect(); + mURLConnection.disconnect(); } - - - /* eventsListView = (ListView) findViewById(R.id.calendarEvent_list); - arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, UWEvents); - - eventsListView.setAdapter(arrayAdapter); - */ - } + } + } \ No newline at end of file diff --git a/src/cs/softwarearchitecture/eventcal/EventNotificationReceiver.java b/src/cs/softwarearchitecture/eventcal/utility/EventNotificationReceiver.java similarity index 96% rename from src/cs/softwarearchitecture/eventcal/EventNotificationReceiver.java rename to src/cs/softwarearchitecture/eventcal/utility/EventNotificationReceiver.java index f968ba7..9ea8ff3 100644 --- a/src/cs/softwarearchitecture/eventcal/EventNotificationReceiver.java +++ b/src/cs/softwarearchitecture/eventcal/utility/EventNotificationReceiver.java @@ -1,7 +1,7 @@ /** * */ -package cs.softwarearchitecture.eventcal; +package cs.softwarearchitecture.eventcal.utility; import android.app.Notification; import android.app.NotificationManager; @@ -14,6 +14,7 @@ import android.net.Uri; import android.os.Bundle; import android.util.Log; +import cs.softwarearchitecture.eventcal.R; import cs.softwarearchitecture.eventcal.modify.EditEvent; /** diff --git a/src/cs/softwarearchitecture/eventcal/SettingsActivity.java b/src/cs/softwarearchitecture/eventcal/utility/SettingsActivity.java similarity index 55% rename from src/cs/softwarearchitecture/eventcal/SettingsActivity.java rename to src/cs/softwarearchitecture/eventcal/utility/SettingsActivity.java index b7b18f1..879bfcd 100644 --- a/src/cs/softwarearchitecture/eventcal/SettingsActivity.java +++ b/src/cs/softwarearchitecture/eventcal/utility/SettingsActivity.java @@ -1,9 +1,15 @@ -package cs.softwarearchitecture.eventcal; +package cs.softwarearchitecture.eventcal.utility; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.net.URL; +import android.annotation.SuppressLint; +import android.app.ActionBar; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; @@ -13,6 +19,7 @@ import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; +import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.preference.CheckBoxPreference; @@ -23,16 +30,21 @@ import android.preference.PreferenceManager; import android.preference.RingtonePreference; import android.text.TextUtils; +import android.util.JsonReader; import android.util.Log; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.widget.EditText; - import com.facebook.android.AsyncFacebookRunner.RequestListener; import com.facebook.android.DialogError; import com.facebook.android.Facebook.DialogListener; import com.facebook.android.FacebookError; +import cs.softwarearchitecture.eventcal.DefaultView; +import cs.softwarearchitecture.eventcal.R; +import cs.softwarearchitecture.eventcal.contentprovider.DBEventsContentProvider; + public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener{ // Permissions array @@ -52,6 +64,10 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); + // Action bar back button implementation + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + // In the simplified UI, fragments are not used at all and we instead // use the older PreferenceActivity APIs. @@ -80,9 +96,22 @@ protected void onPostCreate(Bundle savedInstanceState) { bindPreferenceSummaryToValue(findPreference("notifications_new_event_ringtone")); bindPreferenceSummaryToValue(findPreference("sync_frequency")); - + } + /* (non-Javadoc) + * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem) + */ + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch(item.getItemId()){ + case android.R.id.home: + super.onBackPressed(); + break; + } + return true; + } + /** * A preference value change listener that updates the preference's summary * to reflect its new value. @@ -102,6 +131,7 @@ public boolean onPreferenceChange(Preference preference, Object value) { preference .setSummary(index >= 0 ? listPreference.getEntries()[index] : null); + Log.d("SYNC", "Snync freq: " + listPreference.getEntries()[index]); } else if (preference instanceof RingtonePreference) { // For ringtone preferences, look up the correct display value @@ -176,6 +206,8 @@ private static void bindPreferenceSummaryToValue(Preference preference) { */ private class LoginDialogListener implements DialogListener { + private Editor mEditor; + /* (non-Javadoc) * @see com.facebook.android.Facebook.DialogListener#onComplete(android.os.Bundle) */ @@ -185,10 +217,10 @@ public void onComplete(Bundle values) { Log.d(DefaultView.TAG, "Facebook Login successful!"); // mText.setText("Facebook Login successful. Press Menu..."); SharedPreferences preference = getSharedPreferences("facebook-session", 0); - DefaultView.mEditor = preference.edit(); - DefaultView.mEditor.putString("access_token", DefaultView.mFacebook.getAccessToken()); - DefaultView.mEditor.putLong("access_expires", DefaultView.mFacebook.getAccessExpires()); - DefaultView.mEditor.commit(); + mEditor = preference.edit(); + mEditor.putString("access_token", DefaultView.mFacebook.getAccessToken()); + mEditor.putLong("access_expires", DefaultView.mFacebook.getAccessExpires()); + mEditor.commit(); } @@ -308,97 +340,231 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { @SuppressWarnings("deprecation") @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String value) { - if (sharedPreferences.getBoolean("facebook_login", false)) { - if(!(DefaultView.mFacebook.isSessionValid())){ - int FORCE_DIALOG_AUTH =-1; - Log.d(DefaultView.TAG, "Facebook Login requested!"); - LoginDialogListener loginComplete = new LoginDialogListener(); - DefaultView.mFacebook.authorize(this, PERMS, loginComplete); - Log.d(DefaultView.TAG, "Facebook authorize called!"); + if (value.equals("facebook_login")) { + if (sharedPreferences.getBoolean("facebook_login", false)) { + if(!(DefaultView.mFacebook.isSessionValid())){ + int FORCE_DIALOG_AUTH =-1; + Log.d(DefaultView.TAG, "Facebook Login requested!"); + LoginDialogListener loginComplete = new LoginDialogListener(); + DefaultView.mFacebook.authorize(this, PERMS, loginComplete); + Log.d(DefaultView.TAG, "Facebook authorize called!"); + } } + else { + if(DefaultView.mFacebook.isSessionValid()){ + Log.d(DefaultView.TAG, "Logging out..."); + try{ + DefaultView.mAsyncRunnner.logout(this, new LogoutRequestListener()); + } + catch (Exception e){ + Log.e(DefaultView.TAG, "Exception caught: " + e.getMessage()); + } + } + + // Delete confirmation dialog + deleteDialog("facebook_login", "FACEBOOK"); + } } - else { - if(DefaultView.mFacebook.isSessionValid()){ - Log.d(DefaultView.TAG, "Logging out..."); - try{ - DefaultView.mAsyncRunnner.logout(this, new LogoutRequestListener()); + + if (value.equals("eventbrite_login")) { + if (sharedPreferences.getBoolean("eventbrite_login", false)) { + if(mSettingPreference.getString("user_id", null) == null) { + Log.d(DefaultView.TAG, "Eventbrite Login clicked! User ID: " + mSettingPreference.getString("user_id", null) ); + + // Creating a login Id dialog + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.eventbrite_user_id); + + // Get the layout inflater + LayoutInflater inflater = this.getLayoutInflater(); + + // Inflate and set the layout for the dialog + // Pass null as the parent view because its going in the dialog layout + final View dialogView = inflater.inflate(R.layout.user_id_dialog, null); + + final ValidityCheck tokenValidityCheck = new ValidityCheck(); + + builder.setView(dialogView) + // Add the buttons + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + // User clicked OK button + EditText userID = (EditText) dialogView.findViewById(R.id.userid); + + Log.d(DefaultView.TAG, "USER ID: " + userID.getText().toString()); + + // Store it in shared preferences + mSettingEditor = mSettingPreference.edit(); + mSettingEditor.putString("user_id", userID.getText().toString()); + mSettingEditor.commit(); + + dialog.cancel(); + + /* + * Checking the validity of the token + */ + tokenValidityCheck.execute(); + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + CheckBoxPreference loginCheck = (CheckBoxPreference) findPreference("eventbrite_login"); + loginCheck.setChecked(false); + + // close the dialog box + dialog.cancel(); + } + }); + + // Create the AlertDialog + AlertDialog dialog = builder.create(); + + // Show the Dialog + dialog.show(); } - catch (Exception e){ - Log.e(DefaultView.TAG, "Exception caught: " + e.getMessage()); + } + else{ + // Delete confirmation dialog + if (mSettingPreference.getString("user_id", null) != null) { + deleteDialog("eventbrite_login", "EVENTBRITE"); + + Log.d(DefaultView.TAG, "Deleting user ID for Eventbrite!"); + mSettingEditor = mSettingPreference.edit(); + mSettingEditor.remove("user_id"); + mSettingEditor.commit(); } } - } + } - if (sharedPreferences.getBoolean("eventbrite_login", false)) { - if(mSettingPreference.getString("user_id", null) == null) { - Log.d(DefaultView.TAG, "Eventbrite Login clicked!"); + if (value.equals("google_login")) { + if (sharedPreferences.getBoolean("google_login", false)) { + Log.d(DefaultView.TAG, "Google Login clicked!"); + } + else { + deleteDialog("google_login", "GOOGLE"); + } + } + + if (value.equals("uw_login")) { + if (sharedPreferences.getBoolean("uw_login", false)) { + Log.d(DefaultView.TAG, "UW Login clicked!"); + } + else { + deleteDialog("uw_login", "UW"); + } + } + } + + /** + * Deleting events + * @param tableSource + * @param checkboxName + * + */ + @SuppressLint("DefaultLocale") + private void deleteDialog(final String checkboxName, final String tableSource) { + // Give a warning message before deleting data + AlertDialog.Builder warningBox = new AlertDialog.Builder(SettingsActivity.this); + warningBox.setIcon(R.drawable.ic_stat_alerts).setTitle("Warning") + .setMessage("Are you sure you want to delete " + tableSource.toLowerCase() + " events?") + .setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @SuppressWarnings("deprecation") + @Override + public void onClick(DialogInterface dialog, int id) { + CheckBoxPreference loginCheck = (CheckBoxPreference) findPreference(checkboxName); + loginCheck.setChecked(false); + + // Delete the data + getContentResolver().delete(DBEventsContentProvider.CONTENT_URI, "TABLE_SOURCE LIKE \"" + tableSource + "\"", null); - // Creating a login Id dialog - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.eventbrite_user_id); + dialog.cancel(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @SuppressWarnings("deprecation") + @Override + public void onClick(DialogInterface dialog, int id) { + CheckBoxPreference loginCheck = (CheckBoxPreference) findPreference(checkboxName); + loginCheck.setChecked(false); + + // close the dialog box + dialog.cancel(); + } + }); + // Create the AlertDialog + AlertDialog warningDialog = warningBox.create(); + // Show the Dialog + warningDialog.show(); + } + + /** + * Checking the validity of the token + */ + class ValidityCheck extends AsyncTask { + + @Override + protected Boolean doInBackground(Void... params) { + HttpURLConnection urlConnection; + InputStream in; + try { + // Storing in pref + SharedPreferences preference = getSharedPreferences("eventbrite-session", 0); + Editor eventbriteEditor = preference.edit(); + eventbriteEditor.putString("user_id", mSettingPreference.getString("user_id", null)); + eventbriteEditor.commit(); - // Get the layout inflater - LayoutInflater inflater = this.getLayoutInflater(); - - // Inflate and set the layout for the dialog - // Pass null as the parent view because its going in the dialog layout - final View dialogView = inflater.inflate(R.layout.user_id_dialog, null); - - builder.setView(dialogView) - // Add the buttons - .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - // User clicked OK button - EditText userID = (EditText) dialogView.findViewById(R.id.userid); - - try{ - Log.d(DefaultView.TAG, "USER ID: " + userID.getText().toString()); - // Also check the value is correct or not - - - // Store it in shared preferences - mSettingEditor = mSettingPreference.edit(); - mSettingEditor.putString("user_id", userID.getText().toString()); - mSettingEditor.commit(); - } - catch (Exception e){ - Log.e(DefaultView.TAG, "Exception caught: " + e.getMessage()); - } - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - CheckBoxPreference loginCheck = (CheckBoxPreference) findPreference("eventbrite_login"); + URL url = new URL("https://www.eventbrite.com/json/event_search?app_key=SCGKMFBZ2BGVSH5XL2&user_key=" + mSettingPreference.getString("user_id", null)); + urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection.setDoInput(true); + in = urlConnection.getInputStream(); + JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8")); + reader.beginObject(); + Log.d(DefaultView.TAG, reader.toString()); + if (reader.nextName().equals("error")){ + reader.close(); + urlConnection.disconnect(); + return true; + } + else{ + reader.close(); + urlConnection.disconnect(); + return false; + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + /* (non-Javadoc) + * @see android.os.AsyncTask#onPostExecute(java.lang.Object) + */ + @Override + protected void onPostExecute(Boolean result) { + if(result) { + AlertDialog.Builder invalidUser = new AlertDialog.Builder(SettingsActivity.this); + invalidUser.setIcon(R.drawable.ic_stat_alerts).setTitle("Error").setMessage("Invalid User ID!").setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + CheckBoxPreference loginCheck = (CheckBoxPreference) findPreference("eventbrite_login"); loginCheck.setChecked(false); - - // close the dialog box + //nothing just close the box dialog.cancel(); - } - }); - + } + }); // Create the AlertDialog - AlertDialog dialog = builder.create(); - + AlertDialog invalidDialog = invalidUser.create(); // Show the Dialog - dialog.show(); + invalidDialog.show(); + mSettingEditor = mSettingPreference.edit(); + mSettingEditor.remove("user_id"); + mSettingEditor.commit(); } - } - else{ - Log.d(DefaultView.TAG, "Deleting user ID for Eventbrite!"); - mSettingEditor = mSettingPreference.edit(); - mSettingEditor.remove("user_id"); - mSettingEditor.commit(); - } - - if (sharedPreferences.getBoolean("google_login", false)) { - Log.d(DefaultView.TAG, "Google Login clicked!"); - } - - if (sharedPreferences.getBoolean("uw_login", false)) { - Log.d(DefaultView.TAG, "UW Login clicked!"); } } - }