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 ( alimanam@gmail.com )

 

Attachments

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

DonManfred

Expert
Licensed User
Longtime User

jimmyF

Active Member
Licensed User
Longtime User

asales

Expert
Licensed User
Longtime User
How I can copy an image from CarouselViewPager to an imageview on the click event?
I tried this code, but don't works:
B4X:
Sub Amir_onItemClick (Parent As Panel, Position As Int)
   Log("#-Sub arv_onItemClick, Position=" & Position)
   Dim Panel As Panel = Parent.GetView(0)
   Dim img As ImageView = Panel.GetView(0)
   ImageView1.SetBackgroundImage(img.Bitmap)
End Sub

Thanks in advance.
 

alimanam3386

Active Member
Licensed User
Longtime User
How I can copy an image from CarouselViewPager to an imageview on the click event?
I tried this code, but don't works:
B4X:
Sub Amir_onItemClick (Parent As Panel, Position As Int)
   Log("#-Sub arv_onItemClick, Position=" & Position)
   Dim Panel As Panel = Parent.GetView(0)
   Dim img As ImageView = Panel.GetView(0)
   ImageView1.SetBackgroundImage(img.Bitmap)
End Sub

Thanks in advance.

B4X:
ImageView1.Background=img.Background
 

asales

Expert
Licensed User
Longtime User
B4X:
ImageView1.Background=img.Background
I tried, but don't works.
See my code and example in attached.
Thanks.
B4X:
Sub Globals
    Dim Recycler As Amir_RecyclerView
    Dim CarouselVP As Amir_RVCarouselViewPager
    Private pGallery As Panel
    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1")
    
    Recycler.Initializer("Amir").NoLayout
    pGallery.AddView(Recycler,0,0,pGallery.Width, pGallery.Height)

    CarouselVP.Initializer("Amir",Recycler).MaxVisibleItemCount(5).ItemSpace(150dip).Horizontal.Build
    CarouselVP.CenterSnapHelper
    CarouselVP.Infinite=True
    
    Recycler.DefaultAdapter
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Private Sub Amir_onCreateViewHolder (Parent As Panel,ViewType As Int)
    Dim Panel As Panel
    Panel.Initialize("")
    Parent.AddView(Panel, 0, 0, pGallery.Width, pGallery.Height)
    
    Dim img As ImageView
    img.Initialize("")
    Panel.AddView(img,0,0,Panel.Width,Panel.Height)
End Sub

Private Sub Amir_onBindViewHolder (Parent As Panel,Position As Int)
    Dim Panel As Panel = Parent.GetView(0)
    Dim img As ImageView = Panel.GetView(0)
    
    img.Tag = Null

    LoadImage(img, Position)
    
    Dim Color As ColorDrawable
    Color.Initialize(Colors.Transparent,5dip)
    Panel.Background=Color

    Parent.Width = pGallery.Width
    Parent.Height = pGallery.Height
End Sub

Private Sub LoadImage (Img As ImageView, Position As Int)
    Dim Glide As Amir_Glide
    Glide.Initializer.Default

    Glide.LoadWith.URI("file:///android_asset/item"&(Position+1)&".jpg").Apply(Glide.RO.CenterCrop).Into(Img)

End Sub

Private Sub Amir_GetItemCount As Int
    Return 10
End Sub

Public Sub setClipToOutline (Panel As Panel)
    Dim P As Phone
    If P.SdkVersion >= 21 Then
        Dim jo As JavaObject = Panel
        jo.RunMethod("setClipToOutline",Array(True))
    End If
End Sub

Sub Amir_onItemClick (Parent As Panel, Position As Int)
    Log("#-Sub arv_onItemClick, Position=" & Position)
    
    Dim Panel As Panel = Parent.GetView(0)
    Dim img As ImageView = Panel.GetView(0)
'    ImageView1.SetBackgroundImage(img.Bitmap)

    ImageView1.Background = img.Background
End Sub
 

Attachments

  • arv_carousel.zip
    245.6 KB · Views: 292

alimanam3386

Active Member
Licensed User
Longtime User
I tried, but don't works.
See my code and example in attached.
Thanks.
B4X:
Sub Globals
    Dim Recycler As Amir_RecyclerView
    Dim CarouselVP As Amir_RVCarouselViewPager
    Private pGallery As Panel
    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1")
 
    Recycler.Initializer("Amir").NoLayout
    pGallery.AddView(Recycler,0,0,pGallery.Width, pGallery.Height)

    CarouselVP.Initializer("Amir",Recycler).MaxVisibleItemCount(5).ItemSpace(150dip).Horizontal.Build
    CarouselVP.CenterSnapHelper
    CarouselVP.Infinite=True
 
    Recycler.DefaultAdapter
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Private Sub Amir_onCreateViewHolder (Parent As Panel,ViewType As Int)
    Dim Panel As Panel
    Panel.Initialize("")
    Parent.AddView(Panel, 0, 0, pGallery.Width, pGallery.Height)
 
    Dim img As ImageView
    img.Initialize("")
    Panel.AddView(img,0,0,Panel.Width,Panel.Height)
End Sub

Private Sub Amir_onBindViewHolder (Parent As Panel,Position As Int)
    Dim Panel As Panel = Parent.GetView(0)
    Dim img As ImageView = Panel.GetView(0)
 
    img.Tag = Null

    LoadImage(img, Position)
 
    Dim Color As ColorDrawable
    Color.Initialize(Colors.Transparent,5dip)
    Panel.Background=Color

    Parent.Width = pGallery.Width
    Parent.Height = pGallery.Height
End Sub

Private Sub LoadImage (Img As ImageView, Position As Int)
    Dim Glide As Amir_Glide
    Glide.Initializer.Default

    Glide.LoadWith.URI("file:///android_asset/item"&(Position+1)&".jpg").Apply(Glide.RO.CenterCrop).Into(Img)

End Sub

Private Sub Amir_GetItemCount As Int
    Return 10
End Sub

Public Sub setClipToOutline (Panel As Panel)
    Dim P As Phone
    If P.SdkVersion >= 21 Then
        Dim jo As JavaObject = Panel
        jo.RunMethod("setClipToOutline",Array(True))
    End If
End Sub

Sub Amir_onItemClick (Parent As Panel, Position As Int)
    Log("#-Sub arv_onItemClick, Position=" & Position)
 
    Dim Panel As Panel = Parent.GetView(0)
    Dim img As ImageView = Panel.GetView(0)
'    ImageView1.SetBackgroundImage(img.Bitmap)

    ImageView1.Background = img.Background
End Sub


use this code:

B4X:
Dim Glide As Amir_Glide
  Glide.Initializer.Default
  ImageView1.Background = Glide.Glide.GetDrawable(img)
 

asales

Expert
Licensed User
Longtime User
There are several plugins in this library.
I checked the documentation made by @fredo (thanks!), but I'm not sure what I can do with some of these plugins.
Would be nice have a descripton for the plugins and if I can use it without the Amir_RecyclerView, like the plugins Amir_ViewManager, Amir_Animation, etc.
Thanks.
 

alimanam3386

Active Member
Licensed User
Longtime User
There are several plugins in this library.
I checked the documentation made by @fredo (thanks!), but I'm not sure what I can do with some of these plugins.
Would be nice have a descripton for the plugins and if I can use it without the Amir_RecyclerView, like the plugins Amir_ViewManager, Amir_Animation, etc.
Thanks.

Hi , they are not plug-ins.
 

lcuserfr

New Member
Licensed User
Longtime User
alimanam3386 said: After your purchase please send me an email with your purchase detail ( alimanam@gmail.com )

@ali,
payment of $ 25 with Paypal for the Full package and sending confirmation email to the given address.
Regards
 
Top