Android: games from Lichess and Chess.com, newest first, with «Download new games»
The downloads of the desktop (lookup by nickname, one database per site or both in one, resuming without duplicates, games still being played fetched once they end) move into a shared crate, online-games; the desktop keeps its window on top of it. On Android, «Add a database» → «Games from Lichess and Chess.com»: a nickname, what each site has, the download with its progress. It belongs to the app, not to the screen: the list of databases shows how it goes and says how it ended. «Download new games» in the database's menu and over its games list fetches only the new ones. The games of a downloaded database are listed from the most recent one (by UTC date and time, both sites interleaved). Both builds may now use the internet, only when the user asks. Reviewed by an independent tester and designer (docs/design/android-ui.md §23, §24). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ca444ed8d
commit
f6072cb7c3
29 changed files with 3094 additions and 1299 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Games from Lichess and Chess.com, only when asked for (android-ui.md §23). -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".ChessPenguinApp"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import android.provider.OpenableColumns
|
|||
import io.github.vrubelroman.chesspenguin.data.DbEntry
|
||||
import io.github.vrubelroman.chesspenguin.data.EngineFiles
|
||||
import io.github.vrubelroman.chesspenguin.data.Library
|
||||
import io.github.vrubelroman.chesspenguin.data.OnlineDownloads
|
||||
import io.github.vrubelroman.chesspenguin.data.Settings
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
@ -28,6 +29,8 @@ class ChessPenguinApp : Application() {
|
|||
val library by lazy { Library(this) }
|
||||
val settings by lazy { Settings(this) }
|
||||
val engineFiles by lazy { EngineFiles(this, scope) }
|
||||
/// Games from Lichess and Chess.com being downloaded (android-ui.md §23).
|
||||
val downloads by lazy { OnlineDownloads(library, scope) }
|
||||
|
||||
/// The games shown on the list of each database (after a search), for paging
|
||||
/// games from the game screen: database id → game numbers.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import io.github.vrubelroman.chesspenguin.ui.app
|
|||
import io.github.vrubelroman.chesspenguin.ui.openProblem
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import androidx.navigation3.runtime.entryProvider
|
||||
import androidx.navigation3.runtime.rememberSaveableStateHolderNavEntryDecorator
|
||||
import androidx.lifecycle.viewmodel.navigation3.rememberViewModelStoreNavEntryDecorator
|
||||
import androidx.navigation3.runtime.rememberNavBackStack
|
||||
import androidx.navigation3.ui.NavDisplay
|
||||
import io.github.vrubelroman.chesspenguin.ui.AboutScreen
|
||||
|
|
@ -37,6 +39,7 @@ import io.github.vrubelroman.chesspenguin.ui.DatabasesScreen
|
|||
import io.github.vrubelroman.chesspenguin.ui.SettingsScreen
|
||||
import io.github.vrubelroman.chesspenguin.ui.GameScreen
|
||||
import io.github.vrubelroman.chesspenguin.ui.GamesScreen
|
||||
import io.github.vrubelroman.chesspenguin.ui.OnlineScreen
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable data object Databases : NavKey
|
||||
|
|
@ -53,6 +56,8 @@ import kotlinx.serialization.Serializable
|
|||
|
||||
@Serializable data object BoardStyleKey : NavKey
|
||||
|
||||
@Serializable data object OnlineKey : NavKey
|
||||
|
||||
@Composable
|
||||
fun MainNavigation() {
|
||||
val backStack = rememberNavBackStack(Databases)
|
||||
|
|
@ -92,9 +97,20 @@ fun MainNavigation() {
|
|||
NavDisplay(
|
||||
backStack = backStack,
|
||||
onBack = { backStack.removeLastOrNull() },
|
||||
// Each screen keeps its own saved state and view models: they go with the screen
|
||||
// when it leaves the stack (the search of the online screen must not outlive it).
|
||||
entryDecorators = listOf(
|
||||
rememberSaveableStateHolderNavEntryDecorator(),
|
||||
rememberViewModelStoreNavEntryDecorator(),
|
||||
),
|
||||
entryProvider = entryProvider {
|
||||
entry<Databases> {
|
||||
DatabasesScreen(onOpen = { backStack.add(Games(it)) }, onAdded = ::show, onSettings = { backStack.add(SettingsKey) })
|
||||
DatabasesScreen(
|
||||
onOpen = { backStack.add(Games(it)) },
|
||||
onAdded = ::show,
|
||||
onSettings = { backStack.add(SettingsKey) },
|
||||
onOnline = { backStack.add(OnlineKey) },
|
||||
)
|
||||
}
|
||||
entry<Games> { key ->
|
||||
GamesScreen(key.db, onBack = { backStack.removeLastOrNull() }, onGame = { place, query -> backStack.add(GameAt(key.db, place, query)) })
|
||||
|
|
@ -112,6 +128,16 @@ fun MainNavigation() {
|
|||
entry<BoardStyleKey> {
|
||||
BoardStyleScreen(onBack = { backStack.removeLastOrNull() })
|
||||
}
|
||||
entry<OnlineKey> {
|
||||
OnlineScreen(
|
||||
onBack = { backStack.removeLastOrNull() },
|
||||
// The downloaded database instead of this screen: "back" goes to the list.
|
||||
onOpen = { id ->
|
||||
backStack.removeLastOrNull()
|
||||
backStack.add(Games(id))
|
||||
},
|
||||
)
|
||||
}
|
||||
entry<AboutKey> {
|
||||
AboutScreen(onBack = { backStack.removeLastOrNull() })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ enum class Source {
|
|||
/// A copy kept inside the app (`files/copies/`): games pasted from the clipboard, a
|
||||
/// file opened from another app, which gives access to it only for a while.
|
||||
Copy,
|
||||
|
||||
/// A player's games downloaded from Lichess and Chess.com (`files/online/`, with the
|
||||
/// state of the download beside it, android-ui.md §23).
|
||||
Online,
|
||||
}
|
||||
|
||||
/// A database on the list. The file itself is never changed.
|
||||
|
|
@ -63,6 +67,8 @@ data class DbEntry(
|
|||
val renamed: Boolean = false,
|
||||
/// A copy's SHA-256: the same file opened again is not copied twice.
|
||||
val sha256: String? = null,
|
||||
/// A downloaded database: when its last download finished (Unix seconds).
|
||||
val updated: Long? = null,
|
||||
)
|
||||
|
||||
/// Text or a file with no games in it.
|
||||
|
|
@ -111,6 +117,8 @@ data class FolderScan(val tree: Uri, val name: String, val found: List<Found>)
|
|||
class Library(private val context: Context) {
|
||||
private val file = File(context.filesDir, "library.json")
|
||||
private val copies = File(context.filesDir, "copies")
|
||||
/// Downloaded databases (android-ui.md §23).
|
||||
val onlineDir = File(context.filesDir, "online")
|
||||
private val json = Json { ignoreUnknownKeys = true }
|
||||
private val _entries = MutableStateFlow(load())
|
||||
val entries: StateFlow<List<DbEntry>> = _entries.asStateFlow()
|
||||
|
|
@ -124,6 +132,16 @@ class Library(private val context: Context) {
|
|||
|
||||
init {
|
||||
releaseUnused()
|
||||
// A download cut short by a closed app wrote games the list does not know of yet.
|
||||
update { list -> list.map(::withOnlineState) }
|
||||
}
|
||||
|
||||
/// A downloaded database with the number of games and the time of its last download
|
||||
/// as its state file has them (they change while the list does not look).
|
||||
private fun withOnlineState(e: DbEntry): DbEntry {
|
||||
if (e.source != Source.Online) return e
|
||||
val info = uniffi.mobile_api.onlineDatabase(onlineFile(e).path) ?: return e
|
||||
return e.copy(games = info.games.toInt(), updated = info.updated ?: e.updated)
|
||||
}
|
||||
|
||||
/// Gives back the access to files and folders no database on the list uses (a
|
||||
|
|
@ -132,6 +150,13 @@ class Library(private val context: Context) {
|
|||
private fun releaseUnused() {
|
||||
val kept = _entries.value.filter { it.source == Source.Copy }.map { it.location }.toSet()
|
||||
copies.listFiles()?.filter { it.name !in kept }?.forEach { it.delete() }
|
||||
// A downloaded database left behind (the app closed while "Undo" was offered).
|
||||
// Names may hold dots ("Name (Lichess + Chess.com).pgn"): whole names are compared.
|
||||
val online = _entries.value.filter { it.source == Source.Online }.flatMap {
|
||||
val stem = it.location.removeSuffix(".pgn")
|
||||
listOf("$stem.pgn", "$stem.online.json", "$stem.online.lock")
|
||||
}.toSet()
|
||||
onlineDir.listFiles()?.filter { it.name !in online }?.forEach { it.delete() }
|
||||
val used = _entries.value.mapNotNull { it.tree ?: it.location.takeIf { _ -> it.source == Source.File || it.source == Source.ChessBase } }.toSet()
|
||||
for (p in context.contentResolver.persistedUriPermissions) {
|
||||
if (p.uri.toString() !in used) {
|
||||
|
|
@ -263,6 +288,42 @@ class Library(private val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
/// The file of a downloaded database.
|
||||
fun onlineFile(e: DbEntry): File = File(onlineDir, e.location)
|
||||
|
||||
/// Puts a downloaded database (a file of [onlineDir]) on the list, or gives its entry.
|
||||
fun addOnline(file: File): DbEntry = synchronized(this) {
|
||||
_entries.value.firstOrNull { it.source == Source.Online && it.location == file.name }?.let { return it }
|
||||
val entry = DbEntry(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = file.name.substringBeforeLast('.'),
|
||||
source = Source.Online,
|
||||
location = file.name,
|
||||
fileName = file.name,
|
||||
games = 0,
|
||||
format = "PGN",
|
||||
)
|
||||
update { it + entry }
|
||||
entry
|
||||
}
|
||||
|
||||
/// A downloaded database got new games: it is read again when next opened. The old
|
||||
/// one is not closed: a screen may still show it; it is freed once nothing holds it.
|
||||
suspend fun downloaded(id: String, games: Int, updated: Long?) {
|
||||
lock.withLock {
|
||||
open.remove(id)
|
||||
update { list -> list.map { if (it.id == id) it.copy(games = games, updated = updated ?: it.updated) else it } }
|
||||
}
|
||||
}
|
||||
|
||||
/// Takes a downloaded database that got no games off the list, with its files.
|
||||
fun dropEmpty(id: String) {
|
||||
val e = entry(id) ?: return
|
||||
update { it.filterNot { x -> x.id == id } }
|
||||
open.remove(id)?.close()
|
||||
uniffi.mobile_api.deleteOnlineDatabase(onlineFile(e).path)
|
||||
}
|
||||
|
||||
fun rename(id: String, name: String) = update { list -> list.map { if (it.id == id) it.copy(name = name, renamed = true) else it } }
|
||||
|
||||
/// Takes the database off the list (the file stays where it is). Returns its place,
|
||||
|
|
@ -286,6 +347,10 @@ class Library(private val context: Context) {
|
|||
File(copies, entry.location).delete()
|
||||
return
|
||||
}
|
||||
if (entry.source == Source.Online) {
|
||||
uniffi.mobile_api.deleteOnlineDatabase(onlineFile(entry).path)
|
||||
return
|
||||
}
|
||||
// The permission of a folder is given back with the last of its databases, also
|
||||
// counting those whose "Undo" is still offered.
|
||||
val granted = entry.tree ?: entry.location
|
||||
|
|
@ -433,7 +498,8 @@ class Library(private val context: Context) {
|
|||
|
||||
fun restore(place: Int, entry: DbEntry) {
|
||||
pending.remove(entry)
|
||||
update { it.toMutableList().apply { add(place.coerceIn(0, size), entry) } }
|
||||
// A download may have gone on while it was off the list.
|
||||
update { it.toMutableList().apply { add(place.coerceIn(0, size), withOnlineState(entry)) } }
|
||||
}
|
||||
|
||||
/// The same file on the list, picked through another way (its URI differs).
|
||||
|
|
@ -452,6 +518,14 @@ class Library(private val context: Context) {
|
|||
}
|
||||
}.getOrNull()
|
||||
|
||||
/// The games of a database that `query` finds, in the order the list shows them: a
|
||||
/// downloaded database from the most recent game down (android-ui.md §23), the others
|
||||
/// as in the file. Slow for a big database: call it off the main thread.
|
||||
fun listed(id: String, db: Database, query: String): List<UInt> {
|
||||
val found = db.find(query)
|
||||
return if (entry(id)?.source == Source.Online) db.newestFirst(found) else found
|
||||
}
|
||||
|
||||
/// The open database of an entry (opened in the background the first time).
|
||||
suspend fun database(id: String): Result<Database> = lock.withLock {
|
||||
open[id]?.let { return@withLock Result.success(it) }
|
||||
|
|
@ -466,6 +540,10 @@ class Library(private val context: Context) {
|
|||
e.fileName,
|
||||
android.os.ParcelFileDescriptor.open(File(copies, e.location), android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd(),
|
||||
)
|
||||
Source.Online -> openFile(
|
||||
e.fileName,
|
||||
android.os.ParcelFileDescriptor.open(onlineFile(e), android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
package io.github.vrubelroman.chesspenguin.data
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import uniffi.mobile_api.DownloadState
|
||||
import uniffi.mobile_api.OnlineAccount
|
||||
import uniffi.mobile_api.OnlineDownload
|
||||
import uniffi.mobile_api.onlineDatabase
|
||||
import java.io.File
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/// A download of a database and how it stands (or how it ended); `fresh` when the
|
||||
/// database did not exist before it (its first download).
|
||||
data class DownloadView(val accounts: List<OnlineAccount>, val state: DownloadState, val fresh: Boolean = false)
|
||||
|
||||
/// A download that has ended, for the snackbar of the screen that is shown then.
|
||||
data class Finished(val id: String, val name: String, val view: DownloadView, val games: Int)
|
||||
|
||||
/// The downloads of games from Lichess and Chess.com (android-ui.md §23). They belong to
|
||||
/// the app, not to a screen: leaving the screen does not stop them, and the list of
|
||||
/// databases shows how they go.
|
||||
class OnlineDownloads(private val library: Library, private val scope: CoroutineScope) {
|
||||
private val _views = MutableStateFlow<Map<String, DownloadView>>(emptyMap())
|
||||
/// By database id: the running downloads, and the last one of each database.
|
||||
val views: StateFlow<Map<String, DownloadView>> = _views.asStateFlow()
|
||||
|
||||
private val running = ConcurrentHashMap<String, OnlineDownload>()
|
||||
|
||||
private val _finished = MutableSharedFlow<Finished>(extraBufferCapacity = 8)
|
||||
/// Each download as it ends (android-ui.md §23.3: a snackbar says how it went).
|
||||
val finished: SharedFlow<Finished> = _finished.asSharedFlow()
|
||||
|
||||
/// Where the downloaded databases are kept.
|
||||
val dir: File get() = library.onlineDir
|
||||
|
||||
/// Starts fetching the new games of `accounts` into the database file `path` (put on
|
||||
/// the list at once); one download per database. Returns the database's entry.
|
||||
fun start(accounts: List<OnlineAccount>, path: String): DbEntry {
|
||||
val fresh = !File(path).exists()
|
||||
val entry = library.addOnline(File(path))
|
||||
if (running.containsKey(entry.id)) return entry
|
||||
val d = OnlineDownload.start(accounts, path)
|
||||
running[entry.id] = d
|
||||
scope.launch(Dispatchers.IO) {
|
||||
while (true) {
|
||||
val s = d.state()
|
||||
_views.update { it + (entry.id to DownloadView(accounts, s, fresh)) }
|
||||
if (!s.running) break
|
||||
delay(POLL_MS)
|
||||
}
|
||||
running.remove(entry.id)
|
||||
d.close()
|
||||
val info = onlineDatabase(path)
|
||||
val games = info?.games?.toInt() ?: 0
|
||||
// No game at all (no standard chess there, or it failed at once): not a database.
|
||||
val name = library.entry(entry.id)?.name ?: entry.name
|
||||
if (games == 0) library.dropEmpty(entry.id) else library.downloaded(entry.id, games, info?.updated)
|
||||
_views.value[entry.id]?.let { _finished.tryEmit(Finished(entry.id, name, it, games)) }
|
||||
}
|
||||
return entry
|
||||
}
|
||||
|
||||
/// Fetches the games played since the last download of a database.
|
||||
fun update(entry: DbEntry) {
|
||||
val path = library.onlineFile(entry).path
|
||||
val info = onlineDatabase(path) ?: return
|
||||
start(info.accounts, path)
|
||||
}
|
||||
|
||||
/// Stops a download; what it fetched stays.
|
||||
fun cancel(id: String) {
|
||||
running[id]?.cancel()
|
||||
}
|
||||
|
||||
fun isRunning(id: String): Boolean = running.containsKey(id)
|
||||
|
||||
private companion object {
|
||||
const val POLL_MS = 400L
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.CloudDownload
|
||||
import androidx.compose.material.icons.outlined.ContentPaste
|
||||
import androidx.compose.material.icons.outlined.Description
|
||||
import androidx.compose.material.icons.outlined.Folder
|
||||
|
|
@ -52,10 +53,11 @@ import io.github.vrubelroman.chesspenguin.data.FolderScan
|
|||
import io.github.vrubelroman.chesspenguin.data.Found
|
||||
import io.github.vrubelroman.chesspenguin.data.Source
|
||||
|
||||
/// "Add a database": games in the clipboard, a file, or every database in a folder.
|
||||
/// "Add a database": games in the clipboard, a file, every database in a folder, or a
|
||||
/// player's games from Lichess and Chess.com.
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, onDismiss: () -> Unit) {
|
||||
fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, onOnline: () -> Unit, onDismiss: () -> Unit) {
|
||||
ModalBottomSheet(onDismissRequest = onDismiss) {
|
||||
Column(Modifier.navigationBarsPadding().padding(bottom = 24.dp)) {
|
||||
Text(
|
||||
|
|
@ -74,6 +76,13 @@ fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, o
|
|||
modifier = Modifier.clickable(role = Role.Button, onClick = onPaste).padding(horizontal = 8.dp),
|
||||
)
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(R.string.online_title)) },
|
||||
supportingContent = { Text(stringResource(R.string.add_online_hint)) },
|
||||
leadingContent = { Icon(Icons.Outlined.CloudDownload, null) },
|
||||
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
|
||||
modifier = Modifier.clickable(role = Role.Button, onClick = onOnline).padding(horizontal = 8.dp),
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(R.string.add_file)) },
|
||||
supportingContent = { Text(stringResource(R.string.add_file_hint)) },
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import androidx.compose.material3.IconButton
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SnackbarDuration
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.material3.SnackbarResult
|
||||
|
|
@ -69,6 +70,9 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.github.vrubelroman.chesspenguin.R
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import io.github.vrubelroman.chesspenguin.data.DownloadView
|
||||
import io.github.vrubelroman.chesspenguin.data.Finished
|
||||
import io.github.vrubelroman.chesspenguin.data.DbEntry
|
||||
import io.github.vrubelroman.chesspenguin.data.FolderScan
|
||||
import io.github.vrubelroman.chesspenguin.data.Source
|
||||
|
|
@ -78,13 +82,27 @@ import kotlinx.coroutines.launch
|
|||
/// The first screen: the databases on the list (android-ui.md §3).
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSettings: () -> Unit) {
|
||||
fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSettings: () -> Unit, onOnline: () -> Unit) {
|
||||
val library = app().library
|
||||
val downloads = app().downloads
|
||||
val views by downloads.views.collectAsState()
|
||||
val entries by library.entries.collectAsState()
|
||||
val snackbar = remember { SnackbarHostState() }
|
||||
val scope = rememberCoroutineScope()
|
||||
val removedText = stringResource(R.string.removed)
|
||||
val removedCopyText = stringResource(R.string.removed_copy)
|
||||
val removedOnlineText = stringResource(R.string.online_removed)
|
||||
val resourcesForSnack = LocalResources.current
|
||||
val openText = stringResource(R.string.online_open_short)
|
||||
// How a download ended, said while this screen is shown (android-ui.md §23.3).
|
||||
LaunchedEffect(Unit) {
|
||||
downloads.finished.collect { f ->
|
||||
val text = finishedText(resourcesForSnack, f) ?: return@collect
|
||||
snackbar.currentSnackbarData?.dismiss()
|
||||
val canOpen = f.games > 0 && library.entry(f.id) != null
|
||||
if (snackbar.showSnackbar(text, if (canOpen) openText else null, withDismissAction = false) == SnackbarResult.ActionPerformed) onOpen(f.id)
|
||||
}
|
||||
}
|
||||
val undoText = stringResource(R.string.undo)
|
||||
val pick = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
||||
if (uri != null) onOpen(library.addFile(uri).id)
|
||||
|
|
@ -157,17 +175,27 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
|
|||
items(entries, key = { it.id }) { e ->
|
||||
DatabaseRow(
|
||||
e,
|
||||
download = views[e.id],
|
||||
onOpen = { onOpen(e.id) },
|
||||
onRename = { renaming = e },
|
||||
onUpdate = { downloads.update(e) },
|
||||
onStop = { downloads.cancel(e.id) },
|
||||
onRemove = {
|
||||
// A download into it stops first: its file goes with it.
|
||||
downloads.cancel(e.id)
|
||||
val removed = library.remove(e.id) ?: return@DatabaseRow
|
||||
scope.launch {
|
||||
snackbar.currentSnackbarData?.dismiss()
|
||||
var restored = false
|
||||
try {
|
||||
// A copy is deleted, not only taken off the list.
|
||||
val text = if (e.source == Source.Copy) removedCopyText else removedText
|
||||
if (snackbar.showSnackbar(text, undoText, withDismissAction = false) == SnackbarResult.ActionPerformed) {
|
||||
val text = when (e.source) {
|
||||
Source.Copy -> removedCopyText
|
||||
Source.Online -> removedOnlineText
|
||||
else -> removedText
|
||||
}
|
||||
// Not for ever: the deleted file goes once "Undo" is gone.
|
||||
if (snackbar.showSnackbar(text, undoText, withDismissAction = false, duration = SnackbarDuration.Long) == SnackbarResult.ActionPerformed) {
|
||||
library.restore(removed.first, removed.second)
|
||||
restored = true
|
||||
}
|
||||
|
|
@ -216,6 +244,10 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
|
|||
}
|
||||
}
|
||||
},
|
||||
onOnline = {
|
||||
choosing = false
|
||||
onOnline()
|
||||
},
|
||||
onDismiss = { choosing = false },
|
||||
)
|
||||
}
|
||||
|
|
@ -283,45 +315,85 @@ private fun Empty(modifier: Modifier, onAdd: () -> Unit, onSamples: () -> Unit)
|
|||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun DatabaseRow(e: DbEntry, onOpen: () -> Unit, onRename: () -> Unit, onRemove: () -> Unit, modifier: Modifier) {
|
||||
private fun DatabaseRow(
|
||||
e: DbEntry,
|
||||
download: DownloadView?,
|
||||
onOpen: () -> Unit,
|
||||
onRename: () -> Unit,
|
||||
onUpdate: () -> Unit,
|
||||
onStop: () -> Unit,
|
||||
onRemove: () -> Unit,
|
||||
modifier: Modifier,
|
||||
) {
|
||||
var menu by remember { mutableStateOf(false) }
|
||||
val format = badge(e)
|
||||
val running = download?.state?.running == true
|
||||
val failure = download?.state?.failure?.takeIf { !running }
|
||||
val subtitle = e.games?.let {
|
||||
stringResource(R.string.games_with_format, pluralStringResource(R.plurals.games_count, it, groupDigits(it)), e.format ?: format)
|
||||
} ?: stringResource(R.string.not_opened, formatName(e))
|
||||
// A copy kept in the app says so: removing it deletes it.
|
||||
val shownSubtitle = if (e.source == Source.Copy) subtitle + " · " + stringResource(R.string.db_copy) else subtitle
|
||||
Row(
|
||||
modifier
|
||||
.fillMaxWidth()
|
||||
.height(72.dp)
|
||||
.combinedClickable(onClick = onOpen, onLongClick = { menu = true })
|
||||
.padding(start = 16.dp, end = 4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
FormatBadge(format)
|
||||
Column(Modifier.weight(1f).padding(start = 16.dp)) {
|
||||
Text(displayName(e), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(
|
||||
shownSubtitle,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
val shownSubtitle = when {
|
||||
// A copy kept in the app says so: removing it deletes it.
|
||||
e.source == Source.Copy -> subtitle + " · " + stringResource(R.string.db_copy)
|
||||
e.source != Source.Online -> subtitle
|
||||
// A downloaded database: how its download goes, or when it was last brought up to date.
|
||||
running -> stringResource(R.string.online_downloading, groupDigits(((e.games ?: 0) + download.state.added.toInt())))
|
||||
else -> pluralStringResource(R.plurals.games_count, e.games ?: 0, groupDigits(e.games ?: 0)) + " · " + when {
|
||||
// The games stay in the line: the database is not empty because a site failed.
|
||||
failure != null -> onlineProblemShort(failure)
|
||||
e.updated == null -> stringResource(R.string.online_unfinished)
|
||||
System.currentTimeMillis() - e.updated * 1000 < 60_000 -> stringResource(R.string.online_updated_now)
|
||||
else -> stringResource(
|
||||
R.string.online_updated,
|
||||
DateUtils.getRelativeTimeSpanString(e.updated * 1000, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS).toString(),
|
||||
)
|
||||
}
|
||||
Box {
|
||||
IconButton(onClick = { menu = true }) { Icon(Icons.Rounded.MoreVert, stringResource(R.string.menu)) }
|
||||
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.rename)) }, onClick = {
|
||||
menu = false
|
||||
onRename()
|
||||
})
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.remove)) }, onClick = {
|
||||
menu = false
|
||||
onRemove()
|
||||
})
|
||||
}
|
||||
Box(modifier) {
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.height(72.dp)
|
||||
.combinedClickable(onClick = onOpen, onLongClick = { menu = true })
|
||||
.padding(start = 16.dp, end = 4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
FormatBadge(format)
|
||||
Column(Modifier.weight(1f).padding(start = 16.dp)) {
|
||||
Text(displayName(e), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(
|
||||
shownSubtitle,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = if (failure != null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
Box {
|
||||
IconButton(onClick = { menu = true }) { Icon(Icons.Rounded.MoreVert, stringResource(R.string.menu)) }
|
||||
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
|
||||
if (e.source == Source.Online) {
|
||||
DropdownMenuItem(text = { Text(stringResource(if (running) R.string.online_stop_download else R.string.online_update)) }, onClick = {
|
||||
menu = false
|
||||
if (running) onStop() else onUpdate()
|
||||
})
|
||||
}
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.rename)) }, onClick = {
|
||||
menu = false
|
||||
onRename()
|
||||
})
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.remove)) }, onClick = {
|
||||
menu = false
|
||||
onRemove()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
// A download going on: a thin bar along the bottom of the row (§23.3).
|
||||
if (running) {
|
||||
val share = downloadShare(download)
|
||||
val bar = Modifier.fillMaxWidth().height(2.dp).align(Alignment.BottomStart)
|
||||
if (share != null) LinearProgressIndicator(progress = { share }, modifier = bar) else LinearProgressIndicator(bar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -358,3 +430,16 @@ private fun pastedName(db: Database, dated: String): String {
|
|||
}
|
||||
return dated
|
||||
}
|
||||
|
||||
/// The snackbar of a finished download: "“Name”: +12, 1 246 games in all", "“Name”: no
|
||||
/// new games", "“Name”: Lichess does not answer"; none when it was stopped or got nothing.
|
||||
fun finishedText(res: android.content.res.Resources, f: Finished): String? {
|
||||
val s = f.view.state
|
||||
val games = res.getQuantityString(R.plurals.games_count, f.games, groupDigits(f.games))
|
||||
s.failure?.let { return res.getString(R.string.online_snack_failed, f.name, problemShort(res, it)) }
|
||||
return when {
|
||||
s.cancelled || f.games == 0 -> null
|
||||
s.added == 0UL -> res.getString(R.string.online_snack_none, f.name)
|
||||
else -> res.getString(R.string.online_snack_added, f.name, groupDigits(s.added.toInt()), games)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
return@LaunchedEffect
|
||||
}
|
||||
// After the process was restarted the list is gone: the same search finds it again.
|
||||
val list = games ?: withContext(Dispatchers.Default) { database.find(query) }.also {
|
||||
val list = games ?: withContext(Dispatchers.Default) { app.library.listed(db, database, query) }.also {
|
||||
games = it
|
||||
app.shown[db] = it
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,13 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.github.vrubelroman.chesspenguin.R
|
||||
import io.github.vrubelroman.chesspenguin.data.Source
|
||||
import androidx.compose.ui.zIndex
|
||||
import androidx.compose.ui.platform.LocalResources
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material.icons.rounded.Download
|
||||
import io.github.vrubelroman.chesspenguin.theme.Tabular
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
|
|
@ -76,7 +83,8 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
|
|||
val entry = entries.firstOrNull { it.id == db }
|
||||
var database by remember { mutableStateOf<Database?>(null) }
|
||||
var failed by remember { mutableStateOf<Throwable?>(null) }
|
||||
LaunchedEffect(db) {
|
||||
// Read again when a download brought new games into it (android-ui.md §23).
|
||||
LaunchedEffect(db, entry?.games, entry?.updated) {
|
||||
app.library.database(db).onSuccess { database = it }.onFailure { failed = it }
|
||||
}
|
||||
var searching by rememberSaveable { mutableStateOf(false) }
|
||||
|
|
@ -87,7 +95,7 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
|
|||
LaunchedEffect(database, query) {
|
||||
val d = database ?: return@LaunchedEffect
|
||||
if (query.isNotEmpty()) delay(250)
|
||||
val found = withContext(Dispatchers.Default) { d.find(query) }
|
||||
val found = withContext(Dispatchers.Default) { app.library.listed(db, d, query) }
|
||||
rows.clear()
|
||||
shown = found
|
||||
// New results start at the top.
|
||||
|
|
@ -95,6 +103,18 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
|
|||
app.shown[db] = found
|
||||
}
|
||||
val scroll = TopAppBarDefaults.pinnedScrollBehavior()
|
||||
val download = app.downloads.views.collectAsState().value[db]
|
||||
val snackbar = remember { SnackbarHostState() }
|
||||
val resources = LocalResources.current
|
||||
// How a download of this database ended (§23.3); the list reads it again by itself.
|
||||
LaunchedEffect(db) {
|
||||
app.downloads.finished.collect { f ->
|
||||
if (f.id != db) return@collect
|
||||
val text = finishedText(resources, f) ?: return@collect
|
||||
snackbar.currentSnackbarData?.dismiss()
|
||||
snackbar.showSnackbar(text)
|
||||
}
|
||||
}
|
||||
val focus = remember { FocusRequester() }
|
||||
val keyboard = LocalSoftwareKeyboardController.current
|
||||
BackHandler(searching) {
|
||||
|
|
@ -153,13 +173,28 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
|
|||
}) { Icon(Icons.Rounded.Close, stringResource(R.string.clear)) }
|
||||
} else if (database != null) {
|
||||
IconButton(onClick = { searching = true }) { Icon(Icons.Rounded.Search, stringResource(R.string.search)) }
|
||||
// A downloaded database: its new games from here, where they are
|
||||
// looked for (android-ui.md §23.3); ✕ while they come.
|
||||
if (entry?.source == Source.Online) {
|
||||
if (download?.state?.running == true) {
|
||||
IconButton(onClick = { app.downloads.cancel(db) }) { Icon(Icons.Rounded.Close, stringResource(R.string.online_stop_download)) }
|
||||
} else {
|
||||
IconButton(onClick = { entry.let { app.downloads.update(it) } }) { Icon(Icons.Rounded.Download, stringResource(R.string.online_update)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollBehavior = scroll,
|
||||
)
|
||||
},
|
||||
snackbarHost = { SnackbarHost(snackbar) },
|
||||
) { padding ->
|
||||
Box(Modifier.fillMaxSize().padding(padding)) {
|
||||
download?.takeIf { it.state.running }?.let { v ->
|
||||
val share = downloadShare(v)
|
||||
val bar = Modifier.fillMaxWidth().height(2.dp).align(Alignment.TopStart).zIndex(1f)
|
||||
if (share != null) LinearProgressIndicator(progress = { share }, modifier = bar) else LinearProgressIndicator(bar)
|
||||
}
|
||||
val games = shown
|
||||
when {
|
||||
failed != null -> Message(stringResource(R.string.open_failed), openProblem(failed!!)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,500 @@
|
|||
package io.github.vrubelroman.chesspenguin.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.pluralStringResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.LiveRegionMode
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.heading
|
||||
import androidx.compose.ui.semantics.liveRegion
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import io.github.vrubelroman.chesspenguin.R
|
||||
import io.github.vrubelroman.chesspenguin.data.DownloadView
|
||||
import io.github.vrubelroman.chesspenguin.data.Source
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import uniffi.mobile_api.AccountLookup
|
||||
import uniffi.mobile_api.OnlineAccount
|
||||
import uniffi.mobile_api.OnlineFailure
|
||||
import uniffi.mobile_api.OnlineProblem
|
||||
import uniffi.mobile_api.Site
|
||||
import uniffi.mobile_api.findAccount
|
||||
import uniffi.mobile_api.onlineDatabase
|
||||
import uniffi.mobile_api.onlineTargets
|
||||
import uniffi.mobile_api.validNickname
|
||||
import java.io.File
|
||||
import kotlin.math.ceil
|
||||
|
||||
/// Lichess gives about this many games a second to an anonymous export.
|
||||
private const val LICHESS_GAMES_PER_SECOND = 20.0
|
||||
|
||||
fun siteName(s: Site): String = when (s) {
|
||||
Site.LICHESS -> "Lichess"
|
||||
Site.CHESS_COM -> "Chess.com"
|
||||
}
|
||||
|
||||
/// "1 234 games" in the language of the interface.
|
||||
@Composable
|
||||
fun gamesText(n: Long): String {
|
||||
val k = n.coerceAtMost(Int.MAX_VALUE.toLong()).toInt()
|
||||
return pluralStringResource(R.plurals.games_count, k, groupDigits(k))
|
||||
}
|
||||
|
||||
/// Seconds Lichess needs for `games` games.
|
||||
private fun lichessSeconds(games: Long): Double = games / LICHESS_GAMES_PER_SECOND
|
||||
|
||||
/// What went wrong, in words for a chess player (android-ui.md §23.4).
|
||||
@Composable
|
||||
fun onlineProblemText(f: OnlineFailure): String {
|
||||
val site = f.site?.let(::siteName) ?: "—"
|
||||
return when (f.problem) {
|
||||
OnlineProblem.NETWORK -> stringResource(R.string.online_err_network, site)
|
||||
OnlineProblem.RATE_LIMITED -> stringResource(R.string.online_err_rate, site)
|
||||
OnlineProblem.UNEXPECTED -> stringResource(R.string.online_err_unexpected, site)
|
||||
OnlineProblem.DISK -> stringResource(R.string.online_err_disk)
|
||||
OnlineProblem.BUSY -> stringResource(R.string.online_err_busy)
|
||||
}
|
||||
}
|
||||
|
||||
/// The short form, for the subtitle of a database and the snackbar (§23.3).
|
||||
fun problemShort(res: android.content.res.Resources, f: OnlineFailure): String {
|
||||
val site = f.site?.let(::siteName)
|
||||
return when {
|
||||
site != null && f.problem == OnlineProblem.NETWORK -> res.getString(R.string.online_short_network, site)
|
||||
site != null && f.problem == OnlineProblem.RATE_LIMITED -> res.getString(R.string.online_short_rate, site)
|
||||
else -> res.getString(R.string.online_short_failed)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun onlineProblemShort(f: OnlineFailure): String = problemShort(androidx.compose.ui.platform.LocalResources.current, f)
|
||||
|
||||
/// What a running download is doing: "Lichess: 1 200 of about 6 541 · about 5 min left",
|
||||
/// "Chess.com: month 12 of 84 · 340 games".
|
||||
@Composable
|
||||
fun downloadProgressText(v: DownloadView): String {
|
||||
val s = v.state
|
||||
val account = v.accounts.getOrNull(s.account.toInt())
|
||||
val games = s.accountGames.toLong()
|
||||
return when (account?.site) {
|
||||
Site.LICHESS -> {
|
||||
val total = account.games?.toLong() ?: 0
|
||||
if (total > games) {
|
||||
val minutes = ceil(lichessSeconds(total - games) / 60.0).toInt().coerceAtLeast(1)
|
||||
stringResource(R.string.online_progress_lichess, groupDigits(games.toInt()), groupDigits(total.toInt()), minutes)
|
||||
} else {
|
||||
stringResource(R.string.online_progress_count, "Lichess", gamesText(games))
|
||||
}
|
||||
}
|
||||
Site.CHESS_COM -> if (s.monthsTotal > 0u) {
|
||||
stringResource(R.string.online_progress_chesscom, s.monthsDone.toInt(), s.monthsTotal.toInt(), gamesText(games))
|
||||
} else {
|
||||
stringResource(R.string.online_progress_count, "Chess.com", gamesText(games))
|
||||
}
|
||||
null -> stringResource(R.string.online_downloading, groupDigits(s.added.toInt()))
|
||||
}
|
||||
}
|
||||
|
||||
/// How a finished download went: "Done: 473 games" the first time, "+12, 1 246 games in
|
||||
/// all" later.
|
||||
@Composable
|
||||
fun downloadResultText(v: DownloadView): String {
|
||||
val s = v.state
|
||||
s.failure?.let { return onlineProblemText(it) }
|
||||
val total = s.total?.toLong() ?: 0
|
||||
return when {
|
||||
s.cancelled -> stringResource(R.string.online_stopped, gamesText(total))
|
||||
total == 0L -> stringResource(R.string.online_no_games)
|
||||
s.added == 0UL -> stringResource(R.string.online_no_new, gamesText(total))
|
||||
v.fresh -> stringResource(R.string.online_done, gamesText(total))
|
||||
else -> stringResource(R.string.online_added, groupDigits(s.added.toInt()), gamesText(total))
|
||||
}
|
||||
}
|
||||
|
||||
/// The share of the whole download done, when it is known: each account is an equal part
|
||||
/// (Lichess counted by its games, Chess.com by months).
|
||||
fun downloadShare(v: DownloadView): Float? {
|
||||
val s = v.state
|
||||
val i = s.account.toInt()
|
||||
val account = v.accounts.getOrNull(i) ?: return null
|
||||
val part = when (account.site) {
|
||||
Site.LICHESS -> account.games?.takeIf { it > 0UL }?.let { (s.accountGames.toDouble() / it.toDouble()).toFloat() }
|
||||
Site.CHESS_COM -> s.monthsTotal.takeIf { it > 0u }?.let { s.monthsDone.toFloat() / it.toFloat() }
|
||||
} ?: return null
|
||||
return ((i + part.coerceIn(0f, 1f)) / v.accounts.size).coerceIn(0f, 1f)
|
||||
}
|
||||
|
||||
/// The search of the screen: kept when the phone is turned (android-ui.md §23.2).
|
||||
class OnlineSearch : ViewModel() {
|
||||
var found by mutableStateOf<Map<Site, AccountLookup>?>(null)
|
||||
var chosen by mutableStateOf(setOf<Site>())
|
||||
var searching by mutableStateOf(false)
|
||||
|
||||
fun find(forLichess: String, forChessCom: String) {
|
||||
if (searching) return
|
||||
searching = true
|
||||
viewModelScope.launch {
|
||||
val result = withContext(Dispatchers.IO) {
|
||||
val li = async { findAccount(Site.LICHESS, forLichess) }
|
||||
val cc = async { findAccount(Site.CHESS_COM, forChessCom) }
|
||||
mapOf(Site.LICHESS to li.await(), Site.CHESS_COM to cc.await())
|
||||
}
|
||||
found = result
|
||||
chosen = result.filterValues { it is AccountLookup.Found }.keys
|
||||
searching = false
|
||||
}
|
||||
}
|
||||
|
||||
fun forget() {
|
||||
found = null
|
||||
}
|
||||
}
|
||||
|
||||
/// A nickname is shown as wrong only for a character it may not have or when it is too
|
||||
/// long; a short one is still being typed.
|
||||
private fun badNick(nick: String): Boolean {
|
||||
val t = nick.trim()
|
||||
return t.length > 30 || t.any { !(it.isLetterOrDigit() && it.code < 128) && it != '_' && it != '-' }
|
||||
}
|
||||
|
||||
/// "Games from Lichess and Chess.com" (android-ui.md §23.2): a nickname, what was found on
|
||||
/// each site, the download and how it goes.
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun OnlineScreen(onBack: () -> Unit, onOpen: (String) -> Unit) {
|
||||
val app = app()
|
||||
val downloads = app.downloads
|
||||
val views by downloads.views.collectAsState()
|
||||
val entries by app.library.entries.collectAsState()
|
||||
val search: OnlineSearch = viewModel()
|
||||
val keyboard = LocalSoftwareKeyboardController.current
|
||||
var nick by rememberSaveable { mutableStateOf("") }
|
||||
// A different nickname on Chess.com, once asked for.
|
||||
var other by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
var together by rememberSaveable { mutableStateOf(true) }
|
||||
// The databases this screen started downloading; the found accounts are hidden then,
|
||||
// until the next search.
|
||||
var started by rememberSaveable { mutableStateOf(listOf<String>()) }
|
||||
var launched by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
val nickOk = validNickname(nick)
|
||||
val otherOk = other?.let { it.isBlank() || validNickname(it) } ?: true
|
||||
fun find() {
|
||||
if (!nickOk || !otherOk) return
|
||||
keyboard?.hide()
|
||||
launched = false
|
||||
val forLichess = nick.trim()
|
||||
search.find(forLichess, other?.trim()?.takeIf { it.isNotEmpty() } ?: forLichess)
|
||||
}
|
||||
|
||||
val found = search.found
|
||||
val accounts: List<OnlineAccount> = found.orEmpty()
|
||||
.filterKeys { it in search.chosen }
|
||||
.values.mapNotNull { (it as? AccountLookup.Found)?.account }
|
||||
val merge = together && accounts.size > 1
|
||||
// Where the games go, and how many are there already; read again when a download ends.
|
||||
val ended = started.count { views[it]?.state?.running == false }
|
||||
val targets by produceState(emptyList<Pair<String, Long?>>(), accounts, merge, ended) {
|
||||
value = withContext(Dispatchers.IO) {
|
||||
if (accounts.isEmpty()) {
|
||||
emptyList()
|
||||
} else {
|
||||
onlineTargets(downloads.dir.path, accounts, merge).map { t ->
|
||||
t.path to (if (t.exists) onlineDatabase(t.path)?.games?.toLong() else null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// A database's name as on the list (it may have been renamed), else its file's.
|
||||
fun nameOf(path: String): String {
|
||||
val file = File(path).name
|
||||
return entries.firstOrNull { it.source == Source.Online && it.location == file }?.name ?: file.removeSuffix(".pgn")
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) } },
|
||||
title = { Text(stringResource(R.string.online_title)) },
|
||||
)
|
||||
},
|
||||
) { padding ->
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxSize()
|
||||
.padding(padding)
|
||||
.imePadding()
|
||||
.verticalScroll(rememberScrollState())
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.online_intro), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Spacer(Modifier.height(16.dp))
|
||||
NickField(
|
||||
value = nick,
|
||||
label = stringResource(if (other == null) R.string.online_nick else R.string.online_nick_lichess),
|
||||
bad = badNick(nick),
|
||||
onChange = {
|
||||
nick = it
|
||||
search.forget()
|
||||
},
|
||||
onDone = ::find,
|
||||
)
|
||||
if (other == null) {
|
||||
TextButton(onClick = { other = "" }, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_other)) }
|
||||
} else {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
NickField(
|
||||
value = other.orEmpty(),
|
||||
label = stringResource(R.string.online_other_nick),
|
||||
bad = badNick(other.orEmpty()),
|
||||
onChange = {
|
||||
other = it
|
||||
search.forget()
|
||||
},
|
||||
onDone = ::find,
|
||||
)
|
||||
TextButton(onClick = {
|
||||
other = null
|
||||
search.forget()
|
||||
}, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_same_nick)) }
|
||||
}
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End, verticalAlignment = Alignment.CenterVertically) {
|
||||
if (search.searching) {
|
||||
CircularProgressIndicator(Modifier.size(20.dp), strokeWidth = 2.dp)
|
||||
Spacer(Modifier.size(12.dp))
|
||||
Text(stringResource(R.string.online_searching), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f))
|
||||
}
|
||||
val enabled = nickOk && otherOk && !search.searching
|
||||
// After a search the main button of the screen is "Download".
|
||||
if (found != null && !launched) {
|
||||
OutlinedButton(onClick = ::find, enabled = enabled) { Text(stringResource(R.string.online_find)) }
|
||||
} else {
|
||||
Button(onClick = ::find, enabled = enabled) { Text(stringResource(R.string.online_find)) }
|
||||
}
|
||||
}
|
||||
|
||||
if (found != null && !launched) {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
for (site in listOf(Site.LICHESS, Site.CHESS_COM)) {
|
||||
val r = found[site] ?: continue
|
||||
FoundRow(site, r, site in search.chosen, onToggle = { on -> search.chosen = if (on) search.chosen + site else search.chosen - site }, onRetry = ::find)
|
||||
}
|
||||
if (found.values.count { it is AccountLookup.Found } > 1 && search.chosen.size > 1) {
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 64.dp)
|
||||
.toggleable(value = together, role = Role.Switch, onValueChange = { together = it }),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(stringResource(R.string.online_merge), style = MaterialTheme.typography.bodyLarge)
|
||||
Text(stringResource(R.string.online_merge_hint), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
Switch(checked = together, onCheckedChange = null)
|
||||
}
|
||||
}
|
||||
for ((path, games) in targets) {
|
||||
val name = nameOf(path)
|
||||
Text(
|
||||
if (games != null) {
|
||||
stringResource(R.string.online_into_existing, name, gamesText(games))
|
||||
} else {
|
||||
stringResource(R.string.online_into_new, name)
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(vertical = 4.dp),
|
||||
)
|
||||
}
|
||||
if (accounts.isNotEmpty()) {
|
||||
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.End) {
|
||||
Button(onClick = {
|
||||
val groups = onlineTargets(downloads.dir.path, accounts, merge)
|
||||
started = groups.map { downloads.start(it.accounts, it.path).id }
|
||||
launched = true
|
||||
}) { Text(stringResource(R.string.online_download)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The downloads started here: how they go, then how they went.
|
||||
for (id in started) {
|
||||
val v = views[id] ?: continue
|
||||
Spacer(Modifier.height(16.dp))
|
||||
DownloadCard(
|
||||
name = entries.firstOrNull { it.id == id }?.name ?: v.accounts.joinToString(" + ") { it.username },
|
||||
view = v,
|
||||
onStop = { downloads.cancel(id) },
|
||||
onOpen = if (!v.state.running && (v.state.total ?: 0UL) > 0UL && entries.any { it.id == id }) ({ onOpen(id) }) else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NickField(value: String, label: String, bad: Boolean, onChange: (String) -> Unit, onDone: () -> Unit) {
|
||||
OutlinedTextField(
|
||||
value = value,
|
||||
onValueChange = onChange,
|
||||
label = { Text(label) },
|
||||
placeholder = { Text(stringResource(R.string.online_nick_hint)) },
|
||||
singleLine = true,
|
||||
isError = bad,
|
||||
supportingText = if (bad) ({ Text(stringResource(R.string.online_nick_rule)) }) else null,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
autoCorrectEnabled = false,
|
||||
keyboardType = KeyboardType.Ascii,
|
||||
imeAction = ImeAction.Search,
|
||||
),
|
||||
keyboardActions = KeyboardActions(onSearch = { onDone() }),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
|
||||
/// What one site gave for the nickname: the account to tick, "no such player", or why it
|
||||
/// did not answer.
|
||||
@Composable
|
||||
private fun FoundRow(site: Site, r: AccountLookup, checked: Boolean, onToggle: (Boolean) -> Unit, onRetry: () -> Unit) {
|
||||
when (r) {
|
||||
is AccountLookup.Found -> {
|
||||
val a = r.account
|
||||
val lichess = a.games?.toLong()
|
||||
val detail = when {
|
||||
lichess != null -> {
|
||||
val upTo = pluralStringResource(R.plurals.games_up_to, lichess.coerceAtMost(Int.MAX_VALUE.toLong()).toInt(), groupDigits(lichess.toInt()))
|
||||
val secs = lichessSeconds(lichess)
|
||||
if (secs < 60) {
|
||||
stringResource(R.string.online_lichess_quick, upTo)
|
||||
} else {
|
||||
stringResource(R.string.online_lichess_found, upTo, ceil(secs / 60.0).toInt())
|
||||
}
|
||||
}
|
||||
a.months != null -> stringResource(R.string.online_chesscom_found, a.months!!.toInt())
|
||||
else -> ""
|
||||
}
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 64.dp)
|
||||
.toggleable(value = checked, role = Role.Checkbox, onValueChange = onToggle),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Checkbox(checked = checked, onCheckedChange = null)
|
||||
Column(Modifier.weight(1f).padding(start = 12.dp)) {
|
||||
Text("${siteName(site)} · ${a.username}", style = MaterialTheme.typography.bodyLarge)
|
||||
if (detail.isNotEmpty()) {
|
||||
Text(detail, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AccountLookup.NotFound -> Text(
|
||||
stringResource(R.string.online_not_found, siteName(site)),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.heightIn(min = 48.dp).padding(start = 36.dp, top = 12.dp),
|
||||
)
|
||||
is AccountLookup.Failed -> Column(Modifier.padding(start = 36.dp, top = 8.dp)) {
|
||||
Text(onlineProblemText(r.failure), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error)
|
||||
TextButton(onClick = onRetry, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_try_again)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A download started on this screen: its progress and Stop, then its result and Open.
|
||||
@Composable
|
||||
private fun DownloadCard(name: String, view: DownloadView, onStop: () -> Unit, onOpen: (() -> Unit)?) {
|
||||
val s = view.state
|
||||
Column(Modifier.fillMaxWidth()) {
|
||||
Text(name, style = MaterialTheme.typography.titleMedium, modifier = Modifier.semantics { heading() })
|
||||
Spacer(Modifier.height(4.dp))
|
||||
if (s.running) {
|
||||
// Not a live region: it changes a few times a second (TalkBack would not stop).
|
||||
Text(downloadProgressText(view), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
val share = downloadShare(view)
|
||||
if (share != null) {
|
||||
LinearProgressIndicator(progress = { share }, modifier = Modifier.fillMaxWidth())
|
||||
} else {
|
||||
LinearProgressIndicator(Modifier.fillMaxWidth())
|
||||
}
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Text(stringResource(R.string.online_leave), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
OutlinedButton(onClick = onStop, modifier = Modifier.padding(top = 8.dp)) { Text(stringResource(R.string.online_stop)) }
|
||||
}
|
||||
} else {
|
||||
Text(
|
||||
downloadResultText(view),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = if (s.failure != null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.semantics { liveRegion = LiveRegionMode.Polite },
|
||||
)
|
||||
if (onOpen != null) {
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
Button(onClick = onOpen, modifier = Modifier.padding(top = 8.dp)) { Text(stringResource(R.string.online_open)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<string name="sample_alekhine">Aljechin</string>
|
||||
|
||||
<string name="empty_title">Hier erscheinen Ihre Datenbanken</string>
|
||||
<string name="empty_text">Fügen Sie eine Datei oder einen Ordner mit Datenbanken hinzu: PGN, ChessBase, .zip- und .7z-Archive — vom Telefon oder aus der Cloud.</string>
|
||||
<string name="empty_text">Fügen Sie eine PGN-Datei, eine ChessBase-Datenbank oder ein .zip/.7z-Archiv hinzu – vom Telefon oder aus der Cloud – oder laden Sie Partien von Lichess und Chess.com.</string>
|
||||
<string name="add_database">Datenbank hinzufügen</string>
|
||||
<string name="open_samples">Beispielpartien öffnen</string>
|
||||
<string name="not_opened">noch nicht geöffnet · %1$s</string>
|
||||
|
|
@ -271,4 +271,61 @@
|
|||
<item quantity="one">%1$d Stellung, etwa %2$s</item>
|
||||
<item quantity="other">%1$d Stellungen, etwa %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Partien von Lichess und Chess.com</string>
|
||||
<string name="add_online_hint">Partien beliebiger Spieler per Nickname: eigene, eines Schülers, eines Gegners</string>
|
||||
<string name="online_intro">Die Partien des Spielers werden zu einer Datenbank auf dem Telefon – zum Suchen, Ansehen und Analysieren. Nur der Nickname ist nötig, keine Anmeldung.</string>
|
||||
<string name="online_nick">Nickname des Spielers</string>
|
||||
<string name="online_nick_hint">wie auf der Seite</string>
|
||||
<string name="online_other">Anderer Nickname auf Chess.com</string>
|
||||
<string name="online_other_nick">Nickname auf Chess.com</string>
|
||||
<string name="online_same_nick">Derselbe Nickname</string>
|
||||
<string name="online_nick_rule">Lateinische Buchstaben, Ziffern, _ und -, 2 bis 30 Zeichen</string>
|
||||
<string name="online_find">Suchen</string>
|
||||
<string name="online_searching">Suche auf den Seiten…</string>
|
||||
<string name="online_lichess_found">%1$s · beim ersten Mal etwa %2$d Min.</string>
|
||||
<string name="online_chesscom_found">Monate mit Partien: %1$d</string>
|
||||
<string name="online_not_found">%1$s: kein Spieler mit diesem Nickname – Schreibweise prüfen</string>
|
||||
<string name="online_merge">Beide Seiten in einer Datenbank zusammenführen</string>
|
||||
<string name="online_merge_hint">Sonst bekommt jede Seite eine eigene Datenbank</string>
|
||||
<string name="online_into_new">In die neue Datenbank „%1$s“</string>
|
||||
<string name="online_into_existing">In „%1$s“ (schon %2$s dort; nur neue Partien kommen dazu)</string>
|
||||
<string name="online_download">Herunterladen</string>
|
||||
<string name="online_progress_lichess">Lichess: %1$s von etwa %2$s · noch etwa %3$d Min.</string>
|
||||
<string name="online_progress_count">%1$s: %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com: Monat %1$d von %2$d · %3$s</string>
|
||||
<string name="online_stop">Anhalten</string>
|
||||
<string name="online_added">+%1$s, insgesamt %2$s</string>
|
||||
<string name="online_no_new">Keine neuen Partien, %1$s in der Datenbank</string>
|
||||
<string name="online_stopped">Angehalten, %1$s in der Datenbank</string>
|
||||
<string name="online_no_games">Dort gibt es keine Partien im Standardschach.</string>
|
||||
<string name="online_open">Datenbank öffnen</string>
|
||||
<string name="online_try_again">Erneut versuchen</string>
|
||||
<string name="online_err_network">%1$s antwortet nicht. Prüfen Sie die Internetverbindung und versuchen Sie es erneut.</string>
|
||||
<string name="online_err_rate">%1$s bittet um eine Pause: zu viele Anfragen hintereinander. Warten Sie eine Minute und versuchen Sie es erneut; Geladenes bleibt erhalten.</string>
|
||||
<string name="online_err_unexpected">%1$s hat unverständlich geantwortet: die Seite hat sich vielleicht geändert. Versuchen Sie es später oder aktualisieren Sie ChessPenguin.</string>
|
||||
<string name="online_err_disk">Die Datenbank konnte nicht geschrieben werden: auf dem Telefon ist kein Platz mehr.</string>
|
||||
<string name="online_err_busy">Diese Datenbank wird bereits geladen.</string>
|
||||
<string name="online_short_network">%1$s antwortet nicht</string>
|
||||
<string name="online_short_rate">%1$s bittet um eine Pause</string>
|
||||
<string name="online_short_failed">Der Download wurde unterbrochen</string>
|
||||
<string name="online_update">Neue Partien laden</string>
|
||||
<string name="online_stop_download">Download anhalten</string>
|
||||
<string name="online_downloading">Wird geladen · %1$s</string>
|
||||
<string name="online_updated">aktualisiert %1$s</string>
|
||||
<string name="online_unfinished">unvollständig</string>
|
||||
<string name="online_removed">Geladene Datenbank gelöscht</string>
|
||||
<string name="online_nick_lichess">Nickname auf Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · beim ersten Mal unter einer Minute</string>
|
||||
<string name="online_leave">Sie können diesen Bildschirm verlassen: die Datenbank ist in der Liste, der Download läuft weiter.</string>
|
||||
<string name="online_done">Fertig: %1$s</string>
|
||||
<string name="online_updated_now">gerade aktualisiert</string>
|
||||
<string name="online_snack_added">„%1$s“: +%2$s, insgesamt %3$s</string>
|
||||
<string name="online_snack_none">„%1$s“: keine neuen Partien</string>
|
||||
<string name="online_snack_failed">„%1$s“: %2$s</string>
|
||||
<string name="online_open_short">Öffnen</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">bis zu %1$s Partie</item>
|
||||
<item quantity="other">bis zu %1$s Partien</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<string name="sample_alekhine">Alekhine</string>
|
||||
|
||||
<string name="empty_title">Aquí aparecerán tus bases</string>
|
||||
<string name="empty_text">Añade un archivo o una carpeta de bases: PGN, ChessBase, archivos .zip y .7z — desde el teléfono o la nube.</string>
|
||||
<string name="empty_text">Añade un archivo PGN, una base ChessBase o un archivo .zip/.7z — desde el teléfono o la nube — o descarga partidas de Lichess y Chess.com.</string>
|
||||
<string name="add_database">Añadir base</string>
|
||||
<string name="open_samples">Abrir partidas de ejemplo</string>
|
||||
<string name="not_opened">aún sin abrir · %1$s</string>
|
||||
|
|
@ -276,4 +276,62 @@
|
|||
<item quantity="many">%1$d posiciones, unos %2$s</item>
|
||||
<item quantity="other">%1$d posiciones, unos %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Partidas de Lichess y Chess.com</string>
|
||||
<string name="add_online_hint">Partidas de cualquier jugador por apodo: las tuyas, de un alumno, de un rival</string>
|
||||
<string name="online_intro">Las partidas del jugador se convierten en una base en el teléfono, para buscar, ver y analizar. Solo hace falta el apodo, sin iniciar sesión.</string>
|
||||
<string name="online_nick">Apodo del jugador</string>
|
||||
<string name="online_nick_hint">como en el sitio</string>
|
||||
<string name="online_other">Otro apodo en Chess.com</string>
|
||||
<string name="online_other_nick">Apodo en Chess.com</string>
|
||||
<string name="online_same_nick">El mismo apodo</string>
|
||||
<string name="online_nick_rule">Letras latinas, dígitos, _ y -, de 2 a 30 caracteres</string>
|
||||
<string name="online_find">Buscar</string>
|
||||
<string name="online_searching">Buscando en los sitios…</string>
|
||||
<string name="online_lichess_found">%1$s · la primera vez unos %2$d min</string>
|
||||
<string name="online_chesscom_found">meses con partidas: %1$d</string>
|
||||
<string name="online_not_found">%1$s: no hay ningún jugador con este apodo; revisa cómo se escribe</string>
|
||||
<string name="online_merge">Unir ambos sitios en una sola base</string>
|
||||
<string name="online_merge_hint">Si no, cada sitio tendrá su propia base</string>
|
||||
<string name="online_into_new">En la nueva base «%1$s»</string>
|
||||
<string name="online_into_existing">En «%1$s» (ya hay %2$s; solo se añaden las nuevas)</string>
|
||||
<string name="online_download">Descargar</string>
|
||||
<string name="online_progress_lichess">Lichess: %1$s de unas %2$s · quedan unos %3$d min</string>
|
||||
<string name="online_progress_count">%1$s: %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com: mes %1$d de %2$d · %3$s</string>
|
||||
<string name="online_stop">Detener</string>
|
||||
<string name="online_added">+%1$s, %2$s en total</string>
|
||||
<string name="online_no_new">No hay partidas nuevas, %1$s en la base</string>
|
||||
<string name="online_stopped">Detenido, %1$s en la base</string>
|
||||
<string name="online_no_games">Allí no hay partidas de ajedrez estándar.</string>
|
||||
<string name="online_open">Abrir la base</string>
|
||||
<string name="online_try_again">Reintentar</string>
|
||||
<string name="online_err_network">%1$s no responde. Comprueba la conexión a internet e inténtalo de nuevo.</string>
|
||||
<string name="online_err_rate">%1$s pide una pausa: demasiadas solicitudes seguidas. Espera un minuto e inténtalo de nuevo; lo descargado se conserva.</string>
|
||||
<string name="online_err_unexpected">%1$s respondió de una forma que ChessPenguin no entiende: quizá el sitio cambió. Inténtalo más tarde o actualiza ChessPenguin.</string>
|
||||
<string name="online_err_disk">No se pudo escribir la base: el teléfono no tiene espacio.</string>
|
||||
<string name="online_err_busy">Esta base ya se está descargando.</string>
|
||||
<string name="online_short_network">%1$s no responde</string>
|
||||
<string name="online_short_rate">%1$s pide una pausa</string>
|
||||
<string name="online_short_failed">La descarga se interrumpió</string>
|
||||
<string name="online_update">Descargar partidas nuevas</string>
|
||||
<string name="online_stop_download">Detener la descarga</string>
|
||||
<string name="online_downloading">Descargando · %1$s</string>
|
||||
<string name="online_updated">actualizada %1$s</string>
|
||||
<string name="online_unfinished">incompleta</string>
|
||||
<string name="online_removed">Base descargada eliminada</string>
|
||||
<string name="online_nick_lichess">Apodo en Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · la primera vez menos de un minuto</string>
|
||||
<string name="online_leave">Puedes salir de esta pantalla: la base ya está en la lista y la descarga continúa.</string>
|
||||
<string name="online_done">Listo: %1$s</string>
|
||||
<string name="online_updated_now">actualizada ahora mismo</string>
|
||||
<string name="online_snack_added">«%1$s»: +%2$s, %3$s en total</string>
|
||||
<string name="online_snack_none">«%1$s»: no hay partidas nuevas</string>
|
||||
<string name="online_snack_failed">«%1$s»: %2$s</string>
|
||||
<string name="online_open_short">Abrir</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">hasta %1$s partida</item>
|
||||
<item quantity="many">hasta %1$s partidas</item>
|
||||
<item quantity="other">hasta %1$s partidas</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<string name="sample_alekhine">Alekhine</string>
|
||||
|
||||
<string name="empty_title">Vos bases apparaîtront ici</string>
|
||||
<string name="empty_text">Ajoutez un fichier ou un dossier de bases : PGN, ChessBase, archives .zip et .7z — depuis votre téléphone ou le cloud.</string>
|
||||
<string name="empty_text">Ajoutez un fichier PGN, une base ChessBase ou une archive .zip/.7z — depuis le téléphone ou le cloud — ou téléchargez des parties de Lichess et Chess.com.</string>
|
||||
<string name="add_database">Ajouter une base</string>
|
||||
<string name="open_samples">Ouvrir les parties d’exemple</string>
|
||||
<string name="not_opened">pas encore ouverte · %1$s</string>
|
||||
|
|
@ -276,4 +276,62 @@
|
|||
<item quantity="many">%1$d positions, environ %2$s</item>
|
||||
<item quantity="other">%1$d positions, environ %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Parties de Lichess et Chess.com</string>
|
||||
<string name="add_online_hint">Les parties de n\'importe quel joueur par pseudo : les vôtres, d\'un élève, d\'un adversaire</string>
|
||||
<string name="online_intro">Les parties du joueur deviennent une base sur le téléphone, à chercher, voir et analyser. Seul le pseudo est nécessaire, sans connexion.</string>
|
||||
<string name="online_nick">Pseudo du joueur</string>
|
||||
<string name="online_nick_hint">comme sur le site</string>
|
||||
<string name="online_other">Un autre pseudo sur Chess.com</string>
|
||||
<string name="online_other_nick">Pseudo sur Chess.com</string>
|
||||
<string name="online_same_nick">Le même pseudo</string>
|
||||
<string name="online_nick_rule">Lettres latines, chiffres, _ et -, de 2 à 30 caractères</string>
|
||||
<string name="online_find">Rechercher</string>
|
||||
<string name="online_searching">Recherche sur les sites…</string>
|
||||
<string name="online_lichess_found">%1$s · environ %2$d min la première fois</string>
|
||||
<string name="online_chesscom_found">mois avec des parties : %1$d</string>
|
||||
<string name="online_not_found">%1$s : aucun joueur avec ce pseudo — vérifiez l\'orthographe</string>
|
||||
<string name="online_merge">Réunir les deux sites dans une seule base</string>
|
||||
<string name="online_merge_hint">Sinon chaque site a sa propre base</string>
|
||||
<string name="online_into_new">Dans la nouvelle base « %1$s »</string>
|
||||
<string name="online_into_existing">Dans « %1$s » (déjà %2$s ; seules les nouvelles parties sont ajoutées)</string>
|
||||
<string name="online_download">Télécharger</string>
|
||||
<string name="online_progress_lichess">Lichess : %1$s sur environ %2$s · encore environ %3$d min</string>
|
||||
<string name="online_progress_count">%1$s : %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com : mois %1$d sur %2$d · %3$s</string>
|
||||
<string name="online_stop">Arrêter</string>
|
||||
<string name="online_added">+%1$s, %2$s en tout</string>
|
||||
<string name="online_no_new">Pas de nouvelles parties, %1$s dans la base</string>
|
||||
<string name="online_stopped">Arrêté, %1$s dans la base</string>
|
||||
<string name="online_no_games">Aucune partie d\'échecs standard là-bas.</string>
|
||||
<string name="online_open">Ouvrir la base</string>
|
||||
<string name="online_try_again">Réessayer</string>
|
||||
<string name="online_err_network">%1$s ne répond pas. Vérifiez la connexion Internet et réessayez.</string>
|
||||
<string name="online_err_rate">%1$s demande une pause : trop de requêtes d\'affilée. Attendez une minute et réessayez ; ce qui est téléchargé est conservé.</string>
|
||||
<string name="online_err_unexpected">%1$s a répondu d\'une façon que ChessPenguin ne comprend pas : le site a peut-être changé. Réessayez plus tard ou mettez ChessPenguin à jour.</string>
|
||||
<string name="online_err_disk">Impossible d\'écrire la base : le téléphone n\'a plus de place.</string>
|
||||
<string name="online_err_busy">Cette base est déjà en cours de téléchargement.</string>
|
||||
<string name="online_short_network">%1$s ne répond pas</string>
|
||||
<string name="online_short_rate">%1$s demande une pause</string>
|
||||
<string name="online_short_failed">Le téléchargement s\'est interrompu</string>
|
||||
<string name="online_update">Télécharger les nouvelles parties</string>
|
||||
<string name="online_stop_download">Arrêter le téléchargement</string>
|
||||
<string name="online_downloading">Téléchargement · %1$s</string>
|
||||
<string name="online_updated">mise à jour %1$s</string>
|
||||
<string name="online_unfinished">incomplète</string>
|
||||
<string name="online_removed">Base téléchargée supprimée</string>
|
||||
<string name="online_nick_lichess">Pseudo sur Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · moins d\'une minute la première fois</string>
|
||||
<string name="online_leave">Vous pouvez quitter cet écran : la base est dans la liste et le téléchargement continue.</string>
|
||||
<string name="online_done">Terminé : %1$s</string>
|
||||
<string name="online_updated_now">mise à jour à l\'instant</string>
|
||||
<string name="online_snack_added">« %1$s » : +%2$s, %3$s en tout</string>
|
||||
<string name="online_snack_none">« %1$s » : pas de nouvelles parties</string>
|
||||
<string name="online_snack_failed">« %1$s » : %2$s</string>
|
||||
<string name="online_open_short">Ouvrir</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">jusqu\'à %1$s partie</item>
|
||||
<item quantity="many">jusqu\'à %1$s parties</item>
|
||||
<item quantity="other">jusqu\'à %1$s parties</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<string name="sample_alekhine">Alekhine</string>
|
||||
|
||||
<string name="empty_title">Qui compariranno i tuoi database</string>
|
||||
<string name="empty_text">Aggiungi un file o una cartella di database: PGN, ChessBase, archivi .zip e .7z — dal telefono o dal cloud.</string>
|
||||
<string name="empty_text">Aggiungi un file PGN, un database ChessBase o un archivio .zip/.7z — dal telefono o dal cloud — oppure scarica partite da Lichess e Chess.com.</string>
|
||||
<string name="add_database">Aggiungi database</string>
|
||||
<string name="open_samples">Apri le partite di esempio</string>
|
||||
<string name="not_opened">non ancora aperto · %1$s</string>
|
||||
|
|
@ -276,4 +276,62 @@
|
|||
<item quantity="many">%1$d posizioni, circa %2$s</item>
|
||||
<item quantity="other">%1$d posizioni, circa %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Partite da Lichess e Chess.com</string>
|
||||
<string name="add_online_hint">Partite di qualsiasi giocatore per nickname: le tue, di un allievo, di un avversario</string>
|
||||
<string name="online_intro">Le partite del giocatore diventano una base sul telefono, da cercare, vedere e analizzare. Serve solo il nickname, senza accesso.</string>
|
||||
<string name="online_nick">Nickname del giocatore</string>
|
||||
<string name="online_nick_hint">come sul sito</string>
|
||||
<string name="online_other">Un altro nickname su Chess.com</string>
|
||||
<string name="online_other_nick">Nickname su Chess.com</string>
|
||||
<string name="online_same_nick">Lo stesso nickname</string>
|
||||
<string name="online_nick_rule">Lettere latine, cifre, _ e -, da 2 a 30 caratteri</string>
|
||||
<string name="online_find">Cerca</string>
|
||||
<string name="online_searching">Cerco sui siti…</string>
|
||||
<string name="online_lichess_found">%1$s · la prima volta circa %2$d min</string>
|
||||
<string name="online_chesscom_found">mesi con partite: %1$d</string>
|
||||
<string name="online_not_found">%1$s: nessun giocatore con questo nickname — controlla come è scritto</string>
|
||||
<string name="online_merge">Unire entrambi i siti in una sola base</string>
|
||||
<string name="online_merge_hint">Altrimenti ogni sito avrà la sua base</string>
|
||||
<string name="online_into_new">Nella nuova base «%1$s»</string>
|
||||
<string name="online_into_existing">In «%1$s» (già %2$s; si aggiungono solo le nuove)</string>
|
||||
<string name="online_download">Scarica</string>
|
||||
<string name="online_progress_lichess">Lichess: %1$s di circa %2$s · mancano circa %3$d min</string>
|
||||
<string name="online_progress_count">%1$s: %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com: mese %1$d di %2$d · %3$s</string>
|
||||
<string name="online_stop">Ferma</string>
|
||||
<string name="online_added">+%1$s, %2$s in tutto</string>
|
||||
<string name="online_no_new">Nessuna partita nuova, %1$s nella base</string>
|
||||
<string name="online_stopped">Fermato, %1$s nella base</string>
|
||||
<string name="online_no_games">Lì non ci sono partite di scacchi standard.</string>
|
||||
<string name="online_open">Apri la base</string>
|
||||
<string name="online_try_again">Riprova</string>
|
||||
<string name="online_err_network">%1$s non risponde. Controlla la connessione a internet e riprova.</string>
|
||||
<string name="online_err_rate">%1$s chiede una pausa: troppe richieste di fila. Aspetta un minuto e riprova; il già scaricato resta.</string>
|
||||
<string name="online_err_unexpected">%1$s ha risposto in un modo che ChessPenguin non capisce: forse il sito è cambiato. Riprova più tardi o aggiorna ChessPenguin.</string>
|
||||
<string name="online_err_disk">Impossibile scrivere la base: il telefono non ha spazio.</string>
|
||||
<string name="online_err_busy">Questa base è già in download.</string>
|
||||
<string name="online_short_network">%1$s non risponde</string>
|
||||
<string name="online_short_rate">%1$s chiede una pausa</string>
|
||||
<string name="online_short_failed">Il download si è interrotto</string>
|
||||
<string name="online_update">Scarica le partite nuove</string>
|
||||
<string name="online_stop_download">Ferma il download</string>
|
||||
<string name="online_downloading">Download in corso · %1$s</string>
|
||||
<string name="online_updated">aggiornata %1$s</string>
|
||||
<string name="online_unfinished">incompleta</string>
|
||||
<string name="online_removed">Base scaricata eliminata</string>
|
||||
<string name="online_nick_lichess">Nickname su Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · la prima volta meno di un minuto</string>
|
||||
<string name="online_leave">Puoi uscire da questa schermata: la base è già nell\'elenco e il download continua.</string>
|
||||
<string name="online_done">Fatto: %1$s</string>
|
||||
<string name="online_updated_now">aggiornata adesso</string>
|
||||
<string name="online_snack_added">«%1$s»: +%2$s, %3$s in tutto</string>
|
||||
<string name="online_snack_none">«%1$s»: nessuna partita nuova</string>
|
||||
<string name="online_snack_failed">«%1$s»: %2$s</string>
|
||||
<string name="online_open_short">Apri</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">fino a %1$s partita</item>
|
||||
<item quantity="many">fino a %1$s partite</item>
|
||||
<item quantity="other">fino a %1$s partite</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<string name="sample_alekhine">Алехин</string>
|
||||
|
||||
<string name="empty_title">Здесь будут ваши базы</string>
|
||||
<string name="empty_text">Добавьте файл или папку с базами: PGN, ChessBase, архивы .zip и .7z — с телефона или из облака.</string>
|
||||
<string name="empty_text">Добавьте файл PGN, базу ChessBase или архив .zip/.7z — с телефона или из облака — или скачайте партии с Lichess и Chess.com.</string>
|
||||
<string name="add_database">Добавить базу</string>
|
||||
<string name="open_samples">Открыть примеры партий</string>
|
||||
<string name="not_opened">ещё не открывалась · %1$s</string>
|
||||
|
|
@ -281,4 +281,63 @@
|
|||
<item quantity="many">Позиций: %1$d, примерно %2$s</item>
|
||||
<item quantity="other">Позиций: %1$d, примерно %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Партии с Lichess и Chess.com</string>
|
||||
<string name="add_online_hint">Партии любого игрока по нику: свои, ученика, соперника</string>
|
||||
<string name="online_intro">Партии игрока станут базой на телефоне — искать, смотреть, анализировать. Нужен только ник, входить на сайт не нужно.</string>
|
||||
<string name="online_nick">Ник игрока</string>
|
||||
<string name="online_nick_hint">как на сайте</string>
|
||||
<string name="online_other">На Chess.com другой ник</string>
|
||||
<string name="online_other_nick">Ник на Chess.com</string>
|
||||
<string name="online_same_nick">Тот же ник</string>
|
||||
<string name="online_nick_rule">Латиница, цифры, _ и -, от 2 до 30 символов</string>
|
||||
<string name="online_find">Найти</string>
|
||||
<string name="online_searching">Ищу на сайтах…</string>
|
||||
<string name="online_lichess_found">%1$s · первый раз около %2$d мин</string>
|
||||
<string name="online_chesscom_found">месяцев с партиями: %1$d</string>
|
||||
<string name="online_not_found">%1$s: игрока с таким ником нет — проверьте написание</string>
|
||||
<string name="online_merge">Объединить оба сайта в одну базу</string>
|
||||
<string name="online_merge_hint">Иначе у каждого сайта будет своя база</string>
|
||||
<string name="online_into_new">В новую базу «%1$s»</string>
|
||||
<string name="online_into_existing">В базу «%1$s» (там уже %2$s; добавятся только новые)</string>
|
||||
<string name="online_download">Скачать</string>
|
||||
<string name="online_progress_lichess">Lichess: %1$s из примерно %2$s · осталось около %3$d мин</string>
|
||||
<string name="online_progress_count">%1$s: %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com: месяц %1$d из %2$d · %3$s</string>
|
||||
<string name="online_stop">Остановить</string>
|
||||
<string name="online_added">+%1$s, всего %2$s</string>
|
||||
<string name="online_no_new">Новых партий нет, в базе %1$s</string>
|
||||
<string name="online_stopped">Остановлено, в базе %1$s</string>
|
||||
<string name="online_no_games">Партий в обычные шахматы там нет.</string>
|
||||
<string name="online_open">Открыть базу</string>
|
||||
<string name="online_try_again">Попробовать ещё раз</string>
|
||||
<string name="online_err_network">%1$s не отвечает. Проверьте подключение к интернету и попробуйте ещё раз.</string>
|
||||
<string name="online_err_rate">%1$s просит сделать паузу: слишком много запросов подряд. Подождите минуту и попробуйте снова — скачанное сохранится.</string>
|
||||
<string name="online_err_unexpected">%1$s ответил непонятно — возможно, сайт что-то поменял. Попробуйте позже или обновите ChessPenguin.</string>
|
||||
<string name="online_err_disk">Не удалось записать базу: на телефоне не хватает места.</string>
|
||||
<string name="online_err_busy">Эта база уже скачивается.</string>
|
||||
<string name="online_short_network">%1$s не отвечает</string>
|
||||
<string name="online_short_rate">%1$s просит паузу</string>
|
||||
<string name="online_short_failed">Скачивание прервалось</string>
|
||||
<string name="online_update">Скачать новые партии</string>
|
||||
<string name="online_stop_download">Остановить скачивание</string>
|
||||
<string name="online_downloading">Скачивается · %1$s</string>
|
||||
<string name="online_updated">обновлено %1$s</string>
|
||||
<string name="online_unfinished">не докачана</string>
|
||||
<string name="online_removed">Скачанная база удалена</string>
|
||||
<string name="online_nick_lichess">Ник на Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · первый раз меньше минуты</string>
|
||||
<string name="online_leave">Можно уйти с этого экрана: база уже в списке, скачивание продолжится.</string>
|
||||
<string name="online_done">Готово: %1$s</string>
|
||||
<string name="online_updated_now">обновлено только что</string>
|
||||
<string name="online_snack_added">«%1$s»: +%2$s, всего %3$s</string>
|
||||
<string name="online_snack_none">«%1$s»: новых партий нет</string>
|
||||
<string name="online_snack_failed">«%1$s»: %2$s</string>
|
||||
<string name="online_open_short">Открыть</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">до %1$s партии</item>
|
||||
<item quantity="few">до %1$s партий</item>
|
||||
<item quantity="many">до %1$s партий</item>
|
||||
<item quantity="other">до %1$s партии</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<string name="sample_alekhine">Alekhine</string>
|
||||
|
||||
<string name="empty_title">Your databases will appear here</string>
|
||||
<string name="empty_text">Add a file or a folder of databases: PGN, ChessBase, .zip and .7z archives — from your phone or the cloud.</string>
|
||||
<string name="empty_text">Add a PGN file, a ChessBase database or a .zip/.7z archive — from your phone or the cloud — or download games from Lichess and Chess.com.</string>
|
||||
<string name="add_database">Add database</string>
|
||||
<string name="open_samples">Open sample games</string>
|
||||
<string name="not_opened">not opened yet · %1$s</string>
|
||||
|
|
@ -274,4 +274,61 @@
|
|||
<item quantity="one">%1$d position, about %2$s</item>
|
||||
<item quantity="other">%1$d positions, about %2$s</item>
|
||||
</plurals>
|
||||
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
|
||||
<string name="online_title">Games from Lichess and Chess.com</string>
|
||||
<string name="add_online_hint">Any player\'s games by nickname: yours, a pupil\'s, an opponent\'s</string>
|
||||
<string name="online_intro">The player\'s games become a database on your phone, to search, view and analyse. Only the nickname is needed, no login.</string>
|
||||
<string name="online_nick">Player\'s nickname</string>
|
||||
<string name="online_nick_hint">as on the site</string>
|
||||
<string name="online_other">A different nickname on Chess.com</string>
|
||||
<string name="online_other_nick">Nickname on Chess.com</string>
|
||||
<string name="online_same_nick">The same nickname</string>
|
||||
<string name="online_nick_rule">Latin letters, digits, _ and -, 2 to 30 characters</string>
|
||||
<string name="online_find">Find</string>
|
||||
<string name="online_searching">Looking on the sites…</string>
|
||||
<string name="online_lichess_found">%1$s · about %2$d min the first time</string>
|
||||
<string name="online_chesscom_found">months with games: %1$d</string>
|
||||
<string name="online_not_found">%1$s: no player with this nickname — check the spelling</string>
|
||||
<string name="online_merge">Merge both sites into one database</string>
|
||||
<string name="online_merge_hint">Otherwise each site gets a database of its own</string>
|
||||
<string name="online_into_new">Into the new database “%1$s”</string>
|
||||
<string name="online_into_existing">Into “%1$s” (%2$s there already; only new games are added)</string>
|
||||
<string name="online_download">Download</string>
|
||||
<string name="online_progress_lichess">Lichess: %1$s of about %2$s · about %3$d min left</string>
|
||||
<string name="online_progress_count">%1$s: %2$s</string>
|
||||
<string name="online_progress_chesscom">Chess.com: month %1$d of %2$d · %3$s</string>
|
||||
<string name="online_stop">Stop</string>
|
||||
<string name="online_added">+%1$s, %2$s in all</string>
|
||||
<string name="online_no_new">No new games, %1$s in the database</string>
|
||||
<string name="online_stopped">Stopped, %1$s in the database</string>
|
||||
<string name="online_no_games">No games of standard chess there.</string>
|
||||
<string name="online_open">Open the database</string>
|
||||
<string name="online_try_again">Try again</string>
|
||||
<string name="online_err_network">%1$s does not answer. Check the internet connection and try again.</string>
|
||||
<string name="online_err_rate">%1$s asks for a pause: too many requests in a row. Wait a minute and try again; what is downloaded is kept.</string>
|
||||
<string name="online_err_unexpected">%1$s answered in a way ChessPenguin does not understand: the site may have changed. Try later or update ChessPenguin.</string>
|
||||
<string name="online_err_disk">Could not write the database: the phone is out of space.</string>
|
||||
<string name="online_err_busy">This database is being downloaded already.</string>
|
||||
<string name="online_short_network">%1$s does not answer</string>
|
||||
<string name="online_short_rate">%1$s asks for a pause</string>
|
||||
<string name="online_short_failed">The download stopped</string>
|
||||
<string name="online_update">Download new games</string>
|
||||
<string name="online_stop_download">Stop the download</string>
|
||||
<string name="online_downloading">Downloading · %1$s</string>
|
||||
<string name="online_updated">updated %1$s</string>
|
||||
<string name="online_unfinished">not finished</string>
|
||||
<string name="online_removed">Downloaded database deleted</string>
|
||||
<string name="online_nick_lichess">Nickname on Lichess</string>
|
||||
<string name="online_lichess_quick">%1$s · under a minute the first time</string>
|
||||
<string name="online_leave">You can leave this screen: the database is on the list and the download goes on.</string>
|
||||
<string name="online_done">Done: %1$s</string>
|
||||
<string name="online_updated_now">updated just now</string>
|
||||
<string name="online_snack_added">“%1$s”: +%2$s, %3$s in all</string>
|
||||
<string name="online_snack_none">“%1$s”: no new games</string>
|
||||
<string name="online_snack_failed">“%1$s”: %2$s</string>
|
||||
<string name="online_open_short">Open</string>
|
||||
<plurals name="games_up_to">
|
||||
<item quantity="one">up to %1$s game</item>
|
||||
<item quantity="other">up to %1$s games</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue