Code Monkey home page Code Monkey logo

android-rssv2-reader's Introduction

Simple RSS NEWS reader

originally an assignment in the NTNU course IMT3673 2019

This app was made using

  • Samsung galaxy S5 with android 6.0.1 (Real phone)
  • NEXUS 5X API 28 (Emulator)

About

This is a simple RSS news reader using rss2.0. It has been tested on the rss feeds form:

the app consists of 2 Activities. MainActivity that uses 2 fragments, List and preferences. and a WebActivity for displaying websites. A SQLite database to store rss articles. One background service that downloads rss articles and stores them in a database.

List fragment

in the list fragment you may read the tittle, publication date and descriptions of rss articles. by long-clicking on a item in the list the app will open the rss link in a web browser over the rss list is a edit text field, where you may search all the articles stored in the database based on a regex pattern. the button next to th field activates the search. A empty search will refresh the rss list(by checking the database for new entries).

Preference fragment

In the preference fragment you may specify the following things for the apps behavior.

  • the source of the rss feed to be displayed in the list fragment.

  • how often the background service is to run

  • how many entries to be displayed in the list fragment

  • a editText field to add new rss source url

  • a button for applying changes

invalid entries are rejected, and will result in a snackBar displaying an error message.

WebActivity

a simple WebView that uses a url it gets as a parameter to open a website.

Technical implementation

The app is organized by a tab layout. in order to move between the fragments you may push one of the tabs, or you may swipe left of right.

about the rss list

the list fragment is made using a recyclerView with a card layout. In order to perform the required regex search. the app extract entries from the database and does a regex match in java. I originally wanted to perform the regex search in the database directly. but found that SQLite does not support such functionality. it has a function for searching for a word pattern by using "LIKE %pattern%", but this would not be a fully functional regex search. clicking on a card , long or short, will open WebActivity.

about preferences

i have only tested the app for use with rss2.0. adding a new entry to the rss url source will also add it to a list of url that a background service monitors for new content. in order to apply any changes you must press the "Apply Changes" button. only then will the app try to validate and activate the changes. preferences are stored in DefaultSharedPreferences. this is because it is the recommended way to do it in android. and because DefaultSharedPreferences are easily accessible to all activities, fragments and classes.

about the database

for the database implementation i used the ROOM feature of SQLite. the app only uses one table that look like this:

    link (primary key), title, pubDate, description, origin, sortValue, imageUrl

about the background service

the background service is implemented as a android jobservice, using jobScheduler. this allows the service to run only if several criteria are met. criteria like time or if network is available. the drawback of using this method is that android may not run the service exactly when it is suppose to. for example you may specify the app to run every 30 minutes. but android may run it every 29, 31, 33 minutes or their about in stead. also the minimum time between runs are 15 minutes.

test

all tests are located in Android-RSSv2-reader/app/src/androidTest/java/com/android_lab_2/ExampleInstrumentedTest.java

about other things

in order to parse the rss XML feed. i use XML pull parsing. I originally thought about using XML DOM paring instead. by i found that this is so memory consuming it is not the recommended way to do XML paring in android.

Checklist

  • The git repository URL is correctly provided, such that command works: git clone <url>
  • The code is well, logically organised and structured into appropriate classes. Everything should be in a single package.
  • It is clear to the user what RSS feed formats are supported (RSS2.0 and/or Atom)
  • The user can go to Preferences and set the URL of the RSS feed.
  • The user can go to Preferences and set the feed item limit.
  • The user can go to Preferences and set the feed refresh frequency.
  • The user can see the list of items from the feed on the home Activity ListView.
  • The user can go to a particular item by clicking on it. The content will be displayed in newly open activity. The back button puts the user back onto the main ListView activity to select another item.
  • The user can press the back button from the main activity to quit the app.
  • When the content article has graphics, it is rendered correctly.
  • The Filter EditText works as expected.
  • The app has JUnit Tests for testing the parsing, and the filtering functionality.

android-rssv2-reader's People

Contributors

isberg1 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.