Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle and major dependency updates #200

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 40 additions & 21 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'


android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
buildToolsVersion "29.0.3"

signingConfigs {
release {
def keystore = file('keystore.properties');
def keystore = file('keystore.properties')
if (keystore.exists()) {
def Properties keyProps = new Properties()
Properties keyProps = new Properties()
keyProps.load(new FileInputStream(keystore))
storeFile file(keyProps["store"])
storePassword keyProps["storePass"]
Expand All @@ -44,18 +43,15 @@ android {
versionName '5.6'
}


buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}

flavorDimensions "distribution"

productFlavors {
base {
// Basic build
Expand All @@ -67,29 +63,52 @@ android {
dimension "distribution"
}
}

compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// Android Support
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation ('com.squareup.retrofit2:converter-simplexml:2.3.0') {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'

// Third-party
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.4'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.4'
implementation('com.squareup.retrofit2:converter-simplexml:2.6.4') {
exclude module: 'xpp3'
exclude module: 'stax-api'
}
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'

googleImplementation 'com.google.firebase:firebase-crash:11.8.0'
googleImplementation 'com.android.billingclient:billing:2.0.3'
//Gson
implementation 'com.google.code.gson:gson:2.8.6'

//RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.20'

// Flavor
//googleImplementation 'com.google.firebase:firebase-crash:x.y.z'
googleImplementation 'com.android.billingclient:billing:2.2.0'

debugImplementation 'com.facebook.stetho:stetho:1.5.0'
// Debug
debugImplementation 'com.facebook.stetho:stetho:1.5.1'

// Testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.9.0'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.physphil.android.unitconverterultimate

import android.app.Activity
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.android.billingclient.api.BillingClient
import com.android.billingclient.api.BillingClientStateListener
import com.android.billingclient.api.BillingFlowParams
Expand Down Expand Up @@ -76,7 +76,7 @@ class BillingManager : PurchasesUpdatedListener {
}
}

fun donate(activity: Activity, donation: SkuDetails, listener: DonationResultListener) {
fun donate(activity: AppCompatActivity, donation: SkuDetails, listener: DonationResultListener) {
donationResultListener = listener
val flowParams = BillingFlowParams.newBuilder()
.setSkuDetails(donation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.physphil.android.unitconverterultimate.api;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;

/**
Expand All @@ -34,7 +34,7 @@ private CurrencyApi() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(SimpleXmlConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();

mService = retrofit.create(CurrencyService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import com.physphil.android.unitconverterultimate.api.models.Envelope;

import io.reactivex.Observable;
import retrofit2.http.GET;
import rx.Observable;

/**
* Retrofit service to consume Currency API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func0;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

/**
* Presenter to handle unit conversions
* Created by Phizz on 15-07-29.
*/
public class ConversionPresenter {

private CompositeSubscription mCompositeSubscription;
private CompositeDisposable mCompositeDisposable;
private ConversionView mView;

/**
Expand All @@ -56,33 +56,33 @@ public class ConversionPresenter {
*/
public ConversionPresenter(ConversionView mView) {
this.mView = mView;
this.mCompositeSubscription = new CompositeSubscription();
this.mCompositeDisposable = new CompositeDisposable();
}

public void onDestroy() {
// Clear all observable subscriptions
mCompositeSubscription.unsubscribe();
mCompositeDisposable.dispose();
}

public void getLastConversionState(@Conversion.id final int conversionId) {
mCompositeSubscription.add(getConversionStateObservable(conversionId)
mCompositeDisposable.add(getConversionStateObservable(conversionId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<ConversionState>() {
.subscribe(new Consumer<ConversionState>() {
@Override
public void call(ConversionState conversionState) {
public void accept(ConversionState conversionState) {
mView.restoreConversionState(conversionState);
}
}, new Action1<Throwable>() {
}, new Consumer<Throwable>() {
@Override
public void call(Throwable throwable) {
public void accept(Throwable throwable) {
// This should never happen
}
}));
}

private Observable<ConversionState> getConversionStateObservable(@Conversion.id final int conversionId) {
return Observable.defer(new Func0<Observable<ConversionState>>() {
return Observable.defer(new Callable<Observable<ConversionState>>() {
@Override
public Observable<ConversionState> call() {
return Observable.just(DataAccess.getInstance(mView.getContext()).getConversionState(conversionId));
Expand All @@ -91,13 +91,13 @@ public Observable<ConversionState> call() {
}

public void onUpdateCurrencyConversions() {
mCompositeSubscription.add(CurrencyApi.getInstance().getService()
mCompositeDisposable.add(CurrencyApi.getInstance().getService()
.getLatestRates()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Envelope>() {
.subscribe(new Consumer<Envelope>() {
@Override
public void call(Envelope envelope) {
public void accept(Envelope envelope) {
List<Currency> currencies = new ArrayList<>();
for (Envelope.Cube cube : envelope.getCube().getCube().get(0).getCube()) {
currencies.add(new Currency(cube.getCurrency(), cube.getRate()));
Expand All @@ -115,9 +115,9 @@ public void call(Envelope envelope) {
mView.showUnitsList(Conversions.getInstance().getById(Conversion.CURRENCY));
}
}
}, new Action1<Throwable>() {
}, new Consumer<Throwable>() {
@Override
public void call(Throwable throwable) {
public void accept(Throwable throwable) {
if (!Conversions.getInstance().hasCurrency()) {
mView.showLoadingError(R.string.error_loading_currency);
}
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.4.10'
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Sep 17 21:07:02 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Loading