Mobile App Dev 2022W: Assignment 4

From Soma-notes
Revision as of 15:26, 8 April 2022 by Soma (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Please answer all of the following questions in the supplied template. Your uploaded file should be named "comp1601-assign4-MCOname.txt" where MCOname is your MyCarletonOne username (i.e., the username you use to login to Brightspace) and it should be a UNIX text file (LF line endings).

You may use this validator page to make sure your answer file is properly named and formatted.

The questions are based on PicViewer2 from Tutorial 9. There are 9 questions worth 20 points total + one question worth 5 points extra credit.

Do not turn in modified applications. Instead, when answering code writing questions, include code snippets and explain how they should be used to modify the application. Use complete sentences when answering. Be sure to list collaborators and outside sources that you used.

Submit your answers via Brightspace by April 8, 2022 by 11:30 AM.

Questions

  1. [2] If you change the first line of MainActivity.kt to be "package not.a.real.package", what breaks? Why? Explain briefly.
  2. [2] If you don't make the changes in AndroidManifest.xml and just use the default one that you get when you make an empty activity app, what functionality will break? Why?
  3. [2] If you switch the simulator to use a dark theme, can that affect the layout of the app, other than changing the colors? Why? (Note: this answer depends on what files you edited when setting up PicViewer2.)
  4. [4] How could you change the layout so that the X and Y fields are on the left of the screen and the scale and rotation are on the right? (1 point for the positioning of each value.)
    • The X and scale should be on the same horizontal line, as should be the Y and rotation fields. The X and Y fields should be vertically aligned, as should the rotation and scale fields.
    • Both the Y and rotation fields should be close to the bottom edge of the screen (except for a small margin).
    • Make sure your layout uses no absolute units except, where necessary, for small offsets from the edges of the screen.
  5. [2] Would eliminating the picParamWatcher class and instead putting its code into MainActivity significantly increase the number of lines of code in the program? Explain briefly.
  6. [2] Would eliminating the dragView class and instead putting its code into MainActivity significantly increase the number of lines of code in the program? Explain briefly.
  7. [2] When in the program's execution is dragView's picDragged true? When is it false? Explain in terms of high level program functionality, not precise lines of code.
  8. [2] The image retains its position, rotation, and zoom values when the device is rotated. Is this because the instances of PicParamWatcher are being preserved? Or are they being destroyed and re-created when the device is rotated? Explain, giving empirical evidence in support of your answer.
  9. [2] Why does PicParamWatcher need valueChanged? Explain how the program behaves when this variable is removed along with the code that references it and how the valueChanged-assocated code changes this behaviour.
  10. [5 Extra credit] Implement PicViewer2 (as presented in Tutorial 9) as a SwiftUI program, explaining how your program captures the basic look and functionality of the Android program. Compare the two implementations explaining key design differences. (Your SwiftUI program doesn't have to be completely identical. In particular you don't need to make the title screen. It should be reasonably close, however.)

Solutions

Assignment 4 Solutions