Reimplementing CrytpoNews in Native Android(UPDATE #6: Search Functionality)

in #utopian-io3 years ago (edited)

Link to Project

The aim of the app is to fetch news from different wordpress websites and display in the application. While the news are displayed, the app gives you the ability to click and view each news within the app. Instead of taking you out of the app, it gives you the comfort of viewing within the

History

Previous Updates

New Features

User can now search for Contents in the app

User can Enter Search QueryThe adapter Filters based on Users search query
Group.pngGroup 5.png
An Empty Screen is shown when nothing is foundLife cycle awareness when the app is rotated, search Query is preserved
Group 4.pngvideotogif_2018.05.09_23.13.36.gif

How it was Implemented

The resources for the icons were gotten from google icons. Commit can be found here

  • Handling Searching was a bit tricky but was achieved by using custom Adapter that implemented Searchable Adapter.

  • The Search View was instantiated here

         searchView.setOnQueryTextListener(this);            searchView.setOnQueryTextListener(this);
       if (mSearchQuery != null && !mSearchQuery.isEmpty()){
           String s = mSearchQuery;
           searchItem.expandActionView();
           searchView.setQuery(s, false);
            searchView.clearFocus();
        }

  • The Fragment implemented a listener which watched for change in the text when the user entered his search query in onQueryTextChange() method. This method contains the filter logic which used a for loop to scan through the List for matching text. The code for this can be found here

  • Saving the User search query was very important as i was able to cater for orientation changes in the activity in onSavedInstanceState method and was restored in onCreate method of the activity. This can be found here. Doing this i was able to preserve the fragment it self an the search Query.

  • Other Updates included introducing Databinding to the architecture i am already using. i am able to bind views direct with the data and it helped reduced a lot of broiler plate. A FragmentBindingAdapter was introduced to help directly bind the data to the xml. (no more setText() method in our fragment/activity).

  • Major Commit here

Resources

  • Github Pull Request- Link of PR can be found here
  • Apk for download - Download here
  • Versioning on Playstore on the way : Please kindly uninstall previous version before installing this version.

Roadmap

  • Searching all news
  • Persisting user news
  • Providing different layouts
  • Providing different themes for user
  • Push Notifications
  • News Posts sharing
  • Incorporating more news and giving the user the flexibility of deciding what he wants to read per time.
  • Able to save Favorites
  • Sort News
Sort:  

Thanks for the contribution!

I really like how descriptive your post was, keep up the good work!


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @mathemandy
Thanks for contributing on Utopian.
We're already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Beautiful work..

Thank you!!

Resteem bot Service! Promote Your New Post.Find New Followers - Upvotes. Send 0.400 SBD to @stoneboy and your post url in memo and we will resteem your post to 9500+ followers from two different account.@stoneboy and @vimal-gautam.

This is Very nice

Thanks

👍 we keep reading for appreciation and corrections

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by mathemandy from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Congratulations @mathemandy! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.99
TRX 0.13
JST 0.137
BTC 56288.17
ETH 2221.88
BNB 537.22
SBD 7.78