name: inverse layout: true class: center, middle, inverse --- # Quiz Review & Questions Jennifer Mankoff CSE 340 Winter 2021 --- name: normal layout: true class: --- # On Tap for today Announcements Quiz 2 review Review on anything up to 4/9 (25 minutes) --- # What is the "effort, participation and altruism" grade about? - What you put into the class - How you help others - Whether you show up If you are skipping the quizzes and lecture, not participating/answering questions in lecture, not answering questions on Ed, and so on you will not do well on this grade. You don't have to do ALL of these but you have to do most of them. --- # Quiz Review: Why have a NotificationView? Good answer: .red[.blockquote[...instead of creating 10 separate things for one single notification, you can just create one view. It reduces redundancy and saves time.]] Another good answer mentioned that these things probably need to communicate/reflect the same underlying data structure Other good answer mentioned promoting code reuse, modularity, I'd add that if anyone else is building something with it you can help ensure consistence. --- # Quiz Review: Why have a NotificationView? Some common misconceptions: - NotificationView is not the whole list - It most likely would *not* simplify the interactor hierarchy by removing things from it because that would require not taking advantage of a bunch of android abstractions when building it --- # What are the interactors? .left-column[ ![:img Picture of Ed discussion board, 100%, width](img/ama/ed.png) ] --- # What is the interactor hierarchy? .left-column[ ![:img Picture of Ed discussion board, 100%, width](img/ama/ed.png) ] ??? Important: use multi-level tree --- # What are the two ways we are learning to add views? Dynamic Static ??? difference between them? Which is better when? How does NotificationView potentially combine them? --- # What are the two ways we are learning to add views? Dynamic Static What is the difference between them? Which is better when? ??? Xml vs programmatic Need to use programmatic when things are dynamic -- Xml vs programmatic Need to use programmatic when things are dynamic --- # How does NotificationView potentially combine: Dynamic Static ??? You can instantiate a 'blank' from xml programmatically (inflate) and then fill it in, repeatedly -- You can instantiate a 'blank' from xml programmatically (inflate) and then fill it in, repeatedly --- # Give an example of a view that needs to measure it's children to determine it's size Example of a good answer .red[.blockquote[One example would be a view of some sort of graph like a bar graph or histogram, where the size of the graph depends on the size of each data point it represents.]] Other good answers: LinearLayout; When the parent is set to "wrap_content" (though on a test "give an example" usually means something more specific); Textbox with flexible height; Instagram images; text bubble in a messaging app; a web bookmark; --- # Give an example of a parent view that needs to measure it's children to determine it's size Less good: A container holding multiple views -- that's a necessary pre-condition but imagine an ```AbsoluteFixedLayout``` container -- it wouldn't resize. Similar: describing the layout process Similar issue: child specifies "wrap content" (this means the child sizes itself based on *its* children but says nothing about the parent). --- # Give an example of a parent view that needs to measure it's children to determine it's size Interesting case: ```ImageView```. Is it sized by its child? Not necessarily -- it can resize its contents... But in the Instagram example somene gave, it resizes kids to its width and then resizes itself to their height. This is what you have to do in Part 3 too. --- # If B is A's child, who decides ## Final size of B ![:img Picture of quiz results, 100%, width](img/ama/finalB.png) --- # If B is A's child, who decides ## Position of B ![:img Picture of quiz results, 100%, width](img/ama/finalB.png) --- # If B is A's child, who decides ## Preferred size of B ![:img Picture of quiz results, 100%, width](img/ama/preferredB.png) --- # If B is A's child, who decides ## Final size of A (forgot "final" in quiz -- sorry!) ![:img Picture of quiz results, 100%, width](img/ama/finalA.png) --- # What is missing from this function? What errors could this cause? .left-column40[ ```java protected void drawAll() { onDraw(); foreach child c { if (child.isVisible()) { child.drawAll(); } } } ``` ] .right-column50[ Example of a good answer .red[.blockquote[ 1) the translation of the child's canvas to and from the origin, and 2) the clipping of the child to its width and height. ... could cause the Views to be drawn on the wrong parts of the screen and/or the Views could be drawn outside of their actual bounding box. ]] ] --- # What is missing from this function? What errors could this cause? .left-column40[ ```java protected void drawAll() { onDraw(); foreach child c { if (child.isVisible()) { child.drawAll(); } } } ``` ] .right-column50[ Incorrect: - A call to invalidate - id of each child - doesn't calculate children's size - parent is not being drawn ] --- https://PollEv.com/jmankoff; text JMANKOFF to 22333 to join the session, then text a response.
--- # What to expect Friday The examlet will open at 12:40 - The expectation is that everyone that is in our timezone (PDT) or close to PDT would take this before the end of class. You should be in communication with me if this is an issue. - You should start right away as you would in a traditional classroom and not wait around. - We will be checking to see that everyone has taken it by 1:20 - You will not need to stay on Zoom to take the assessment. However we will stay in the classroom session in case you have questions about the format etc. - This should be about 30 minutes, but you will have a buffer to ensure that everyone can submit on time. - If you have problems with any of the technology you MUST get in touch with the course staff immediately. - You may use your notes, the website, take a look at your code, etc, but *you may not collaborate with others on the exam*.