tags) {
57 | this.tags = tags;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volume.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Jeevanandam M. (https://github.com/jeevatkm)
3 | *
4 | * digitalocean-api-client source code and usage is governed by a MIT style license that can be
5 | * found in the LICENSE file
6 | */
7 |
8 | package in.tosc.doandroidlib.objects;
9 |
10 | import com.google.gson.annotations.SerializedName;
11 |
12 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
13 |
14 | import java.util.Date;
15 | import java.util.Set;
16 |
17 | /**
18 | * Represents Block Storage attributes of DigitalOcean.
19 | *
20 | *
21 | * Block Storage volumes provide expanded storage capacity for your Droplets.
22 | *
23 | *
24 | * @author Eugene Strokin (https://github.com/strokine)
25 | *
26 | * @since v2.7
27 | */
28 | public class Volume extends RateLimitBase {
29 |
30 | private static final long serialVersionUID = 3274091633535612517L;
31 |
32 | private String id;
33 |
34 | private Region region;
35 |
36 | @SerializedName("droplet_ids")
37 | private Set dropletIds;
38 |
39 | private String name;
40 |
41 | private String description;
42 |
43 | @SerializedName("size_gigabytes")
44 | private Double size;
45 |
46 | @SerializedName("created_at")
47 | private Date createdDate;
48 |
49 | @Override
50 | public String toString() {
51 | return ReflectionToStringBuilder.toString(this);
52 | }
53 |
54 | /**
55 | * @return the id
56 | */
57 | public String getId() {
58 | return id;
59 | }
60 |
61 | /**
62 | * @param id the id to set
63 | */
64 | public void setId(String id) {
65 | this.id = id;
66 | }
67 |
68 | /**
69 | * @return the region
70 | */
71 | public Region getRegion() {
72 | return region;
73 | }
74 |
75 | /**
76 | * @param region the region to set
77 | */
78 | public void setRegion(Region region) {
79 | this.region = region;
80 | }
81 |
82 | /**
83 | * @return the dropletIds
84 | */
85 | public Set getDropletIds() {
86 | return dropletIds;
87 | }
88 |
89 | /**
90 | * @param dropletIds the dropletIds to set
91 | */
92 | public void setDropletIds(Set dropletIds) {
93 | this.dropletIds = dropletIds;
94 | }
95 |
96 | /**
97 | * @return the name
98 | */
99 | public String getName() {
100 | return name;
101 | }
102 |
103 | /**
104 | * @param name the name to set
105 | */
106 | public void setName(String name) {
107 | this.name = name;
108 | }
109 |
110 | /**
111 | * @return the description
112 | */
113 | public String getDescription() {
114 | return description;
115 | }
116 |
117 | /**
118 | * @param description the description to set
119 | */
120 | public void setDescription(String description) {
121 | this.description = description;
122 | }
123 |
124 | /**
125 | * @return the size in Gigabytes
126 | */
127 | public Double getSize() {
128 | return size;
129 | }
130 |
131 | /**
132 | * @param size the size to set
133 | */
134 | public void setSize(Double size) {
135 | this.size = size;
136 | }
137 |
138 | /**
139 | * @return the createdDate
140 | */
141 | public Date getCreatedDate() {
142 | return createdDate;
143 | }
144 |
145 | /**
146 | * @param createdDate the createdDate to set
147 | */
148 | public void setCreatedDate(Date createdDate) {
149 | this.createdDate = createdDate;
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/objects/Volumes.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Jeevanandam M. (https://github.com/jeevatkm)
3 | *
4 | * digitalocean-api-client source code and usage is governed by a MIT style license that can be
5 | * found in the LICENSE file
6 | */
7 |
8 | package in.tosc.doandroidlib.objects;
9 |
10 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Represents list of volumes.
16 | *
17 | * @author Eugene Strokin (https://github.com/strokine)
18 | *
19 | * @since v2.7
20 | */
21 | public class Volumes extends Base {
22 |
23 | private static final long serialVersionUID = 1739002259344347687L;
24 |
25 | private List volumes;
26 |
27 | @Override
28 | public String toString() {
29 | return ReflectionToStringBuilder.toString(this);
30 | }
31 |
32 | /**
33 | * @return the volumes
34 | */
35 | public List getVolumes() {
36 | return volumes;
37 | }
38 |
39 | /**
40 | * @param volumes the volumes to set
41 | */
42 | public void setVolumes(List volumes) {
43 | this.volumes = volumes;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/serializer/DropletSerializer.java:
--------------------------------------------------------------------------------
1 | package in.tosc.doandroidlib.serializer;
2 |
3 | /**
4 | * Created by championswimmer on 26/11/16.
5 | */
6 | import java.lang.reflect.Type;
7 |
8 | import org.apache.commons.lang3.StringUtils;
9 |
10 | import com.google.gson.JsonArray;
11 | import com.google.gson.JsonElement;
12 | import com.google.gson.JsonObject;
13 | import com.google.gson.JsonSerializationContext;
14 | import com.google.gson.JsonSerializer;
15 | import in.tosc.doandroidlib.objects.Droplet;
16 | import in.tosc.doandroidlib.objects.Key;
17 |
18 | /**
19 | * Serializer for droplet class
20 | *
21 | * @author Jeevanandam M. (jeeva@myjeeva.com)
22 | *
23 | * @since v2.0
24 | */
25 | public class DropletSerializer implements JsonSerializer {
26 |
27 | @Override
28 | public JsonElement serialize(Droplet droplet, Type paramType, JsonSerializationContext context) {
29 | final JsonObject jsonObject = new JsonObject();
30 |
31 | jsonObject.addProperty("name", droplet.getName());
32 |
33 | if (null != droplet.getNames() && droplet.getNames().size() > 0) {
34 | JsonArray names = new JsonArray();
35 | for (String name : droplet.getNames()) {
36 | names.add(context.serialize(name));
37 | }
38 | jsonObject.add("names", names);
39 | }
40 |
41 | jsonObject.addProperty("region", droplet.getRegion().getSlug());
42 | jsonObject.addProperty("size", droplet.getSize());
43 |
44 | if (null == droplet.getImage().getId()) {
45 | jsonObject.addProperty("image", droplet.getImage().getSlug());
46 | } else {
47 | jsonObject.addProperty("image", droplet.getImage().getId());
48 | }
49 |
50 | if (null != droplet.getEnableBackup()) {
51 | jsonObject.addProperty("backups", droplet.getEnableBackup());
52 | }
53 |
54 | if (null != droplet.getEnableIpv6()) {
55 | jsonObject.addProperty("ipv6", droplet.getEnableIpv6());
56 | }
57 |
58 | if (null != droplet.getEnablePrivateNetworking()) {
59 | jsonObject.addProperty("private_networking", droplet.getEnablePrivateNetworking());
60 | }
61 |
62 | if (null != droplet.getKeys() && droplet.getKeys().size() > 0) {
63 | JsonArray sshKeys = new JsonArray();
64 | for (Key k : droplet.getKeys()) {
65 | if (null != k.getId()) {
66 | sshKeys.add(context.serialize(k.getId()));
67 | }
68 | if (!StringUtils.isEmpty(k.getFingerprint())) {
69 | sshKeys.add(context.serialize(k.getFingerprint()));
70 | }
71 | }
72 | jsonObject.add("ssh_keys", sshKeys);
73 | }
74 |
75 | // #19 - https://github.com/jeevatkm/digitalocean-api-java/issues/19
76 | if (null != droplet.getUserData()) {
77 | jsonObject.addProperty("user_data", droplet.getUserData());
78 | }
79 |
80 | return jsonObject;
81 | }
82 |
83 | }
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/serializer/ListDeserializer.java:
--------------------------------------------------------------------------------
1 | package in.tosc.doandroidlib.serializer;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.JsonDeserializationContext;
5 | import com.google.gson.JsonDeserializer;
6 | import com.google.gson.JsonElement;
7 | import com.google.gson.JsonParseException;
8 |
9 | import java.lang.reflect.Type;
10 | import java.util.List;
11 |
12 | /**
13 | * Created by championswimmer on 27/11/16.
14 | */
15 |
16 | public class ListDeserializer implements JsonDeserializer> {
17 |
18 | String key;
19 |
20 | public ListDeserializer(String objKey) {
21 | this.key = objKey;
22 | }
23 |
24 | @Override
25 | public List deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
26 | return new Gson().fromJson(json.getAsJsonObject().getAsJsonArray(key), typeOfT);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/serializer/ObjectDeserializer.java:
--------------------------------------------------------------------------------
1 | package in.tosc.doandroidlib.serializer;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.JsonDeserializationContext;
5 | import com.google.gson.JsonDeserializer;
6 | import com.google.gson.JsonElement;
7 | import com.google.gson.JsonParseException;
8 |
9 | import java.lang.reflect.Type;
10 |
11 | /**
12 | * Created by championswimmer on 26/11/16.
13 | */
14 |
15 | public class ObjectDeserializer implements JsonDeserializer {
16 |
17 | private String key;
18 |
19 | public ObjectDeserializer(String objKey) {
20 | key = objKey;
21 | }
22 |
23 | @Override
24 | public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
25 | return new Gson().fromJson(json.getAsJsonObject().getAsJsonObject(key), typeOfT);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/java/in/tosc/doandroidlib/serializer/VolumeSerializer.java:
--------------------------------------------------------------------------------
1 | package in.tosc.doandroidlib.serializer;
2 |
3 | import java.lang.reflect.Type;
4 |
5 | import org.apache.commons.lang3.StringUtils;
6 |
7 | import com.google.gson.JsonElement;
8 | import com.google.gson.JsonObject;
9 | import com.google.gson.JsonSerializationContext;
10 | import com.google.gson.JsonSerializer;
11 | import in.tosc.doandroidlib.objects.Volume;
12 |
13 | /**
14 | * Serialize the volume info for POST request.
15 | *
16 | * @author Eugene Strokin (https://github.com/strokine)
17 | *
18 | * @since v2.7
19 | */
20 | public class VolumeSerializer implements JsonSerializer {
21 |
22 | @Override
23 | public JsonElement serialize(Volume volume, Type paramType, JsonSerializationContext context) {
24 | final JsonObject jsonObject = new JsonObject();
25 |
26 | jsonObject.addProperty("id", volume.getId());
27 | jsonObject.addProperty("name", volume.getName());
28 |
29 | if (StringUtils.isNotBlank(volume.getDescription())) {
30 | jsonObject.addProperty("description", volume.getDescription());
31 | }
32 |
33 | if (StringUtils.isNotBlank(volume.getRegion().getSlug())) {
34 | jsonObject.addProperty("region", volume.getRegion().getSlug());
35 | }
36 |
37 | if (null != volume.getSize()) {
38 | jsonObject.addProperty("size_gigabytes", volume.getSize());
39 | }
40 |
41 | return jsonObject;
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/doandroidlib/src/main/res/layout/activity_dologin.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
21 |
22 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/doandroidlib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DOAndroidLib
3 |
4 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teamOSC/DigitalOceanApp/2a7fcd42a0cc4884cbb6796a27cd8489c06e0762/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':doandroidlib'
2 |
--------------------------------------------------------------------------------