diff --git a/build.gradle b/build.gradle index f6f82340..4a44e61b 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ allprojects { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0' - classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.8' + classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.16' } } } @@ -35,9 +35,9 @@ subprojects { } ext { - minSdkVersion = 9 - targetSdkVersion = 27 - compileSdkVersion = 27 + minSdkVersion = 14 + targetSdkVersion = 28 + compileSdkVersion = 28 buildToolsVersion = '28.0.3' sourceCompatibilityVersion = JavaVersion.VERSION_1_7 targetCompatibilityVersion = JavaVersion.VERSION_1_7 @@ -56,29 +56,28 @@ project.plugins.whenPluginAdded { plugin -> } } -def androidSupportVersion = '27.0.1' +def androidxVersion = '1.0.0-beta01' def gradleIncapHelperVersion = '0.2' def autoserviceVersion = '1.0-rc5' ext.deps = [ - android : 'com.google.android:android:4.1.1.4', - supportAnnotations : "com.android.support:support-annotations:$androidSupportVersion", - appCompat : "com.android.support:appcompat-v7:$androidSupportVersion", - design : "com.android.support:design:$androidSupportVersion", - supportTestRunner : 'com.android.support.test:runner:0.5', - javapoet : 'com.squareup:javapoet:1.8.0', - autovalueProcessor : 'com.google.auto.value:auto-value:1.6.5', - autovalueApi : 'com.google.auto.value:auto-value-annotations:1.6.3', - autocommon : 'com.google.auto:auto-common:0.8', - autoserviceProcessor : "com.google.auto.service:auto-service:$autoserviceVersion", - autoserviceApi : "com.google.auto.service:auto-service-annotations:$autoserviceVersion", - javaFormat : 'com.google.googlejavaformat:google-java-format:1.1', - junit : 'junit:junit:4.12', - truth : 'com.google.truth:truth:0.30', - compiletesting : 'com.google.testing.compile:compile-testing:0.10', - lombok : "org.projectlombok:lombok:1.16.16", - gradleIncapHelperApi : "net.ltgt.gradle.incap:incap:$gradleIncapHelperVersion", - gradleIncapHelperProcessor: "net.ltgt.gradle.incap:incap-processor:$gradleIncapHelperVersion" + android: 'com.google.android:android:4.1.1.4', + supportAnnotations: "androidx.annotation:annotation:$androidxVersion", + appCompat: "androidx.appcompat:appcompat:$androidxVersion", + supportTestRunner: 'com.android.support.test:runner:0.5', + javapoet: 'com.squareup:javapoet:1.8.0', + autovalueProcessor: 'com.google.auto.value:auto-value:1.6.5', + autovalueApi: 'com.google.auto.value:auto-value-annotations:1.6.3', + autocommon: 'com.google.auto:auto-common:0.8', + autoserviceProcessor: "com.google.auto.service:auto-service:$autoserviceVersion", + autoserviceApi: "com.google.auto.service:auto-service-annotations:$autoserviceVersion", + javaFormat: 'com.google.googlejavaformat:google-java-format:1.1', + junit: 'junit:junit:4.12', + truth: 'com.google.truth:truth:0.30', + compiletesting: 'com.google.testing.compile:compile-testing:0.10', + lombok: "org.projectlombok:lombok:1.16.16", + gradleIncapHelperApi: "net.ltgt.gradle.incap:incap:$gradleIncapHelperVersion", + gradleIncapHelperProcessor: "net.ltgt.gradle.incap:incap-processor:$gradleIncapHelperVersion" ] task clean(type: Delete) { diff --git a/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/DateAdapter.java b/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/DateAdapter.java index d0f55c3b..6e102c62 100644 --- a/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/DateAdapter.java +++ b/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/DateAdapter.java @@ -17,8 +17,10 @@ package nz.bradcampbell.autovalueexample; import android.os.Parcel; -import android.support.annotation.NonNull; + import java.util.Date; + +import androidx.annotation.NonNull; import paperparcel.TypeAdapter; public final class DateAdapter implements TypeAdapter { diff --git a/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/MainActivity.java b/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/MainActivity.java index f93227be..648ef74c 100644 --- a/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/MainActivity.java +++ b/examples/autovalue-example/src/main/java/nz/bradcampbell/autovalueexample/MainActivity.java @@ -17,16 +17,18 @@ package nz.bradcampbell.autovalueexample; import android.os.Bundle; -import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import androidx.annotation.Nullable; + public class MainActivity extends AppCompatActivity { private static final String STATE_KEY = "state"; diff --git a/examples/java7-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java b/examples/java7-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java index d71f1324..3b1ddfad 100644 --- a/examples/java7-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java +++ b/examples/java7-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java @@ -17,8 +17,10 @@ package nz.bradcampbell.java7example; import android.os.Parcel; -import android.support.annotation.NonNull; + import java.util.Date; + +import androidx.annotation.NonNull; import paperparcel.TypeAdapter; public final class DateAdapter implements TypeAdapter { diff --git a/examples/java7-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java b/examples/java7-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java index e8d74aa0..e63578ef 100644 --- a/examples/java7-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java +++ b/examples/java7-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java @@ -17,16 +17,18 @@ package nz.bradcampbell.java7example; import android.os.Bundle; -import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import androidx.annotation.Nullable; + public class MainActivity extends AppCompatActivity { private State state = new State(0); private final DateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.getDefault()); diff --git a/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java b/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java index d71f1324..3b1ddfad 100644 --- a/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java +++ b/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/DateAdapter.java @@ -17,8 +17,10 @@ package nz.bradcampbell.java7example; import android.os.Parcel; -import android.support.annotation.NonNull; + import java.util.Date; + +import androidx.annotation.NonNull; import paperparcel.TypeAdapter; public final class DateAdapter implements TypeAdapter { diff --git a/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java b/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java index 269259f7..463a4b37 100644 --- a/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java +++ b/examples/java7-lombok-example/src/main/java/nz/bradcampbell/java7example/MainActivity.java @@ -17,16 +17,18 @@ package nz.bradcampbell.java7example; import android.os.Bundle; -import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.TextView; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import androidx.annotation.Nullable; + public class MainActivity extends AppCompatActivity { private State state = new State(0); private final DateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.getDefault()); diff --git a/examples/kotlin-example/build.gradle b/examples/kotlin-example/build.gradle index f8a4c47f..08519746 100644 --- a/examples/kotlin-example/build.gradle +++ b/examples/kotlin-example/build.gradle @@ -34,17 +34,16 @@ android { } dependencies { - compile deps.appCompat - compile deps.design + implementation deps.appCompat - compile project(':paperparcel') - compile project(':paperparcel-kotlin') + implementation project(':paperparcel') + implementation project(':paperparcel-kotlin') kapt project(':paperparcel-compiler') - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - testCompile deps.junit - testCompile deps.compiletesting + testImplementation deps.junit + testImplementation deps.compiletesting } tasks.withType(Test) { diff --git a/examples/kotlin-example/src/main/AndroidManifest.xml b/examples/kotlin-example/src/main/AndroidManifest.xml index db102c8a..5a04972b 100644 --- a/examples/kotlin-example/src/main/AndroidManifest.xml +++ b/examples/kotlin-example/src/main/AndroidManifest.xml @@ -9,13 +9,12 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" - android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> + android:theme="@style/AppTheme"> diff --git a/examples/kotlin-example/src/main/kotlin/nz/bradcampbell/kotlinexample/MainActivity.kt b/examples/kotlin-example/src/main/kotlin/nz/bradcampbell/kotlinexample/MainActivity.kt index 46688559..1a8eaa71 100644 --- a/examples/kotlin-example/src/main/kotlin/nz/bradcampbell/kotlinexample/MainActivity.kt +++ b/examples/kotlin-example/src/main/kotlin/nz/bradcampbell/kotlinexample/MainActivity.kt @@ -16,51 +16,54 @@ package nz.bradcampbell.kotlinexample +import android.annotation.SuppressLint import android.os.Bundle -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.Toolbar +import android.view.View import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.widget.Toolbar import java.text.SimpleDateFormat import java.util.Date +import java.util.Locale class MainActivity : AppCompatActivity() { - var state = State(0, Date()) - val dateFormat = SimpleDateFormat("HH:mm") + private var state = State(0, Date()) + private val dateFormat = SimpleDateFormat("HH:mm", Locale.ENGLISH) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) savedInstanceState?.let { - state = it.getParcelable("state") + state = it.getParcelable("state") } - val toolbar = findViewById(R.id.toolbar) as Toolbar + val toolbar = findViewById(R.id.toolbar) setSupportActionBar(toolbar) - val plusButton = findViewById(R.id.add_button) + val plusButton = findViewById(R.id.add_button) plusButton.setOnClickListener { - state = state.copy(state.count + 1, Date()) + state = state.copy(count = state.count + 1, modificationDate = Date()) updateText() } - val subtractButton = findViewById(R.id.subtract_button) + val subtractButton = findViewById(R.id.subtract_button) subtractButton.setOnClickListener { - state = state.copy(state.count - 1, Date()) + state = state.copy(count = state.count - 1, modificationDate = Date()) updateText() } updateText() } - fun updateText() { - val counter = findViewById(R.id.counter) as TextView - counter.text = state.count.toString() + " (updated at " + dateFormat.format( - state.modificationDate) + ")" - } - override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putParcelable("state", state) } + + @SuppressLint("SetTextI18n") + private fun updateText() { + val counter = findViewById(R.id.counter) + counter.text = "${state.count} (updated at ${dateFormat.format(state.modificationDate)})" + } } diff --git a/examples/kotlin-example/src/main/res/layout/activity_main.xml b/examples/kotlin-example/src/main/res/layout/activity_main.xml index 097ded18..1680016b 100644 --- a/examples/kotlin-example/src/main/res/layout/activity_main.xml +++ b/examples/kotlin-example/src/main/res/layout/activity_main.xml @@ -1,30 +1,60 @@ - - + + - + + - +