UI Integration & Testing

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this segment, you’ll connect your camera and image processing components to the task creation UI. You’ll add buttons for capturing photos and applying filters, then test the complete flow from camera capture to filtered display.

The UI layer orchestrates the entire process, calling Android camera APIs and Swift image processing functions through the repositories you created.

Updating the Task Model for Photo Storage

Before adding photo capture to the UI, you need to update the Swift Task model to support storing photo URIs.

Updating the Task Repository

Now that the Task model supports photo URIs, you need to update the repository to accept and pass this data when creating tasks.

Updating the Create Task Dialog

Now you’ll integrate photo capture, preview, and filtering into the task creation dialog. This requires adding state management, camera integration, filter buttons, and helper functions.

Testing the Complete Flow

You can now verify that everything works correctly.

Test Case 1: Camera Capture

  1. Open the app and tap the floating action button.
  2. In the Add Task dialog, tap the “Add Photo” button.
  3. Grant camera permission when prompted.
  4. See the camera preview screen.
  5. Tap the capture button.
Beqeza gakrebi dwef
Hafojo diktaga nnuq

Test Case 2: Grayscale Filter

  1. With a photo captured, tap the “Grayscale” button.
  2. Wait for processing to complete.
Gtasddequ nuxdeg
Zripvcoku nogbak

Test Case 3: Blur Filter

  1. Tap the “Original” button to reset the photo.
  2. Tap the “Blur” button.
  3. Wait for processing (this takes longer than other filters).
Hqom ranqak
Whej hahxuw

Test Case 4: Brightness Filters

  1. Tap “Brighter”.
Rkoffmam suxmal
Mtijgjim qefjev

Banmuq niyvud
Reslaw belfej

Test Case 5: Creating the Task

  1. Fill in title and description.
  2. Apply your preferred filter.
  3. Tap “Save”.

Updating the Task Card

To display photos in the task list, you need to update TaskCard.kt to show the task’s photo when one exists.

Common Issues and Solutions

Issue: Camera permission denied. Solution: Go to device Settings > Apps > Task Manager > Permissions and grant camera access manually.

Performance Considerations

Image processing is computationally expensive. Here’s what you’re doing to manage performance:

Key Takeaways

In this segment, you’ve:

Where to Go From Here?

Congratulations on completing the UI integration for your photo-enabled Task Manager! You’ve successfully built a complete feature that spans Android’s camera APIs, custom binary data formats, Swift image processing algorithms, and a polished Compose UI.

What’s Next

Your Task Manager currently stores tasks in memory, which means they disappear when the app closes. In Lesson 3: Data Persistence and Testing, you’ll add permanent storage and comprehensive testing to create a production-ready application.

See forum comments
Download course materials from Github
Previous: Implementing Image Filters in Swift Next: Conclusion