Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "ignoring unecessary files"

This reverts commit cc59506.
  • Loading branch information...
commit cb02eb2186245df16e082f4d20c6e4b88da17e95 1 parent cc59506
@loganlinn authored
Showing with 11,711 additions and 3 deletions.
  1. +0 −3  .gitignore
  2. +29 −0 .svn/all-wcprops
  3. +16 −0 .svn/dir-props
  4. +211 −0 .svn/entries
  5. +7 −0 .svn/text-base/.classpath.svn-base
  6. +33 −0 .svn/text-base/.project.svn-base
  7. +31 −0 .svn/text-base/AndroidManifest.xml.svn-base
  8. +11 −0 .svn/text-base/default.properties.svn-base
  9. 0  README
  10. +5 −0 src/com/.svn/all-wcprops
  11. +6 −0 src/com/.svn/dir-prop-base
  12. +31 −0 src/com/.svn/entries
  13. +5 −0 src/com/loganlinn/.svn/all-wcprops
  14. +6 −0 src/com/loganlinn/.svn/dir-prop-base
  15. +54 −0 src/com/loganlinn/.svn/entries
  16. +71 −0 src/com/loganlinn/pivotaltracker/.svn/all-wcprops
  17. +6 −0 src/com/loganlinn/pivotaltracker/.svn/dir-prop-base
  18. +660 −0 src/com/loganlinn/pivotaltracker/.svn/entries
  19. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/Attachment.java.svn-base
  20. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/CursorQuery.java.svn-base
  21. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/IterationEntry.java.svn-base
  22. +12 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/Member.java.svn-base
  23. +71 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/MemberEntry.java.svn-base
  24. +341 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTracker.java.svn-base
  25. +30 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerError.java.svn-base
  26. +6 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerListener.java.svn-base
  27. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerResponseListener.java.svn-base
  28. +15 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/Project.java.svn-base
  29. +160 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectEntry.java.svn-base
  30. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectIntegration.java.svn-base
  31. +5 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectMember.java.svn-base
  32. +55 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/Story.java.svn-base
  33. +196 −0 src/com/loganlinn/pivotaltracker/.svn/text-base/StoryEntry.java.svn-base
  34. +5 −0 src/com/loganlinn/pivotaltracker/Attachment.java
  35. +5 −0 src/com/loganlinn/pivotaltracker/CursorQuery.java
  36. +5 −0 src/com/loganlinn/pivotaltracker/IterationEntry.java
  37. +12 −0 src/com/loganlinn/pivotaltracker/Member.java
  38. +71 −0 src/com/loganlinn/pivotaltracker/MemberEntry.java
  39. +341 −0 src/com/loganlinn/pivotaltracker/PivotalTracker.java
  40. +30 −0 src/com/loganlinn/pivotaltracker/PivotalTrackerError.java
  41. +6 −0 src/com/loganlinn/pivotaltracker/PivotalTrackerListener.java
  42. +15 −0 src/com/loganlinn/pivotaltracker/Project.java
  43. +160 −0 src/com/loganlinn/pivotaltracker/ProjectEntry.java
  44. +5 −0 src/com/loganlinn/pivotaltracker/ProjectIntegration.java
  45. +5 −0 src/com/loganlinn/pivotaltracker/ProjectMember.java
  46. +55 −0 src/com/loganlinn/pivotaltracker/Story.java
  47. +196 −0 src/com/loganlinn/pivotaltracker/StoryEntry.java
  48. +5 −0 src/com/loganlinn/pivotaltracker/xml/.svn/all-wcprops
  49. +52 −0 src/com/loganlinn/pivotaltracker/xml/.svn/entries
  50. +5 −0 src/com/loganlinn/pivotaltrackie/.svn/all-wcprops
  51. +6 −0 src/com/loganlinn/pivotaltrackie/.svn/dir-prop-base
  52. +63 −0 src/com/loganlinn/pivotaltrackie/.svn/entries
  53. +47 −0 src/com/loganlinn/pivotaltrackie/io/.svn/all-wcprops
  54. +266 −0 src/com/loganlinn/pivotaltrackie/io/.svn/entries
  55. +69 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/LocalExecutor.java.svn-base
  56. +132 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/RemoteExecutor.java.svn-base
  57. +31 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/RemoteIterationsHandler.java.svn-base
  58. +102 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/RemoteProjectsHandler.java.svn-base
  59. +81 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/RemoteStoriesHandler.java.svn-base
  60. +5 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/SaveStoryHandler.java.svn-base
  61. +115 −0 src/com/loganlinn/pivotaltrackie/io/.svn/text-base/XmlHandler.java.svn-base
  62. +69 −0 src/com/loganlinn/pivotaltrackie/io/LocalExecutor.java
  63. +132 −0 src/com/loganlinn/pivotaltrackie/io/RemoteExecutor.java
  64. +31 −0 src/com/loganlinn/pivotaltrackie/io/RemoteIterationsHandler.java
  65. +102 −0 src/com/loganlinn/pivotaltrackie/io/RemoteProjectsHandler.java
  66. +81 −0 src/com/loganlinn/pivotaltrackie/io/RemoteStoriesHandler.java
  67. +5 −0 src/com/loganlinn/pivotaltrackie/io/SaveStoryHandler.java
  68. +115 −0 src/com/loganlinn/pivotaltrackie/io/XmlHandler.java
  69. +23 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/all-wcprops
  70. +6 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/dir-prop-base
  71. +130 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/entries
  72. +214 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/text-base/ProjectContract.java.svn-base
  73. +147 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/text-base/ProjectDatabase.java.svn-base
  74. +174 −0 src/com/loganlinn/pivotaltrackie/provider/.svn/text-base/ProjectProvider.java.svn-base
  75. +214 −0 src/com/loganlinn/pivotaltrackie/provider/ProjectContract.java
  76. +147 −0 src/com/loganlinn/pivotaltrackie/provider/ProjectDatabase.java
  77. +174 −0 src/com/loganlinn/pivotaltrackie/provider/ProjectProvider.java
  78. +11 −0 src/com/loganlinn/pivotaltrackie/service/.svn/all-wcprops
  79. +6 −0 src/com/loganlinn/pivotaltrackie/service/.svn/dir-prop-base
  80. +62 −0 src/com/loganlinn/pivotaltrackie/service/.svn/entries
  81. +221 −0 src/com/loganlinn/pivotaltrackie/service/.svn/text-base/SyncService.java.svn-base
  82. +221 −0 src/com/loganlinn/pivotaltrackie/service/SyncService.java
  83. +47 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/all-wcprops
  84. +314 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/entries
  85. +14 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/ActivityState.java.svn-base
  86. +316 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/EditStoryActivity.java.svn-base
  87. +308 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/HomeActivity.java.svn-base
  88. +53 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/LoginActivity.java.svn-base
  89. +380 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/ProjectActivity.java.svn-base
  90. +245 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/ViewStoryActivity.java.svn-base
  91. +70 −0 src/com/loganlinn/pivotaltrackie/ui/.svn/text-base/XMLTokenHandler.java.svn-base
  92. +14 −0 src/com/loganlinn/pivotaltrackie/ui/ActivityState.java
  93. +316 −0 src/com/loganlinn/pivotaltrackie/ui/EditStoryActivity.java
  94. +308 −0 src/com/loganlinn/pivotaltrackie/ui/HomeActivity.java
  95. +53 −0 src/com/loganlinn/pivotaltrackie/ui/LoginActivity.java
  96. +380 −0 src/com/loganlinn/pivotaltrackie/ui/ProjectActivity.java
  97. +245 −0 src/com/loganlinn/pivotaltrackie/ui/ViewStoryActivity.java
  98. +70 −0 src/com/loganlinn/pivotaltrackie/ui/XMLTokenHandler.java
  99. +29 −0 src/com/loganlinn/pivotaltrackie/util/.svn/all-wcprops
  100. +6 −0 src/com/loganlinn/pivotaltrackie/util/.svn/dir-prop-base
  101. +368 −0 src/com/loganlinn/pivotaltrackie/util/.svn/entries
  102. +103 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/DateTimeUtils.java.svn-base
  103. +60 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/DetachableResultReceiver.java.svn-base
  104. +87 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/FlingGestureListener.java.svn-base
  105. +195 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/HttpUtils.java.svn-base
  106. +49 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/Lists.java.svn-base
  107. +27 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/Maps.java.svn-base
  108. +134 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/NotifyingAsyncQueryHandler.java.svn-base
  109. +47 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/ParserUtils.java.svn-base
  110. +69 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/PivotalTrackerToken.java.svn-base
  111. +180 −0 src/com/loganlinn/pivotaltrackie/util/.svn/text-base/SelectionBuilder.java.svn-base
  112. +103 −0 src/com/loganlinn/pivotaltrackie/util/DateTimeUtils.java
  113. +60 −0 src/com/loganlinn/pivotaltrackie/util/DetachableResultReceiver.java
  114. +87 −0 src/com/loganlinn/pivotaltrackie/util/FlingGestureListener.java
  115. +195 −0 src/com/loganlinn/pivotaltrackie/util/HttpUtils.java
  116. +49 −0 src/com/loganlinn/pivotaltrackie/util/Lists.java
  117. +27 −0 src/com/loganlinn/pivotaltrackie/util/Maps.java
  118. +134 −0 src/com/loganlinn/pivotaltrackie/util/NotifyingAsyncQueryHandler.java
  119. +47 −0 src/com/loganlinn/pivotaltrackie/util/ParserUtils.java
  120. +69 −0 src/com/loganlinn/pivotaltrackie/util/PivotalTrackerToken.java
  121. +180 −0 src/com/loganlinn/pivotaltrackie/util/SelectionBuilder.java
View
3  .gitignore
@@ -1,3 +0,0 @@
-.svn
-src
-.class
View
29 .svn/all-wcprops
@@ -0,0 +1,29 @@
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/!svn/ver/2086/trunk/assignments/logan_linn/final/PivotalTrackie
+END
+default.properties
+K 25
+svn:wc:ra_dav:version-url
+V 87
+/svn/!svn/ver/1887/trunk/assignments/logan_linn/final/PivotalTrackie/default.properties
+END
+.classpath
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/!svn/ver/1887/trunk/assignments/logan_linn/final/PivotalTrackie/.classpath
+END
+.project
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/!svn/ver/1887/trunk/assignments/logan_linn/final/PivotalTrackie/.project
+END
+AndroidManifest.xml
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/svn/!svn/ver/2183/trunk/assignments/logan_linn/final/PivotalTrackie/AndroidManifest.xml
+END
View
16 .svn/dir-props
@@ -0,0 +1,16 @@
+K 10
+svn:ignore
+V 113
+# Eclipse meta-information
+/.project
+/.classpath
+/.settings
+bin
+
+# Local Properties
+local.properties
+
+# SVN
+.svn
+
+END
View
211 .svn/entries
@@ -0,0 +1,211 @@
+10
+
+dir
+2086
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie
+https://vtnetapps.googlecode.com/svn
+
+
+
+2010-11-30T01:50:07.295384Z
+2086
+logan.linn@gmail.com
+has-props
+has-prop-mods
+
+
+
+
+
+
+
+
+
+
+
+
+13dd798f-c9a9-0d3a-1410-a4e436c6fec4
+
+
+
+
+
+
+
+immediates
+((conflict 4 .git dir update deleted edited (version https://vtnetapps.googlecode.com/svn 4 1887 trunk/assignments/logan_linn/final/PivotalTrackie/.git dir) (version https://vtnetapps.googlecode.com/svn 4 1970 trunk/assignments/logan_linn/final/PivotalTrackie/.git none)))
+
+default.properties
+file
+
+
+
+
+2010-11-01T20:04:10.000000Z
+8d79ea50b3b4eb3970a455abbc97b61a
+2010-11-08T03:02:57.877705Z
+1887
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+364
+
+.classpath
+file
+
+
+
+
+2010-11-01T20:04:10.000000Z
+20cf7e6f1cd84dd2fc63bde4738a2a5e
+2010-11-08T03:02:57.877705Z
+1887
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+273
+
+.git
+dir
+
+
+
+add
+
+
+
+
+
+
+
+
+
+
+
+
+
+copied
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie/.git
+1887
+
+assets
+dir
+
+.project
+file
+
+
+
+
+2010-11-01T20:04:10.000000Z
+6e7fc9fafe2df3163535ddc5419849d0
+2010-11-08T03:02:57.877705Z
+1887
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+817
+
+AndroidManifest.xml
+file
+2183
+
+
+
+2010-12-01T23:40:12.000000Z
+0ccad628faa88afe504efb7320e74b31
+2010-12-02T04:08:08.804433Z
+2183
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1076
+
+src
+dir
+
+bin
+dir
+
+design
+dir
+
+res
+dir
+
View
7 .svn/text-base/.classpath.svn-base
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
33 .svn/text-base/.project.svn-base
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>PivotalTrackie</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
31 .svn/text-base/AndroidManifest.xml.svn-base
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.loganlinn.pivotaltrackie" android:versionCode="1"
+ android:versionName="1.0">
+
+ <application android:icon="@drawable/icon" android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar">
+ <activity android:name=".ui.HomeActivity" android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+
+ </intent-filter>
+
+ </activity>
+
+ <activity android:name=".ui.LoginActivity"></activity>
+
+ <activity android:name=".ui.ProjectActivity"></activity>
+
+ <activity android:name=".ui.ViewStoryActivity"></activity>
+
+ <service android:enabled="true" android:name=".service.SyncService">
+
+ </service>
+ <provider android:name=".provider.ProjectProvider"
+ android:authorities="com.loganlinn.pivotaltrackie" />
+ </application>
+
+ <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+</manifest>
View
11 .svn/text-base/default.properties.svn-base
@@ -0,0 +1,11 @@
+# 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 use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-8
View
0  README
No changes.
View
5 src/com/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/!svn/ver/2086/trunk/assignments/logan_linn/final/PivotalTrackie/src/com
+END
View
6 src/com/.svn/dir-prop-base
@@ -0,0 +1,6 @@
+K 10
+svn:ignore
+V 6
+.git*
+
+END
View
31 src/com/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+2086
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie/src/com
+https://vtnetapps.googlecode.com/svn
+
+
+
+2010-11-30T01:50:07.295384Z
+2086
+logan.linn@gmail.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+13dd798f-c9a9-0d3a-1410-a4e436c6fec4
+
+loganlinn
+dir
+
View
5 src/com/loganlinn/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 86
+/svn/!svn/ver/2086/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn
+END
View
6 src/com/loganlinn/.svn/dir-prop-base
@@ -0,0 +1,6 @@
+K 10
+svn:ignore
+V 6
+.git*
+
+END
View
54 src/com/loganlinn/.svn/entries
@@ -0,0 +1,54 @@
+10
+
+dir
+2086
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn
+https://vtnetapps.googlecode.com/svn
+
+
+
+2010-11-30T01:50:07.295384Z
+2086
+logan.linn@gmail.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+13dd798f-c9a9-0d3a-1410-a4e436c6fec4
+
+pivotaltrackie
+dir
+
+pivotaltracker
+dir
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltrackie/pivotaltracker
+1887
+
View
71 src/com/loganlinn/pivotaltracker/.svn/all-wcprops
@@ -0,0 +1,71 @@
+K 25
+svn:wc:ra_dav:version-url
+V 101
+/svn/!svn/ver/2086/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker
+END
+PivotalTrackerListener.java
+K 25
+svn:wc:ra_dav:version-url
+V 129
+/svn/!svn/ver/2028/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/PivotalTrackerListener.java
+END
+Story.java
+K 25
+svn:wc:ra_dav:version-url
+V 112
+/svn/!svn/ver/2389/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/Story.java
+END
+IterationEntry.java
+K 25
+svn:wc:ra_dav:version-url
+V 121
+/svn/!svn/ver/2626/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/IterationEntry.java
+END
+StoryEntry.java
+K 25
+svn:wc:ra_dav:version-url
+V 117
+/svn/!svn/ver/2587/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/StoryEntry.java
+END
+CursorQuery.java
+K 25
+svn:wc:ra_dav:version-url
+V 118
+/svn/!svn/ver/2183/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/CursorQuery.java
+END
+PivotalTrackerError.java
+K 25
+svn:wc:ra_dav:version-url
+V 126
+/svn/!svn/ver/2028/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/PivotalTrackerError.java
+END
+Project.java
+K 25
+svn:wc:ra_dav:version-url
+V 114
+/svn/!svn/ver/2170/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/Project.java
+END
+Member.java
+K 25
+svn:wc:ra_dav:version-url
+V 113
+/svn/!svn/ver/2389/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/Member.java
+END
+ProjectEntry.java
+K 25
+svn:wc:ra_dav:version-url
+V 119
+/svn/!svn/ver/2588/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/ProjectEntry.java
+END
+MemberEntry.java
+K 25
+svn:wc:ra_dav:version-url
+V 118
+/svn/!svn/ver/2389/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/MemberEntry.java
+END
+PivotalTracker.java
+K 25
+svn:wc:ra_dav:version-url
+V 121
+/svn/!svn/ver/2626/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker/PivotalTracker.java
+END
View
6 src/com/loganlinn/pivotaltracker/.svn/dir-prop-base
@@ -0,0 +1,6 @@
+K 10
+svn:ignore
+V 6
+.git*
+
+END
View
660 src/com/loganlinn/pivotaltracker/.svn/entries
@@ -0,0 +1,660 @@
+10
+
+dir
+2086
+https://vtnetapps.googlecode.com/svn/trunk/assignments/logan_linn/final/PivotalTrackie/src/com/loganlinn/pivotaltracker
+https://vtnetapps.googlecode.com/svn
+
+
+
+2010-11-30T01:50:07.295384Z
+2086
+logan.linn@gmail.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+13dd798f-c9a9-0d3a-1410-a4e436c6fec4
+
+
+
+
+
+
+
+
+()
+
+PivotalTrackerListener.java
+file
+
+
+
+
+2010-11-22T14:43:30.000000Z
+27a36b8e0312f607f4c8b49aa5b3ff4b
+2010-11-26T19:31:41.563373Z
+2028
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+170
+
+StoryEntry.java
+file
+2587
+
+
+
+2010-12-06T06:52:26.000000Z
+6436ae026aca946880b6c27666a39dd2
+2010-12-07T22:40:29.935924Z
+2587
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4839
+
+PivotalTrackerResource.java
+file
+2183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
+StoryTask.java
+file
+2389
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
+CursorQuery.java
+file
+2183
+
+
+
+2010-12-01T22:09:33.000000Z
+ee21bc582e42882b3073198ab778f492
+2010-12-02T04:08:08.804433Z
+2183
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+99
+
+PivotalTrackerError.java
+file
+
+
+
+
+2010-11-22T14:45:57.000000Z
+52387d4eadbd82d1df700f731f3d51b9
+2010-11-26T19:31:41.563373Z
+2028
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+511
+
+Project.java
+file
+2170
+
+
+
+2010-12-01T15:16:22.000000Z
+4e372ffba8937a64c715cf5346c7a454
+2010-12-01T18:03:53.612881Z
+2170
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+415
+
+Member.java
+file
+2389
+
+
+
+2010-12-02T23:03:04.000000Z
+6e54ab1bf00ce16d474b33ee3c67825c
+2010-12-03T04:10:27.338840Z
+2389
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+259
+
+ProjectIntegration.java
+file
+
+
+
+
+2010-11-15T16:29:33.000000Z
+2b7fdf54e07910e51508bd22cbfcf2a9
+2010-11-18T06:04:04.323673Z
+1972
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+76
+
+IterationEntry.java
+file
+2626
+
+
+
+2010-12-08T14:42:33.000000Z
+df1ae25c2601b97a2355bce45c63d93c
+2010-12-10T17:14:25.002194Z
+2626
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+73
+
+xml
+dir
+
+Story.java
+file
+2389
+
+
+
+2010-12-03T01:57:00.000000Z
+2722d5bd8c89989c2c8f849f1910c310
+2010-12-03T04:10:27.338840Z
+2389
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1236
+
+Token.java
+file
+2183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
+AsyncPivotalTrackerRunner.java
+file
+2183
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
+PivotalTrackerAPI.java
+file
+2389
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
+ProjectEntry.java
+file
+2588
+
+
+
+2010-12-07T22:41:23.000000Z
+d4211bd14d5c0cb74f93a9730c87baa8
+2010-12-08T00:10:34.757519Z
+2588
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4988
+
+Attachment.java
+file
+
+
+
+
+2010-11-15T16:29:33.000000Z
+67e6181d4b0ad6fdb6b403dc94998cb9
+2010-11-18T06:04:04.323673Z
+1972
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+68
+
+MemberEntry.java
+file
+2389
+
+
+
+2010-12-02T23:52:59.000000Z
+ab7263eeaacab054ad3951c6bdfe1b53
+2010-12-03T04:10:27.338840Z
+2389
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1775
+
+PivotalTracker.java
+file
+2626
+
+
+
+2010-12-08T14:40:02.000000Z
+cf22c9390153e55e70ff513df4388917
+2010-12-10T17:14:25.002194Z
+2626
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+10464
+
+ProjectMember.java
+file
+
+
+
+
+2010-11-15T16:29:33.000000Z
+4fcceb7714719c2b7434248820195f97
+2010-11-18T06:04:04.323673Z
+1972
+loganlinn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+71
+
+IternationEntry.java
+file
+2626
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/Attachment.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class Attachment {
+
+}
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/CursorQuery.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public interface CursorQuery {
+ String[] PROJECTION = {};
+}
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/IterationEntry.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class IterationEntry {
+
+}
View
12 src/com/loganlinn/pivotaltracker/.svn/text-base/Member.java.svn-base
@@ -0,0 +1,12 @@
+package com.loganlinn.pivotaltracker;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Members;
+
+public class Member {
+ public interface DefaultMemberQuery extends CursorQuery{
+ String[] PROJECTION = {
+ Members.NAME
+ };
+ int NAME = 0;
+ }
+}
View
71 src/com/loganlinn/pivotaltracker/.svn/text-base/MemberEntry.java.svn-base
@@ -0,0 +1,71 @@
+package com.loganlinn.pivotaltracker;
+
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.END_TAG;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
+import static org.xmlpull.v1.XmlPullParser.TEXT;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Members;
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.SyncColumns;
+
+public class MemberEntry extends HashMap<String, String>{
+ public static final String[] FIELDS = {
+ Members.NAME,
+ Members.EMAIL,
+ Members.INITIALS,
+ };
+
+ public interface MemberTags{
+ String MEMBER_ID = "id";
+ }
+
+ public MemberEntry(){
+ for(String f : FIELDS){
+ put(f,null);
+ }
+ }
+
+ public void sanitizeNullValues(){
+ for(String k: keySet()){
+ if(get(k) == null){
+ put(k,"");
+ }
+ }
+ }
+
+ public static MemberEntry fromParser(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+
+ final int depth = parser.getDepth();
+ final MemberEntry entry = new MemberEntry();
+ String tag = null;
+ int type;
+ while (((type = parser.next()) != END_TAG || parser.getDepth() > depth)
+ && type != END_DOCUMENT) {
+ if (type == START_TAG) {
+ tag = parser.getName();
+ } else if (type == END_TAG) {
+ tag = null;
+ } else if (type == TEXT) {
+ if(tag != null){
+ String text = parser.getText();
+ if(MemberTags.MEMBER_ID.equals(tag)){
+ entry.put(Members.MEMBER_ID, text);//store as story_id not id
+ }else if(entry.containsKey(tag)){
+ entry.put(tag, text);
+ }
+ }
+ }
+ }
+
+ entry.put(SyncColumns.UPDATED, String.valueOf(System.currentTimeMillis()));
+
+ return entry;
+ }
+}
View
341 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTracker.java.svn-base
@@ -0,0 +1,341 @@
+package com.loganlinn.pivotaltracker;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.util.Base64;
+import android.util.Log;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Stories;
+import com.loganlinn.pivotaltrackie.ui.XMLTokenHandler;
+import com.loganlinn.pivotaltrackie.util.HttpUtils;
+
+public class PivotalTracker extends HttpUtils {
+ private static final String TAG = "PivotalTrackerAPI";
+ public static final String BASE_ADDRESS = "http://www.pivotaltracker.com";
+ public static final String BASE_HTTPS_ADDRESS = "https://www.pivotaltracker.com";
+ public static final String TOKEN_PATH = "";
+ private static Context sContext;
+ private static PivotalTracker sInstance = null;
+ //
+ private static String sToken = "408384a051c11410ce069a01c1cc665f";// REPLACE
+ // WITH
+ // YOUR
+ // TOKEN
+ // FOR
+ // TESTING
+ private static SimpleDateFormat sDateFormat = new SimpleDateFormat(
+ "yyyy/MM/dd kk:mm:ss zzz"); // ex 2010/12/03 14:41:52 UTC
+ private ContentResolver mContentResolver;
+
+ public static String getStoriesUrl(int projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%d/stories", projectId);
+ }
+
+ public static String getStoriesUrl(String projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/stories", projectId);
+ }
+
+ public static String getStoryUrl(int projectId, int storyId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%d/stories/%d",
+ projectId, storyId);
+ }
+
+ public static String getStoryUrl(String projectId, String storyId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/stories/%s",
+ projectId, storyId);
+ }
+
+ public static String getIterationUrl(String projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/iterations",
+ projectId);
+ }
+
+ /**
+ * Forces the singleton instance to be recreated (if it exists) with the
+ * given context
+ *
+ * @param ctx
+ * @return
+ */
+ public static synchronized PivotalTracker newInstance(Context ctx) {
+ sInstance = new PivotalTracker(ctx);
+ return sInstance;
+ }
+
+ /**
+ * Get the singleton PivotalTracker instance If an instance already exists,
+ * create one with the passed context, otherwise the context is not used
+ *
+ * @param ctx
+ * @return
+ */
+ public static synchronized PivotalTracker getInstance(Context ctx) {
+ Log.i(TAG, "Fetching PivotalTracker API");
+ if (sInstance == null) {
+ sInstance = new PivotalTracker(ctx);
+ }
+
+ return sInstance;
+ }
+
+ /**
+ * Private constructor for singleton pattern
+ *
+ * @param context
+ */
+ private PivotalTracker(Context context) {
+ sContext = context;
+ sInstance = this;
+ mContentResolver = context.getContentResolver();
+ }
+
+ public static String getTokenUrl() {
+ return BASE_HTTPS_ADDRESS + TOKEN_PATH;
+ }
+
+ public void fetchToken(final String username, final String password,
+ PivotalTrackerListener authenticateListener) {
+ //
+ // HttpClient client = getHttpClient(sContext);
+ // URLConnection con = null;
+ // try {
+ // con = new URL(getTokenUrl()).openConnection();
+ //
+ // if (con instanceof HttpsURLConnection) {
+ // Log.w(TAG, "fetchToken connection is Https");
+ // // ((HttpsURLConnection) con)
+ // // .setHostnameVerifier(new AllowAllHostnameVerifier());
+ // }
+ //
+ // HttpsURLConnection httpsCon = (HttpsURLConnection) con;
+ // httpsCon.setHostnameVerifier(new AllowAllHostnameVerifier());
+ //
+ // final byte[] credentials = ((String) username + ":" + password)
+ // .getBytes();
+ //
+ // httpsCon.setRequestProperty("Authorization", "Basic "
+ // + Base64.encodeToString(credentials, Base64.DEFAULT));
+ // httpsCon.setAllowUserInteraction(false);
+ // httpsCon.setInstanceFollowRedirects(true);
+ // httpsCon.setRequestMethod("GET");
+ //
+ // Log.i(TAG, "Requesting URL: " + httpsCon.getURL());
+ // httpsCon.connect();
+ //
+ // if (httpsCon.getResponseCode() == HttpsURLConnection.HTTP_OK) {
+ // final String token = new XMLTokenHandler()
+ // .getTokenAndClose(httpsCon.getInputStream());
+ // Log.i(TAG, "Token = " + token);
+ //
+ // saveToken(token);
+ //
+ // authenticateListener.onSuccess(token);
+ // } else {
+ // authenticateListener.onError(new PivotalTrackerError(
+ // "HttpsConnection responseCode="
+ // + httpsCon.getResponseCode()));
+ // }
+ // } catch (MalformedURLException e) {
+ // authenticateListener
+ // .onError(new PivotalTrackerError(e.getMessage()));
+ // e.printStackTrace();
+ // return;
+ // } catch (IOException e) {
+ // authenticateListener
+ // .onError(new PivotalTrackerError(e.getMessage()));
+ // e.printStackTrace();
+ // return;
+ // }
+
+ /**
+ * TODO: FIX HTTPS SUPPORT! This throws javax.net.ssl.SSLException: Not
+ * trusted server certificate!
+ */
+ HttpParams parameters = new BasicHttpParams();
+ SchemeRegistry schemeRegistry = new SchemeRegistry();
+ SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
+ sslSocketFactory
+ .setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ schemeRegistry.register(new Scheme("https", sslSocketFactory, 443));
+ ClientConnectionManager manager = new ThreadSafeClientConnManager(
+ parameters, schemeRegistry);
+ HttpClient httpClient = new DefaultHttpClient(manager, parameters);
+
+ // DefaultHttpClient client = HttpUtils.getHttpClient(sContext);
+
+ HttpGet request = new HttpGet(this.getTokenUrl());
+ final byte[] credentials = ((String) username + ":" + password)
+ .getBytes();
+ request.setHeader("Authorization", "Basic "
+ + Base64.encodeToString(credentials, Base64.DEFAULT));
+ try {
+
+ HttpResponse response = httpClient.execute(request);
+
+ final String token = new XMLTokenHandler()
+ .getTokenAndClose(response.getEntity().getContent());
+ Log.i(TAG, "Token: " + token);
+
+ // saveToken(token);
+
+ authenticateListener.onSuccess(token);
+ } catch (ClientProtocolException e) {
+ authenticateListener
+ .onError(new PivotalTrackerError(e.getMessage()));
+ e.printStackTrace();
+ } catch (IOException e) {
+ authenticateListener
+ .onError(new PivotalTrackerError(e.getMessage()));
+ e.printStackTrace();
+ }
+
+ }
+
+ public static String getToken(Context context) {
+ sContext = context;
+ return getToken();
+ }
+
+ public static String getToken() {
+ if (sToken == null) {
+ Log.i(TAG, "Getting token from SavedPreferences");
+
+ final SharedPreferences prefs = getPreferences();
+ sToken = prefs.getString(Prefs.TOKEN, null);
+ }
+
+ return sToken;
+ }
+
+ public static HttpUriRequest getGetRequest(String url) {
+ final HttpUriRequest request = new HttpGet(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPutRequest(String url) {
+ final HttpUriRequest request = new HttpPut(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPostRequest(String url) {
+ final HttpUriRequest request = new HttpPost(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getDeleteRequest(String url) {
+ final HttpUriRequest request = new HttpDelete(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPostRequest(StoryEntry story) {
+ final String projectId = story.get(Stories.PROJECT_ID);
+ Log.i(TAG, "Creating new story for project " + projectId);
+
+ final HttpPost request = (HttpPost) getPostRequest(getStoriesUrl(projectId));
+ try {
+ final StringEntity entity = new StringEntity(story.toXml());
+
+ entity.setContentType("text/xml");
+
+ request.setHeader("Content-Type", "application/xml");
+ request.setEntity(entity);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return request;
+ }
+
+ public static HttpUriRequest getPutRequest(StoryEntry story) {
+ final String projectId = story.get(Stories.PROJECT_ID);
+ final String storyId = story.get(Stories.STORY_ID);
+
+ final HttpPut request = (HttpPut) getPutRequest(getStoryUrl(projectId,
+ storyId));
+ try {
+ final StringEntity entity = new StringEntity(story.toXml());
+
+ entity.setContentType("text/xml");
+
+ request.setHeader("Content-Type", "application/xml");
+ request.setEntity(entity);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return request;
+ }
+
+ public static HttpUriRequest getDeleteStoryRequest(int storyId,
+ int projectId) {
+
+ return (HttpDelete) getDeleteRequest(getStoryUrl(storyId, projectId));
+ }
+
+ private void saveToken(String token) {
+ final SharedPreferences prefs = getPreferences();
+ prefs.edit().putString(Prefs.TOKEN, token);
+ }
+
+ public static SharedPreferences getPreferences() {
+ return sContext.getSharedPreferences(Prefs.NAME, Context.MODE_PRIVATE);
+ }
+
+ public interface Prefs {
+ String NAME = "pivotaltracker";
+ String TOKEN = "token";
+ String ID = "id";
+ }
+
+ public static SimpleDateFormat getUTCDateFormat() {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss 'UTC'");// simpledateformat
+ // is
+ // not
+ // thread
+ // safe
+ // --
+ // return
+ // a
+ // new
+ // instance
+ df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return df;
+ }
+
+ public static SimpleDateFormat getDateFormat() {
+ return getUTCDateFormat(); // use the UTC format for now
+ }
+}
View
30 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerError.java.svn-base
@@ -0,0 +1,30 @@
+package com.loganlinn.pivotaltracker;
+
+public class PivotalTrackerError extends Throwable {
+
+ private int mStatusCode;
+
+ public PivotalTrackerError(String message) {
+ super(message);
+ }
+
+ public PivotalTrackerError(int status) {
+ mStatusCode = status;
+ }
+
+ /**
+ * @return the mStatusCode
+ */
+ public int getmStatusCode() {
+ return mStatusCode;
+ }
+
+ /**
+ * @param mStatusCode
+ * the mStatusCode to set
+ */
+ public void setmStatusCode(int mStatusCode) {
+ this.mStatusCode = mStatusCode;
+ }
+
+}
View
6 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerListener.java.svn-base
@@ -0,0 +1,6 @@
+package com.loganlinn.pivotaltracker;
+
+public interface PivotalTrackerListener {
+ public void onSuccess(String token);
+ public void onError(PivotalTrackerError error);
+}
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/PivotalTrackerResponseListener.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public interface AuthenticateListener {
+
+}
View
15 src/com/loganlinn/pivotaltracker/.svn/text-base/Project.java.svn-base
@@ -0,0 +1,15 @@
+package com.loganlinn.pivotaltracker;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Projects;
+
+public class Project {
+ public interface DefaultProjectsQuery extends CursorQuery {
+ String[] PROJECTION = {Projects.PROJECT_ID, Projects.NAME,
+ Projects.CURRENT_VELOCITY, Projects.LAST_ACTIVITY_AT};
+
+ int PROJECT_ID = 0;
+ int NAME = 1;
+ int CURRENT_VELOCITY = 2;
+ int LAST_ACTIVITY_AT = 3;
+ }
+}
View
160 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectEntry.java.svn-base
@@ -0,0 +1,160 @@
+package com.loganlinn.pivotaltracker;
+
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.END_TAG;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
+import static org.xmlpull.v1.XmlPullParser.TEXT;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.util.Log;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract;
+
+public class ProjectEntry extends HashMap<String, String> {
+ private static final String TAG = "ProjectEntry";
+ public static final String[] FIELDS = {
+ ProjectTags.ID,
+ ProjectTags.NAME,
+ ProjectTags.ITERATION_LENGTH,
+ ProjectTags.WEEK_START_DAY,
+ ProjectTags.POINT_SCALE,
+ ProjectTags.ACCOUNT,
+ ProjectTags.VELOCITY_SCHEME,
+ ProjectTags.CURRENT_VELOCITY,
+ ProjectTags.INITIAL_VELOCITY,
+ ProjectTags.NUMBER_OF_DONE_ITERATIONS_TO_SHOW,
+ ProjectTags.LABELS,
+ ProjectTags.ALLOW_ATTACHMENTS,
+ ProjectTags.PUBLIC,
+ ProjectTags.USE_HTTPS,
+ ProjectTags.BUGS_AND_CHORES_ARE_ESTIMATABLE,
+ ProjectTags.COMMIT_MODE,
+ ProjectTags.LAST_ACTIVITY_AT,
+ /*ProjectTags.MEMBERSHIPS,*/
+ ProjectTags.INTEGRATIONS
+ };
+
+ /* Expected XML Tags for Project */
+ public interface ProjectTags {
+ String PROJECTS = "projects";
+ String PROJECT = "project";
+
+ String ID = "id";
+ String NAME = "name";
+ String ITERATION_LENGTH = "iteration_length";
+ String WEEK_START_DAY = "week_start_day";
+ String POINT_SCALE = "point_scale";
+ String ACCOUNT = "account";
+ String VELOCITY_SCHEME = "velocity_scheme";
+ String CURRENT_VELOCITY = "current_velocity";
+ String INITIAL_VELOCITY = "initial_velocity";
+ String NUMBER_OF_DONE_ITERATIONS_TO_SHOW = "number_of_done_iterations_to_show";
+ String LABELS = "labels";
+ String ALLOW_ATTACHMENTS = "allow_attachments";
+ String PUBLIC = "public";
+ String USE_HTTPS = "use_https";
+ String BUGS_AND_CHORES_ARE_ESTIMATABLE = "bugs_and_chores_are_estimatable";
+ String COMMIT_MODE = "commit_mode";
+ String LAST_ACTIVITY_AT = "last_activity_at";
+ String MEMBERSHIPS = "memberships";
+ String INTEGRATIONS = "integrations";
+
+ }
+ private long mUpdated = ProjectContract.UPDATED_UNKNOWN;
+ private static final SimpleDateFormat sDatetimeFormat = PivotalTracker.getDateFormat();
+
+ public ProjectEntry(){
+ for(String f : FIELDS){
+ put(f,null);
+ }
+ }
+ public void setUpdated(long u){
+ mUpdated = u;
+ }
+
+ public long getUpdated() {
+ return mUpdated;
+ }
+
+ public static ProjectEntry fromParser(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ final int depth = parser.getDepth();
+ final ProjectEntry entry = new ProjectEntry();
+
+ String tag = null;
+ int type;
+ boolean inMemberships = false;
+
+ while (((type = parser.next()) != END_TAG || parser.getDepth() > depth)
+ && type != END_DOCUMENT) {
+ if(inMemberships) continue;
+ if (type == START_TAG) {
+ tag = parser.getName();
+ if(ProjectTags.MEMBERSHIPS.equals(tag)){
+ inMemberships = true;
+ }
+ } else if (type == END_TAG) {
+ if(ProjectTags.MEMBERSHIPS.equals(parser.getName())){
+ inMemberships = false;
+ }
+ tag = null;
+ } else if (type == TEXT) {
+ if(tag != null){
+ String text = parser.getText();
+ //Log.i(TAG, "tag="+tag+"\ttext="+text);
+
+ if(ProjectTags.LAST_ACTIVITY_AT.equals(tag)){
+ try {
+ entry.setUpdated(sDatetimeFormat.parse(text).getTime());
+ } catch (ParseException e) {
+ Log.w(TAG, "Failed to parse updated date");
+ e.printStackTrace();
+ }
+ }
+
+ if(entry.containsKey(tag)){
+ entry.put(tag, text);
+ Log.i(TAG, tag+"="+text);
+
+ }
+ }
+
+// if (ProjectTags.ID.equals(tag)) {
+// } else if (ProjectTags.NAME.equals(tag)){
+// } else if (ProjectTags.ITERATION_LENGTH.equals(tag)){
+// } else if (ProjectTags.WEEK_START_DAY.equals(tag)){
+// } else if (ProjectTags.POINT_SCALE.equals(tag)){
+// } else if (ProjectTags.VELOCITY_SCHEME.equals(tag)){
+// } else if (ProjectTags.CURRENT_VELOCITY.equals(tag)){
+// } else if (ProjectTags.INITIAL_VELOCITY.equals(tag)){
+// } else if (ProjectTags.NUMBER_OF_DONE_ITERATIONS_TO_SHOW.equals(tag)){
+// } else if (ProjectTags.LABELS.equals(tag)){
+// } else if (ProjectTags.ALLOW_ATTACHMENTS.equals(tag)){
+// } else if (ProjectTags.USE_HTTPS.equals(tag)){
+// } else if (ProjectTags.PUBLIC.equals(tag)){
+// } else if (ProjectTags.USE_HTTPS.equals(tag)){
+// } else if (ProjectTags.BUGS_AND_CHORES_ARE_ESTIMATABLE.equals(tag)){
+// } else if (ProjectTags.COMMIT_MODE.equals(tag)){
+// } else if (ProjectTags.LAST_ACTIVITY_AT.equals(tag)){
+// } else if (ProjectTags.MEMBERSHIPS.equals(tag)){
+// } else if (ProjectTags.INTEGRATIONS.equals(tag)){
+// } else if (ProjectTags.MEMBERSHIPS.equals(tag)){
+// //TODO parseMembers(parser, batch, resolver);
+// }
+ }
+ }
+
+ return entry;
+ }
+
+
+}
+
+
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectIntegration.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class ProjectIntegration {
+
+}
View
5 src/com/loganlinn/pivotaltracker/.svn/text-base/ProjectMember.java.svn-base
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class ProjectMember {
+
+}
View
55 src/com/loganlinn/pivotaltracker/.svn/text-base/Story.java.svn-base
@@ -0,0 +1,55 @@
+package com.loganlinn.pivotaltracker;
+
+import com.loganlinn.pivotaltracker.StoryEntry.StoryTags;
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Stories;
+
+public class Story {
+ public static interface DefaultStoriesQuery extends CursorQuery {
+ String[] PROJECTION = {
+ Stories.STORY_ID,
+ Stories.PROJECT_ID,
+ Stories.NAME,
+ Stories.CURRENT_STATE,
+ Stories.ESTIMATE,
+ Stories.STORY_TYPE
+ };
+ int STORY_ID = 0;
+ int PROJECT_ID = 1;
+ int NAME = 2;
+ int CURRENT_STATE = 3;
+ int ESTIMATE = 4;
+ int STORY_TYPE = 5;
+ }
+ public static interface DetailStoriesQuery{
+ String[] PROJECTION = {
+ Stories.STORY_ID,
+ Stories.PROJECT_ID,
+ Stories.STORY_TYPE,
+ Stories.URL,
+ Stories.ESTIMATE,
+ Stories.CURRENT_STATE,
+ Stories.DESCRIPTION,
+ Stories.NAME,
+ Stories.REQUESTED_BY,
+ Stories.OWNED_BY,
+ Stories.CREATED_AT,
+ Stories.ACCEPTED_AT,
+ Stories.LABELS,
+ };
+ int STORY_ID = 0;
+ int PROJECT_ID = 1;
+ int STORY_TYPE = 2;
+ int URL = 3;
+ int ESTIMATE = 4;
+ int CURRENT_STATE = 5;
+ int DESCRIPTION = 6;
+ int NAME = 7;
+ int REQUESTED_BY = 8;
+ int OWNED_BY = 9;
+ int CREATED_AT = 10;
+ int ACCEPTED_AT = 11;
+ int LABELS = 12;
+ //TODO: add full story query
+ }
+
+}
View
196 src/com/loganlinn/pivotaltracker/.svn/text-base/StoryEntry.java.svn-base
@@ -0,0 +1,196 @@
+package com.loganlinn.pivotaltracker;
+
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.END_TAG;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
+import static org.xmlpull.v1.XmlPullParser.TEXT;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.database.Cursor;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.loganlinn.pivotaltracker.Story.DefaultStoriesQuery;
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Stories;
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.SyncColumns;
+
+public class StoryEntry extends HashMap<String, String> {
+ private static final String TAG = "StoryEntry";
+
+ public static final String[] FIELDS = {
+ Stories.STORY_ID,
+ StoryTags.PROJECT_ID,
+ StoryTags.STORY_TYPE,
+ StoryTags.URL,
+ StoryTags.ESTIMATE,
+ StoryTags.CURRENT_STATE,
+ StoryTags.DESCRIPTION,
+ StoryTags.NAME,
+ StoryTags.REQUESTED_BY,
+ StoryTags.OWNED_BY,
+ StoryTags.CREATED_AT,
+ StoryTags.ACCEPTED_AT,
+ StoryTags.LABELS
+ //TODO: Allow add-in fields for integrations
+ };
+
+ public static final String[] SAVEABLE_FIELDS = {
+ StoryTags.ESTIMATE,
+ StoryTags.DESCRIPTION,
+ StoryTags.NAME,
+ StoryTags.REQUESTED_BY,
+ StoryTags.OWNED_BY,
+ StoryTags.LABELS
+ };
+
+ public interface StoryTags {
+ String STORY = "story";
+
+ String STORY_ID = "id";
+ String PROJECT_ID = "project_id";
+ String STORY_TYPE = "story_type";
+ String URL = "url";
+ String ESTIMATE = "estimate";
+ String CURRENT_STATE = "current_state";
+ String DESCRIPTION = "description";
+ String NAME = "name";
+ String REQUESTED_BY = "requested_by";
+ String OWNED_BY = "owned_by";
+ String CREATED_AT = "created_at";
+ String ACCEPTED_AT = "accepted_at";
+ String LABELS = "labels";
+ String ATTACHMENTS = "attachments";
+ }
+
+ public StoryEntry(){
+ for(String f : FIELDS){
+ put(f,null);
+ }
+ }
+
+ public void sanitizeNullValues(){
+ for(String k: keySet()){
+ if(get(k) == null){
+ put(k,"");
+ }
+ }
+ }
+ public static StoryEntry fromCursor(Cursor cursor){
+ return fromCursor(cursor, DefaultStoriesQuery.PROJECTION);
+ }
+
+
+ public static StoryEntry fromCursor(Cursor cursor, String[] projection){
+ final StoryEntry entry = new StoryEntry();
+ final int len = projection.length;
+
+ for(int i = 0; i < len; i++){
+ entry.put(projection[i], cursor.getString(i));
+ }
+
+ return entry;
+ }
+
+ public static StoryEntry fromParser(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ final int depth = parser.getDepth();
+ final StoryEntry entry = new StoryEntry();
+
+ String tag = null;
+ int type;
+
+ while (((type = parser.next()) != END_TAG || parser.getDepth() > depth)
+ && type != END_DOCUMENT) {
+ if (type == START_TAG) {
+ tag = parser.getName();
+ } else if (type == END_TAG) {
+ tag = null;
+ } else if (type == TEXT) {
+ if(tag != null){
+ String text = parser.getText();
+ if(StoryTags.STORY_ID.equals(tag)){
+ entry.put(Stories.STORY_ID, text);//store as story_id not id
+ }else if(entry.containsKey(tag)){
+ entry.put(tag, text);
+ }
+ }
+ }
+ }
+
+ entry.put(SyncColumns.UPDATED, String.valueOf(System.currentTimeMillis()));
+
+ return entry;
+ }
+
+ public static StoryEntry fromBundle(Bundle data, String[] projection) {
+ final StoryEntry entry = new StoryEntry();
+ for(String f: projection){
+ if(Stories.STORY_ID.equals(f) || Stories.PROJECT_ID.equals(f)){
+ final Object storyId = data.get(f);
+
+ if(storyId instanceof String){
+ entry.put(f, (String) storyId);
+ }else{
+ entry.put(f, String.valueOf(storyId));
+ }
+ }else{
+ entry.put(f, data.getString(f));
+ }
+ }
+ return entry;
+ }
+
+ public static StoryEntry fromBundle(Bundle data){
+ return fromBundle(data, Story.DefaultStoriesQuery.PROJECTION);
+ }
+
+ public Bundle toBundle() {
+ final Bundle bundle = new Bundle();
+ for(String f: FIELDS){
+ bundle.putString(f, get(f));
+ }
+ return bundle;
+ }
+
+ public String toXml(){
+ final StringBuilder builder = new StringBuilder();
+ Log.i(TAG, this.toString());
+
+ builder.append("<story>");
+ for(String k: SAVEABLE_FIELDS){
+ final String v = get(k);
+ if(v != null && !v.equals("")){
+ builder.append("<"+k+">");
+ builder.append(v);
+ builder.append("</"+k+">");
+ }
+ }
+ builder.append("</story>");
+ Log.i(TAG, builder.toString());
+
+ return builder.toString();
+ }
+
+ public String toString(){
+ final StringBuilder builder = new StringBuilder();
+ builder.append("{");
+
+ for(String k : keySet()){
+ builder.append(k+":"+get(k));
+ builder.append(", ");
+ }
+
+ builder.append("}");
+
+ return builder.toString();
+ }
+}
+
View
5 src/com/loganlinn/pivotaltracker/Attachment.java
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class Attachment {
+
+}
View
5 src/com/loganlinn/pivotaltracker/CursorQuery.java
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public interface CursorQuery {
+ String[] PROJECTION = {};
+}
View
5 src/com/loganlinn/pivotaltracker/IterationEntry.java
@@ -0,0 +1,5 @@
+package com.loganlinn.pivotaltracker;
+
+public class IterationEntry {
+
+}
View
12 src/com/loganlinn/pivotaltracker/Member.java
@@ -0,0 +1,12 @@
+package com.loganlinn.pivotaltracker;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Members;
+
+public class Member {
+ public interface DefaultMemberQuery extends CursorQuery{
+ String[] PROJECTION = {
+ Members.NAME
+ };
+ int NAME = 0;
+ }
+}
View
71 src/com/loganlinn/pivotaltracker/MemberEntry.java
@@ -0,0 +1,71 @@
+package com.loganlinn.pivotaltracker;
+
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.END_TAG;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
+import static org.xmlpull.v1.XmlPullParser.TEXT;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Members;
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.SyncColumns;
+
+public class MemberEntry extends HashMap<String, String>{
+ public static final String[] FIELDS = {
+ Members.NAME,
+ Members.EMAIL,
+ Members.INITIALS,
+ };
+
+ public interface MemberTags{
+ String MEMBER_ID = "id";
+ }
+
+ public MemberEntry(){
+ for(String f : FIELDS){
+ put(f,null);
+ }
+ }
+
+ public void sanitizeNullValues(){
+ for(String k: keySet()){
+ if(get(k) == null){
+ put(k,"");
+ }
+ }
+ }
+
+ public static MemberEntry fromParser(XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+
+ final int depth = parser.getDepth();
+ final MemberEntry entry = new MemberEntry();
+ String tag = null;
+ int type;
+ while (((type = parser.next()) != END_TAG || parser.getDepth() > depth)
+ && type != END_DOCUMENT) {
+ if (type == START_TAG) {
+ tag = parser.getName();
+ } else if (type == END_TAG) {
+ tag = null;
+ } else if (type == TEXT) {
+ if(tag != null){
+ String text = parser.getText();
+ if(MemberTags.MEMBER_ID.equals(tag)){
+ entry.put(Members.MEMBER_ID, text);//store as story_id not id
+ }else if(entry.containsKey(tag)){
+ entry.put(tag, text);
+ }
+ }
+ }
+ }
+
+ entry.put(SyncColumns.UPDATED, String.valueOf(System.currentTimeMillis()));
+
+ return entry;
+ }
+}
View
341 src/com/loganlinn/pivotaltracker/PivotalTracker.java
@@ -0,0 +1,341 @@
+package com.loganlinn.pivotaltracker;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.util.Base64;
+import android.util.Log;
+
+import com.loganlinn.pivotaltrackie.provider.ProjectContract.Stories;
+import com.loganlinn.pivotaltrackie.ui.XMLTokenHandler;
+import com.loganlinn.pivotaltrackie.util.HttpUtils;
+
+public class PivotalTracker extends HttpUtils {
+ private static final String TAG = "PivotalTrackerAPI";
+ public static final String BASE_ADDRESS = "http://www.pivotaltracker.com";
+ public static final String BASE_HTTPS_ADDRESS = "https://www.pivotaltracker.com";
+ public static final String TOKEN_PATH = "";
+ private static Context sContext;
+ private static PivotalTracker sInstance = null;
+ //
+ private static String sToken = "408384a051c11410ce069a01c1cc665f";// REPLACE
+ // WITH
+ // YOUR
+ // TOKEN
+ // FOR
+ // TESTING
+ private static SimpleDateFormat sDateFormat = new SimpleDateFormat(
+ "yyyy/MM/dd kk:mm:ss zzz"); // ex 2010/12/03 14:41:52 UTC
+ private ContentResolver mContentResolver;
+
+ public static String getStoriesUrl(int projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%d/stories", projectId);
+ }
+
+ public static String getStoriesUrl(String projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/stories", projectId);
+ }
+
+ public static String getStoryUrl(int projectId, int storyId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%d/stories/%d",
+ projectId, storyId);
+ }
+
+ public static String getStoryUrl(String projectId, String storyId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/stories/%s",
+ projectId, storyId);
+ }
+
+ public static String getIterationUrl(String projectId) {
+ return BASE_ADDRESS
+ + String.format("/services/v3/projects/%s/iterations",
+ projectId);
+ }
+
+ /**
+ * Forces the singleton instance to be recreated (if it exists) with the
+ * given context
+ *
+ * @param ctx
+ * @return
+ */
+ public static synchronized PivotalTracker newInstance(Context ctx) {
+ sInstance = new PivotalTracker(ctx);
+ return sInstance;
+ }
+
+ /**
+ * Get the singleton PivotalTracker instance If an instance already exists,
+ * create one with the passed context, otherwise the context is not used
+ *
+ * @param ctx
+ * @return
+ */
+ public static synchronized PivotalTracker getInstance(Context ctx) {
+ Log.i(TAG, "Fetching PivotalTracker API");
+ if (sInstance == null) {
+ sInstance = new PivotalTracker(ctx);
+ }
+
+ return sInstance;
+ }
+
+ /**
+ * Private constructor for singleton pattern
+ *
+ * @param context
+ */
+ private PivotalTracker(Context context) {
+ sContext = context;
+ sInstance = this;
+ mContentResolver = context.getContentResolver();
+ }
+
+ public static String getTokenUrl() {
+ return BASE_HTTPS_ADDRESS + TOKEN_PATH;
+ }
+
+ public void fetchToken(final String username, final String password,
+ PivotalTrackerListener authenticateListener) {
+ //
+ // HttpClient client = getHttpClient(sContext);
+ // URLConnection con = null;
+ // try {
+ // con = new URL(getTokenUrl()).openConnection();
+ //
+ // if (con instanceof HttpsURLConnection) {
+ // Log.w(TAG, "fetchToken connection is Https");
+ // // ((HttpsURLConnection) con)
+ // // .setHostnameVerifier(new AllowAllHostnameVerifier());
+ // }
+ //
+ // HttpsURLConnection httpsCon = (HttpsURLConnection) con;
+ // httpsCon.setHostnameVerifier(new AllowAllHostnameVerifier());
+ //
+ // final byte[] credentials = ((String) username + ":" + password)
+ // .getBytes();
+ //
+ // httpsCon.setRequestProperty("Authorization", "Basic "
+ // + Base64.encodeToString(credentials, Base64.DEFAULT));
+ // httpsCon.setAllowUserInteraction(false);
+ // httpsCon.setInstanceFollowRedirects(true);
+ // httpsCon.setRequestMethod("GET");
+ //
+ // Log.i(TAG, "Requesting URL: " + httpsCon.getURL());
+ // httpsCon.connect();
+ //
+ // if (httpsCon.getResponseCode() == HttpsURLConnection.HTTP_OK) {
+ // final String token = new XMLTokenHandler()
+ // .getTokenAndClose(httpsCon.getInputStream());
+ // Log.i(TAG, "Token = " + token);
+ //
+ // saveToken(token);
+ //
+ // authenticateListener.onSuccess(token);
+ // } else {
+ // authenticateListener.onError(new PivotalTrackerError(
+ // "HttpsConnection responseCode="
+ // + httpsCon.getResponseCode()));
+ // }
+ // } catch (MalformedURLException e) {
+ // authenticateListener
+ // .onError(new PivotalTrackerError(e.getMessage()));
+ // e.printStackTrace();
+ // return;
+ // } catch (IOException e) {
+ // authenticateListener
+ // .onError(new PivotalTrackerError(e.getMessage()));
+ // e.printStackTrace();
+ // return;
+ // }
+
+ /**
+ * TODO: FIX HTTPS SUPPORT! This throws javax.net.ssl.SSLException: Not
+ * trusted server certificate!
+ */
+ HttpParams parameters = new BasicHttpParams();
+ SchemeRegistry schemeRegistry = new SchemeRegistry();
+ SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
+ sslSocketFactory
+ .setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ schemeRegistry.register(new Scheme("https", sslSocketFactory, 443));
+ ClientConnectionManager manager = new ThreadSafeClientConnManager(
+ parameters, schemeRegistry);
+ HttpClient httpClient = new DefaultHttpClient(manager, parameters);
+
+ // DefaultHttpClient client = HttpUtils.getHttpClient(sContext);
+
+ HttpGet request = new HttpGet(this.getTokenUrl());
+ final byte[] credentials = ((String) username + ":" + password)
+ .getBytes();
+ request.setHeader("Authorization", "Basic "
+ + Base64.encodeToString(credentials, Base64.DEFAULT));
+ try {
+
+ HttpResponse response = httpClient.execute(request);
+
+ final String token = new XMLTokenHandler()
+ .getTokenAndClose(response.getEntity().getContent());
+ Log.i(TAG, "Token: " + token);
+
+ // saveToken(token);
+
+ authenticateListener.onSuccess(token);
+ } catch (ClientProtocolException e) {
+ authenticateListener
+ .onError(new PivotalTrackerError(e.getMessage()));
+ e.printStackTrace();
+ } catch (IOException e) {
+ authenticateListener
+ .onError(new PivotalTrackerError(e.getMessage()));
+ e.printStackTrace();
+ }
+
+ }
+
+ public static String getToken(Context context) {
+ sContext = context;
+ return getToken();
+ }
+
+ public static String getToken() {
+ if (sToken == null) {
+ Log.i(TAG, "Getting token from SavedPreferences");
+
+ final SharedPreferences prefs = getPreferences();
+ sToken = prefs.getString(Prefs.TOKEN, null);
+ }
+
+ return sToken;
+ }
+
+ public static HttpUriRequest getGetRequest(String url) {
+ final HttpUriRequest request = new HttpGet(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPutRequest(String url) {
+ final HttpUriRequest request = new HttpPut(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPostRequest(String url) {
+ final HttpUriRequest request = new HttpPost(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getDeleteRequest(String url) {
+ final HttpUriRequest request = new HttpDelete(url);
+ request.addHeader("X-TrackerToken", getToken());
+ return request;
+ }
+
+ public static HttpUriRequest getPostRequest(StoryEntry story) {
+ final String projectId = story.get(Stories.PROJECT_ID);
+ Log.i(TAG, "Creating new story for project " + projectId);
+
+ final HttpPost request = (HttpPost) getPostRequest(getStoriesUrl(projectId));
+ try {
+ final StringEntity entity = new StringEntity(story.toXml());
+
+ entity.setContentType("text/xml");
+
+ request.setHeader("Content-Type", "application/xml");
+ request.setEntity(entity);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return request;
+ }
+
+ public static HttpUriRequest getPutRequest(StoryEntry story) {
+ final String projectId = story.get(Stories.PROJECT_ID);
+ final String storyId = story.get(Stories.STORY_ID);
+
+ final HttpPut request = (HttpPut) getPutRequest(getStoryUrl(projectId,
+ storyId));
+ try {
+ final StringEntity entity = new StringEntity(story.toXml());
+
+ entity.setContentType("text/xml");
+
+ request.setHeader("Content-Type", "application/xml");
+ request.setEntity(entity);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return request;
+ }
+
+ public static HttpUriRequest getDeleteStoryRequest(int storyId,
+ int projectId) {
+
+ return (HttpDelete) getDeleteRequest(getStoryUrl(storyId, projectId));
+ }
+
+ private void saveToken(String token) {
+ final SharedPreferences prefs = getPreferences();
+ prefs.edit().putString(Prefs.TOKEN, token);
+ }
+
+ public static SharedPreferences getPreferences() {
+ return sContext.getSharedPreferences(Prefs.NAME, Context.MODE_PRIVATE);
+ }
+
+ public interface Prefs {
+ String NAME = "pivotaltracker";
+ String TOKEN = "token";
+ String ID = "id";
+ }
+
+ public static SimpleDateFormat getUTCDateFormat() {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss 'UTC'");// simpledateformat
+ // is
+ // not
+ // thread
+ // safe
+ // --
+ // return
+ // a
+ // new
+ // instance
+ df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return df;
+ }
+
+ public static SimpleDateFormat getDateFormat() {
+ return getUTCDateFormat(); // use the UTC format for now
+ }
+}
View
30 src/com/loganlinn/pivotaltracker/PivotalTrackerError.java
@@ -0,0 +1,30 @@
+package com.loganlinn.pivotaltracker;
+
+public class PivotalTrackerError extends Throwable {
+
+ private int mStatusCode;
+
+ public PivotalTrackerError(String message) {
+ super(message);
+ }
+
+ public PivotalTrackerError(int status) {
+ mStatusCode = status;
+ }
+
+ /**
+ * @return the mStatusCode
+ */
+ public int getmStatusCode() {
+ return mStatusCode;
+ }
+
+ /**
+ * @param mStatusCode
+ * the mStatusCode to set
+ */
+ public void setmStatusCode(int mStatusCode) {
+ this.mStatusCode = mStatusCode;
+ }
+
+}
View
6 src/com/loganlinn/pivotaltracker/PivotalTrackerListener.java
@@ -0,0 +1,6 @@
+package com.loganlinn.pivotaltracker;
+
+public interface PivotalTrackerListener {
+