.opencode/skills/loading-overlay/SKILL.md
Block UI screen content during data loading or asynchronous operations with loading indicator display. Use this skill when developing screens with network requests, CRUD operations, and other asynchronous actions.
npx skillsauth add easydev991/Jetpack-WorkoutApp loading-overlayInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In ViewModel, add StateFlow<Boolean> for tracking loading state:
private val _isProcessing = MutableStateFlow(false)
val isProcessing: StateFlow<Boolean> = _isProcessing.asStateFlow()
In operation methods, set _isProcessing.value = true at the beginning and _isProcessing.value = false in the finally block.
In Composable screen, collect state via collectAsState() and pass to the stateless component:
val isProcessing by viewModel.isProcessing.collectAsState()
MyFriendsScreenContent(
// other parameters...
isProcessing = isProcessing
)
In stateless component:
enabled = !isProcessing to content componentsLoadingOverlayView from design system over content during loadingBox(modifier = Modifier.fillMaxSize()) {
Content(enabled = !isProcessing)
if (isProcessing) {
LoadingOverlayView()
}
}
Note: LoadingOverlayView automatically occupies the entire size of the parent Box and blocks all gestures. The component is located in com.swparks.ui.ds.
In list components, pass enabled to interactive elements:
Box(
modifier = Modifier.clickable(enabled = enabled) { onClick() }
) {
UserRowView(/* parameters */)
}
UiState.Loading)UiState.Success)enabled = false)isProcessing = true)isProcessing = false)isLoading)isProcessing)combine or in UI (!isLoading && !isProcessing)Use regular CircularProgressIndicator or LoadingIndicator in the center of the screen in the when block for UiState.Loading.
Use LoadingOverlayView from design system over content in Box with isProcessing. This component automatically blocks all gestures and occupies the entire size of the parent container.
For buttons with CRUD operations, use built-in CircularProgressIndicator or enabled parameter.
Always use Box with Modifier.fillMaxSize() for content so LoadingOverlayView can display over and correctly block all gestures.
LoadingOverlayView from design system automatically occupies the parent Box size and blocks all gestures. No need to use matchParentSize() or fillMaxSize().
Always use try-finally for guaranteed unlocking on successful execution or error.
Don't forget to pass enabled to all clickable elements: buttons, clickable Box/Row/Surface.
StateFlow<Boolean> for loading state in ViewModeltry-finally for reliable blockingcollectAsState()enabled = !isProcessing to stateless componentLoadingOverlayView() from design system over content during loadingenabled to interactive list elements (buttons, clickable areas)testing
Пиши тесты в андроид-проекте правильно. Используй этот навык при написании любых типов тестов (unit, integration, UI), тестировании бизнес-логики, сетевых функций и компонентов UI.
tools
Реализуй pull-to-refresh в Jetpack Compose с использованием Material 3 PullToRefreshBox. Используй этот навык при добавлении возможности обновления данных на экранах со списками или карточками.
tools
Правильно работай с локализацией в Android-проекте. Используй этот навык при добавлении новых строковых ресурсов, работе с plurals, форматировании дат и текстов.
tools
Блокировка UI контента экрана во время загрузки данных или выполнения асинхронных операций с отображением индикатора загрузки. Используй этот навык при разработке экранов с сетевыми запросами, операциями CRUD и других асинхронных действий.