epoxy

Epoxy is an Android library for building complex screens in a RecyclerView

APACHE-2.0 License

Stars
8.5K
Committers
85

Bot releases are hidden (Show)

epoxy - 5.1.4 Latest Release

Published by rossbacher 9 months ago

  • Change the way the Compose interop works to avoid Android 12 bug (#1370)
epoxy - 5.1.3

Published by elihart over 1 year ago

Update to kotlin 1.8.21
Fix click listener kapt bug (https://github.com/airbnb/epoxy/pull/1327)
Resolve unchecked call warning for WrappedEpoxyModelClickListener (https://github.com/airbnb/epoxy/pull/1337)
Fix refresh KDoc (https://github.com/airbnb/epoxy/pull/1334)
epoxy-kspsample : use ksp block to specify arguments (https://github.com/airbnb/epoxy/pull/1347)

epoxy - 5.1.2

Published by elihart over 1 year ago

Updates kotlin, ksp, and the xprocessing library.

Notably, the androidx.room:room-compiler-processing library (aka xprocessing) has been updated to 2.6.0-alpha01. This version is incompatible with previous versions due to a breaking API change. All annotation processors using this library must be on the same version. Other annotation processors such as Epoxy and Paris also use xprocessing and if you use them you need to use a version of them that also uses xprocessing 2.6.0-alpha01

epoxy - 5.1.1

Published by elihart almost 2 years ago

Remove incorrect ksp symbol validation

epoxy - 5.1.0

Published by elihart almost 2 years ago

Updates Kotlin to 1.7.20 and KSP to 1.7.20-1.0.7, as well as the room compiler processing (xprocessing) library to 2.5.0-beta01.

Also deletes the epoxy-paging artifact in favor of the newer epoxy-paging3

epoxy - 5.0.0

Published by elihart about 2 years ago

5.0.0

This adds support for Kotlin Symbol Processing, while maintaining backwards compatibility with java annotation processing via the xprocessing library from Room.

This includes a major version bump to 5.0.0 because there may be slight behavior differences with KSP, especially for generic types in generated code. For example, if you previously had an epoxy attribute in java source code with a raw type it may now appear in the generated code with a wildcard type, which may require tweaking the type that is passed to the model.

Additionally, some type checking was improved, for example more accurate validation of proper equals and hashcode implementations.

To use Epoxy with KSP, simply apply it with the ksp gradle plugin instead of kapt (https://github.com/google/ksp/blob/main/docs/quickstart.md). See the new epoxy-kspsample module for an example.

Note that unfortunately the databinding processor does NOT support KSP, simply because Android databinding itself uses KAPT and KSP cannot currently depend on KAPT sources. The code changes are in place to enable KSP with databinding once the databinding plugin from Android supports KSP (although this is unlikely) - alternatively it may be possible to configure the KSP plugin to run after KAPT and depend on its outputs (you're on your own if you want to try that).

Also, parallel processing support was removed because it is not compatible with KSP.

We have also added easy interop with Jetpack Compose via functions in the epoxy-composeinterop artifact.
See the epoxy-composesample module for example usage.

epoxy - 5.0.0-beta03

Published by elihart almost 3 years ago

Fixes an empty list crash in the processor when a view with @ModelView extends a subclass that has a @ModelProp annotation with a default parameter value.

epoxy - 5.0.0-beta02

Published by elihart almost 3 years ago

This adds support for Kotlin Symbol Processing, while maintaining backwards compatibility with java annotation processing via the xprocessing library from Room. Note that compilation speed with epoxy in KSP is not yet faster than KAPT due to some optimizations that remain to be made, but those should be made before long.

This includes a major version bump to 5.0.0 because there may be slight behavior differences with KSP, especially for generic types in generated code. For example, if you previously had an epoxy attribute in java source code with a raw type it may now appear in the generated code with a wildcard type, which may require tweaking the type that is passed to the model.

Additionally, some type checking was improved, for example more accurate validation of proper equals and hashcode implementations.

To use Epoxy with KSP, simply apply it with the ksp gradle plugin instead of kapt (https://github.com/google/ksp/blob/main/docs/quickstart.md). See the new epoxy-kspsample module for an example.

Note that unfortunately the databinding processor does NOT support KSP, simply because Android databinding itself uses KAPT and KSP cannot currently depend on KAPT sources. The code changes are in place to enable KSP with databinding once the databinding plugin from Android supports KSP (although this is unlikely) - alternatively it may be possible to configure the KSP plugin to run after KAPT and depend on its outputs (you're on your own if you want to try that).

Also, parallel processing support was removed because it is not compatible with KSP.

KSP Generated Sources in IDE

Note, that as of the current KSP version generated java sources are detected by the IDE but NOT generated kotlin sources. This means that generated epoxy kotlin extensions will not automatically be resolved in the IDE. You must manually configure your source sets to include ksp generated folders.

You can add this to your root build.gradle file to work around this

subprojects { project ->
    afterEvaluate {
        if (project.hasProperty("android")) {
            android {
                if (it instanceof com.android.build.gradle.LibraryExtension) {
                    libraryVariants.all { variant ->
                        def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
                        variant.addJavaSourceFoldersToModel(outputFolder)
                        android.sourceSets.getAt(variant.name).java {
                            srcDir(outputFolder)
                        }
                    }
                } else if (it instanceof com.android.build.gradle.AppExtension) {
                    applicationVariants.all { variant ->
                        def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
                        variant.addJavaSourceFoldersToModel(outputFolder)
                        android.sourceSets.getAt(variant.name).java {
                            srcDir(outputFolder)
                        }
                    }
                }
           }
      }
}

Of if you use kotlin build files you can apply it like this to a project.

    private fun Project.registerKspKotlinOutputAsSourceSet() {       
        afterEvaluate {
            val android: BaseExtension by lazy { extensions.findByType(BaseExtension::class.java) }

            requireAndroidVariants().forEach { variant ->
                val variantName = variant.name
                val outputFolder = File("build/generated/ksp/$variantName/kotlin")
                variant.addJavaSourceFoldersToModel(outputFolder)
                android.sourceSets.getAt(variantName).java {
                    srcDir(outputFolder)
                }
            }
        }
    }

/**
 * Return the Android variants for this module, or error if this is not a module with a known Android plugin.
 */
fun Project.requireAndroidVariants(): DomainObjectSet<out BaseVariant> {
    return androidVariants() ?: error("no known android extension found for ${project.name}")
}

/**
 * Return the Android variants for this module, or null if this is not a module with a known Android plugin.
 */
fun Project.androidVariants(): DomainObjectSet<out BaseVariant>? {
    return when (val androidExtension = this.extensions.findByName("android")) {
        is LibraryExtension -> {
            androidExtension.libraryVariants
        }
        is AppExtension -> {
            androidExtension.applicationVariants
        }
        else -> null
    }
}
epoxy - 4.6.3

Published by vinaygaba about 3 years ago

  • Add EpoxyModel#preBind hook(#1225)
  • Add unbind extension to ItemViewBindingEpoxyHolder (#1223)
  • Add missing loadStateFlow to PagingDataEpoxyController (#1209)
epoxy - 4.6.2

Published by elihart over 3 years ago

Fix Drag n Drop not working in 4.6.1 (#1195)

epoxy - 4.6.1

Published by elihart over 3 years ago

4.6.1 (May 13, 2021)

Adds "epoxyDisableDslMarker" annotation processor flag which you can use to delay migration to the model building scope DLSMarker introduced in 4.6.0 if it is a large breaking change for your project.

Note that this only applies to your project modules that you apply it to, and does not apply to the handful of models that ship with the Epoxy library (like the Carousel or group builder).

For example:

project.android.buildTypes.all { buildType ->
    buildType.javaCompileOptions.annotationProcessorOptions.arguments =
            [
                    epoxyDisableDslMarker     : "true",
            ]
}
epoxy - 4.6.0

Published by elihart over 3 years ago

4.6.0 (May 12, 2021)

New Feature!

Epoxy View Binder (#1175) Bind epoxy models to views outside of a RecyclerView.

Potentially Breaking

  • Use kotlin dsl marker for model building receivers (#1180)

This change uses Kotlin's DSL marker annotation to enforce proper usage of model building extension
functions. You may now need to change some references in your model building code to explicitly reference properties with this.

epoxy - 4.5.0

Published by elihart over 3 years ago

Fix generated code consistency in builder interfaces (#1166)
Provided support to invalidate modelCache in PagingDataEpoxyController (#1161)
Explicitly add public modifier (#1162)
Unwrap context to find parent activity in order to share viewpool when using Hilt (#1157)

epoxy - 4.4.4

Published by elihart over 3 years ago

Provide support for snapshot() function in PagingDataEpoxyController (#1144)

epoxy - 4.4.3

Published by vinaygaba over 3 years ago

Fixed a bug so that the model class generated for an interface uses the package name of the module its generated in.

epoxy - 4.4.2

Published by vinaygaba over 3 years ago

A minor regression was introduced from this PR(https://github.com/airbnb/epoxy/commit/fa61cfbc4059f88a3e89644ab21b3f8d70aa7c57). Avoid using this release and wait for the next one with the fix.

epoxy - 4.4.1

Published by elihart over 3 years ago

Support for Paging3 (#1126) (Thanks to @osipxd and @anhanh11001!)
Update KotlinPoet to 1.7.2 (#1117)

epoxy - 4.3.1

Published by elihart almost 4 years ago

  • Fix ANR and view pool resolution in nested group (#1101)
  • ModelGroupHolder get recycle pool from parent (#1097)
  • Add support for EpoxyModelGroup in the EpoxyVisibilityTracker (#1091)
  • Convert EpoxyVisibilityTracker code to Kotlin (#1090)

Breaking Changes

Note that due to the conversion of EpoxyVisibilityTracker to kotlin you now need to access - EpoxyVisibilityTracker.partialImpressionThresholdPercentage as a property
epoxyVisibilityTracker.setPartialImpressionThresholdPercentage(value) -> epoxyVisibilityTracker.partialImpressionThresholdPercentage = value`

Also, the ModelGroupHolder improvement required the ModelGroupHolder#createNewHolder function to change its signature to accept a ViewParent parameter.

If you override createNewHolder() anywhere you will need to change it to createNewHolder(@NonNull ViewParent parent)

epoxy - 4.2.0

Published by elihart almost 4 years ago

  • Add notify model changed method (#1063)
  • Update to Kotlin 1.4.20-RC and remove dependency on kotlin-android-extensions
epoxy - 4.1.0

Published by elihart about 4 years ago

  • Fix some synchronization issues with the parallel Epoxy processing option
  • Add view visibility checks to EpoxyVisibilityItem and decouple RecyclerView #1052