diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4f83359
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,165 @@
+
+# Created by https://www.gitignore.io/api/macos,sonar,gradle,android,intellij
+
+### Android ###
+# Built application files
+*.apk
+*.ap_
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# Intellij
+*.iml
+.idea/
+
+# Keystore files
+app/keys/
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+### Android Patch ###
+gen-external-apklibs
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff:
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+
+# Sensitive or high-churn files:
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.xml
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+
+# Gradle:
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# CMake
+cmake-build-debug/
+
+# Mongo Explorer plugin:
+.idea/**/mongoSettings.xml
+
+## File-based project format:
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+/out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+### Intellij Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+.idea/sonarlint
+
+### macOS ###
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Sonar ###
+#Sonar generated dir
+.sonar/
+
+### Gradle ###
+.gradle
+/build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties
+
+# End of https://www.gitignore.io/api/macos,sonar,gradle,android,intellij
diff --git a/appauth-android_codelab_init/app/build.gradle b/appauth-android_codelab_init/app/build.gradle
index f20b4e0..bb5738b 100644
--- a/appauth-android_codelab_init/app/build.gradle
+++ b/appauth-android_codelab_init/app/build.gradle
@@ -1,15 +1,16 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
+ compileSdkVersion 27
+ buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.codelabs.appauth"
minSdkVersion 21
- targetSdkVersion 23
+ targetSdkVersion 27
versionCode 1
versionName "1.0"
+ manifestPlaceholders = [appAuthRedirectScheme : "myScheme"]
}
buildTypes {
release {
@@ -20,10 +21,14 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:23.3.0'
- compile 'com.android.support:design:23.3.0'
- compile 'com.squareup.okhttp3:okhttp:3.2.0'
- compile 'com.squareup.picasso:picasso:2.5.2'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation 'junit:junit:4.12'
+ implementation 'com.android.support:appcompat-v7:27.1.1'
+ implementation 'com.android.support:animated-vector-drawable:27.1.1'
+ implementation 'com.android.support:exifinterface:27.1.1'
+ implementation 'com.android.support:design:27.1.1'
+ implementation 'com.android.support:customtabs:27.1.1'
+ implementation 'com.squareup.okhttp3:okhttp:3.10.0'
+ implementation 'com.squareup.picasso:picasso:2.71828'
+ implementation 'net.openid:appauth:0.7.0'
}
diff --git a/appauth-android_codelab_init/app/src/androidTest/java/com/google/codelabs/appauth/ApplicationTest.java b/appauth-android_codelab_init/app/src/androidTest/java/com/google/codelabs/appauth/ApplicationTest.java
deleted file mode 100644
index e740cfe..0000000
--- a/appauth-android_codelab_init/app/src/androidTest/java/com/google/codelabs/appauth/ApplicationTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.codelabs.appauth;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/appauth-android_codelab_init/app/src/main/java/com/google/codelabs/appauth/MainActivity.java b/appauth-android_codelab_init/app/src/main/java/com/google/codelabs/appauth/MainActivity.java
index 9d06af4..4995603 100644
--- a/appauth-android_codelab_init/app/src/main/java/com/google/codelabs/appauth/MainActivity.java
+++ b/appauth-android_codelab_init/app/src/main/java/com/google/codelabs/appauth/MainActivity.java
@@ -14,43 +14,24 @@
package com.google.codelabs.appauth;
-import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
-import android.net.Uri;
-import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.AppCompatTextView;
import android.text.TextUtils;
-import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
-import com.squareup.picasso.Picasso;
-
import net.openid.appauth.AuthState;
-import net.openid.appauth.AuthorizationException;
-import net.openid.appauth.AuthorizationRequest;
-import net.openid.appauth.AuthorizationResponse;
import net.openid.appauth.AuthorizationService;
-import net.openid.appauth.AuthorizationServiceConfiguration;
import net.openid.appauth.TokenResponse;
import org.json.JSONException;
-import org.json.JSONObject;
-
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.Response;
-
-import static com.google.codelabs.appauth.MainApplication.LOG_TAG;
public class MainActivity extends AppCompatActivity {
@@ -121,7 +102,7 @@ private void handleAuthorizationResponse(@NonNull Intent intent) {
private void persistAuthState(@NonNull AuthState authState) {
getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit()
- .putString(AUTH_STATE, authState.toJsonString())
+ .putString(AUTH_STATE, authState.jsonSerializeString())
.commit();
enablePostAuthorizationFlows();
}
@@ -139,7 +120,7 @@ private AuthState restoreAuthState() {
.getString(AUTH_STATE, null);
if (!TextUtils.isEmpty(jsonString)) {
try {
- return AuthState.fromJson(jsonString);
+ return AuthState.jsonDeserialize(jsonString);
} catch (JSONException jsonException) {
// should never happen
}
diff --git a/appauth-android_codelab_init/app/src/test/java/com/google/codelabs/appauth/ExampleUnitTest.java b/appauth-android_codelab_init/app/src/test/java/com/google/codelabs/appauth/ExampleUnitTest.java
deleted file mode 100644
index e990d9a..0000000
--- a/appauth-android_codelab_init/app/src/test/java/com/google/codelabs/appauth/ExampleUnitTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.codelabs.appauth;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/appauth-android_codelab_init/build.gradle b/appauth-android_codelab_init/build.gradle
index 03bced9..4a706d9 100644
--- a/appauth-android_codelab_init/build.gradle
+++ b/appauth-android_codelab_init/build.gradle
@@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.1.0'
+ classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ google()
}
}
diff --git a/appauth-android_codelab_init/gradle/wrapper/gradle-wrapper.properties b/appauth-android_codelab_init/gradle/wrapper/gradle-wrapper.properties
index 122a0dc..c3510d6 100644
--- a/appauth-android_codelab_init/gradle/wrapper/gradle-wrapper.properties
+++ b/appauth-android_codelab_init/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ 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