This project is being carried out by Mauricio Guignard for elective "Android Programming: Introduction" of the Faculty of Mathematics, Astronomy, Physics and Computing (FaMAF), UNC, Argentina dictated by Professor Diego Mercado.
- Learn the communication between activities and their lifecycle
- Download the tag "activities_assignment" from the repository https://github.com/mercadodiego/RedditReader
- Pressing "Sign in or register" should invoke
LoginActivity
- Once logged in, the user name should be displayed on the screen
- Learn the basic principles of Layouts, View and View Groups on Android
- Learn to modify and add graphics and text resources to the application
- Download the tag "layout_assignment" from the repository https://github.com/mercadodiego/RedditReader
- Add Spanish translation
- Change application name to "Reddit Reader" in English and "Lector de Reddit" in Spanish
- Change application icon to ./images/reddit_icon.png
- Change package name to ar.edu.unc.famaf.redditreader
- Add a subreddit item layout as shown in ./images/screenshot1.jpg
- Implement a ListView that gets its content from a custom ArrayAdapter
- Download the tag "adapters_assignment" from the repository https://github.com/mercadodiego/RedditReader
- The class
ar.edu.unc.famaf.redditreader.model.PostModel
should represent a Post in Reddit. Add the attributes relating to title, author, creation date, number of comments, image preview / thumbnail, etc. with the corresponding setter / getter - Implement the method
List<PostModel> getTopPosts()
of the classar.edu.unc.famaf.redditreader.backend.Backend
. It should always return 5 dummy PostModel instances - Create a
ar.edu.unc.famaf.redditreader.ui.PostAdapter
class that extendsandroid.widget.ArrayAdapter
and re-implement the necessary methods NewsActivityFragment
should show a ListView occupying all the space available and must display the contents of each of the posts following the design implemented in the previous activity LayoutAssignment. Keep in mind that the title should always be displayed and the height of each row should be adjusted to allow it- Implement a ViewHolder in the
ar.edu.unc.famaf.redditreader.ui.PostAdapter
class to improve the performance of the ListView
- Implement an AsyncTask within the ListView to download the thumbnails from Internet
- Having completed the AdaptersAssignment activity
- The class
ar.edu.unc.famaf.redditreader.ui.PostAdapter
should implement an AsyncTask that given an URL previously defined in thear.edu.unc.famaf.redditreader.model.PostModel
class, allows to download the image and displays it in the ImageView representative of the image preview / thumbnail - An animated
android.widget.ProgressBar
must be shown while the image is being downloaded
- Make a call to a REST service, interpret the returned JSON and display the results on screen.
- Having completed the ThreadsAssignment activity
- The class
ar.edu.unc.famaf.redditreader.backend.GetTopPostsTask
should get the content of the first 50 Reddit's Top posts via HTTP in JSON format, interpret it and return as result aList<PostModel>
- The content must be displayed in the ListView of the
NewsActivityFragment
class - When no INTERNET connection is available, an AlertDialog or Toast must be displayed indicating the error
- The JSON interpreter must be defined in a new
ar.edu.unc.famaf.redditreader.backend.Parser
class and must implement the following input method, internally using an instance of JsonReader that returns an instance of a new class calledar.edu.unc.famaf.redditreader.model.Listing
(according to the structure of objects of the Reddit API)
public Listing readJsonStream(InputStream in) throws IOException {....}
- Implement a small SQLite database
- Having completed the WebServicesAssignment activity
- The class
ar.edu.unc.famaf.redditreader.backend.GetTopPostsTask
should implement the following behaviour:
- Invoke Reddit's REST service to get the 50 first TOP posts
- Persist the results in an internal database
- Return the results from the internal database
- If no internet connection is available, the last results obtained from the internal database must be returned
- The internal database must be implemented in a new class
ar.edu.unc.famaf.redditreader.backend.RedditDBHelper
that extendsSQLiteOpenHelper
- Should only store the last 50 posts. All the others must be deleted
- The thumbnails/preview should also be stored in the internal database as they are downloaded. Remember that they can be stored as a byte array:
public static byte[] getBytes(Bitmap bitmap)
{
ByteArrayOutputStream stream=new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG,0, stream);
return stream.toByteArray();
}
public static Bitmap getImage(byte[] image)
{
return BitmapFactory.decodeByteArray(image, 0, image.length);
}