devahamed / multiviewadapter Goto Github PK
View Code? Open in Web Editor NEWEasily create complex recyclerview adapters in android
Home Page: https://devahamed.github.io/MultiViewAdapter
License: Apache License 2.0
Easily create complex recyclerview adapters in android
Home Page: https://devahamed.github.io/MultiViewAdapter
License: Apache License 2.0
can you add ?
Please complete the following information:
When clearAllSelections or collapseAllItems methods are called, notify method is not called with correct position. This is due to incorrect incrementation inside the loop.
Hi! first of all, awesome library!!
I found an issue with the expand collapse feature. While items expand and collapse correctly, groups can't collapse again, except if I click on another group(in EXPANDABLE_MODE_SINGLE). When i call the method isItemExpanded() after toggleGroupExpansion() it returns allways false.
This is a clone of your proyect:
BaseDataManager.setSelectedItem can only be called from within the same library (com.github.devahamed:multi-view-adapter) less... (Ctrl+F1)
This API has been flagged with a restriction that has not been met. Examples of API restrictions: * Method can only be invoked by a subclass * Method can only be accessed from within the same library (defined by the Gradle library group id) * Method can only be accessed from tests. You can add your own API restrictions with the @RestrictTo annotation. Issue id: RestrictedApi
here is my code
if(taxListDataSet.contains(row1)) {
rowDataListManager.setSelectedItem(taxListDataSet.get(taxListDataSet.indexOf(row1)));
selectableAdapter.notifyDataSetChanged();
}
Instead of the decoration takes the background color of parent view containing the recyclerview, could we change the color of decoration? Many thanks.
File templates is not a widely used feature since it requires set-up from the user side. Also whenever the AndroidStudio is updated users have to move the file templates manually.
Apart from this file templates is additional burden to keep them updated with each release. So we can remove the file templates from the library.
java.lang.IllegalStateException: Binder not found for position. Position = 0 using wiki simple usage
DiffUtil calculation is done at the main thread. For lists smaller count, the calculation on main thread is fine. But for larger lists it might block the main thread for few frames.
In 'Simple grid' and 'Complex' page, long press the grid item will caused NullPointerException
:
FATAL EXCEPTION: main
Process: com.ahamed.sample, PID: 25712
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.helper.ItemTouchHelper.startDrag(android.support.v7.widget.RecyclerView$ViewHolder)' on a null object reference
at com.ahamed.multiviewadapter.CoreRecyclerAdapter$2.onStartDrag(CoreRecyclerAdapter.java:79)
at com.ahamed.multiviewadapter.BaseViewHolder.startDrag(BaseViewHolder.java:162)
at com.ahamed.sample.common.binder.GridItemBinder$ItemViewHolder$2.onItemLongClick(GridItemBinder.java:73)
at com.ahamed.sample.common.binder.GridItemBinder$ItemViewHolder$2.onItemLongClick(GridItemBinder.java:71)
at com.ahamed.multiviewadapter.BaseViewHolder.onLongClick(BaseViewHolder.java:44)
In my case:
Is it possible by default?
Improve the javadocs by documenting all public methods. Improve the wiki pages layout and navigation by adding a new website.
Hello. Been using your library since yesterday, and it has been wonderful. Thanks for the effort.
Having a question here.. how do I build such a list:
where basically header a and b are the same object type, and items a1, a2, b1 and b2 are also the same type.
If in the adapter I have two list managers (say, headers and items), then headers will grouped at the top, and all of the items will be grouped below.
Maybe this is just a stupid question, but really appreciate any help. Thanks beforehand.
I have to increase gap of grid view items nearly 23dp. But I'm not getting that much spacing in between. Could you please suggest me on this?
My span count is 2:
Actual Result:
Grid1 Grid2
Grid3 Grid4
Excepted Result:
Grid1 Grid2
Grid3 Grid4
Since milestones are already there, its good to have a publicly trackable road map.
Is it possible to expand groups that are not children?
For example, I have a header that says "expand all", when clicking this header I want to expand three different groups bellow this header.
As far as I can see I can only expand from the ViewHolder itself and that's not enough for this requirement I think.
When we are publishing the library artifacts, empty javadoc jar is uploaded with artifacts. This might be related to how android projects handle javadoc generation.
At the time of v1.2.6 release, the combined test coverage stands at 55%. These include some false positive test cases as well. Since we have android unit test which needs emulator to boot up, our CI build times are high and fail most of the times. So its time to improve the test cases for the library.
When an item in the expandable list is expanded or collapsed, most of the contents of the holder's
itemView are not affected (except the expand/contract indicator).
I have a holder which has many complex views (including a TextureView) that do not need to be refreshed every time I expand or collapse that item.
So I was thinking that shouldn't there be an alternative abstract method in the ItemBinder class which should get invoked instead of invoking the bind() method when expanding or collapsgin an item, where we put the views that get changed only on expanding/collapsing? I think the impact on performance could be reduced by this.
Hello, first of all, congratulations for this great library. I have a question. Does this library support item click and long click detection? Thanks in advance!
Hi Ahamed,
Your library is awesome and saved me lots of times and headache, thank you.
I was wondering if there is a way to add SortedList or any kind of sorting to items in the DataListManager as my data is coming through RxJava and I have no clue about the order of them so I have to sort it before passing it to Adapter.
I was doing it before by adding my item to SortedList and adding Comprable to my model.
Hello @DevAhamed,
Awesome work you have done on the new features.
I was however wondering if it's possible to do an example with multiple items under an expandable item.
Thanks
Corerecycleradapter ——>getpositioninadapter (BaseDataManager dataManager, int binderPosition)
What is the effect of this method?
I did not read, ask for answers.
Thank you
Information Needed:
What:
When adapter has selection mode as 'Multiple' and sections has selection mode as 'Single', adapter behaves as if the selection mode was 'Single'
Steps to reproduce:
This adapter is awesome!!!
Could be good to have a method that returns all items in adapter :O
Recyclerview allows adding multiple item decorations. In that case item binders also should allow users to add multiple item decoration.
Full warning text:
Type itemDecorationManager! is inaccessible in this context due to: public/package/ open class ItemDecorationManager : RecyclerView.itemDecoration defined in com.ahamed.multiviewadapter in file ItemDecorationManager.class.
I have been developing the library under the wraps for a few months. Open source development should not happen that way, but i regret doing the same. I am currently in the process of migrating to AndroidX. Once done v2 source code will be dropped with a better documentation and test cases.
ItemViewHolder name is in the same line as the convention used throughout the library. Deprecate the BaseViewHolder class for backward compatibility
Is there any way to update just the existing DataManager object and its associated ItemBinder, when the model is updated/changed (in an adapter of multiple DataManagers and ItemBinders)?
The entire library is not tested. Adding test cases will help the library to iterate quickly and ensures the new feature doesn't break.
Build snapshots of library from the default branch and deploy them to artifactory. We have already integrated with CI pipeline, where builds are checked nightly on default branch. We can leverage this and deploy snapshots either,
We have to choose any one of the options above and automate the deployment process.
Since android support libraries are moving into jetpack, and package names are being changed, it is good to have one last minor version release(v1.3.0) before migration.
I got IllegalAccessError when my RecyclerAdapter is Kotlin.
It says "Illegal class access", "declaration of 'My Adapter Class' appears in ...base.apk:classes2.dex"
But when I change my class to java, It works fine.
java.lang.IllegalAccessError: Illegal class access: 'cupid.android.ui.adapter.HomeFragmentAdapter' attempting to access 'com.ahamed.multiviewadapter.BaseDataManager' (declaration of 'cupid.android.ui.adapter.HomeFragmentAdapter' appears in /data/app/cupid.android-1/base.apk:classes2.dex)
at cupid.android.ui.adapter.HomeFragmentAdapter.<init>(HomeFragmentAdapter.kt:20)
at cupid.android.ui.screen.activity.main.fragment.home.HomeFragmentLayout.createView(HomeFragmentLayout.kt:20)
at cupid.android.ui.screen.activity.main.fragment.home.HomeFragmentLayout.createView(HomeFragmentLayout.kt:13)
at cupid.android.ui.base.BaseFragmentLayout.view(BaseFragmentLayout.kt:12)
at cupid.android.ui.screen.activity.main.fragment.home.HomeFragment.onCreateView(HomeFragment.kt:37)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2337)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1739)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1808)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2579)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2366)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2321)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2198)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:167)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1362)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:19857)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)
at android.view.View.measure(View.java:19857)
07-06 04:36:31.822 8493-8493/cupid.android E/AndroidRuntime: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
at android.view.Choreographer.doCallbacks(Choreographer.java:686)
at android.view.Choreographer.doFrame(Choreographer.java:621)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Adding the sample in kotlin language will help the first-time kotliners.
Since AndroidX packages are now out of beta, its time to add support for new packages. Since this requires a major refactor, my current plan is to release it with v2 refactor.
When i put a recycleview in xml layout of a binder,
and try remove ** the first** element of binder, it hide all view of binder.
Sorry for my poor english.
/**
/**
/**
why the POSITION_RIGHT ‘s note is rigth ?
this is a accident mistake or this have other meaning?
Can you provide a demo about in a RecyclerView with Grid hava different item and different SpanCount ?
I have read ComplexListActivity ,but This is not what I want。
https://github.com/DevAhamed/MultiViewAdapter/wiki/Grid-Adapter about specific demo!
Best blessing!
thank you very much!
are there any plans to implement a "sticky headers feature" to expandable group headers?
Hi @DevAhamed,
I was reading the Multiple Data Sets section on the wiki and I wonder if it is possible to add a header view for each data set?
Also in this example I see that there are two separate list. How can we do if we have one list with different kind of views? (Ex.: a newsfeed where one item is a photo item, one a simple text item and they have different layouts)
Thank you.
In the sample app, when expanding items in 'Expanding group' page, IndexOutOfBoundsException thrown:
IndexOutOfBoundsException
FATAL EXCEPTION: main
Process: com.ahamed.sample, PID: 24672
java.lang.IndexOutOfBoundsException: Index: 10, Size: 10
at java.util.ArrayList.get(ArrayList.java:411)
at com.ahamed.multiviewadapter.BaseDataManager.getItem(BaseDataManager.java:316)
at com.ahamed.multiviewadapter.BaseDataManager.get(BaseDataManager.java:210)
at com.ahamed.multiviewadapter.CoreRecyclerAdapter.onBindViewHolder(CoreRecyclerAdapter.java:116)
at com.ahamed.multiviewadapter.CoreRecyclerAdapter.onBindViewHolder(CoreRecyclerAdapter.java:35)
...
It would be really nice to be able to use the Loader pattern with cursors.
I have a CursorRecyclerViewAdapter implementation that i might be able to adapt but I don't want to bother if there is already something in the works.
This library was very useful to me. Thank a lot!
Just wanted to know is there any way to remove a registered binder from recyclerAdapter dynamically?
CI will let the library to iterate quickly without breaking the api's
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.