Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Basic fonctionalities working.

Update portfolio using google finance.
Ability to configure a google account and pick a google finance portfolio
Ability to enable/disable status bar notification
  • Loading branch information...
commit b3e9ccecf693b25c2de470f53364e7c767e25666 1 parent ebba476
@benoitdion authored
Showing with 648 additions and 33 deletions.
  1. +7 −2 AndroidManifest.xml
  2. +11 −0 gen/com/bd/stocknotification/R.java
  3. +202 −0 libs/google-api-java-client-1.6.0-beta/LICENSE
  4. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/android-1.5_r4-sources.jar
  5. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/android-1.5_r4.jar
  6. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-codec-1.3-sources.jar
  7. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-codec-1.3.jar
  8. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-logging-1.1.1-sources.jar
  9. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-logging-1.1.1.jar
  10. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/google-collections-1.0-sources.jar
  11. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/google-collections-1.0.jar
  12. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/gson-1.7.1-sources.jar
  13. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/gson-1.7.1.jar
  14. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/guava-r09-sources.jar
  15. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/guava-r09.jar
  16. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpclient-4.0.3-sources.jar
  17. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpclient-4.0.3.jar
  18. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpcore-4.0.1-sources.jar
  19. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpcore-4.0.1.jar
  20. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jackson-core-asl-1.9.1-sources.jar
  21. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jackson-core-asl-1.9.1.jar
  22. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jdo2-api-2.3-eb-sources.jar
  23. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jdo2-api-2.3-eb.jar
  24. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/joda-time-1.6-sources.jar
  25. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/joda-time-1.6.jar
  26. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsontoken-1.0-sources.jar
  27. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsontoken-1.0.jar
  28. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsr305-1.3.9.jar
  29. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/junit-4.8.2-sources.jar
  30. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/junit-4.8.2.jar
  31. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/opengl-api-gl1.1-android-2.1_r1-sources.jar
  32. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/opengl-api-gl1.1-android-2.1_r1.jar
  33. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/protobuf-java-2.2.0-sources.jar
  34. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/protobuf-java-2.2.0.jar
  35. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/servlet-api-2.5-sources.jar
  36. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/servlet-api-2.5.jar
  37. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/transaction-api-1.1-sources.jar
  38. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/transaction-api-1.1.jar
  39. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xmlParserAPIs-2.6.2.jar
  40. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xpp3-1.1.4c-sources.jar
  41. BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xpp3-1.1.4c.jar
  42. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-1.6.0-beta-sources.jar
  43. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-1.6.0-beta.jar
  44. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-1.6.0-beta-sources.jar
  45. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-1.6.0-beta.jar
  46. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-android2-1.6.0-beta-sources.jar
  47. BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-android2-1.6.0-beta.jar
  48. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-1.6.0-beta-sources.jar
  49. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-1.6.0-beta.jar
  50. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-1.6.0-beta-sources.jar
  51. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-1.6.0-beta.jar
  52. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta-sources.jar
  53. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta.jar
  54. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android3-1.6.0-beta-sources.jar
  55. BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android3-1.6.0-beta.jar
  56. BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-1.6.0-beta-sources.jar
  57. BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-1.6.0-beta.jar
  58. BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-extensions-1.6.0-beta-sources.jar
  59. BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-extensions-1.6.0-beta.jar
  60. +13 −0 libs/google-api-java-client-1.6.0-beta/readme.html
  61. +12 −0 proguard.cfg
  62. BIN  res/drawable/unchanged.png
  63. +1 −1  res/values/colors.xml
  64. +12 −1 res/values/strings.xml
  65. +210 −13 src/com/bd/stocknotification/ConfigurationActivity.java
  66. +71 −0 src/com/bd/stocknotification/GoogleFinancePortfolio.java
  67. +14 −0 src/com/bd/stocknotification/PortfolioRemoteViewsAdapter.java
  68. +8 −0 src/com/bd/stocknotification/PreferencesKeys.java
  69. +2 −2 src/com/bd/stocknotification/StockRemoteViewsAdapter.java
  70. +58 −14 src/com/bd/stocknotification/StockService.java
  71. +14 −0 src/com/bd/stocknotification/StreamUtils.java
  72. +11 −0 src/com/bd/stocknotification/StringUtils.java
  73. +2 −0  stock-notification.iml
View
9 AndroidManifest.xml
@@ -3,7 +3,13 @@
package="com.bd.stocknotification"
android:versionCode="1"
android:versionName="1.0">
- <application android:label="@string/app_name" >
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+ <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+
+ <application android:label="@string/app_name" android:debuggable="true" >
<activity android:name=".ConfigurationActivity"
android:label="@string/app_name">
<intent-filter>
@@ -14,5 +20,4 @@
<service android:name="StockService">
</service>
</application>
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
View
11 gen/com/bd/stocknotification/R.java
@@ -40,6 +40,17 @@
public static final int stock_notification_container=0x7f030002;
}
public static final class string {
+ public static final int accounts_list_dialog_title=0x7f060003;
+ public static final int accounts_list_summary=0x7f060001;
+ public static final int accounts_list_title=0x7f060002;
public static final int app_name=0x7f060000;
+ public static final int error_loading_portfolios=0x7f060009;
+ public static final int google_finance_category_title=0x7f060004;
+ public static final int portfolio_list_dialog_title=0x7f060007;
+ public static final int portfolio_list_summary=0x7f060005;
+ public static final int portfolio_list_title=0x7f060006;
+ public static final int show_notification_checkbox_summary=0x7f06000b;
+ public static final int show_notification_checkbox_title=0x7f06000a;
+ public static final int text_loading=0x7f060008;
}
}
View
202 libs/google-api-java-client-1.6.0-beta/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/android-1.5_r4-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/android-1.5_r4.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-codec-1.3-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-codec-1.3.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-logging-1.1.1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/commons-logging-1.1.1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/google-collections-1.0-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/google-collections-1.0.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/gson-1.7.1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/gson-1.7.1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/guava-r09-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/guava-r09.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpclient-4.0.3-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpclient-4.0.3.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpcore-4.0.1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/httpcore-4.0.1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jackson-core-asl-1.9.1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jackson-core-asl-1.9.1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jdo2-api-2.3-eb-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jdo2-api-2.3-eb.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/joda-time-1.6-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/joda-time-1.6.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsontoken-1.0-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsontoken-1.0.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/jsr305-1.3.9.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/junit-4.8.2-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/junit-4.8.2.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/opengl-api-gl1.1-android-2.1_r1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/opengl-api-gl1.1-android-2.1_r1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/protobuf-java-2.2.0-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/protobuf-java-2.2.0.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/servlet-api-2.5-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/servlet-api-2.5.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/transaction-api-1.1-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/transaction-api-1.1.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xmlParserAPIs-2.6.2.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xpp3-1.1.4c-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/dependencies/xpp3-1.1.4c.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-android2-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-api-client-extensions-android2-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android3-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-http-client-extensions-android3-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-1.6.0-beta.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-extensions-1.6.0-beta-sources.jar
Binary file not shown
View
BIN  libs/google-api-java-client-1.6.0-beta/google-oauth-client-extensions-1.6.0-beta.jar
Binary file not shown
View
13 libs/google-api-java-client-1.6.0-beta/readme.html
@@ -0,0 +1,13 @@
+<html>
+<title>Assembly for the Google APIs Client Library for Java 1.6.0-beta</title>
+<body>
+<h2>Assembly for the Google APIs Client Library for Java 1.6.0-beta</h2>
+
+<p>High-level details about this library can be found at <a
+ href="http://code.google.com/p/google-api-java-client">http://code.google.com/p/google-api-java-client</a>,
+including JavaDoc, documentation, support, samples, and source code.</p>
+
+<p>Dependent jars are found in the <code>dependencies</code> folder.</p>
+
+</body>
+</html>
View
12 proguard.cfg
@@ -38,3 +38,15 @@
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
+
+# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
+
+-keepclassmembers class * {
+ @com.google.api.client.util.Key <fields>;
+}
+
+-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
+
+# Needed by Guava
+
+-dontwarn sun.misc.Unsafe
View
BIN  res/drawable/unchanged.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  res/values/colors.xml
@@ -3,5 +3,5 @@
<color name="symbol_text">#FF005790</color>
<color name="stock_up">#FF178817</color>
<color name="stock_down">#FFCD171C</color>
- <color name="stock_unchanged">#FFFE8314</color>
+ <color name="stock_unchanged">#FF979797</color>
</resources>
View
13 res/values/strings.xml
@@ -1,4 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="app_name">stock-notification</string>
+ <string name="app_name">Stock Notification</string>
+ <string name="accounts_list_summary">Select the Google Account you want to use</string>
+ <string name="accounts_list_title">Google Account</string>
+ <string name="accounts_list_dialog_title">Select a Google Account</string>
+ <string name="google_finance_category_title">Google Finance Settings</string>
+ <string name="portfolio_list_summary">Select the portfolio you want to use</string>
+ <string name="portfolio_list_title">Portfolio</string>
+ <string name="portfolio_list_dialog_title">Select a portfolio</string>
+ <string name="text_loading">loading...</string>
+ <string name="error_loading_portfolios">We couldn\'t load the portfolios.. Please retry later :)</string>
+ <string name="show_notification_checkbox_title">Show Notification</string>
+ <string name="show_notification_checkbox_summary">See your portfolio in the status bar</string>
</resources>
View
223 src/com/bd/stocknotification/ConfigurationActivity.java
@@ -1,27 +1,224 @@
package com.bd.stocknotification;
-import android.app.*;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AccountManagerCallback;
+import android.accounts.AccountManagerFuture;
+import android.content.*;
import android.os.Bundle;
-import android.os.Handler;
-import android.view.KeyEvent;
-import android.view.accessibility.AccessibilityManager;
-import android.widget.RemoteViews;
+import android.preference.*;
+import android.util.Log;
+import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
+import org.json.JSONArray;
+import org.json.JSONObject;
-import java.util.Date;
-import java.util.Timer;
-import java.util.TimerTask;
+import java.net.URL;
+import java.net.URLConnection;
-public class ConfigurationActivity extends Activity
+import static com.bd.stocknotification.StringUtils.*;
+
+public class ConfigurationActivity extends PreferenceActivity
+ implements SharedPreferences.OnSharedPreferenceChangeListener
{
+ private static final int REQUEST_AUTHENTICATE = 0;
+ public static final String PREFERENCE_NAME = "configuration";
+
+ private ListPreference accountsList;
+ private ListPreference portfoliosList;
+ private GoogleAccountManager googleAccountManager;
+ private SharedPreferences preference;
+ private PreferenceManager preferenceManager;
+ private CheckBoxPreference showNotificationCheckBox;
+
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ preferenceManager = getPreferenceManager();
+ preferenceManager.setSharedPreferencesName(PREFERENCE_NAME);
+ preference = getPreferenceManager().getSharedPreferences();
+ googleAccountManager = new GoogleAccountManager(this);
+
+ //setContentView(R.layout.main);
Intent i = new Intent(this, StockService.class);
startService(i);
+
+ setPreferenceScreen(buildPreferenceScreen());
+ }
+
+ private PreferenceScreen buildPreferenceScreen() {
+ PreferenceScreen root = preferenceManager.createPreferenceScreen(this);
+
+ PreferenceCategory googleFinanceCategory = new PreferenceCategory(this);
+ googleFinanceCategory.setTitle(R.string.google_finance_category_title);
+ root.addPreference(googleFinanceCategory);
+
+ accountsList = new ListPreference(this);
+ CharSequence[] accountsNames = getAccountsNames();
+ accountsList.setEntries(accountsNames);
+ accountsList.setEntryValues(accountsNames);
+ accountsList.setDialogTitle(R.string.accounts_list_dialog_title);
+ accountsList.setKey(PreferencesKeys.GOOGLE_ACCOUNT);
+ accountsList.setTitle(R.string.accounts_list_title);
+ accountsList.setSummary(R.string.accounts_list_summary);
+ googleFinanceCategory.addPreference(accountsList);
+
+ portfoliosList = new ListPreference(this);
+ portfoliosList.setDialogTitle(R.string.portfolio_list_dialog_title);
+ portfoliosList.setKey(PreferencesKeys.GOOGLE_FINANCE_PORTFOLIO);
+ portfoliosList.setTitle(R.string.portfolio_list_title);
+ portfoliosList.setSummary(R.string.portfolio_list_summary);
+ portfoliosList.setEnabled(false);
+ googleFinanceCategory.addPreference(portfoliosList);
+
+ showNotificationCheckBox = new CheckBoxPreference(this);
+ showNotificationCheckBox.setKey(PreferencesKeys.SHOW_GOOGLE_FINANCE_NOTIFICATION);
+ showNotificationCheckBox.setTitle(R.string.show_notification_checkbox_title);
+ showNotificationCheckBox.setSummary(R.string.show_notification_checkbox_summary);
+ googleFinanceCategory.addPreference(showNotificationCheckBox);
+
+ preference.registerOnSharedPreferenceChangeListener(this);
+
+ onAccountListChange();
+ onPortfolioListChange();
+
+ return root;
+ }
+
+ private CharSequence[] getAccountsNames() {
+ Account[] accounts = googleAccountManager.getAccounts();
+
+ CharSequence[] accountsNames = new CharSequence[accounts.length];
+
+ for (int i = 0; i < accountsNames.length; i++) {
+ accountsNames[i] = accounts[i].name;
+ }
+
+ return accountsNames;
+ }
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ onValueChange(key);
+ }
+
+ private void onValueChange(String key) {
+ if (key.equals(PreferencesKeys.GOOGLE_ACCOUNT)) {
+ onAccountListChange();
+ } else if(key.equals(PreferencesKeys.GOOGLE_FINANCE_PORTFOLIO)) {
+ onPortfolioListChange();
+ }
+ }
+
+ private void onPortfolioListChange() {
+ CharSequence entry = portfoliosList.getEntry();
+ if (!isNullOrEmpty(entry)) {
+ portfoliosList.setSummary(entry);
+ } else {
+ portfoliosList.setSummary(R.string.portfolio_list_summary);
+ }
+ }
+
+ private void onAccountListChange() {
+ CharSequence entry = accountsList.getEntry();
+ if (!isNullOrEmpty(entry)) {
+ String accountName = accountsList.getValue();
+ accountsList.setSummary(accountName);
+ requestToken(accountName);
+ } else {
+ accountsList.setSummary(R.string.accounts_list_summary);
+ portfoliosList.setEnabled(false);
+ }
+ }
+
+ private void requestToken(String accountName) {
+ AccountManager accountManager = AccountManager.get(getApplication());
+ accountManager.getAuthToken(googleAccountManager.getAccountByName(accountName), "finance", true,
+ new AccountManagerCallback<Bundle>() {
+ public void run(AccountManagerFuture<Bundle> future) {
+ try {
+ Bundle bundle = future.getResult();
+ if (bundle.containsKey(AccountManager.KEY_INTENT)) {
+ Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT);
+ intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivityForResult(intent, REQUEST_AUTHENTICATE);
+ } else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
+ String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
+ preference.edit().putString(PreferencesKeys.GOOGLE_AUTHENTICATION_TOKEN, token).commit();
+ onTokenReceived(token);
+ }
+ } catch (Exception e) {
+ Log.e(this.getClass().getName(), "unexpected exception while trying to read the Google authentication token", e);
+ }
+ }
+ }, null);
+ }
+
+ private void onTokenReceived(String token) {
+ if (isNullOrEmpty(portfoliosList.getEntry())) {
+ portfoliosList.setSummary(R.string.text_loading);
+ }
+
+ try {
+ URL url = new URL("https://finance.google.com/finance/feeds/default/portfolios?alt=json");
+ URLConnection conn = url.openConnection();
+ conn.addRequestProperty("Authorization", "GoogleLogin auth=" + token);
+ String result = StreamUtils.convertToString(conn.getInputStream());
+
+ JSONObject json = new JSONObject(result);
+ JSONArray portfolios = json.getJSONObject("feed").getJSONArray("entry");
+
+ CharSequence[] entries = new CharSequence[portfolios.length()];
+ CharSequence[] values = new CharSequence[portfolios.length()];
+
+ for (int i = 0; i < portfolios.length(); i++) {
+ JSONObject portfolio = portfolios.getJSONObject(i);
+ String title = portfolio.getJSONObject("title").getString("$t");
+ JSONArray links = portfolio.getJSONArray("link");
+ String address = null;
+
+ for (int j = 0; j < links.length(); j++) {
+ JSONObject link = links.getJSONObject(j);
+ String rel = link.getString("rel");
+
+ if (rel.equals("self")) {
+ address = link.getString("href") + "/positions?alt=json";
+ break;
+ }
+ }
+
+ entries[i] = title;
+ values[i] = address;
+ }
+
+ portfoliosList.setSummary(R.string.portfolio_list_summary);
+ portfoliosList.setEntries(entries);
+ portfoliosList.setEntryValues(values);
+ portfoliosList.setValue(preference.getString(PreferencesKeys.GOOGLE_FINANCE_PORTFOLIO, null));
+ portfoliosList.setEnabled(true);
+ onPortfolioListChange();
+ } catch (Exception e) {
+ portfoliosList.setSummary(R.string.error_loading_portfolios);
+ Log.i(this.getClass().getName(), "An error occurred while trying to load the portfolios", e);
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ switch (requestCode) {
+ case REQUEST_AUTHENTICATE:
+ if (resultCode == RESULT_OK) {
+ String accountName = preference.getString(PreferencesKeys.GOOGLE_ACCOUNT, null);
+
+ if (!isNullOrEmpty(accountName))
+ requestToken(accountName);
+ } else {
+ // do nothing, wait for the user to select an account again.
+ }
+ break;
+ }
}
}
+
+
View
71 src/com/bd/stocknotification/GoogleFinancePortfolio.java
@@ -0,0 +1,71 @@
+package com.bd.stocknotification;
+
+import android.content.Context;
+import android.util.Log;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.bd.stocknotification.StreamUtils.convertToString;
+
+public class GoogleFinancePortfolio implements Portfolio {
+ private Context context;
+ private String positionUri;
+ private String authenticationToken;
+ private String stockPriceUri = "https://finance.google.com/finance/info?client=ig&q=";
+
+ public GoogleFinancePortfolio(Context context, String portfolioUri, String authenticationToken) {
+ this.context = context;
+ this.positionUri = portfolioUri;
+ this.authenticationToken = authenticationToken;
+ }
+
+ @Override
+ public List<Stock> getStocks() {
+ List<Stock> stocks = new ArrayList<Stock>();
+ Exception ex;
+ try {
+ URL url = new URL(positionUri);
+ URLConnection conn = url.openConnection();
+ conn.addRequestProperty("Authorization", "GoogleLogin auth=" + authenticationToken);
+ String result = convertToString(conn.getInputStream());
+
+ JSONObject json = new JSONObject(result);
+ JSONArray positions = json.getJSONObject("feed").getJSONArray("entry");
+
+ String symbols = "";
+ for (int i = 0; i < positions.length(); i++) {
+ JSONObject position = positions.getJSONObject(i);
+ JSONObject symbolDetails = position.getJSONObject("gf$symbol");
+ String symbol = symbolDetails.getString("symbol");
+ String exchange = symbolDetails.getString("exchange");
+ symbols += exchange + ":" + symbol + ",";
+ }
+
+ conn = new URL(stockPriceUri + symbols).openConnection();
+ result = StreamUtils.convertToString(conn.getInputStream());
+ // result comes back with 2 trailing slashes
+ result = result.substring(3);
+
+ positions = new JSONArray(result);
+
+ for (int i = 0; i < positions.length(); i++) {
+ JSONObject position = positions.getJSONObject(i);
+
+ stocks.add(new Stock(position.getString("t"),
+ Double.valueOf(position.getString("l")),
+ Double.valueOf(position.getString("c")),
+ Double.valueOf(position.getString("cp"))));
+ }
+ }
+ catch(Exception e) {
+ Log.e(GoogleFinancePortfolio.class.getName() , "error while trying to fetch the positions" ,e);
+ }
+
+ return stocks;
+ }
+}
View
14 src/com/bd/stocknotification/PortfolioRemoteViewsAdapter.java
@@ -12,6 +12,8 @@
private RemoteViews view;
private HashMap<String, StockRemoteViewsAdapter> adapters = new HashMap<String, StockRemoteViewsAdapter>();
private Context context;
+ // optimistic by default :)
+ private boolean isMarketUp = true;
public PortfolioRemoteViewsAdapter(Portfolio portfolio, String packageName, Context context) {
this.portfolio = portfolio;
@@ -33,10 +35,16 @@ public void updateView() {
HashMap<String, StockRemoteViewsAdapter> tempAdapters = new HashMap<String, StockRemoteViewsAdapter>();
List<Stock> stocks = portfolio.getStocks();
+ int stocksUp = 0;
+
// update existing views and create new ones if necessary.
// this is probably the most effective approach because we don't need to recreate a view for existing stocks.
// one possible downside of this approach is that it won't work if stock ordering is important
for (Stock stock : stocks) {
+ if (stock.getDayChange() > 0 || stock.getDayChangePercent() > 0) {
+ stocksUp++;
+ }
+
if (adapters.containsKey(stock.getSymbol())) {
StockRemoteViewsAdapter adapter = adapters.get(stock.getSymbol());
adapters.remove(stock.getSymbol());
@@ -50,6 +58,8 @@ public void updateView() {
}
}
+ isMarketUp = stocksUp >= (int)Math.ceil(stocks.size() / 2.0);
+
// a stock was removed. remove all views and start over
if (!adapters.isEmpty() && !stocks.isEmpty()) {
view.removeAllViews(R.id.stock_container);
@@ -60,4 +70,8 @@ public void updateView() {
adapters = tempAdapters;
}
+
+ public boolean isMarketUp() {
+ return isMarketUp;
+ }
}
View
8 src/com/bd/stocknotification/PreferencesKeys.java
@@ -0,0 +1,8 @@
+package com.bd.stocknotification;
+
+public class PreferencesKeys {
+ public static final String GOOGLE_ACCOUNT = "google_account";
+ public static String GOOGLE_FINANCE_PORTFOLIO = "google_finance_portfolio";
+ public static String GOOGLE_AUTHENTICATION_TOKEN = "google_authentication_token";
+ public static String SHOW_GOOGLE_FINANCE_NOTIFICATION = "show_google_finance_notification";
+}
View
4 src/com/bd/stocknotification/StockRemoteViewsAdapter.java
@@ -50,10 +50,10 @@ private void refreshView() {
view.setTextViewText(R.id.price, decimalFormat.format(stock.getPrice()));
view.setTextViewText(R.id.day_change, dayChangeFormat.format(stock.getDayChange()) + " (" + dayChangeFormat.format(stock.getDayChangePercent()) + "%)");
- if (stock.getDayChange() > 0) {
+ if (stock.getDayChange() > 0 || stock.getDayChangePercent() > 0) {
view.setImageViewResource(R.id.stock_image, R.drawable.up);
view.setTextColor(R.id.day_change, stockUpColor);
- } else if (stock.getDayChange() < 0) {
+ } else if (stock.getDayChange() < 0 || stock.getDayChangePercent() < 0) {
view.setImageViewResource(R.id.stock_image, R.drawable.down);
view.setTextColor(R.id.day_change, stockDownColor);
} else {
View
72 src/com/bd/stocknotification/StockService.java
@@ -1,20 +1,36 @@
package com.bd.stocknotification;
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AccountManagerCallback;
+import android.accounts.AccountManagerFuture;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
+import android.content.*;
+import android.os.Bundle;
import android.os.IBinder;
+import android.widget.RemoteViews;
+import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
+import com.google.gson.Gson;
+import org.json.JSONArray;
+import org.json.JSONObject;
-public class StockService extends Service {
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.logging.Logger;
+
+import static com.bd.stocknotification.StringUtils.isNullOrEmpty;
+
+public class StockService extends Service
+ implements SharedPreferences.OnSharedPreferenceChangeListener
+{
private BroadcastReceiver screenOnBroadcastReceiver;
private NotificationManager notificationManager;
private Notification notification;
private PortfolioRemoteViewsAdapter adapter;
+ private SharedPreferences preference;
@Override
public IBinder onBind(Intent intent) {
@@ -23,6 +39,10 @@ public IBinder onBind(Intent intent) {
@Override
public void onCreate() {
+ preference = getApplicationContext().getSharedPreferences(ConfigurationActivity.PREFERENCE_NAME, Context.MODE_PRIVATE);
+ preference.registerOnSharedPreferenceChangeListener(this);
+ notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+
final IntentFilter screenOnFilter = new IntentFilter();
screenOnFilter.addAction(Intent.ACTION_SCREEN_ON);
@@ -38,25 +58,44 @@ public void onDestroy() {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- if (adapter == null) {
- createNotification();
+ // create a new notifications when screen turns on or the service starts it seems Notification and/or RemoteViews leak memory
+ updateNotification(true);
+
+ return START_STICKY;
+ }
+
+ private void updateNotification(boolean recycle) {
+ if (!preference.getBoolean(PreferencesKeys.SHOW_GOOGLE_FINANCE_NOTIFICATION, false)) {
+ notificationManager.cancel(1);
+ return;
+ }
+
+ String portfolioUri = preference.getString(PreferencesKeys.GOOGLE_FINANCE_PORTFOLIO, null);
+ String authenticationToken = preference.getString(PreferencesKeys.GOOGLE_AUTHENTICATION_TOKEN, null);
+
+ if (notification == null || recycle) {
+ createNotification(portfolioUri, authenticationToken);
} else {
adapter.updateView();
notificationManager.notify(1, notification);
}
-
- return START_STICKY;
}
- private void createNotification() {
- notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ private void createNotification(String portfolioUri, String authenticationToken) {
+ if (isNullOrEmpty(authenticationToken) || isNullOrEmpty(portfolioUri))
+ return;
+
+ GoogleFinancePortfolio portfolio = new GoogleFinancePortfolio(getApplicationContext(), portfolioUri, authenticationToken);
- notification = new Notification(R.drawable.stock, "", System.currentTimeMillis());
+ adapter = new PortfolioRemoteViewsAdapter(portfolio, getPackageName(), getApplicationContext());
+ RemoteViews contentView = adapter.getView();
+
+ notification = new Notification(adapter.isMarketUp() ? R.drawable.up : R.drawable.down, "", System.currentTimeMillis());
notification.flags |= Notification.FLAG_NO_CLEAR;
notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE;
notification.flags |= Notification.FLAG_ONGOING_EVENT;
- adapter = new PortfolioRemoteViewsAdapter(new RandomPortfolio(), getPackageName(), getApplicationContext());
- notification.contentView = adapter.getView();
+
+ notification.contentView = contentView;
Intent notificationIntent = new Intent(this, ConfigurationActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
@@ -64,4 +103,9 @@ private void createNotification() {
notificationManager.notify(1, notification);
}
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ updateNotification(false);
+ }
}
View
14 src/com/bd/stocknotification/StreamUtils.java
@@ -0,0 +1,14 @@
+package com.bd.stocknotification;
+
+import java.io.InputStream;
+
+public class StreamUtils {
+ public static String convertToString(InputStream is) {
+ try {
+ return new java.util.Scanner(is).useDelimiter("\\A").next();
+ } catch (java.util.NoSuchElementException e) {
+ return "";
+ }
+ }
+
+}
View
11 src/com/bd/stocknotification/StringUtils.java
@@ -0,0 +1,11 @@
+package com.bd.stocknotification;
+
+public class StringUtils {
+ public static boolean isNullOrEmpty(String s) {
+ return s == null || s.equals("");
+ }
+
+ public static boolean isNullOrEmpty(CharSequence s) {
+ return s == null || s.toString().equals("");
+ }
+}
View
2  stock-notification.iml
@@ -31,6 +31,8 @@
</content>
<orderEntry type="jdk" jdkName="Android 2.3.3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="google-api-client-1.6.0-beta" level="project" />
+ <orderEntry type="library" name="gson-2.1" level="project" />
</component>
</module>
Please sign in to comment.
Something went wrong with that request. Please try again.