Skip to content

MainActivity.java

adbrandao edited this page Jun 17, 2016 · 7 revisions

Page last updated 6/17/16.

Startup Video

This is where the video that plays on the app on startup is hardcoded:

~Line 66

String uriPath = "android.resource://" + getPackageName() + "/" + R.raw.presentations;
Uri uri = Uri.parse(uriPath);
videoView.setVideoURI(uri);.

The first couple of lines set the path, and the third line actually starts playing the video at that path.

There are 2 videos in app/java/res/raw: presentationp.mp4 (for photography) and presentations.mp4 (for stars).

~Line 219 At startup, the video stars playing and after a short delay, the video pauses. Without the delay, the video will not show up on the screen. (Not having code to restart the video, this allows the user to resize a frame and then continue watching the stars video after clicking the Log button. Otherwise, the photo video will play from the beginning.)

There is also an alert on startup letting the user know that the video should be moved before being resized. (It seems that if resizing happens before moving the video at all, then the video can disappear....)

Radio Buttons (Move and Resize)

~Line 251

This code takes care of the cases of when either the Move or the Resize radio buttons are checked. Relatively straightforward -- the Move button changes the TOUCH_GESTURE_MODE so that users can drag the video, and the Resize button changes it to allow resizing the video.

Button (Log)

~Line 155

Start reading at ~Line 173. First we create the message that will be shown in the alert dialog/ popup when a user clicks the Log button. The "positive" and "negative" buttons are set to play the stars video or the photography video. In the "Stars" case, the startPres() function is called to make the buttons invisible and change the gesture mode such that users can no longer adjust the video. The video then starts playing. For the "Photo" case, first we change the video url to be the photo video instead of the originally set stars one. Then play the video.

Clone this wiki locally