Skip to content

Commit eed3eef

Browse files
authored
Migrate to AndroidX & Update dependencies (#508)
* gradle update to 5.4.1 * gradle plugin update to 3.5.3 * minor bintray update * bump compile sdk to 29 - this requires bumping build tools to 29 - also updating the gradlewrapper (again, fully) to 5.4.1 * Migrate to AndroidX This required changes to checkstyle & javadocs gradle files (perhaps because of jetifier? not sure tbh) Also mockito now can mock all final classes * Fix compiler warning * update travis build tools to 29.0.2 to align with build.gradle * update travis android sdk version to 29 to align with build.gradle
1 parent a773043 commit eed3eef

File tree

65 files changed

+331
-276
lines changed

Some content is hidden

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

65 files changed

+331
-276
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
language: android
55
android:
66
components:
7-
- build-tools-27.0.3
8-
- android-27
7+
- build-tools-29.0.2
8+
- android-29
99
script:
1010
- ./gradlew check jacoco assemble
1111
- bash <(curl -s https://codecov.io/bash)

app/build.gradle

+5-7
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,16 @@ android {
4040
}
4141
}
4242

43-
project.ext.glideVersion = '4.7.1'
44-
4543
dependencies {
46-
implementation fileTree(dir: 'libs', include: ['*.jar'])
4744
implementation project(':library')
48-
implementation "com.android.support:appcompat-v7:${rootProject.supportLibVersion}"
49-
implementation "com.android.support:design:${rootProject.supportLibVersion}"
50-
implementation "com.github.bumptech.glide:glide:${project.glideVersion}"
45+
implementation "androidx.appcompat:appcompat:1.1.0"
46+
implementation 'androidx.annotation:annotation:1.1.0'
47+
implementation "com.google.android.material:material:1.0.0"
48+
implementation "com.github.bumptech.glide:glide:4.10.0"
5149
implementation 'com.squareup.okio:okio:1.14.1'
5250
implementation 'joda-time:joda-time:2.10'
5351

54-
annotationProcessor "com.github.bumptech.glide:compiler:${project.glideVersion}"
52+
annotationProcessor "com.github.bumptech.glide:compiler:4.10.0"
5553
}
5654

5755
apply from: '../config/style.gradle'

app/java/net/openid/appauthdemo/Application.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
package net.openid.appauthdemo;
1616

17-
import android.support.v7.app.AppCompatDelegate;
17+
import androidx.appcompat.app.AppCompatDelegate;
1818

1919
/**
2020
* Application object; ensures that the support library is correctly configured for use of

app/java/net/openid/appauthdemo/AuthStateManager.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import android.content.Context;
1818
import android.content.SharedPreferences;
19-
import android.support.annotation.AnyThread;
20-
import android.support.annotation.NonNull;
21-
import android.support.annotation.Nullable;
2219
import android.util.Log;
2320

21+
import androidx.annotation.AnyThread;
22+
import androidx.annotation.NonNull;
23+
import androidx.annotation.Nullable;
24+
2425
import net.openid.appauth.AuthState;
2526
import net.openid.appauth.AuthorizationException;
2627
import net.openid.appauth.AuthorizationResponse;

app/java/net/openid/appauthdemo/BrowserSelectionAdapter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
import android.content.pm.PackageManager.NameNotFoundException;
2525
import android.graphics.drawable.Drawable;
2626
import android.os.Bundle;
27-
import android.support.annotation.NonNull;
2827
import android.view.LayoutInflater;
2928
import android.view.View;
3029
import android.view.ViewGroup;
3130
import android.widget.BaseAdapter;
3231
import android.widget.ImageView;
3332
import android.widget.TextView;
3433

34+
import androidx.annotation.NonNull;
35+
3536
import net.openid.appauth.browser.BrowserDescriptor;
3637
import net.openid.appauth.browser.BrowserSelector;
3738

app/java/net/openid/appauthdemo/Configuration.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import android.content.SharedPreferences;
2020
import android.content.res.Resources;
2121
import android.net.Uri;
22-
import android.support.annotation.NonNull;
23-
import android.support.annotation.Nullable;
2422
import android.text.TextUtils;
2523

24+
import androidx.annotation.NonNull;
25+
import androidx.annotation.Nullable;
26+
2627
import net.openid.appauth.connectivity.ConnectionBuilder;
2728
import net.openid.appauth.connectivity.DefaultConnectionBuilder;
2829

@@ -37,6 +38,7 @@
3738
import java.lang.ref.WeakReference;
3839
import java.nio.charset.Charset;
3940

41+
4042
/**
4143
* Reads and validates the demo app configuration from `res/raw/auth_config.json`. Configuration
4244
* changes are detected by comparing the hash of the last known configuration to the read

app/java/net/openid/appauthdemo/ConnectionBuilderForTesting.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
import android.annotation.SuppressLint;
1818
import android.net.Uri;
19-
import android.support.annotation.NonNull;
20-
import android.support.annotation.Nullable;
2119
import android.util.Log;
2220

21+
import androidx.annotation.NonNull;
22+
import androidx.annotation.Nullable;
23+
2324
import net.openid.appauth.Preconditions;
2425
import net.openid.appauth.connectivity.ConnectionBuilder;
2526

app/java/net/openid/appauthdemo/LoginActivity.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121
import android.os.Bundle;
2222
import android.os.Handler;
2323
import android.os.Looper;
24-
import android.support.annotation.AnyThread;
25-
import android.support.annotation.ColorRes;
26-
import android.support.annotation.MainThread;
27-
import android.support.annotation.NonNull;
28-
import android.support.annotation.Nullable;
29-
import android.support.annotation.WorkerThread;
30-
import android.support.customtabs.CustomTabsIntent;
31-
import android.support.design.widget.Snackbar;
32-
import android.support.v7.app.AppCompatActivity;
3324
import android.text.Editable;
3425
import android.text.TextUtils;
3526
import android.text.TextWatcher;
@@ -42,6 +33,17 @@
4233
import android.widget.Spinner;
4334
import android.widget.TextView;
4435

36+
import androidx.annotation.AnyThread;
37+
import androidx.annotation.ColorRes;
38+
import androidx.annotation.MainThread;
39+
import androidx.annotation.NonNull;
40+
import androidx.annotation.Nullable;
41+
import androidx.annotation.WorkerThread;
42+
import androidx.appcompat.app.AppCompatActivity;
43+
import androidx.browser.customtabs.CustomTabsIntent;
44+
45+
import com.google.android.material.snackbar.Snackbar;
46+
4547
import net.openid.appauth.AppAuthConfiguration;
4648
import net.openid.appauth.AuthState;
4749
import net.openid.appauth.AuthorizationException;
@@ -171,6 +173,7 @@ protected void onDestroy() {
171173

172174
@Override
173175
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
176+
super.onActivityResult(requestCode, resultCode, data);
174177
displayAuthOptions();
175178
if (resultCode == RESULT_CANCELED) {
176179
displayAuthCancelled();

app/java/net/openid/appauthdemo/TokenActivity.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@
1717
import android.content.Intent;
1818
import android.net.Uri;
1919
import android.os.Bundle;
20-
import android.support.annotation.MainThread;
21-
import android.support.annotation.Nullable;
22-
import android.support.annotation.WorkerThread;
23-
import android.support.design.widget.Snackbar;
24-
import android.support.v7.app.AppCompatActivity;
2520
import android.util.Log;
2621
import android.view.View;
2722
import android.widget.Button;
2823
import android.widget.ImageView;
2924
import android.widget.TextView;
3025
import android.widget.Toast;
3126

27+
import androidx.annotation.MainThread;
28+
import androidx.annotation.Nullable;
29+
import androidx.annotation.WorkerThread;
30+
import androidx.appcompat.app.AppCompatActivity;
31+
32+
import com.google.android.material.snackbar.Snackbar;
33+
3234
import net.openid.appauth.AppAuthConfiguration;
3335
import net.openid.appauth.AuthState;
3436
import net.openid.appauth.AuthorizationException;
@@ -54,6 +56,7 @@
5456
import java.util.concurrent.Executors;
5557
import java.util.concurrent.atomic.AtomicReference;
5658

59+
5760
/**
5861
* Displays the authorized state of the user. This activity is provided with the outcome of the
5962
* authorization flow, which it uses to negotiate the final authorized state,

app/res/layout/activity_login.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.design.widget.CoordinatorLayout
2+
<androidx.coordinatorlayout.widget.CoordinatorLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
xmlns:tools="http://schemas.android.com/tools"
@@ -9,7 +9,7 @@
99
android:layout_height="match_parent"
1010
android:fitsSystemWindows="true" >
1111

12-
<android.support.v4.widget.NestedScrollView
12+
<androidx.core.widget.NestedScrollView
1313
android:layout_width="match_parent"
1414
android:layout_height="match_parent"
1515
app:layout_behavior="@string/appbar_scrolling_view_behavior">
@@ -86,19 +86,19 @@
8686
android:layout_marginTop="16dp"
8787
style="@style/Base.TextAppearance.AppCompat.Subhead" />
8888

89-
<android.support.design.widget.TextInputLayout
89+
<com.google.android.material.textfield.TextInputLayout
9090
android:layout_width="match_parent"
9191
android:layout_height="wrap_content"
9292
android:layout_marginTop="8dp">
9393

94-
<android.support.design.widget.TextInputEditText
94+
<com.google.android.material.textfield.TextInputEditText
9595
android:id="@+id/login_hint_value"
9696
android:layout_width="match_parent"
9797
android:layout_height="wrap_content"
9898
android:inputType="textEmailAddress"
9999
android:hint="@string/login_hint_value"/>
100100

101-
</android.support.design.widget.TextInputLayout>
101+
</com.google.android.material.textfield.TextInputLayout>
102102

103103
<TextView
104104
android:layout_width="match_parent"
@@ -170,5 +170,5 @@
170170

171171
</LinearLayout>
172172
</LinearLayout>
173-
</android.support.v4.widget.NestedScrollView>
174-
</android.support.design.widget.CoordinatorLayout>
173+
</androidx.core.widget.NestedScrollView>
174+
</androidx.coordinatorlayout.widget.CoordinatorLayout>

app/res/layout/activity_token.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.design.widget.CoordinatorLayout
2+
<androidx.coordinatorlayout.widget.CoordinatorLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
xmlns:tools="http://schemas.android.com/tools"
@@ -192,4 +192,4 @@
192192
</LinearLayout>
193193
</LinearLayout>
194194
</ScrollView>
195-
</android.support.design.widget.CoordinatorLayout>
195+
</androidx.coordinatorlayout.widget.CoordinatorLayout>

build.gradle

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.4'
9+
classpath 'com.android.tools.build:gradle:3.5.3'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
11-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
11+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
1212
classpath 'org.ajoberstar:gradle-git:1.7.2'
1313
}
1414
}
@@ -40,9 +40,8 @@ try {
4040
}
4141

4242
project.ext.minSdkVersion = 16
43-
project.ext.compileSdkVersion = 27
44-
project.ext.buildToolsVersion = '27.0.3'
45-
project.ext.supportLibVersion = '27.1.1'
43+
project.ext.compileSdkVersion = 29
44+
project.ext.buildToolsVersion = '29.0.2'
4645

4746
task showVersion {
4847
doLast {

config/coverage.gradle

+8-6
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
2121
html.enabled = true
2222
}
2323
// Class R is used, but usage will not be covered, so ignore this class from report
24-
classDirectories = fileTree(
25-
dir: 'build/intermediates/classes/debug',
26-
excludes: ['**/BuildConfig.class']
27-
)
28-
sourceDirectories = files('java')
29-
executionData = files('build/jacoco/testDebugUnitTest.exec')
24+
afterEvaluate {
25+
classDirectories = fileTree(
26+
dir: 'build/intermediates/classes/debug',
27+
excludes: ['**/BuildConfig.class']
28+
)
29+
sourceDirectories = files('java')
30+
executionData = files('build/jacoco/testDebugUnitTest.exec')
31+
}
3032
}

config/javadoc.gradle

+14-12
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,29 @@ dependencies {
77
}
88

99
task androidJavadoc(type: Javadoc) {
10-
source = android.sourceSets.main.java.srcDirs
11-
title = "AppAuth for Android"
12-
classpath += files(project.android.getBootClasspath())
13-
options {
14-
doclet "org.jdrupes.mdoclet.MDoclet"
15-
docletpath(*configurations.mdDoclet.files.asType(List))
16-
links "http://docs.oracle.com/javase/7/docs/api/"
17-
linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
10+
afterEvaluate {
11+
source = android.sourceSets.main.java.srcDirs
12+
title = "AppAuth for Android"
13+
classpath += files(project.android.getBootClasspath())
14+
options {
15+
doclet "org.jdrupes.mdoclet.MDoclet"
16+
docletpath(*configurations.mdDoclet.files.asType(List))
17+
links "http://docs.oracle.com/javase/7/docs/api/"
18+
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
19+
}
20+
exclude '**/BuildConfig.java'
21+
exclude '**/R.java'
1822
}
19-
exclude '**/BuildConfig.java'
20-
exclude '**/R.java'
2123
}
2224

23-
task javadocJar(type: Jar, dependsOn:androidJavadoc) {
25+
task javadocJar(type: Jar, dependsOn: androidJavadoc) {
2426
classifier = 'javadoc'
2527
from androidJavadoc.destinationDir
2628
}
2729

2830
afterEvaluate {
2931
// fixes issue where javadoc can't find android symbols ref: http://stackoverflow.com/a/34572606
3032
androidJavadoc.classpath += files(android.libraryVariants.collect { variant ->
31-
variant.javaCompile.classpath.files
33+
variant.javaCompileProvider.get().classpath.files
3234
})
3335
}

config/style.gradle

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ checkstyle {
77
}
88

99
task checkAllSource(type: Checkstyle) {
10-
source 'java'
11-
include '**/*.java'
12-
classpath = files project.configurations.compile.files
10+
afterEvaluate {
11+
source 'java'
12+
include '**/*.java'
13+
classpath = files project.configurations.compile.files
14+
}
1315
}
1416

1517
task failOnCheckstyleWarning {

gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
android.enableJetifier=true
2+
android.useAndroidX=true
13
org.gradle.daemon=true

gradle/wrapper/gradle-wrapper.jar

4.39 KB
Binary file not shown.
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Apr 06 13:27:13 PDT 2018
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)