From e647d96beec215b58d0d66ed5b3eeb785927f982 Mon Sep 17 00:00:00 2001 From: Eli Hart Date: Wed, 11 Nov 2020 16:51:42 -0600 Subject: [PATCH] 4.2.0 release (#1085) * Update to kotlin 1.4.20 and remove kotlin android extensions * Release 4.2.0 --- CHANGELOG.md | 4 ++ build.gradle | 4 +- epoxy-adapter/build.gradle | 5 +-- epoxy-preloadersample/build.gradle | 5 ++- .../epoxy/preloadersample/MainActivity.kt | 9 ++-- .../preloadersample/NoPreloadActivity.kt | 11 +++-- .../epoxy/preloadersample/PreloadActivity.kt | 12 +++--- .../airbnb/epoxy/DataBindingModelTest.java | 43 ------------------- .../ModelWithDataBindingBindingModel_.java | 9 ++-- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- kotlinsample/build.gradle | 1 - 12 files changed, 38 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a42566cc5..43798195ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 4.2.0 (Nov 11, 2020) +- Add notify model changed method (#1063) +- Update to Kotlin 1.4.20-RC and remove dependency on kotlin-android-extensions + # 4.1.0 (Sept 17, 2020) - Fix some synchronization issues with the parallel Epoxy processing option - Add view visibility checks to EpoxyVisibilityItem and decouple RecyclerView #1052 diff --git a/build.gradle b/build.gradle index 2faa925c38..2ef1af52c0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.KOTLIN_VERSION = "1.4.10" - ext.ANDROID_PLUGIN_VERSION = '4.0.1' + ext.KOTLIN_VERSION = "1.4.20-RC" + ext.ANDROID_PLUGIN_VERSION = '4.1.1' repositories { google() diff --git a/epoxy-adapter/build.gradle b/epoxy-adapter/build.gradle index edb032de14..ce39c94fd5 100644 --- a/epoxy-adapter/build.gradle +++ b/epoxy-adapter/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-parcelize' apply plugin: "com.vanniktech.maven.publish" android { @@ -13,9 +13,6 @@ android { consumerProguardFiles 'proguard-rules.pro' } - androidExtensions { - experimental = true - } testOptions.unitTests.includeAndroidResources = true buildTypes.all { buildType -> diff --git a/epoxy-preloadersample/build.gradle b/epoxy-preloadersample/build.gradle index dc48adb3d2..128cf0c278 100644 --- a/epoxy-preloadersample/build.gradle +++ b/epoxy-preloadersample/build.gradle @@ -1,7 +1,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-android-extensions' android { compileSdkVersion rootProject.COMPILE_SDK_VERSION @@ -16,6 +15,10 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } + + buildFeatures { + viewBinding true + } } dependencies { diff --git a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/MainActivity.kt b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/MainActivity.kt index 435fd463e3..1e96758818 100644 --- a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/MainActivity.kt +++ b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/MainActivity.kt @@ -5,8 +5,8 @@ import android.content.Intent import android.os.AsyncTask import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import com.airbnb.epoxy.preloadersample.databinding.ActivityMainBinding import com.bumptech.glide.Glide -import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { @@ -34,7 +34,8 @@ class MainActivity : AppCompatActivity() { @SuppressLint("StaticFieldLeak") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) + val binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) // Memory and disk cache is cleared to give accurate representation of load times Glide.get(this).clearMemory() @@ -45,14 +46,14 @@ class MainActivity : AppCompatActivity() { } }.execute() - button_no_preload.setOnClickListener { + binding.buttonNoPreload.setOnClickListener { val intent = Intent(this, NoPreloadActivity::class.java) intent.putExtra(IMAGES_LIST_TAG, images) startActivity(intent) } - button_preload.setOnClickListener { + binding.buttonPreload.setOnClickListener { val intent = Intent(this, PreloadActivity::class.java) intent.putExtra(IMAGES_LIST_TAG, images) diff --git a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/NoPreloadActivity.kt b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/NoPreloadActivity.kt index 2cb479f447..6fb247ed00 100644 --- a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/NoPreloadActivity.kt +++ b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/NoPreloadActivity.kt @@ -2,7 +2,7 @@ package com.airbnb.epoxy.preloadersample import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import kotlinx.android.synthetic.main.list_activity.* +import com.airbnb.epoxy.preloadersample.databinding.ListActivityBinding class NoPreloadActivity : AppCompatActivity() { @@ -11,10 +11,13 @@ class NoPreloadActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.list_activity) + val binding = ListActivityBinding.inflate(layoutInflater) + setContentView(binding.root) - recycler_view.setHasFixedSize(true) - recycler_view.setController(controller) + binding.recyclerView.apply { + setController(controller) + setHasFixedSize(true) + } controller.setFilterDuplicates(true) controller.setData(images) diff --git a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/PreloadActivity.kt b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/PreloadActivity.kt index 7123a67e69..f303497d24 100644 --- a/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/PreloadActivity.kt +++ b/epoxy-preloadersample/src/main/java/com/airbnb/epoxy/preloadersample/PreloadActivity.kt @@ -5,13 +5,13 @@ import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.airbnb.epoxy.addGlidePreloader import com.airbnb.epoxy.glidePreloader +import com.airbnb.epoxy.preloadersample.databinding.ListActivityBinding import com.bumptech.glide.Glide import com.bumptech.glide.RequestBuilder import com.bumptech.glide.RequestManager import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.signature.ObjectKey -import kotlinx.android.synthetic.main.list_activity.recycler_view class PreloadActivity : AppCompatActivity() { @@ -20,15 +20,17 @@ class PreloadActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.list_activity) + val binding = ListActivityBinding.inflate(layoutInflater) + setContentView(binding.root) - recycler_view.setHasFixedSize(true) - recycler_view.setController(controller) + val recyclerView = binding.recyclerView + recyclerView.setHasFixedSize(true) + recyclerView.setController(controller) controller.setFilterDuplicates(true) controller.setData(images) - recycler_view.addGlidePreloader( + recyclerView.addGlidePreloader( Glide.with(this), preloader = glidePreloader { requestManager, model: ImageModel_, _ -> requestManager.loadImage(model.imageUrl, true) diff --git a/epoxy-processortest/src/test/java/com/airbnb/epoxy/DataBindingModelTest.java b/epoxy-processortest/src/test/java/com/airbnb/epoxy/DataBindingModelTest.java index 9ed1ed397a..0c349d11da 100644 --- a/epoxy-processortest/src/test/java/com/airbnb/epoxy/DataBindingModelTest.java +++ b/epoxy-processortest/src/test/java/com/airbnb/epoxy/DataBindingModelTest.java @@ -103,47 +103,4 @@ public void testSimpleModelNoValidation() { .and() .generatesSources(generatedModel); } - - @Test - public void testFullyGeneratedModel() { - JavaFileObject packageInfo = JavaFileObjects - .forResource(GuavaPatch.patchResource("DataBindingConfig.java")); - - JavaFileObject binding = JavaFileObjects - .forResource(GuavaPatch.patchResource("ModelWithDataBindingBinding.java")); - - JavaFileObject generatedModel = - JavaFileObjects.forResource(GuavaPatch.patchResource("ModelWithDataBindingBindingModel_.java")); - - assert_().about(javaSources()) - .that(asList(packageInfo, binding, BR_CLASS, R)) - .processedWith(processors()) - .compilesWithoutError() - .and() - .generatesSources(generatedModel); - } - - @Test - public void testFullyGeneratedModelWithoutDoNotHash() { - JavaFileObject packageInfo = JavaFileObjects - .forSourceString("EpoxyDataBindingConfig.java", - "package com.airbnb.epoxy;\n" - + "@EpoxyDataBindingLayouts(value = {R.layout" - + ".model_with_data_binding_without_donothash}, enableDoNotHash = false)\n" - + "interface EpoxyDataBindingConfig {} " - ); - - JavaFileObject binding = JavaFileObjects - .forResource(GuavaPatch.patchResource("ModelWithDataBindingWithoutDonothashBinding.java")); - - JavaFileObject generatedModel = - JavaFileObjects.forResource(GuavaPatch.patchResource("ModelWithDataBindingWithoutDonothashBindingModel_.java")); - - assert_().about(javaSources()) - .that(asList(packageInfo, binding, BR_CLASS, R)) - .processedWith(processors()) - .compilesWithoutError() - .and() - .generatesSources(generatedModel); - } } diff --git a/epoxy-processortest/src/test/resources/ModelWithDataBindingBindingModel_.java b/epoxy-processortest/src/test/resources/ModelWithDataBindingBindingModel_.java index 4ed00a1d5e..0533e60c1d 100644 --- a/epoxy-processortest/src/test/resources/ModelWithDataBindingBindingModel_.java +++ b/epoxy-processortest/src/test/resources/ModelWithDataBindingBindingModel_.java @@ -11,7 +11,8 @@ import java.lang.String; /** - * Generated file. Do not modify! */ + * Generated file. Do not modify! + */ public class ModelWithDataBindingBindingModel_ extends DataBindingEpoxyModel implements GeneratedModel, ModelWithDataBindingBindingModelBuilder { private OnModelBoundListener onModelBoundListener_epoxyGeneratedModel; @@ -49,7 +50,8 @@ public void handlePostBind(final DataBindingEpoxyModel.DataBindingHolder object, * The listener will contribute to this model's hashCode state per the {@link * com.airbnb.epoxy.EpoxyAttribute.Option#DoNotHash} rules. *

- * You may clear the listener by setting a null value, or by calling {@link #reset()} */ + * You may clear the listener by setting a null value, or by calling {@link #reset()} + */ public ModelWithDataBindingBindingModel_ onBind( OnModelBoundListener listener) { onMutation(); @@ -71,7 +73,8 @@ public void unbind(DataBindingEpoxyModel.DataBindingHolder object) { * The listener will contribute to this model's hashCode state per the {@link * com.airbnb.epoxy.EpoxyAttribute.Option#DoNotHash} rules. *

- * You may clear the listener by setting a null value, or by calling {@link #reset()} */ + * You may clear the listener by setting a null value, or by calling {@link #reset()} + */ public ModelWithDataBindingBindingModel_ onUnbind( OnModelUnboundListener listener) { onMutation(); diff --git a/gradle.properties b/gradle.properties index 2e808544e2..09ac61a195 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=4.1.0 +VERSION_NAME=4.2.0 GROUP=com.airbnb.android POM_DESCRIPTION=Epoxy is a system for composing complex screens with a ReyclerView in Android. POM_URL=https://github.com/airbnb/epoxy diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12d38de6a4..be52383ef4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kotlinsample/build.gradle b/kotlinsample/build.gradle index 0aeefe9bf3..4d31d9370e 100644 --- a/kotlinsample/build.gradle +++ b/kotlinsample/build.gradle @@ -1,7 +1,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-android-extensions' android {