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

Commit 3432a1a9 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge "[SB][Screen Chips] Update dialog strings." into main

parents 4e82c7c6 f2c0a6da
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -321,11 +321,11 @@
    <!-- A toast message shown when the screen recording cannot be started due to a generic error [CHAR LIMIT=NONE] -->
    <string name="screenrecord_start_error">Error starting screen recording</string>
    <!-- Title for a dialog shown to the user that will let them stop recording their screen [CHAR LIMIT=50] -->
    <string name="screenrecord_stop_dialog_title">Stop recording screen?</string>
    <!-- Text telling a user that they will stop recording their screen if they click the "Stop recording" button [CHAR LIMIT=100] -->
    <string name="screenrecord_stop_dialog_message">You will stop recording your screen</string>
    <!-- Text telling a user that they will stop recording the contents of the specified [app_name] if they click the "Stop recording" button. Note that the app name will appear in bold. [CHAR LIMIT=100] -->
    <string name="screenrecord_stop_dialog_message_specific_app">You will stop recording &lt;b><xliff:g id="app_name" example="Photos App">%1$s</xliff:g>&lt;/b></string>
    <string name="screenrecord_stop_dialog_title">Stop recording?</string>
    <!-- Text telling a user that they're currently recording their screen [CHAR LIMIT=100] -->
    <string name="screenrecord_stop_dialog_message">You\'re currently recording your entire screen</string>
    <!-- Text telling a user that they're currently recording the contents of the specified [app_name]. [CHAR LIMIT=100] -->
    <string name="screenrecord_stop_dialog_message_specific_app">You\'re currently recording <xliff:g id="app_name" example="Photos App">%1$s</xliff:g></string>
    <!-- Button to stop a screen recording [CHAR LIMIT=35] -->
    <string name="screenrecord_stop_dialog_button">Stop recording</string>

@@ -333,25 +333,33 @@
    <string name="share_to_app_chip_accessibility_label">Sharing screen</string>
    <!-- Title for a dialog shown to the user that will let them stop sharing their screen to another app on the device [CHAR LIMIT=50] -->
    <string name="share_to_app_stop_dialog_title">Stop sharing screen?</string>
    <!-- Text telling a user that they will stop sharing their screen if they click the "Stop sharing" button [CHAR LIMIT=100] -->
    <string name="share_to_app_stop_dialog_message">You will stop sharing your screen</string>
    <!-- Text telling a user that they will stop sharing the contents of the specified [app_name] if they click the "Stop sharing" button. Note that the app name will appear in bold. [CHAR LIMIT=100] -->
    <string name="share_to_app_stop_dialog_message_specific_app">You will stop sharing &lt;b><xliff:g id="app_name" example="Photos App">%1$s</xliff:g>&lt;/b></string>
    <!-- Text telling a user that they're currently sharing their entire screen to [host_app_name] (i.e. [host_app_name] can currently see all screen content) [CHAR LIMIT=150] -->
    <string name="share_to_app_stop_dialog_message_entire_screen_with_host_app">You\'re currently sharing your entire screen with <xliff:g id="host_app_name" example="Screen Recorder App">%1$s</xliff:g></string>
    <!-- Text telling a user that they're currently sharing their entire screen to an app (but we don't know what app) [CHAR LIMIT=150] -->
    <string name="share_to_app_stop_dialog_message_entire_screen">You\'re currently sharing your entire screen with an app</string>
    <!-- Text telling a user that they're currently sharing the contents of [app_being_shared_name]. (i.e. some app can currently see the content of [app_being_shared_name]). [CHAR LIMIT=150] -->
    <string name="share_to_app_stop_dialog_message_single_app_specific">You\'re currently sharing <xliff:g id="app_being_shared_name" example="Photos App">%1$s</xliff:g></string>
    <!-- Text telling a user that they're currently sharing their screen [CHAR LIMIT=150] -->
    <string name="share_to_app_stop_dialog_message_single_app_generic">You\'re currently sharing an app</string>
    <!-- Button to stop screen sharing [CHAR LIMIT=35] -->
    <string name="share_to_app_stop_dialog_button">Stop sharing</string>

    <!-- Content description for the status bar chip shown to the user when they're casting their screen to a different device [CHAR LIMIT=NONE] -->
    <string name="cast_screen_to_other_device_chip_accessibility_label">Casting screen</string>
    <!-- Title for a dialog shown to the user that will let them stop casting their screen to a different device [CHAR LIMIT=50] -->
    <string name="cast_screen_to_other_device_stop_dialog_title">Stop casting screen?</string>
    <!-- Title for a dialog shown to the user that will let them stop casting to a different device [CHAR LIMIT=50] -->
    <string name="cast_to_other_device_stop_dialog_title">Stop casting?</string>
    <!-- Text telling a user that they will stop casting their screen to a different device if they click the "Stop casting" button [CHAR LIMIT=100] -->
    <string name="cast_screen_to_other_device_stop_dialog_message">You will stop casting your screen</string>
    <!-- Text telling a user that they will stop casting the contents of the specified [app_name] to a different device if they click the "Stop casting" button. Note that the app name will appear in bold.  [CHAR LIMIT=100] -->
    <string name="cast_screen_to_other_device_stop_dialog_message_specific_app">You will stop casting &lt;b><xliff:g id="app_name" example="Photos App">%1$s</xliff:g>&lt;/b></string>
    <!-- Text telling a user that they're currently casting to a different device [CHAR LIMIT=100] -->
    <string name="cast_to_other_device_stop_dialog_message">You\'re currently casting</string>
    <!-- Text telling a user that they're currently casting their screen to a different device. The device receiving the cast is named [device_name]. [CHAR LIMIT=150] -->
    <string name="cast_to_other_device_stop_dialog_message_entire_screen_with_device">You\'re currently casting your entire screen to <xliff:g id="device_name" example="Living Room Device">%1$s</xliff:g></string>
    <!-- Text telling a user that they're currently casting their screen to a nearby device. [CHAR LIMIT=150] -->
    <string name="cast_to_other_device_stop_dialog_message_entire_screen">You\'re currently casting your entire screen to a nearby device</string>
    <!-- Text telling a user that they're currently casting the contents of [app_being_shared_name] to a different device. The device receiving the cast is named [device_name]. [CHAR LIMIT=150] -->
    <string name="cast_to_other_device_stop_dialog_message_specific_app_with_device">You\'re currently casting <xliff:g id="app_being_shared_name" example="Photos App">%1$s</xliff:g> to <xliff:g id="device_name" example="Living Room Device">%2$s</xliff:g></string>
    <!-- Text telling a user that they're currently casting the contents of [app_being_shared_name] to a different device. [CHAR LIMIT=150] -->
    <string name="cast_to_other_device_stop_dialog_message_specific_app">You\'re currently casting <xliff:g id="app_being_shared_name" example="Photos App">%1$s</xliff:g> to a nearby device</string>
    <!-- Text telling a user that they're currently casting to a different device. The device receiving the cast is named [device_name]. [CHAR LIMIT=100] -->
    <string name="cast_to_other_device_stop_dialog_message_generic_with_device">You\'re currently casting to <xliff:g id="device_name" example="Living Room Device">%1$s</xliff:g></string>
    <!-- Text telling a user that they're currently casting to a nearby device [CHAR LIMIT=100] -->
    <string name="cast_to_other_device_stop_dialog_message_generic">You\'re currently casting to a nearby device</string>
    <!-- Button to stop screen casting to a different device [CHAR LIMIT=35] -->
    <string name="cast_to_other_device_stop_dialog_button">Stop casting</string>

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ constructor(
        activeCastDevice
            .map {
                if (it != null) {
                    MediaRouterCastModel.Casting
                    MediaRouterCastModel.Casting(deviceName = it.name)
                } else {
                    MediaRouterCastModel.DoingNothing
                }
+6 −2
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ sealed interface MediaRouterCastModel {
    /** MediaRouter isn't aware of any active cast. */
    data object DoingNothing : MediaRouterCastModel

    /** MediaRouter has an active cast. */
    data object Casting : MediaRouterCastModel
    /**
     * MediaRouter has an active cast.
     *
     * @property deviceName the name of the device receiving the cast.
     */
    data class Casting(val deviceName: String?) : MediaRouterCastModel
}
+42 −10
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.systemui.statusbar.chips.casttootherdevice.ui.view

import android.content.Context
import android.os.Bundle
import com.android.systemui.mediaprojection.data.model.MediaProjectionState
import com.android.systemui.res.R
import com.android.systemui.statusbar.chips.casttootherdevice.ui.viewmodel.CastToOtherDeviceChipViewModel.Companion.CAST_TO_OTHER_DEVICE_ICON
import com.android.systemui.statusbar.chips.mediaprojection.domain.model.ProjectionChipModel
@@ -26,6 +28,7 @@ import com.android.systemui.statusbar.phone.SystemUIDialog
/** A dialog that lets the user stop an ongoing cast-screen-to-other-device event. */
class EndCastScreenToOtherDeviceDialogDelegate(
    private val endMediaProjectionDialogHelper: EndMediaProjectionDialogHelper,
    private val context: Context,
    private val stopAction: () -> Unit,
    private val state: ProjectionChipModel.Projecting,
) : SystemUIDialog.Delegate {
@@ -36,16 +39,8 @@ class EndCastScreenToOtherDeviceDialogDelegate(
    override fun beforeCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) {
        with(dialog) {
            setIcon(CAST_TO_OTHER_DEVICE_ICON)
            setTitle(R.string.cast_screen_to_other_device_stop_dialog_title)
            // TODO(b/332662551): Include device name in this string.
            setMessage(
                endMediaProjectionDialogHelper.getDialogMessage(
                    state.projectionState,
                    genericMessageResId = R.string.cast_screen_to_other_device_stop_dialog_message,
                    specificAppMessageResId =
                        R.string.cast_screen_to_other_device_stop_dialog_message_specific_app,
                )
            )
            setTitle(R.string.cast_to_other_device_stop_dialog_title)
            setMessage(getMessage())
            // No custom on-click, because the dialog will automatically be dismissed when the
            // button is clicked anyway.
            setNegativeButton(R.string.close_dialog_button, /* onClick= */ null)
@@ -54,4 +49,41 @@ class EndCastScreenToOtherDeviceDialogDelegate(
            }
        }
    }

    private fun getMessage(): String {
        return if (state.projectionState is MediaProjectionState.Projecting.SingleTask) {
            val appBeingSharedName =
                endMediaProjectionDialogHelper.getAppName(state.projectionState)
            if (appBeingSharedName != null && state.deviceName != null) {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_specific_app_with_device,
                    appBeingSharedName,
                    state.deviceName,
                )
            } else if (appBeingSharedName != null) {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_specific_app,
                    appBeingSharedName,
                )
            } else if (state.deviceName != null) {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_generic_with_device,
                    state.deviceName
                )
            } else {
                context.getString(R.string.cast_to_other_device_stop_dialog_message_generic)
            }
        } else {
            if (state.deviceName != null) {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_entire_screen_with_device,
                    state.deviceName
                )
            } else {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_entire_screen,
                )
            }
        }
    }
}
+13 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.chips.casttootherdevice.ui.view

import android.content.Context
import android.os.Bundle
import com.android.systemui.res.R
import com.android.systemui.statusbar.chips.casttootherdevice.ui.viewmodel.CastToOtherDeviceChipViewModel.Companion.CAST_TO_OTHER_DEVICE_ICON
@@ -29,6 +30,8 @@ import com.android.systemui.statusbar.phone.SystemUIDialog
 */
class EndGenericCastToOtherDeviceDialogDelegate(
    private val endMediaProjectionDialogHelper: EndMediaProjectionDialogHelper,
    private val context: Context,
    private val deviceName: String?,
    private val stopAction: () -> Unit,
) : SystemUIDialog.Delegate {
    override fun createDialog(): SystemUIDialog {
@@ -36,11 +39,19 @@ class EndGenericCastToOtherDeviceDialogDelegate(
    }

    override fun beforeCreate(dialog: SystemUIDialog, savedInstanceState: Bundle?) {
        val message =
            if (deviceName != null) {
                context.getString(
                    R.string.cast_to_other_device_stop_dialog_message_generic_with_device,
                    deviceName,
                )
            } else {
                context.getString(R.string.cast_to_other_device_stop_dialog_message_generic)
            }
        with(dialog) {
            setIcon(CAST_TO_OTHER_DEVICE_ICON)
            setTitle(R.string.cast_to_other_device_stop_dialog_title)
            // TODO(b/332662551): Include device name in this string.
            setMessage(R.string.cast_to_other_device_stop_dialog_message)
            setMessage(message)
            // No custom on-click, because the dialog will automatically be dismissed when the
            // button is clicked anyway.
            setNegativeButton(R.string.close_dialog_button, /* onClick= */ null)
Loading