Teaching / Mobile Programming 2

HTML Assignments

Web version of the laboratory assignments. The left menu selects an assignment and the right panel shows the English assignment content.

HTML Assignments

L01 - Assignment 1

Assignment 1

Deadline:

  • Tuesday group: 21.10
  • Thursday group: 23.10

Task 1 - 6 pts

Build the "ComposeShop" application with one main navigation structure handled by bottom navigation and a navigation drawer, and one nested navigation flow dedicated to the checkout process. An example run is shown in video L1.

The main application interface combines bottom navigation and a navigation drawer. All these screens should be part of one main navigation graph (NavHost).

Bottom Navigation Screens

Navigation happens by tapping the appropriate icon in the bottom bar, which calls navController.navigate("screen_name").

  • Home screen: the first screen after application launch. It displays a list.
  • Categories screen: a list of product categories, for example "Electronics", "Fashion", "Home".
  • Cart screen: displays products added to the cart. Static data is acceptable. The "Go to checkout" button starts the nested navigation flow.
  • Favorites screen: a list of products marked by the user as favorites.

Drawer Navigation Screens

  • My profile screen: displays basic user information, for example name and email address.
  • Order history screen: displays previous orders with date and status.
  • Settings screen: contains configuration options, for example switches for dark mode or notifications. These can be simulated.
  • "Log out" button: simulates the logout process and navigates to the start screen.

Nested Navigation Flow: Checkout Process

Navigation to this flow starts on the cart screen. After entering this mode, bottom navigation and the drawer should no longer be visible, so the user can focus fully on the purchase process. Navigation inside this graph is linear: the user goes from step 1 to step 2, and then to step 3.

  • Screen 1: delivery address. Contains a simple form for entering address data. The "Next" button navigates to the next screen in the flow.
  • Screen 2: payment method. Allows the user to choose one of several payment options, for example with RadioButton. The "Summary" button navigates to the final step.
  • Screen 3: summary and confirmation. Displays all collected information: cart products, delivery address and selected payment method.
  • The "Order and pay" button finishes the process. Its click performs the key navigation action: it removes the whole checkout graph (checkout_graph) from the back stack, so the user cannot accidentally return to the payment screen with the back button. It then navigates the user back to the main application screen.

Oral answer - 4 pts

Grades

gradepoints
3.06 pts
3.57 pts
4.08 pts
4.59 pts
5.010 pts

Example run

Task 1 - example run

Questions

Topics: Compose Navigation, NavHost, NavController, nested graphs, drawer, bottom navigation, back stack.

Additional questions: Activity, Intent, Context.

  1. What is an Activity and what is its role in an application built entirely with Jetpack Compose?
  2. What is Context and why is it needed in an Android application?
  3. What is the Intent mechanism used for in Android?
  4. What is the role of the NavHost component in Compose navigation?
  5. What is NavController used for?
  6. What is a route in the context of navigation?
  7. How do we define a screen, or navigation destination, inside NavHost?
  8. What does the startDestination parameter define in NavHost?
  9. What is nested navigation and why do we use it?
  10. What does navController.popBackStack() do?
  11. What is the back stack?
  12. How can you pass a simple argument, for example a product ID, to another screen in Compose Navigation?
  13. What is a deep link and how can an Intent Filter in the manifest be related to it?
  14. How does centralizing navigation routes, for example in an object, help maintain the code?
  15. Describe the Activity lifecycle and its most important states.
  16. What is an explicit Intent? Give an example.
  17. What is an implicit Intent? Give an example.
  18. How does the NavController state created with rememberNavController() survive recomposition?
  19. What is the setContent function used for in ComponentActivity?
  20. How can you open and close a navigation drawer programmatically?
  21. What are Application Context and Activity Context?
  22. Can one NavController manage multiple NavHost instances?