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

Commit 1164f6b2 authored by Michal Brzezinski's avatar Michal Brzezinski
Browse files

Adding icons to buttons in touchpad tutorial

Fixes: 371193338
Test: manual
Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial
Change-Id: I269a748e4e05af24329e6ebb057ea706c97a911a
parent ba99fe6a
Loading
Loading
Loading
Loading
+26 −0
Original line number Original line Diff line number Diff line
<!--
  ~ Copyright (C) 2024 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.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:tint="?attr/colorControlNormal"
    android:viewportHeight="960"
    android:viewportWidth="960">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M240,760L360,760L360,520L600,520L600,760L720,760L720,400L480,220L240,400L240,760ZM160,840L160,360L480,120L800,360L800,840L520,840L520,600L440,600L440,840L160,840ZM480,490L480,490L480,490L480,490L480,490L480,490L480,490L480,490L480,490Z" />
</vector>
+27 −0
Original line number Original line Diff line number Diff line
<!--
  ~ Copyright (C) 2024 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.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:autoMirrored="true"
    android:tint="?attr/colorControlNormal"
    android:viewportHeight="960"
    android:viewportWidth="960">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M120,800Q87,800 63.5,776.5Q40,753 40,720L40,240Q40,207 63.5,183.5Q87,160 120,160L200,160Q233,160 256.5,183.5Q280,207 280,240L280,720Q280,753 256.5,776.5Q233,800 200,800L120,800ZM120,721L200,721Q200,721 200,721Q200,721 200,721L200,239Q200,239 200,239Q200,239 200,239L120,239Q120,239 120,239Q120,239 120,239L120,721Q120,721 120,721Q120,721 120,721ZM440,800Q407,800 383.5,776.5Q360,753 360,720L360,240Q360,207 383.5,183.5Q407,160 440,160L840,160Q873,160 896.5,183.5Q920,207 920,240L920,720Q920,753 896.5,776.5Q873,800 840,800L440,800ZM440,721L840,721Q840,721 840,721Q840,721 840,721L840,239Q840,239 840,239Q840,239 840,239L440,239Q440,239 440,239Q440,239 440,239L440,721Q440,721 440,721Q440,721 440,721ZM200,721Q200,721 200,721Q200,721 200,721L200,239Q200,239 200,239Q200,239 200,239L200,239Q200,239 200,239Q200,239 200,239L200,721Q200,721 200,721Q200,721 200,721ZM440,721Q440,721 440,721Q440,721 440,721L440,239Q440,239 440,239Q440,239 440,239L440,239Q440,239 440,239Q440,239 440,239L440,721Q440,721 440,721Q440,721 440,721Z" />
</vector>
+44 −19
Original line number Original line Diff line number Diff line
@@ -20,19 +20,27 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.dp
import com.android.systemui.inputdevice.tutorial.ui.composable.DoneButton
import com.android.systemui.inputdevice.tutorial.ui.composable.DoneButton
import com.android.systemui.res.R
import com.android.systemui.res.R
@@ -47,20 +55,17 @@ fun TutorialSelectionScreen(
    Column(
    Column(
        verticalArrangement = Arrangement.Center,
        verticalArrangement = Arrangement.Center,
        modifier =
        modifier =
            Modifier.background(
            Modifier.background(color = MaterialTheme.colorScheme.surfaceContainer).fillMaxSize(),
                    color = MaterialTheme.colorScheme.surfaceContainer,
                )
                .fillMaxSize()
    ) {
    ) {
        TutorialSelectionButtons(
        TutorialSelectionButtons(
            onBackTutorialClicked = onBackTutorialClicked,
            onBackTutorialClicked = onBackTutorialClicked,
            onHomeTutorialClicked = onHomeTutorialClicked,
            onHomeTutorialClicked = onHomeTutorialClicked,
            onRecentAppsTutorialClicked = onRecentAppsTutorialClicked,
            onRecentAppsTutorialClicked = onRecentAppsTutorialClicked,
            modifier = Modifier.padding(60.dp)
            modifier = Modifier.padding(60.dp),
        )
        )
        DoneButton(
        DoneButton(
            onDoneButtonClicked = onDoneButtonClicked,
            onDoneButtonClicked = onDoneButtonClicked,
            modifier = Modifier.padding(horizontal = 60.dp)
            modifier = Modifier.padding(horizontal = 60.dp),
        )
        )
    }
    }
}
}
@@ -70,30 +75,36 @@ private fun TutorialSelectionButtons(
    onBackTutorialClicked: () -> Unit,
    onBackTutorialClicked: () -> Unit,
    onHomeTutorialClicked: () -> Unit,
    onHomeTutorialClicked: () -> Unit,
    onRecentAppsTutorialClicked: () -> Unit,
    onRecentAppsTutorialClicked: () -> Unit,
    modifier: Modifier = Modifier
    modifier: Modifier = Modifier,
) {
) {
    Row(
    Row(
        horizontalArrangement = Arrangement.spacedBy(20.dp),
        horizontalArrangement = Arrangement.spacedBy(20.dp),
        verticalAlignment = Alignment.CenterVertically,
        verticalAlignment = Alignment.CenterVertically,
        modifier = modifier
        modifier = modifier,
    ) {
    ) {
        TutorialButton(
        TutorialButton(
            text = stringResource(R.string.touchpad_tutorial_home_gesture_button),
            text = stringResource(R.string.touchpad_tutorial_home_gesture_button),
            icon = Icons.AutoMirrored.Outlined.ArrowBack,
            iconColor = MaterialTheme.colorScheme.onPrimary,
            onClick = onHomeTutorialClicked,
            onClick = onHomeTutorialClicked,
            color = MaterialTheme.colorScheme.primary,
            backgroundColor = MaterialTheme.colorScheme.primary,
            modifier = Modifier.weight(1f)
            modifier = Modifier.weight(1f),
        )
        )
        TutorialButton(
        TutorialButton(
            text = stringResource(R.string.touchpad_tutorial_back_gesture_button),
            text = stringResource(R.string.touchpad_tutorial_back_gesture_button),
            icon = ImageVector.vectorResource(id = R.drawable.touchpad_tutorial_home_icon),
            iconColor = MaterialTheme.colorScheme.onTertiary,
            onClick = onBackTutorialClicked,
            onClick = onBackTutorialClicked,
            color = MaterialTheme.colorScheme.tertiary,
            backgroundColor = MaterialTheme.colorScheme.tertiary,
            modifier = Modifier.weight(1f)
            modifier = Modifier.weight(1f),
        )
        )
        TutorialButton(
        TutorialButton(
            text = stringResource(R.string.touchpad_tutorial_recent_apps_gesture_button),
            text = stringResource(R.string.touchpad_tutorial_recent_apps_gesture_button),
            icon = ImageVector.vectorResource(id = R.drawable.touchpad_tutorial_recents_icon),
            iconColor = MaterialTheme.colorScheme.onSecondary,
            onClick = onRecentAppsTutorialClicked,
            onClick = onRecentAppsTutorialClicked,
            color = MaterialTheme.colorScheme.secondary,
            backgroundColor = MaterialTheme.colorScheme.secondary,
            modifier = Modifier.weight(1f)
            modifier = Modifier.weight(1f),
        )
        )
    }
    }
}
}
@@ -101,16 +112,30 @@ private fun TutorialSelectionButtons(
@Composable
@Composable
private fun TutorialButton(
private fun TutorialButton(
    text: String,
    text: String,
    icon: ImageVector,
    iconColor: Color,
    onClick: () -> Unit,
    onClick: () -> Unit,
    color: Color,
    backgroundColor: Color,
    modifier: Modifier = Modifier
    modifier: Modifier = Modifier,
) {
) {
    Button(
    Button(
        onClick = onClick,
        onClick = onClick,
        shape = RoundedCornerShape(16.dp),
        shape = RoundedCornerShape(16.dp),
        colors = ButtonDefaults.buttonColors(containerColor = color),
        colors = ButtonDefaults.buttonColors(containerColor = backgroundColor),
        modifier = modifier.aspectRatio(0.66f)
        modifier = modifier.aspectRatio(0.66f),
    ) {
        Column(
            verticalArrangement = Arrangement.Center,
            horizontalAlignment = Alignment.CenterHorizontally,
        ) {
        ) {
            Icon(
                imageVector = icon,
                contentDescription = text,
                modifier = Modifier.width(30.dp).height(30.dp),
                tint = iconColor,
            )
            Spacer(modifier = Modifier.height(16.dp))
            Text(text = text, style = MaterialTheme.typography.headlineLarge)
            Text(text = text, style = MaterialTheme.typography.headlineLarge)
        }
        }
    }
    }
}