Components
-Screen -Horizontal scroll arrangement -Button (Red_Button) -Button (Blue_Button) -Button (Green_Button) -Button (Yellow_Button) -Button (Cyan_Button) -Button (Magenta_Button) -Canvas -Horizontal Arrangement -Slider -Label (Dotsize_Label) -Horizontal Arrangement -Button (Fill_Button) -Button (NoFill_Button) -Button (Wipe_Button) -Horizontal Arrangement -Button (Camera_Button) -Image Picker -Button (Reset_Button) Non-visible Components -Camera |
Coding
The app uses a total of 19 event handlers and 2 sets of code that initialize certain variables. The first 6 event handlers allow the user to select the color they use to draw on the canvas. There are 6 different colors that can be selected by pressing their respective button. The next event handler is triggered when the canvas is tapped. It will place a dot on the exact x and y location that is tapped on the canvas. The size of that dot is determined by the global variable ("dotsize"). The dot is either filled or not filed based of the global variable ("fill"). The next event handler is triggered by dragging on the canvas. It will draw what seems like one free-form line, but instead makes a lot of tiny, combined lines. The lines are made from the previously touched x and y coordinate to the current x and y location. |
The next code sets the variable "dotsize" to a value of 6 when the app starts up. The next event handler sets the thumb position on the slider to 6 when the app initializes. The next event handler is triggered when the slider thumb position is moved. When it is moved the "dotsize" variable is set to the thumb position and the label is set to "Dotsize = ("dotsize")". The next code initializes the variable "fill" to true, which means that dots on the canvas are filled in. The next two handlers control two different buttons, the Fill_Button and the NoFill_Button. When the Fill_Button is clicked the variable "fill" is set to true, and when the NoFill_Button is clicked the variable "fill" is set to false. The next event handler is triggered when the Wipe_Button is clicked and it wipes the canvas. The next event handler is triggered when the Camera_Button is clicked and it causes the camera to open. When a picture is taken by the camera the canvas background is set to that picture.
|
The next two event handlers are for one button. When the ImagePicker is touched up or down, the ImagePicker is opened. When an image is picked from the image picker, the background of the canvas is set to that image. The final event handler is triggered by clicking the Reset_Button, and it causes the "dotsize" variable to be set back to 6, label is set back to "Dotsize = 6", the canvas image is set back to the kitten picture, the paint color on the canvas is set to black, the slider thumb position is set to 6, and the "fill" variable is set to true.
|
paintpotproject_1_.apk | |
File Size: | 1699 kb |
File Type: | apk |
paintpotproject_1_.aia | |
File Size: | 181 kb |
File Type: | aia |