I have implemented an activity that retrieves data from a web service and display it in the AutoCompleteTextView. This has been working quite well.
I'm interested in displaying a spinning animation while the data is being retrieved (The same effect like the Quick Search Box)
I try to figure out how the QSB is doing it (10x Open Source!) but couldn't find any place where the spinner image is being put/set/drawn onto the EditText control.
alt text http://img704.imageshack.us/img704/8210/spinnera.png
There is no public interface to set the 'working spinner'.
If you implemented the suggestion provider, the spinner shows when the query starts.
Reference
Related
I have followed this tutorial and have successfully implemented a recylerview with searchview in my app https://github.com/Wrdlbrnft/Searchable-RecyclerView-Demo. However, now instead of having text in my recylerview I have icons representing two states for a user Online and Offline, what I want to do is when the user types in Online in the searchView I only want the Online icon to show up and simiarly when they type Offline I only want the offline icon to show up.
To filter text, as shown in the example I have done this;
if (personStatus.contains(query)) {
filteredModelList.add(model);
}
This works perfectly for text based results in my recylerview, however, I want to filter based on icons in the recylerView.
The icon can either be R.drawable.Online or R.drawable.Offline. I have a imageView called icon.
What I have tried so far;
if(query.toLowerCase().equals("online") {
filteredModelList.add(model.getIcon().getDrawable(R.drawable.online));
}
This doesn't seem to work, I get a error on getIcon, it says cannot resolve method getIcon. I do have a method getIcon as shown in the example above in the exampleModel class;
what I want to do is;
IF searchView text = "Online" THEN
Only show recylerview items that contains icon Online
I hope I have explained myself fully, if not please let me know.
The approach you are using might be slow when dealing with large data set, because you are doing the search on the main thread. If the searching does not complete in 8ms you are about to experience junk.
Comparison that you are using query.toLowerCase().equals("online") is fine. You need to move that logic inside your adapter that should implement Filterable. You need to toggle that online/offline status in your model, like: setStatus(Status.ONLINE) or setStatus(Status.OFFLINE) so iteration to find all items for particular status is easy, only with using your condition & constraint from the SearchView, i.e query.toLowerCase().equals("online").
Take a look at my answer here. It is more or less I mentioned.
What's the best approach in Android to get a searchview with autosearch results styled like this example from the Uber app? I especially like how the results are displayed directly on the screen and not with a dropdown look.
I was thinking possibly getting the query of a search and add the results on the screen dynamically as buttons but there must be a simple way to achieve the style and functionality they have here. Open to any suggestions.
I just took a look at the Android's Uber app, and there they have an EditText on the top with a ListView below that. Whenever the user types in anything in the EditText, the query is made to the server to get the data from it, and the results are displayed in the ListView below.
You should make the query to the server in afterTextChanged() method of the EditText TextWatcher. Also, make sure when the user is typing in continuously, cancel the previous request and only the latest char change query string should go in the request.
I have a text gathered from API and it consists of custom syntax. I display it using TextView but I need to render special part of the text and convert those text into elements. An example of a text is below.
Oh, that's great idea! Check (user: someuser)'s answer for this.
You can as well look at (ref: a forum post title) or:
(ref: another forum post)
This is a hint for you! (hint: should be displayed as a mini icon
but when clicked, a tooltip should be opened)
Here is a spoiler for you.
---- spoiler ----
some spoiler. this text should not be displayed directly but it should be
converted to a button element. When the button is clicked, this text should
be shown
---- spoiler ----
So, I need to convert (user: someuser) into a link in the view which will be shown as "someuser" but when clicked, it will open a new intent. For (ref: topic) keyword, it's the same. When I hit spoiler, I want to make it a nice button indicating that it's a spoiler and when user clicks, it will expand.
How can I parse this text and show correctly in a view? I don't have problem with parsing but my problem is displaying those elements in the view.
Methods I Tried
I tried WebView instead of TextView thinking that I can convert those into HTML/Js but the performance was terrible. Although I use RecycleView and ViewHolder, WebView is simply an overkill. I need to use some kind of a TextView but with the elements I would like to have.
I also looked at custom HTML tag handling with TextView (thinking I can convert those legacy tags into html) but I failed to see how I can insert button for spoiler tag or insert custom elements like tooltip for hint.
Thank you!
I want to create a activity which should display my data same as the default contactView in android. Below is the snapshot . I want UI same as the image below.
a search box and all the alphabets at the right hand side of UI.
My data is coming from webservice and i want to display it just like default android contactsView
this is quite an old style of how the contacts app look like.
anyway, what you can do is to use pinnedHeaderListView library , and for each item put a simple imageView and textView.
for the tabs, use the tabs navigation as used on actionBarSherlock library
I am a newbie to android and trying to implement Quick Search Dialog for my application.
Actually, in my application I have an activity
1. where I have a Edit text and Search Button next to it
2. Add Button and a Employee Table below it.
Whenever the user enters the search string in the EditText and clicks the Search button , I am calling the Quick Search Box and luckily it opens with the Search and here the user can see the given search query.
Till this, every thing works perfectly as I want.
But what I want is:
On-Clicking the Search button,the search query is displayed in the QSB and what I want is to display custom suggestions based on the search query and selecting the valid data , it should be saved in the Employee table.
Now I want Custom Suggestions to be displayed in a list view based on the search query.
How do I proceed to achieve this.
Please provide links for Quick search Box custom suggestions also.
Thanks and Regards,
Fazal Ahamed B
This is described here: http://developer.android.com/guide/topics/search/adding-custom-suggestions.html