Skip to content

Commit

Permalink
Merge pull request #1 from evant/master
Browse files Browse the repository at this point in the history
Update from source repo
  • Loading branch information
wongcain authored Jun 28, 2019
2 parents ca8749e + f669eda commit 98a3138
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 129 deletions.
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-28-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
# - run:
# name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
# command: sudo chmod +x ./gradlew
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew test
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: app/build/reports
destination: reports
- store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: app/build/test-results
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo "$MAVEN_CENTRAL_SEC_RING" | base64 -d > $HOME/secring.gpg
gpg --import --batch $HOME/secring.gpg
./gradlew publish -Psonatype.username="$SONATYPE_USERNAME" -Psonatype.password="$SONATYPE_PASSWORD" -Psigning.keyId=34BCD878 -Psigning.password="$MAVEN_CENTRAL_KEY_PASSPHRASE" -Psigning.secretKeyRingFile=$HOME/secring.gpg -Porg.gradle.parallel=false
fi
workflows:
version: 2
build:
jobs:
- build:
context: opensource-maven
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Unreleased
### 3.0.0
- Removed `LayoutManagers`. RecyclerView has support setting the LayoutManager in xml using it's
class name that doesn't rely on databinding.
- Added `AsyncDiffObservableList` which is based on `AsyncListDiffer`. You should prefer this over
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ Easy way to bind collections to listviews and recyclerviews with the new [Androi

## Download

If you are using androidx use version `3.0.0`, this also uses databinding v2

```groovy
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.2.0'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.2.0'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:3.0.0'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:3.0.0'
```
requires at least android gradle plugin `2.3.0`.

If you want to try out [databinding v2](https://developer.android.com/topic/libraries/data-binding/start#preview-compiler)
you can use version `2.3.0-beta3`
otherwise, you can try out [databinding v2](https://developer.android.com/topic/libraries/data-binding/start#preview-compiler)
with version `2.3.0-beta3`

```groovy
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.3.0-beta3'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.3.0-beta3'
```

If you are using androidx use version `3.0.0-beta3`, this also uses databinding v2
or use the previous stable version

```groovy
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:3.0.0-beta3'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:3.0.0-beta3'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.2.0'
compile 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.2.0'
```

## Usage
Expand Down
3 changes: 0 additions & 3 deletions bindingcollectionadapter-ktx/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'
apply plugin: 'kotlin-android'

android {
Expand Down
12 changes: 5 additions & 7 deletions bindingcollectionadapter-paging/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'

android {
Expand Down Expand Up @@ -34,17 +32,17 @@ android {

dependencies {
implementation project(':bindingcollectionadapter-recyclerview')
implementation 'androidx.paging:paging-runtime:2.0.0-rc01'
implementation 'androidx.paging:paging-runtime:2.0.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.6.2'
testImplementation 'org.mockito:mockito-core:2.19.0'

androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test:rules:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'com.squareup.assertj:assertj-android:1.1.0'
androidTestImplementation 'androidx.core:core:1.0.0-rc02'
androidTestImplementation 'androidx.core:core:1.0.0'
}

apply from: '../publish.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import java.util.Arrays;

import me.tatarka.bindingcollectionadapter2.collections.DiffObservableList;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -40,7 +42,7 @@ public void removeOneItem() {
assertThat(list).isEmpty();
verify(callback).onItemRangeRemoved(list, 0, 1);
}

@Test
public void moveOneItem() {
DiffObservableList<Item> list = new DiffObservableList<>(Item.DIFF_CALLBACK);
Expand All @@ -54,7 +56,7 @@ public void moveOneItem() {
.containsExactly(new Item("2", "b"), new Item("1", "a"));
verify(callback).onItemRangeMoved(list, 1, 0, 1);
}

@Test
public void changeItem() {
DiffObservableList<Item> list = new DiffObservableList<>(Item.DIFF_CALLBACK);
Expand All @@ -68,7 +70,7 @@ public void changeItem() {
.containsExactly(new Item("1", "b"));
verify(callback).onItemRangeChanged(list, 0, 1);
}


static class Item {

Expand Down
13 changes: 5 additions & 8 deletions bindingcollectionadapter-recyclerview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'

android {
compileSdkVersion 28
Expand Down Expand Up @@ -34,17 +31,17 @@ android {

dependencies {
api project(':bindingcollectionadapter')
api 'androidx.recyclerview:recyclerview:1.0.0-rc02'
api 'androidx.recyclerview:recyclerview:1.0.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.6.2'
testImplementation 'org.mockito:mockito-core:2.19.0'

androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test:rules:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'com.squareup.assertj:assertj-android:1.1.0'
androidTestImplementation 'androidx.core:core:1.0.0-rc02'
androidTestImplementation 'androidx.core:core:1.0.0'
}

apply from: '../publish.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ public ViewDataBinding onCreateBinding(@NonNull LayoutInflater inflater, @Layout

@Override
public void onBindBinding(@NonNull ViewDataBinding binding, int variableId, @LayoutRes int layoutRes, int position, T item) {
if (itemBinding.bind(binding, item)) {
boolean bound = itemBinding.bind(binding, item);
binding.setLifecycleOwner(lifecycleOwner);
if (bound) {
binding.executePendingBindings();
}
}
Expand Down Expand Up @@ -195,8 +197,6 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position, @NonNull
if (isForDataBinding(payloads)) {
binding.executePendingBindings();
} else {
binding.setLifecycleOwner(lifecycleOwner);

T item = items.get(position);
onBindBinding(binding, itemBinding.variableId(), itemBinding.layoutRes(), position, item);
}
Expand Down
13 changes: 5 additions & 8 deletions bindingcollectionadapter/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'

android {
compileSdkVersion 28
Expand Down Expand Up @@ -33,16 +30,16 @@ android {
}

dependencies {
implementation 'androidx.core:core:1.0.0-rc02'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0-rc02'
implementation 'androidx.core:core:1.0.0'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.6.2'
testImplementation 'org.mockito:mockito-core:2.19.0'

androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test:rules:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'com.squareup.assertj:assertj-android:1.1.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public ViewDataBinding onCreateBinding(@NonNull LayoutInflater inflater, @Layout

@Override
public void onBindBinding(@NonNull ViewDataBinding binding, int variableId, @LayoutRes int layoutRes, int position, T item) {
if (itemBinding.bind(binding, item)) {
boolean bound = itemBinding.bind(binding, item);
binding.setLifecycleOwner(lifecycleOwner);
if (bound) {
binding.executePendingBindings();
}
}
Expand Down Expand Up @@ -166,7 +168,6 @@ public final View getView(int position, @Nullable View convertView, @NonNull Vie
}

View view = binding.getRoot();
binding.setLifecycleOwner(lifecycleOwner);

T item = items.get(position);
onBindBinding(binding, itemBinding.variableId(), layoutRes, position, item);
Expand Down Expand Up @@ -194,7 +195,6 @@ public final View getDropDownView(int position, @Nullable View convertView, @Non
}

View view = binding.getRoot();
binding.setLifecycleOwner(lifecycleOwner);

T item = items.get(position);
onBindBinding(binding, itemBinding.variableId(), layoutRes, position, item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public ViewDataBinding onCreateBinding(@NonNull LayoutInflater inflater, @Layout

@Override
public void onBindBinding(@NonNull ViewDataBinding binding, int variableId, @LayoutRes int layoutRes, int position, T item) {
if (itemBinding.bind(binding, item)) {
boolean bound = itemBinding.bind(binding, item);
binding.setLifecycleOwner(lifecycleOwner);
if (bound) {
binding.executePendingBindings();
binding.setLifecycleOwner(lifecycleOwner);
}
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.61'
ext.agp_version = '3.2.0-rc02'
ext.kotlin_version = '1.3.0'
ext.agp_version = '3.3.0'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$agp_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'digital.wup:android-maven-publish:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# org.gradle.parallel=true

group=me.tatarka.bindingcollectionadapter2
version=3.0.0-SNAPSHOT
version=3.0.0
android.databinding.enableV2=true
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Loading

0 comments on commit 98a3138

Please sign in to comment.