Skip to content

Commit

Permalink
View Binder Support (#1175)
Browse files Browse the repository at this point in the history
* Initial addition of view binder classes

* Hook up visibility tracking
Add view binder to kotlin sample

* EpoxyViewBinder update - add epoxyView / optionalEpoxyView to ViewGroup (#1165)

* Add epoxyView shortcut to ViewGroup

* Add optionalEpoxyView for activity and view (with a minor refactor for less copy/paste)

* switch to `androidx.core.app.ComponentActivity`

Co-authored-by: Emmanuel Boudrant <eboudrant@netflix.com>

* [View Binder] Add visibility tracker tests and API tweaks (#1168)

* Add view binder visibility tests

* Add basic unit tests for the view binder

* Gradle clean up

* Can't use ComponentActivity directly with the current dependency version

Co-authored-by: Peter Elliott <peter.elliott@airbnb.com>

* Set packageid to com.airbnb.epoxy.viewbinder (#1172)

* package="com.airbnb.epoxy.viewbinder"

* import com.airbnb.epoxy.viewbinder.R

* Doc cleanup and refactors for line length

* Move some extension functions to new file
Some documentation tweaks

* Add tests
Add try/catch and fix up dependencies

* Fix dependency mismatch
Add newline

* Add model update test

* Apply suggestions from code review

Co-authored-by: Eli Hart <eli.hart@airbnb.com>

* Convert to ModelCollector
Add exception handler
Misc improvements based on PR comments

* Fix comment and lint failures

* Don't use debugImplementation as CI runs release tests

* Fix tests due to model collector swap

Co-authored-by: Peter Elliott <peter.elliott@airbnb.com>
Co-authored-by: Emmanuel Boudrant <emmanuel.boudrant@gmail.com>
Co-authored-by: Emmanuel Boudrant <eboudrant@netflix.com>
Co-authored-by: Eli Hart <eli.hart@airbnb.com>
  • Loading branch information
5 people committed May 8, 2021
1 parent 7a532df commit 35d3f77
Show file tree
Hide file tree
Showing 23 changed files with 2,363 additions and 15 deletions.
8 changes: 7 additions & 1 deletion blessedDeps.gradle
Expand Up @@ -19,6 +19,9 @@ rootProject.ext.ANDROIDX_RECYCLERVIEW = "1.1.0"
rootProject.ext.ANDROIDX_MATERIAL = "1.0.0"
rootProject.ext.ANDROIDX_APPCOMPAT = "1.0.0"
rootProject.ext.ANDROIDX_CARDVIEW = "1.0.0"
rootProject.ext.ANDROIDX_CORE_KTX = "1.0.0"
rootProject.ext.ANDROIDX_ESPRESSO_CORE = "3.3.0"
rootProject.ext.ANDROIDX_FRAGMENT_TESTING= "1.3.3"
rootProject.ext.ANDROIDX_LEGACY = "1.0.0"
rootProject.ext.ANDROIDX_PAGING = "2.0.0"
rootProject.ext.ANDROIDX_PAGING3 = "3.0.0-alpha13"
Expand All @@ -42,7 +45,7 @@ rootProject.ext.ASSERTJ_VERSION = "1.7.1"
rootProject.ext.GOOGLE_TESTING_COMPILE_VERSION = "0.19"
rootProject.ext.JUNIT_VERSION = "4.13.1"
rootProject.ext.MOCKITO_VERSION = "3.7.7"
rootProject.ext.ROBOLECTRIC_VERSION = "4.4"
rootProject.ext.ROBOLECTRIC_VERSION = "4.5.1"

rootProject.ext.LOTTIE_VERSION = "2.8.0"

Expand All @@ -61,7 +64,10 @@ rootProject.ext.deps = [
androidRuntime : "com.google.android:android:$ANDROID_RUNTIME_VERSION",
androidAppcompat : "androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT",
androidCardView : "androidx.cardview:cardview:$ANDROIDX_CARDVIEW",
androidCoreKtx : "androidx.core:core-ktx:$ANDROIDX_CORE_KTX",
androidDesignLibrary : "com.google.android.material:material:$ANDROIDX_MATERIAL",
androidEspressoCore : "androidx.test.espresso:espresso-core:$ANDROIDX_ESPRESSO_CORE",
androidFragmentTesting : "androidx.fragment:fragment-testing:$ANDROIDX_FRAGMENT_TESTING",
androidRecyclerView : "androidx.recyclerview:recyclerview:$ANDROIDX_RECYCLERVIEW",
androidPagingComponent : "androidx.paging:paging-runtime:$ANDROIDX_PAGING",
androidPaging3Component: "androidx.paging:paging-runtime:$ANDROIDX_PAGING3",
Expand Down
9 changes: 5 additions & 4 deletions epoxy-integrationtest/build.gradle
Expand Up @@ -42,12 +42,15 @@ android {

dependencies {
implementation rootProject.deps.kotlin
implementation rootProject.deps.androidRecyclerView
implementation rootProject.deps.androidAppcompat
implementation rootProject.deps.androidFragmentTesting
implementation rootProject.deps.androidPagingComponent
implementation rootProject.deps.androidRecyclerView
implementation project(':epoxy-adapter')
implementation project(':epoxy-annotations')
implementation project(':epoxy-databinding')
implementation project(':epoxy-paging')
implementation project(':epoxy-viewbinder')

kapt project(':epoxy-processor')

Expand All @@ -57,9 +60,7 @@ dependencies {
testImplementation rootProject.deps.mockito_inline
testImplementation rootProject.deps.androidTestCore
testImplementation rootProject.deps.androidTestExtJunitKtx
testImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation rootProject.deps.androidEspressoCore
}

repositories {
Expand Down
Expand Up @@ -6,6 +6,8 @@
import com.airbnb.epoxy.EpoxyModel;
import com.airbnb.epoxy.EpoxyModelClass;

import androidx.annotation.NonNull;

@EpoxyModelClass
public abstract class Model extends EpoxyModel<TextView> {
@EpoxyAttribute public int value;
Expand All @@ -14,4 +16,9 @@ public abstract class Model extends EpoxyModel<TextView> {
protected int getDefaultLayout() {
return R.layout.model_with_click_listener;
}

@Override
public void bind(@NonNull TextView view) {
view.setText(String.valueOf(value));
}
}
@@ -1,8 +1,8 @@
package com.airbnb.epoxy.integrationtest

import android.app.Activity
import androidx.appcompat.app.AppCompatActivity

/**
* Empty activity used for view testing.
*/
class TestActivity : Activity()
class TestActivity : AppCompatActivity()

0 comments on commit 35d3f77

Please sign in to comment.