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

Commit ca2bfe8c authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Use new color tokens in PeopleSpaceActivity

This CL fixes the color tokens of the PeopleSpaceActivity, and also
enables edge-to-edge so that we don't show the black navigation bar
background and the translucent status bar background.

See b/382448604#comment9 for before/after screenshots.

Bug: 382448604
Test: Manual, see b/382448604#comment9
Flag: EXEMPT bug fix & simple color change
Change-Id: I76a1b8950055c743234876aa6ef3d827e242a38f
parent 0d84ee07
Loading
Loading
Loading
Loading
+7 −18
Original line number Diff line number Diff line
@@ -26,12 +26,12 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -47,7 +47,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.theme.colorAttr
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.people.ui.viewmodel.PeopleTileViewModel
import com.android.systemui.people.ui.viewmodel.PeopleViewModel
@@ -75,13 +74,7 @@ fun PeopleScreen(viewModel: PeopleViewModel, onResult: (PeopleViewModel.Result)
        }
    }

    // Make sure to use the Android colors and not the default Material3 colors to have the exact
    // same colors as the View implementation.
    Surface(
        color = colorAttr(com.android.internal.R.attr.colorBackground),
        contentColor = colorAttr(com.android.internal.R.attr.textColorPrimary),
        modifier = Modifier.fillMaxSize(),
    ) {
    Surface(color = MaterialTheme.colorScheme.background, modifier = Modifier.fillMaxSize()) {
        if (priorityTiles.isNotEmpty() || recentTiles.isNotEmpty()) {
            PeopleScreenWithConversations(priorityTiles, recentTiles, viewModel.onTileClicked)
        } else {
@@ -97,7 +90,7 @@ private fun PeopleScreenWithConversations(
    onTileClicked: (PeopleTileViewModel) -> Unit,
) {
    Column(
        Modifier.fillMaxSize().safeContentPadding().sysuiResTag("top_level_with_conversations")
        Modifier.fillMaxSize().safeDrawingPadding().sysuiResTag("top_level_with_conversations")
    ) {
        Column(
            Modifier.fillMaxWidth().padding(PeopleSpacePadding),
@@ -151,17 +144,14 @@ private fun ConversationList(
        stringResource(headerTextResource),
        Modifier.padding(start = 16.dp),
        style = MaterialTheme.typography.labelLarge,
        color = colorAttr(com.android.internal.R.attr.colorAccentPrimaryVariant),
        color = MaterialTheme.colorScheme.primary,
    )

    Spacer(Modifier.height(10.dp))

    tiles.forEachIndexed { index, tile ->
        if (index > 0) {
            Divider(
                color = colorAttr(com.android.internal.R.attr.colorBackground),
                thickness = 2.dp,
            )
            HorizontalDivider(color = MaterialTheme.colorScheme.background, thickness = 2.dp)
        }

        key(tile.key.toString()) {
@@ -187,8 +177,7 @@ private fun Tile(
    val bottomCornerRadius = if (withBottomCornerRadius) cornerRadius else 0.dp

    Surface(
        color = colorAttr(com.android.internal.R.attr.colorSurface),
        contentColor = colorAttr(com.android.internal.R.attr.textColorPrimary),
        color = MaterialTheme.colorScheme.secondaryContainer,
        shape =
            RoundedCornerShape(
                topStart = topCornerRadius,
+4 −15
Original line number Diff line number Diff line
@@ -25,12 +25,11 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -42,13 +41,12 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.android.compose.theme.colorAttr
import com.android.systemui.res.R

@Composable
internal fun PeopleScreenEmpty(onGotItClicked: () -> Unit) {
    Column(
        Modifier.fillMaxSize().safeContentPadding().padding(PeopleSpacePadding),
        Modifier.fillMaxSize().safeDrawingPadding().padding(PeopleSpacePadding),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        Text(
@@ -69,15 +67,7 @@ internal fun PeopleScreenEmpty(onGotItClicked: () -> Unit) {
        ExampleTile()
        Spacer(Modifier.weight(1f))

        Button(
            onGotItClicked,
            Modifier.fillMaxWidth().defaultMinSize(minHeight = 56.dp),
            colors =
                ButtonDefaults.buttonColors(
                    containerColor = colorAttr(com.android.internal.R.attr.colorAccentPrimary),
                    contentColor = colorAttr(com.android.internal.R.attr.textColorOnAccent),
                ),
        ) {
        Button(onGotItClicked, Modifier.fillMaxWidth().defaultMinSize(minHeight = 56.dp)) {
            Text(stringResource(R.string.got_it))
        }
    }
@@ -87,8 +77,7 @@ internal fun PeopleScreenEmpty(onGotItClicked: () -> Unit) {
private fun ExampleTile() {
    Surface(
        shape = RoundedCornerShape(28.dp),
        color = colorAttr(com.android.internal.R.attr.colorSurface),
        contentColor = colorAttr(com.android.internal.R.attr.textColorPrimary),
        color = MaterialTheme.colorScheme.secondaryContainer,
    ) {
        Row(
            Modifier.padding(vertical = 20.dp, horizontal = 16.dp),
+4 −1
Original line number Diff line number Diff line
@@ -21,15 +21,16 @@ import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.theme.PlatformTheme
import com.android.systemui.people.ui.compose.PeopleScreen
import com.android.systemui.people.ui.viewmodel.PeopleViewModel
import javax.inject.Inject
import com.android.app.tracing.coroutines.launchTraced as launch

/** People Tile Widget configuration activity that shows the user their conversation tiles. */
class PeopleSpaceActivity
@@ -37,6 +38,8 @@ class PeopleSpaceActivity
constructor(private val viewModelFactory: PeopleViewModel.Factory) : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()

        setResult(RESULT_CANCELED)

        // Update the widget ID coming from the intent.