Home Assignment 1
- Have an activity with design such as in figure A, presenting a RecyclerView-based list of the phones contacts (using Contacts content provider, Cursor) ( 6 pts)
- Content Providers with an example of getting contacts were discussed in lecture 4
- Tip: You will have to do at least a total of 2 queries, as the list of contacts and data about contacts (such as e-mail) are stored in different tables.
- Selecting one contact opens up their details in a new activity (Email composition activity) and provides means for sending an e-mail, including EditTexts to capture a title and body for the e-mail ( 3 pts)
- Required details: Full name, phone no., email
- Use startActivityForResult() when opening this new activity so you can later handle the results (read below)
- Pressing the send e-mail button will forward an intent to send an e-mail, passing along relevant information (the recipient's e-mail, e-mail title, body) ( 3 pts)
- This intent should cause an e-mail app to open up (such as Gmail) with the recpient address and e-mail body pre-filled
- Alternatively, if the user does not press send e-mail, but hits the back button, they are returned to the contact list activity and a temporary message should appear with the text "Mail composition cancelled".
- When the user is in the e-mail app (e.g. Gmail), after hitting "send" (which closes the mail App), the e-mail composing activity automatically closes without user input. The user is immediately returned to the contact list, and a message/indicator next to the chosen contact appears indicating that an e-mail was composed for them (up to you how to display the message exactly).
- The app should also have an action bar with working search (filter) functionality (filter contact list by name). ( 3 pts)
- Use SearchView
- I recommend using setting a SearchView.OnQueryTextListener, but other SearchView based solutions are also fine.
- Use SearchView
- Make sure your application takes care of lifecycle changes & user state
- Filtering results must not be lost e.g. when switching phone orientation
- The app should take care of requesting permissions if they are not already granted.
- Empty inputs, missing permissions should not make the app crash!
- if you fail to meet this requirement you will receive a penalty of -3 pts
Note:
- You may have noticed that Gmail doesn't actually give you any distinct resultCodes when the user sends the e-mail or actually cancels/closes the gmail app without sending. Since we don't know which e-mail apps make proper use of resultCodes, for this assignment you can just assume the e-mail was sent, even if the user canceled it.