Loading packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/PreCaptureUI.kt +4 −1 Original line number Diff line number Diff line Loading @@ -69,14 +69,17 @@ fun PreCaptureUI(viewModel: PreCaptureViewModel) { ) } } ScreenCaptureRegion.PARTIAL -> { // TODO(b/427541309) Set the initial width and height of the RegionBox based on the // viewmodel state. RegionBox( onRegionSelected = { rect: Rect -> viewModel.updateRegionBox(rect) }, drawableLoaderViewModel = viewModel, onRegionSelected = { rect: Rect -> viewModel.updateRegionBox(rect) }, onCaptureClick = { viewModel.takePartialScreenshot() }, ) } ScreenCaptureRegion.APP_WINDOW -> {} } } Loading packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionBox.kt +7 −3 Original line number Diff line number Diff line Loading @@ -223,12 +223,14 @@ private class RegionBoxState(private val minSizePx: Float, private val touchArea * user finishes a drag gesture. This rectangle is used for taking a screenshot. The rectangle is * of type [android.graphics.Rect] because the screenshot API requires int values. * @param drawableLoaderViewModel The view model that is used to load drawables. * @param onCaptureClick A callback function that is invoked when the capture button is clicked. * @param modifier The modifier to be applied to the composable. */ @Composable fun RegionBox( onRegionSelected: (rect: IntRect) -> Unit, drawableLoaderViewModel: DrawableLoaderViewModel, onRegionSelected: (rect: IntRect) -> Unit, onCaptureClick: () -> Unit, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading Loading @@ -298,12 +300,14 @@ fun RegionBox( contentAlignment = Alignment.Center, ) {} // The screenshot button that is positioned inside or outside the region box. RegionScreenshotButton( // The button which initiates capturing the specified region of the screen. It is // positioned inside or outside the region box depending on the size of the region box. RegionBoxButton( boxWidthDp, boxHeightDp, currentRect, drawableLoaderViewModel = drawableLoaderViewModel, onClick = onCaptureClick, ) } } Loading packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionScreenshotButton.kt→packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionBoxButton.kt +8 −9 Original line number Diff line number Diff line Loading @@ -36,21 +36,22 @@ import com.android.systemui.screencapture.common.ui.compose.loadIcon import com.android.systemui.screencapture.common.ui.viewmodel.DrawableLoaderViewModel /** * A composable that represents the screenshot button that is positioned inside or outside the * region box. * A composable that represents the button that is positioned inside or outside the region box. * * @param boxWidthDp The width of the region box in dp. * @param boxHeightDp The height of the region box in dp. * @param currentRect The current region box. * @param drawableLoaderViewModel The view model that is used to load drawables. * @param onClick A callback function that is invoked when this button is clicked. * @param modifier The modifier to be applied to the composable. */ @Composable fun RegionScreenshotButton( fun RegionBoxButton( boxWidthDp: Dp, boxHeightDp: Dp, currentRect: Rect, drawableLoaderViewModel: DrawableLoaderViewModel, onClick: () -> Unit, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading @@ -59,8 +60,8 @@ fun RegionScreenshotButton( val buttonWidthDp = with(density) { buttonSize.width.toDp() } val buttonHeightDp = with(density) { buttonSize.height.toDp() } // Check if the box dimensions is smaller than the screenshot button. If so, the button // will be positioned outside the box. // Check if the box dimensions is smaller than the button. If so, the button will be positioned // outside the box. val isButtonOutside = boxWidthDp < buttonWidthDp || boxHeightDp < buttonHeightDp // The translation of the button in the X direction. Loading Loading @@ -92,20 +93,18 @@ fun RegionScreenshotButton( PrimaryButton( modifier = modifier .onSizeChanged { screenshotButtonSize -> buttonSize = screenshotButtonSize } .onSizeChanged { size -> buttonSize = size } .graphicsLayer { translationX = targetTranslationX translationY = targetTranslationY }, text = stringResource(id = R.string.screen_capture_region_selection_button), onClick = { // TODO(b/417534202): trigger a screenshot of the selected area. }, icon = loadIcon( viewModel = drawableLoaderViewModel, resId = R.drawable.ic_screen_capture_camera, contentDescription = null, ), onClick = onClick, ) } Loading
packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/PreCaptureUI.kt +4 −1 Original line number Diff line number Diff line Loading @@ -69,14 +69,17 @@ fun PreCaptureUI(viewModel: PreCaptureViewModel) { ) } } ScreenCaptureRegion.PARTIAL -> { // TODO(b/427541309) Set the initial width and height of the RegionBox based on the // viewmodel state. RegionBox( onRegionSelected = { rect: Rect -> viewModel.updateRegionBox(rect) }, drawableLoaderViewModel = viewModel, onRegionSelected = { rect: Rect -> viewModel.updateRegionBox(rect) }, onCaptureClick = { viewModel.takePartialScreenshot() }, ) } ScreenCaptureRegion.APP_WINDOW -> {} } } Loading
packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionBox.kt +7 −3 Original line number Diff line number Diff line Loading @@ -223,12 +223,14 @@ private class RegionBoxState(private val minSizePx: Float, private val touchArea * user finishes a drag gesture. This rectangle is used for taking a screenshot. The rectangle is * of type [android.graphics.Rect] because the screenshot API requires int values. * @param drawableLoaderViewModel The view model that is used to load drawables. * @param onCaptureClick A callback function that is invoked when the capture button is clicked. * @param modifier The modifier to be applied to the composable. */ @Composable fun RegionBox( onRegionSelected: (rect: IntRect) -> Unit, drawableLoaderViewModel: DrawableLoaderViewModel, onRegionSelected: (rect: IntRect) -> Unit, onCaptureClick: () -> Unit, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading Loading @@ -298,12 +300,14 @@ fun RegionBox( contentAlignment = Alignment.Center, ) {} // The screenshot button that is positioned inside or outside the region box. RegionScreenshotButton( // The button which initiates capturing the specified region of the screen. It is // positioned inside or outside the region box depending on the size of the region box. RegionBoxButton( boxWidthDp, boxHeightDp, currentRect, drawableLoaderViewModel = drawableLoaderViewModel, onClick = onCaptureClick, ) } } Loading
packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionScreenshotButton.kt→packages/SystemUI/src/com/android/systemui/screencapture/record/largescreen/ui/compose/RegionBoxButton.kt +8 −9 Original line number Diff line number Diff line Loading @@ -36,21 +36,22 @@ import com.android.systemui.screencapture.common.ui.compose.loadIcon import com.android.systemui.screencapture.common.ui.viewmodel.DrawableLoaderViewModel /** * A composable that represents the screenshot button that is positioned inside or outside the * region box. * A composable that represents the button that is positioned inside or outside the region box. * * @param boxWidthDp The width of the region box in dp. * @param boxHeightDp The height of the region box in dp. * @param currentRect The current region box. * @param drawableLoaderViewModel The view model that is used to load drawables. * @param onClick A callback function that is invoked when this button is clicked. * @param modifier The modifier to be applied to the composable. */ @Composable fun RegionScreenshotButton( fun RegionBoxButton( boxWidthDp: Dp, boxHeightDp: Dp, currentRect: Rect, drawableLoaderViewModel: DrawableLoaderViewModel, onClick: () -> Unit, modifier: Modifier = Modifier, ) { val density = LocalDensity.current Loading @@ -59,8 +60,8 @@ fun RegionScreenshotButton( val buttonWidthDp = with(density) { buttonSize.width.toDp() } val buttonHeightDp = with(density) { buttonSize.height.toDp() } // Check if the box dimensions is smaller than the screenshot button. If so, the button // will be positioned outside the box. // Check if the box dimensions is smaller than the button. If so, the button will be positioned // outside the box. val isButtonOutside = boxWidthDp < buttonWidthDp || boxHeightDp < buttonHeightDp // The translation of the button in the X direction. Loading Loading @@ -92,20 +93,18 @@ fun RegionScreenshotButton( PrimaryButton( modifier = modifier .onSizeChanged { screenshotButtonSize -> buttonSize = screenshotButtonSize } .onSizeChanged { size -> buttonSize = size } .graphicsLayer { translationX = targetTranslationX translationY = targetTranslationY }, text = stringResource(id = R.string.screen_capture_region_selection_button), onClick = { // TODO(b/417534202): trigger a screenshot of the selected area. }, icon = loadIcon( viewModel = drawableLoaderViewModel, resId = R.drawable.ic_screen_capture_camera, contentDescription = null, ), onClick = onClick, ) }