Skip to content

Commit 8a51169

Browse files
author
Karl Rieb
committed
2.0-beta-3 release.
1 parent b9bd0bc commit 8a51169

File tree

108 files changed

+24278
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+24278
-242
lines changed

ChangeLog.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
---------------------------------------------
2+
2.0-beta-3 (2015-12-01)
3+
- Add a workaround for older Android versions' buggy SecureRandom.
4+
- Fix android example
5+
6+
---------------------------------------------
7+
2.0-beta-2 (2015-11-13)
8+
- Put "Dbx" prefix on namespace classes (Files -> DbxFiles, etc.)
9+
- Updated to latest API specs.
10+
11+
---------------------------------------------
12+
2.0-beta-1 (2015-10-13)
13+
- Add support for Dropbox API v2. Moved API v1-specific classes to
14+
'v1' sub-package.
15+
- Add support for Android.
16+
- Add support for using OkHttp as the HTTP client library.
17+
118
---------------------------------------------
219
1.8.2 (2015-10-19)
320

License.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013 Dropbox Inc., http://www.dropbox.com/
1+
Copyright (c) 2015 Dropbox Inc., http://www.dropbox.com/
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

ReadMe.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Dropbox Core SDK for Java 6+
22

3-
A Java library to access [Dropbox's HTTP-based Core API](https://www.dropbox.com/developers/core/docs).
3+
A Java library to access [Dropbox's HTTP-based Core API v2](https://www.dropbox.com/developers/documentation/http#documentation). This SDK also supports the older [Core API v1](https://www.dropbox.com/developers-v1/core/docs), but that support will be removed at some point.
44

55
License: [MIT](License.txt)
66

7-
This is for web applications. If you want to use Dropbox's API from Android, try the [Dropbox Core SDK for Android](https://www.dropbox.com/developers/core/sdks/android).
8-
9-
[Javadoc.](http://dropbox.github.io/dropbox-sdk-java/api-docs/v1.8.x/)
7+
[Javadoc.](http://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/)
108

119
## Setup
1210

@@ -16,12 +14,12 @@ If you're using Maven, then edit your project's "pom.xml" and add this to the `<
1614
<dependency>
1715
<groupId>com.dropbox.core</groupId>
1816
<artifactId>dropbox-core-sdk</artifactId>
19-
<version>[1.8,1.9)</version>
17+
<version>2.0-beta-3</version>
2018
</dependency>
2119
```
2220

2321
If you aren't using Maven, here are the JARs you need:
24-
- [Dropbox Core SDK 1.8.2](https://oss.sonatype.org/content/repositories/releases/com/dropbox/core/dropbox-core-sdk/1.8.2/dropbox-core-sdk-1.8.2.jar)
22+
- [Dropbox Core SDK 2.0-beta-3](https://oss.sonatype.org/content/repositories/releases/com/dropbox/core/dropbox-core-sdk/2.0-beta-3/dropbox-core-sdk-2.0-beta-3.jar)
2523
- [Jackson Core 2.6.1](https://oss.sonatype.org/content/repositories/releases/com/fasterxml/jackson/core/jackson-core/2.6.1/jackson-core-2.6.1.jar) (JSON parser)
2624

2725
## Get a Dropbox API key
@@ -43,13 +41,13 @@ Save the API key to a JSON file called, say, "test.app":
4341
## Using the Dropbox API
4442

4543
Before your app can access a Dropbox user's files, the user must authorize your application using OAuth 2. Successfully completing this authorization flow gives you an _access token_ for the user's Dropbox account, which grants you the ability to make Dropbox API calls to access their files.
44+
* Example for a simple web app: [Web File Browser example](examples/web-file-browser/src/com/dropbox/core/examples/web_file_browser/DropboxAuth.java)
45+
* Example for an Android app: [Android example](examples/android/src/main/java/com/dropbox/core/examples/android/UserActivity.java)
46+
* Example for a command-line tool: [Command-Line Authorization example](examples/authorize/src/com/dropbox/core/examples/authorize/Main.java)
4647

47-
* Authorization example for a simple web app: [Web File Browser example](examples/web-file-browser/src/com/dropbox/core/examples/web_file_browser/DropboxAuth.java)
48-
* Authorization example for a command-line tool: [Command-Line Authorization example](examples/authorize/src/com/dropbox/core/examples/authorize/Main.java)
49-
50-
Once you have an access token, create a [`DbxClient`](http://dropbox.github.io/dropbox-sdk-java/api-docs/v1.8.x/com/dropbox/core/DbxClient.html) and start making API calls.
48+
Once you have an access token, create a [`DbxClientV2`](https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/DbxClientV2.html) and start making API calls.
5149

52-
You only need to perform the authorization process once per user. Once you have an access token for a user, save it somewhere persistent, like in a database. The next time that user visits your app's, you can skip the authorization process and go straight to creating a `DbxClient` and making API calls.
50+
You only need to perform the authorization process once per user. Once you have an access token for a user, save it somewhere persistent, like in a database. The next time that user visits your app's, you can skip the authorization process and go straight to creating a `DbxClientV2` and making API calls.
5351

5452
## Running the examples
5553

examples/account-info/src/com/dropbox/core/examples/account_info/Main.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package com.dropbox.core.examples.account_info;
22

3-
import com.dropbox.core.*;
3+
import com.dropbox.core.DbxAuthInfo;
4+
import com.dropbox.core.DbxException;
5+
import com.dropbox.core.DbxRequestConfig;
6+
import com.dropbox.core.DbxWebAuth;
47
import com.dropbox.core.json.JsonReader;
8+
import com.dropbox.core.v2.DbxClientV2;
9+
import com.dropbox.core.v2.DbxUsers;
510

611
import java.io.IOException;
712
import java.util.Locale;
@@ -49,21 +54,22 @@ public static void main(String[] args)
4954
System.exit(1); return;
5055
}
5156

52-
// Create a DbxClient, which is what you use to make API calls.
57+
// Create a DbxClientV1, which is what you use to make API calls.
5358
String userLocale = Locale.getDefault().toString();
5459
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-account-info", userLocale);
55-
DbxClient dbxClient = new DbxClient(requestConfig, authInfo.accessToken, authInfo.host);
60+
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.accessToken, authInfo.host);
5661

5762
// Make the /account/info API call.
58-
DbxAccountInfo dbxAccountInfo;
63+
DbxUsers.FullAccount dbxAccountInfo;
64+
DbxUsers.SpaceUsage dbxSpaceUsage;
5965
try {
60-
dbxAccountInfo = dbxClient.getAccountInfo();
66+
dbxAccountInfo = dbxClient.users.getCurrentAccount();
6167
}
6268
catch (DbxException ex) {
63-
ex.printStackTrace();
64-
System.err.println("Error in getAccountInfo(): " + ex.getMessage());
69+
System.err.println("Error making API call: " + ex.getMessage());
6570
System.exit(1); return;
6671
}
67-
System.out.println("User's account info: " + dbxAccountInfo.toStringMultiline());
72+
73+
System.out.print(dbxAccountInfo.toStringMultiline());
6874
}
6975
}

examples/android/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/local.properties
2+
3+
/.gradle
4+
/build
5+
6+
/.idea
7+
/android.iml
8+
/captures

examples/android/ReadMe.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Example Android application (using the Dropbox SDK for Java.)
2+
3+
This shows the Dropbox API authorization flow and some API calls to retrieve files.
4+
5+
## Running the example
6+
7+
Prerequisites: Apache Maven (to build the SDK), [Android Studio](http://developer.android.com/sdk/installing/) (not strictly necessary)
8+
9+
1. Download this repository.
10+
2. Build the SDK: run `mvn package` in the SDK root directory (two levels up from this folder).
11+
3. In Android Studio, choose "Import Project" and select this folder.
12+
4. Edit "src/main/AndroidManifest.xml" and "src/main/res/values/strings.xml" and replace `YOUR_APP_KEY_HERE` with your Dropbox API key ([how to get a Dropbox API key](../../ReadMe.md#get-a-dropbox-api-key)).
13+
5. Build and run.
14+
15+
If you don't have Android Studio, you can use the command-line:
16+
17+
1. Make sure you have the standalone [Android SDK Tools](http://developer.android.com/sdk/installing/).
18+
2. Make sure your `ANDROID_SDK` environment variable is set to the path where the standalone Android SDK Tools are installed.
19+
3. To build: run `./gradlew assemble`.
20+
4. The example app's ".apk" files should now be in "build/outputs/apk". You can use "adb install" to install them to the emulator or to a real device.

examples/android/build.gradle

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
jcenter()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:1.2.3'
9+
10+
// NOTE: Do not place your application dependencies here; they belong
11+
// in the individual module build.gradle files
12+
}
13+
}
14+
15+
allprojects {
16+
repositories {
17+
jcenter()
18+
mavenLocal()
19+
}
20+
}
21+
22+
apply plugin: 'com.android.application'
23+
24+
android {
25+
compileSdkVersion 22
26+
buildToolsVersion "22.0.1"
27+
28+
defaultConfig {
29+
applicationId "com.dropbox.core.examples.android"
30+
minSdkVersion 19
31+
targetSdkVersion 22
32+
versionCode 1
33+
versionName "1.0"
34+
}
35+
buildTypes {
36+
release {
37+
minifyEnabled false
38+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
39+
}
40+
}
41+
42+
packagingOptions {
43+
exclude 'META-INF/LICENSE'
44+
exclude 'META-INF/LICENSE.txt'
45+
exclude 'META-INF/NOTICE'
46+
exclude 'META-INF/NOTICE.txt'
47+
}
48+
}
49+
50+
dependencies {
51+
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '0-SNAPSHOT', changing: true
52+
compile 'com.android.support:appcompat-v7:22.2.0'
53+
compile 'com.android.support:design:22.2.0'
54+
compile 'com.android.support:recyclerview-v7:21.0.0'
55+
compile 'com.fasterxml.jackson.core:jackson-core:2.5.4'
56+
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.4'
57+
compile 'com.squareup.picasso:picasso:2.5.2'
58+
compile 'com.squareup.okhttp:okhttp:2.4.0'
59+
}

examples/android/gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Project-wide Gradle settings.
2+
3+
# IDE (e.g. Android Studio) users:
4+
# Gradle settings configured through the IDE *will override*
5+
# any settings specified in this file.
6+
7+
# For more details on how to configure your build environment visit
8+
# http://www.gradle.org/docs/current/userguide/build_environment.html
9+
10+
# Specifies the JVM arguments used for the daemon process.
11+
# The setting is particularly useful for tweaking memory settings.
12+
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14+
15+
# When configured, Gradle will run in incubating parallel mode.
16+
# This option should only be used with decoupled projects. More details, visit
17+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18+
# org.gradle.parallel=true
48.7 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Apr 10 15:27:10 PDT 2013
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.2.1-all.zip

0 commit comments

Comments
 (0)