From 8c255b55fddd73ef72a30f05c24838d59b870d78 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 22 Nov 2023 19:44:43 +0100 Subject: [PATCH] Display user profile at the top right if logged in --- .../twom/matrix/MatrixActivityScaffold.kt | 18 +++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/steffo/twom/matrix/MatrixActivityScaffold.kt b/app/src/main/java/eu/steffo/twom/matrix/MatrixActivityScaffold.kt index f6c64c1..7fc1d8f 100644 --- a/app/src/main/java/eu/steffo/twom/matrix/MatrixActivityScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/matrix/MatrixActivityScaffold.kt @@ -1,8 +1,12 @@ package eu.steffo.twom.matrix import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.AccountCircle import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -26,7 +30,19 @@ fun MatrixActivityScaffold( CenterAlignedTopAppBar( title = { Text(LocalContext.current.getString(R.string.app_name)) - } + }, + actions = { + if (session != null) { + IconButton( + onClick = {} + ) { + Icon( + Icons.Filled.AccountCircle, + LocalContext.current.getString(R.string.account_label) + ) + } + } + }, ) } ) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 036a23f..40fc6c0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,4 +22,5 @@ To use TwoM, you need to be logged into Matrix. Login You are logged in. + My account \ No newline at end of file