B4A Library [Lib, Chargeable] Amir_RecyclerView

New b4a library! :)

RecyclerView, an important part of the sdk and android for making a custom list with better Layout , animation , and fixed for large data set.


Amir_RecyclerView released new version that we call it AX_RecyclerView.

version 1.0.8 is last update for Amir_RecyclerView and we will work on AX_RecyclerView only in future.


RecyclerView Android X : https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView

"RecyclerView is part of the v7 support library which means you can use it on anything that has api 7 and up"

543434345345.jpg



Advantages of using recyclerview instead listview:
  • ViewHolder Pattern
In a ListView, it was recommended to use the ViewHolder pattern but it was never a compulsion. In case of RecyclerView, this is mandatory using the RecyclerView.ViewHolder class. This is one of the major differences between the ListView and the RecyclerView.​

  • LayoutManager
This is another massive enhancement brought to the RecyclerView. In a ListView, the only type of view available is the vertical ListView. There is no official way to even implement a horizontal ListView.​
Now using a RecyclerView, we can have a:​
i) LinearLayoutManager - which supports both vertical and horizontal lists,​
ii) StaggeredLayoutManager - which supports Pinterest like staggered lists,​
iii) GridLayoutManager - which supports displaying grids as seen in Gallery apps.​
And the best thing is that we can do all these dynamically as we want.​

  • Item Animator
ListViews are lacking in support of good animations, but the RecyclerView brings a whole new dimension to it. Using the RecyclerView.ItemAnimator class, animating the views becomes so much easy and intuitive.​

  • Item Decoration
In case of ListViews, dynamically decorating items like adding borders or dividers was never easy. But in case of RecyclerView, the RecyclerView.ItemDecorator class gives huge control to the developers but makes things a bit more time consuming and complex.​

  • OnItemTouchListener
Intercepting item clicks on a ListView was simple, thanks to its AdapterView.OnItemClickListener interface. But the RecyclerView gives much more power and control to its developers by the RecyclerView. OnItemTouchListener but it complicates things a bit for the developer.​


For more info:
https://developer.android.com/reference/android/support/v7/widget/RecyclerView

You can add plugins as library and connect it to Amir_RecyclerView using a line of code

Current Plugins :
  • Amir_RVHeaderFooter
  • Amir_RVToolbarParallax
  • Amir_RVEmptyView
  • Amir_RVCardSlider
  • Amir_RVCarousel
  • Amir_RVDiscrete
  • Amir_RVExpandable
  • Amir_RVFanLayout
  • Amir_RVFeature
  • Amir_RVItemPicker ( deprecated )
  • Amir_RVLayoutAnimation
  • Amir_RVMultiSelection
  • Amir_RVParallax
  • Amir_RVRefreshLayout
  • Amir_RVShimmer
  • Amir_RVSkidRight
  • Amir_RVSwipeCards
  • Amir_RVVegaLayout
  • Amir_RVEchelon
  • Amir_WearableRecyclerView
  • Amir_RVDragItem
  • Amir_RVStickyHeader
  • AX_RecyclerViewPager ( deprecated )
  • Amir_RVAnimators
  • AX_RVSelection
  • AX_RVItemPicker
  • AX_RVPageIndicator
  • Amir_RVChipsLayoutManager
  • AX_RVSwipeLayout 1.00
  • AX_RVHeaderParallax
  • Amir_RVCardViewAdapter
  • Amir_RVExpandableStickyHeader
  • Amir_RVOverScroll
  • AX_RVFastScroller
  • AX_RVHeightStaggeredGrid
  • Amir_RVDragAndSwipe ( NEW )

Demo and samples how to use :

Download the DEMO.apk ( updated in 28th of July 2019 )
Download Demo Source Code

Extra Samples are here


Current version of Amir_RecyclerView : 1.2.0

Be sure to check the apk sample before purchasing.


You can have this fantastic library just with $25 ( only Amir_RecyclerView )
Full packages include all plugins only $35

Short documentations attached , special thanks to fredo

After your purchase please send me an email with your purchase detail ( [email protected] )

 

Attachments

  • Amir_RecyclerView_FullPackage_1.0.2.LIBDOC.zip
    61.1 KB · Views: 1,500
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
please update your android sdk , it should solve your problem.

The problem is, I'm already using version 28, which is the latest version. My path is C:\android_sdk\platforms\android-28\android.jar.

I'm still getting
B4X:
java.lang.IndexOutOfBoundsException: Invalid item position 0(0). Item count:0 com.aghajari.rv.RecyclerView{28abdee3 VFED.... ......I. 0,0-0,0}, adapter:com.aghajari.rvplugins.Amir_RVItemPicker$Amir_RVItemPickerAdapter@35a940e0, layout:com.aghajari.rvplugins.PickerLayoutManager@38150f99, context:b4a.example.main@350e725e
when using the ItemPicker plugin. This error was reported by someone else on one of the previous pages as well.

The bug can easily be shown with this code:
B4X:
Sub Globals
    Private WheelPicker As Amir_RVItemPicker
    Private WheelData As List
    Private Wheel As Amir_RecyclerView
End Sub

Sub Activity_Create(Time As Boolean)
    WheelData.Initialize
    WheelData.Add("one")
    WheelData.Add("two")
    WheelData.Add("three")
    WheelData.Add("four")
    Wheel.Initializer("")
    Activity.AddView(Wheel,0,0,300dip,300dip)
    WheelPicker.Initialize("WheelPicker",Wheel)
    WheelPicker.SetAdapter(WheelData).LayoutSize(Wheel.width,Wheel.height).TextSize(32).TextColor(Colors.Black).Build
End Sub

Tested with Java 8 and Android 28.

I did some research and this is apparently a known issue. The suggestion often seen is to setAutoMeasureEnabled(false) on the LayoutManager.

EDIT: just tried on three different computers, all show the same error...
 
Last edited:

alimanam3386

Active Member
Licensed User
Longtime User
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
The example starts working when you add these files to the SDK folder. However, several other apps not using recyclerview are now giving problems.

When I compare my extras folder to the one from the ZIP above, the ZIP contains a directory called 'android' which has different versions of recyclerview inside.

@Erel I presume overwriting the SDK folder isn't the recommended way. What needs to be checked in the SDK manager in order to download the android directory in extras?
 
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
I think I have localized the problem. Your ZIP file comes with Android Support Repository v44.0.0 - this is not the latest version. All people who install B4A from scratch will have Android Support Repository v47.0.0. And Amir_RVItemPicker does not work with v47... can you please correct this? This is the cause of all the problems...
 

wimpie3

Well-Known Member
Licensed User
Longtime User
It's a shame because this is blocking me from finishing a large project. You only have to modify one line in the plugin.
B4X:
LayoutManager.setAutoMeasureEnabled(false);
 

alimanam3386

Active Member
Licensed User
Longtime User
It's a shame because this is blocking me from finishing a large project.

I can't understand how can I blocking you to finishing your project!!!!?? it is not mandatory to use this plugin in your project. in other hand please be aware I am not your employee ,several times I explained to you I am not developer of this lib I just wrapped that nothing else. anyway I added you in my ignored users.
 

wimpie3

Well-Known Member
Licensed User
Longtime User
I don't see why such agression is needed. I have always tried to be polite and constructive, posting source code to show where things are going wrong. I love working with your library, if not, I wouldn't care about it. I think it's normal that as a paying user, you can count on bugfixes, right? You can't just charge money and run away when things don't work as expected.
 

alimanam3386

Active Member
Licensed User
Longtime User
Sorry!, How can I explain it to you it is not a bug ? if was it should not working at all but works as expected in my sdk with android-28 and repository as you said with version 44 . It is a incompatibility between the orginal lib and wrapped of it with repository version higher than 44 .
I explained the solution for you. I know it is not ideal solution but it works so what can I do more ???????
 
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
I agree, it works, thank you for helping me... but I'm happy to read you agree this is not ideal and I was hoping all the time you could find a solution for this. But thanks anyway.
 

alimanam3386

Active Member
Licensed User
Longtime User
New version of Amir_RecyclerView has been released Version 1.0.8

today , All of us have heard about AndroidX . thanks Erel , we can switch to AndroidX like a piece of cake.

Amir_RecyclerView released new version that we call it AX_RecyclerView.
version 1.0.8 is last update for Amir_RecyclerView and we will work on AX_RecyclerView only in future.
RecyclerView Android X : https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView

This update includes 2 new plugin : Amir_RVAnimators AND AX_RVSelection

1.Amir_RVAnimators :
RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations.
See more : https://github.com/wasabeef/recyclerview-animators

2.AX_RVSelection :

A RecyclerView addon library providing support for item selection. The library provides support for both touch and mouse driven selection. Developers retain control over the visual representation, and the policies controlling selection behavior (like which items are eligible for selection, and how many items can be selected.)
See more : https://developer.android.com/reference/androidx/recyclerview/selection/Selection

the plugins which starts with AX_ only works for AndroidX Sdk which means you should use AX_RecyclerView and update your sdk,b4a to support androidx.

All other plugins will work with androidx. you only need to Jetify your libraries
Except Amir_RVItemPicker . this plugin may has some problems with new sdk (not sure). we will replace this plugin with new androidx plugin soon.

And new update includes 2 important things

1. RVViewHolder And RVBasicAdapter classes :
with this adapter you can make your RecyclerView Adapter just like java.

2. FixableListView Layout :

new ListView Layout is special for chat applications. FixableListView will controll all possible errors.
it's easy to use :
B4X:
 ListView : RV.Initializer("RV").ListView.Vertical.Build

FixableListView :
B4X:
RV.Initializer("RV").FixableListView(False).Vertical.Build

thanks for your support
 

alimanam3386

Active Member
Licensed User
Longtime User
New version of Amir_RVItemPicker has been released Version 1.1.2
new plugin is using AndroidX and the name of new plugin is AX_RVItemPicker.

WARNING : Amir_RVItemPicker deprecated.

if you are adding custom adapter to recyclerview you need use this line for set plugin layout size :
B4X:
ItemPicker.SetSize(Width,Height)


switch fast to androidx version of this plugin :
search Amir_RVItemPicker in Quick Search (Ctrl+F). Replace With AX_RVItemPicker and click All Modules button.
 

itgirl

Active Member
Licensed User
Longtime User
New version of Amir_RVItemPicker has been released Version 1.1.2
new plugin is using AndroidX and the name of new plugin is AX_RVItemPicker.

WARNING : Amir_RVItemPicker deprecated.

if you are adding custom adapter to recyclerview you need use this line for set plugin layout size :
B4X:
ItemPicker.SetSize(Width,Height)


switch fast to androidx version of this plugin :
search Amir_RVItemPicker in Quick Search (Ctrl+F). Replace With AX_RVItemPicker and click All Modules button.
Already started to move to AndroidX thanks for the updates
 

alimanam3386

Active Member
Licensed User
Longtime User
Hello world!

we are here with 2 new plugin for Amir_RecyclerView / AX_RecyclerView.

1. AX_RVPageIndicator ( See : https://github.com/chahine/pageindicator )
A page indicator like Instagram compatible with RecyclerView and RecyclerViewPager using AndroidX

2. Amir_RVChipsLayoutManager ( See : https://github.com/BelooS/ChipsLayoutManager )
A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features.
Support android support and androidx.


You can create your own ui with your custom adapter or use Amir_RVChipsAdapter class to make a fixable material ui only in one moment.


thanks for your support
 
Last edited:

asales

Expert
Licensed User
Longtime User
What is the minimum Android version to the Amir_RVChipsLayoutManager?

I tested the example in Android 4.2 and 4.4 and I got this errors:
B4X:
android.view.InflateException: Binary XML file line #57: Error inflating class android.widget.ImageButton
    at android.view.LayoutInflater.createView(LayoutInflater.java:620)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at com.aghajari.recyclerview.plugin.chipslm.ChipsAdapter.onCreateViewHolder(ChipsAdapter.java:44)
    at com.aghajari.recyclerview.plugin.chipslm.ChipsAdapter.onCreateViewHolder(ChipsAdapter.java:14)
    at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
    at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
    at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
    at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:860)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:823)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onLayoutChildren(ChipsLayoutManager.java:721)
    at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
    at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
    at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194)
    at android.view.View.layout(View.java:14963)
    at android.view.ViewGroup.layout(ViewGroup.java:4631)
    at anywheresoftware.b4a.BALayout.onLayout(BALayout.java:43)
    at android.view.View.layout(View.java:14963)
    at android.view.ViewGroup.layout(ViewGroup.java:4631)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14963)
    at android.view.ViewGroup.layout(ViewGroup.java:4631)
    at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:374)
    at android.view.View.layout(View.java:14963)
    at android.view.ViewGroup.layout(ViewGroup.java:4631)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14963)
    at android.view.ViewGroup.layout(ViewGroup.java:4631)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5675)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
    at android.view.Choreographer.doCallbacks(Choreographer.java:574)
    at android.view.Choreographer.doFrame(Choreographer.java:544)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5214)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:814)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at android.view.L
Message longer than Log limit (4000). Message was truncated.

The AX_RVPageIndicator works fine.
 

alimanam3386

Active Member
Licensed User
Longtime User
I tested the example in Android 4.2 and 4.4 and I got this errors:

Amir_RVChipsLayoutManager 1.01 support android +4

The reason for the error was that we used vector drawable for close button and android 4 doesn't support vector.
Make sure update aar file in your libs with new one

NOTE : you can change button image by this line on onBindViewHolder Or onCreateViewHolder :
B4X:
Dim Jo As JavaObject = Holder.ButtonView
Jo.RunMethod("setImageDrawable",Array(Drawable))

the download link will send soon.

Thanks
 

wimpie3

Well-Known Member
Licensed User
Longtime User
I switched to version 1.0.8. Is it normal a new file called Amir_RecyclerView.androidx.jar is added?
 
Top