mirror of
https://github.com/kalarina-bit/Matewave.git
synced 2026-11-22 08:06:09 +00:00
Support landscape and tablets
Remove the portrait lock: Android 16 ignores it on large screens anyway. Board screens (game, puzzle, opening trainer, spectator) put the board on the left and the players, moves and buttons on the right in landscape. Rotation no longer recreates the activity, so games and connections keep their state, and content stays clear of the cutout and side navigation bar.
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait">
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboardHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
@@ -53,6 +53,72 @@ import cc.skysparkle.matewave.ui.theme.GlassShape
|
||||
import cc.skysparkle.matewave.ui.theme.PanelBorder
|
||||
import cc.skysparkle.matewave.ui.theme.TabletMaxContentWidth
|
||||
import cc.skysparkle.matewave.ui.theme.glass
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||
import androidx.compose.foundation.layout.displayCutout
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.union
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.unit.min
|
||||
import cc.skysparkle.matewave.ui.theme.LandscapeMaxContentWidth
|
||||
|
||||
/** Landscape: a phone on its side or a tablet held wide. Board screens then put the board on the left. */
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
fun isLandscape(): Boolean {
|
||||
val config = LocalConfiguration.current
|
||||
return config.screenWidthDp > config.screenHeightDp
|
||||
}
|
||||
|
||||
/** Side insets in landscape: the camera cutout and a 3-button navigation bar sit on the left or right. */
|
||||
@Composable
|
||||
fun Modifier.horizontalSafePadding(): Modifier =
|
||||
windowInsetsPadding(WindowInsets.displayCutout.union(WindowInsets.navigationBars).only(WindowInsetsSides.Horizontal))
|
||||
|
||||
@Composable
|
||||
private fun ScaffoldTopBar(
|
||||
title: String,
|
||||
onBack: (() -> Unit)?,
|
||||
actions: @Composable RowScope.() -> Unit,
|
||||
titleContent: (@Composable RowScope.() -> Unit)?
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().statusBarsPadding().padding(start = 4.dp, end = 4.dp, top = 8.dp, bottom = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (onBack != null) {
|
||||
IconButton(onClick = onBack) {
|
||||
AppIcon(
|
||||
R.drawable.ic_arrow_back,
|
||||
size = 24.dp,
|
||||
tint = ChessGreen,
|
||||
contentDescription = stringResource(R.string.back)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Spacer(Modifier.width(16.dp))
|
||||
}
|
||||
if (titleContent != null) {
|
||||
Row(modifier = Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically, content = titleContent)
|
||||
} else {
|
||||
Text(
|
||||
title,
|
||||
color = ink,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
actions()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun GlassScaffold(
|
||||
@@ -64,38 +130,9 @@ fun GlassScaffold(
|
||||
titleContent: (@Composable RowScope.() -> Unit)? = null,
|
||||
content: @Composable ColumnScope.() -> Unit
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
|
||||
Box(modifier = Modifier.fillMaxSize().horizontalSafePadding(), contentAlignment = Alignment.TopCenter) {
|
||||
Column(modifier = Modifier.fillMaxSize().widthIn(max = TabletMaxContentWidth)) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().statusBarsPadding().padding(start = 4.dp, end = 4.dp, top = 8.dp, bottom = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (onBack != null) {
|
||||
IconButton(onClick = onBack) {
|
||||
AppIcon(
|
||||
R.drawable.ic_arrow_back,
|
||||
size = 24.dp,
|
||||
tint = ChessGreen,
|
||||
contentDescription = stringResource(R.string.back)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Spacer(Modifier.width(16.dp))
|
||||
}
|
||||
if (titleContent != null) {
|
||||
Row(modifier = Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically, content = titleContent)
|
||||
} else {
|
||||
Text(
|
||||
title,
|
||||
color = ink,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
actions()
|
||||
}
|
||||
ScaffoldTopBar(title, onBack, actions, titleContent)
|
||||
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
@@ -120,6 +157,65 @@ fun GlassScaffold(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A screen with a chess board. Portrait: [above], the board and [below] in one scrolling column,
|
||||
* as before. Landscape: the board on the left as large as the height allows, [above] and [below]
|
||||
* in a scrolling column on the right. [board] gets the modifier that sizes it.
|
||||
*/
|
||||
@Composable
|
||||
fun BoardScaffold(
|
||||
title: String,
|
||||
onBack: (() -> Unit)? = null,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
titleContent: (@Composable RowScope.() -> Unit)? = null,
|
||||
above: @Composable ColumnScope.() -> Unit = {},
|
||||
board: (@Composable (Modifier) -> Unit)?,
|
||||
below: @Composable ColumnScope.() -> Unit = {}
|
||||
) {
|
||||
if (!isLandscape()) {
|
||||
GlassScaffold(title = title, onBack = onBack, actions = actions, titleContent = titleContent) {
|
||||
above()
|
||||
if (board != null) {
|
||||
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.TopCenter) { board(Modifier) }
|
||||
}
|
||||
below()
|
||||
}
|
||||
return
|
||||
}
|
||||
Box(modifier = Modifier.fillMaxSize().horizontalSafePadding(), contentAlignment = Alignment.TopCenter) {
|
||||
Column(modifier = Modifier.fillMaxSize().widthIn(max = LandscapeMaxContentWidth)) {
|
||||
ScaffoldTopBar(title, onBack, actions, titleContent)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f)
|
||||
.navigationBarsPadding()
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 12.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(20.dp)
|
||||
) {
|
||||
if (board != null) {
|
||||
BoxWithConstraints(
|
||||
modifier = Modifier.weight(1f).fillMaxHeight(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
board(Modifier.size(min(maxWidth, maxHeight)))
|
||||
}
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxHeight()
|
||||
.verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(14.dp)
|
||||
) {
|
||||
above()
|
||||
below()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Modifier.pressScale(interactionSource: MutableInteractionSource): Modifier {
|
||||
val pressed by interactionSource.collectIsPressedAsState()
|
||||
|
||||
@@ -102,7 +102,14 @@ fun GameScreen(viewModel: GameViewModel, onExit: () -> Unit) {
|
||||
else -> null
|
||||
}
|
||||
|
||||
GlassScaffold(
|
||||
val material = remember(state.board) { cc.skysparkle.matewave.engine.Material.balance(state.board) }
|
||||
val bottomColor = state.myColor
|
||||
val topColor = if (bottomColor == PieceColor.WHITE) PieceColor.BLACK else PieceColor.WHITE
|
||||
val kingInCheckSquare = remember(state.board) { ChessEngine.checkedKingSquare(state.board) }
|
||||
|
||||
// Portrait: opponent, board, you and the controls one under another.
|
||||
// Landscape: the board on the left, players and controls on the right.
|
||||
cc.skysparkle.matewave.ui.components.BoardScaffold(
|
||||
title = "",
|
||||
onBack = requestExit,
|
||||
actions = {
|
||||
@@ -112,32 +119,29 @@ fun GameScreen(viewModel: GameViewModel, onExit: () -> Unit) {
|
||||
},
|
||||
titleContent = if (showOpening && opening != null) {
|
||||
{ OpeningTitle("${opening.eco} · ${opening.name}", bookStatus, inBook) }
|
||||
} else null
|
||||
} else null,
|
||||
above = {
|
||||
if (state.mode == GameMode.VS_PLAYER_NETWORK) ConnectionBanner(state)
|
||||
TrustBanners(state)
|
||||
PlayerRow(state, topColor, isMe = false, material = material, clock = viewModel.clockState)
|
||||
},
|
||||
board = { boardModifier ->
|
||||
ChessBoardView(
|
||||
modifier = boardModifier,
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargetsFromSelected,
|
||||
kingInCheckSquare = kingInCheckSquare,
|
||||
flipped = state.myColor == PieceColor.BLACK,
|
||||
onSquareClick = viewModel::onSquareClicked,
|
||||
lastMove = state.lastMove,
|
||||
interactionEnabled = state.status == GameStatus.ONGOING && state.pendingPromotion == null &&
|
||||
(state.mode != GameMode.VS_PLAYER_NETWORK ||
|
||||
(state.connectionState == ConnectionState.CONNECTED &&
|
||||
state.handshake == cc.skysparkle.matewave.viewmodel.HandshakeState.PLAYING))
|
||||
)
|
||||
}
|
||||
) {
|
||||
if (state.mode == GameMode.VS_PLAYER_NETWORK) ConnectionBanner(state)
|
||||
TrustBanners(state)
|
||||
|
||||
val material = remember(state.board) { cc.skysparkle.matewave.engine.Material.balance(state.board) }
|
||||
val bottomColor = state.myColor
|
||||
val topColor = if (bottomColor == PieceColor.WHITE) PieceColor.BLACK else PieceColor.WHITE
|
||||
val kingInCheckSquare = remember(state.board) { ChessEngine.checkedKingSquare(state.board) }
|
||||
|
||||
PlayerRow(state, topColor, isMe = false, material = material, clock = viewModel.clockState)
|
||||
|
||||
ChessBoardView(
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargetsFromSelected,
|
||||
kingInCheckSquare = kingInCheckSquare,
|
||||
flipped = state.myColor == PieceColor.BLACK,
|
||||
onSquareClick = viewModel::onSquareClicked,
|
||||
lastMove = state.lastMove,
|
||||
interactionEnabled = state.status == GameStatus.ONGOING && state.pendingPromotion == null &&
|
||||
(state.mode != GameMode.VS_PLAYER_NETWORK ||
|
||||
(state.connectionState == ConnectionState.CONNECTED &&
|
||||
state.handshake == cc.skysparkle.matewave.viewmodel.HandshakeState.PLAYING))
|
||||
)
|
||||
|
||||
PlayerRow(state, bottomColor, isMe = true, material = material, clock = viewModel.clockState)
|
||||
|
||||
// The move ribbon: only moves here, the opening name lives in the top bar.
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import cc.skysparkle.matewave.ui.components.horizontalSafePadding
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
@@ -98,7 +99,7 @@ fun MainMenuScreen(
|
||||
var showRatingGate by remember { mutableStateOf(false) }
|
||||
var showStats by remember { mutableStateOf(false) }
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
|
||||
Box(modifier = Modifier.fillMaxSize().horizontalSafePadding(), contentAlignment = Alignment.TopCenter) {
|
||||
Column(modifier = Modifier.fillMaxSize().widthIn(max = TabletMaxContentWidth)) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -59,6 +59,7 @@ import cc.skysparkle.matewave.data.ProfileStore
|
||||
import cc.skysparkle.matewave.network.Transports
|
||||
import cc.skysparkle.matewave.ui.components.AppIcon
|
||||
import cc.skysparkle.matewave.ui.components.GlassButton
|
||||
import cc.skysparkle.matewave.ui.components.horizontalSafePadding
|
||||
import cc.skysparkle.matewave.ui.theme.ChessGreen
|
||||
import cc.skysparkle.matewave.ui.theme.PanelBorder
|
||||
import cc.skysparkle.matewave.ui.theme.Surface2
|
||||
@@ -165,6 +166,7 @@ fun OnboardingScreen(replay: Boolean, onDone: () -> Unit) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.horizontalSafePadding()
|
||||
.testTag("onboarding"),
|
||||
contentAlignment = Alignment.TopCenter
|
||||
) {
|
||||
|
||||
@@ -43,45 +43,52 @@ fun OpeningTrainerScreen(viewModel: OpeningStudyViewModel, onBack: () -> Unit) {
|
||||
val sans = state.sans
|
||||
val opening = remember(sans) { OpeningBook.openingName(sans) }
|
||||
|
||||
GlassScaffold(title = course.name, onBack = onBack) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
stringResource(
|
||||
when (state.mode) {
|
||||
SessionMode.LEARN -> R.string.study_mode_learn
|
||||
SessionMode.REVIEW -> R.string.study_mode_review
|
||||
SessionMode.PRACTICE -> R.string.study_mode_practice
|
||||
}
|
||||
),
|
||||
color = ChessGreen,
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
val asked = state.asked.size
|
||||
if (asked > 0 && state.phase != TrainerPhase.COMPLETE) {
|
||||
// Landscape: the board on the left, progress, moves and the task on the right
|
||||
cc.skysparkle.matewave.ui.components.BoardScaffold(
|
||||
title = course.name,
|
||||
onBack = onBack,
|
||||
above = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
stringResource(R.string.study_progress, minOf(state.answered + 1, asked), asked),
|
||||
color = ink.copy(alpha = 0.7f),
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
stringResource(
|
||||
when (state.mode) {
|
||||
SessionMode.LEARN -> R.string.study_mode_learn
|
||||
SessionMode.REVIEW -> R.string.study_mode_review
|
||||
SessionMode.PRACTICE -> R.string.study_mode_practice
|
||||
}
|
||||
),
|
||||
color = ChessGreen,
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
val asked = state.asked.size
|
||||
if (asked > 0 && state.phase != TrainerPhase.COMPLETE) {
|
||||
Text(
|
||||
stringResource(R.string.study_progress, minOf(state.answered + 1, asked), asked),
|
||||
color = ink.copy(alpha = 0.7f),
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
ProgressBar(state.answered.toFloat() / state.asked.size.coerceAtLeast(1))
|
||||
|
||||
MovesBar(sans = sans, startBoard = startBoard, opening = opening)
|
||||
},
|
||||
board = { boardModifier ->
|
||||
ChessBoardView(
|
||||
modifier = boardModifier,
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargets,
|
||||
kingInCheckSquare = null,
|
||||
flipped = course.side == PieceColor.BLACK,
|
||||
onSquareClick = { viewModel.onSquareClick(it) },
|
||||
lastMove = state.lastMove,
|
||||
hintSquare = state.hintSquare,
|
||||
interactionEnabled = state.phase == TrainerPhase.YOUR_MOVE || state.phase == TrainerPhase.WRONG
|
||||
)
|
||||
}
|
||||
ProgressBar(state.answered.toFloat() / state.asked.size.coerceAtLeast(1))
|
||||
|
||||
MovesBar(sans = sans, startBoard = startBoard, opening = opening)
|
||||
|
||||
ChessBoardView(
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargets,
|
||||
kingInCheckSquare = null,
|
||||
flipped = course.side == PieceColor.BLACK,
|
||||
onSquareClick = { viewModel.onSquareClick(it) },
|
||||
lastMove = state.lastMove,
|
||||
hintSquare = state.hintSquare,
|
||||
interactionEnabled = state.phase == TrainerPhase.YOUR_MOVE || state.phase == TrainerPhase.WRONG
|
||||
)
|
||||
|
||||
) {
|
||||
when (state.phase) {
|
||||
TrainerPhase.YOUR_MOVE -> Text(
|
||||
stringResource(if (state.mode == SessionMode.LEARN) R.string.study_learn_prompt else R.string.study_recall_prompt),
|
||||
|
||||
@@ -71,7 +71,8 @@ fun PuzzleSolveScreen(viewModel: GameViewModel, onBack: () -> Unit, onNextPuzzle
|
||||
}
|
||||
val redSquare = if (state.puzzleFailedAttempt && state.puzzleAutoMoving) state.lastMove?.to else null
|
||||
|
||||
GlassScaffold(
|
||||
// Landscape: the board on the left, the task and buttons on the right
|
||||
cc.skysparkle.matewave.ui.components.BoardScaffold(
|
||||
title = puzzle?.let { stringResource(R.string.puzzle_title_rating, it.rating) } ?: stringResource(R.string.puzzle_title_fallback),
|
||||
onBack = onBack,
|
||||
actions = {
|
||||
@@ -88,24 +89,25 @@ fun PuzzleSolveScreen(viewModel: GameViewModel, onBack: () -> Unit, onNextPuzzle
|
||||
.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||
)
|
||||
}
|
||||
},
|
||||
board = { boardModifier ->
|
||||
// On tablets the board is capped and centred, so the task and buttons fit without scrolling.
|
||||
ChessBoardView(
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargetsFromSelected,
|
||||
kingInCheckSquare = remember(state.board) { ChessEngine.checkedKingSquare(state.board) },
|
||||
flipped = state.myColor == PieceColor.BLACK,
|
||||
onSquareClick = viewModel::onSquareClicked,
|
||||
modifier = boardModifier.widthIn(max = 560.dp),
|
||||
lastMove = state.lastMove,
|
||||
hintSquare = state.puzzleHintFrom,
|
||||
interactionEnabled = state.puzzleStarted && !state.puzzleAutoMoving && !state.puzzleSolved && state.pendingPromotion == null,
|
||||
flashSquare = redSquare ?: greenFlash,
|
||||
flashColor = if (redSquare != null) WrongRed.copy(alpha = 0.55f) else ChessGreen.copy(alpha = 0.55f)
|
||||
)
|
||||
}
|
||||
) {
|
||||
// On tablets the board is capped and centred, so the task and buttons fit without scrolling.
|
||||
ChessBoardView(
|
||||
board = state.board,
|
||||
selectedSquare = state.selectedSquare,
|
||||
legalTargets = state.legalTargetsFromSelected,
|
||||
kingInCheckSquare = remember(state.board) { ChessEngine.checkedKingSquare(state.board) },
|
||||
flipped = state.myColor == PieceColor.BLACK,
|
||||
onSquareClick = viewModel::onSquareClicked,
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally).widthIn(max = 560.dp),
|
||||
lastMove = state.lastMove,
|
||||
hintSquare = state.puzzleHintFrom,
|
||||
interactionEnabled = state.puzzleStarted && !state.puzzleAutoMoving && !state.puzzleSolved && state.pendingPromotion == null,
|
||||
flashSquare = redSquare ?: greenFlash,
|
||||
flashColor = if (redSquare != null) WrongRed.copy(alpha = 0.55f) else ChessGreen.copy(alpha = 0.55f)
|
||||
)
|
||||
|
||||
// The task, in the same format as the status in a game: a dot in the side's colour.
|
||||
val (text, color) = when {
|
||||
state.puzzleSolved -> stringResource(R.string.puzzle_solved) to ChessGreen
|
||||
|
||||
@@ -88,35 +88,40 @@ fun SpectatorScreen(target: SpectateTarget, onBackToFriends: () -> Unit) {
|
||||
val view = state.view
|
||||
var resultHidden by remember(view?.gameId, state.phase) { mutableStateOf(false) }
|
||||
|
||||
GlassScaffold(
|
||||
val bottom = if (state.flipped) PieceColor.BLACK else PieceColor.WHITE
|
||||
val material = remember(view?.board) { view?.let { Material.balance(it.board) } }
|
||||
val checkSquare = remember(view?.board) { view?.let { ChessEngine.checkedKingSquare(it.board) } }
|
||||
|
||||
// Landscape: the board on the left, players, moves and buttons on the right
|
||||
cc.skysparkle.matewave.ui.components.BoardScaffold(
|
||||
title = stringResource(R.string.spectate_title),
|
||||
onBack = backToFriends,
|
||||
actions = { if (view != null) SpectatorBadge(state.spectators, state.max) }
|
||||
) {
|
||||
if (state.phase == SpectatePhase.CONNECTING) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CircularProgressIndicator(color = ink, strokeWidth = 2.dp, modifier = Modifier.size(16.dp))
|
||||
Text(stringResource(R.string.spectate_joining), color = ink, style = MaterialTheme.typography.bodyMedium)
|
||||
actions = { if (view != null) SpectatorBadge(state.spectators, state.max) },
|
||||
above = {
|
||||
if (state.phase == SpectatePhase.CONNECTING) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CircularProgressIndicator(color = ink, strokeWidth = 2.dp, modifier = Modifier.size(16.dp))
|
||||
Text(stringResource(R.string.spectate_joining), color = ink, style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
}
|
||||
if (view != null && material != null) SpectatorPlayerRow(view, bottom.opposite(), state, material)
|
||||
},
|
||||
board = { boardModifier ->
|
||||
if (view != null) ChessBoardView(
|
||||
modifier = boardModifier,
|
||||
board = view.board,
|
||||
selectedSquare = null,
|
||||
legalTargets = emptyList(),
|
||||
kingInCheckSquare = checkSquare,
|
||||
flipped = state.flipped,
|
||||
onSquareClick = {},
|
||||
lastMove = view.lastMove,
|
||||
interactionEnabled = false,
|
||||
highlightLastMove = true
|
||||
)
|
||||
}
|
||||
if (view == null) return@GlassScaffold
|
||||
|
||||
val bottom = if (state.flipped) PieceColor.BLACK else PieceColor.WHITE
|
||||
val material = remember(view.board) { Material.balance(view.board) }
|
||||
val checkSquare = remember(view.board) { ChessEngine.checkedKingSquare(view.board) }
|
||||
|
||||
SpectatorPlayerRow(view, bottom.opposite(), state, material)
|
||||
ChessBoardView(
|
||||
board = view.board,
|
||||
selectedSquare = null,
|
||||
legalTargets = emptyList(),
|
||||
kingInCheckSquare = checkSquare,
|
||||
flipped = state.flipped,
|
||||
onSquareClick = {},
|
||||
lastMove = view.lastMove,
|
||||
interactionEnabled = false,
|
||||
highlightLastMove = true
|
||||
)
|
||||
) {
|
||||
if (view == null || material == null) return@BoardScaffold
|
||||
SpectatorPlayerRow(view, bottom, state, material)
|
||||
|
||||
val bookPlies = remember(view.moveSans) { OpeningBook.bookDepth(view.moveSans) }
|
||||
|
||||
@@ -15,6 +15,8 @@ val UiCornerRadius = 22.dp
|
||||
val GlassShape: Shape = RoundedCornerShape(UiCornerRadius)
|
||||
|
||||
val TabletMaxContentWidth = 600.dp
|
||||
/** Landscape board screens: board and side panel together. */
|
||||
val LandscapeMaxContentWidth = 1200.dp
|
||||
|
||||
fun Modifier.glass(): Modifier = this
|
||||
.clip(GlassShape)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• Unterstützungskarte mit Ko-fi-Button unten in den Einstellungen und unter „Über die App“
|
||||
• Links zum Quellcode führen jetzt zu GitHub
|
||||
• Eine kurze Anleitung beim ersten Start mit Name und Spielstärke; erneut aufrufbar in den Einstellungen
|
||||
• Querformat und Tablets: Brett links, Spieler und Züge rechts
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• Support card with a Ko-fi button at the bottom of Settings and in About
|
||||
• Source code links now lead to GitHub
|
||||
• A short guide on first launch, with your name and level; open it again from Settings
|
||||
• Landscape and tablets: the board on the left, players and moves on the right
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• 設定の下部と「このアプリについて」にKo-fiボタン付きの支援カード
|
||||
• ソースコードへのリンクはGitHubに変更
|
||||
• 初回起動時の簡単なガイド(名前とレベルの設定つき)。設定から再表示できます
|
||||
• 横向き・タブレット対応:盤面を左、プレイヤーと棋譜を右に表示
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• Paramos kortelė su Ko-fi mygtuku nustatymų apačioje ir lange „Apie programą“
|
||||
• Nuorodos į išeitinį kodą dabar veda į GitHub
|
||||
• Trumpas gidas pirmą kartą paleidus, su vardu ir lygiu; jį vėl rasite nustatymuose
|
||||
• Gulsčias ekranas ir planšetės: lenta kairėje, žaidėjai ir ėjimai dešinėje
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• Карточка поддержки с кнопкой Ko-fi внизу настроек и в окне «О программе»
|
||||
• Ссылки на исходный код теперь ведут на GitHub
|
||||
• Короткий гид при первом запуске с выбором имени и уровня; его можно открыть снова в настройках
|
||||
• Альбомный режим и планшеты: доска слева, игроки и ходы справа
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
• 设置底部和“关于”中新增带 Ko-fi 按钮的支持卡片
|
||||
• 源代码链接现在指向 GitHub
|
||||
• 首次启动时的简短指南,可设置名字和水平;可在设置中再次打开
|
||||
• 横屏和平板:棋盘在左,玩家和着法在右
|
||||
|
||||
Reference in New Issue
Block a user