You will create an interactive mobile application that allows users to create, modify and delete text notes. The whole application should respond to device orientation.
This assignment gives you an opportunity to build an interactive mobile application, and gain experience managing dynamic layout on a mobile device.
Design and implement a mobile application called Notepad, which allows users to display, create, edit and delete notes. The application should have two different views: one that displays all the notes and one to type in text. The application should look something like this:
When first launched, the application should show a scrollable list (RecyclerView) with all the existent notes thumbnails. The notes thumbnails should be displayed from the newest to the oldest.
For each thumbnail in the list, the title is displayed in bold and larger font, the first 15 characters of the first line of the note in gray below the title and a bin icon to delete the note. If the title is too long, it should be truncated. If the note has no title, the first 10 characters of the content should be displayed.
A button in the layout should be used to create a new note and open an activity to edit it.
The thumbnails in the list are well separated from each other by a line divider.
When touching a note thumbnail in the list, it opens a Activity to edit the associated note.
The edit Activity allows users to type a title, content and save a note. The content EditText is scrollable when text is long. Tapping the previous button saves the current note and reopens the main Activity with the list. If there is no title and no content typed (string is empty) when the previous button is pressed, the note is deleted. There is also a Save button that saves the note and goes back to the main Activity.
Your application should not hang or freeze-up when loading the note. Consider loading the text in the background to prevent this problem for large notes (>500 characters and under 5000 characters). Display the first 500 characters (for example) when opening the edit activity and load the rest of the note in background. See hints below.
The notes are persistent. If you create a note then close the app and reopen it, the note will appear in the list at startup.
You need to support two layouts: one that is shown when the phone is held vertically, and one when it is held horizontally. The user does not manually change the layout, but instead your application should respond to changes in phone orientation so that the appropriate layout is always shown. No data should be lost when the phone is rotated (note: the emulator uses a hotkey to change orientation, typically Ctrl-F11). When typing a note and changing orientation, text already typed should not be lost.
- You must create this assignment as an Android project using IntelliJ 2019.3, with the Android API 29 SDK. Instructions to install and configure IntelliJ are included in the Android development slides.
- If you are using an Android Virtual Device, create a Pixel 3 XL phone AVD using API 29.
- You can use any functionality included in the Android SDK, and are free to use code snippets from the Android sample code included with the SDK (i.e. a snippet being a small segment of code). You can also use any code that we introduce in the course (i.e. from the CS 349 Git repo). If you do this, put comments in your code referencing the original source. You are not allowed to use any other third-party code or libraries, unless you obtain permission from the instructor (permission on Piazza is fine).
- You are not required to use Model-View-Controller, but you *must* save your data in such a way that no data is lost during orientation changes, or when switching between activities.
To setup your environment and create a new porject, you can follow this tutorial.
Here's some suggestions if you're new to Android and mobile development.
- Create your project (recommended to use the "Empty" project). Setup your AVD, and configure the project to launch and run in the AVD. Projects are very difficult to get setup and build properly, so you want to make sure it's working before you start modifying anything.
- Commit and push changes to Git frequently! Anytime you make a substantial change (and your code compiles/works), then commit and push to Git.
- Android will handle the orientation change for you but make sure to save and restore data during the orientation change.
- Create a Main activity for your list and a second one to write or modify a note. Use intents or a shared model to pass information between these activities.
- Use a RecyclerView to display the notes thumbnails check the Android tutorial for this: RecyclerView tutorial.
- In Android, you have different places to store data. For this assignment, since the notes are only visible from the Notepad app, use only the internal storage. To store and access the app specific internal files and directory
- Consider using an AsyncTask to fetch data in the background. To test it, you can just load the first 2 characters and load the rest in background.
Your directory structure for your assignment submission should be in subdirectories under your a4/ directory in your Git repository. It should use a standard file layout for an Android IntelliJ project.
Your submission needs to include:
- All source code and resources required to build and execute your program.
- An IntelliJ project that compiles everything using the specified JDK and Android SDK, and which has a Run target that will execute your program.
- A `readme.md' file with any details required to help the TA grade your assignment.
- An APK file at the top-level of your directory structure. You will likely need to manually create this (Build -> Build APK) and copy to this location. This will help the TA to load and test your application without needing to load the project.
Your `readme.md' file needs to include, at a minimum:
- Your name,
- Your student number,
- Your operating system & version,
- The version of Java and the Android SDK that you used,
Late assignments will not be accepted. Markers will test your application by running your APK file against a Pixel AVD. Your submission will be assessed roughly as follows (detailed marking scheme to follow):
- Code compiles and runs, readme, working project.
- Application loads, and screen includes the create note button.
- Notes with their title content and delete button are shown in a scrollable list.
- User can create and delete notes.
- Tapping a thumbnail opens the edit note activity with the title and content of the note.
- Changing the orientation when in the edit note activity keeps the current text and title.
1.0. Mar 3, 2020. Initial release.
1.0. Mar 5, 2020. Clarified the SDK version.