diff --git a/README.md b/README.md
index 5732648..c6b7f47 100644
--- a/README.md
+++ b/README.md
@@ -22,11 +22,27 @@ There are some gifs from Demo:
- selectAll/deselectAll
- getAllSelectedNodes
+Now supports [sevar83's IndeterminateCheckBox](https://github.com/sevar83/indeterminate-checkbox) as well as Android's android.widget.CheckBox
+
### Usage
**1.Reference the library from your module's build.gradle:**
-```groovy
-compile 'me.texy.treeview:treeview_lib:1.0.3'
-```
+1. You need to have this in your project's `build.gradle` file:
+
+ ```Gradle
+ allprojects {
+ repositories {
+ jcenter()
+ maven { url "https://jitpack.io" }
+ }
+ }
+ ```
+2. You need this in your app's module `build.gradle` file:
+ ```Gradle
+ dependencies {
+ compile 'com.github.penguin86:TreeView:1.0.5@aar'
+ }
+ ```
+
**2.Implement your all level's BaseNodeViewBinder**
Sampleļ¼
diff --git a/app/build.gradle b/app/build.gradle
index f90b194..0f1e216 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 25
+ compileSdkVersion 27
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "me.texy.treeviewdemo"
@@ -24,10 +24,11 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:25.0.0'
- compile 'com.android.support:recyclerview-v7:25.0.0'
+ compile 'com.android.support:appcompat-v7:27.0.2'
+ compile 'com.android.support:recyclerview-v7:27.0.2'
testCompile 'junit:junit:4.12'
compile project(':treeview_lib')
// compile 'me.texy.treeview:treeview_lib:1.0.1'
+ compile 'com.github.sevar83:indeterminate-checkbox:1.0.5@aar'
}
diff --git a/app/src/main/res/layout/item_first_level.xml b/app/src/main/res/layout/item_first_level.xml
index 2df1cbb..b06cb8f 100644
--- a/app/src/main/res/layout/item_first_level.xml
+++ b/app/src/main/res/layout/item_first_level.xml
@@ -30,7 +30,7 @@
-
-
- selectParentIfNeedWhenNodeSelected(TreeNode treeNod
parent.setSelected(true);
impactedParents.add(parent);
impactedParents.addAll(selectParentIfNeedWhenNodeSelected(parent, true));
+ } else if(select){
+ impactedParents.add(parent);
+ impactedParents.addAll(selectParentIfNeedWhenNodeSelected(parent, true));
} else if (!select && selectedBrotherCount == brothers.size() - 1) {
// only the condition that the size of selected's brothers
// is one less than total count can trigger the deselect
parent.setSelected(false);
impactedParents.add(parent);
impactedParents.addAll(selectParentIfNeedWhenNodeSelected(parent, false));
+ } else {
+ // only some selected/deselected: refresh parent view
+ impactedParents.add(parent);
+ impactedParents.addAll(selectParentIfNeedWhenNodeSelected(parent, false));
}
return impactedParents;
}