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

Commit 4aa04968 authored by Danny Wang's avatar Danny Wang
Browse files

Screen Sharing: Setup basic screen share toolbar

Creates a new composable for the screen share toolbar containing the
radio button groups and various icons. The toolbar will be hooked up to
the view model and state in later CLs. Only large screen window & tab
sharing experience is included in the tool bar for DF2.

Screenshot: http://screen/6PirfrGQ5W9giLJ

Bug: 423707607
Test: Manual
Flag: com.android.systemui.large_screen_sharing
Change-Id: Id4784d19421e832ada3362dcf4c3be2f6e25e795
parent f4701f74
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -365,6 +365,8 @@
    <string name="screen_capture_toolbar_capture_button">Capture</string>
    <!-- Button text in the toolbar for choosing the screen recording type. [CHAR LIMIT=35] -->
    <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>

    <!-- Content description for the status bar chip shown to the user when they're sharing their screen to another app on the device [CHAR LIMIT=NONE] -->
    <string name="share_to_app_chip_accessibility_label">Sharing screen</string>
+71 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.screencapture.sharescreen.largescreen.ui.compose

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon as IconModel
import com.android.systemui.res.R
import com.android.systemui.screencapture.common.ui.compose.PrimaryButton
import com.android.systemui.screencapture.common.ui.compose.RadioButtonGroup
import com.android.systemui.screencapture.common.ui.compose.RadioButtonGroupItem
import com.android.systemui.screencapture.common.ui.compose.Toolbar

/** TODO(b/433836686): Inject ScreenShareViewModel */
@Composable
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
fun PreShareToolbar(expanded: Boolean, onCloseClick: () -> Unit, modifier: Modifier = Modifier) {
    // TODO(b/433836686): Preload icons in the view model to avoid loading icons in UI thread and
    // improve performance
    val screenShareTabIcon =
        IconModel.Resource(res = R.drawable.ic_screen_capture_tab, contentDescription = null)
    val screenShareWindowIcon =
        IconModel.Resource(res = R.drawable.ic_screen_capture_window, contentDescription = null)

    val captureShareButtonItems =
        listOf(
            RadioButtonGroupItem(icon = screenShareTabIcon, isSelected = true, onClick = {}),
            RadioButtonGroupItem(icon = screenShareWindowIcon, isSelected = false, onClick = {}),
        )

    Toolbar(expanded = expanded, onCloseClick = onCloseClick, modifier = modifier) {
        Row {
            // TODO(b/433836686): Use state from ViewModel for selected index
            RadioButtonGroup(items = captureShareButtonItems)

            Spacer(Modifier.size(16.dp))

            PrimaryButton(
                icon =
                    IconModel.Resource(
                        res = R.drawable.ic_present_to_all,
                        contentDescription =
                            ContentDescription.Resource(R.string.screen_share_toolbar_share_button),
                    ),
                text = stringResource(R.string.screen_share_toolbar_share_button),
                onClick = {},
            )
        }
    }
}