$29.99
Assignment 2 – Android Notes
Uses: RecyclerView, Multiple Activity, JSON File, Option Menus
App Requirements
• This app allows the creation and maintenance of personal notes. Any number of notes are allowed (including no notes at all). Notes are made up of a title, a note text, and a last-update time.
• There is no need to use a different layout for landscape orientation in this application. The design/layout of this app should already work fine in either orientation (but you should test this to verify it works properly).
• Notes should be saved to (and loaded from) the internal file system in JSON format. If no file is found upon loading, the application should start with no existing notes and no errors. (A new JSON file would then be created when new notes are saved).
• JSON file loading must happen in the onCreate method. Saving should happen whenever a new note is added or a note is deleted.
• The application is made up of 3 activities. These are described below:
Notes should be displayed in a list, in time order (latest-update-first, oldestupdate-last). The note list must be implemented using the RecyclerView.
• The Main Activity will allow the user to create a new note via an Add options-menu item (use built-in icon ic_input_add). Tapping this menu icon will open the Edit Activity (described next) with empty Title and Note Text areas.
The main activity will allow the user to edit an existing note by tapping on an existing note in the displayed list of notes. Doing so will open the Edit
Activity, displaying the note’s Title and Note Text – both available for editing.
Notes can be deleted from the Main Activity by long-pressing on a note entry. Upon doing so, a confirmation dialog will be opened where the user can confirm (or cancel) the delete operation.
Note list-entries contain the note title (bold), the last-save-time, and the first 80 characters of the note text (see image). Notes titles or note text with more than 80 characters should display only the first 80 characters with “…” at the end (to indicate there is more content available).
The app title “Android Notes” ad the current number of notes is displayed in the title-bar.
The activity background should be set to a color other than white (preferable a darker color). The list entries should be a lighter version of that same color.
© Christopher Hield
CS 442 Mobile Applications
Development (Android Section)
The Edit Activity contains editable fields for the note title and note text. The last-save time is NOT displayed here and is never user-editable – it should be automatically generated and saved when the note is saved.
The note title is a single-line text field (EditText) where the user can enter or edit a title for the current note (no size limit).
The note text is a multi-line text area (EditText) with no size limit. This should have scrolling capability for when notes exceed the size of the activity.
The Edit Activity allows the note title & text to be saved by either:
a) Pressing the Save options-menu item (use built-in icon ic_menu_save).
This will return the new note to the MainActivity, and then exit the Edit Activity. MainActivity will then add the note to the MainActivity’s list of notes. Note that if no changes have been made to the current note, the Edit Activity simply exits.
b) Pressing the Back arrow to exit the activity. This will first display a confirmation dialog where the user can opt to save the note (if changes have been made) before exiting the activity. If saved, the new note is returned to the MainActivity, and then exit the Edit Activity. MainActivity will then add the note to the MainActivity’s list of notes. Note that if no changes have been made to the current note, the Edit Activity simply exits.
• Note this “Save” in steps “a” and “b” does not imply saving to file – it implies updating an existing note object in the Main Activity’s note list or adding a new note to the Main Activity’s note list.
• A note without a title is not allowed to be saved (even if there is note text). If such an attempt is made, show an Ok/Cancel alert dialog telling the user the note will not be saved without a title.
o Selecting Ok should close the dialog and EditActivity without saving o Selecting Cancel should close the dialog and remain in the EditActivity.
• The activity background should be set to a color other than white (the same color used in the Main Activity). The title and text fields should be a lighter version of that same color (the same color used in the Main Activity).
© Christopher Hield
CS 442 Mobile Applications
Development (Android Section)
The About Activity should contain a full-screen image background (use any non-copywritten image you desire).
There is no functionality present on this activity. The only action a user can take is to press the Back arrow to exit the activity.
Application Flow Diagrams (showing how the various behaviors should work)
© Christopher Hield
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield
CS 442 Mobile Applications
Development (Android Section)
Assignment Assistance
Submissions & Grading
1) Submissions must consist of your zipped project folder (please execute Build =>Clean Project before generating the zip file).
2) Submissions should reflect the concepts and practices we cover in class, and the requirements specified in this document.
• The following are the key points that will be examined in Project when graded:
• General (25%)
o Loads and Saves Notes to a JSON file – no errors displayed if file is not present.
o Load is initiated in the onCreate method, save is performed whenever a new note is added or a note is deleted.
o A separate Note class used to represent note data
o App is functional and visible in portrait and landscape orientations
• MainActivity (37%)
o Options Menu is present in App-Bar and is displayed as Icons o Clicking Add button opens the Edit Activity
o Clicking Info in the list opens the About Activity, displaying the note’s title and content o Long-click on a note in the list displays Delete Confirmation dialog.
▪ Approving dialog results in note deleted from list
▪ Cancelling dialog leaves the list unchanged
o Activity background color is a color other than white o List uses RecyclerView
o Note list is displayed in order of most recent first
o List entry contains a bold title, the last-save-time, and note text is limited to 80 chars
▪ Adds “…” for titles and notes containing more than 80 chars
© Christopher Hield
CS 442 Mobile Applications
Development (Android Section)
• EditActivity (28%)
o Contains editable fields for title (single line) and note text (multi-line) o Options Menu is present in App-Bar and is displayed as Icons
o Clicking Save button saves the note, closes the EditActivity, and updates the MainActivity
list o Clicking Back button displays Save Confirmation dialog.
▪ Approving dialog results in note saved, closes the EditActivity, and updates the MainActivity list
▪ Cancelling dialog closes the EditActivity and leaves the list unchanged
o Notes with no title are not saved (Toast message informs the user) o Activity background color is a color other than white
• About Activity (10%)
o Contains full-screen background image
NOTE
This assignment is worth 200 points (your first assignment was worth 100 points).
This means (for example) that if you get 89% on this assignment, your recorded score will be: (89% * 200 points = 178 points)
If you do not understand anything in this handout, please ask.
Otherwise the assumption is that you understand the content.
Unsure? Ask!
© Christopher Hield