Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] FastAdapter V3 #294

Closed
wants to merge 60 commits into from
Closed

[WIP] FastAdapter V3 #294

wants to merge 60 commits into from

Conversation

FabianTerhorst
Copy link
Contributor

@FabianTerhorst FabianTerhorst commented Dec 19, 2016

Roadmap:

Todo

Current method count (run ./gradlew assembleDebug)

methods fields package/class name
1322 9345 com.mikepenz.fastadapter
100 12 com.mikepenz.fastadapter.adapters
776 6379 com.mikepenz.fastadapter.app
40 2 com.mikepenz.fastadapter.app.adapters
6 0 com.mikepenz.fastadapter.app.dummy
24 5 com.mikepenz.fastadapter.app.generic
308 105 com.mikepenz.fastadapter.app.items
63 21 com.mikepenz.fastadapter.app.items.expandable
127 1455 com.mikepenz.fastadapter.commons
51 4 com.mikepenz.fastadapter.commons.adapters
27 6 com.mikepenz.fastadapter.commons.items
34 5 com.mikepenz.fastadapter.commons.utils
15 11 com.mikepenz.fastadapter.helpers
42 10 com.mikepenz.fastadapter.items
18 0 com.mikepenz.fastadapter.listeners
15 1 com.mikepenz.fastadapter.utils
356 110 com.mikepenz.fastadapter_extensions
7 0 com.mikepenz.fastadapter_extensions.adapters
49 4 com.mikepenz.fastadapter_extensions.dialog
10 6 com.mikepenz.fastadapter_extensions.drag
98 27 com.mikepenz.fastadapter_extensions.items
68 34 com.mikepenz.fastadapter_extensions.scroll
28 8 com.mikepenz.fastadapter_extensions.swipe
20 2 com.mikepenz.fastadapter_extensions.utilities
allprojects {
	repositories {
	     ...
	     maven { url 'https://jitpack.io' }
        }
}

dependencies {
        compile 'com.github.mikepenz:fastadapter:v3-SNAPSHOT'
}

@IlyaGulya
Copy link

How about to add this issue to roadmap? #285

@@ -133,7 +133,7 @@ public void filter(CharSequence constraint) {
* @param sortNow specifies if we use the provided comparator to sort now
* @return this
*/
public ItemAdapter<Item> withComparator(Comparator<Item> comparator, boolean sortNow) {
private ItemAdapter<Item> withComparator(Comparator<Item> comparator, boolean sortNow) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be private

@@ -466,7 +466,7 @@ public void remapMappedTypes() {
* ItemFilter which extends the Filter api provided by Android
* This calls automatically all required methods, just overwrite the filterItems method
*/
public class ItemFilter extends Filter {
private class ItemFilter extends Filter {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one should also be public (as you are allowed to provide your own ItemFilter

@@ -35,28 +34,28 @@ public RecyclerViewCacheUtil withCacheSize(int cacheSize) {
public void apply(RecyclerView recyclerView, Iterable<Item> items) {
if (items != null) {
//we pre-create the views for our cache
HashMap<Integer, Stack<RecyclerView.ViewHolder>> cache = new HashMap<>();
SparseArray<Stack<RecyclerView.ViewHolder>> cache = new SparseArray<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SparseArrays map integers to Objects. Unlike a normal array of Objects, there can be gaps in the indices. It is intended to be more memory efficient than using a HashMap to map Integers to Objects, both because it avoids auto-boxing keys and its data structure doesn't rely on an extra entry object for each mapping." https://developer.android.com/reference/android/util/SparseArray.html

mFastItemAdapter.items().setNewList(userItems);
mFastItemAdapter.items().getAdapterItems().clear();
mFastItemAdapter.items().getAdapterItems().addAll(realmSampleUserItems);
mFastItemAdapter.items().mapPossibleTypes(realmSampleUserItems);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the best solution currently

* only allocate ClickListenerHelper if needed
* items that are implementing the new interface can specify event hooks
* the event hooks are getting registered when the item gets added to
the adapter for the first time
@mikepenz
Copy link
Owner

#344

@FabianTerhorst FabianTerhorst mentioned this pull request Mar 18, 2017
FabianTerhorst and others added 7 commits March 27, 2017 15:44
[V3] Remove view holder factory
* update to support libs 25.3.1
* gradle 3.4.1
* set alpha v3 version name and code
# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.java
#	app/src/main/java/com/mikepenz/fastadapter/app/RealmActivity.java
#	app/src/main/java/com/mikepenz/fastadapter/app/items/SwipeableItem.java
#	build.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	library-core/build.gradle
#	library-core/gradle.properties
#	library-core/src/main/java/com/mikepenz/fastadapter/adapters/GenericItemAdapter.java
#	library-extensions-firebase/gradle.properties
#	library-extensions-realm/build.gradle
#	library-extensions-realm/gradle.properties
#	library-extensions/build.gradle
#	library-extensions/gradle.properties
#	library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java
#	library/build.gradle
#	library/gradle.properties
@eygraber
Copy link

Should a new project using FastAdapter use the snapshots from v3, or is it unstable?

@mikepenz
Copy link
Owner

@eygraber I suggest of using v2.5.x right now. A few cleanup and bigger API changes were already done. So It's better to keep with the 2.x branch until we get to a more feature rich state of v3

@FabianTerhorst
Copy link
Contributor Author

Checkout #443 to see the new changes. The benchmarks will be migrated to the new version after release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants