Saturday, March 10, 2012

The Object design

Well, after some deep thoughts I finally made out how the app architecture will work.
Warning:
This is about the programming stuff, if you're a user, you probably won't find it really interesting...
So, in Android, the Java implementation needs an activity class, that does all the fancy stuff. In my case, that will be the ReadFeed class extending Activity base class. UI-wise, it will contain a ListView and optionally, if the screen is large enough, a WebView to read the articles straight away.

For the ListView to work, you need a data container called an Adapter. I've called mine FeeedAdapterand it extends the BaseAdapter android class. The adapter handles data operations requested by the ListView (like "give me item no. 13") and the drawing of the list items. The drawing part is crucial for my app to work as I want it to.

The dataset for the FeedAdapter is represented by a FeedView - that is a view of a number of separate feeds aggregated together into one stream if information. Every single feed item has it's own instance of the FeedItem class. A FeedItem has all the information neccesary to display it in a FeedView - the URL, the color label, the estimated importance of the article for the reader... The FeedItems are gonna be stored in a Collection (HashMap for now).
Next, the FeedView has a Filter class instance to filter the items, assign labels and importances to them and to do the smart stuff (like learn what the user likes).

In the basement of the app, there will be the DataDownloader class, that will be providing all the Internet communication services for the app, like updating the feeds or downloading the images do display. The downloaded data will travel to a FeedParser, that will get the feed items and store them locally, in the DB. Once in a while, a clean-up will be run to delete old items and free some space.
Then there will be a ContentProvider to transfer the items from DB to the FeedView.

The SettingsActivity will be quite simple as of the architecture. There'll be a page for managing feeds and a page for simple settings, no really interesting stuff there.

So, that's how it'll work. Now just to get it to work, and I'm done!

No comments:

Post a Comment