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
Thank you for correcting the bugs! There is now a big need for a decent manual I guess. Several properties are not documented. Like the "Adjusted" property. And what is the difference between DoScroll and ScrollToPosition...? I know we can follow the examples but I'd like to know what I'm doing :)
 

itgirl

Active Member
Licensed User
Longtime User
There is a strange bug try to change the locale to any RTL locale like Hebrew or Arabic and enable LinearSnapHelper2 the snapper will keep scrolling till the beginning of the list o_O
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Is it possible to use the Amir_animation library to animate TO a certain x,y location? That seems to be missing currently.
 

alimanam3386

Active Member
Licensed User
Longtime User
There is a strange bug try to change the locale to any RTL locale like Hebrew or Arabic and enable LinearSnapHelper2 the snapper will keep scrolling till the beginning of the list o_O

It's not bug , use LinearSnapHelper instead of LinearSnapHelper2 for RTL layouts.
 

alimanam3386

Active Member
Licensed User
Longtime User
Thank you for correcting the bugs! There is now a big need for a decent manual I guess. Several properties are not documented. Like the "Adjusted" property. And what is the difference between DoScroll and ScrollToPosition...? I know we can follow the examples but I'd like to know what I'm doing :)

the main difference between doScroll and ScrollToPosition is when you use doScroll to navigate between pages you should declare the Adjusted property.
 

itgirl

Active Member
Licensed User
Longtime User
It's not bug , use LinearSnapHelper instead of LinearSnapHelper2 for RTL layouts.
Yeah i kinda figure that out , because first i used LinearSnapHelper2 with gravity but didn't work so i went back to LinearSnapHelper and it worked, Thanks for your replies for the bugs and also for you effort ;)
 

wimpie3

Well-Known Member
Licensed User
Longtime User
In the Amir_RecycleView example you show a horizontal pageviewer. This works fine. However, I'd like to detect when someone is moving their finger UP or DOWN over the control (while keeping the LEFT/RIGHT slide for the pageviewer). I'm not able to do that using for instance GestureDetector. Any idea where I should be looking?
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Also: is it possible to expose onGetChildDrawingOrder? When I want to change the z-order of views inside the RecycleView using bringtofront/sendtoback, the RecycleView gets messed up. This can be solved by using onGetChildDrawingOrder but that function is not available.
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Another bug. Run the following program. At the start the recycleviewer scrolls to Item 2. When you push the red button the recycler scrolls to Item 1 (perfect). But the debug log shows that the view on the first visible position is Item 0, and not Item 1. I suspect some problem with "measuring" which panel is visible, since when you modify the source code below and put Parent.Width=100%x+1 instead of Parent.Width=100%x, it works as expected.

B4X:
#Region  Project Attributes 
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName: 
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
End Sub

Sub Globals
    Dim recycler As Amir_RecyclerView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    recycler.Initializer("Amir").ListView.Horizontal.Build
    Activity.AddView(recycler,0,0,100%x,100%y)
    recycler.ScrollingTouchSlop=recycler.TOUCH_SLOP_PAGING
    recycler.LinearSnapHelper
    recycler.Adapter=recycler.DefaultAdapter
    Dim b As Button
    b.Initialize("b")
    b.Color=Colors.red
    Activity.AddView(b,0,100dip,300dip,100dip)
    recycler.ScrollToPosition(2)
End Sub

Sub b_Click
    recycler.SmoothScrollToPosition(1)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub Amir_onCreateViewHolder (Parent As Panel,ViewType As Int)
    Dim panel As Panel
    panel.Initialize("")
    Parent.AddView(panel,0,0,Parent.Width,50dip)
    Dim label As Label
    label.Initialize("")
    panel.AddView(label,0,0,panel.Width,panel.Height)
End Sub

Sub Amir_onBindViewHolder (Parent As Panel,Position As Int)
    Dim panel As Panel=Parent.GetView(0)
    Dim label As Label=panel.GetView(0)
    label.Text="Item " & Position
    label.Color=Colors.black
    Parent.Width=100%x
    Parent.Height=70dip
End Sub

Sub Amir_onScrollStateChanged (NewState As Int)
    If NewState = 0 Then
        Dim p As Panel=recycler.Utils.ViewIndexToItemObject(recycler,0)
        Dim p2 As Panel=p.GetView(0)
        Dim l As Label=p2.GetView(0)
        Log(l.text)
    End If
End Sub

Sub Amir_GetItemCount As Int
    Return 200
End Sub
 

evbedp

Member
Licensed User
Longtime User
it's possible change from GRID to ListView in same time?

as you know ecommerce application have menu to change product display from grid to listview.
 

Carlos marin

Active Member
Licensed User
Longtime User
hi dear I have a concern, I use VisibleRangeChanged erel
since in the app I have a very heavy load images from a server in some cases the custom is loaded with more than 100 to 500 items with images, Can this library support this load? you can call images of the internet to load the items is something like that.
 

Attachments

  • WhatsApp Image 2019-03-04 at 1.30.38 PM.jpg
    WhatsApp Image 2019-03-04 at 1.30.38 PM.jpg
    146 KB · Views: 235

itgirl

Active Member
Licensed User
Longtime User
hi dear I have a concern, I use VisibleRangeChanged erel
since in the app I have a very heavy load images from a server in some cases the custom is loaded with more than 100 to 500 items with images, Can this library support this load? you can call images of the internet to load the items is something like that.
You should NEVER load 100-500 images at the same time, from a memory consumption view RecyclerView will definitely help having 100-500 items even much much more but that's only for Views and views life cycle. of course for downloading images you can always rely on glide which this lib use and it will 100% be much more easier to handle all the memory and cache problems, to sum it up your problem is not about the kind of lib you use it's about the way you do it and downloading 500 images is never a good way ;)
Try to show only 20 items [lazy loading] no need to wait for the end of scroll maybe when user scroll reach 10 load another 20 and so on, this way even the user will not notice the download happening.
 
Last edited:

itgirl

Active Member
Licensed User
Longtime User
not this feature,

i want to show progress bar at bottom Recycler View, like load more data not for refresh screen.
when bottom progress bar show it will request to generate more other products.
Also the refresh from bottom is implemented ;)
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Anyone else getting the following error when using RVItemPicker?
B4X:
java.lang.IndexOutOfBoundsException: Invalid item position 0(0). Item count:0 com.aghajari.rv.RecyclerView{34a816ce VFED.... ......I. 0,0-0,0}, adapter:com.aghajari.rvplugins.Amir_RVItemPicker$Amir_RVItemPickerAdapter@13d8a9ef, layout:com.aghajari.rvplugins.PickerLayoutManager@14e15cfc, context:android.app.Application@35318f85
 

itgirl

Active Member
Licensed User
Longtime User
Anyone else getting the following error when using RVItemPicker?
B4X:
java.lang.IndexOutOfBoundsException: Invalid item position 0(0). Item count:0 com.aghajari.rv.RecyclerView{34a816ce VFED.... ......I. 0,0-0,0}, adapter:com.aghajari.rvplugins.Amir_RVItemPicker$Amir_RVItemPickerAdapter@13d8a9ef, layout:com.aghajari.rvplugins.PickerLayoutManager@14e15cfc, context:android.app.Application@35318f85
From the example?
 
Top