├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── pluscubed │ │ │ └── picasaclient │ │ │ ├── GphotosClient.java │ │ │ ├── PicasaClient.java │ │ │ ├── PicasaService.java │ │ │ └── model │ │ │ ├── AlbumEntry.java │ │ │ ├── AlbumFeed.java │ │ │ ├── AlbumFeedResponse.java │ │ │ ├── Author.java │ │ │ ├── Category.java │ │ │ ├── Content.java │ │ │ ├── ExifTags.java │ │ │ ├── Generator.java │ │ │ ├── Georss$where.java │ │ │ ├── GmlPoint.java │ │ │ ├── Gphoto$license.java │ │ │ ├── Gphoto$shapes.java │ │ │ ├── Link.java │ │ │ ├── Media$description.java │ │ │ ├── Media$keywords.java │ │ │ ├── Media$thumbnail.java │ │ │ ├── Media$title.java │ │ │ ├── MediaContent.java │ │ │ ├── MediaGroup.java │ │ │ ├── PhotoEntry.java │ │ │ ├── SingleIntegerElement.java │ │ │ ├── SingleStringElement.java │ │ │ ├── UserFeed.java │ │ │ └── UserFeedResponse.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── pluscubed │ └── picasaclient │ └── ExampleUnitTest.java ├── sample ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── pluscubed │ │ └── picasaclientsample │ │ ├── MainActivity.java │ │ └── SquareFrameLayout.java │ └── res │ ├── layout │ ├── activity_main.xml │ └── list_item_entry.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Android ### 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | # Log Files 29 | *.log 30 | 31 | 32 | ### OSX ### 33 | .DS_Store 34 | .AppleDouble 35 | .LSOverride 36 | 37 | # Icon must end with two \r 38 | Icon 39 | 40 | 41 | # Thumbnails 42 | ._* 43 | 44 | # Files that might appear on external disk 45 | .Spotlight-V100 46 | .Trashes 47 | 48 | # Directories potentially created on remote AFP share 49 | .AppleDB 50 | .AppleDesktop 51 | Network Trash Folder 52 | Temporary Items 53 | .apdisk 54 | 55 | 56 | ### Java ### 57 | *.class 58 | 59 | # Mobile Tools for Java (J2ME) 60 | .mtj.tmp/ 61 | 62 | # Package Files # 63 | *.war 64 | *.ear 65 | 66 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 67 | hs_err_pid* 68 | 69 | 70 | ### Intellij ### 71 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 72 | 73 | *.iml 74 | 75 | ## Directory-based project format: 76 | .idea/ 77 | # if you remove the above rule, at least ignore the following: 78 | 79 | # User-specific stuff: 80 | # .idea/workspace.xml 81 | # .idea/tasks.xml 82 | # .idea/dictionaries 83 | 84 | # Sensitive or high-churn files: 85 | # .idea/dataSources.ids 86 | # .idea/dataSources.xml 87 | # .idea/sqlDataSources.xml 88 | # .idea/dynamic.xml 89 | # .idea/uiDesigner.xml 90 | 91 | # Gradle: 92 | # .idea/gradle.xml 93 | # .idea/libraries 94 | 95 | # Mongo Explorer plugin: 96 | # .idea/mongoSettings.xml 97 | 98 | ## File-based project format: 99 | *.ipr 100 | *.iws 101 | 102 | ## Plugin-specific files: 103 | 104 | # IntelliJ 105 | out/ 106 | 107 | # mpeltonen/sbt-idea plugin 108 | .idea_modules/ 109 | 110 | # JIRA plugin 111 | atlassian-ide-plugin.xml 112 | 113 | # Crashlytics plugin (for Android Studio and IntelliJ) 114 | com_crashlytics_export_strings.xml 115 | crashlytics.properties 116 | crashlytics-build.properties 117 | fabric.properties 118 | 119 | ### Crashlytics ### 120 | #Crashlytics 121 | crashlytics-build.properties 122 | com_crashlytics_export_strings.xml 123 | 124 | 125 | ### Windows ### 126 | # Windows image file caches 127 | Thumbs.db 128 | ehthumbs.db 129 | 130 | # Folder config file 131 | Desktop.ini 132 | 133 | # Recycle Bin used on file shares 134 | $RECYCLE.BIN/ 135 | 136 | # Windows Installer files 137 | *.cab 138 | *.msi 139 | *.msm 140 | *.msp 141 | 142 | # Windows shortcuts 143 | *.lnk -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Picasa & Google Photos API Client 2 | 3 | [![Release](https://img.shields.io/github/release/plusCubed/android-picasa-client.svg?label=JitPack)](https://jitpack.io/#com.pluscubed/android-picasa-client) [![License](https://img.shields.io/github/license/pluscubed/android-picasa-client.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 4 | 5 | Not ready for use yet. Watch the repo for updates. 6 | 7 | ### Dependency 8 | 9 | Add this in your root `build.gradle` file (**not** your module `build.gradle` file): 10 | 11 | ```gradle 12 | allprojects { 13 | repositories { 14 | ... 15 | maven { url "https://jitpack.io" } 16 | } 17 | } 18 | ``` 19 | 20 | Add this to your module's `build.gradle` file: 21 | 22 | ```Gradle 23 | dependencies { 24 | ... 25 | compile 'com.pluscubed:android-picasa-client:{latest-version}' 26 | } 27 | ``` 28 | 29 | The library is versioned according to [Semantic Versioning](http://semver.org/). 30 | 31 | ### Basic Usage 32 | 1. `PicasaClient` needs to be attached to the Activity using it, and can be detached when not used anymore. For example: 33 | ```java 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | //... 37 | PicasaClient.get().attachActivity(this); 38 | } 39 | 40 | @Override 41 | protected void onDestroy() { 42 | //... 43 | PicasaClient.get().detachActivity(); 44 | } 45 | ``` 46 | 47 | 2. In `onActivityResult()`, you need to add the following to let the client resolve any error code or process the chosen user account: 48 | ```java 49 | @Override 50 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 51 | //... 52 | PicasaClient.get().onActivityResult(requestCode, resultCode, data); 53 | } 54 | ``` 55 | 56 | 3. The client must be initialized. You can do this in one of two ways depending on whether you know the Google account email or not at this point in your app: 57 | 58 | 2a. Call `pickUserAccount()` and use `onActivityResult()` to observe when initialization is done: 59 | ```java 60 | TODO: sample code 61 | ``` 62 | 2b. Call `setAccount()` and observe when initialization is done: 63 | ```java 64 | TODO: sample code 65 | ``` 66 | 67 | See the sample project for a full demo. 68 | 69 | ### License 70 | 71 | ``` 72 | Copyright 2016 Daniel Ciao 73 | 74 | Licensed under the Apache License, Version 2.0 (the "License"); 75 | you may not use this file except in compliance with the License. 76 | You may obtain a copy of the License at 77 | 78 | http://www.apache.org/licenses/LICENSE-2.0 79 | 80 | Unless required by applicable law or agreed to in writing, software 81 | distributed under the License is distributed on an "AS IS" BASIS, 82 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 83 | See the License for the specific language governing permissions and 84 | limitations under the License. 85 | ``` 86 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.ben-manes.versions' 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.0-alpha5' 9 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | jcenter() 17 | } 18 | } 19 | 20 | task clean(type: Delete) { 21 | delete rootProject.buildDir 22 | } 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluscubed/android-picasa-client/0b8fd5d42da66e20523dac09ebe136a4b1c6b0e8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Dec 20 21:20:58 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group = 'com.pluscubed' 5 | 6 | android { 7 | compileSdkVersion 23 8 | buildToolsVersion "23.0.2" 9 | 10 | defaultConfig { 11 | minSdkVersion 16 12 | targetSdkVersion 23 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile 'com.android.support:appcompat-v7:23.3.0' 26 | 27 | compile 'com.squareup.okhttp3:okhttp:3.2.0' 28 | compile 'com.squareup.retrofit2:retrofit:2.0.1' 29 | compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1' 30 | compile 'com.squareup.retrofit2:converter-gson:2.0.1' 31 | compile 'com.google.code.gson:gson:2.6.2' 32 | 33 | compile 'io.reactivex:rxandroid:1.1.0' 34 | compile 'io.reactivex:rxjava:1.1.2' 35 | 36 | compile 'com.google.android.gms:play-services-auth:8.4.0' 37 | 38 | compile fileTree(dir: 'libs', include: ['*.jar']) 39 | testCompile 'junit:junit:4.12' 40 | } 41 | 42 | // build a jar with source files 43 | task sourcesJar(type: Jar) { 44 | from android.sourceSets.main.java.srcDirs 45 | classifier = 'sources' 46 | } 47 | 48 | task javadoc(type: Javadoc) { 49 | failOnError false 50 | source = android.sourceSets.main.java.sourceFiles 51 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 52 | classpath += configurations.compile 53 | } 54 | 55 | // build a jar with javadoc 56 | task javadocJar(type: Jar, dependsOn: javadoc) { 57 | classifier = 'javadoc' 58 | from javadoc.getDestinationDir() 59 | } 60 | 61 | artifacts { 62 | archives sourcesJar 63 | archives javadocJar 64 | } -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\DC\Development\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/GphotosClient.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient; 2 | 3 | import com.pluscubed.picasaclient.model.AlbumEntry; 4 | import com.pluscubed.picasaclient.model.AlbumFeed; 5 | import com.pluscubed.picasaclient.model.UserFeed; 6 | 7 | import rx.Single; 8 | import rx.functions.Func1; 9 | 10 | public class GphotosClient { 11 | 12 | public Single getGphotosAlbumFeed() { 13 | return PicasaClient.get().getUserFeed() 14 | .flatMap(new Func1>() { 15 | @Override 16 | public Single call(UserFeed userFeed) { 17 | long id = -1; 18 | for (AlbumEntry entry : userFeed.getAlbumEntries()) { 19 | if (entry.getGphotoAlbumType().equals(AlbumEntry.TYPE_GOOGLE_PHOTOS)) { 20 | id = entry.getGphotoId(); 21 | } 22 | } 23 | 24 | return PicasaClient.get().getAlbumFeed(id); 25 | } 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/PicasaClient.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient; 2 | 3 | import android.accounts.Account; 4 | import android.accounts.AccountManager; 5 | import android.app.Activity; 6 | import android.app.Dialog; 7 | import android.app.Fragment; 8 | import android.content.Context; 9 | import android.content.Intent; 10 | import android.net.ConnectivityManager; 11 | import android.net.NetworkInfo; 12 | import android.support.annotation.Nullable; 13 | import android.text.TextUtils; 14 | 15 | import com.google.android.gms.auth.GoogleAuthException; 16 | import com.google.android.gms.auth.GoogleAuthUtil; 17 | import com.google.android.gms.auth.GooglePlayServicesAvailabilityException; 18 | import com.google.android.gms.auth.UserRecoverableAuthException; 19 | import com.google.android.gms.common.AccountPicker; 20 | import com.google.android.gms.common.GoogleApiAvailability; 21 | import com.pluscubed.picasaclient.model.AlbumFeed; 22 | import com.pluscubed.picasaclient.model.AlbumFeedResponse; 23 | import com.pluscubed.picasaclient.model.UserFeed; 24 | import com.pluscubed.picasaclient.model.UserFeedResponse; 25 | 26 | import java.io.IOException; 27 | import java.util.ArrayList; 28 | import java.util.Arrays; 29 | import java.util.List; 30 | 31 | import okhttp3.HttpUrl; 32 | import okhttp3.Interceptor; 33 | import okhttp3.OkHttpClient; 34 | import okhttp3.Request; 35 | import okhttp3.Response; 36 | import retrofit2.Retrofit; 37 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 38 | import retrofit2.converter.gson.GsonConverterFactory; 39 | import rx.Completable; 40 | import rx.Single; 41 | import rx.SingleSubscriber; 42 | import rx.android.schedulers.AndroidSchedulers; 43 | import rx.functions.Action1; 44 | import rx.functions.Func1; 45 | import rx.schedulers.Schedulers; 46 | 47 | public class PicasaClient { 48 | 49 | public static final String ACCOUNT_TYPE_GOOGLE = "com.google"; 50 | 51 | private static final String SCOPE_PICASA = "https://picasaweb.google.com/data/"; 52 | private static final String BASE_API_URL = "https://picasaweb.google.com/data/feed/api/user/"; 53 | 54 | private static final int REQUEST_ACCOUNT_PICKER = 1000; 55 | private static final int REQUEST_RECOVER_PLAY_SERVICES_ERROR = 1024; 56 | 57 | private static PicasaClient picasaClient; 58 | private Activity mActivity; 59 | private Fragment mFragment; 60 | private Account mAccount; 61 | private String mOAuthToken; 62 | private PicasaService mPicasaService; 63 | 64 | private PicasaClient() { 65 | OkHttpClient client = new OkHttpClient.Builder() 66 | .addInterceptor(new Interceptor() { 67 | @Override 68 | public Response intercept(Chain chain) throws IOException { 69 | Request originalRequest = chain.request(); 70 | if (originalRequest.body() != null || originalRequest.header("Authorization") != null) { 71 | return chain.proceed(originalRequest); 72 | } 73 | 74 | HttpUrl jsonUrl = originalRequest.url().newBuilder() 75 | .addQueryParameter("alt", "json") 76 | .build(); 77 | 78 | Request authorizedRequest = originalRequest.newBuilder() 79 | .url(jsonUrl) 80 | .header("Authorization", "Bearer " + mOAuthToken) 81 | .header("Gdata-version", "2") 82 | .build(); 83 | return chain.proceed(authorizedRequest); 84 | } 85 | }).build(); 86 | 87 | Retrofit retrofit = new Retrofit.Builder() 88 | .baseUrl(BASE_API_URL) 89 | .addConverterFactory(GsonConverterFactory.create()) 90 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 91 | .client(client) 92 | .build(); 93 | 94 | mPicasaService = retrofit.create(PicasaService.class); 95 | } 96 | 97 | public static PicasaClient get() { 98 | if (picasaClient == null) { 99 | picasaClient = new PicasaClient(); 100 | } 101 | return picasaClient; 102 | } 103 | 104 | public void attachActivity(Activity activity) { 105 | mActivity = activity; 106 | } 107 | 108 | public void attachFragment(Activity activity, Fragment fragment) { 109 | mActivity = activity; 110 | mFragment = fragment; 111 | } 112 | 113 | public void detach() { 114 | mActivity = null; 115 | mFragment = null; 116 | } 117 | 118 | /** 119 | * Completed when the Picasa service is initialized. 120 | */ 121 | public Completable setAccount(Account account, String... additionalScopes) { 122 | if (account.type.equals(ACCOUNT_TYPE_GOOGLE)) { 123 | mAccount = account; 124 | 125 | return retrieveTokenInitService(additionalScopes); 126 | } else { 127 | return Completable.error(new RuntimeException("You may only set a Google account")); 128 | } 129 | } 130 | 131 | 132 | /** 133 | * onActivityResult will be called either in the Activity/Fragment depending on whether a Fragment is attached. 134 | */ 135 | public void pickAccount() { 136 | String[] accountTypes = new String[]{ACCOUNT_TYPE_GOOGLE}; 137 | Intent intent = AccountPicker.newChooseAccountIntent(null, null, accountTypes, false, null, null, null, null); 138 | if (mFragment != null) { 139 | mFragment.startActivityForResult(intent, REQUEST_ACCOUNT_PICKER); 140 | } else { 141 | mActivity.startActivityForResult(intent, REQUEST_ACCOUNT_PICKER); 142 | } 143 | } 144 | 145 | 146 | /** 147 | * Processes account picker or error result. Completed when the Picasa service is initialized. 148 | */ 149 | public Completable onActivityResult(int requestCode, int resultCode, Intent data, String... additionalScopes) { 150 | if (requestCode == REQUEST_ACCOUNT_PICKER) { 151 | if (resultCode == Activity.RESULT_OK) { 152 | String accountEmail = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); 153 | mAccount = new Account(accountEmail, ACCOUNT_TYPE_GOOGLE); 154 | 155 | return retrieveTokenInitService(additionalScopes); 156 | } else if (resultCode == Activity.RESULT_CANCELED) { 157 | //Select an account to add 158 | return Completable.error(new Exception("User canceled account picker dialog")); 159 | } 160 | } else if (requestCode == REQUEST_RECOVER_PLAY_SERVICES_ERROR && resultCode == Activity.RESULT_OK) { 161 | // Receiving a result that follows a GoogleAuthException, try auth again 162 | return retrieveTokenInitService(additionalScopes); 163 | } 164 | 165 | return Completable.never(); 166 | } 167 | 168 | private boolean isDeviceOnline() { 169 | ConnectivityManager connMgr = (ConnectivityManager) mActivity.getSystemService(Context.CONNECTIVITY_SERVICE); 170 | NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); 171 | return networkInfo != null && networkInfo.isConnected(); 172 | } 173 | 174 | private Completable retrieveTokenInitService(final String... additionalScopes) { 175 | if (isDeviceOnline()) { 176 | return Single.create(new Single.OnSubscribe() { 177 | @Override 178 | public void call(SingleSubscriber subscriber) { 179 | try { 180 | List scopes = new ArrayList<>(); 181 | scopes.add(SCOPE_PICASA); 182 | scopes.addAll(Arrays.asList(additionalScopes)); 183 | subscriber.onSuccess(GoogleAuthUtil.getToken(mActivity, mAccount, "oauth2:" 184 | + TextUtils.join(" ", scopes))); 185 | } catch (IOException | GoogleAuthException e) { 186 | subscriber.onError(e); 187 | } 188 | } 189 | }).subscribeOn(Schedulers.io()) 190 | .observeOn(AndroidSchedulers.mainThread()) 191 | .doOnError(new Action1() { 192 | @Override 193 | public void call(Throwable error) { 194 | if (error instanceof GooglePlayServicesAvailabilityException) { 195 | int statusCode = ((GooglePlayServicesAvailabilityException) error) 196 | .getConnectionStatusCode(); 197 | Dialog dialog = GoogleApiAvailability.getInstance() 198 | .getErrorDialog(mActivity, statusCode, REQUEST_RECOVER_PLAY_SERVICES_ERROR); 199 | dialog.show(); 200 | } else if (error instanceof UserRecoverableAuthException) { 201 | Intent intent = ((UserRecoverableAuthException) error).getIntent(); 202 | mActivity.startActivityForResult(intent, REQUEST_RECOVER_PLAY_SERVICES_ERROR); 203 | } 204 | } 205 | }) 206 | .doOnSuccess(new Action1() { 207 | @Override 208 | public void call(String s) { 209 | mOAuthToken = s; 210 | } 211 | }) 212 | .toObservable() 213 | .toCompletable(); 214 | } else { 215 | return Completable.error(new Exception("Device not online.")); 216 | } 217 | } 218 | 219 | private void checkTokenInitialized() { 220 | if (!isInitialized()) { 221 | throw new RuntimeException("Service not initialized"); 222 | } 223 | } 224 | 225 | public boolean isInitialized(){ 226 | return mOAuthToken!=null; 227 | } 228 | 229 | @Nullable 230 | public Account getAccount(){ 231 | return mAccount; 232 | } 233 | 234 | public PicasaService getService() { 235 | checkTokenInitialized(); 236 | return mPicasaService; 237 | } 238 | 239 | public Single getUserFeed() { 240 | checkTokenInitialized(); 241 | return mPicasaService.getUserFeedResponse() 242 | .map(new Func1() { 243 | @Override 244 | public UserFeed call(UserFeedResponse response) { 245 | return response.getFeed(); 246 | } 247 | }) 248 | .subscribeOn(Schedulers.io()) 249 | .toSingle(); 250 | } 251 | 252 | public Single getAlbumFeed(long albumId) { 253 | checkTokenInitialized(); 254 | return mPicasaService.getAlbumFeedResponse(albumId) 255 | .map(new Func1() { 256 | @Override 257 | public AlbumFeed call(AlbumFeedResponse response) { 258 | return response.getFeed(); 259 | } 260 | }) 261 | .subscribeOn(Schedulers.io()) 262 | .toSingle(); 263 | } 264 | 265 | } 266 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/PicasaService.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient; 2 | 3 | 4 | import com.pluscubed.picasaclient.model.AlbumFeedResponse; 5 | import com.pluscubed.picasaclient.model.UserFeedResponse; 6 | 7 | import retrofit2.http.GET; 8 | import retrofit2.http.Path; 9 | import rx.Observable; 10 | 11 | public interface PicasaService { 12 | 13 | @GET("default") 14 | Observable getUserFeedResponse(); 15 | 16 | @GET("default/albumid/{albumId}") 17 | Observable getAlbumFeedResponse(@Path("albumId") long albumId); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/AlbumEntry.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | 12 | public class AlbumEntry { 13 | 14 | public static final String TYPE_GOOGLE_PHOTOS = "InstantUpload"; 15 | public static final String TYPE_GOOGLE_PLUS = "Buzz"; 16 | public static final String TYPE_PROFILE_PHOTOS = "ProfilePhotos"; 17 | public static final String TYPE_SCRAPBOOK = "ScrapBook"; 18 | 19 | @SerializedName("category") 20 | @Expose 21 | private List category = new ArrayList<>(); 22 | @SerializedName("gphoto$access") 23 | @Expose 24 | private SingleStringElement gphoto$access; 25 | @SerializedName("updated") 26 | @Expose 27 | private SingleStringElement updated; 28 | @SerializedName("rights") 29 | @Expose 30 | private SingleStringElement rights; 31 | @SerializedName("gphoto$name") 32 | @Expose 33 | private SingleStringElement gphoto$name; 34 | @SerializedName("author") 35 | @Expose 36 | private List author = new ArrayList<>(); 37 | @SerializedName("gd$etag") 38 | @Expose 39 | private String gd$etag; 40 | @SerializedName("gphoto$user") 41 | @Expose 42 | private SingleStringElement gphoto$user; 43 | @SerializedName("gphoto$numphotos") 44 | @Expose 45 | private SingleIntegerElement gphoto$numphotos; 46 | @SerializedName("summary") 47 | @Expose 48 | private SingleStringElement summary; 49 | @SerializedName("gphoto$nickname") 50 | @Expose 51 | private SingleStringElement gphoto$nickname; 52 | @SerializedName("link") 53 | @Expose 54 | private List link = new ArrayList<>(); 55 | @SerializedName("published") 56 | @Expose 57 | private SingleStringElement published; 58 | @SerializedName("id") 59 | @Expose 60 | private SingleStringElement id; 61 | @SerializedName("gphoto$bytesUsed") 62 | @Expose 63 | private SingleStringElement gphoto$bytesUsed; 64 | @SerializedName("gphoto$location") 65 | @Expose 66 | private SingleStringElement gphoto$location; 67 | @SerializedName("gphoto$numphotosremaining") 68 | @Expose 69 | private SingleIntegerElement gphoto$numphotosremaining; 70 | @SerializedName("app$edited") 71 | @Expose 72 | private SingleStringElement app$edited; 73 | 74 | 75 | @SerializedName("gphoto$id") 76 | @Expose 77 | private SingleStringElement gphotoId; 78 | @SerializedName("media$group") 79 | @Expose 80 | private MediaGroup mediaGroup; 81 | @SerializedName("title") 82 | @Expose 83 | private SingleStringElement title; 84 | @SerializedName("gphoto$albumType") 85 | @Expose 86 | @Nullable 87 | private SingleStringElement gphotoAlbumType; 88 | @SerializedName("gphoto$timestamp") 89 | @Expose 90 | private SingleStringElement gphotoTimestamp; 91 | 92 | /** 93 | * @return media group 94 | */ 95 | public MediaGroup getMediaGroup() { 96 | return mediaGroup; 97 | } 98 | 99 | public void setMediaGroup(MediaGroup mediaGroup) { 100 | this.mediaGroup = mediaGroup; 101 | } 102 | 103 | /** 104 | * @return title 105 | */ 106 | public String getTitle() { 107 | return title.getBody(); 108 | } 109 | 110 | public void setTitle(SingleStringElement title) { 111 | this.title = title; 112 | } 113 | 114 | /** 115 | * @return Gphoto ID 116 | */ 117 | public long getGphotoId() { 118 | return Long.parseLong(gphotoId.getBody()); 119 | } 120 | 121 | public void setGphotoId(SingleStringElement gphotoId) { 122 | this.gphotoId = gphotoId; 123 | } 124 | 125 | /** 126 | * @return Gphoto album type 127 | */ 128 | @Nullable 129 | public String getGphotoAlbumType() { 130 | return gphotoAlbumType != null ? gphotoAlbumType.getBody() : null; 131 | } 132 | 133 | public void setGphotoAlbumType(@Nullable SingleStringElement gphotoAlbumType) { 134 | this.gphotoAlbumType = gphotoAlbumType; 135 | } 136 | 137 | /** 138 | * @return Gphoto timestamp 139 | */ 140 | public long getGphotoTimestamp() { 141 | return Long.parseLong(gphotoTimestamp.getBody()); 142 | } 143 | 144 | public void setGphotoTimestamp(long gphotoTimestamp) { 145 | this.gphotoTimestamp.setBody(String.valueOf(gphotoTimestamp)); 146 | } 147 | 148 | public List getCategory() { 149 | return category; 150 | } 151 | 152 | public void setCategory(List category) { 153 | this.category = category; 154 | } 155 | 156 | public SingleStringElement getGphoto$access() { 157 | return gphoto$access; 158 | } 159 | 160 | public void setGphoto$access(SingleStringElement gphoto$access) { 161 | this.gphoto$access = gphoto$access; 162 | } 163 | 164 | public SingleStringElement getUpdated() { 165 | return updated; 166 | } 167 | 168 | public void setUpdated(SingleStringElement updated) { 169 | this.updated = updated; 170 | } 171 | 172 | public SingleStringElement getRights() { 173 | return rights; 174 | } 175 | 176 | public void setRights(SingleStringElement rights) { 177 | this.rights = rights; 178 | } 179 | 180 | public SingleStringElement getGphoto$name() { 181 | return gphoto$name; 182 | } 183 | 184 | public void setGphoto$name(SingleStringElement gphoto$name) { 185 | this.gphoto$name = gphoto$name; 186 | } 187 | 188 | public List getAuthor() { 189 | return author; 190 | } 191 | 192 | public void setAuthor(List author) { 193 | this.author = author; 194 | } 195 | 196 | public String getGd$etag() { 197 | return gd$etag; 198 | } 199 | 200 | public void setGd$etag(String gd$etag) { 201 | this.gd$etag = gd$etag; 202 | } 203 | 204 | public SingleStringElement getGphoto$user() { 205 | return gphoto$user; 206 | } 207 | 208 | public void setGphoto$user(SingleStringElement gphoto$user) { 209 | this.gphoto$user = gphoto$user; 210 | } 211 | 212 | public SingleIntegerElement getGphoto$numphotos() { 213 | return gphoto$numphotos; 214 | } 215 | 216 | public void setGphoto$numphotos(SingleIntegerElement gphoto$numphotos) { 217 | this.gphoto$numphotos = gphoto$numphotos; 218 | } 219 | 220 | public SingleStringElement getSummary() { 221 | return summary; 222 | } 223 | 224 | public void setSummary(SingleStringElement summary) { 225 | this.summary = summary; 226 | } 227 | 228 | public SingleStringElement getGphoto$nickname() { 229 | return gphoto$nickname; 230 | } 231 | 232 | public void setGphoto$nickname(SingleStringElement gphoto$nickname) { 233 | this.gphoto$nickname = gphoto$nickname; 234 | } 235 | 236 | public List getLink() { 237 | return link; 238 | } 239 | 240 | public void setLink(List link) { 241 | this.link = link; 242 | } 243 | 244 | public SingleStringElement getPublished() { 245 | return published; 246 | } 247 | 248 | public void setPublished(SingleStringElement published) { 249 | this.published = published; 250 | } 251 | 252 | public SingleStringElement getId() { 253 | return id; 254 | } 255 | 256 | 257 | public void setId(SingleStringElement id) { 258 | this.id = id; 259 | } 260 | 261 | 262 | public SingleStringElement getGphoto$bytesUsed() { 263 | return gphoto$bytesUsed; 264 | } 265 | 266 | 267 | public void setGphoto$bytesUsed(SingleStringElement gphoto$bytesUsed) { 268 | this.gphoto$bytesUsed = gphoto$bytesUsed; 269 | } 270 | 271 | 272 | public SingleStringElement getGphoto$location() { 273 | return gphoto$location; 274 | } 275 | 276 | 277 | public void setGphoto$location(SingleStringElement gphoto$location) { 278 | this.gphoto$location = gphoto$location; 279 | } 280 | 281 | 282 | public SingleIntegerElement getGphoto$numphotosremaining() { 283 | return gphoto$numphotosremaining; 284 | } 285 | 286 | 287 | public void setGphoto$numphotosremaining(SingleIntegerElement gphoto$numphotosremaining) { 288 | this.gphoto$numphotosremaining = gphoto$numphotosremaining; 289 | } 290 | 291 | 292 | public SingleStringElement getApp$edited() { 293 | return app$edited; 294 | } 295 | 296 | 297 | public void setApp$edited(SingleStringElement app$edited) { 298 | this.app$edited = app$edited; 299 | } 300 | 301 | } 302 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/AlbumFeed.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | 10 | public class AlbumFeed { 11 | 12 | @SerializedName("gphoto$bytesUsed") 13 | @Expose 14 | private SingleStringElement gphoto$bytesUsed; 15 | @SerializedName("subtitle") 16 | @Expose 17 | private SingleStringElement subtitle; 18 | @SerializedName("xmlns$exif") 19 | @Expose 20 | private String xmlns$exif; 21 | @SerializedName("gphoto$location") 22 | @Expose 23 | private SingleStringElement gphoto$location; 24 | @SerializedName("xmlns$georss") 25 | @Expose 26 | private String xmlns$georss; 27 | @SerializedName("openSearch$itemsPerPage") 28 | @Expose 29 | private SingleIntegerElement openSearch$itemsPerPage; 30 | @SerializedName("gphoto$name") 31 | @Expose 32 | private SingleStringElement gphoto$name; 33 | @SerializedName("id") 34 | @Expose 35 | private SingleStringElement id; 36 | @SerializedName("category") 37 | @Expose 38 | private List category = new ArrayList(); 39 | @SerializedName("rights") 40 | @Expose 41 | private SingleStringElement rights; 42 | @SerializedName("generator") 43 | @Expose 44 | private Generator generator; 45 | @SerializedName("author") 46 | @Expose 47 | private List author = new ArrayList(); 48 | @SerializedName("openSearch$startIndex") 49 | @Expose 50 | private SingleIntegerElement openSearch$startIndex; 51 | @SerializedName("xmlns$media") 52 | @Expose 53 | private String xmlns$media; 54 | @SerializedName("xmlns$app") 55 | @Expose 56 | private String xmlns$app; 57 | @SerializedName("gd$etag") 58 | @Expose 59 | private String gd$etag; 60 | @SerializedName("updated") 61 | @Expose 62 | private SingleStringElement updated; 63 | @SerializedName("xmlns$gd") 64 | @Expose 65 | private String xmlns$gd; 66 | @SerializedName("xmlns$gphoto") 67 | @Expose 68 | private String xmlns$gphoto; 69 | @SerializedName("gphoto$user") 70 | @Expose 71 | private SingleStringElement gphoto$user; 72 | @SerializedName("xmlns$gml") 73 | @Expose 74 | private String xmlns$gml; 75 | @SerializedName("link") 76 | @Expose 77 | private List link = new ArrayList(); 78 | @SerializedName("xmlns$openSearch") 79 | @Expose 80 | private String xmlns$openSearch; 81 | @SerializedName("gphoto$numphotosremaining") 82 | @Expose 83 | private SingleIntegerElement gphoto$numphotosremaining; 84 | @SerializedName("icon") 85 | @Expose 86 | private SingleStringElement icon; 87 | @SerializedName("gphoto$nickname") 88 | @Expose 89 | private SingleStringElement gphoto$nickname; 90 | @SerializedName("xmlns") 91 | @Expose 92 | private String xmlns; 93 | @SerializedName("openSearch$totalResults") 94 | @Expose 95 | private SingleIntegerElement openSearch$totalResults; 96 | @SerializedName("title") 97 | @Expose 98 | private SingleStringElement title; 99 | @SerializedName("gphoto$numphotos") 100 | @Expose 101 | private SingleIntegerElement gphoto$numphotos; 102 | @SerializedName("gphoto$access") 103 | @Expose 104 | private SingleStringElement gphoto$access; 105 | 106 | 107 | @SerializedName("entry") 108 | @Expose 109 | private List photoEntries = new ArrayList<>(); 110 | @SerializedName("gphoto$id") 111 | @Expose 112 | private SingleStringElement gphotoId; 113 | @SerializedName("gphoto$albumType") 114 | @Expose 115 | private SingleStringElement gphotoAlbumType; 116 | @SerializedName("gphoto$timestamp") 117 | @Expose 118 | private SingleStringElement gphotoTimestamp; 119 | @SerializedName("gphoto$allowPrints") 120 | @Expose 121 | private SingleStringElement gphotoAllowPrints; 122 | @SerializedName("gphoto$allowDownloads") 123 | @Expose 124 | private SingleStringElement gphotoAllowDownloads; 125 | 126 | /** 127 | * @return title 128 | */ 129 | public String getTitle() { 130 | return title.getBody(); 131 | } 132 | 133 | public void setTitle(SingleStringElement title) { 134 | this.title = title; 135 | } 136 | 137 | /** 138 | * @return photo entries 139 | */ 140 | public List getPhotoEntries() { 141 | return photoEntries; 142 | } 143 | 144 | public void setPhotoEntries(List photoEntries) { 145 | this.photoEntries = photoEntries; 146 | } 147 | 148 | /** 149 | * @return Gphoto album type 150 | */ 151 | public String getGphotoAlbumType() { 152 | return gphotoAlbumType.getBody(); 153 | } 154 | 155 | public void setGphotoAlbumType(SingleStringElement gphotoAlbumType) { 156 | this.gphotoAlbumType = gphotoAlbumType; 157 | } 158 | 159 | /** 160 | * @return Gphoto timestamp 161 | */ 162 | public long getGphotoTimestamp() { 163 | return Long.parseLong(gphotoTimestamp.getBody()); 164 | } 165 | 166 | public void setGphotoTimestamp(long gphotoTimestamp) { 167 | this.gphotoTimestamp.setBody(String.valueOf(gphotoTimestamp)); 168 | } 169 | 170 | public boolean getGphotoAllowPrints() { 171 | return Boolean.parseBoolean(gphotoAllowPrints.getBody()); 172 | } 173 | 174 | public void setGphotoAllowPrints(boolean gphotoAllowPrints) { 175 | this.gphotoAllowPrints.setBody(String.valueOf(gphotoAllowPrints)); 176 | } 177 | 178 | public boolean getGphotoAllowDownloads() { 179 | return Boolean.parseBoolean(gphotoAllowDownloads.getBody()); 180 | } 181 | 182 | public void setGphotoAllowDownloads(boolean gphotoAllowDownloads) { 183 | this.gphotoAllowDownloads.setBody(String.valueOf(gphotoAllowDownloads)); 184 | } 185 | 186 | public long getGphotoId() { 187 | return Long.parseLong(gphotoId.getBody()); 188 | } 189 | 190 | public void setGphotoId(SingleStringElement gphotoId) { 191 | this.gphotoId = gphotoId; 192 | } 193 | 194 | public SingleStringElement getGphoto$bytesUsed() { 195 | return gphoto$bytesUsed; 196 | } 197 | 198 | public void setGphoto$bytesUsed(SingleStringElement gphoto$bytesUsed) { 199 | this.gphoto$bytesUsed = gphoto$bytesUsed; 200 | } 201 | 202 | public SingleStringElement getSubtitle() { 203 | return subtitle; 204 | } 205 | 206 | public void setSubtitle(SingleStringElement subtitle) { 207 | this.subtitle = subtitle; 208 | } 209 | 210 | public String getXmlns$exif() { 211 | return xmlns$exif; 212 | } 213 | 214 | public void setXmlns$exif(String xmlns$exif) { 215 | this.xmlns$exif = xmlns$exif; 216 | } 217 | 218 | public SingleStringElement getGphoto$location() { 219 | return gphoto$location; 220 | } 221 | 222 | public void setGphoto$location(SingleStringElement gphoto$location) { 223 | this.gphoto$location = gphoto$location; 224 | } 225 | 226 | public String getXmlns$georss() { 227 | return xmlns$georss; 228 | } 229 | 230 | public void setXmlns$georss(String xmlns$georss) { 231 | this.xmlns$georss = xmlns$georss; 232 | } 233 | 234 | public SingleIntegerElement getOpenSearch$itemsPerPage() { 235 | return openSearch$itemsPerPage; 236 | } 237 | 238 | public void setOpenSearch$itemsPerPage(SingleIntegerElement openSearch$itemsPerPage) { 239 | this.openSearch$itemsPerPage = openSearch$itemsPerPage; 240 | } 241 | 242 | public SingleStringElement getGphoto$name() { 243 | return gphoto$name; 244 | } 245 | 246 | public void setGphoto$name(SingleStringElement gphoto$name) { 247 | this.gphoto$name = gphoto$name; 248 | } 249 | 250 | public SingleStringElement getId() { 251 | return id; 252 | } 253 | 254 | public void setId(SingleStringElement id) { 255 | this.id = id; 256 | } 257 | 258 | public List getCategory() { 259 | return category; 260 | } 261 | 262 | public void setCategory(List category) { 263 | this.category = category; 264 | } 265 | 266 | public SingleStringElement getRights() { 267 | return rights; 268 | } 269 | 270 | public void setRights(SingleStringElement rights) { 271 | this.rights = rights; 272 | } 273 | 274 | public Generator getGenerator() { 275 | return generator; 276 | } 277 | 278 | public void setGenerator(Generator generator) { 279 | this.generator = generator; 280 | } 281 | 282 | public List getAuthor() { 283 | return author; 284 | } 285 | 286 | public void setAuthor(List author) { 287 | this.author = author; 288 | } 289 | 290 | public SingleIntegerElement getOpenSearch$startIndex() { 291 | return openSearch$startIndex; 292 | } 293 | 294 | public void setOpenSearch$startIndex(SingleIntegerElement openSearch$startIndex) { 295 | this.openSearch$startIndex = openSearch$startIndex; 296 | } 297 | 298 | public String getXmlns$media() { 299 | return xmlns$media; 300 | } 301 | 302 | public void setXmlns$media(String xmlns$media) { 303 | this.xmlns$media = xmlns$media; 304 | } 305 | 306 | public String getXmlns$app() { 307 | return xmlns$app; 308 | } 309 | 310 | public void setXmlns$app(String xmlns$app) { 311 | this.xmlns$app = xmlns$app; 312 | } 313 | 314 | public String getGd$etag() { 315 | return gd$etag; 316 | } 317 | 318 | public void setGd$etag(String gd$etag) { 319 | this.gd$etag = gd$etag; 320 | } 321 | 322 | public SingleStringElement getUpdated() { 323 | return updated; 324 | } 325 | 326 | public void setUpdated(SingleStringElement updated) { 327 | this.updated = updated; 328 | } 329 | 330 | public String getXmlns$gd() { 331 | return xmlns$gd; 332 | } 333 | 334 | public void setXmlns$gd(String xmlns$gd) { 335 | this.xmlns$gd = xmlns$gd; 336 | } 337 | 338 | public String getXmlns$gphoto() { 339 | return xmlns$gphoto; 340 | } 341 | 342 | public void setXmlns$gphoto(String xmlns$gphoto) { 343 | this.xmlns$gphoto = xmlns$gphoto; 344 | } 345 | 346 | public SingleStringElement getGphoto$user() { 347 | return gphoto$user; 348 | } 349 | 350 | public void setGphoto$user(SingleStringElement gphoto$user) { 351 | this.gphoto$user = gphoto$user; 352 | } 353 | 354 | public String getXmlns$gml() { 355 | return xmlns$gml; 356 | } 357 | 358 | public void setXmlns$gml(String xmlns$gml) { 359 | this.xmlns$gml = xmlns$gml; 360 | } 361 | 362 | public List getLink() { 363 | return link; 364 | } 365 | 366 | public void setLink(List link) { 367 | this.link = link; 368 | } 369 | 370 | public String getXmlns$openSearch() { 371 | return xmlns$openSearch; 372 | } 373 | 374 | public void setXmlns$openSearch(String xmlns$openSearch) { 375 | this.xmlns$openSearch = xmlns$openSearch; 376 | } 377 | 378 | public SingleIntegerElement getGphoto$numphotosremaining() { 379 | return gphoto$numphotosremaining; 380 | } 381 | 382 | public void setGphoto$numphotosremaining(SingleIntegerElement gphoto$numphotosremaining) { 383 | this.gphoto$numphotosremaining = gphoto$numphotosremaining; 384 | } 385 | 386 | public SingleStringElement getIcon() { 387 | return icon; 388 | } 389 | 390 | public void setIcon(SingleStringElement icon) { 391 | this.icon = icon; 392 | } 393 | 394 | public SingleStringElement getGphoto$nickname() { 395 | return gphoto$nickname; 396 | } 397 | 398 | public void setGphoto$nickname(SingleStringElement gphoto$nickname) { 399 | this.gphoto$nickname = gphoto$nickname; 400 | } 401 | 402 | public String getXmlns() { 403 | return xmlns; 404 | } 405 | 406 | public void setXmlns(String xmlns) { 407 | this.xmlns = xmlns; 408 | } 409 | 410 | public SingleIntegerElement getOpenSearch$totalResults() { 411 | return openSearch$totalResults; 412 | } 413 | 414 | public void setOpenSearch$totalResults(SingleIntegerElement openSearch$totalResults) { 415 | this.openSearch$totalResults = openSearch$totalResults; 416 | } 417 | 418 | public SingleIntegerElement getGphoto$numphotos() { 419 | return gphoto$numphotos; 420 | } 421 | 422 | public void setGphoto$numphotos(SingleIntegerElement gphoto$numphotos) { 423 | this.gphoto$numphotos = gphoto$numphotos; 424 | } 425 | 426 | public SingleStringElement getGphoto$access() { 427 | return gphoto$access; 428 | } 429 | 430 | public void setGphoto$access(SingleStringElement gphoto$access) { 431 | this.gphoto$access = gphoto$access; 432 | } 433 | 434 | } 435 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/AlbumFeedResponse.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class AlbumFeedResponse { 9 | 10 | @SerializedName("feed") 11 | @Expose 12 | private AlbumFeed feed; 13 | @SerializedName("version") 14 | @Expose 15 | private String version; 16 | @SerializedName("encoding") 17 | @Expose 18 | private String encoding; 19 | 20 | 21 | public AlbumFeed getFeed() { 22 | return feed; 23 | } 24 | 25 | 26 | public void setFeed(AlbumFeed feed) { 27 | this.feed = feed; 28 | } 29 | 30 | 31 | public String getVersion() { 32 | return version; 33 | } 34 | 35 | 36 | public void setVersion(String version) { 37 | this.version = version; 38 | } 39 | 40 | 41 | public String getEncoding() { 42 | return encoding; 43 | } 44 | 45 | 46 | public void setEncoding(String encoding) { 47 | this.encoding = encoding; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Author.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Author { 9 | 10 | @SerializedName("name") 11 | @Expose 12 | private SingleStringElement name; 13 | @SerializedName("uri") 14 | @Expose 15 | private SingleStringElement uri; 16 | 17 | 18 | public SingleStringElement getName() { 19 | return name; 20 | } 21 | 22 | 23 | public void setName(SingleStringElement name) { 24 | this.name = name; 25 | } 26 | 27 | 28 | public SingleStringElement getUri() { 29 | return uri; 30 | } 31 | 32 | 33 | public void setUri(SingleStringElement uri) { 34 | this.uri = uri; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Category.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Category { 9 | 10 | @SerializedName("term") 11 | @Expose 12 | private String term; 13 | @SerializedName("scheme") 14 | @Expose 15 | private String scheme; 16 | 17 | 18 | public String getTerm() { 19 | return term; 20 | } 21 | 22 | 23 | public void setTerm(String term) { 24 | this.term = term; 25 | } 26 | 27 | 28 | public String getScheme() { 29 | return scheme; 30 | } 31 | 32 | 33 | public void setScheme(String scheme) { 34 | this.scheme = scheme; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Content.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Content { 9 | 10 | @SerializedName("src") 11 | @Expose 12 | private String src; 13 | @SerializedName("type") 14 | @Expose 15 | private String type; 16 | 17 | 18 | public String getSrc() { 19 | return src; 20 | } 21 | 22 | 23 | public void setSrc(String src) { 24 | this.src = src; 25 | } 26 | 27 | 28 | public String getType() { 29 | return type; 30 | } 31 | 32 | 33 | public void setType(String type) { 34 | this.type = type; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/ExifTags.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * EXIF Tags 9 | */ 10 | public class ExifTags { 11 | 12 | @SerializedName("exif$fstop") 13 | @Expose 14 | private SingleStringElement exifFstop; 15 | @SerializedName("exif$imageUniqueID") 16 | @Expose 17 | private SingleStringElement exifImageUniqueID; 18 | @SerializedName("exif$model") 19 | @Expose 20 | private SingleStringElement exifModel; 21 | @SerializedName("exif$make") 22 | @Expose 23 | private SingleStringElement exifMake; 24 | @SerializedName("exif$iso") 25 | @Expose 26 | private SingleStringElement exifIso; 27 | @SerializedName("exif$flash") 28 | @Expose 29 | private SingleStringElement exifFlash; 30 | @SerializedName("exif$exposure") 31 | @Expose 32 | private SingleStringElement exifExposure; 33 | @SerializedName("exif$time") 34 | @Expose 35 | private SingleStringElement exifTime; 36 | @SerializedName("exif$focallength") 37 | @Expose 38 | private SingleStringElement exifFocalLength; 39 | @SerializedName("exif$distance") 40 | @Expose 41 | private SingleStringElement exifDistance; 42 | 43 | public double getExifDistance() { 44 | return exifDistance != null ? Double.parseDouble(exifDistance.getBody()) : -1; 45 | } 46 | 47 | 48 | public void setExifDistance(double exifDistance) { 49 | this.exifDistance.setBody(String.valueOf(exifDistance)); 50 | } 51 | 52 | 53 | public double getExifFstop() { 54 | return exifFstop != null ? Double.parseDouble(exifFstop.getBody()) : -1; 55 | } 56 | 57 | 58 | public void setExifFstop(double exifFstop) { 59 | this.exifFstop.setBody(String.valueOf(exifFstop)); 60 | } 61 | 62 | 63 | public String getExifImageUniqueID() { 64 | return exifImageUniqueID.getBody(); 65 | } 66 | 67 | public void setExifImageUniqueID(String exifImageUniqueID) { 68 | this.exifImageUniqueID.setBody(exifImageUniqueID); 69 | } 70 | 71 | 72 | public String getExifModel() { 73 | return exifModel != null ? exifModel.getBody() : null; 74 | } 75 | 76 | 77 | public void setExifModel(String exifModel) { 78 | this.exifModel.setBody(exifModel); 79 | } 80 | 81 | 82 | public String getExifMake() { 83 | return exifMake != null ? exifMake.getBody() : null; 84 | } 85 | 86 | 87 | public void setExifMake(String exifMake) { 88 | this.exifMake.setBody(exifMake); 89 | } 90 | 91 | 92 | public int getExifIso() { 93 | return exifIso != null ? Integer.parseInt(exifIso.getBody()) : -1; 94 | } 95 | 96 | 97 | public void setExifIso(int exifIso) { 98 | this.exifIso.setBody(String.valueOf(exifIso)); 99 | } 100 | 101 | 102 | public boolean getExifFlash() { 103 | return exifFlash != null && Boolean.parseBoolean(exifFlash.getBody()); 104 | } 105 | 106 | 107 | public void setExifFlash(boolean exifFlash) { 108 | this.exifFlash.setBody(String.valueOf(exifFlash)); 109 | } 110 | 111 | 112 | public double getExifExposure() { 113 | return exifExposure != null ? Double.parseDouble(exifExposure.getBody()) : -1; 114 | } 115 | 116 | 117 | public void setExifExposure(double exifExposure) { 118 | this.exifExposure.setBody(String.valueOf(exifExposure)); 119 | } 120 | 121 | 122 | public long getExifTime() { 123 | return exifTime != null ? Long.parseLong(exifTime.getBody()) : -1; 124 | } 125 | 126 | 127 | public void setExifTime(long exifTime) { 128 | this.exifTime.setBody(String.valueOf(exifTime)); 129 | } 130 | 131 | 132 | public double getExifFocalLength() { 133 | return exifFocalLength != null ? Double.parseDouble(exifFocalLength.getBody()) : -1; 134 | } 135 | 136 | 137 | public void setExifFocalLength(double exifFocalLength) { 138 | this.exifFocalLength.setBody(String.valueOf(exifFocalLength)); 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Generator.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Generator { 9 | 10 | @SerializedName("$t") 11 | @Expose 12 | private String $t; 13 | @SerializedName("version") 14 | @Expose 15 | private String version; 16 | @SerializedName("uri") 17 | @Expose 18 | private String uri; 19 | 20 | 21 | public String get$t() { 22 | return $t; 23 | } 24 | 25 | 26 | public void set$t(String $t) { 27 | this.$t = $t; 28 | } 29 | 30 | 31 | public String getVersion() { 32 | return version; 33 | } 34 | 35 | 36 | public void setVersion(String version) { 37 | this.version = version; 38 | } 39 | 40 | 41 | public String getUri() { 42 | return uri; 43 | } 44 | 45 | 46 | public void setUri(String uri) { 47 | this.uri = uri; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Georss$where.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Georss$where { 9 | 10 | @SerializedName("gml$Point") 11 | @Expose 12 | private GmlPoint gmlPoint; 13 | 14 | 15 | public GmlPoint getGmlPoint() { 16 | return gmlPoint; 17 | } 18 | 19 | 20 | public void setGmlPoint(GmlPoint gmlPoint) { 21 | this.gmlPoint = gmlPoint; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/GmlPoint.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class GmlPoint { 9 | 10 | @SerializedName("gml$pos") 11 | @Expose 12 | private SingleStringElement gmlPos; 13 | 14 | 15 | public SingleStringElement getGmlPos() { 16 | return gmlPos; 17 | } 18 | 19 | 20 | public void setGmlPos(SingleStringElement gmlPos) { 21 | this.gmlPos = gmlPos; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Gphoto$license.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Gphoto$license { 9 | 10 | @SerializedName("url") 11 | @Expose 12 | private String url; 13 | @SerializedName("$t") 14 | @Expose 15 | private String $t; 16 | @SerializedName("id") 17 | @Expose 18 | private Integer id; 19 | @SerializedName("name") 20 | @Expose 21 | private String name; 22 | 23 | 24 | public String getUrl() { 25 | return url; 26 | } 27 | 28 | 29 | public void setUrl(String url) { 30 | this.url = url; 31 | } 32 | 33 | 34 | public String get$t() { 35 | return $t; 36 | } 37 | 38 | 39 | public void set$t(String $t) { 40 | this.$t = $t; 41 | } 42 | 43 | 44 | public Integer getId() { 45 | return id; 46 | } 47 | 48 | 49 | public void setId(Integer id) { 50 | this.id = id; 51 | } 52 | 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | 59 | public void setName(String name) { 60 | this.name = name; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Gphoto$shapes.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Gphoto$shapes { 9 | 10 | @SerializedName("faces") 11 | @Expose 12 | private String faces; 13 | 14 | 15 | public String getFaces() { 16 | return faces; 17 | } 18 | 19 | 20 | public void setFaces(String faces) { 21 | this.faces = faces; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Link.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Link { 9 | 10 | @SerializedName("href") 11 | @Expose 12 | private String href; 13 | @SerializedName("type") 14 | @Expose 15 | private String type; 16 | @SerializedName("rel") 17 | @Expose 18 | private String rel; 19 | 20 | 21 | public String getHref() { 22 | return href; 23 | } 24 | 25 | 26 | public void setHref(String href) { 27 | this.href = href; 28 | } 29 | 30 | 31 | public String getType() { 32 | return type; 33 | } 34 | 35 | 36 | public void setType(String type) { 37 | this.type = type; 38 | } 39 | 40 | 41 | public String getRel() { 42 | return rel; 43 | } 44 | 45 | 46 | public void setRel(String rel) { 47 | this.rel = rel; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Media$description.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Media$description { 9 | 10 | @SerializedName("$t") 11 | @Expose 12 | private String $t; 13 | @SerializedName("type") 14 | @Expose 15 | private String type; 16 | 17 | 18 | public String get$t() { 19 | return $t; 20 | } 21 | 22 | 23 | public void set$t(String $t) { 24 | this.$t = $t; 25 | } 26 | 27 | 28 | public String getType() { 29 | return type; 30 | } 31 | 32 | 33 | public void setType(String type) { 34 | this.type = type; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Media$keywords.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | public class Media$keywords { 4 | 5 | 6 | } 7 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Media$thumbnail.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Media$thumbnail { 9 | 10 | @SerializedName("url") 11 | @Expose 12 | private String url; 13 | @SerializedName("width") 14 | @Expose 15 | private Integer width; 16 | @SerializedName("height") 17 | @Expose 18 | private Integer height; 19 | 20 | 21 | public String getUrl() { 22 | return url; 23 | } 24 | 25 | 26 | public void setUrl(String url) { 27 | this.url = url; 28 | } 29 | 30 | 31 | public Integer getWidth() { 32 | return width; 33 | } 34 | 35 | 36 | public void setWidth(Integer width) { 37 | this.width = width; 38 | } 39 | 40 | 41 | public Integer getHeight() { 42 | return height; 43 | } 44 | 45 | 46 | public void setHeight(Integer height) { 47 | this.height = height; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/Media$title.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class Media$title { 9 | 10 | @SerializedName("$t") 11 | @Expose 12 | private String $t; 13 | @SerializedName("type") 14 | @Expose 15 | private String type; 16 | 17 | 18 | public String get$t() { 19 | return $t; 20 | } 21 | 22 | 23 | public void set$t(String $t) { 24 | this.$t = $t; 25 | } 26 | 27 | 28 | public String getType() { 29 | return type; 30 | } 31 | 32 | 33 | public void setType(String type) { 34 | this.type = type; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/MediaContent.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class MediaContent { 9 | 10 | @SerializedName("url") 11 | @Expose 12 | private String url; 13 | @SerializedName("medium") 14 | @Expose 15 | private String medium; 16 | @SerializedName("type") 17 | @Expose 18 | private String type; 19 | 20 | 21 | /** 22 | * @return URL 23 | */ 24 | public String getUrl() { 25 | return url; 26 | } 27 | 28 | 29 | public void setUrl(String url) { 30 | this.url = url; 31 | } 32 | 33 | 34 | public String getMedium() { 35 | return medium; 36 | } 37 | 38 | 39 | public void setMedium(String medium) { 40 | this.medium = medium; 41 | } 42 | 43 | 44 | public String getType() { 45 | return type; 46 | } 47 | 48 | 49 | public void setType(String type) { 50 | this.type = type; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/MediaGroup.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | 10 | public class MediaGroup { 11 | 12 | @SerializedName("media$credit") 13 | @Expose 14 | private List media$credit = new ArrayList<>(); 15 | @SerializedName("media$title") 16 | @Expose 17 | private Media$title media$title; 18 | @SerializedName("media$thumbnail") 19 | @Expose 20 | private List media$thumbnail = new ArrayList<>(); 21 | @SerializedName("media$keywords") 22 | @Expose 23 | private Media$keywords media$keywords; 24 | @SerializedName("media$description") 25 | @Expose 26 | private Media$description media$description; 27 | 28 | @SerializedName("media$content") 29 | @Expose 30 | private List mediaContents = new ArrayList<>(); 31 | 32 | /** 33 | * @return media contents 34 | */ 35 | public List getContents() { 36 | return mediaContents; 37 | } 38 | 39 | 40 | public List getMedia$credit() { 41 | return media$credit; 42 | } 43 | 44 | 45 | public void setMedia$credit(List media$credit) { 46 | this.media$credit = media$credit; 47 | } 48 | 49 | 50 | public Media$title getMedia$title() { 51 | return media$title; 52 | } 53 | 54 | 55 | public void setMedia$title(Media$title media$title) { 56 | this.media$title = media$title; 57 | } 58 | 59 | 60 | public void setMediaContents(List mediaContents) { 61 | this.mediaContents = mediaContents; 62 | } 63 | 64 | 65 | public List getMedia$thumbnail() { 66 | return media$thumbnail; 67 | } 68 | 69 | 70 | public void setMedia$thumbnail(List media$thumbnail) { 71 | this.media$thumbnail = media$thumbnail; 72 | } 73 | 74 | 75 | public Media$keywords getMedia$keywords() { 76 | return media$keywords; 77 | } 78 | 79 | 80 | public void setMedia$keywords(Media$keywords media$keywords) { 81 | this.media$keywords = media$keywords; 82 | } 83 | 84 | 85 | public Media$description getMedia$description() { 86 | return media$description; 87 | } 88 | 89 | 90 | public void setMedia$description(Media$description media$description) { 91 | this.media$description = media$description; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/PhotoEntry.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | 10 | public class PhotoEntry { 11 | 12 | @SerializedName("gphoto$width") 13 | @Expose 14 | private SingleStringElement gphotoWidth; 15 | @SerializedName("gphoto$height") 16 | @Expose 17 | private SingleStringElement gphotoHeight; 18 | @SerializedName("id") 19 | @Expose 20 | private SingleStringElement id; 21 | @SerializedName("category") 22 | @Expose 23 | private List category = new ArrayList<>(); 24 | @SerializedName("gphoto$license") 25 | @Expose 26 | private Gphoto$license gphoto$license; 27 | @SerializedName("title") 28 | @Expose 29 | private SingleStringElement title; 30 | @SerializedName("gphoto$shapes") 31 | @Expose 32 | private Gphoto$shapes gphoto$shapes; 33 | @SerializedName("content") 34 | @Expose 35 | private Content content; 36 | @SerializedName("gd$etag") 37 | @Expose 38 | private String gd$etag; 39 | @SerializedName("gphoto$streamId") 40 | @Expose 41 | private List gphotoStreamId = new ArrayList<>(); 42 | @SerializedName("updated") 43 | @Expose 44 | private SingleStringElement updated; 45 | @SerializedName("gphoto$checksum") 46 | @Expose 47 | private SingleStringElement gphotoChecksum; 48 | @SerializedName("gphoto$size") 49 | @Expose 50 | private SingleStringElement gphotoSize; 51 | @SerializedName("link") 52 | @Expose 53 | private List link = new ArrayList<>(); 54 | @SerializedName("app$edited") 55 | @Expose 56 | private SingleStringElement app$edited; 57 | @SerializedName("gphoto$commentCount") 58 | @Expose 59 | private SingleIntegerElement gphoto$commentCount; 60 | @SerializedName("gphoto$commentingEnabled") 61 | @Expose 62 | private SingleStringElement gphotoCommentingEnabled; 63 | @SerializedName("summary") 64 | @Expose 65 | private SingleStringElement summary; 66 | @SerializedName("gphoto$imageVersion") 67 | @Expose 68 | private SingleStringElement gphotoImageVersion; 69 | @SerializedName("gphoto$access") 70 | @Expose 71 | private SingleStringElement gphotoAccess; 72 | @SerializedName("published") 73 | @Expose 74 | private SingleStringElement published; 75 | @SerializedName("georss$where") 76 | @Expose 77 | private Georss$where georss$where; 78 | 79 | @SerializedName("gphoto$id") 80 | @Expose 81 | private SingleStringElement gphotoId; 82 | @SerializedName("media$group") 83 | @Expose 84 | private MediaGroup mediaGroup; 85 | @SerializedName("gphoto$albumid") 86 | @Expose 87 | private SingleStringElement gphotoAlbumId; 88 | @SerializedName("exif$tags") 89 | @Expose 90 | private ExifTags exifTags; 91 | @SerializedName("gphoto$timestamp") 92 | @Expose 93 | private SingleStringElement gphotoTimestamp; 94 | 95 | 96 | /** 97 | * @return media group 98 | */ 99 | public MediaGroup getMediaGroup() { 100 | return mediaGroup; 101 | } 102 | 103 | public void setMediaGroup(MediaGroup mediaGroup) { 104 | this.mediaGroup = mediaGroup; 105 | } 106 | 107 | /** 108 | * @return Gphoto album ID 109 | */ 110 | public long getGphotoAlbumId() { 111 | return Long.parseLong(gphotoAlbumId.getBody()); 112 | } 113 | 114 | public void setGphotoAlbumId(SingleStringElement gphotoAlbumId) { 115 | this.gphotoAlbumId = gphotoAlbumId; 116 | } 117 | 118 | /** 119 | * @return Gphoto ID 120 | */ 121 | public long getGphotoId() { 122 | return Long.parseLong(gphotoId.getBody()); 123 | } 124 | 125 | public void setGphotoId(SingleStringElement gphotoId) { 126 | this.gphotoId = gphotoId; 127 | } 128 | 129 | /** 130 | * @return Gphoto width 131 | */ 132 | public int getGphotoWidth() { 133 | return Integer.parseInt(gphotoWidth.getBody()); 134 | } 135 | 136 | public void setGphotoWidth(SingleStringElement gphotoWidth) { 137 | this.gphotoWidth = gphotoWidth; 138 | } 139 | 140 | /** 141 | * @return Gphoto height 142 | */ 143 | public int getGphotoHeight() { 144 | return Integer.parseInt(gphotoHeight.getBody()); 145 | } 146 | 147 | public void setGphotoHeight(SingleStringElement gphotoHeight) { 148 | this.gphotoHeight = gphotoHeight; 149 | } 150 | 151 | /** 152 | * @return EXIF tags 153 | */ 154 | public ExifTags getExifTags() { 155 | return exifTags; 156 | } 157 | 158 | public void setExifTags(ExifTags exifTags) { 159 | this.exifTags = exifTags; 160 | } 161 | 162 | /** 163 | * @return Gphoto timestamp 164 | */ 165 | public long getGphotoTimestamp() { 166 | return Long.parseLong(gphotoTimestamp.getBody()); 167 | } 168 | 169 | public void setGphotoTimestamp(SingleStringElement gphotoTimestamp) { 170 | this.gphotoTimestamp = gphotoTimestamp; 171 | } 172 | 173 | public SingleStringElement getId() { 174 | return id; 175 | } 176 | 177 | public void setId(SingleStringElement id) { 178 | this.id = id; 179 | } 180 | 181 | public List getCategory() { 182 | return category; 183 | } 184 | 185 | public void setCategory(List category) { 186 | this.category = category; 187 | } 188 | 189 | public Gphoto$license getGphoto$license() { 190 | return gphoto$license; 191 | } 192 | 193 | public void setGphoto$license(Gphoto$license gphoto$license) { 194 | this.gphoto$license = gphoto$license; 195 | } 196 | 197 | public String getTitle() { 198 | return title.getBody(); 199 | } 200 | 201 | public void setTitle(String title) { 202 | this.title.setBody(title); 203 | } 204 | 205 | public Gphoto$shapes getGphoto$shapes() { 206 | return gphoto$shapes; 207 | } 208 | 209 | public void setGphoto$shapes(Gphoto$shapes gphoto$shapes) { 210 | this.gphoto$shapes = gphoto$shapes; 211 | } 212 | 213 | public Content getContent() { 214 | return content; 215 | } 216 | 217 | public void setContent(Content content) { 218 | this.content = content; 219 | } 220 | 221 | public String getGd$etag() { 222 | return gd$etag; 223 | } 224 | 225 | public void setGd$etag(String gd$etag) { 226 | this.gd$etag = gd$etag; 227 | } 228 | 229 | public List getGphotoStreamId() { 230 | return gphotoStreamId; 231 | } 232 | 233 | public void setGphotoStreamId(List gphotoStreamId) { 234 | this.gphotoStreamId = gphotoStreamId; 235 | } 236 | 237 | public SingleStringElement getUpdated() { 238 | return updated; 239 | } 240 | 241 | public void setUpdated(SingleStringElement updated) { 242 | this.updated = updated; 243 | } 244 | 245 | public SingleStringElement getGphotoChecksum() { 246 | return gphotoChecksum; 247 | } 248 | 249 | public void setGphotoChecksum(SingleStringElement gphotoChecksum) { 250 | this.gphotoChecksum = gphotoChecksum; 251 | } 252 | 253 | public SingleStringElement getGphotoSize() { 254 | return gphotoSize; 255 | } 256 | 257 | public void setGphotoSize(SingleStringElement gphotoSize) { 258 | this.gphotoSize = gphotoSize; 259 | } 260 | 261 | public List getLink() { 262 | return link; 263 | } 264 | 265 | public void setLink(List link) { 266 | this.link = link; 267 | } 268 | 269 | public SingleStringElement getApp$edited() { 270 | return app$edited; 271 | } 272 | 273 | public void setApp$edited(SingleStringElement app$edited) { 274 | this.app$edited = app$edited; 275 | } 276 | 277 | public SingleIntegerElement getGphoto$commentCount() { 278 | return gphoto$commentCount; 279 | } 280 | 281 | public void setGphoto$commentCount(SingleIntegerElement gphoto$commentCount) { 282 | this.gphoto$commentCount = gphoto$commentCount; 283 | } 284 | 285 | public SingleStringElement getGphotoCommentingEnabled() { 286 | return gphotoCommentingEnabled; 287 | } 288 | 289 | public void setGphotoCommentingEnabled(SingleStringElement gphotoCommentingEnabled) { 290 | this.gphotoCommentingEnabled = gphotoCommentingEnabled; 291 | } 292 | 293 | public SingleStringElement getSummary() { 294 | return summary; 295 | } 296 | 297 | 298 | public void setSummary(SingleStringElement summary) { 299 | this.summary = summary; 300 | } 301 | 302 | 303 | public SingleStringElement getGphotoImageVersion() { 304 | return gphotoImageVersion; 305 | } 306 | 307 | 308 | public void setGphotoImageVersion(SingleStringElement gphotoImageVersion) { 309 | this.gphotoImageVersion = gphotoImageVersion; 310 | } 311 | 312 | 313 | public SingleStringElement getGphotoAccess() { 314 | return gphotoAccess; 315 | } 316 | 317 | 318 | public void setGphotoAccess(SingleStringElement gphotoAccess) { 319 | this.gphotoAccess = gphotoAccess; 320 | } 321 | 322 | 323 | public SingleStringElement getPublished() { 324 | return published; 325 | } 326 | 327 | 328 | public void setPublished(SingleStringElement published) { 329 | this.published = published; 330 | } 331 | 332 | 333 | public Georss$where getGeorss$where() { 334 | return georss$where; 335 | } 336 | 337 | 338 | public void setGeorss$where(Georss$where georss$where) { 339 | this.georss$where = georss$where; 340 | } 341 | 342 | } 343 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/SingleIntegerElement.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class SingleIntegerElement { 7 | 8 | @SerializedName("$t") 9 | @Expose 10 | private int body; 11 | 12 | 13 | public int getBody() { 14 | return body; 15 | } 16 | 17 | 18 | public void setBody(int $t) { 19 | this.body = $t; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/SingleStringElement.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class SingleStringElement { 9 | 10 | @SerializedName("$t") 11 | @Expose 12 | private String body; 13 | 14 | 15 | public String getBody() { 16 | return body; 17 | } 18 | 19 | 20 | public void setBody(String $t) { 21 | this.body = $t; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/UserFeed.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | 10 | public class UserFeed { 11 | 12 | @SerializedName("subtitle") 13 | @Expose 14 | private SingleStringElement subtitle; 15 | @SerializedName("gphoto$user") 16 | @Expose 17 | private SingleStringElement gphoto$user; 18 | @SerializedName("gphoto$maxPhotosPerAlbum") 19 | @Expose 20 | private SingleIntegerElement gphoto$maxPhotosPerAlbum; 21 | @SerializedName("openSearch$itemsPerPage") 22 | @Expose 23 | private SingleStringElement openSearch$itemsPerPage; 24 | @SerializedName("id") 25 | @Expose 26 | private SingleStringElement id; 27 | @SerializedName("category") 28 | @Expose 29 | private List category = new ArrayList(); 30 | @SerializedName("generator") 31 | @Expose 32 | private Generator generator; 33 | @SerializedName("openSearch$startIndex") 34 | @Expose 35 | private SingleIntegerElement openSearch$startIndex; 36 | @SerializedName("xmlns$media") 37 | @Expose 38 | private String xmlns$media; 39 | @SerializedName("xmlns$app") 40 | @Expose 41 | private String xmlns$app; 42 | @SerializedName("gd$etag") 43 | @Expose 44 | private String gd$etag; 45 | @SerializedName("updated") 46 | @Expose 47 | private SingleStringElement updated; 48 | @SerializedName("xmlns$gd") 49 | @Expose 50 | private String xmlns$gd; 51 | @SerializedName("xmlns$gphoto") 52 | @Expose 53 | private String xmlns$gphoto; 54 | @SerializedName("gphoto$nickname") 55 | @Expose 56 | private SingleStringElement gphoto$nickname; 57 | @SerializedName("link") 58 | @Expose 59 | private List link = new ArrayList(); 60 | @SerializedName("xmlns$openSearch") 61 | @Expose 62 | private String xmlns$openSearch; 63 | @SerializedName("gphoto$quotacurrent") 64 | @Expose 65 | private SingleStringElement gphoto$quotacurrent; 66 | @SerializedName("icon") 67 | @Expose 68 | private SingleStringElement icon; 69 | @SerializedName("xmlns") 70 | @Expose 71 | private String xmlns; 72 | @SerializedName("openSearch$totalResults") 73 | @Expose 74 | private SingleIntegerElement openSearch$totalResults; 75 | @SerializedName("author") 76 | @Expose 77 | private List author = new ArrayList(); 78 | @SerializedName("gphoto$quotalimit") 79 | @Expose 80 | private SingleStringElement gphoto$quotalimit; 81 | @SerializedName("gphoto$thumbnail") 82 | @Expose 83 | private SingleStringElement gphoto$thumbnail; 84 | 85 | 86 | @SerializedName("title") 87 | @Expose 88 | private SingleStringElement title; 89 | @SerializedName("entry") 90 | @Expose 91 | private List albumEntries = new ArrayList<>(); 92 | 93 | 94 | public String getTitle() { 95 | return title.getBody(); 96 | } 97 | 98 | public void setTitle(SingleStringElement title) { 99 | this.title = title; 100 | } 101 | 102 | public List getAlbumEntries() { 103 | return albumEntries; 104 | } 105 | 106 | public void setAlbumEntries(List albumEntries) { 107 | this.albumEntries = albumEntries; 108 | } 109 | 110 | public SingleStringElement getSubtitle() { 111 | return subtitle; 112 | } 113 | 114 | public void setSubtitle(SingleStringElement subtitle) { 115 | this.subtitle = subtitle; 116 | } 117 | 118 | public SingleStringElement getGphoto$user() { 119 | return gphoto$user; 120 | } 121 | 122 | public void setGphoto$user(SingleStringElement gphoto$user) { 123 | this.gphoto$user = gphoto$user; 124 | } 125 | 126 | public SingleIntegerElement getGphoto$maxPhotosPerAlbum() { 127 | return gphoto$maxPhotosPerAlbum; 128 | } 129 | 130 | public void setGphoto$maxPhotosPerAlbum(SingleIntegerElement gphoto$maxPhotosPerAlbum) { 131 | this.gphoto$maxPhotosPerAlbum = gphoto$maxPhotosPerAlbum; 132 | } 133 | 134 | public SingleStringElement getOpenSearch$itemsPerPage() { 135 | return openSearch$itemsPerPage; 136 | } 137 | 138 | public void setOpenSearch$itemsPerPage(SingleStringElement openSearch$itemsPerPage) { 139 | this.openSearch$itemsPerPage = openSearch$itemsPerPage; 140 | } 141 | 142 | public SingleStringElement getId() { 143 | return id; 144 | } 145 | 146 | public void setId(SingleStringElement id) { 147 | this.id = id; 148 | } 149 | 150 | public List getCategory() { 151 | return category; 152 | } 153 | 154 | public void setCategory(List category) { 155 | this.category = category; 156 | } 157 | 158 | public Generator getGenerator() { 159 | return generator; 160 | } 161 | 162 | public void setGenerator(Generator generator) { 163 | this.generator = generator; 164 | } 165 | 166 | public SingleIntegerElement getOpenSearch$startIndex() { 167 | return openSearch$startIndex; 168 | } 169 | 170 | public void setOpenSearch$startIndex(SingleIntegerElement openSearch$startIndex) { 171 | this.openSearch$startIndex = openSearch$startIndex; 172 | } 173 | 174 | public String getXmlns$media() { 175 | return xmlns$media; 176 | } 177 | 178 | public void setXmlns$media(String xmlns$media) { 179 | this.xmlns$media = xmlns$media; 180 | } 181 | 182 | public String getXmlns$app() { 183 | return xmlns$app; 184 | } 185 | 186 | public void setXmlns$app(String xmlns$app) { 187 | this.xmlns$app = xmlns$app; 188 | } 189 | 190 | public String getGd$etag() { 191 | return gd$etag; 192 | } 193 | 194 | public void setGd$etag(String gd$etag) { 195 | this.gd$etag = gd$etag; 196 | } 197 | 198 | public SingleStringElement getUpdated() { 199 | return updated; 200 | } 201 | 202 | public void setUpdated(SingleStringElement updated) { 203 | this.updated = updated; 204 | } 205 | 206 | public String getXmlns$gd() { 207 | return xmlns$gd; 208 | } 209 | 210 | public void setXmlns$gd(String xmlns$gd) { 211 | this.xmlns$gd = xmlns$gd; 212 | } 213 | 214 | public String getXmlns$gphoto() { 215 | return xmlns$gphoto; 216 | } 217 | 218 | public void setXmlns$gphoto(String xmlns$gphoto) { 219 | this.xmlns$gphoto = xmlns$gphoto; 220 | } 221 | 222 | public SingleStringElement getGphoto$nickname() { 223 | return gphoto$nickname; 224 | } 225 | 226 | public void setGphoto$nickname(SingleStringElement gphoto$nickname) { 227 | this.gphoto$nickname = gphoto$nickname; 228 | } 229 | 230 | public List getLink() { 231 | return link; 232 | } 233 | 234 | public void setLink(List link) { 235 | this.link = link; 236 | } 237 | 238 | public String getXmlns$openSearch() { 239 | return xmlns$openSearch; 240 | } 241 | 242 | public void setXmlns$openSearch(String xmlns$openSearch) { 243 | this.xmlns$openSearch = xmlns$openSearch; 244 | } 245 | 246 | public SingleStringElement getGphoto$quotacurrent() { 247 | return gphoto$quotacurrent; 248 | } 249 | 250 | public void setGphoto$quotacurrent(SingleStringElement gphoto$quotacurrent) { 251 | this.gphoto$quotacurrent = gphoto$quotacurrent; 252 | } 253 | 254 | public SingleStringElement getIcon() { 255 | return icon; 256 | } 257 | 258 | public void setIcon(SingleStringElement icon) { 259 | this.icon = icon; 260 | } 261 | 262 | public String getXmlns() { 263 | return xmlns; 264 | } 265 | 266 | public void setXmlns(String xmlns) { 267 | this.xmlns = xmlns; 268 | } 269 | 270 | public SingleIntegerElement getOpenSearch$totalResults() { 271 | return openSearch$totalResults; 272 | } 273 | 274 | public void setOpenSearch$totalResults(SingleIntegerElement openSearch$totalResults) { 275 | this.openSearch$totalResults = openSearch$totalResults; 276 | } 277 | 278 | public List getAuthor() { 279 | return author; 280 | } 281 | 282 | public void setAuthor(List author) { 283 | this.author = author; 284 | } 285 | 286 | public SingleStringElement getGphoto$quotalimit() { 287 | return gphoto$quotalimit; 288 | } 289 | 290 | public void setGphoto$quotalimit(SingleStringElement gphoto$quotalimit) { 291 | this.gphoto$quotalimit = gphoto$quotalimit; 292 | } 293 | 294 | public SingleStringElement getGphoto$thumbnail() { 295 | return gphoto$thumbnail; 296 | } 297 | 298 | 299 | public void setGphoto$thumbnail(SingleStringElement gphoto$thumbnail) { 300 | this.gphoto$thumbnail = gphoto$thumbnail; 301 | } 302 | 303 | } 304 | -------------------------------------------------------------------------------- /library/src/main/java/com/pluscubed/picasaclient/model/UserFeedResponse.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient.model; 2 | 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | 8 | public class UserFeedResponse { 9 | 10 | @SerializedName("feed") 11 | @Expose 12 | private UserFeed feed; 13 | @SerializedName("version") 14 | @Expose 15 | private String version; 16 | @SerializedName("encoding") 17 | @Expose 18 | private String encoding; 19 | 20 | 21 | public UserFeed getFeed() { 22 | return feed; 23 | } 24 | 25 | 26 | public void setFeed(UserFeed feed) { 27 | this.feed = feed; 28 | } 29 | 30 | 31 | public String getVersion() { 32 | return version; 33 | } 34 | 35 | 36 | public void setVersion(String version) { 37 | this.version = version; 38 | } 39 | 40 | 41 | public String getEncoding() { 42 | return encoding; 43 | } 44 | 45 | 46 | public void setEncoding(String encoding) { 47 | this.encoding = encoding; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/src/test/java/com/pluscubed/picasaclient/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclient; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.pluscubed.picasaclientsample" 9 | minSdkVersion 16 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | repositories { 23 | maven { url "https://jitpack.io" } 24 | } 25 | 26 | 27 | dependencies { 28 | compile fileTree(include: ['*.jar'], dir: 'libs') 29 | testCompile 'junit:junit:4.12' 30 | compile 'com.android.support:appcompat-v7:23.3.0' 31 | compile 'com.android.support:recyclerview-v7:23.3.0' 32 | compile 'com.github.bumptech.glide:glide:3.7.0' 33 | compile 'com.github.afollestad.material-dialogs:core:0.8.5.7' 34 | 35 | compile project(':library') 36 | } 37 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\DC\Development\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/java/com/pluscubed/picasaclientsample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclientsample; 2 | 3 | import android.accounts.Account; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.preference.PreferenceManager; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.content.ContextCompat; 9 | import android.support.v4.widget.SwipeRefreshLayout; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.support.v7.widget.GridLayoutManager; 12 | import android.support.v7.widget.RecyclerView; 13 | import android.support.v7.widget.Toolbar; 14 | import android.text.format.DateUtils; 15 | import android.view.LayoutInflater; 16 | import android.view.View; 17 | import android.view.ViewGroup; 18 | import android.widget.Button; 19 | import android.widget.ImageView; 20 | import android.widget.TextView; 21 | import android.widget.Toast; 22 | 23 | import com.afollestad.materialdialogs.MaterialDialog; 24 | import com.bumptech.glide.Glide; 25 | import com.pluscubed.picasaclient.PicasaClient; 26 | import com.pluscubed.picasaclient.model.AlbumEntry; 27 | import com.pluscubed.picasaclient.model.AlbumFeed; 28 | import com.pluscubed.picasaclient.model.ExifTags; 29 | import com.pluscubed.picasaclient.model.PhotoEntry; 30 | import com.pluscubed.picasaclient.model.UserFeed; 31 | 32 | import java.util.ArrayList; 33 | import java.util.List; 34 | 35 | import rx.Completable; 36 | import rx.SingleSubscriber; 37 | import rx.Subscription; 38 | import rx.android.schedulers.AndroidSchedulers; 39 | 40 | /** 41 | * Sample MainActivity 42 | *

43 | * Only a demo of the library - not guaranteed to be complete, stateful, nor structured well. 44 | */ 45 | public class MainActivity extends AppCompatActivity { 46 | 47 | private static final String STATE_ACCOUNT = "account"; 48 | private static final String PREF_ACCOUNT = "pref_account"; 49 | 50 | private List mAlbumEntries; 51 | private List mPhotoEntries; 52 | 53 | private boolean mAlbumMode; 54 | private long mAlbumId; 55 | 56 | private boolean mReloading; 57 | 58 | private PicasaAdapter mAdapter; 59 | private SwipeRefreshLayout mRefreshLayout; 60 | 61 | private Account mAccount; 62 | private TextView mAccountText; 63 | 64 | @Override 65 | protected void onCreate(@Nullable Bundle savedInstanceState) { 66 | super.onCreate(savedInstanceState); 67 | setContentView(R.layout.activity_main); 68 | 69 | PicasaClient.get().attachActivity(this); 70 | 71 | mAlbumMode = true; 72 | 73 | mAlbumEntries = new ArrayList<>(); 74 | mPhotoEntries = new ArrayList<>(); 75 | 76 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 77 | setSupportActionBar(toolbar); 78 | 79 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); 80 | mAdapter = new PicasaAdapter(); 81 | recyclerView.setAdapter(mAdapter); 82 | GridLayoutManager manager = new GridLayoutManager(this, 2); 83 | recyclerView.setLayoutManager(manager); 84 | 85 | mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); 86 | mRefreshLayout.setColorSchemeColors(ContextCompat.getColor(this, R.color.colorAccent)); 87 | mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 88 | @Override 89 | public void onRefresh() { 90 | if (PicasaClient.get().isInitialized()) { 91 | reload(true); 92 | } 93 | } 94 | }); 95 | 96 | Button choose = (Button) findViewById(R.id.choose_account); 97 | choose.setOnClickListener(new View.OnClickListener() { 98 | @Override 99 | public void onClick(View v) { 100 | PicasaClient.get().pickAccount(); 101 | } 102 | }); 103 | 104 | mAccountText = (TextView) findViewById(R.id.account); 105 | 106 | 107 | if (PicasaClient.get().isInitialized()) { 108 | reload(false); 109 | } else { 110 | String savedAccount = PreferenceManager.getDefaultSharedPreferences(this).getString(PREF_ACCOUNT, null); 111 | if (savedAccount != null) { 112 | mAccount = new Account(savedAccount, PicasaClient.ACCOUNT_TYPE_GOOGLE); 113 | PicasaClient.get().setAccount(mAccount) 114 | .observeOn(AndroidSchedulers.mainThread()) 115 | .subscribe(new Completable.CompletableSubscriber() { 116 | @Override 117 | public void onCompleted() { 118 | reload(false); 119 | } 120 | 121 | @Override 122 | public void onError(Throwable e) { 123 | 124 | } 125 | 126 | @Override 127 | public void onSubscribe(Subscription d) { 128 | 129 | } 130 | }); 131 | } 132 | } 133 | 134 | updateAccount(); 135 | } 136 | 137 | private void updateAccount() { 138 | mAccount = PicasaClient.get().getAccount(); 139 | if (mAccount != null) 140 | PreferenceManager.getDefaultSharedPreferences(this).edit().putString(PREF_ACCOUNT, mAccount.name).apply(); 141 | mAccountText.setText(String.format(getString(R.string.account), mAccount == null ? "None" : mAccount.name)); 142 | } 143 | 144 | private void reload(boolean force) { 145 | mReloading = true; 146 | mAdapter.notifyDataSetChanged(); 147 | 148 | mRefreshLayout.setRefreshing(true); 149 | if (mAlbumMode) { 150 | if (force || mAlbumEntries.isEmpty()) { 151 | PicasaClient.get().getUserFeed() 152 | .toObservable() 153 | .retry(5) 154 | .toSingle() 155 | .observeOn(AndroidSchedulers.mainThread()) 156 | .subscribe(new SingleSubscriber() { 157 | @Override 158 | public void onSuccess(UserFeed feed) { 159 | mAlbumEntries = feed.getAlbumEntries(); 160 | 161 | onReloadFinished(); 162 | } 163 | 164 | @Override 165 | public void onError(Throwable error) { 166 | MainActivity.this.onError(error); 167 | } 168 | }); 169 | } else { 170 | onReloadFinished(); 171 | } 172 | } else { 173 | PicasaClient.get().getAlbumFeed(mAlbumId) 174 | .toObservable() 175 | .retry(5) 176 | .toSingle() 177 | .observeOn(AndroidSchedulers.mainThread()) 178 | .subscribe(new SingleSubscriber() { 179 | @Override 180 | public void onSuccess(AlbumFeed albumFeed) { 181 | mPhotoEntries = albumFeed.getPhotoEntries(); 182 | 183 | onReloadFinished(); 184 | } 185 | 186 | @Override 187 | public void onError(Throwable error) { 188 | MainActivity.this.onError(error); 189 | } 190 | }); 191 | } 192 | } 193 | 194 | private void onReloadFinished() { 195 | mReloading = false; 196 | mAdapter.notifyDataSetChanged(); 197 | mRefreshLayout.setRefreshing(false); 198 | } 199 | 200 | private void onError(Throwable error) { 201 | mReloading = false; 202 | error.printStackTrace(); 203 | mRefreshLayout.setRefreshing(false); 204 | Toast.makeText(MainActivity.this, "Error: " + error.getMessage(), Toast.LENGTH_SHORT).show(); 205 | } 206 | 207 | @Override 208 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 209 | super.onActivityResult(requestCode, resultCode, data); 210 | 211 | PicasaClient.get().onActivityResult(requestCode, resultCode, data) 212 | .observeOn(AndroidSchedulers.mainThread()) 213 | .subscribe(new Completable.CompletableSubscriber() { 214 | @Override 215 | public void onCompleted() { 216 | updateAccount(); 217 | reload(false); 218 | } 219 | 220 | @Override 221 | public void onError(Throwable e) { 222 | 223 | } 224 | 225 | @Override 226 | public void onSubscribe(Subscription d) { 227 | 228 | } 229 | }); 230 | } 231 | 232 | @Override 233 | protected void onDestroy() { 234 | super.onDestroy(); 235 | 236 | PicasaClient.get().detach(); 237 | } 238 | 239 | @Override 240 | public void onBackPressed() { 241 | if (!mAlbumMode) { 242 | mAlbumMode = true; 243 | reload(false); 244 | } else { 245 | super.onBackPressed(); 246 | } 247 | } 248 | 249 | private class PicasaAdapter extends RecyclerView.Adapter { 250 | 251 | public PicasaAdapter() { 252 | super(); 253 | setHasStableIds(true); 254 | } 255 | 256 | @Override 257 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 258 | LayoutInflater inflater = LayoutInflater.from(MainActivity.this); 259 | View view = inflater.inflate(R.layout.list_item_entry, parent, false); 260 | 261 | return new ViewHolder(view); 262 | } 263 | 264 | @Override 265 | public void onBindViewHolder(ViewHolder holder, int position) { 266 | if (mAlbumMode) { 267 | 268 | AlbumEntry albumEntry = mAlbumEntries.get(position); 269 | 270 | Glide.with(MainActivity.this) 271 | .load(albumEntry.getMediaGroup().getContents().get(0).getUrl()) 272 | .into(holder.image); 273 | 274 | holder.title.setText(albumEntry.getTitle()); 275 | 276 | String gphotoAlbumType = albumEntry.getGphotoAlbumType(); 277 | if (gphotoAlbumType != null) { 278 | switch (gphotoAlbumType) { 279 | case AlbumEntry.TYPE_GOOGLE_PHOTOS: 280 | gphotoAlbumType = getString(R.string.google_photos); 281 | break; 282 | case AlbumEntry.TYPE_GOOGLE_PLUS: 283 | gphotoAlbumType = getString(R.string.google_plus); 284 | break; 285 | } 286 | } 287 | holder.subtitle.setText(gphotoAlbumType); 288 | } else { 289 | PhotoEntry photoEntry = mPhotoEntries.get(position); 290 | 291 | Glide.with(MainActivity.this) 292 | .load(photoEntry.getMediaGroup().getContents().get(0).getUrl()) 293 | .into(holder.image); 294 | 295 | holder.title.setText(photoEntry.getTitle()); 296 | String text = photoEntry.getGphotoWidth() + "x" + photoEntry.getGphotoHeight(); 297 | holder.subtitle.setText(text); 298 | } 299 | } 300 | 301 | @Override 302 | public int getItemCount() { 303 | if (mReloading) return 0; 304 | else return mAlbumMode ? mAlbumEntries.size() : mPhotoEntries.size(); 305 | } 306 | 307 | @Override 308 | public long getItemId(int position) { 309 | return mAlbumMode ? mAlbumEntries.get(position).getGphotoId() : mPhotoEntries.get(position).getGphotoId(); 310 | } 311 | 312 | class ViewHolder extends RecyclerView.ViewHolder { 313 | ImageView image; 314 | TextView title; 315 | TextView subtitle; 316 | 317 | public ViewHolder(View itemView) { 318 | super(itemView); 319 | 320 | image = (ImageView) itemView.findViewById(R.id.image); 321 | title = (TextView) itemView.findViewById(R.id.title); 322 | subtitle = (TextView) itemView.findViewById(R.id.subtitle); 323 | 324 | itemView.setOnClickListener(new View.OnClickListener() { 325 | @Override 326 | public void onClick(View v) { 327 | if (getAdapterPosition() != RecyclerView.NO_POSITION) { 328 | if (mAlbumMode) { 329 | mAlbumMode = false; 330 | mAlbumId = mAlbumEntries.get(getAdapterPosition()).getGphotoId(); 331 | reload(false); 332 | } else { 333 | PhotoEntry entry = mPhotoEntries.get(getAdapterPosition()); 334 | 335 | ExifTags exifTags = entry.getExifTags(); 336 | 337 | String dateTime = DateUtils.formatDateTime(MainActivity.this, entry.getGphotoTimestamp(), 338 | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME); 339 | String camera = exifTags.getExifMake() + " " + exifTags.getExifModel(); 340 | 341 | 342 | new MaterialDialog.Builder(MainActivity.this) 343 | .content("Time: " + dateTime 344 | + "\n" + "Camera: " + camera 345 | + "\n" + "ISO: " + exifTags.getExifIso() 346 | + "\n" + "F-Stop: " + exifTags.getExifFstop() 347 | + "\n" + "Exposure: 1/" + (int) (1 / exifTags.getExifExposure() + 0.5) + "s" 348 | + "\n" + "Focal Length: " + exifTags.getExifFocalLength() + "mm" 349 | + "\n" + "Distance: " + exifTags.getExifDistance()) 350 | .positiveText(android.R.string.ok) 351 | .show(); 352 | } 353 | } 354 | } 355 | }); 356 | } 357 | } 358 | } 359 | } 360 | -------------------------------------------------------------------------------- /sample/src/main/java/com/pluscubed/picasaclientsample/SquareFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.pluscubed.picasaclientsample; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.FrameLayout; 6 | 7 | public class SquareFrameLayout extends FrameLayout { 8 | 9 | public SquareFrameLayout(Context context) { 10 | super(context); 11 | } 12 | 13 | public SquareFrameLayout(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | } 16 | 17 | public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { 18 | super(context, attrs, defStyleAttr); 19 | } 20 | 21 | @Override 22 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 23 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 24 | setMeasuredDimension(widthMeasureSpec, widthMeasureSpec); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 22 | 23 | 31 | 32 | 38 | 39 |