Skip to content

Commit 5cc6281

Browse files
author
Rafael Dominiquini
committed
Merge remote-tracking branch 'davideas/dev' into dev
2 parents 06618a7 + 320e441 commit 5cc6281

File tree

95 files changed

+2463
-1173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2463
-1173
lines changed

ISSUE_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Please check off the following points BEFORE submitting a new issue / asking support.
2+
- [ ] Write a self explanatory Subject.
3+
4+
1) For Bugs / Support
5+
- [ ] What you've tried (If necessary, indicate library Version / Android version / hardware)
6+
- [ ] Expected behavior and actual behavior (problem encountered)
7+
- [ ] Steps to reproduce the problem (also include code snippets if you think will help)
8+
9+
2) For questions / new feature / improvement
10+
- [ ] Simply Erase all this text and ask your question;
11+
12+
3) To have your App added to the list
13+
- [ ] Simply Erase all this text and provide your app's name and link.

README.md

Lines changed: 79 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55

66
# FlexibleAdapter
77

8-
###### A pattern for every RecyclerView
9-
- Stable _light_ version: 4.2 built on 2015.12.16
10-
- NEW! Beta version: 5.0.0-b6 built on 2016.05.01 (usable library!)
8+
###### The only Adapter multi-function for your RecyclerView
9+
- NEW! Beta version: 5.0.0-b7 built on 2016.06.20 (usable library!) (111KB)
1110

1211
####ANNOUNCEMENT: Important and Revolutionary changes are foreseen in v5.0.0. Please see [issues](https://github.com/davideas/FlexibleAdapter/issues) and [releases](https://github.com/davideas/FlexibleAdapter/releases).
1312

14-
> When initially Android introduced the RecyclerView widget, we had to implement the Adapter in several applications, again and again to provide the items for our views. Since I created this library, it has become easy to configure how views will be displayed in a list. Thanks to a library like this, nobody wants to use a ListView anymore.
13+
> When initially Android introduced the RecyclerView widget, we had to implement a custom Adapter in several applications, again and again to provide the items for our views. Since I created this library, it has become easy to configure how views will be displayed in a list. Thanks to a library like this, nobody wants to use a ListView anymore.
1514
16-
The FlexibleAdapter helps developers to simplify this process without to worry about the adapter anymore. It's easy to extends, it has predefined logic for different situations and prevents common mistakes.
15+
The FlexibleAdapter helps developers to simplify this process without to worry about the Adapter anymore. It's easy to extend, it has predefined logic for different situations and prevents common mistakes.
1716
This library is configurable and it guides the developers (thanks to quality comments on the methods) to create a better user experience and now, even more with the new ViewHolders and new actions.
1817

1918
#### Main functionalities
2019
* Simple item selection with ripple effect, Single & Multi selection mode.
2120
* Restore deleted items (undo delete), **NEW** works with Expandable items too!
22-
* FastScroller, **NEW** now in the library and with GridLayout support.
21+
* FastScroller, **NEW** now in the library supporting all the 3 Layouts.
2322
* Customizable ItemDecoration.
2423
* SearchFilter with Spannable text, **NEW** now items are animated. Works with sub items too!
2524
* Add and Remove items with custom animations.
@@ -29,12 +28,14 @@ This library is configurable and it guides the developers (thanks to quality com
2928
* **NEW!** Drag&Drop and Swipe-To-Dismiss with Leave-Behind pattern, with <u>Selection Coherence</u>.
3029
* **NEW!** Headers/Sections with sticky behaviour fully clickable, collapsible, automatic linkage!
3130
* **NEW!** Auto mapping ViewTypes with Item interfaces.
32-
* **NEW!** 1 simple constructor for all events.
33-
* **NEW!** EndlessScroll with Adapter binding.
31+
* **NEW!** Innovative EndlessScroll with Adapter binding (<u>No OnScrollListener</u>).
3432
* **NEW!** UndoHelper &amp; ActionModeHelper.
33+
* **NEW!** DrawableUtils for dynamic backgrounds (<u>No XML</u>).
34+
* **NEW!** 1 simple constructor for all events.
35+
* **NEW!** Easy runtime position calculation for adding/moving items in sections.
3536

3637
#### How is made
37-
Some simple functionalities have been implemented thanks to the some Blogs (see at the bottom of the page), merged and methods have been improved for speed and scalability, for all Activities that use a RecyclerView.
38+
Some simple functionalities have been implemented thanks to some Blogs (see at the bottom of the page), merged and methods have been improved for speed and scalability, for all Activities that use a RecyclerView.
3839

3940
* At lower level there is `SelectableAdapter` class. It provides selection functionalities and it's able to _maintain the state_ after the rotation: you just need to call the onSave/onRestore methods from the Activity!
4041
* At middle level, the `AnimatorAdapter` class has been added to give some animation at startup and when user scrolls.
@@ -47,15 +48,16 @@ Some simple functionalities have been implemented thanks to the some Blogs (see
4748
![StickyHeaders & EndlessScrolling](/screenshots/sticky_headers.png)
4849

4950
![Multi Selection & SC](/screenshots/multi_selection_sc.png)
50-
![Search](/screenshots/search_sections.png)
5151
![Undo](/screenshots/undo_single_selection.png)
52-
5352
![Drag Linear](/screenshots/drag_linear.png)
53+
54+
![Search](/screenshots/search_sections.png)
5455
![swipe-to-dismiss1](/screenshots/swipe-to-dismiss1.png)
5556
![swipe-to-dismiss2](/screenshots/swipe-to-dismiss2.png)
5657

5758
![Adapter Animations](/screenshots/adapter_animations.png)
5859
![Dynamic Sections](/screenshots/dynamic_sections.png)
60+
![Staggered Layout](/screenshots/dynamic_staggered_layout.png)
5961

6062
# Setup
6163
```
@@ -67,13 +69,9 @@ repositories {
6769
```
6870
```
6971
dependencies {
70-
//Using bintray.com
71-
compile 'eu.davidea:flexible-adapter:4.2.0@aar'
72-
compile 'eu.davidea:flexible-adapter:5.0.0-b6@aar'
73-
7472
//Using JCenter
7573
compile 'eu.davidea:flexible-adapter:4.2.0'
76-
compile 'eu.davidea:flexible-adapter:5.0.0-b6'
74+
compile 'eu.davidea:flexible-adapter:5.0.0-b7'
7775
7876
//Using MavenSnapshots repository for continuous updates from my development
7977
compile 'eu.davidea:flexible-adapter:5.0.0-SNAPSHOT'
@@ -82,7 +80,7 @@ dependencies {
8280

8381
#### Pull requests / Issues / Improvement requests
8482
Feel free to contribute and ask!<br/>
85-
Active discussion [Test FlexibleAdapter v5.0.0](https://github.com/davideas/FlexibleAdapter/issues/39).
83+
Active discussion [Snapshots and Pre-Releases for FlexibleAdapter v5.0.0](https://github.com/davideas/FlexibleAdapter/issues/39).
8684

8785
# Wiki!
8886
I strong suggest to read the **new [Wiki](https://github.com/davideas/FlexibleAdapter/wiki) pages**.
@@ -92,57 +90,72 @@ Wiki pages have been completely reviewed to support all the coming functionaliti
9290
Not all pages are filled, working in progress :-)
9391

9492
# Change Log
95-
###### v5.0.0-b6 - 2016.05.01
96-
_Refactor_
97-
- Removed `isSelected()` and `setSelected()` from `IFlexible` interface.
98-
- Deprecated and removed `getSectionableOf()` in favor of the new `getSectionItems()`.
99-
- Improved instance state on rotation.
100-
- Renamed package `eu.davidea.examples` in `eu.davidea.samples`.
93+
###### v5.0.0-b7 - 2016.06.20
94+
_Deprecation and Refactoring_ (Changes that you have to take care from all previous versions)
95+
- Refactored class signature for `IHeader` and `IExpandable` and their abstract implementation, [see #117].
96+
- Refactored method `moveItem()` to `swapItem()`.
97+
- Separated the initialization of expanded items at start up [see #86]: `expandItemsAtStartUp()` must be explicitly called by the user in Activity creation phase, `expandItemsAtStartUp()` method now uses the existent `expand()` method with initialization info.
98+
- Items are _NOT_ Draggable and Swipeable by default.
99+
- Experimenting `TreeSet` instead of `ArrayList` for `mSelectedPositions`. As consequence `getSelectedPositions()` returns a _copied_ List from the Set (already sorted, no duplication)!
100+
- Deprecated method `addSection()` with refHeader, will be removed from next release.
101101

102102
_Improvements_
103-
- Brand new Swipe-To-Dismiss implementation: added custom rear views _Left/Right_! [See #21].
104-
- Added `UndoHelper` [See #29].
105-
- Added `ActionModeHelper` [See #30].
106-
- Added **EndlessScroll/OnLoadMore**, using adapter binding, _not scroll listener!_ [See #43].
107-
- Modified `DividerItemDecorator` to accept a custom resource and gap between sections [See #60].
108-
- New methods: `addSection()`, `addItemToSection()` [See #62].
109-
- Improved `isEnabled()` on `IExpandable` items.
110-
- Improved methods `getSectionItems()` and `getHeaderItems()`.
111-
- Support for `StaggeredGridLayoutManager` when using Adapter Animation.
112-
- Added possibility to filter Header item AND to keep the header also if a subItem has been filtered in [See #73].
113-
114-
_Multi-level expansion_
115-
- Added possibility to chain Expandable items into others expandable [See #63].
116-
- Item restoration works in multi-level expansion: expanded children are forced to collapse before restoration.
117-
- Selection coherence in multi-level expansion.
118-
119-
_FastScroller_
120-
- Added a small gap between bubble and handle.
121-
- Auto handling a change of a new LayoutManager when `FastScroller` is configured. Now FastScroller should work in every situations.
122-
- Added SmoothScroll for `GridLayoutManager` and optimized smooth scrolling classes.
103+
- Dragging and swiping can be enabled by type [see #80].
104+
- Alpha animation, when enabling / disabling sticky headers.
105+
- Added new method `getItemTouchHelperCallback()` to customize Swipe and Drag behaviors.
106+
- Added new method `calculatePositionFor()`.
107+
- Added new method `addSection()` with Comparator object.
108+
- Added new method `moveItem()` that simply moves an item without swapping it.
109+
- Added new method `calculatePositionFor()` useful for new items of every type, a custom `Comparator` is needed.
110+
- Improved method `addItemToSection()` see JavaDoc.
111+
- Improved method `updateDataSet()`, optionally items can be animated, when `false` a `notifyDataSetChanged()` will be executed.
112+
- Added 2 new overload methods for `expand()` series [see #110].
113+
- Added class `UndoHelper.SimpleActionListener` to simplify the development.
114+
- Added class `DrawableUtils` to manage the background Drawables at runtime without XML configuration [see #35].
115+
- Added new base interface `OnActionStateListener` for `OnItemMoveListener` and `OnItemSwipeListener` to overcome the drag issue with the `SwipeRefreshLayout`, [see #104 and #83].
116+
- Added possibility to change mode how `DividerItemDecorator` is drawn, over or (default) underneath the item [see #106].
117+
- Added `applyAndAnimateMovedItems()` when using `animateTo()` (in filter and `updateDataSet()`).
118+
- Full support for `StaggeredGridLayout` [see #107].
119+
- Better selection management: made public `addSelection()`, `removeSelection()`, the new 2 methods don't notify any change as `toggleSelection()` does.
120+
- `Utils.colorAccent` is now public.
121+
- `onUpdateEmptyView()` is now called only if there was a change from 0 / to 0 itemCount [see #113].
122+
- Chaining the Adapter for all initialization and configuration methods (sets).
123+
- Upgrade to SupportLib 23.4.0.
123124

124125
_Fixes_
125-
- Fixed inconsistency bug when expanding/collapsing _sticky_ header items _not_ fully visible.
126-
- Fixed StickyHeaders with `GridLayoutManager` when all sub-items of a section fit the single row of span count [See #61].
127-
- Fixed #74: Initialization of the stickyHeader is laid out in post.
128-
- Fixed the automatic linkage for headers and sections when delete and undo.
129-
- Fixed the automatic linkage for headers and sections. Force collapsing when dragging expandable.
130-
- Fixed NPE when setting a null `FastScroller` instance [See #66].
131-
- Fixed new position in `addSection()`.
132-
- Adjusted behaviours for swipe and drag view activation.
133-
- Fixed the delay on the 1st item when animating the view.
126+
- Fixed headers showing after rotation [see #88].
127+
- Fixed `addItemToSection` when Header is hidden: item is now added to the unique visible list.
128+
- Solution to improve ViewHolder with sticky behaviour, (user has to pass `true` as new parameter to the FVH super.constructor). [see #78, #79 and #92].
129+
- Removed useless call in `onChanged()`, causing duplication of subItems when updating the data set [see #95 and #96].
130+
- Fixed hidden status when removing a Header item.
131+
- Fixed Item does not updated after `updateDataSet()` [see #94].
132+
- Fixed NPE bug during filter and null subList [see #103].
133+
- Fixed NPE on originalText in `Utils.hightlightText()` [see #112].
134+
- Fixed expansion status after filtering expandable items.
135+
- Fixed animation changes when calling method `animateTo()`.
136+
- Fixed ArrayIndexOutOfBoundsException with StaggeredGridLayoutManager [see #87, part of changes of #107].
137+
- Adjusted selection flags when removing items and fixed small bug when restoring items after applying the filter and vice-versa.
138+
- Method `onUpdateEmptyView()` is now called when passing null or empty new list in `updateDataSet()`.
139+
- Filter on restore instance state bug [see #111].
140+
- Fixed header View params when higher than Item view params [see P.R. #116].
141+
- Fixed Constraint on `FlexibleViewHolder` when using StickyHeader functionality, as consequence changed class signature of `IHeader` item interface and its implementation. Also changed the class signature of `IExpandable` item interface and its implementation to have a ViewHolder of type `ExpandableViewHolder` as well [see #117].
134142

135143
_Demo App_
136-
- Big code reorganization using fragments [See #36].
137-
- Fixed #64 for demo app for API < 23.
138-
- Enabled Header and Sections example with Design BottomSheet.
139-
- Enabled FragmentSelectionModes example.
140-
- Enabled Instagram example with Endless Scroll with Glide lib.
144+
- Added new example Fragment for StaggeredLayout with multiple functionalities:
145+
- merge/split items at runtime (position are recalculated);
146+
- move item with animation taking care of the groups using the new function `calculatePositionFor()`;
147+
- automatic sorting when adding new items using the new function `addItemToSection()`;
148+
- example of Comparator object;
149+
- change Drawable background at runtime, maintaining the ripple effect (no XML is used).
150+
- Fix for SwipeRefreshLayout to be displayed on the top of StickyHeaders Layout [see #83].
151+
- SwipeRefresh with StickyHeader is not compatible with Dragging feature, added comments in the layout to show the difference #83: User must disable the SwipeRefreshLayout programmatically, to do it, I added a new callback function and relative listener `OnActionStateListener`.
152+
- Adjusted demo App behavior when filtering with Endless Scrolling.
153+
- Several minor changes.
141154

142155
###### Old releases
143156
See [releases](https://github.com/davideas/FlexibleAdapter/releases) for old versions.
144157

145-
v5.0.0-b5 - 2016.04.04 |
158+
v5.0.0-b6 - 2016.05.01 | v5.0.0-b5 - 2016.04.04 |
146159
v5.0.0-b4 - 2016.02.21 | v5.0.0-b3 - 2016.02.08 |
147160
v5.0.0-b2 - 2016.01.31 | v5.0.0-b1 - 2016.01.03 |
148161
v4.2.0 - 2015.12.12 | v4.1.0 - 2015.11.29 |
@@ -151,6 +164,10 @@ v3.1 - 2015.08.18 | v3.0 - 2015.07.29 |
151164
v2.2 - 2015.07.20 | v2.1 - 2015.07.03 |
152165
v2.0 - 2015.06.19 | v1.0 - 2015.05.03
153166

167+
# Limitations
168+
Item half swipe cannot be implemented due to how the `android.support.v7.widget.helper.ItemTouchHelper` is done.
169+
Half swipe can be done with others means, please see issues #98 and #100. See also commits of Apr 25, 2016.
170+
154171
# Thanks
155172
I've used these blogs as starting point:
156173

@@ -161,7 +178,10 @@ https://www.grokkingandroid.com/statelistdrawables-for-recyclerview-selection/
161178
# Imported libraries
162179

163180
[LollipopContactsRecyclerViewFastScroller](https://github.com/AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller)<br/>
164-
Improved and adapted to work in conjunction with `FlexibleAnimatorAdapter`.
181+
Improved and adapted to work in conjunction with `AnimatorAdapter`.
182+
183+
# Apps that use this Adapter
184+
It will be a pleasure to add your App here.
165185

166186
# License
167187

build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ext {
66
developerEmail = "dave.dna@gmail.com"
77

88
//Library
9-
libraryCode = 16
10-
libraryVersion = "5.0.0-SNAPSHOT"
9+
libraryCode = 17
10+
libraryVersion = "5.0.0-b7"
1111
libraryDate = " built on " + getDate()
1212
libraryDescription = "1 Adapter for SelectionMode, Undo, ViewHolders, Filter, FastScroller, Animations, Sticky Headers, Expandable, Draggable, Swipeable, EndlessScroll :-)"
1313
libraryName = "FlexibleAdapter"
@@ -49,6 +49,15 @@ def getDate() {
4949
return date.format('yyyy.MM.dd')
5050
}
5151

52+
//Avoid Javadoc Lint failures when using Java8
53+
if (JavaVersion.current().isJava8Compatible()) {
54+
allprojects {
55+
tasks.withType(Javadoc) {
56+
options.addStringOption('Xdoclint:none', '-quiet')
57+
}
58+
}
59+
}
60+
5261
buildscript {
5362
repositories {
5463
jcenter()
@@ -57,9 +66,11 @@ buildscript {
5766

5867
dependencies {
5968
classpath 'com.android.tools.build:gradle:2.1.2'
69+
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
6070
classpath "com.github.dcendents:android-maven-gradle-plugin:1.3"
6171
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6"
6272
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
73+
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
6374
// NOTE: Do not place your application dependencies here; they belong
6475
// in the individual module build.gradle files
6576
}

flexible-adapter-app/build.gradle

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apply plugin: "com.android.application"
2+
apply plugin: 'com.neenbedankt.android-apt'
3+
apply plugin: 'com.jakewharton.hugo'
24

35
android {
46
compileSdkVersion targetSdk
@@ -11,6 +13,8 @@ android {
1113
versionCode libraryCode
1214
versionName libraryVersion + libraryDate
1315

16+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17+
1418
applicationVariants.all { variant ->
1519
variant.outputs.each { output ->
1620
def file = output.outputFile
@@ -29,12 +33,31 @@ android {
2933
minifyEnabled false
3034
}
3135
}
36+
testOptions {
37+
unitTests.returnDefaultValues = true
38+
}
3239
}
3340

3441
dependencies {
42+
//Testing
43+
androidTestCompile supportDependencies.annotations
44+
androidTestCompile 'com.android.support.test:runner:0.4.1'
45+
androidTestCompile 'com.android.support.test:rules:0.4.1'
46+
testCompile 'org.robolectric:robolectric:3.1'
47+
testCompile 'junit:junit:4.12'
48+
testCompile 'org.mockito:mockito-core:2.0.71-beta'
49+
50+
//FlexibleAdapter
3551
compile project (":flexible-adapter")
52+
53+
//FlipView
3654
compile "eu.davidea:flipview:1.1.1"
3755

56+
//ButterKnife
57+
compile 'com.jakewharton:butterknife:8.0.1'
58+
apt 'com.jakewharton:butterknife-compiler:8.0.1'
59+
60+
//Support Libraries
3861
compile supportDependencies.appcompat
3962
compile supportDependencies.cardview
4063
compile (supportDependencies.design) {
@@ -46,10 +69,7 @@ dependencies {
4669
exclude module: "support-annotations"
4770
}
4871

49-
//https://github.com/bumptech/glide
72+
//Glide (Image Loader)
5073
compile 'com.github.bumptech.glide:glide:3.7.0'
5174

52-
// compile("com.mikepenz:materialize:0.8.7@aar") {
53-
// transitive = true
54-
// }
5575
}

0 commit comments

Comments
 (0)