Individual Assignment 2

From CS1635 Spring 2016
Jump to: navigation, search

Deadline: by 9:00AM on February 9, 2016

Overview

In this assignment you will build a simple scribbling/note taking app that lets the users sketch simple illustrations with their fingers on their mobile device.

The purpose of the assignment is to deepen your understanding of drawing and touch event-handling on the Android platform

You will submit three things:

  1. your source code
  2. your executable (Make sure your executable has all resources that it needs to run.)
  3. a brief description about major challenges you addressed or lessons learned from this assignment.

Design Requirements

Requirements:

  • Application:
    • Create an application that accepts and responds to touch events. (reference: Input Events)
    • Using the touch data, track and display single finger movements on a canvas (Please refer to chapter 9 of Programming Android for drawing on a canvas) (Note: when you visualize your finger traces, you can use straight lines (3 or 4 pixels wide) to connect dots collected in a single stroke)
    • User must be able to clear the writing area
    • User must be able to select the color for displaying ink traces (selecting between a few pre-defined colors is sufficient)
    • The application should have at least two activities


One way to satisfy the application functionality requirements is to create an application with two views: one of the canvas, and another of an options screen that lets the user change modes and adjust settings.

Extra credit: Up to 5 extra credit points are available if you design and implement more features, such as:

  • Put your ink capture and display region into a Fragment, and attach the fragment to your activity, rather than directly adding a View to your target activity.
  • Show previous drawings on the canvas via a RecyclerView, each previous drawing will be one row in this RecyclerView. The left hand side of the row could be a thumbnail illustration of the corresponding scribble, the right hand side of the row could be the time-stamp when this view was adding. Clicking on a row could put the corresponding historical scribbles back to the main Canvas region.

Notes

Implementation

Client

First you need to get the user's input. You will need an OnTouchListener over the paint window to catch touch events.

There are a few ways to paint in Android. One way is to paint directly on a View object. If performance is an issue, i.e. for real-time graphics as is the case here, it is better to paint onto a Canvas object which gives the programmer more control and is usually faster. To do this, define a custom class which extends View and override its onDraw method. onDraw is where you do your drawing. onDraw will automatically be called with a Canvas object argument, so you don't need to extract the canvas from the View. In order to draw on the canvas, you will need to create one or more paint objects with the desired colors.

To put this custom View object in the hierarchy, create an instance of it in the main onCreate() method as you would for other Views, and then make it a child of a View or Layout widget that you have included in your XML layout file using View.addView. The new view will have "fill_parent" attributes by default, and so will fill available space which is probably what you want.

Because painting in Android (like most other GUI toolkits) is "smart", the display doesn't automatically change when you paint on the canvas. Instead you have to tell Android that the image really changed by calling View.invalidate().

This is by no means a brilliant design. You are free to design your own app provided that it has at least the functionality enumerated above.


Grading criteria

Up to 20 points will be given if your application compiles, runs, contains the functionality as detailed in the instructions.

Up to 5 extra points will be given if you implement additions that make the application more usable or more useful.

Submission Instructions

Create a Wiki Page for this assignment

Begin by creating a new wiki page for this assignment. Go to your user page that you created when you made your account. You can get to it by typing the following URL into your browser:

http://mips.lrdc.pitt.edu/cs1635-spring16/User:FirstName_LastName

Replace FirstName and LastName with your real first and last names. This will take you to the page you created for yourself when you created your wiki account. If you have trouble accessing this page, please check that you created your wiki account properly.

Edit your user page to add a link to a new wiki page for this assignment. The wiki syntax should look like this:

[[IndividualAssignment2-FirstName_LastName|Individual Assignment 2]]

Again replace FirstName and LastName with your name. Look at my user page for an example. Then click on the link and enter the information about your assignment. You should upload two files (described below) and in the wiki page, describe any extra credit functionality you implemented and want us to review.

Upload Project

  • Your submitted project must include the full source code as well as the executable of the working application and the one page challenges and lessons learned.
  • Create a zip file of your project tree (the top-level folder that includes the Eclipse project. Rename the zip file to apk2-firstname-lastname.zip (e.g., apk2-jingtao-wang.zip)
  • Upload the zip file to the IndividualAssignment2-FirstNameLastName page you just created:
    • Create a new file link like this: [[File:apk2-firstname-lastname.zip]]
    • Save the page, then click on the File link you just created to upload the zip file.

Add Link to Your Finished Assignment

One you are finished editing the page, add a link to it at the bottom of the page with your full name as the link text. The wiki syntax will look like this: *[[IndividualAssignment2-FirstName_LastName|FirstName LastName]]. Hit the edit button for the last section to see how I created the link for my name.

Links to Finished Assignments

Add your submission below this line: