Reimplementing CrytpoNews in Native Android(UPDATE #4: Share News Functionality)

in #utopian-io6 years ago (edited)

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 app.

History

Previous Update

New Update

  • Share news post

The Share feature was added to make the application interactive and flexible. This makes users get to share interesting crypto news to anyone they wish to instead of manually copying the link from the website (i.e going to the website which is outside the app). Of course, users would like to do this at their comfort in the app.

This is how it was implemented

  • Firstly, the share icon was added to the menu_news_webpage.xml file. This is the icon that will help a user trigger an action to share.
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".NewsWebPageActivity">
    <item
        android:id="@+id/action_share"
        android:orderInCategory="100"
        android:title="@string/share"
        android:icon="@mipmap/share_icon"
        app:showAsAction="always" />
</menu>
  • Secondly, in the NewsWebPageActivity.java file, an intent is triggered to share the post with some attributes like subject and text of the post. Accompanied by a post sent, the title with url is displayed to a user before clicking to have a clue of what the post is about.
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_share) {

            Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
            sharingIntent.setType("text/plain");
            String shareBody = title + " " + url;
            sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
            sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
            startActivity(Intent.createChooser(sharingIntent, "Share via"));

            return true;
        }

Resources

  • Github Pull Request- Link of PR can be found here
  • Apk for download - Download here

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.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Congratulations @princessdharmy! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of posts published

Click on any badge to view your own Board of Honor on SteemitBoard.

To support your work, I also upvoted your post!
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Hey @princessdharmy! Thank you for the great work you've done!

We're already looking forward to your next contribution!

Fully Decentralized Rewards

We hope you will take the time to share your expertise and knowledge by rating contributions made by others on Utopian.io to help us reward the best contributions together.

Utopian Witness!

Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

Want to chat? Join us on Discord https://discord.me/utopian-io