B4A Library [Lib, Chargeable] Amir_RecyclerView

asales

Expert
Licensed User
Longtime User
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

the download link will send soon.
It works. Thanks.

A small addition in code:
B4X:
Dim Drawable As BitmapDrawable
Drawable.Initialize(LoadBitmap(File.DirAssets,"close-btn.png"))
Dim Jo As JavaObject = Holder.ButtonView
Jo.RunMethod("setImageDrawable",Array(Drawable))
 

Almora

Active Member
Licensed User
Longtime User
I am using
* AX_RecyclerView
* Amir_Glide

libraries board with Jetify.
I get such an error..

ka_amir_onbindviewholder (java line: 483)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
at com.bumptech.glide.GlideBuilder.<init>(GlideBuilder.java:33)
at com.bumptech.glide.Glide.initializeGlide(Glide.java:219)
at com.bumptech.glide.Glide.checkAndInitializeGlide(Glide.java:180)
at com.bumptech.glide.Glide.get(Glide.java:164)
at ir.aghajari.retrofitglide.Amir_Glide.<init>(Amir_Glide.java:74)
at ka._amir_onbindviewholder(ka.java:483)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at com.aghajari.rv.Amir_RVAdapter$Amir_RVAdapterWrapper.onBindViewHolder(Amir_RVAdapter.java:166)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
.......
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2176)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1936)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6035)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.


--------------------------------------------------------------

AX_RecyclerView works fine but when I integrate Amir_Glide this error occurs.



B4X:
#Region  Project Attributes
    #ApplicationLabel: AX_RecyclerView
    #VersionCode: 1
    #VersionName: 1.00
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
   
    #BridgeLogger : true
#End Region

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

Sub Process_Globals

End Sub

Sub Globals
Dim Recycler As AX_RecyclerView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Recycler.Initializer("Amir").ListView.Build
    Activity.AddView(Recycler,0,0,100%x,100%y)

    Dim Adapter As AX_RVAdapter
    Adapter.Initialize("Amir",Adapter.LOOP_NEVER)
   
    Recycler.Adapter=Adapter
   

    Activity.Color=Colors.White
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,10dip,10dip,Parent.Width-20dip,190dip)
   
    Dim img As ImageView
    img.Initialize("")
    Panel.AddView(img,0,0,Panel.Width,Panel.Height)

     Dim Title As Label
     Title.Initialize("")
    Panel.AddView(Title,20dip,20dip,Panel.Width-40dip,50dip)

    Dim Text As Label
    Text.Initialize("")
    Panel.AddView(Text,20dip,Panel.Height-100dip,Panel.Width-40dip,100dip)
End Sub

Private Sub Amir_onBindViewHolder (Parent As Panel,Position As Int)
    Dim Panel As Panel = Parent.GetView(0)
    Panel.Color = Colors.White
    Panel.Elevation=4dip
   
    Dim img As ImageView = Panel.GetView(0)
    Dim Title = Panel.GetView(1) , Text = Panel.GetView(2) As Label
    Dim Color2 As ColorDrawable
    Color2.Initialize(Colors.DarkGray,0)
    img.Background = Color2

    Title.TextColor=Colors.White
    Title.TextSize=35
    Title.Text="Item : "&(Position+1)
    Text.TextColor=Colors.White
    Text.TextSize=14
    Text.Text="Do one thing at a time, and do well.Keep on going never give up. Whatever Is worth doing Is worth doing well.I can because i think i can.Jack of all trades And master of none."
    Parent.Height=210dip
    'Parent.Width=100%x
    LoadImage(img,Position)  
   
End Sub

Private Sub LoadImage (Img As ImageView,Position As Int)
    Dim Glide As Amir_Glide
    Glide.Initializer.Default
    Dim Color2 As ColorDrawable
    Color2.Initialize(Colors.DarkGray,0)
    Glide.RequestManager.SetDefaultRequestOptions(Glide.RO.ErrorDrawable(Color2).FallBack(Color2).Placeholder(Color2).CenterCrop)
    Select Case Position
        Case 0
            Glide.Load("http://s9.picofile.com/file/8333943434/skid_right_1.gif").Apply(Glide.RO.CenterCrop).Into(Img)
        Case 1
            Glide.Load("http://s9.picofile.com/file/8333943450/skid_right_2.gif").Apply(Glide.RO.CenterCrop).Into(Img)
        Case 2
            Glide.Load("http://s9.picofile.com/file/8333943468/skid_right_3.gif").Apply(Glide.RO.CenterCrop).Into(Img)
        Case 3
            Glide.Load("http://s8.picofile.com/file/8333943492/skid_right_4.gif").Apply(Glide.RO.CenterCrop).Into(Img)
        Case 4
            Glide.Load("http://s9.picofile.com/file/8333943518/skid_right_5.gif").Apply(Glide.RO.CenterCrop).Into(Img)
        Case 5
            Glide.Load("http://s8.picofile.com/file/8333943526/skid_right_6.gif").Apply(Glide.RO.CenterCrop).Into(Img)
    End Select
End Sub


Private Sub Amir_GetItemCount As Int
    Return 6
End Sub


main_loadimage (java line: 466)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
at com.bumptech.glide.GlideBuilder.<init>(GlideBuilder.java:33)
at com.bumptech.glide.Glide.initializeGlide(Glide.java:219)
at com.bumptech.glide.Glide.checkAndInitializeGlide(Glide.java:180)
at com.bumptech.glide.Glide.get(Glide.java:164)
at ir.aghajari.retrofitglide.Amir_Glide.<init>(Amir_Glide.java:74)
at b4a.example.main._loadimage(main.java:466)
at b4a.example.main._amir_onbindviewholder(main.java:417)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at com.aghajari.rv.Amir_RVAdapter$Amir_RVAdapterWrapper.onBindViewHolder(Amir_RVAdapter.java:166)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
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:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at anywheresoftware.b4a.BALayout.onLayout(BALayout.java:43)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
at android.view.View.layout(View.java:16652)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2176)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1936)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6035)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class
Message longer than Log limit (4000). Message was truncated.
 
Last edited:

asales

Expert
Licensed User
Longtime User
Can you post a new Demo Source Code with the new components of the AndroidX?

I tried to change the example, but I got this error:
B4X:
src\com\aghajari\recyclerview\samplev2\rva_discrete.java:498: error: package android.support.v7.widget does not exist
public void SetOnClickNavButtonView (android.support.v7.widget.Toolbar toolbar)
 

alimanam3386

Active Member
Licensed User
Longtime User
AX_RVSwipeLayout 1.00

A layout that you can swipe/slide to show another layout.

Flexible, easy to use with Amir_RecyclerView.
Four drag edges (left, right, top, bottom).
Two drag modes:
  • Normal (the secondary view is underneath the main view).
  • Same level (the secondary view sticks to the edge of the main view).
Able to open one row at a time.
Minimum api level 9.


---- Package Update Log ----


RV Demo Source Updated to AndroidX (OLD)
New plugins added to list :


  • SwipeLayout (AndroidX) (New)
  • ItemPicker (AndroidX)
  • ChipsLayoutManager
  • PageIndicator (AndroidX)
 
Last edited:

itgirl

Active Member
Licensed User
Longtime User
AX_RVHeaderParallax 1.00


An Amir_RecyclerView plugin which could be used to achieve a parallax effect on AX_RecyclerView/Amir_RecyclerView.
you can customize everything.

thanks for your support
Actually i made this parallax effect using code and scroll events , but now with this plugin all my work is useless, lol big thanks for this it is important feature
 

alimanam3386

Active Member
Licensed User
Longtime User
New version of Amir_RecyclerView (AX_RecyclerView) (Version 1.1.0) has been released.

Whats new ?
  • New Plugin Amir_RVCardViewAdapter 1.00
  • New Class AX_RVMixAdapter
  • Update Plugin AX_RVHeaderAdapter 1.04

AX_RVMixAdapter :
A new adapter which could be used to add multiple adapter in recyclerview. (Each adapter is identified by ItemViewType).
Sample Path : ..\ARV-Main\Basic Sample\MixAdapter-AndroidX

AX_RVHeaderParallax 1.04 :

An Amir_RecyclerView plugin which could be used to achieve a parallax effect on AX_RecyclerView/Amir_RecyclerView.
Update : now you can use this parallax effect in viewpagers (used AHViewPager in samples) !

Amir_RVCardViewAdapter 1.00 :
An Amir_RecyclerView plugin which could be use to add CardView as parent of RecyclerView Items. (all methods and events are same with Amir_RVAdapter. only CardView method is new)
 

kelevra1602

Member
Licensed User
Longtime User
In the example of Amir_RVStickyHeader if I add:
B4X:
RecyclerView.SpaceItemDecoration.ListView (16dip, True, True)
when it passes through the spaces, the header disappears and reappears until the space ends, causing a strange blink

How could solve this without removing the space?
 

alimanam3386

Active Member
Licensed User
Longtime User

Try to add item space in parent
 

Attachments

  • space_item_arv.zip
    9.7 KB · Views: 251

tiziana.tinnirello

Member
Licensed User
Longtime User

Same error, tried to change all ref but android.support.v7.widget.Toolbar toolbar error still here. Solutions ?
 

alimanam3386

Active Member
Licensed User
Longtime User
Same error, tried to change all ref but android.support.v7.widget.Toolbar toolbar error still here. Solutions ?


You are using the old code . try to replace code ( #If java ) with below code :

B4X:
#if java
public void SetOnClickNavButtonView (androidx.appcompat.widget.Toolbar toolbar){
android.view.View nav=getNavButtonView(toolbar);
if (nav==null){return;}
nav.setOnClickListener(new android.view.View.OnClickListener(){
@Override
public void onClick (android.view.View arg0){
try{
_activity_actionbarhomeclick();
}catch (Exception e){}
}
});
}

    public android.view.View getNavButtonView ( androidx.appcompat.widget.Toolbar toolbar) {
    try { try {
      java.lang.Class<?> toolbarClass =  androidx.appcompat.widget.Toolbar.class;
      java.lang.reflect.Field navButtonField = toolbarClass.getDeclaredField("mNavButtonView");
  boolean isAccessible=navButtonField.isAccessible();
          navButtonField.setAccessible(true);
          android.view.View navButtonView = (android.view.View) navButtonField.get(toolbar);
  navButtonField.setAccessible(isAccessible);
          return navButtonView;
      }
      catch (java.lang.NoSuchFieldException  e) {
          return null;
      }
    } catch (java.lang.IllegalAccessException e) {
    return null;
    }
    }
#End if
 

maddy

Member
Licensed User
Hey @Amir i am unable to filter the items in recyclerview actually i am binding recyclerview with Objects and i am trying to filer the list with the itemname provided in searchbar but the data is not updating in ui altough i am calling notifyadapteer.Here is attached code

B4X:
Sub modifydata(query As String)
    If rcyclrItems.Adapter=Null Then Return
    rvdata.Clear
    If query.Length=0 Then
        rvdata.AddAll(ItemList)
    Else
        
        'iDetails.rvdata.AddAll(iDetails.rcyclrItems.Utils.FilterSearchList("",iDetails.ItemList).Trim.SkipLowerCase.StartsWith(query))
        For i=0 To ItemList.Size-1
            Dim iData As ItemData
            iData.Initialize
            iData=ItemList1.Get(i)
            If iData.itemname.StartsWith(query) Then
                rvdata.Add(iData)
            End If
        Next
        rcyclrItems.Utils.FilterSearchList("CustomType",rvdata)
        Log("SAize is"&rvdata.Size)
        
    
    End If
        callnotifier
End Sub
public Sub callnotifier
    rcyclrItems.Adapter2.NotifyDataSetChanged
End Sub
Here idata is a custom type object like this
Type ItemData (itemno As String, itemname As String,qty As String,amount As String,Price As String)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…