Open Source Project - Crypto News App (UPDATE #5: Search Functionality)
The aim of the application is to fetch news feed from preferred blogs and display on the application. It is structured in such a way that you can scroll through them like you would do on your social media timeline. It also leverages you the ability to read any of these news, right there on the app without having to open another browser application.
Previous Updates
- Open Source Project - Crypto News App
- Open Source Project - Crypto News App (UPDATE)
- Open Source Project - Crypto News App (UPDATE #2: Favourite posts Section)
- Open Source Project - Crypto News App (UPDATE #3: Share Post Functionality)
- Open Source Paroject - Crypto News App (UPDATE #4: Image Caching, Internet Connectivity & Duplication Fix)
Updates
Search and Filter: In this new update, I added search functionality. Being able to filter specific information from a list/collection is one feature every application that handles data should have. I have now added that functionality to CryptoNews app. Users can now search within posts and filter out specific information based on their search.
First, I added a search bar to the content page.
<SearchBar TextChanged="SearchBar_TextChanged"></SearchBar>
Then I set an EventListener in the code behind to handle changes to the text in the searchBar entry.
public void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
{
var viewModel = BindingContext as BlogPostsViewModel;
var list = viewModel.BlogPosts;
if (string.IsNullOrEmpty(e.NewTextValue))
{
BlogPostsListView.ItemsSource = list;
}
else
{
var newList = list.Where(x => x.Title.ToLower().Contains(e.NewTextValue.ToLower())).ToList();
BlogPostsListView.ItemsSource = newList;
}
}
What this block of code does exactly is to handle any change in the text of the search bar entry. If nothing is typed in, the resulting list is the original list from the database. However, with changes to the search text, the list updates itself to match only results containing the searched string in their title.
https://github.com/Johnesan/CryptoNews/blob/master/CryptoNews/CryptoNews/Views/BlogPosts.xaml.cs
- I created a custom renderer to handle having the search bar in the toolbar because xamarin.forms does not support it right out of the box. However, because of the fact that it is a hacked attempt, few compatibility issues still exist which may cause the app to close unexpectedly sometimes, when implemented.
More details of what I did are reflected in the commits
Roadmap
Due to the various issues associated with using a crossplatform framework such as large application file size, this application would be ported to native development environment to ensure seamless exprience, smooth feel, and leveraging usage of native API functionalities. @princessdharmy and @mathemandy have offered to help in that regard. This would leverage me time to focus more on the iOS implementation.
The scope of this application will eventually broaden to emcompass news from every sector (and not just crytpo).
Github Commits
- https://github.com/Johnesan/CryptoNews/commit/d1879093f5224170ec399a76f01b685f524d147a
- https://github.com/Johnesan/CryptoNews/commit/9a2caa00ae2789114d11a0a0c1e32febeb904133
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @johnesan I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x