B4i Library [class] SearchView

This class is similar to B4A SearchView class. It allows the user to filter a list of items based on a term (prefix matches first followed by other matches).

It uses the new RichString class to highlight the matching terms. Note that the scrolling and filtering performance in release mode are very good. It can be a bit jumpy in debug mode.


New version of SearchView is now available. It is implemented as a custom view. It also properly handles the keyboard state.
 

Attachments

  • SearchView.zip
    7.5 KB · Views: 331
Last edited:

miker2069

Active Member
Licensed User
Longtime User
Is it possible to add an item with more than just one line? I believe with the equivalent in B4A you can add singleline and doubleline. Is it possible to add a custom view or something (i.e., an entry with a line and an icon?)
 

Shay

Well-Known Member
Licensed User
Longtime User
How do I put default text on it
there is no sv.text = "something"

and second question, how do I do sv2.enabled = false
since I want to enable it only after sv1.text has something in it
(sv1 = cities, sv2 = streets)
I wish to load only the relevant streets by city
 
Last edited:

Shay

Well-Known Member
Licensed User
Longtime User
I am getting error that my IDE is older (I am using 1.80)
 

narek adonts

Well-Known Member
Licensed User
Longtime User
I have updated Erel's SearchView with using the iOS native SearchViewController (like in iMessage, Whatsapp, Viber,...)

It is just the basic wrapping so you can contribute to it.

For current users of SearchView you do not need modify anything in your code.

Project attached.

Narek
 

Attachments

  • searchView.zip
    4.2 KB · Views: 163

John Woodsmall

Active Member
Licensed User
Longtime User
This works very well on most text files. However I have 271 "Div/state" files...the entire list of cities
in the world. The 3 one I tested is "UK.TXT" which is a simple ascii list of the cities in the UK.
I get "encode-error" when I try to open it:"Error reading file. Incorrect encoding"

I have checked the file and can not find any weird letters?
 

Attachments

  • uk.txt
    47.1 KB · Views: 12

John Woodsmall

Active Member
Licensed User
Longtime User
In the "New" from:"narek-adonts" search view above (which I have added to my app) it does not seem to return a value to
the sv_ItemClick(Value As String)
.
On the first one (above) it works correctly. But on the new one which looks great(i would love to use it)
it does not seem to return a value. All i did was replace the new *.bas to my app.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Open the file with Notepad++ and change its encoding to UTF8:

SS-2016-01-13_17.31.30.png


However this file is too large for SearchView to index. It will probably be quite slow.
You should follow these steps: https://www.b4x.com/android/forum/threads/61872/#content
 
Top