DRY pass #2, batch 6, F19: BackButton, the arrow out of a full-screen surface (#5372)

Panel.kt BackButton(onClick, label): the IconButton + ArrowBack that the
tags, sync and editor top bars each built. Each keeps its own spoken
label. Checked with ktlint in the CI image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 14:52:54 -04:00
co-authored by Claude Opus 5.5
parent 74ee288fd4
commit f2fac1674b
4 changed files with 18 additions and 28 deletions
@@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.List import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
@@ -96,12 +95,7 @@ fun EditorTopBar(
// The only way out, and the only thing that needed a "save" button // The only way out, and the only thing that needed a "save" button
// before writes became continuous. Leaving IS saving now, which is what // before writes became continuous. Leaving IS saving now, which is what
// the line in the bottom corner is there to say out loud. // the line in the bottom corner is there to say out loud.
IconButton(onClick = onClose) { BackButton(onClose, R.string.editor_back)
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.editor_back),
)
}
}, },
actions = { actions = {
if (!readOnly && owner) { if (!readOnly && owner) {
@@ -9,8 +9,12 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
@@ -175,6 +179,17 @@ fun ConfirmDialog(
) )
} }
/** The arrow out of a full-screen surface, at the start of its top bar. */
@Composable
fun BackButton(
onClick: () -> Unit,
@StringRes label: Int,
) {
IconButton(onClick = onClick) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(label))
}
}
/** Secondary text under a field or a heading: smaller, and in the quieter ink. */ /** Secondary text under a field or a heading: smaller, and in the quieter ink. */
@Composable @Composable
fun Hint( fun Hint(
@@ -9,13 +9,9 @@ import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
@@ -76,14 +72,7 @@ fun SyncScreen(
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(R.string.sync_title)) }, title = { Text(stringResource(R.string.sync_title)) },
navigationIcon = { navigationIcon = { BackButton(onClose, R.string.editor_back) },
IconButton(onClick = onClose) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.editor_back),
)
}
},
) )
}, },
) { padding -> ) { padding ->
@@ -19,7 +19,6 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenu
@@ -104,14 +103,7 @@ fun TagsScreen(
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(R.string.tags_title)) }, title = { Text(stringResource(R.string.tags_title)) },
navigationIcon = { navigationIcon = { BackButton(onClose, R.string.tags_back) },
IconButton(onClick = onClose) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.tags_back),
)
}
},
) )
}, },
) { padding -> ) { padding ->