B4A Library [Lib, Chargeable] Amir_RecyclerView

wimpie3

Well-Known Member
Licensed User
Longtime User
I have discovered a bug in the parallax code example (Amir_RecyclerView HeaderParallax). Modify the following code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Recycler.Initializer("Amir").ListView.Build
Activity.AddView(Recycler,0,0,100%x,100%y)
Recycler.DividerHorizontal.Color(Colors.black).Size(0.5dip).Build
The last line causes an issue when you scroll... a strange line is floating around on the screen!
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Next issue:

B4X:
onItemLongClick

also causes onItemClick to fire. I think you should be able to return true/false in the long click sub, but it's not a function...
 

evbedp

Member
Licensed User
Longtime User
i had a problem, i'm use recycler view for image slide when recycler onBind, position always in index 2... item count is 3. please help me
 
Last edited:

evbedp

Member
Licensed User
Longtime User
i had a problem, i'm use recycler view for image slide when recycler onBind, position always in index 2... item count is 3. please help me
finally i got the solution, i must create fake or empty image first in the contentlist. when image got the new resources, i'm just need to clear the contentlist and insert new resources to the contentlist. add source code recyclerview.adapter2.NotifDataSetChanged to refresh the view.
 

alimanam3386

Active Member
Licensed User
Longtime User

As you can see in the Filter Sample "Main-RecyclerView\ARV-Main\Basic Sample\FilterSearch" you need to add items (which return in FilterSearchList method) to your recyclerView data list.
this code should works :

B4X:
Sub modifydata(query As String)
    If rcyclrItems.Adapter=Null Then Return
    rvdata.Clear
    If query.Length=0 Then
        rvdata.AddAll(ItemList)
    Else
      
        rvdata.AddAll(rcyclrItems.Utils.FilterSearchList("itemname",ItemList).Trim.SkipLowerCase.StartsWith(query))
        Log("SAize is"&rvdata.Size)
      
    End If
        callnotifier
End Sub
 

alimanam3386

Active Member
Licensed User
Longtime User

You are right, you can use reflection to add listeners :

next update I will fix it.

B4X:
Private Sub RV_onBindViewHolder (Parent As Panel,Position As Int)
  Parent.Tag = Position
  Dim r As Reflector
  r.Target = Parent
  r.SetOnLongClickListener("RV_LongClick")
End Sub
Private Sub RV_LongClick (tag As Object) As Boolean
  Log(tag)
  Return False
End Sub
 
Last edited:

alimanam3386

Active Member
Licensed User
Longtime User

It is Not a bug , use this code :

B4X:
Recycler.Initializer("Amir").ListView.Build
  Activity.AddView(Recycler,0,0,100%x,100%y)
  Recycler.DividerHorizontal.Color(Colors.black).Size(0.5dip).VisibilityProvider("RV").Build

Sub RV_DividerVisibility (Position As Int) As Boolean
  If Position=0 Then Return True Else Return False
End Sub
 

wimpie3

Well-Known Member
Licensed User
Longtime User
I want to disable a finger scroll, and only let the user scroll with two buttons: "previous page" and "next page".

I've implemented this with recyclerView.LayoutFrozen=True. This disables the finger swipe.

When someone clicks on one of the buttons, I set LayoutFrozen to False, go to the next/previous page and freeze the layout again in the Sub recyclerView_onScrollStateChanged using
B4X:
If NewState=0 Then
    ' page scroll finished
    recyclerView.LayoutFrozen=True: ' disable scroll
End If

However, from time to time I get this error:
B4X:
java.lang.IllegalStateException: Do not setLayoutFrozen in layout or scroll

So my question is: am I overlooking something or is there another way to disable the finger scroll?
 

alimanam3386

Active Member
Licensed User
Longtime User


With this following code you can disable RV touch
B4X:
RV.Listeners.AddOnItemTouchListener("RV")

Sub RV_onInterceptTouchEvent (Action As Int,X As Float,Y As Float,MotionEvent As Object) As Boolean 'Return true if you want disable touch
  Return True
End Sub


And If you want to disable only RV scroll , use this code (ViewHolder views are touchable)
B4X:
Sub RV_onInterceptTouchEvent (Action As Int,X As Float,Y As Float,MotionEvent As Object) As Boolean
  Dim jo As JavaObject = RV 
  jo.RunMethod("requestDisallowInterceptTouchEvent",Array(True))
  Return False
End Sub
 

Ashaz

Member
Licensed User
Amir_RecyclerView_GooglePlay_Demo

Powered Just with Amir_RecyclerView and B4A !

Download the Demo



i purchased amir recycleview.
now android play store sample gives below error.


--------------------
B4A Version: 9.50
Java Version: 8
Parsing code. (0.03s)
Building folders structure. (0.16s)
Compiling code. (0.05s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(Android Support Library)
Generating R file. (1.39s)
Compiling generated Java code. Error
javac 1.8.0_191
src\com\recyclerview\googleplaysample\itemrecyclerview.java:725: error: package androidx.recyclerview.widget does not exist
_rv.setObject((androidx.recyclerview.widget.RecyclerView)(group2.Get(index2)));}
^
Note: src\com\recyclerview\googleplaysample\starter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

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

alimanam3386

Active Member
Licensed User
Longtime User

Please update your sdk to androidX ( by sdk manager )

 
Last edited:

Ashaz

Member
Licensed User
i updated , ,now getting below error .

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. Error
h:\mohib\setups\b4a\android sdk\android-sdk\tools\..\extras\b4a_remote\androidx\core\core\1.2.0\unpacked-core-1.2.0\res\values\values.xml:163: error: Attribute "fontVariationSettings" has already been defined

Plz. guide.
 

alimanam3386

Active Member
Licensed User
Longtime User

it looks like a problem with sdk file try to change targetSdkVersion to 28 and try again. if the problem still not solved try to search in forum.
 

asales

Expert
Licensed User
Longtime User
Error
h:\mohib\setups\b4a\android sdk\android-sdk\tools\..\extras\b4a_remote\androidx\core\core\1.2.0\unpacked-core-1.2.0\res\values\values.xml:163: error: Attribute "fontVariationSettings" has already been defined
You can see the same error here:
 

Ashaz

Member
Licensed User


its solved. but now getting below error.

Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling generated Java code. Error
B4A line: 185
Activity.AddView(RecyclerView,0,0,100%x,100%y)
javac 1.8.0_191
src\com\recyclerview\googleplaysample\main.java:441: error: cannot access RecyclerView
mostCurrent._activity.AddView((android.view.View)(mostCurrent._vvvvvvvvvv5.getObject()),(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float) (100),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float) (100),mostCurrent.activityBA));
^
class file for android.support.v7.widget.RecyclerView not found
 

asales

Expert
Licensed User
Longtime User
Did you jetified the library?
Search to "RecyclerView" in the forum to get similar thread and a possible answer to your issue.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…