Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Upload libraries
  • Loading branch information
Marina committed Apr 15, 2019
1 parent 8ac4a05 commit 2fa681a
Show file tree
Hide file tree
Showing 37 changed files with 189 additions and 173 deletions.
42 changes: 21 additions & 21 deletions api/build.gradle
@@ -1,21 +1,20 @@
apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'jacoco-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "25.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
Expand All @@ -40,26 +39,27 @@ dependencies {
compile 'com.android.support:support-v4:25.2.0'

// Raizlabs
apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
compile "com.raizlabs.android:DBFlow-Core:2.2.1"
compile "com.raizlabs.android:DBFlow:2.2.1"

annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
implementation "com.raizlabs.android:DBFlow:2.2.1"
// Jackson
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.2'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.7.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.7.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.2'

// Square
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.retrofit:converter-jackson:1.9.0'
compile 'com.squareup:otto:1.3.8'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.retrofit:converter-jackson:1.9.0'
implementation 'com.squareup:otto:1.3.8'

// Other
compile 'joda-time:joda-time:2.9.2'
implementation 'joda-time:joda-time:2.9.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'

// Java test dependencies
testCompile "junit:junit:4.12"
Expand Down
Expand Up @@ -33,7 +33,6 @@
import android.content.Context;

import com.raizlabs.android.dbflow.config.FlowManager;
import com.squareup.okhttp.HttpUrl;

import org.hisp.dhis.android.dashboard.api.models.UserAccount;
import org.hisp.dhis.android.dashboard.api.models.meta.Credentials;
Expand All @@ -49,6 +48,8 @@

import java.io.IOException;

import okhttp3.HttpUrl;

public class DhisController {
private static DhisController mDhisController;
private Session mSession;
Expand Down
@@ -1,30 +1,16 @@
package org.hisp.dhis.android.dashboard.api.controllers;

import static org.hisp.dhis.android.dashboard.api.models.BaseIdentifiableObject.merge;
import static org.hisp.dhis.android.dashboard.api.models.BaseIdentifiableObject.toMap;
import static org.hisp.dhis.android.dashboard.api.utils.NetworkUtils.unwrapResponse;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import com.raizlabs.android.dbflow.sql.language.Select;
import com.squareup.okhttp.HttpUrl;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;

import org.hisp.dhis.android.dashboard.api.models.Dashboard;
import org.hisp.dhis.android.dashboard.api.models.DashboardElement;
import org.hisp.dhis.android.dashboard.api.models.DashboardItem;
import org.hisp.dhis.android.dashboard.api.models.DataMap;
import org.hisp.dhis.android.dashboard.api.models.meta.DbOperation;
import org.hisp.dhis.android.dashboard.api.network.APIException;
import org.hisp.dhis.android.dashboard.api.network.BaseMapLayerDhisTransformation;
import org.hisp.dhis.android.dashboard.api.network.DhisApi;
import org.hisp.dhis.android.dashboard.api.persistence.preferences.DateTimeManager;
import org.hisp.dhis.android.dashboard.api.persistence.preferences.ResourceType;
import org.hisp.dhis.android.dashboard.api.utils.DbUtils;
import org.hisp.dhis.android.dashboard.api.utils.PicassoProvider;
import org.joda.time.DateTime;

import java.util.HashMap;
Expand All @@ -33,6 +19,8 @@
import java.util.Map;
import java.util.Queue;

import okhttp3.HttpUrl;

public class MapController {
private DhisApi mDhisApi;

Expand Down
Expand Up @@ -27,7 +27,6 @@
package org.hisp.dhis.android.dashboard.api.controllers;

import com.raizlabs.android.dbflow.sql.language.Delete;
import com.squareup.okhttp.HttpUrl;

import org.hisp.dhis.android.dashboard.api.models.Dashboard;
import org.hisp.dhis.android.dashboard.api.models.DashboardElement;
Expand All @@ -49,6 +48,8 @@
import java.util.HashMap;
import java.util.Map;

import okhttp3.HttpUrl;

/**
* @author Araz Abishov <araz.abishov.gsoc@gmail.com>.
*/
Expand Down
Expand Up @@ -28,7 +28,8 @@

package org.hisp.dhis.android.dashboard.api.models.meta;

import com.squareup.okhttp.HttpUrl;

import okhttp3.HttpUrl;

public final class Session {
private final HttpUrl serverUrl;
Expand Down
Expand Up @@ -28,18 +28,13 @@

package org.hisp.dhis.android.dashboard.api.network;

import static com.squareup.okhttp.Credentials.basic;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.squareup.okhttp.Cache;
import com.squareup.okhttp.HttpUrl;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

import com.jakewharton.retrofit.Ok3Client;

import org.hisp.dhis.android.dashboard.api.controllers.DhisController;
import org.hisp.dhis.android.dashboard.api.models.meta.Credentials;
Expand All @@ -50,6 +45,12 @@
import java.net.HttpURLConnection;
import java.util.concurrent.TimeUnit;

import okhttp3.Cache;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit.ErrorHandler;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
Expand All @@ -58,6 +59,8 @@
import retrofit.converter.Converter;
import retrofit.converter.JacksonConverter;

import static okhttp3.Credentials.basic;


public final class RepoManager {
static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 15 * 1000; // 15s
Expand All @@ -69,7 +72,7 @@ private RepoManager() {
}

public static DhisApi createService(HttpUrl serverUrl, Credentials credentials,
final Context context) {
final Context context) {
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(provideServerUrl(serverUrl))
.setConverter(provideJacksonConverter())
Expand All @@ -91,19 +94,17 @@ private static Converter provideJacksonConverter() {
return new JacksonConverter(ObjectMapperProvider.getInstance());
}

private static OkClient provideOkClient(Credentials credentials, Context context) {
return new OkClient(provideOkHttpClient(credentials, context));
private static Ok3Client provideOkClient(Credentials credentials, Context context) {
return new Ok3Client(provideOkHttpClient(credentials, context));
}

public static OkHttpClient provideOkHttpClient(Credentials credentials, Context context) {

OkHttpClient client = new OkHttpClient();
client.interceptors().add(provideInterceptor(credentials));
client.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
client.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
client.setWriteTimeout(DEFAULT_WRITE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
client.setCache(provideCache(context));
return client;
return new OkHttpClient().newBuilder()
.addInterceptor(provideInterceptor(credentials))
.connectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.readTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.writeTimeout(DEFAULT_WRITE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.cache(provideCache(context)).build();
}

private static Cache provideCache(Context context) {
Expand Down
Expand Up @@ -125,6 +125,7 @@ protected void onStartLoading() {
}

// Begin monitoring the underlying data source.

registerObservers();

if (takeContentChanged() || mData == null) {
Expand Down
Expand Up @@ -31,11 +31,11 @@
import android.content.Context;
import android.content.SharedPreferences;

import com.squareup.okhttp.HttpUrl;

import org.hisp.dhis.android.dashboard.api.models.meta.Credentials;
import org.hisp.dhis.android.dashboard.api.models.meta.Session;

import okhttp3.HttpUrl;

import static org.hisp.dhis.android.dashboard.api.utils.Preconditions.isNull;

public final class LastUpdatedManager {
Expand Down
Expand Up @@ -30,13 +30,14 @@

import android.content.Context;

import com.squareup.okhttp.OkHttpClient;
import com.squareup.picasso.OkHttpDownloader;
import com.jakewharton.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;

import org.hisp.dhis.android.dashboard.api.controllers.DhisController;
import org.hisp.dhis.android.dashboard.api.network.RepoManager;

import okhttp3.OkHttpClient;

public final class PicassoProvider {

private static Picasso mPicasso;
Expand All @@ -49,7 +50,7 @@ public static Picasso getInstance(Context context, boolean changeCredentials) {
OkHttpClient client = RepoManager.provideOkHttpClient(
DhisController.getInstance().getUserCredentials(), context);
mPicasso = new Picasso.Builder(context)
.downloader(new OkHttpDownloader(client))
.downloader(new OkHttp3Downloader(client))
.build();
mPicasso.setIndicatorsEnabled(false);
mPicasso.setLoggingEnabled(false);
Expand Down
42 changes: 25 additions & 17 deletions app/build.gradle
Expand Up @@ -7,20 +7,21 @@ repositories {
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "25.0.3"

defaultConfig {
applicationId "org.hisp.dhis.android.dashboard_dev"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 26
versionCode 11
versionName "0.7.3"
multiDexEnabled true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
Expand All @@ -41,25 +42,32 @@ android {
}

dependencies {
compile project(':api')

implementation project(':api')
annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
implementation "com.raizlabs.android:DBFlow:2.2.1"
// Google
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:design:25.2.0'

implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
// Castorflex
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.2.0'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
implementation 'com.github.castorflex.smoothprogressbar:library-circular:1.2.0'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'

// Other
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
implementation 'com.github.chrisbanes.photoview:library:1.2.4'

implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.1'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
// Java test dependencies
testCompile "junit:junit:4.10"
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true;
transitive = true
}
}
Expand Up @@ -87,4 +87,6 @@ public void showApiExceptionMessage(APIException apiException) {

}
}


}
Expand Up @@ -32,8 +32,6 @@
import android.os.Binder;
import android.os.IBinder;

import com.squareup.okhttp.HttpUrl;

import org.hisp.dhis.android.dashboard.api.controllers.DhisController;
import org.hisp.dhis.android.dashboard.api.job.Job;
import org.hisp.dhis.android.dashboard.api.job.JobExecutor;
Expand All @@ -46,6 +44,8 @@
import org.hisp.dhis.android.dashboard.api.utils.SyncStrategy;
import org.hisp.dhis.android.dashboard.ui.events.UiEvent;

import okhttp3.HttpUrl;

/**
* @author Araz Abishov <araz.abishov.gsoc@gmail.com>.
*/
Expand Down

0 comments on commit 2fa681a

Please sign in to comment.