B4A Library [Lib, Chargeable] Amir_RecyclerView

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

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: 297

alimanam3386

Active Member
Licensed User
Longtime User


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

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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…