Skip to content

Commit

Permalink
Make android example work for android P.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuyangzhao committed Jun 25, 2018
1 parent 45bced7 commit c710ef8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
26 changes: 12 additions & 14 deletions examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.2'
classpath 'com.android.tools.build:gradle:3.2.0-beta01'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3'
}
}

allprojects {
repositories {
jcenter()
mavenLocal()
google()
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion 28

defaultConfig {
applicationId "com.dropbox.core.examples.android"
minSdkVersion 19
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand Down Expand Up @@ -58,15 +59,12 @@ android {
}

dependencies {
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '0-SNAPSHOT', changing: true
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
// picasso 2.5.2 doesn't have OkHttp3 support (although it exists
// on master). Must use OkHttp v2 and v3 until new picasso release
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
implementation group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '0-SNAPSHOT', changing: true
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:design:28.0.0-alpha3'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
implementation 'com.squareup.picasso:picasso:2.71828'
api 'com.squareup.okhttp3:okhttp:3.10.0'
}

apply plugin: 'com.getkeepsafe.dexcount'
Expand Down
4 changes: 2 additions & 2 deletions examples/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 27 11:21:25 PDT 2016
#Sun Jun 24 16:05:27 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
2 changes: 1 addition & 1 deletion examples/android/proguard-rules-debug.pro
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-dontobfuscate
-include "proguard-rules.pro"
-include proguard-rules.pro
1 change: 1 addition & 0 deletions examples/android/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

-dontwarn okio.**
-dontwarn okhttp3.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.**
-dontwarn javax.servlet.**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.dropbox.core.v2.files.FileMetadata;
import com.dropbox.core.v2.files.ThumbnailFormat;
import com.dropbox.core.v2.files.ThumbnailSize;
import okio.Okio;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Request;
import com.squareup.picasso.RequestHandler;
Expand Down Expand Up @@ -54,7 +55,7 @@ public Result load(Request request, int networkPolicy) throws IOException {
.withSize(ThumbnailSize.W1024H768)
.start();

return new Result(downloader.getInputStream(), Picasso.LoadedFrom.NETWORK);
return new Result(Okio.source(downloader.getInputStream()), Picasso.LoadedFrom.NETWORK);
} catch (DbxException e) {
throw new IOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.content.Context;

import com.dropbox.core.v2.DbxClientV2;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;

/**
Expand All @@ -16,7 +16,7 @@ public static void init(Context context, DbxClientV2 dbxClient) {

// Configure picasso to know about special thumbnail requests
sPicasso = new Picasso.Builder(context)
.downloader(new OkHttpDownloader(context))
.downloader(new OkHttp3Downloader(context))
.addRequestHandler(new FileThumbnailRequestHandler(dbxClient))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.dropbox.core.examples.android;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
Expand Down

0 comments on commit c710ef8

Please sign in to comment.