├── .gitignore
├── .travis.settings.xml
├── .travis.yml
├── README.md
├── art
├── README.md
├── RegalAndroid.xcf
├── RegalAndroid_180_120.jpg
├── RegalAndroid_280_335.png
├── RegalAndroid_335_335.xcf
├── RegalAndroid_48_48.png
├── RegalAndroid_512_512.jpg
├── RegalAndroid_55_55.png
├── android.jpg
├── couronne.png
├── loading.xcf
├── qrcode-small.png
└── qrcode.png
├── bin
└── ci
│ ├── do-nothing.sh
│ └── get-android-sdk.sh
├── build.gradle
├── commons-gallery
├── GPLv3-license.txt
├── build.gradle
├── pom.xml
├── resources
│ └── license-header.txt
└── src
│ ├── main
│ ├── java
│ │ └── net
│ │ │ └── dahanne
│ │ │ └── gallery
│ │ │ └── commons
│ │ │ ├── model
│ │ │ ├── Album.java
│ │ │ ├── AlbumComparator.java
│ │ │ └── Picture.java
│ │ │ ├── remote
│ │ │ ├── GalleryConnectionException.java
│ │ │ ├── GalleryOperationNotYetSupportedException.java
│ │ │ ├── ImpossibleToLoginException.java
│ │ │ └── RemoteGallery.java
│ │ │ └── utils
│ │ │ ├── AlbumUtils.java
│ │ │ ├── Serialization.java
│ │ │ ├── SerializationException.java
│ │ │ └── UriUtils.java
│ └── resources
│ │ └── .gitignore
│ └── test
│ ├── java
│ ├── .gitignore
│ └── net
│ │ └── dahanne
│ │ └── gallery
│ │ └── commons
│ │ └── utils
│ │ ├── AlbumUtilsTest.java
│ │ ├── SerializationTest.java
│ │ └── UriUtilsTest.java
│ └── resources
│ └── .gitignore
├── g2-java-client
├── GPLv3-license.txt
├── build.gradle
├── image.png
├── pom.xml
├── resources
│ └── license-header.txt
└── src
│ ├── main
│ ├── java
│ │ └── net
│ │ │ └── dahanne
│ │ │ └── gallery
│ │ │ └── g2
│ │ │ └── java
│ │ │ └── client
│ │ │ ├── business
│ │ │ └── G2Client.java
│ │ │ ├── model
│ │ │ ├── G2Album.java
│ │ │ └── G2Picture.java
│ │ │ ├── ssl
│ │ │ ├── FakeSocketFactory.java
│ │ │ └── FakeTrustManager.java
│ │ │ └── utils
│ │ │ └── G2ConvertUtils.java
│ └── resources
│ │ └── .gitignore
│ └── test
│ ├── java
│ ├── .gitignore
│ └── net
│ │ └── dahanne
│ │ └── gallery
│ │ └── g2
│ │ └── java
│ │ └── client
│ │ ├── business
│ │ └── G2ClientTest.java
│ │ └── utils
│ │ └── G2ConvertUtilsTest.java
│ └── resources
│ ├── .gitignore
│ └── image.png
├── g3-java-client
├── GPLv3-license.txt
├── build.gradle
├── pom.xml
├── resources
│ ├── getApiKeyExample.rcq
│ ├── getItem1.rcq
│ ├── license-header.txt
│ └── request-examples.txt
└── src
│ ├── main
│ └── java
│ │ └── net
│ │ └── dahanne
│ │ └── gallery3
│ │ └── client
│ │ ├── business
│ │ ├── G3Client.java
│ │ ├── IG3Client.java
│ │ └── exceptions
│ │ │ ├── G3BadRequestException.java
│ │ │ ├── G3ForbiddenException.java
│ │ │ ├── G3GalleryException.java
│ │ │ └── G3ItemNotFoundException.java
│ │ ├── model
│ │ ├── Comments.java
│ │ ├── Entity.java
│ │ ├── EntityAlbum.java
│ │ ├── EntityPhoto.java
│ │ ├── Item.java
│ │ ├── RelationShips.java
│ │ └── Tags.java
│ │ └── utils
│ │ ├── G3ConvertUtils.java
│ │ └── ItemUtils.java
│ └── test
│ ├── java
│ └── net
│ │ └── dahanne
│ │ └── gallery3
│ │ └── client
│ │ ├── business
│ │ └── G3ClientTest.java
│ │ └── utils
│ │ ├── G3ConvertUtilsTest.java
│ │ └── ItemUtilsTest.java
│ └── resources
│ ├── get-album-1.json
│ ├── get-album-11.json
│ ├── get-album-bug32_owner-id-null.json
│ ├── get-albums-no-comments-issue82.json
│ ├── get-albums-no-relationships-38.json
│ ├── get-photo-2.json
│ ├── get-photo-bug3_resize_size_false.json
│ ├── logo.png
│ └── tree-album-1.json
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── jiwigo-ws-api-converter
├── GPLv3-license.txt
├── build.gradle
├── pom.xml
├── resources
│ └── license-header.txt
└── src
│ ├── main
│ └── java
│ │ └── net
│ │ └── dahanne
│ │ └── gallery
│ │ └── jiwigo
│ │ └── converter
│ │ └── JiwigoConvertUtils.java
│ └── test
│ └── java
│ └── net
│ └── dahanne
│ └── gallery
│ └── jiwigo
│ └── converter
│ └── JiwigoConvertUtilsTest.java
├── jiwigo-ws-api
├── build.gradle
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── fr
│ │ │ └── mael
│ │ │ └── jiwigo
│ │ │ ├── dao
│ │ │ ├── CategoryDao.java
│ │ │ ├── CommentDao.java
│ │ │ ├── ImageDao.java
│ │ │ ├── TagDao.java
│ │ │ └── impl
│ │ │ │ ├── CategoryDaoImpl.java
│ │ │ │ ├── CommentDaoImpl.java
│ │ │ │ ├── ImageDaoImpl.java
│ │ │ │ └── TagDaoImpl.java
│ │ │ ├── om
│ │ │ ├── Category.java
│ │ │ ├── Comment.java
│ │ │ ├── Image.java
│ │ │ └── Tag.java
│ │ │ ├── service
│ │ │ ├── CategoryService.java
│ │ │ ├── CommentService.java
│ │ │ ├── ImageService.java
│ │ │ ├── TagService.java
│ │ │ └── impl
│ │ │ │ ├── CategoryServiceImpl.java
│ │ │ │ ├── CommentServiceImpl.java
│ │ │ │ ├── ImageServiceImpl.java
│ │ │ │ └── TagServiceImpl.java
│ │ │ └── transverse
│ │ │ ├── enumeration
│ │ │ ├── CacheEnum.java
│ │ │ ├── CategoryEnum.java
│ │ │ ├── MethodsEnum.java
│ │ │ └── TagEnum.java
│ │ │ ├── exception
│ │ │ ├── FileAlreadyExistsException.java
│ │ │ ├── JiwigoException.java
│ │ │ ├── ProxyAuthenticationException.java
│ │ │ └── WrongChunkSizeException.java
│ │ │ ├── session
│ │ │ ├── SessionManager.java
│ │ │ └── impl
│ │ │ │ └── SessionManagerImpl.java
│ │ │ └── util
│ │ │ ├── ImagesUtil.java
│ │ │ └── Tools.java
│ └── resources
│ │ └── temp.xml
│ └── test
│ ├── java
│ └── fr
│ │ └── mael
│ │ └── jiwigo
│ │ └── service
│ │ ├── CategoryServiceTest.java
│ │ ├── ServicesTest.java
│ │ └── TagServiceTest.java
│ └── resources
│ └── piwigo_org.png
├── pom.xml
├── regalandroid-parent
└── pom.xml
├── regalandroid-test
├── AndroidManifest.xml
├── build.properties
├── pom.xml
├── project.properties
└── src
│ └── net
│ └── dahanne
│ └── android
│ └── regalandroid
│ └── its
│ ├── AllTests.java
│ └── ReGalAndroidTest.java
├── regalandroid
├── AndroidManifest.xml
├── GPLv3-license.txt
├── build.gradle
├── image.png
├── pom.xml
├── project.properties
├── res
│ ├── anim
│ │ ├── slide_down.xml
│ │ └── slide_up.xml
│ ├── drawable
│ │ ├── folder_images_icon.png
│ │ ├── ic_launcher_gallery.png
│ │ ├── icon.png
│ │ ├── loading.png
│ │ ├── regalandroid.png
│ │ ├── timepicker_down_normal.png
│ │ └── timepicker_up_normal.png
│ ├── layout
│ │ ├── about.xml
│ │ ├── album_is_empty.xml
│ │ ├── choose_photo_number.xml
│ │ ├── create_subalbum.xml
│ │ ├── firsttime.xml
│ │ ├── fullimage.xml
│ │ ├── main.xml
│ │ ├── number_picker.xml
│ │ ├── show_albums.xml
│ │ ├── show_albums_for_upload_row.xml
│ │ ├── show_albums_row.xml
│ │ ├── show_gallery.xml
│ │ └── upload_photo.xml
│ ├── menu
│ │ ├── menu.xml
│ │ ├── menu_full_image.xml
│ │ └── menu_show_albums.xml
│ ├── values-de
│ │ └── strings.xml
│ ├── values-es
│ │ └── strings.xml
│ ├── values-fr
│ │ └── strings.xml
│ ├── values-zh-rCN
│ │ └── strings.xml
│ ├── values-zh-rTW
│ │ └── strings.xml
│ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── gallery_types.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── xml
│ │ └── settings.xml
├── resources
│ ├── .gitignore
│ └── license-header.txt
└── src
│ └── main
│ └── java
│ └── net
│ └── dahanne
│ └── android
│ └── regalandroid
│ ├── RegalAndroidApplication.java
│ ├── activity
│ ├── About.java
│ ├── ChoosePhotoNumber.java
│ ├── ChooseSubAlbumName.java
│ ├── FirstTime.java
│ ├── FullImage.java
│ ├── Settings.java
│ ├── ShowAlbums.java
│ ├── ShowGallery.java
│ ├── Start.java
│ ├── TouchImageView.java
│ └── UploadPhoto.java
│ ├── adapters
│ ├── AlbumAdapter.java
│ └── AlbumAdapterForUpload.java
│ ├── api
│ └── EditUrlPreference.java
│ ├── remote
│ ├── G2Connection.java
│ ├── G3Connection.java
│ ├── PiwigoConnection.java
│ └── RemoteGalleryConnectionFactory.java
│ ├── tasks
│ ├── AddPhotoTask.java
│ ├── AddPhotosTask.java
│ ├── CreateAlbumTask.java
│ ├── DownloadImageTask.java
│ ├── FetchAlbumAndSubAlbumsAndPicturesTask.java
│ ├── FetchAlbumForUploadTask.java
│ ├── FetchAlbumTask.java
│ ├── LoginTask.java
│ └── ReplaceMainImageTask.java
│ └── utils
│ ├── AndroidUriUtils.java
│ ├── DBHelper.java
│ ├── DBUtils.java
│ ├── FileHandlingException.java
│ ├── FileUtils.java
│ ├── ShowUtils.java
│ └── modified_android_source
│ ├── NumberPicker.java
│ └── NumberPickerButton.java
├── screenshots
├── browsingalbum.png
├── browsingpictures.png
├── gallery_type.png
├── picture-options.png
├── settings.png
└── title.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # mac stuff
2 | .DS_Store
3 |
4 | # intellij stuff
5 | .idea
6 | *.iml
7 |
8 | # Android stuff
9 | local.properties
10 | bin
11 | gen
12 |
13 | #Gradle stuff
14 | build/
15 | .gradle
16 |
--------------------------------------------------------------------------------
/.travis.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | bintray
7 |
8 |
9 | bintray
10 | bintray
11 | http://jcenter.bintray.com
12 |
13 | false
14 |
15 |
16 |
17 |
18 |
19 |
20 | bintray
21 |
22 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | jdk:
3 | - oraclejdk8
4 | android:
5 | components:
6 | - platform-tools
7 | - tools
8 | - build-tools-23.0.3
9 | - android-24
10 | - extra-android-support
11 | - extra-android-m2repository
12 | licenses:
13 | - 'android-sdk-license-.+'
14 | - '.*intel.+'
15 |
--------------------------------------------------------------------------------
/art/README.md:
--------------------------------------------------------------------------------
1 | Couronne.png was taken from : http://www.clker.com/clipart-67673.html
2 | Android.jpg was taken from : http://www.logiciel.net/le-premier-virus-qui-vise-android-voit-le-jour-8875.htm
3 |
--------------------------------------------------------------------------------
/art/RegalAndroid.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid.xcf
--------------------------------------------------------------------------------
/art/RegalAndroid_180_120.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_180_120.jpg
--------------------------------------------------------------------------------
/art/RegalAndroid_280_335.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_280_335.png
--------------------------------------------------------------------------------
/art/RegalAndroid_335_335.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_335_335.xcf
--------------------------------------------------------------------------------
/art/RegalAndroid_48_48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_48_48.png
--------------------------------------------------------------------------------
/art/RegalAndroid_512_512.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_512_512.jpg
--------------------------------------------------------------------------------
/art/RegalAndroid_55_55.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/RegalAndroid_55_55.png
--------------------------------------------------------------------------------
/art/android.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/android.jpg
--------------------------------------------------------------------------------
/art/couronne.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/couronne.png
--------------------------------------------------------------------------------
/art/loading.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/loading.xcf
--------------------------------------------------------------------------------
/art/qrcode-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/qrcode-small.png
--------------------------------------------------------------------------------
/art/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/art/qrcode.png
--------------------------------------------------------------------------------
/bin/ci/do-nothing.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #a script that does nothing ! used to override default travis-ci build lifecycle command
3 |
--------------------------------------------------------------------------------
/bin/ci/get-android-sdk.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | echo "about to download Android SDK from http://dl.google.com/android/android-sdk_r16-linux.tgz"
3 | wget http://dl.google.com/android/android-sdk_r16-linux.tgz
4 | #ls
5 | echo "unzipping android-sdk_r16-linux.tgz"
6 | tar xvzf android-sdk_r16-linux.tgz
7 | #ls android-sdk-linux
8 | echo "getting some Android platforms"
9 | android-sdk-linux/tools/android update sdk --no-ui -t platform
10 | android-sdk-linux/tools/android update sdk --no-ui -t platform-tools
11 | android-sdk-linux/tools/android update sdk --no-ui --obsolete --force
12 | echo "here is the list of the downloaded platforms : "
13 | ls android-sdk-linux/platforms
14 | echo "creating an emulator"
15 | #the echo no | before the command is to answer no to the question "do you wish to create a custom hardware profile"
16 | #see http://stackoverflow.com/questions/7931997/setting-android-avd-command-line-hardware-profile
17 | echo no | android-sdk-linux/tools/android create avd -n android2.3.3 -t android-10 -c 16M -b armeabi
18 | echo "starting the emulator in background with no window"
19 | android-sdk-linux/tools/emulator-arm -avd android2.3.3 -no-window &
20 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 |
3 | buildscript {
4 | repositories {
5 | mavenCentral()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:2.1.3'
10 | }
11 | }
12 |
13 | }
14 | subprojects {
15 | repositories {
16 | mavenCentral()
17 | jcenter()
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/commons-gallery/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | sourceCompatibility = 1.7
3 | targetCompatibility = 1.7
4 | group = 'net.dahanne.gallery'
5 | description = 'Gallery Commons'
6 | dependencies {
7 | compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.0.1'
8 | compile group: 'org.slf4j', name: 'slf4j-api', version:'1.6.2'
9 | testCompile group: 'ch.qos.logback', name: 'logback-classic', version:'0.9.30'
10 | testCompile group: 'junit', name: 'junit', version:'4.10'
11 | }
12 |
--------------------------------------------------------------------------------
/commons-gallery/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | regalandroid-parent
5 | net.dahanne.android
6 | 1.2.1-SNAPSHOT
7 | ../regalandroid-parent/pom.xml
8 |
9 | 4.0.0
10 | net.dahanne.gallery
11 | commons-gallery
12 | Gallery Commons
13 | This project provides interfaces and models commons to all remote gallery layers (G2, G3, Piwigo, etc..)
14 | It is a submodule of the ReGalAndroid project
15 | http://github.com/anthonydahanne/ReGalAndroid
16 |
17 | UTF-8
18 |
19 |
20 |
21 | GPL v3
22 | http://www.gnu.org/licenses/gpl.txt
23 | repo
24 |
25 |
26 |
27 | git@github.com:anthonydahanne/ReGalAndroid.git
28 | git@github.com:anthonydahanne/ReGalAndroid.git
29 | git@github.com:anthonydahanne/ReGalAndroid.git
30 |
31 |
32 |
33 | anthonydahanne
34 | Anthony Dahanne
35 | anthony.dahanne@gmail.com
36 | http://blog.dahanne.net
37 |
38 |
39 |
40 |
41 |
42 | org.apache.httpcomponents
43 | httpclient
44 | 4.0.1
45 | compile
46 |
47 |
48 | org.slf4j
49 | slf4j-api
50 | jar
51 | compile
52 |
53 |
54 | ch.qos.logback
55 | logback-classic
56 | 0.9.30
57 | test
58 |
59 |
60 | junit
61 | junit
62 | jar
63 | test
64 |
65 |
66 |
67 |
68 |
69 |
70 | org.apache.maven.plugins
71 | maven-source-plugin
72 |
73 |
74 | attach-sources
75 | verify
76 |
77 | jar-no-fork
78 |
79 |
80 |
81 |
82 |
83 | org.apache.maven.plugins
84 | maven-compiler-plugin
85 |
86 | 1.5
87 | 1.5
88 |
89 |
90 |
91 | com.mycila
92 | maven-license-plugin
93 |
94 | ${basedir}/resources/license-header.txt
95 | true
96 |
97 |
98 |
99 | check
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/commons-gallery/resources/license-header.txt:
--------------------------------------------------------------------------------
1 | commons-gallery, a common API module for ReGalAndroid
2 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
3 | Copyright (c) 2010 Anthony Dahanne
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/model/AlbumComparator.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.model;
20 |
21 | import java.util.Comparator;
22 |
23 | import net.dahanne.gallery.commons.model.Album;
24 |
25 | public class AlbumComparator implements Comparator {
26 |
27 | public int compare(Album album1, Album album2) {
28 | if (album1 == null) {
29 | return -1;
30 | }
31 | if (album2 == null) {
32 | return 1;
33 | }
34 | return album1.getName() > album2.getName() ? 1 : -1;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/remote/GalleryConnectionException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.remote;
20 |
21 | public class GalleryConnectionException extends Exception {
22 |
23 | private static final long serialVersionUID = 7190018624500833576L;
24 | private final static String message = GalleryConnectionException.class
25 | .getName();
26 |
27 | /**
28 | * @param msg
29 | */
30 | public GalleryConnectionException(String msg) {
31 | super(message + " : " + msg);
32 | }
33 |
34 | public GalleryConnectionException(Throwable t) {
35 | super(t);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/remote/GalleryOperationNotYetSupportedException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.remote;
20 |
21 | public class GalleryOperationNotYetSupportedException extends GalleryConnectionException {
22 |
23 |
24 | private static final long serialVersionUID = 8468892237712525290L;
25 |
26 | public GalleryOperationNotYetSupportedException(String msg) {
27 | super(msg);
28 | }
29 |
30 | public GalleryOperationNotYetSupportedException(Throwable t) {
31 | super(t);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/remote/ImpossibleToLoginException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.remote;
20 |
21 | public class ImpossibleToLoginException extends GalleryConnectionException {
22 |
23 | private static final long serialVersionUID = -8277215227949719569L;
24 |
25 | public ImpossibleToLoginException(String msg) {
26 | super(msg);
27 | }
28 |
29 | public ImpossibleToLoginException(Throwable t) {
30 | super(t);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/utils/AlbumUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import net.dahanne.gallery.commons.model.Album;
22 |
23 | import org.slf4j.Logger;
24 | import org.slf4j.LoggerFactory;
25 |
26 | public class AlbumUtils {
27 | private final static Logger logger = LoggerFactory.getLogger(AlbumUtils.class);
28 |
29 | /**
30 | * This method returns the Album corresponding to albumName, among the rootAlbum hierarchy
31 | * @param rootAlbum
32 | * @param albumName
33 | * @return
34 | */
35 | public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) {
36 | logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName);
37 | Album albumFound=null;
38 | if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) {
39 | albumFound= rootAlbum;
40 | }
41 | for (Album album : rootAlbum.getSubAlbums()) {
42 | if (album.getName() == albumName && !album.isFakeAlbum()) {
43 | albumFound= album;
44 | break;
45 | }
46 | Album fromAlbumName = findAlbumFromAlbumName(album, albumName);
47 | if (fromAlbumName != null && !fromAlbumName.isFakeAlbum()) {
48 | albumFound= fromAlbumName;
49 | }
50 |
51 | }
52 | logger.debug("albumFound is : {}",albumFound);
53 | return albumFound;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/utils/Serialization.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import java.io.ByteArrayInputStream;
22 | import java.io.ByteArrayOutputStream;
23 | import java.io.IOException;
24 | import java.io.ObjectInputStream;
25 | import java.io.ObjectOutputStream;
26 | import java.io.StreamCorruptedException;
27 |
28 | import net.dahanne.gallery.commons.model.Album;
29 |
30 | /**
31 | * @author Anthony Dahanne
32 | *
33 | */
34 | public class Serialization {
35 |
36 | /**
37 | * Serialize the album into bytes; useful for saving to android database
38 | *
39 | * @return
40 | * @throws SerializationException
41 | */
42 | public static byte[] serializeAlbum(Album album) throws SerializationException {
43 | ByteArrayOutputStream output = new ByteArrayOutputStream();
44 | try {
45 | ObjectOutputStream oos = new ObjectOutputStream(output);
46 | oos.writeObject(album);
47 | oos.close();
48 | } catch (IOException e) {
49 | throw new SerializationException(e);
50 | }
51 | return output.toByteArray();
52 |
53 | }
54 |
55 | /**
56 | * Unserialize the album from byte[], useful for getting an album back from
57 | * the android database
58 | *
59 | * @param serializedAlbum
60 | * @return
61 | * @throws SerializationException
62 | */
63 | public static Album unserializeAlbum(byte[] serializedAlbum) throws SerializationException {
64 | Album album = null;
65 | try {
66 | ByteArrayInputStream bais = new ByteArrayInputStream(
67 | serializedAlbum);
68 | ObjectInputStream ois = new ObjectInputStream(bais);
69 | album = (Album) ois.readObject();
70 | ois.close();
71 | } catch (StreamCorruptedException e) {
72 | throw new SerializationException(e);
73 | } catch (IOException e) {
74 | throw new SerializationException(e);
75 | } catch (ClassNotFoundException e) {
76 | throw new SerializationException(e);
77 | }
78 | return album;
79 |
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/utils/SerializationException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import net.dahanne.gallery.commons.remote.GalleryConnectionException;
22 |
23 | public class SerializationException extends Exception {
24 |
25 | private static final long serialVersionUID = 4185267365609877943L;
26 | private final static String message = GalleryConnectionException.class
27 | .getName();
28 |
29 | /**
30 | * @param msg
31 | */
32 | public SerializationException(String msg) {
33 | super(message + " : " + msg);
34 | }
35 |
36 | public SerializationException(Throwable t) {
37 | super(t);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/java/net/dahanne/gallery/commons/utils/UriUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import java.net.URI;
22 | import java.util.regex.Matcher;
23 | import java.util.regex.Pattern;
24 |
25 | import org.slf4j.Logger;
26 | import org.slf4j.LoggerFactory;
27 |
28 | public class UriUtils {
29 |
30 | public final static String URL_PATTERN = "^(http|https):\\/\\/(?:\\P{M}\\p{M}*)+([\\-\\.]{1}(?:\\P{M}\\p{M}*)+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$";
31 | public final static String IP_ADDRESS_PATTERN = "^(http|https):\\/\\/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:[0-9]{1,5})?(\\/.*)?$";
32 | private final static Logger logger = LoggerFactory.getLogger(UriUtils.class);
33 |
34 |
35 | public static void checkUrlIsValid(String url) throws IllegalArgumentException {
36 | logger.debug("Url is : {}",url);
37 | boolean urlIsValid;
38 | Pattern p = Pattern.compile(URL_PATTERN);
39 | Matcher m = p.matcher(url);
40 | if (!m.matches()) {
41 | // not an url ? maybe an ip address
42 | p = Pattern.compile(IP_ADDRESS_PATTERN);
43 | m = p.matcher(url);
44 | urlIsValid = m.matches();
45 | }else{
46 | urlIsValid = true;
47 | }
48 | if(!urlIsValid){
49 | throw new IllegalArgumentException("Url is not valid");
50 | }
51 | //nothing is better than testing for real
52 | URI.create(url);
53 | logger.debug("urlIsValid : {}",urlIsValid);
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/commons-gallery/src/main/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/commons-gallery/src/main/resources/.gitignore
--------------------------------------------------------------------------------
/commons-gallery/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/commons-gallery/src/test/java/.gitignore
--------------------------------------------------------------------------------
/commons-gallery/src/test/java/net/dahanne/gallery/commons/utils/AlbumUtilsTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import junit.framework.Assert;
22 | import net.dahanne.gallery.commons.model.Album;
23 |
24 | import org.junit.Test;
25 |
26 | public class AlbumUtilsTest extends Assert {
27 | @Test
28 | public void findAlbumFromAlbumNameTest() {
29 | Album rootAlbum = new Album();
30 | rootAlbum.setName(999);
31 | Album album1 = new Album();
32 | album1.setName(1);
33 | rootAlbum.getSubAlbums().add(album1);
34 | Album album2 = new Album();
35 | album2.setName(2);
36 | rootAlbum.getSubAlbums().add(album2);
37 | Album album3 = new Album();
38 | album3.setName(3);
39 | rootAlbum.getSubAlbums().add(album3);
40 | Album album4 = new Album();
41 | album4.setName(4);
42 | rootAlbum.getSubAlbums().add(album4);
43 | Album album31 = new Album();
44 | album31.setName(31);
45 | album3.getSubAlbums().add(album31);
46 | Album album311 = new Album();
47 | album311.setName(311);
48 | album311.setId(12);
49 | album31.getSubAlbums().add(album311);
50 |
51 |
52 | //simulation of a fake album not to be taken into account!
53 | Album album311_fake = new Album();
54 | album311_fake.setName(311);
55 | album311_fake.setFakeAlbum(true);
56 | album311.getSubAlbums().add(album311_fake);
57 |
58 | Album albumFound = AlbumUtils.findAlbumFromAlbumName(rootAlbum, 311);
59 | assertEquals(album311, albumFound);
60 |
61 | assertNull(AlbumUtils.findAlbumFromAlbumName(rootAlbum, 312));
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/commons-gallery/src/test/java/net/dahanne/gallery/commons/utils/SerializationTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import net.dahanne.gallery.commons.model.Album;
22 |
23 | import org.junit.Assert;
24 | import org.junit.Test;
25 |
26 | public class SerializationTest {
27 | @Test
28 | public void serializeAlbumAndUnSerializeAnAlbum() throws SerializationException {
29 | Album myAlbum = new Album(1, 43, "myAlbum",
30 | "Inthis album, there's not much", 0, false, false, false,
31 | false, "no extrafield");
32 | myAlbum.getSubAlbums().add(
33 | new Album(2, 4343, "a sub album", "nothing more here !", 43,
34 | true, true, true, true, "Some fields!"));
35 |
36 | byte[] serialize = Serialization.serializeAlbum(myAlbum);
37 | Album unserializedAlbum = Serialization.unserializeAlbum(serialize);
38 | Assert.assertEquals(myAlbum, unserializedAlbum);
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/commons-gallery/src/test/java/net/dahanne/gallery/commons/utils/UriUtilsTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * commons-gallery, a common API module for ReGalAndroid
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery.commons.utils;
20 |
21 | import static org.junit.Assert.assertFalse;
22 | import static org.junit.Assert.assertTrue;
23 |
24 | import org.junit.Assert;
25 | import org.junit.Test;
26 |
27 | public class UriUtilsTest {
28 | @Test
29 | public void checkUriIsValidTest() {
30 | String url = "http://google.com";
31 | UriUtils.checkUrlIsValid(url);
32 | url = "https://google.com/test";
33 | UriUtils.checkUrlIsValid(url);
34 | url = "http://google.com:453/truc";
35 | UriUtils.checkUrlIsValid(url);
36 | url = "https://google.com:66/test";
37 | UriUtils.checkUrlIsValid(url);
38 | url = "http://läxhjälpen.se/";
39 | UriUtils.checkUrlIsValid(url);
40 | url = "http://xn--lxhjlpen-0zad.se/";
41 | UriUtils.checkUrlIsValid(url);
42 | url = "http://192.168.1.101:66/test";
43 | UriUtils.checkUrlIsValid(url);
44 | url = "https://192.168.1.101";
45 | UriUtils.checkUrlIsValid(url);
46 | }
47 |
48 | @Test(expected=IllegalArgumentException.class)
49 | public void spaceIsNotValidTest(){
50 | String url = "http://192.168.1.101:66/test ll";
51 | UriUtils.checkUrlIsValid(url);
52 | }
53 |
54 | @Test(expected=IllegalArgumentException.class)
55 | public void noHttpIsNotValidTest(){
56 | String url = "badurl.net";
57 | UriUtils.checkUrlIsValid(url);
58 | }
59 | @Test(expected=IllegalArgumentException.class)
60 | public void plainStringIsNotValidTest(){
61 | String url = "toto";
62 | UriUtils.checkUrlIsValid(url);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/commons-gallery/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/commons-gallery/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/g2-java-client/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | sourceCompatibility = 1.7
3 | targetCompatibility = 1.7
4 | group = 'net.dahanne.gallery2'
5 | description = 'Gallery2 Java Client'
6 | dependencies {
7 | compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.0.1'
8 | compile group: 'org.json', name: 'json', version:'20090211'
9 | compile group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.0.3'
10 | compile project(':commons-gallery')
11 | compile group: 'commons-lang', name: 'commons-lang', version:'2.4'
12 | testCompile group: 'com.google.guava', name: 'guava', version:'r06'
13 | testCompile group: 'junit', name: 'junit', version:'4.10'
14 | }
15 |
--------------------------------------------------------------------------------
/g2-java-client/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g2-java-client/image.png
--------------------------------------------------------------------------------
/g2-java-client/resources/license-header.txt:
--------------------------------------------------------------------------------
1 | g2-java-client, a Menalto Gallery2 Java Client API
2 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
3 | Copyright (c) 2010 Anthony Dahanne
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/g2-java-client/src/main/java/net/dahanne/gallery/g2/java/client/ssl/FakeTrustManager.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g2-java-client, a Menalto Gallery2 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | /**
20 | *
21 | * Taken from http://code.google.com/p/transdroid
22 | *
23 | *
24 | */
25 | package net.dahanne.gallery.g2.java.client.ssl;
26 |
27 | import java.security.cert.CertificateException;
28 | import java.security.cert.X509Certificate;
29 |
30 | import javax.net.ssl.X509TrustManager;
31 |
32 | public class FakeTrustManager implements X509TrustManager {
33 |
34 | private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
35 |
36 | public void checkClientTrusted(X509Certificate[] chain, String authType)
37 | throws CertificateException {
38 | }
39 |
40 | public void checkServerTrusted(X509Certificate[] chain, String authType)
41 | throws CertificateException {
42 | }
43 |
44 | public boolean isClientTrusted(X509Certificate[] chain) {
45 | return true;
46 | }
47 |
48 | public boolean isServerTrusted(X509Certificate[] chain) {
49 | return true;
50 | }
51 |
52 | public X509Certificate[] getAcceptedIssuers() {
53 | return _AcceptedIssuers;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/g2-java-client/src/main/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g2-java-client/src/main/resources/.gitignore
--------------------------------------------------------------------------------
/g2-java-client/src/test/java/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g2-java-client/src/test/java/.gitignore
--------------------------------------------------------------------------------
/g2-java-client/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g2-java-client/src/test/resources/.gitignore
--------------------------------------------------------------------------------
/g2-java-client/src/test/resources/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g2-java-client/src/test/resources/image.png
--------------------------------------------------------------------------------
/g3-java-client/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | sourceCompatibility = 1.7
3 | targetCompatibility = 1.7
4 | group = 'net.dahanne.gallery3'
5 | description = 'Gallery3 Java Client'
6 | dependencies {
7 | compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.1.2'
8 | compile group: 'org.json', name: 'json', version:'20090211'
9 | compile group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.1.2'
10 | compile project(':commons-gallery')
11 | compile group: 'commons-lang', name: 'commons-lang', version:'2.6'
12 | testCompile group: 'com.google.guava', name: 'guava', version:'10.0.1'
13 | testCompile group: 'junit', name: 'junit', version:'4.10'
14 | testCompile group: 'jmimemagic', name: 'jmimemagic', version:'0.1.2'
15 | }
16 |
--------------------------------------------------------------------------------
/g3-java-client/resources/getApiKeyExample.rcq:
--------------------------------------------------------------------------------
1 |
2 | 1.1http://url/index.php/restPOSTuser=anthony&password=reGalF00
3 |
--------------------------------------------------------------------------------
/g3-java-client/resources/getItem1.rcq:
--------------------------------------------------------------------------------
1 |
2 | 1.1http://url/index.php/rest/item/1POST
3 |
--------------------------------------------------------------------------------
/g3-java-client/resources/license-header.txt:
--------------------------------------------------------------------------------
1 | g3-java-client, a Menalto Gallery3 Java Client API
2 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
3 | Copyright (c) 2010 Anthony Dahanne
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/g3-java-client/resources/request-examples.txt:
--------------------------------------------------------------------------------
1 | ====
2 | g3-java-client, a Menalto Gallery3 Java Client API
3 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | Copyright (c) 2010 Anthony Dahanne
5 | This program is free software; you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation; either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | ====
18 |
19 | ----------Item remote api examples
20 | https://github.com/gallery/gallery3/blob/master/modules/gallery/helpers/item_rest.php
21 | #get the item 172
22 | http://g3.dahanne.net/index.php/rest/item/172?output=html
23 |
24 |
25 | ----------Items remote api examples
26 | https://github.com/gallery/gallery3/blob/master/modules/gallery/helpers/items_rest.php
27 | #get the items 4 and 5
28 | http://g3.dahanne.net//index.php/rest/items?urls=[%22http://g3.dahanne.net/index.php/rest/item/4%22,%22http://g3.dahanne.net/index.php/rest/item/5%22]%20&output=html
29 |
30 | #get the items 173,178,179 and 180, but only the photos items among them
31 | http://g3.dahanne.net//index.php/rest/items?urls=[%22http://g3.dahanne.net/index.php/rest/item/173%22,%22http://g3.dahanne.net/index.php/rest/item/178%22,%22http://g3.dahanne.net/index.php/rest/item/179%22,%22http://g3.dahanne.net/index.php/rest/item/180%22]%20&type=photo&output=html
32 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/business/IG3Client.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.business;
20 |
21 | import java.io.File;
22 | import java.util.List;
23 |
24 | import net.dahanne.gallery3.client.business.exceptions.G3GalleryException;
25 | import net.dahanne.gallery3.client.model.Entity;
26 | import net.dahanne.gallery3.client.model.Item;
27 |
28 | public interface IG3Client {
29 |
30 | Item getItem(int itemId)throws G3GalleryException;
31 | int createItem(Entity entity,File file) throws G3GalleryException;
32 | void updateItem(Entity entity)throws G3GalleryException;
33 | void deleteItem(int itemId)throws G3GalleryException;
34 | String getApiKey()throws G3GalleryException;
35 | List- getAlbumAndSubAlbums(int albumId) throws G3GalleryException;
36 | public List
- getPictures(int albumId) throws G3GalleryException;
37 | }
38 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/business/exceptions/G3BadRequestException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.business.exceptions;
20 |
21 | public class G3BadRequestException extends G3GalleryException {
22 |
23 | private static final long serialVersionUID = -2438128686943266378L;
24 | public G3BadRequestException(String string) {
25 | super(string);
26 | }
27 | public G3BadRequestException() {
28 | super();
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/business/exceptions/G3ForbiddenException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.business.exceptions;
20 |
21 | public class G3ForbiddenException extends G3GalleryException {
22 |
23 | private static final long serialVersionUID = -2438128686943266378L;
24 | public G3ForbiddenException(String string) {
25 | super(string);
26 | }
27 | public G3ForbiddenException() {
28 | super();
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/business/exceptions/G3GalleryException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.business.exceptions;
20 |
21 | public class G3GalleryException extends Exception {
22 |
23 | public G3GalleryException(Throwable arg0) {
24 | super(arg0);
25 | }
26 | public G3GalleryException() {
27 | super();
28 | }
29 | private static final long serialVersionUID = -2438128686943266378L;
30 | public G3GalleryException(String string) {
31 | super(string);
32 | }
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/business/exceptions/G3ItemNotFoundException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.business.exceptions;
20 |
21 | public class G3ItemNotFoundException extends G3GalleryException {
22 |
23 | private static final long serialVersionUID = -2438128686943266378L;
24 | public G3ItemNotFoundException(String string) {
25 | super(string);
26 | }
27 | public G3ItemNotFoundException() {
28 | super();
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/Comments.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import javax.xml.bind.annotation.XmlRootElement;
22 |
23 | @XmlRootElement
24 | public class Comments {
25 | private String url;
26 |
27 | public void setUrl(String url) {
28 | this.url = url;
29 | }
30 |
31 | public String getUrl() {
32 | return url;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/EntityAlbum.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import javax.xml.bind.annotation.XmlRootElement;
22 |
23 | @XmlRootElement
24 | public class EntityAlbum extends Entity {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/EntityPhoto.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import javax.xml.bind.annotation.XmlRootElement;
22 |
23 | @XmlRootElement
24 | public class EntityPhoto extends Entity {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/Item.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import java.util.Collection;
22 | import java.util.HashSet;
23 |
24 |
25 | public class Item {
26 |
27 | private String url;
28 | private Entity entity;
29 | private RelationShips relationships;
30 | private final Collection members = new HashSet();
31 |
32 | public Entity getEntity() {
33 | return entity;
34 | }
35 |
36 | public void setEntity(Entity entity) {
37 | this.entity = entity;
38 | }
39 |
40 | public RelationShips getRelationships() {
41 | return relationships;
42 | }
43 |
44 | public void setRelationships(RelationShips relationships) {
45 | this.relationships = relationships;
46 | }
47 |
48 | public void setUrl(String url) {
49 | this.url = url;
50 | }
51 |
52 | public String getUrl() {
53 | return url;
54 | }
55 |
56 | /**
57 | * members are the sub items urls of the current item(which has to be an
58 | * album, as only albums have members)
59 | *
60 | * @return
61 | */
62 | public Collection getMembers() {
63 | return members;
64 | }
65 | @Override
66 | public String toString() {
67 | return new StringBuilder().append(" url : ").append(url)
68 | .append(" entity : ").append(entity.toString() )
69 | .toString();
70 | }
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/RelationShips.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import javax.xml.bind.annotation.XmlRootElement;
22 |
23 | @XmlRootElement
24 | public class RelationShips {
25 | private Tags tags;
26 | private Comments comments;
27 |
28 | public void setTags(Tags tags) {
29 | this.tags = tags;
30 | }
31 |
32 | public Tags getTags() {
33 | return tags;
34 | }
35 |
36 | public void setComments(Comments comments) {
37 | this.comments = comments;
38 | }
39 |
40 | public Comments getComments() {
41 | return comments;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/model/Tags.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.model;
20 |
21 | import java.util.Collection;
22 | import java.util.HashSet;
23 |
24 | import javax.xml.bind.annotation.XmlRootElement;
25 |
26 | @XmlRootElement
27 | public class Tags {
28 | private String url;
29 | private final Collection members = new HashSet();
30 | public Collection getMembers() {
31 | return members;
32 | }
33 | public String getUrl() {
34 | return url;
35 | }
36 | public void setUrl(String url) {
37 | this.url = url;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/g3-java-client/src/main/java/net/dahanne/gallery3/client/utils/G3ConvertUtils.java:
--------------------------------------------------------------------------------
1 | /**
2 | * g3-java-client, a Menalto Gallery3 Java Client API
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.gallery3.client.utils;
20 |
21 | import net.dahanne.gallery.commons.model.Album;
22 | import net.dahanne.gallery.commons.model.Picture;
23 | import net.dahanne.gallery3.client.model.Item;
24 |
25 | public class G3ConvertUtils {
26 |
27 | public static Album itemToAlbum(Item item) {
28 | if(item==null ||item.getEntity()==null){
29 | return null;
30 | }
31 | Album album = new Album();
32 | album.setId(item.getEntity().getId());
33 | album.setName(item.getEntity().getId());
34 | album.setTitle(item.getEntity().getTitle());
35 | album.setSummary(item.getEntity().getDescription());
36 | album.setAlbumUrl(item.getEntity().getWebUrl());
37 | album.setAlbumCoverUrl(item.getEntity().getThumbUrl());
38 | return album;
39 | }
40 | public static Picture itemToPicture(Item item) {
41 | if(item==null ||item.getEntity()==null){
42 | return null;
43 | }
44 | Picture picture = new Picture();
45 | picture.setId(item.getEntity().getId());
46 | picture.setTitle(item.getEntity().getTitle());
47 | picture.setFileName(item.getEntity().getName());
48 |
49 | picture.setThumbUrl(item.getEntity().getThumbUrl());
50 | picture.setThumbWidth(item.getEntity().getThumbWidth());
51 | picture.setThumbHeight(item.getEntity().getThumbHeight());
52 | picture.setThumbSize(item.getEntity().getThumbSize());
53 |
54 | picture.setResizedUrl(item.getEntity().getResizeUrl());
55 | picture.setResizedWidth(item.getEntity().getResizeWidth());
56 | picture.setResizedHeight(item.getEntity().getResizeHeight());
57 | picture.setResizedSize(item.getEntity().getResizeSize());
58 |
59 | picture.setFileUrl(item.getEntity().getFileUrl());
60 | picture.setFileSize(item.getEntity().getFileSize());
61 | picture.setHeight(item.getEntity().getHeight());
62 | picture.setWidth(item.getEntity().getWidth());
63 |
64 | picture.setPublicUrl(item.getEntity().getWebUrl());
65 |
66 | return picture;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-album-1.json:
--------------------------------------------------------------------------------
1 | {"url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/1",
2 | "entity":{
3 | "id":"1",
4 | "captured":null,
5 | "created":"1276227460",
6 | "description":"",
7 | "height":null,
8 | "level":"1",
9 | "mime_type":null,
10 | "name":null,
11 | "owner_id":"2",
12 | "rand_key":null,
13 | "resize_height":null,
14 | "resize_width":null,
15 | "slug":null,
16 | "sort_column":"weight",
17 | "sort_order":"ASC",
18 | "thumb_height":"200",
19 | "thumb_width":"150",
20 | "title":"Gallery",
21 | "type":"album",
22 | "updated":"1276227718",
23 | "view_count":"8",
24 | "width":null,
25 | "view_1":"1",
26 | "view_2":"1",
27 | "album_cover":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/2",
28 | "web_url":"http:\/\/g3.dahanne.net\/index.php\/",
29 | "thumb_url":"http:\/\/g3.dahanne.net\/index.php\/rest\/data\/1?size=thumb",
30 | "thumb_size":17151,
31 | "thumb_url_public":"http:\/\/g3.dahanne.net\/var\/thumbs\/\/.album.jpg?m=1276227718",
32 | "can_edit":false
33 | },
34 | "relationships":{
35 | "comments":{
36 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_comments\/1"
37 | },
38 | "tags":{
39 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_tags\/1",
40 | "members":[]
41 | }
42 | },
43 | "members":["http:\/\/g3.dahanne.net\/index.php\/rest\/item\/2","http:\/\/g3.dahanne.net\/index.php\/rest\/item\/3"]
44 | }
45 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-album-11.json:
--------------------------------------------------------------------------------
1 | {"url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/11",
2 | "entity":{
3 | "id":"11",
4 | "captured":null,
5 | "created":"1284818165",
6 | "description":"",
7 | "height":null,
8 | "level":"2",
9 | "mime_type":null,
10 | "name":"G2AndroidSecretAlbum",
11 | "owner_id":"2",
12 | "rand_key":"0.952582",
13 | "resize_height":null,
14 | "resize_width":null,
15 | "slug":"G2AndroidSecretAlbum",
16 | "sort_column":"created",
17 | "sort_order":"ASC",
18 | "thumb_height":null,
19 | "thumb_width":null,
20 | "title":"G2AndroidSecretAlbum",
21 | "type":"album",
22 | "updated":"1284830781",
23 | "view_count":"6",
24 | "width":null,
25 | "view_1":"0",
26 | "view_2":"0",
27 | "view_3":"1",
28 | "parent":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/1",
29 | "web_url":"http:\/\/g3.dahanne.net\/index.php\/G2AndroidSecretAlbum",
30 | "can_edit":true
31 | },
32 | "relationships":{
33 | "comments":{
34 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_comments\/11"
35 | },
36 | "tags":{
37 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_tags\/11",
38 | "members":[]
39 | }
40 | },
41 | "members":["http:\/\/g3.dahanne.net\/index.php\/rest\/item\/13",
42 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/14",
43 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/15",
44 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/16",
45 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/18",
46 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/20",
47 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/22",
48 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/25",
49 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/26",
50 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/28",
51 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/30",
52 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/32",
53 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/34",
54 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/35"]}
55 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-album-bug32_owner-id-null.json:
--------------------------------------------------------------------------------
1 | {
2 | "url":"http://myserver.com:7770/gallery3/index.php/rest/item/1",
3 | "entity":
4 | {
5 | "id":"1",
6 | "captured":null,
7 | "created":"1267413254",
8 | "description":"",
9 | "height":null,
10 | "level":"1",
11 | "mime_type":null,
12 | "name":null,
13 | "owner_id":null,
14 | "rand_key":null,
15 | "resize_height":null,
16 | "resize_width":null,
17 | "slug":null,
18 | "sort_column":"weight",
19 | "sort_order":"ASC",
20 | "thumb_height":"150",
21 | "thumb_width":"200",
22 | "title":"Gallery",
23 | "type":"album",
24 | "updated":"1291018965",
25 | "view_count":"635",
26 | "width":null,
27 | "view_1":"1",
28 | "view_2":"1",
29 | "view_3":"1",
30 | "album_cover":"http://myserver.com:7770/gallery3/index.php/rest/item/6094",
31 | "web_url":"http://myserver.com:7770/gallery3/index.php/",
32 | "thumb_url":"http://myserver.com:7770/gallery3/index.php/rest/data/1?size=thumb",
33 | "thumb_size":57139,
34 | "thumb_url_public":"http://myserver.com:7770/gallery3/var/thumbs//.album.jpg?m=1291018965",
35 | "can_edit":false
36 | },
37 | "relationships":
38 | {
39 | "comments":{"url":"http://myserver.com:7770/gallery3/index.php/rest/item_comments/1"},
40 | "tags":{"url":"http://myserver.com:7770/gallery3/index.php/rest/item_tags/1",
41 | "members":[]}
42 | },
43 | "members":["http://myserver.com:7770/gallery3/index.php/rest/item/5",
44 | "http://myserver.com:7770/gallery3/index.php/rest/item/2307"]
45 | }
46 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-albums-no-comments-issue82.json:
--------------------------------------------------------------------------------
1 | {"url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/11",
2 | "entity":{
3 | "id":"11",
4 | "captured":null,
5 | "created":"1284818165",
6 | "description":"",
7 | "height":null,
8 | "level":"2",
9 | "mime_type":null,
10 | "name":"G2AndroidSecretAlbum",
11 | "owner_id":"2",
12 | "rand_key":"0.952582",
13 | "resize_height":null,
14 | "resize_width":null,
15 | "slug":"G2AndroidSecretAlbum",
16 | "sort_column":"created",
17 | "sort_order":"ASC",
18 | "thumb_height":null,
19 | "thumb_width":null,
20 | "title":"G2AndroidSecretAlbum",
21 | "type":"album",
22 | "updated":"1284830781",
23 | "view_count":"6",
24 | "width":null,
25 | "view_1":"0",
26 | "view_2":"0",
27 | "view_3":"1",
28 | "parent":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/1",
29 | "web_url":"http:\/\/g3.dahanne.net\/index.php\/G2AndroidSecretAlbum",
30 | "can_edit":true
31 | },
32 | "relationships":{
33 | "comments":[],
34 | "tags":[]
35 | },
36 | "members":["http:\/\/g3.dahanne.net\/index.php\/rest\/item\/13",
37 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/14",
38 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/15",
39 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/16",
40 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/18",
41 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/20",
42 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/22",
43 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/25",
44 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/26",
45 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/28",
46 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/30",
47 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/32",
48 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/34",
49 | "http:\/\/g3.dahanne.net\/index.php\/rest\/item\/35"]}
50 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-albums-no-relationships-38.json:
--------------------------------------------------------------------------------
1 | {"url":"http:\/\/kr.scuznet.com\/gallery3\/index.php\/rest\/item\/1",
2 | "entity":{"id":"1",
3 | "captured":null,
4 | "created":"1248009005",
5 | "description":"",
6 | "height":null,
7 | "level":"1",
8 | "mime_type":null,
9 | "name":null,
10 | "owner_id":"3",
11 | "rand_key":null,
12 | "resize_height":null,
13 | "resize_width":null,
14 | "sort_column":"weight",
15 | "sort_order":"ASC",
16 | "thumb_height":"166",
17 | "thumb_width":"250",
18 | "title":"Gallery",
19 | "type":"album",
20 | "updated":"1248010262",
21 | "view_count":"486",
22 | "width":null,
23 | "view_1":"0",
24 | "view_2":"0",
25 | "slug":null,
26 | "view_4":"1",
27 | "view_5":"1",
28 | "album_cover":"http:\/\/kr.scuznet.com\/gallery3\/index.php\/rest\/item\/2236",
29 | "web_url":"http:\/\/kr.scuznet.com\/gallery3\/index.php\/",
30 | "thumb_url":"http:\/\/kr.scuznet.com\/gallery3\/index.php\/rest\/data\/1?size=thumb",
31 | "thumb_size":21254,
32 | "can_edit":false},
33 | "relationships":[],
34 | "members":["http:\/\/kr.scuznet.com\/gallery3\/index.php\/rest\/item\/86992"]}
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-photo-2.json:
--------------------------------------------------------------------------------
1 | {"url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/2",
2 | "entity":{
3 | "id":"2",
4 | "captured":"1272750491",
5 | "created":"1276227630",
6 | "description":"La March\u00e9 bon secours \u00e0 Montr\u00e9al",
7 | "height":"3072",
8 | "level":"2",
9 | "mime_type":"image\/jpeg",
10 | "name":"marche-bonsecours.JPG",
11 | "owner_id":"2",
12 | "rand_key":"0.451528",
13 | "resize_height":"640",
14 | "resize_width":"480",
15 | "slug":"marche-bonsecours",
16 | "sort_column":"created",
17 | "sort_order":"ASC",
18 | "thumb_height":"200",
19 | "thumb_width":"150",
20 | "title":"March\u00e9 Bon secours",
21 | "type":"photo",
22 | "updated":"1276229274",
23 | "view_count":"60",
24 | "width":"2304",
25 | "view_1":"1",
26 | "view_2":"1",
27 | "parent":"http:\/\/g3.dahanne.net\/index.php\/rest\/item\/1",
28 | "web_url":"http:\/\/g3.dahanne.net\/index.php\/marche-bonsecours",
29 | "file_url":"http:\/\/g3.dahanne.net\/index.php\/rest\/data\/2?size=full",
30 | "file_size":675745,
31 | "file_url_public":"http:\/\/g3.dahanne.net\/var\/albums\/marche-bonsecours.JPG?m=1276229274",
32 | "resize_url":"http:\/\/g3.dahanne.net\/index.php\/rest\/data\/2?size=resize",
33 | "resize_size":58309,
34 | "resize_url_public":"http:\/\/g3.dahanne.net\/var\/resizes\/marche-bonsecours.JPG?m=1276229274",
35 | "thumb_url":"http:\/\/g3.dahanne.net\/index.php\/rest\/data\/2?size=thumb",
36 | "thumb_size":17151,
37 | "thumb_url_public":"http:\/\/g3.dahanne.net\/var\/thumbs\/marche-bonsecours.JPG?m=1276229274",
38 | "can_edit":false
39 | },
40 | "relationships":{
41 | "comments":{
42 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_comments\/2"
43 | },
44 | "tags":{
45 | "url":"http:\/\/g3.dahanne.net\/index.php\/rest\/item_tags\/2",
46 | "members":["http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/6,2",
47 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/7,2",
48 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/8,2",
49 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/9,2",
50 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/10,2",
51 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/11,2",
52 | "http:\/\/g3.dahanne.net\/index.php\/rest\/tag_item\/12,2"]
53 | }
54 | }
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/get-photo-bug3_resize_size_false.json:
--------------------------------------------------------------------------------
1 | {
2 | "relationships":{
3 | "tags":{
4 | "members":[],
5 | "url":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/item_tags\/502"
6 | },
7 | "comments":{
8 | "url":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/item_comments\/502"
9 | }
10 | },
11 | "url":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/item\/502",
12 | "entity":{
13 | "rand_key":"0.112113",
14 | "resize_size":false,
15 | "view_2":"1",
16 | "can_edit":false,
17 | "resize_url":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/data\/502?size=resize",
18 | "captured":"1280221410",
19 | "type":"photo",
20 | "view_1":"1",
21 | "file_url":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/data\/502?size=full",
22 | "id":"502",
23 | "title":"graduation pics 427",
24 | "level":"3",
25 | "height":"1932",
26 | "mime_type":"image\/jpeg",
27 | "updated":"1288040628",
28 | "created":"1287591712",
29 | "thumb_width":null,
30 | "description":null,
31 | "name":"graduation pics 427.jpg",
32 | "file_url_public":"http:\/\/www.iffam.org\/gallery\/var\/albums\/Twitpic\/graduation%20pics%20427.jpg?m=1288040628",
33 | "sort_column":"created",
34 | "file_size":1144458,
35 | "resize_url_public":"http:\/\/www.iffam.org\/gallery\/var\/resizes\/Twitpic\/graduation%20pics%20427.jpg?m=1288040628",
36 | "thumb_height":null,
37 | "web_url":"http:\/\/www.iffam.org\/gallery\/index.php\/Twitpic\/graduation-pics-427",
38 | "width":"2576",
39 | "parent":"http:\/\/www.iffam.org\/gallery\/index.php\/rest\/item\/2",
40 | "resize_height":null,
41 | "owner_id":"2",
42 | "slug":"graduation-pics-427",
43 | "resize_width":null,
44 | "sort_order":"ASC",
45 | "view_count":"2"
46 | }
47 | }
--------------------------------------------------------------------------------
/g3-java-client/src/test/resources/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/g3-java-client/src/test/resources/logo.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 10 23:22:05 EDT 2016
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.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/jiwigo-ws-api-converter/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | sourceCompatibility = 1.7
3 | targetCompatibility = 1.7
4 | group = 'net.dahanne.gallery'
5 | description = 'Jiwigo WS API Converter'
6 | dependencies {
7 | compile project(':jiwigo-ws-api')
8 | compile project(':commons-gallery')
9 | testCompile group: 'junit', name: 'junit', version:'4.10'
10 | }
11 |
--------------------------------------------------------------------------------
/jiwigo-ws-api-converter/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | regalandroid-parent
6 | net.dahanne.android
7 | 1.2.1-SNAPSHOT
8 | ../regalandroid-parent/pom.xml
9 |
10 | net.dahanne.gallery
11 | jiwigo-ws-api-converter
12 | Jiwigo WS API Converter
13 | This project contains utilities to transform Jiwgo WS API objects to Albums and Pictures used by RegalAndroid
14 | http://github.com/anthonydahanne/ReGalAndroid
15 |
16 | UTF-8
17 |
18 |
19 |
20 | GPL v3
21 | http://www.gnu.org/licenses/gpl.txt
22 | repo
23 |
24 |
25 |
26 | git@github.com:anthonydahanne/ReGalAndroid.git
27 | git@github.com:anthonydahanne/ReGalAndroid.git
28 | git@github.com:anthonydahanne/ReGalAndroid.git
29 |
30 |
31 |
32 | anthonydahanne
33 | Anthony Dahanne
34 | anthony.dahanne@gmail.com
35 | http://blog.dahanne.net
36 |
37 |
38 |
39 |
40 |
41 | fr.mael.jiwigo
42 | jiwigo-ws-api
43 | ${project.parent.version}
44 |
45 |
46 | net.dahanne.gallery
47 | commons-gallery
48 | ${project.parent.version}
49 |
50 |
51 | junit
52 | junit
53 | jar
54 | test
55 |
56 |
57 |
58 |
59 |
60 | org.apache.maven.plugins
61 | maven-source-plugin
62 |
63 |
64 | attach-sources
65 | verify
66 |
67 | jar-no-fork
68 |
69 |
70 |
71 |
72 |
73 | org.apache.maven.plugins
74 | maven-compiler-plugin
75 |
76 | 1.5
77 | 1.5
78 |
79 |
80 |
81 | com.mycila
82 | maven-license-plugin
83 |
84 | ${basedir}/resources/license-header.txt
85 | true
86 |
87 |
88 |
89 | check
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | commons-lang
101 | commons-lang
102 | 2.6
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/jiwigo-ws-api-converter/resources/license-header.txt:
--------------------------------------------------------------------------------
1 | g3-java-client, a Menalto Gallery3 Java Client API
2 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
3 | Copyright (c) 2010 Anthony Dahanne
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/jiwigo-ws-api/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | sourceCompatibility = 1.7
3 | targetCompatibility = 1.7
4 | group = 'fr.mael.jiwigo'
5 | description = ''
6 | dependencies {
7 | compile group: 'commons-lang', name: 'commons-lang', version:'2.5'
8 | compile(group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.1') {
9 | exclude(module: 'commons-logging')
10 | }
11 | compile group: 'org.slf4j', name: 'slf4j-api', version:'1.6.2'
12 | compile(group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.1.1') {
13 | exclude(module: 'commons-logging')
14 | }
15 | testCompile group: 'junit', name: 'junit', version:'4.10'
16 | testCompile group: 'commons-logging', name: 'commons-logging', version:'1.1.3'
17 | }
18 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | fr.mael.jiwigo
4 | jiwigo-ws-api
5 |
6 |
7 | regalandroid-parent
8 | net.dahanne.android
9 | 1.2.1-SNAPSHOT
10 | ../regalandroid-parent/pom.xml
11 |
12 |
13 |
14 |
15 | commons-lang
16 | commons-lang
17 | 2.5
18 |
19 |
20 | org.apache.httpcomponents
21 | httpclient
22 | 4.1
23 |
24 |
25 | commons-logging
26 | commons-logging
27 |
28 |
29 |
30 |
31 | org.slf4j
32 | slf4j-api
33 | jar
34 | compile
35 |
36 |
37 | junit
38 | junit
39 | jar
40 | test
41 |
42 |
43 | org.apache.httpcomponents
44 | httpmime
45 | 4.1.1
46 | jar
47 | compile
48 |
49 |
50 | commons-logging
51 | commons-logging
52 |
53 |
54 |
55 |
56 | commons-logging
57 | commons-logging
58 | 1.1.3
59 | test
60 |
61 |
62 |
63 |
64 |
65 |
66 | maven-assembly-plugin
67 | 2.2
68 |
69 |
70 | jar-with-dependencies
71 |
72 |
73 |
74 |
75 | org.apache.maven.plugins
76 | maven-compiler-plugin
77 |
78 | 1.5
79 | 1.5
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.dao;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import fr.mael.jiwigo.om.Category;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
9 |
10 | public interface CategoryDao {
11 |
12 | /**
13 | * Lists the categories
14 | * @param recursive true : recursive listing of the categories
15 | * @return the list of categories
16 | * @throws IOException
17 | * @throws ProxyAuthenticationException
18 | * @throws JiwigoException
19 | */
20 | public List list(boolean recursive) throws JiwigoException;
21 |
22 | /**
23 | * Creation of a category
24 | * @param category the category to create
25 | * @return true if the category is successfully created
26 | * @throws ProxyAuthenticationException
27 | * @throws JiwigoException
28 | */
29 | public boolean create(Category category) throws JiwigoException;
30 |
31 | /**
32 | * Function that deletes a given category
33 | * @param category the category to delete
34 | * @return true if the category is successfully deleted
35 | * @throws JiwigoException
36 | */
37 | public boolean delete(Category category) throws JiwigoException;
38 | }
39 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.dao;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import fr.mael.jiwigo.om.Comment;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
9 |
10 | public interface CommentDao {
11 | /**
12 | * Listing of the comments for the given image
13 | * @param idImage id of the image
14 | * @return list of comments
15 | * @throws IOException
16 | * @throws ProxyAuthenticationException
17 | */
18 | public List list(Integer idImage) throws JiwigoException;
19 |
20 | /**
21 | * Gets the key essential to add a comment
22 | * @param idImage the id of the image
23 | * @return the key
24 | * @throws IOException
25 | * @throws ProxyAuthenticationException
26 | */
27 | public String getKey(Integer idImage) throws JiwigoException;
28 |
29 | /**
30 | * Creates a comment
31 | * @param commentaire the comment to add
32 | * @return true if the comment is successfully added
33 | * @throws IOException
34 | * @throws ProxyAuthenticationException
35 | */
36 | public boolean create(Comment commentaire) throws JiwigoException;
37 | }
38 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.dao;
2 |
3 | import java.util.List;
4 |
5 | import fr.mael.jiwigo.om.Image;
6 | import fr.mael.jiwigo.om.Tag;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 |
9 | public interface TagDao {
10 | /**
11 | * lists the tags
12 | * @return the list of tags
13 | * @throws JiwigoException
14 | */
15 | public List list() throws JiwigoException;
16 |
17 | /**
18 | * Creation of a tag
19 | * @param tag the tag to create
20 | * @return true if the tag as been successfully created
21 | * @throws JiwigoException
22 | */
23 | public boolean create(Tag tag) throws JiwigoException;
24 |
25 | /**
26 | * Function that returns the tags for an image
27 | * @param image the image
28 | * @return the tags list
29 | * @throws JiwigoException
30 | */
31 | public List tagsForImage(Image image) throws JiwigoException;
32 | }
33 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Comment.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.om;
2 |
3 | /*
4 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
5 | Version 2, December 2004
6 |
7 | Copyright (C) 2011 Mael
8 |
9 | Everyone is permitted to copy and distribute verbatim or modified
10 | copies of this license document, and changing it is allowed as long
11 | as the name is changed.
12 |
13 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
14 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
15 |
16 | 0. You just DO WHAT THE FUCK YOU WANT TO.
17 |
18 | */
19 | /**
20 | *
21 | * @author mael
22 | *
23 | */
24 | public class Comment {
25 | private Integer imageId;
26 | private String author;
27 | private String content;
28 | private String key;
29 | private Integer identifier;
30 | private String date;
31 |
32 | /**
33 | * @return the imageId
34 | */
35 | public Integer getImageId() {
36 | return imageId;
37 | }
38 |
39 | /**
40 | * @param imageId the imageId to set
41 | */
42 | public void setImageId(Integer imageId) {
43 | this.imageId = imageId;
44 | }
45 |
46 | /**
47 | * @return the author
48 | */
49 | public String getAuthor() {
50 | return author;
51 | }
52 |
53 | /**
54 | * @param author the author to set
55 | */
56 | public void setAuthor(String author) {
57 | this.author = author;
58 | }
59 |
60 | /**
61 | * @return the content
62 | */
63 | public String getContent() {
64 | return content;
65 | }
66 |
67 | /**
68 | * @param content the content to set
69 | */
70 | public void setContent(String content) {
71 | this.content = content;
72 | }
73 |
74 | /**
75 | * @return the key
76 | */
77 | public String getKey() {
78 | return key;
79 | }
80 |
81 | /**
82 | * @param key the key to set
83 | */
84 | public void setKey(String key) {
85 | this.key = key;
86 | }
87 |
88 | public Integer getIdentifier() {
89 | return identifier;
90 | }
91 |
92 | public void setIdentifier(Integer identifier) {
93 | this.identifier = identifier;
94 | }
95 |
96 | /**
97 | * @return the date
98 | */
99 | public String getDate() {
100 | return date;
101 | }
102 |
103 | /**
104 | * @param date the date to set
105 | */
106 | public void setDate(String date) {
107 | this.date = date;
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Tag.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.om;
2 |
3 | /*
4 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
5 | Version 2, December 2004
6 |
7 | Copyright (C) 2011 Mael
8 |
9 | Everyone is permitted to copy and distribute verbatim or modified
10 | copies of this license document, and changing it is allowed as long
11 | as the name is changed.
12 |
13 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
14 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
15 |
16 | 0. You just DO WHAT THE FUCK YOU WANT TO.
17 |
18 | */
19 | /**
20 |
21 | * @author mael
22 | *
23 | */
24 | public class Tag {
25 | /**
26 | * Name of the tag
27 | */
28 | private String name;
29 |
30 | /**
31 | * Id of the tag
32 | */
33 | private Integer identifier;
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public Integer getIdentifier() {
44 | return identifier;
45 | }
46 |
47 | public void setIdentifier(Integer identifier) {
48 | this.identifier = identifier;
49 | }
50 |
51 | @Override
52 | public String toString() {
53 | // TODO Auto-generated method stub
54 | return name;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import fr.mael.jiwigo.om.Category;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
9 |
10 | public interface CategoryService {
11 | /**
12 | * Lists all categories
13 | * @param recursive true : recursive listing
14 | * @return the list of categories
15 | * @throws IOException
16 | * @throws ProxyAuthenticationException
17 | */
18 | public List list(boolean recursive) throws JiwigoException;
19 |
20 | /**
21 | * Allows to create the categories tree
22 | * @return list of categories
23 | * @throws IOException
24 | * @throws ProxyAuthenticationException
25 | */
26 | public List makeTree() throws JiwigoException;
27 |
28 | /**
29 | * creation of a category
30 | * @param nom name of the category
31 | * @param parent parent category
32 | * @return true if successful
33 | * @throws ProxyAuthenticationException
34 | */
35 | public boolean create(String nom, Integer parent) throws JiwigoException;
36 |
37 | /**
38 | * creation of a category without parent
39 | * @param nom name of the category
40 | * @return true if successful
41 | * @throws ProxyAuthenticationException
42 | */
43 | public boolean create(String nom) throws JiwigoException;
44 |
45 | /**
46 | * Deletes a category
47 | * @param id id of the category
48 | * @return
49 | * @throws JiwigoException
50 | */
51 | public boolean delete(Category category) throws JiwigoException;
52 | }
53 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import fr.mael.jiwigo.om.Comment;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
9 |
10 | public interface CommentService {
11 | /**
12 | * Lists all comments for an image
13 | * @param imageId the id of the image
14 | * @return the list of comments
15 | * @throws IOException
16 | * @throws ProxyAuthenticationException
17 | */
18 | public List list(Integer imageId) throws JiwigoException;
19 |
20 | /**
21 | * Creates a comment for an image
22 | * @param content the comment
23 | * @param imageId the id of the image
24 | * @param auteur the author of the comment
25 | * @return true if successful
26 | * @throws IOException
27 | * @throws ProxyAuthenticationException
28 | */
29 | public boolean create(String content, Integer imageId, String auteur) throws JiwigoException;
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.security.NoSuchAlgorithmException;
6 | import java.util.List;
7 |
8 | import fr.mael.jiwigo.om.Image;
9 | import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
10 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
11 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
12 | import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException;
13 |
14 | public interface ImageService {
15 |
16 | /**
17 | * Lists all images for a category
18 | * @param categoryId the id of the category
19 | * @return the list of images
20 | * @throws IOException
21 | * @throws ProxyAuthenticationException
22 | */
23 | public List listByCategory(Integer categoryId, boolean rafraichir) throws JiwigoException;
24 |
25 | /**
26 | * Method called to send an image to the server.
27 | * @param filePath
28 | * @param idCategory
29 | * @param originalWidth width for the original image
30 | * @param originalHeight height for the original image
31 | * @return true if the image is created
32 | * @throws IOException
33 | * @throws WrongChunkSizeException
34 | * @throws ProxyAuthenticationException
35 | * @throws FileAlreadyExistsException
36 | * @throws NoSuchAlgorithmException
37 | * @throws JiwigoException
38 | * @throws Exception
39 | */
40 | public boolean create(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight,
41 | Double chunckSize, Integer privacyLevel) throws IOException, NoSuchAlgorithmException,
42 | FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException, JiwigoException;
43 |
44 | /**
45 | * Add tags to an existing image
46 | * @param image the image
47 | * @param tagId the ids of the tags
48 | * @return true if successful
49 | * @throws IOException
50 | * @throws ProxyAuthenticationException
51 | */
52 | public boolean addTags(Image image, String tagId) throws JiwigoException;
53 |
54 | /**
55 | * Search images from a string
56 | * @param queryString the string
57 | * @return images matching the string
58 | * @throws IOException
59 | * @throws ProxyAuthenticationException
60 | */
61 | public List search(String queryString) throws JiwigoException;
62 |
63 | /**
64 | * Uses the pwg.images.addsimple web API to add a new picture
65 | * http://piwigo.org/doc/doku.php?id=en:dev:webapi:pwg.images.addsimple
66 | *
67 | * @param file
68 | * @param category
69 | * @param title
70 | * @throws IOException
71 | * @throws JiwigoException
72 | */
73 | public void addSimple(File file, Integer category, String title) throws JiwigoException;
74 |
75 | /**
76 | * Uses the pwg.images.addsimple web API to add a new picture
77 | * http://piwigo.org/doc/doku.php?id=en:dev:webapi:pwg.images.addsimple
78 | *
79 | * @param file
80 | * @param category
81 | * @param title
82 | * @param level
83 | * @throws IOException
84 | * @throws JiwigoException
85 | */
86 | public void addSimple(File file, Integer category, String title, Integer level) throws JiwigoException;
87 |
88 | /**
89 | * Deletes an image
90 | * @param image the image to delete
91 | * @throws JiwigoException
92 | */
93 | public boolean delete(Image image) throws JiwigoException;
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.util.List;
4 |
5 | import fr.mael.jiwigo.om.Image;
6 | import fr.mael.jiwigo.om.Tag;
7 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
8 |
9 | public interface TagService {
10 |
11 | /**
12 | * Lists all tags
13 | * @return le list of tags
14 | * @throws JiwigoException
15 | */
16 | public List list() throws JiwigoException;
17 |
18 | /**
19 | * Creates a tag
20 | * @param nom name of the tag
21 | * @return true if the tag is created
22 | * @throws JiwigoException
23 | */
24 | public boolean create(String nom) throws JiwigoException;
25 |
26 | /**
27 | * Returns all the tag for an image
28 | * @param image the image to check
29 | * @return the list of tags
30 | * @throws JiwigoException
31 | */
32 | public List tagsForImage(Image image) throws JiwigoException;
33 | }
34 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/CommentServiceImpl.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service.impl;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 |
9 | import fr.mael.jiwigo.dao.CommentDao;
10 | import fr.mael.jiwigo.om.Comment;
11 | import fr.mael.jiwigo.service.CommentService;
12 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
13 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
14 |
15 | /*
16 | * jiwigo-ws-api Piwigo webservice access Api
17 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
18 | * All Rights Reserved
19 | *
20 | * This library is free software. It comes without any warranty, to
21 | * the extent permitted by applicable law. You can redistribute it
22 | * and/or modify it under the terms of the Do What The Fuck You Want
23 | * To Public License, Version 2, as published by Sam Hocevar. See
24 | * http://sam.zoy.org/wtfpl/COPYING for more details.
25 | */
26 | /**
27 |
28 | * @author mael
29 | *
30 | */
31 | public class CommentServiceImpl implements CommentService {
32 | /**
33 | * Logger
34 | */
35 | private final Logger LOG = LoggerFactory.getLogger(CommentServiceImpl.class);
36 |
37 | private CommentDao dao;
38 |
39 | /**
40 | * Lists all comments for an image
41 | * @param imageId the id of the image
42 | * @return the list of comments
43 | * @throws IOException
44 | * @throws ProxyAuthenticationException
45 | */
46 | public List list(Integer imageId) throws JiwigoException {
47 | return dao.list(imageId);
48 | }
49 |
50 | /**
51 | * Creates a comment for an image
52 | * @param content the comment
53 | * @param imageId the id of the image
54 | * @param auteur the author of the comment
55 | * @return true if successful
56 | * @throws IOException
57 | * @throws ProxyAuthenticationException
58 | */
59 | public boolean create(String content, Integer imageId, String auteur) throws JiwigoException {
60 | Comment comment = new Comment();
61 | comment.setContent(content);
62 | comment.setImageId(imageId);
63 | comment.setAuthor(auteur);
64 | return dao.create(comment);
65 | }
66 |
67 | public CommentDao getDao() {
68 | return dao;
69 | }
70 |
71 | public void setDao(CommentDao dao) {
72 | this.dao = dao;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/TagServiceImpl.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service.impl;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 |
9 | import fr.mael.jiwigo.dao.TagDao;
10 | import fr.mael.jiwigo.om.Image;
11 | import fr.mael.jiwigo.om.Tag;
12 | import fr.mael.jiwigo.service.TagService;
13 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
14 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
15 |
16 | /*
17 | * jiwigo-ws-api Piwigo webservice access Api
18 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
19 | * All Rights Reserved
20 | *
21 | * This library is free software. It comes without any warranty, to
22 | * the extent permitted by applicable law. You can redistribute it
23 | * and/or modify it under the terms of the Do What The Fuck You Want
24 | * To Public License, Version 2, as published by Sam Hocevar. See
25 | * http://sam.zoy.org/wtfpl/COPYING for more details.
26 | */
27 | /**
28 | *
29 |
30 | * @author mael
31 | *
32 | */
33 | public class TagServiceImpl implements TagService {
34 | /**
35 | * Logger
36 | */
37 | private final Logger LOG = LoggerFactory.getLogger(TagServiceImpl.class);
38 |
39 | private TagDao dao;
40 |
41 | /**
42 | * Lists all tags
43 | * @return le list of tags
44 | * @throws IOException
45 | * @throws ProxyAuthenticationException
46 | * @throws JiwigoException
47 | */
48 | public List list() throws JiwigoException {
49 | return dao.list();
50 | }
51 |
52 | /**
53 | * Creates a tag
54 | * @param nom name of the tag
55 | * @return true if the tag is created
56 | * @throws IOException
57 | * @throws ProxyAuthenticationException
58 | * @throws JiwigoException
59 | */
60 | public boolean create(String nom) throws JiwigoException {
61 | Tag tag = new Tag();
62 | tag.setName(nom);
63 | return dao.create(tag);
64 | }
65 |
66 | /**
67 | * Returns all the tag for an image
68 | * @param image the image to check
69 | * @return the list of tags
70 | * @throws IOException
71 | * @throws ProxyAuthenticationException
72 | * @throws JiwigoException
73 | */
74 | public List tagsForImage(Image image) throws JiwigoException {
75 | return dao.tagsForImage(image);
76 | }
77 |
78 | public TagDao getDao() {
79 | return dao;
80 | }
81 |
82 | public void setDao(TagDao dao) {
83 | this.dao = dao;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/enumeration/CacheEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package fr.mael.jiwigo.transverse.enumeration;
5 |
6 | /*
7 | * jiwigo-ws-api Piwigo webservice access Api
8 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
9 | * All Rights Reserved
10 | *
11 | * This library is free software. It comes without any warranty, to
12 | * the extent permitted by applicable law. You can redistribute it
13 | * and/or modify it under the terms of the Do What The Fuck You Want
14 | * To Public License, Version 2, as published by Sam Hocevar. See
15 | * http://sam.zoy.org/wtfpl/COPYING for more details.
16 | */
17 | /**
18 |
19 | * @author mael
20 | *
21 | */
22 | public enum CacheEnum {
23 |
24 | MAX_IMAGES_IN_IMAGE_DAO(10);
25 |
26 | protected Integer nb;
27 |
28 | /** Constructeur */
29 | CacheEnum(Integer pNb) {
30 | this.nb = pNb;
31 | }
32 |
33 | public Integer getNb() {
34 | return this.nb;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/enumeration/CategoryEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package fr.mael.jiwigo.transverse.enumeration;
5 |
6 | /*
7 | * jiwigo-ws-api Piwigo webservice access Api
8 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
9 | * All Rights Reserved
10 | *
11 | * This library is free software. It comes without any warranty, to
12 | * the extent permitted by applicable law. You can redistribute it
13 | * and/or modify it under the terms of the Do What The Fuck You Want
14 | * To Public License, Version 2, as published by Sam Hocevar. See
15 | * http://sam.zoy.org/wtfpl/COPYING for more details.
16 | */
17 | /**
18 |
19 | * @author mael
20 | *
21 | */
22 | public enum CategoryEnum {
23 |
24 | ID("id"), NB_IMAGES("nb_images"), NB_TOTAL_IMAGES("total_nb_images"), URL("url"), NAME("name"), CAT_MERES(
25 | "uppercats");
26 |
27 | protected String label;
28 |
29 | /** Constructeur */
30 | CategoryEnum(String pLabel) {
31 | this.label = pLabel;
32 | }
33 |
34 | public String getLabel() {
35 | return this.label;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/enumeration/MethodsEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package fr.mael.jiwigo.transverse.enumeration;
5 |
6 | /*
7 | * jiwigo-ws-api Piwigo webservice access Api
8 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
9 | * All Rights Reserved
10 | *
11 | * This library is free software. It comes without any warranty, to
12 | * the extent permitted by applicable law. You can redistribute it
13 | * and/or modify it under the terms of the Do What The Fuck You Want
14 | * To Public License, Version 2, as published by Sam Hocevar. See
15 | * http://sam.zoy.org/wtfpl/COPYING for more details.
16 | */
17 | /**
18 |
19 | * Lists the methods of the webservice
20 | * @author mael
21 | *
22 | */
23 | public enum MethodsEnum {
24 |
25 | LOGIN("pwg.session.login"), LISTER_CATEGORIES("pwg.categories.getList"), LISTER_IMAGES("pwg.categories.getImages"), GET_INFO(
26 | "pwg.images.getInfo"), AJOUTER_CATEGORIE("pwg.categories.add"), AJOUTER_COMMENTAIRE("pwg.images.addComment"), LISTER_TAGS(
27 | "pwg.tags.getList"), TAGS_ADMIN_LIST("pwg.tags.getAdminList"), ADD_TAG("pwg.tags.add"), SET_INFO(
28 | "pwg.images.setInfo"), SEARCH("pwg.images.search"), SET_PRIVACY_LEVEL("pwg.images.setPrivacyLevel"), ADD_SIMPLE(
29 | "pwg.images.addSimple"), ADD_IMAGE("pwg.images.add"), ADD_CHUNK("pwg.images.addChunk"), DELETE_CATEGORY(
30 | "pwg.categories.delete"), DELETE_IMAGE("pwg.images.delete"), SESSION_STATUS("pwg.session.getStatus"), IMAGE_EXIST(
31 | "pwg.images.exist");
32 |
33 | protected String label;
34 |
35 | /** Constructeur */
36 | MethodsEnum(String pLabel) {
37 | this.label = pLabel;
38 | }
39 |
40 | public String getLabel() {
41 | return this.label;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/enumeration/TagEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package fr.mael.jiwigo.transverse.enumeration;
5 |
6 | /*
7 | * jiwigo-ws-api Piwigo webservice access Api
8 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
9 | * All Rights Reserved
10 | *
11 | * This library is free software. It comes without any warranty, to
12 | * the extent permitted by applicable law. You can redistribute it
13 | * and/or modify it under the terms of the Do What The Fuck You Want
14 | * To Public License, Version 2, as published by Sam Hocevar. See
15 | * http://sam.zoy.org/wtfpl/COPYING for more details.
16 | */
17 | /**
18 |
19 | * @author mael
20 | *
21 | */
22 | public enum TagEnum {
23 |
24 | ID("id"), NAME("name");
25 |
26 | protected String label;
27 |
28 | /** Constructeur */
29 | TagEnum(String pLabel) {
30 | this.label = pLabel;
31 | }
32 |
33 | public String getLabel() {
34 | return this.label;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/FileAlreadyExistsException.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.transverse.exception;
2 |
3 | /*
4 | * jiwigo-ws-api Piwigo webservice access Api
5 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
6 | * All Rights Reserved
7 | *
8 | * This library is free software. It comes without any warranty, to
9 | * the extent permitted by applicable law. You can redistribute it
10 | * and/or modify it under the terms of the Do What The Fuck You Want
11 | * To Public License, Version 2, as published by Sam Hocevar. See
12 | * http://sam.zoy.org/wtfpl/COPYING for more details.
13 | */
14 | public class FileAlreadyExistsException extends Exception {
15 | public FileAlreadyExistsException(String msg) {
16 | super(msg);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/JiwigoException.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.transverse.exception;
2 |
3 | public class JiwigoException extends Exception {
4 |
5 | private static final long serialVersionUID = -6224666480360206953L;
6 |
7 | public JiwigoException(String msg) {
8 | super(msg);
9 | }
10 |
11 | public JiwigoException(Throwable t) {
12 | super(t);
13 | }
14 |
15 | public JiwigoException(String msg, Throwable t) {
16 | super(msg, t);
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/ProxyAuthenticationException.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.transverse.exception;
2 |
3 | /*
4 | * jiwigo-ws-api Piwigo webservice access Api
5 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
6 | * All Rights Reserved
7 | *
8 | * This library is free software. It comes without any warranty, to
9 | * the extent permitted by applicable law. You can redistribute it
10 | * and/or modify it under the terms of the Do What The Fuck You Want
11 | * To Public License, Version 2, as published by Sam Hocevar. See
12 | * http://sam.zoy.org/wtfpl/COPYING for more details.
13 | */
14 | public class ProxyAuthenticationException extends Exception {
15 | public ProxyAuthenticationException(String msg) {
16 | super(msg);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/exception/WrongChunkSizeException.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.transverse.exception;
2 |
3 | /*
4 | * jiwigo-ws-api Piwigo webservice access Api
5 | * Copyright (c) 2010-2011 Mael mael@le-guevel.com
6 | * All Rights Reserved
7 | *
8 | * This library is free software. It comes without any warranty, to
9 | * the extent permitted by applicable law. You can redistribute it
10 | * and/or modify it under the terms of the Do What The Fuck You Want
11 | * To Public License, Version 2, as published by Sam Hocevar. See
12 | * http://sam.zoy.org/wtfpl/COPYING for more details.
13 | */
14 | public class WrongChunkSizeException extends Exception {
15 | public WrongChunkSizeException(String msg) {
16 | super(msg);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/main/resources/temp.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 | 10
9 |
10 |
11 |
14 | test de test do not delete
15 | 1,3
16 | 1.1
17 |
18 |
19 |
20 |
22 |
23 |
25 |
26 |
27 | mael
28 | comment test
29 |
30 |
31 | mael
32 | comment test
33 |
34 |
35 | mael
36 | comment test
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/CategoryServiceTest.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.util.Date;
4 |
5 | import junit.framework.Assert;
6 |
7 | import org.junit.Before;
8 | import org.junit.Test;
9 | import org.junit.Ignore;
10 |
11 | import fr.mael.jiwigo.dao.impl.CategoryDaoImpl;
12 | import fr.mael.jiwigo.service.impl.CategoryServiceImpl;
13 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
14 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
15 | import fr.mael.jiwigo.transverse.session.SessionManager;
16 | import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl;
17 |
18 | @Ignore
19 | public class CategoryServiceTest {
20 | private SessionManager sessionManager;
21 |
22 | @Before
23 | public void setUp() throws JiwigoException {
24 | sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
25 | sessionManager.processLogin();
26 | }
27 |
28 | /**
29 | * Test of the list method
30 | *
31 | * @throws ProxyAuthenticationException
32 | */
33 | @Test
34 | public void ListerTest() throws JiwigoException {
35 | CategoryDaoImpl categaryDao = new CategoryDaoImpl();
36 | categaryDao.setSessionManager(sessionManager);
37 | categaryDao.list(true);
38 | categaryDao.list(false);
39 | }
40 |
41 | /**
42 | * Test of the creation method
43 | *
44 | * @throws ProxyAuthenticationException
45 | */
46 | @Test
47 | public void creerTest() throws JiwigoException {
48 | Date date = new Date();
49 | CategoryServiceImpl categoryService = new CategoryServiceImpl();
50 | CategoryDaoImpl dao = new CategoryDaoImpl();
51 | dao.setSessionManager(sessionManager);
52 | categoryService.setDao(dao);
53 | Assert.assertSame(true, categoryService.create("Category" + date.getTime()));
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/ServicesTest.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.io.File;
4 | import java.util.List;
5 |
6 | import junit.framework.Assert;
7 |
8 | import org.junit.Before;
9 | import org.junit.Ignore;
10 | import org.junit.Test;
11 |
12 | import fr.mael.jiwigo.dao.impl.CategoryDaoImpl;
13 | import fr.mael.jiwigo.dao.impl.ImageDaoImpl;
14 | import fr.mael.jiwigo.om.Category;
15 | import fr.mael.jiwigo.om.Image;
16 | import fr.mael.jiwigo.service.impl.CategoryServiceImpl;
17 | import fr.mael.jiwigo.service.impl.ImageServiceImpl;
18 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
19 | import fr.mael.jiwigo.transverse.session.SessionManager;
20 | import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl;
21 |
22 | @Ignore
23 | public class ServicesTest {
24 |
25 | private SessionManager sessionManager;
26 |
27 | @Before
28 | public void setUp() throws JiwigoException {
29 | sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
30 | sessionManager.processLogin();
31 | }
32 |
33 | @Test
34 | public void testCreer() throws Exception {
35 | Category cat = null;
36 | CategoryServiceImpl categoryService = new CategoryServiceImpl();
37 | CategoryDaoImpl categoryDao = new CategoryDaoImpl();
38 | categoryDao.setSessionManager(sessionManager);
39 | categoryService.setDao(categoryDao);
40 |
41 | ImageServiceImpl imageService = new ImageServiceImpl();
42 | ImageDaoImpl imageDao = new ImageDaoImpl();
43 | imageDao.setSessionManager(sessionManager);
44 | imageService.setDao(imageDao);
45 | //we choose category number 3
46 | for (Category category : categoryService.list(true)) {
47 | if (category.getIdentifier().equals(3)) {
48 | cat = category;
49 | break;
50 | }
51 | }
52 | //we look for the first picture of category 3
53 | Image image = imageService.listByCategory(cat.getIdentifier(), true).get(0);
54 | Assert.assertEquals("test de test do not delete", cat.getName());
55 | Assert.assertEquals("20110329194915-0c0b3f36.jpg", image.getFile());
56 |
57 | }
58 |
59 | @Test
60 | public void addSimpleTest() {
61 |
62 | // we prepare the service implementing add-simple
63 | ImageServiceImpl imageService = new ImageServiceImpl();
64 | ImageDaoImpl dao = new ImageDaoImpl();
65 | dao.setSessionManager(sessionManager);
66 | imageService.setDao(dao);
67 |
68 | //we prepare the resource to send
69 | File imageFile = new File(this.getClass().getClassLoader().getResource("piwigo_org.png").getPath());
70 | // File imageFile = new File("piwigo_org.png");
71 | Integer categoryTest = 98;
72 | String title = "title" + System.currentTimeMillis();
73 | try {
74 | imageService.addSimple(imageFile, categoryTest, title);
75 | } catch (JiwigoException e) {
76 | Assert.fail("An exception was thrown while trying to send the pictures" + e.getMessage());
77 | }
78 |
79 | //the image should be sent, let's check if piwigo added it to the category.
80 | boolean found = false;
81 | List listByCategory;
82 | try {
83 | listByCategory = imageService.listByCategory(categoryTest, true);
84 | for (Image image : listByCategory) {
85 | if (image.getName().equals(title)) {
86 | found = true;
87 | break;
88 | }
89 | }
90 | } catch (Exception e) {
91 | Assert.fail("An exception was thrown while trying to fetch the pictures from category " + categoryTest
92 | + "exception was : " + e.getMessage());
93 | }
94 | Assert.assertTrue("The picture just sent could not be found", found);
95 |
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/test/java/fr/mael/jiwigo/service/TagServiceTest.java:
--------------------------------------------------------------------------------
1 | package fr.mael.jiwigo.service;
2 |
3 | import java.io.IOException;
4 | import java.util.Date;
5 |
6 | import junit.framework.Assert;
7 |
8 | import org.junit.Before;
9 | import org.junit.Ignore;
10 | import org.junit.Test;
11 |
12 | import fr.mael.jiwigo.dao.impl.TagDaoImpl;
13 | import fr.mael.jiwigo.service.impl.TagServiceImpl;
14 | import fr.mael.jiwigo.transverse.exception.JiwigoException;
15 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
16 | import fr.mael.jiwigo.transverse.session.SessionManager;
17 | import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl;
18 |
19 | @Ignore
20 | public class TagServiceTest {
21 |
22 | private SessionManager sessionManager;
23 |
24 | @Before
25 | public void setUp() throws JiwigoException {
26 | sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test");
27 | sessionManager.processLogin();
28 | }
29 |
30 | /**
31 | * Test of the listing method
32 | * @throws JiwigoException
33 | *
34 | * @throws ProxyAuthenticationException
35 | */
36 | @Test
37 | @Ignore
38 | public void listTest() throws JiwigoException {
39 | TagDaoImpl tagDao = new TagDaoImpl();
40 | tagDao.setSessionManager(sessionManager);
41 | // TODO something weird happens here,
42 | // java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl cannot be cast to
43 | // org.w3c.dom.Element
44 | // at fr.mael.jiwigo.dao.impl.TagDaoImpl.list(TagDaoImpl.java:58)
45 | tagDao.list();
46 | }
47 |
48 | /**
49 | * Test of the creation method
50 | * @throws JiwigoException
51 | *
52 | * @throws ProxyAuthenticationException
53 | * @throws IOException
54 | */
55 | @Test
56 | public void createTest() throws JiwigoException {
57 | Date date = new Date();
58 | TagServiceImpl tagService = new TagServiceImpl();
59 | TagDaoImpl tagDao = new TagDaoImpl();
60 | tagDao.setSessionManager(sessionManager);
61 | tagService.setDao(tagDao);
62 | Assert.assertSame(true, tagService.create("Tag" + date.getTime()));
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/jiwigo-ws-api/src/test/resources/piwigo_org.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/jiwigo-ws-api/src/test/resources/piwigo_org.png
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | regalandroid-aggregator
5 | pom
6 | This pom can be used to build all the submodules at once
7 | ReGalAndroid Build aggregator
8 |
9 | regalandroid-parent
10 | net.dahanne.android
11 | 1.2.1-SNAPSHOT
12 | regalandroid-parent
13 |
14 |
15 | regalandroid-parent
16 |
17 |
18 | regalandroid
19 | commons-gallery
20 | g2-java-client
21 | g3-java-client
22 | jiwigo-ws-api-converter
23 | jiwigo-ws-api
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/regalandroid-parent/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | net.dahanne.android
5 | regalandroid-parent
6 | 1.2.1-SNAPSHOT
7 | pom
8 | ReGalAndroid parent module
9 |
10 |
11 |
12 | org.slf4j
13 | slf4j-api
14 | 1.6.2
15 |
16 |
17 | junit
18 | junit
19 | 4.10
20 |
21 |
22 | com.google.android
23 | android
24 | 2.3.3
25 |
26 |
27 | com.google.android
28 | android-test
29 | 2.3.3
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.apache.maven.plugins
38 | maven-source-plugin
39 | 2.1.2
40 |
41 |
42 | org.apache.maven.plugins
43 | maven-compiler-plugin
44 | 2.3.2
45 |
46 |
47 | com.mycila
48 | maven-license-plugin
49 | 2.6.0
50 |
51 |
52 | com.jayway.maven.plugins.android.generation2
53 | android-maven-plugin
54 | 3.9.0-rc.1
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/regalandroid-test/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/regalandroid-test/build.properties:
--------------------------------------------------------------------------------
1 | tested.project.dir=..
--------------------------------------------------------------------------------
/regalandroid-test/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-10
12 | tested.project.dir=regalandroid
13 |
--------------------------------------------------------------------------------
/regalandroid-test/src/net/dahanne/android/regalandroid/its/AllTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.dahanne.android.regalandroid.its;
18 |
19 | import junit.framework.Test;
20 | import junit.framework.TestSuite;
21 |
22 | import android.test.suitebuilder.TestSuiteBuilder;
23 |
24 | /**
25 | * A test suite containing all tests for ApiDemos.
26 | *
27 | * To run all suites found in this apk:
28 | * $ adb shell am instrument -w \
29 | * com.example.android.apis.tests/android.test.InstrumentationTestRunner
30 | *
31 | * To run just this suite from the command line:
32 | * $ adb shell am instrument -w \
33 | * -e class com.example.android.apis.AllTests \
34 | * com.example.android.apis.tests/android.test.InstrumentationTestRunner
35 | *
36 | * To run an individual test case, e.g. {@link com.example.android.apis.os.MorseCodeConverterTest}:
37 | * $ adb shell am instrument -w \
38 | * -e class com.example.android.apis.os.MorseCodeConverterTest \
39 | * com.example.android.apis.tests/android.test.InstrumentationTestRunner
40 | *
41 | * To run an individual test, e.g. {@link com.example.android.apis.os.MorseCodeConverterTest#testCharacterS()}:
42 | * $ adb shell am instrument -w \
43 | * -e class com.example.android.apis.os.MorseCodeConverterTest#testCharacterS \
44 | * com.example.android.apis.tests/android.test.InstrumentationTestRunner
45 | */
46 | public class AllTests extends TestSuite {
47 |
48 | public static Test suite() {
49 | return new TestSuiteBuilder(AllTests.class)
50 | .includeAllPackagesUnderHere()
51 | .build();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/regalandroid-test/src/net/dahanne/android/regalandroid/its/ReGalAndroidTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an example test project created in Eclipse to test NotePad which is a sample
3 | * project located in AndroidSDK/samples/android-11/NotePad
4 | * Just click on File --> New --> Project --> Android Project --> Create Project from existing source and
5 | * select NotePad.
6 | *
7 | * Then you can run these test cases either on the emulator or on device. You right click
8 | * the test project and select Run As --> Run As Android JUnit Test
9 | *
10 | * @author Renas Reda, renas.reda@jayway.com
11 | *
12 | */
13 |
14 | package net.dahanne.android.regalandroid.its;
15 |
16 | import junit.framework.AssertionFailedError;
17 | import net.dahanne.android.regalandroid.R;
18 | import net.dahanne.android.regalandroid.activity.Start;
19 |
20 | import com.jayway.android.robotium.solo.Solo;
21 | import android.test.ActivityInstrumentationTestCase2;
22 | import android.test.suitebuilder.annotation.Smoke;
23 | import android.util.Log;
24 |
25 |
26 | public class ReGalAndroidTest extends ActivityInstrumentationTestCase2{
27 |
28 | private static final String REGALANDROIDTEST = "RegalAndroidTest";
29 | private Solo solo;
30 |
31 | public ReGalAndroidTest() {
32 | super("net.dahanne.android.regalandroid", Start.class);
33 |
34 | }
35 | @Override
36 | public void setUp() throws Exception {
37 | solo = new Solo(getInstrumentation(), getActivity());
38 | }
39 |
40 |
41 | @Smoke
42 | public void testEnterSettingsAndConfigurePiwigoGallery() throws Exception {
43 | try{
44 | solo.clickOnButton(this.getActivity().getString(R.string.accept));
45 | Log.d(REGALANDROIDTEST, "accepted the eula");
46 | }catch (AssertionFailedError e){
47 | //OK, this is not the first time this activity is run
48 | }
49 |
50 | solo.clickOnMenuItem(this.getActivity().getString(R.string.clear_cache_title));
51 | Log.d(REGALANDROIDTEST, "clicked on the clear cache menu entry");
52 |
53 |
54 | solo.clickOnMenuItem(this.getActivity().getString(R.string.settings_label));
55 | Log.d(REGALANDROIDTEST, "clicked on the settings menu entry");
56 |
57 | //Assert that Settings activity is opened
58 | solo.assertCurrentActivity("Expected ReGalAndroid activity", "Settings");
59 | Log.d(REGALANDROIDTEST, "entering the settings activity");
60 |
61 | //Choose Piwigo Gallery as gallerytype
62 | solo.clickOnText(this.getActivity().getString(R.string.gallery_connection_type_title));
63 | solo.clickOnText(this.getActivity().getString(R.string.gallery_connection_type_piwigo));
64 | Log.d(REGALANDROIDTEST, "chose Piwigo as gallery type");
65 |
66 | //set user as username
67 | solo.clickOnText(this.getActivity().getString(R.string.username_title));
68 | solo.clearEditText(0);
69 | solo.enterText(0,"user");
70 | solo.clickOnButton(this.getActivity().getString(R.string.ok));
71 | Log.d(REGALANDROIDTEST, "set username as user");
72 |
73 | // solo.wait(3000);
74 |
75 | //set password as password
76 | solo.clickOnText(this.getActivity().getString(R.string.password_title));
77 | solo.clearEditText(0);
78 | solo.enterText(0,"password");
79 | solo.clickOnButton(this.getActivity().getString(R.string.ok));
80 | Log.d(REGALANDROIDTEST, "set password as password");
81 |
82 |
83 | }
84 |
85 | @Override
86 | public void tearDown() throws Exception {
87 | //Robotium will finish all the activities that have been opened
88 | solo.finishOpenedActivities();
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/regalandroid/build.gradle:
--------------------------------------------------------------------------------
1 | description = 'ReGalAndroid'
2 | apply plugin: 'com.android.application'
3 |
4 | android {
5 | compileSdkVersion 24
6 | buildToolsVersion '23.0.3'
7 | useLibrary 'org.apache.http.legacy'
8 |
9 | defaultConfig {
10 | minSdkVersion 11
11 | targetSdkVersion 16
12 | }
13 | lintOptions {
14 | checkReleaseBuilds false
15 | abortOnError false
16 | }
17 | sourceSets {
18 | main {
19 | manifest.srcFile 'AndroidManifest.xml'
20 | res.srcDirs = ['res']
21 | }
22 | }
23 | packagingOptions {
24 | exclude 'META-INF/LICENSE.txt'
25 | exclude 'META-INF/NOTICE.txt'
26 | }
27 | productFlavors {
28 | }
29 | }
30 |
31 | dependencies {
32 | compile(project(':g2-java-client')) {
33 | exclude module: 'slf4j-api'
34 | }
35 | compile(project(':g3-java-client')) {
36 | exclude module: 'slf4j-api'
37 | }
38 | compile 'commons-io:commons-io:20030203.000550'
39 | compile(project(':jiwigo-ws-api-converter')) {
40 | exclude module: 'slf4j-api'
41 | }
42 | compile 'org.slf4j:slf4j-android:1.6.1-RC1'
43 | compile 'com.android.support:appcompat-v7:24.2.1'
44 | }
45 |
--------------------------------------------------------------------------------
/regalandroid/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/image.png
--------------------------------------------------------------------------------
/regalandroid/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-10
15 |
--------------------------------------------------------------------------------
/regalandroid/res/anim/slide_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/regalandroid/res/anim/slide_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/regalandroid/res/drawable/folder_images_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/folder_images_icon.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/ic_launcher_gallery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/ic_launcher_gallery.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/icon.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/loading.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/regalandroid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/regalandroid.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/timepicker_down_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/timepicker_down_normal.png
--------------------------------------------------------------------------------
/regalandroid/res/drawable/timepicker_up_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/res/drawable/timepicker_up_normal.png
--------------------------------------------------------------------------------
/regalandroid/res/layout/album_is_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
29 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/choose_photo_number.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
26 |
27 |
28 |
30 |
31 |
32 |
38 |
39 |
40 |
44 |
45 |
46 |
53 |
54 |
55 |
57 |
61 |
65 |
66 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/create_subalbum.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/firsttime.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
28 |
30 |
35 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/fullimage.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
30 |
34 |
35 |
38 |
39 |
40 |
44 |
45 |
49 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/number_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
37 |
38 |
43 |
44 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/show_albums.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
33 |
38 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/show_albums_for_upload_row.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
29 |
30 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/show_albums_row.xml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
27 |
31 |
42 |
43 |
54 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/show_gallery.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
26 |
33 |
34 |
43 |
44 |
--------------------------------------------------------------------------------
/regalandroid/res/layout/upload_photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
29 |
32 |
35 |
37 |
42 |
43 |
46 |
47 |
50 |
52 |
56 |
57 |
59 |
61 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/regalandroid/res/menu/menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
33 |
--------------------------------------------------------------------------------
/regalandroid/res/menu/menu_full_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
46 |
--------------------------------------------------------------------------------
/regalandroid/res/menu/menu_show_albums.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
31 |
--------------------------------------------------------------------------------
/regalandroid/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 | #3500ffff
24 | #ffffffff
25 | #ffffffff
26 | #FF0000
27 |
--------------------------------------------------------------------------------
/regalandroid/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
--------------------------------------------------------------------------------
/regalandroid/res/values/gallery_types.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
24 |
25 |
26 |
27 |
- @string/gallery_connection_type_gallery2
28 | - @string/gallery_connection_type_gallery3
29 | - @string/gallery_connection_type_piwigo
30 |
31 |
32 |
34 |
35 | - 0
36 | - 1
37 | - 2
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/regalandroid/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
23 |
32 |
33 |
--------------------------------------------------------------------------------
/regalandroid/resources/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anthonydahanne/ReGalAndroid/57bf3fee31a1b715ef0cca8ac2b9f909138f9f1b/regalandroid/resources/.gitignore
--------------------------------------------------------------------------------
/regalandroid/resources/license-header.txt:
--------------------------------------------------------------------------------
1 | ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
2 | URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
3 | Copyright (c) 2010-2014 Anthony Dahanne
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/RegalAndroidApplication.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | import net.dahanne.android.regalandroid.remote.RemoteGalleryConnectionFactory;
25 | import net.dahanne.gallery.commons.model.Album;
26 | import net.dahanne.gallery.commons.model.Picture;
27 | import android.app.Application;
28 |
29 | public class RegalAndroidApplication extends Application {
30 | private final List pictures = new ArrayList();
31 | private Album currentAlbum;
32 | private int currentPosition;
33 |
34 |
35 |
36 |
37 | public RegalAndroidApplication() {
38 | super();
39 | RemoteGalleryConnectionFactory.setContext(this);
40 |
41 | }
42 |
43 | public void setCurrentAlbum(Album currentAlbum) {
44 | this.currentAlbum = currentAlbum;
45 | }
46 |
47 | public Album getCurrentAlbum() {
48 | return currentAlbum;
49 | }
50 |
51 | public List getPictures() {
52 | return pictures;
53 | }
54 |
55 | public void setCurrentPosition(int currentPosition) {
56 | this.currentPosition = currentPosition;
57 | }
58 |
59 | public int getCurrentPosition() {
60 | return currentPosition;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/activity/About.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.activity;
20 |
21 | import net.dahanne.android.regalandroid.R;
22 | import android.app.Activity;
23 | import android.os.Bundle;
24 |
25 | public class About extends Activity {
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.about);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/activity/ChoosePhotoNumber.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.activity;
20 |
21 | import net.dahanne.android.regalandroid.RegalAndroidApplication;
22 | import net.dahanne.android.regalandroid.R;
23 | import net.dahanne.android.regalandroid.utils.modified_android_source.NumberPicker;
24 | import android.app.Activity;
25 | import android.os.Bundle;
26 | import android.view.View;
27 | import android.view.View.OnClickListener;
28 | import android.widget.Button;
29 |
30 | public class ChoosePhotoNumber extends Activity implements OnClickListener {
31 |
32 | private NumberPicker np;
33 | private Button okButton;
34 | private Button cancelButton;
35 | private Button firstPhotoButton;
36 | private Button lastPhotoButton;
37 | private int numberOfPictures;
38 |
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 |
43 | // view creation and context loading
44 | setContentView(R.layout.choose_photo_number);
45 | numberOfPictures = ((RegalAndroidApplication) getApplication())
46 | .getPictures().size();
47 | int currentPhoto = getIntent().getIntExtra(FullImage.CURRENT_POSITION,
48 | 0);
49 | setTitle(R.string.choose_photo_number_title);
50 |
51 | // number picker initialization
52 | np = (NumberPicker) findViewById(R.id.photo_number);
53 | np.setRange(1, numberOfPictures, null);
54 | np.setCurrent(currentPhoto + 1);
55 |
56 | // buttons and listeners attached
57 | okButton = (Button) findViewById(R.id.ok);
58 | cancelButton = (Button) findViewById(R.id.cancel);
59 | firstPhotoButton = (Button) findViewById(R.id.first_photo);
60 | lastPhotoButton = (Button) findViewById(R.id.last_photo);
61 | okButton.setOnClickListener(this);
62 | cancelButton.setOnClickListener(this);
63 | firstPhotoButton.setOnClickListener(this);
64 | lastPhotoButton.setOnClickListener(this);
65 |
66 | }
67 |
68 | public void onClick(View v) {
69 | int chosenPhoto = 0;
70 | switch (v.getId()) {
71 | case R.id.ok:
72 | chosenPhoto = np.getCurrent() - 1;
73 | break;
74 | case R.id.first_photo:
75 | // already 0 so nothing to do here
76 | break;
77 | case R.id.last_photo:
78 | chosenPhoto = numberOfPictures - 1;
79 | break;
80 | case R.id.cancel:
81 | setResult(RESULT_CANCELED);
82 | finish();
83 | break;
84 | default:
85 | break;
86 | }
87 | ((RegalAndroidApplication) getApplication())
88 | .setCurrentPosition(chosenPhoto);
89 | finish();
90 |
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/activity/ChooseSubAlbumName.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.activity;
20 |
21 | import net.dahanne.android.regalandroid.R;
22 | import android.app.Activity;
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.view.View.OnClickListener;
27 | import android.widget.Button;
28 | import android.widget.EditText;
29 |
30 | public class ChooseSubAlbumName extends Activity implements OnClickListener {
31 | static final String SUBALBUM_NAME = "subalbumName";
32 | private EditText subalbumEditText;
33 | private Button okButton;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 |
39 | setContentView(R.layout.create_subalbum);
40 | setTitle(R.string.create_album_label);
41 | subalbumEditText = (EditText) findViewById(R.id.subalbum_id);
42 | okButton = (Button) findViewById(R.id.ok_id);
43 | okButton.setOnClickListener(this);
44 |
45 | }
46 |
47 | public void onClick(View v) {
48 | Intent data = new Intent();
49 | data.putExtra(SUBALBUM_NAME, subalbumEditText.getText().toString());
50 | setResult(RESULT_OK, data);
51 | finish();
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/adapters/AlbumAdapterForUpload.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.adapters;
20 |
21 | import java.util.List;
22 |
23 | import net.dahanne.android.regalandroid.R;
24 | import net.dahanne.gallery.commons.model.Album;
25 | import android.content.Context;
26 | import android.view.LayoutInflater;
27 | import android.view.View;
28 | import android.view.ViewGroup;
29 | import android.widget.ArrayAdapter;
30 | import android.widget.TextView;
31 |
32 | public class AlbumAdapterForUpload extends ArrayAdapter {
33 |
34 | private final List items;
35 | private final Context context;
36 |
37 | public AlbumAdapterForUpload(Context context, int textViewResourceId,
38 | List items) {
39 | super(context, textViewResourceId, items);
40 | this.items = items;
41 | this.context = context;
42 |
43 | }
44 |
45 | @Override
46 | public View getView(int position, View convertView, ViewGroup parent) {
47 | View v = convertView;
48 | if (v == null) {
49 | LayoutInflater vi = (LayoutInflater) context
50 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
51 | v = vi.inflate(R.layout.show_albums_for_upload_row, null);
52 | }
53 | Album album = items.get(position);
54 | if (album != null) {
55 | TextView tt = (TextView) v.findViewById(R.id.first_line);
56 | if (tt != null) {
57 | tt.setText(album.getTitle());
58 | }
59 | }
60 | return v;
61 | }
62 |
63 | @Override
64 | public View getDropDownView(int position, View convertView, ViewGroup parent) {
65 | return getView(position, convertView, parent);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/api/EditUrlPreference.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.api;
20 |
21 | import net.dahanne.android.regalandroid.R;
22 | import net.dahanne.gallery.commons.utils.UriUtils;
23 | import android.app.AlertDialog;
24 | import android.content.Context;
25 | import android.content.DialogInterface;
26 | import android.preference.EditTextPreference;
27 | import android.util.AttributeSet;
28 |
29 | public class EditUrlPreference extends EditTextPreference {
30 |
31 | private Context givenContext;
32 |
33 | public EditUrlPreference(Context context) {
34 | super(context);
35 | givenContext=context;
36 | }
37 |
38 |
39 |
40 | public EditUrlPreference(Context context, AttributeSet attrs, int defStyle) {
41 | super(context, attrs, defStyle);
42 | givenContext=context;
43 | }
44 |
45 |
46 |
47 | public EditUrlPreference(Context context, AttributeSet attrs) {
48 | super(context, attrs);
49 | givenContext = context;
50 | }
51 |
52 |
53 |
54 | @Override
55 | public void setText(String text) {
56 | super.setText(text);
57 | try{
58 | UriUtils.checkUrlIsValid(text);
59 | }catch (IllegalArgumentException e){
60 | alertValidationProblem();
61 | }
62 | }
63 |
64 | @Override
65 | public void onClick(DialogInterface dialog, int which) {
66 | super.onClick(dialog, which);
67 |
68 | }
69 |
70 | public void alertValidationProblem() {
71 | AlertDialog.Builder builder = new AlertDialog.Builder(givenContext);
72 | String message =
73 | givenContext.getString(R.string.url_validation_problem);
74 | builder.setTitle(R.string.problem).setMessage(message)
75 | .setPositiveButton(R.string.ok,
76 | new DialogInterface.OnClickListener() {
77 | public void onClick(DialogInterface dialog, int id) {
78 | dialog.cancel();
79 | }
80 | });
81 | AlertDialog alert = builder.create();
82 | alert.show();
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/regalandroid/src/main/java/net/dahanne/android/regalandroid/tasks/AddPhotoTask.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ReGalAndroid, a gallery client for Android, supporting G2, G3, etc...
3 | * URLs: https://github.com/anthonydahanne/ReGalAndroid , http://blog.dahanne.net
4 | * Copyright (c) 2010 Anthony Dahanne
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package net.dahanne.android.regalandroid.tasks;
20 |
21 | import java.io.File;
22 |
23 | import net.dahanne.android.regalandroid.activity.Settings;
24 | import net.dahanne.android.regalandroid.remote.RemoteGalleryConnectionFactory;
25 | import net.dahanne.android.regalandroid.utils.AndroidUriUtils;
26 | import net.dahanne.android.regalandroid.utils.ShowUtils;
27 | import net.dahanne.gallery.commons.remote.GalleryConnectionException;
28 | import android.app.Activity;
29 | import android.app.ProgressDialog;
30 | import android.net.Uri;
31 | import android.os.AsyncTask;
32 |
33 | public class AddPhotoTask extends AsyncTask