OLX Sarina Dhamija Feb 15, 2021

Designing a Custom Progress bar with timed breaks in Android

Article Summary

Sarina Dhamija from OLX Engineering tackles a tricky Android UI challenge: building a circular progress bar that shows pause breaks during video recording. Think Instagram Stories meets custom video capture.

This deep dive walks through creating a reusable Android component that visualizes recording progress with visible pause indicators. The article breaks down the implementation into three phases: UI rendering, state management, and the drawing logic that makes it all work.

Key Takeaways

Critical Insight

A production-ready custom progress bar that elegantly handles timed breaks through state management and calculated arc drawing, perfect for video recording UIs.

The math behind calculating sweep angles for pause breaks is surprisingly elegant, and the future template system could make this work for any shape.

About This Article

Problem

Sarina Dhamija at OLX Engineering needed to show video recording progress with visible pause breaks. The challenge was drawing dynamic arcs that could track multiple pause-resume cycles and calculate timestamps accurately.

Solution

The team built a RecorderStateManager state machine with four states: INIT, RECORDING, PAUSED, and RESUMED. They paired it with ValueAnimator and Paint objects that change colors based on the current state. White shows progress, transparent shows breaks. The sweep angles come from calculated pause and resume times.

Impact

This Android component works across different use cases like video recording and uploading. Teams can reuse it without rebuilding from scratch. Down the road, they can add template-based customization for shape, size, and state-specific icons to make it more interactive.