Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab7d7993 authored by Danny Wang's avatar Danny Wang
Browse files

Screen Sharing: Add no select preview placeholder

screencast: http://go/scrcast/NTkwMjAyMjQzMDY4NzIzMnxjYjM4NmNjYi00ZQ

BUG: 440967325
Test: manual
Flag: com.android.systemui.large_screen_sharing
Change-Id: I9916b4902f36c7a8b11ef1f6bc39fd5f5190adb5
parent fb8acc99
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -396,6 +396,8 @@
    <string name="screen_capture_toolbar_record_button">Record</string>
    <!-- Button text for screen sharing [CHAR LIMIT=35] -->
    <string name="screen_share_toolbar_share_button">Share</string>
    <!-- Text for app screen sharing thumbnail when no app is selected. [CHAR LIMIT=35] -->
    <string name="screen_share_no_select_app_thumbnail">Select an app to share</string>
    <!-- Content description for the app window screenshot button in the toolbar, when the capture mode is set to "screenshot". [CHAR LIMIT=NONE] -->
    <string name="screen_capture_toolbar_app_window_button_screenshot_a11y">Take screenshot of window</string>
    <!-- Content description for the app window screenshot button in the toolbar, when the capture mode is set to "record". [CHAR LIMIT=NONE] -->
+24 −8
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.android.systemui.res.R
import com.android.systemui.screencapture.common.ui.viewmodel.RecentTaskViewModel
import com.android.systemui.screencapture.sharescreen.largescreen.ui.viewmodel.AudioSwitchViewModel
import com.android.systemui.screencapture.sharescreen.largescreen.ui.viewmodel.ShareContentListViewModel
@@ -50,6 +52,7 @@ fun ShareContentSelector(
    recentTaskViewModelFactory: RecentTaskViewModel.Factory,
) {
    val selectedRecentTaskViewModel = shareContentListViewModel.selectedRecentTaskViewModel
    val itemSelected = selectedRecentTaskViewModel != null

    Surface(color = MaterialTheme.colorScheme.surfaceBright, shape = RoundedCornerShape(20.dp)) {
        Column(
@@ -75,7 +78,8 @@ fun ShareContentSelector(
                )
                ItemPreview(
                    preview = selectedRecentTaskViewModel?.thumbnail?.getOrNull()?.asImageBitmap(),
                    modifier = Modifier.weight(1f).height(140.dp),
                    modifier = Modifier.weight(1f).height(140.dp).width(230.dp),
                    itemSelected = itemSelected,
                )
            }
            DisclaimerText()
@@ -85,7 +89,11 @@ fun ShareContentSelector(
}

@Composable
private fun ItemPreview(preview: ImageBitmap?, modifier: Modifier = Modifier) {
private fun ItemPreview(
    preview: ImageBitmap?,
    modifier: Modifier = Modifier,
    itemSelected: Boolean,
) {
    Box(
        modifier =
            modifier
@@ -93,14 +101,22 @@ private fun ItemPreview(preview: ImageBitmap?, modifier: Modifier = Modifier) {
                .background(MaterialTheme.colorScheme.surfaceVariant),
        contentAlignment = Alignment.Center,
    ) {
        if (itemSelected) {
            if (preview != null) {
                Image(
                    bitmap = preview,
                contentDescription = "preview",
                    contentDescription = null,
                    modifier = Modifier.matchParentSize(),
                    contentScale = ContentScale.Fit,
                )
            }
        } else {
            Text(
                text = stringResource(R.string.screen_share_no_select_app_thumbnail),
                color = MaterialTheme.colorScheme.primaryContainer,
                style = MaterialTheme.typography.labelMedium,
            )
        }
    }
}