mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed02f6a92b | ||
|
|
a8918c7a01 | ||
|
|
f211bbb5a8 | ||
|
|
36c807fbce | ||
|
|
5306b2ba03 | ||
|
|
a335cac006 | ||
|
|
2151db3883 | ||
|
|
823f70320f | ||
|
|
bf7f7ecda7 | ||
|
|
3b8b14b06c | ||
|
|
a305a91c66 | ||
|
|
3e558ab33e | ||
|
|
d5b9cf5b41 | ||
|
|
2478c44948 | ||
|
|
6400a9ef09 | ||
|
|
c78adda7ca | ||
|
|
43b17483fb | ||
|
|
84c877813f | ||
|
|
f43cc43d05 | ||
|
|
101139ec99 | ||
|
|
527cb85867 | ||
|
|
6ef8e2274e | ||
|
|
00525cde15 | ||
|
|
210c127446 | ||
|
|
234e40157e | ||
|
|
c3809c0a75 | ||
|
|
71b7b6efad | ||
|
|
a0e7c1715a | ||
|
|
2c2d55058e | ||
|
|
7f61e514e6 | ||
|
|
b891019b87 | ||
|
|
1a29c65d4f | ||
|
|
ff5e4c7ac7 | ||
|
|
2d38f11b36 | ||
|
|
fd2e1652ad | ||
|
|
c6b6e7362e | ||
|
|
cb7edbefd2 | ||
|
|
a9b5994a91 | ||
|
|
42f25c2a6c | ||
|
|
501debc7f6 | ||
|
|
1f70d43fe2 | ||
|
|
a8d03d687f |
No files matched your search
@@ -29,11 +29,14 @@ jobs:
|
||||
persist-credentials: false
|
||||
- name: Build in Arch Linux ARM
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
FEX_EXTRA_CXXFLAGS: ${{ inputs.cxxflags }}
|
||||
FEX_THUNKS: ${{ inputs.thunks == 'true' && '1' || '0' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm -e FEX_EXTRA_CXXFLAGS="$FEX_EXTRA_CXXFLAGS" -e FEX_THUNKS="$FEX_THUNKS" -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/fex/build-in-arch.sh
|
||||
FEX_VERSION=$(gh api repos/FEX-Emu/FEX/releases/latest --jq .tag_name)
|
||||
echo "Building $FEX_VERSION, FEX's latest release"
|
||||
docker run --rm -e FEX_VERSION="$FEX_VERSION" -e FEX_EXTRA_CXXFLAGS="$FEX_EXTRA_CXXFLAGS" -e FEX_THUNKS="$FEX_THUNKS" -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/fex/build-in-arch.sh
|
||||
sudo chown -R "$(id -u):$(id -g)" .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
@@ -70,7 +70,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
|
||||
- Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
|
||||
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source.
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
|
||||
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
|
||||
@@ -15,6 +15,7 @@ private fun Launcher(tab: String, games: List<com.droiddeck.launcher.frontend.Li
|
||||
PreviewHost { FrontEndScreen(sampleState(games = games, navigate = tab, ready = ready), sampleActions) }
|
||||
|
||||
@DroidDeckPreviews @Composable private fun SteamTabPreview() = Launcher("steam")
|
||||
@DroidDeckPreviews @Composable private fun SteamEmptyPreview() = Launcher("steam", games = emptyList())
|
||||
@DroidDeckPreviews @Composable private fun LibraryPreview() = Launcher("games")
|
||||
@DroidDeckPreviews @Composable private fun LibraryEmptyPreview() = Launcher("games", games = emptyList())
|
||||
@DroidDeckPreviews @Composable private fun StoresPreview() = Launcher("stores")
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
android:exported="false"
|
||||
android:screenOrientation="user"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define SYS_munmap 215
|
||||
#define SYS_mmap 222
|
||||
#define SYS_mprotect 226
|
||||
#define SYS_getpid 172
|
||||
|
||||
#define AT_FDCWD_ (-100)
|
||||
#define O_RDONLY_ 0
|
||||
@@ -52,6 +53,21 @@ static size_t slen(const char *s) {
|
||||
return n;
|
||||
}
|
||||
|
||||
static int seq(const char *a, const char *b) {
|
||||
while (*a && *a == *b) a++, b++;
|
||||
return *a == *b;
|
||||
}
|
||||
|
||||
static const char *env_get(char **envp, const char *name) {
|
||||
size_t n = slen(name);
|
||||
for (; *envp; envp++) {
|
||||
size_t i = 0;
|
||||
while (i < n && (*envp)[i] == name[i]) i++;
|
||||
if (i == n && (*envp)[n] == '=') return *envp + n + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void out(const char *s) { sys6(SYS_write, 2, (long)s, (long)slen(s), 0, 0, 0); }
|
||||
|
||||
static void out_num(long v) {
|
||||
@@ -112,19 +128,43 @@ static int prot_of(uint32_t flags) {
|
||||
|
||||
static void map_failed(const char *path, long r) { die("cannot map a segment", path, r); }
|
||||
|
||||
static void load(const char *path, struct image *im, uintptr_t page) {
|
||||
static void read_interp(int fd, const Elf64_Phdr *ph, int phnum, char *interp, size_t size, const char *path) {
|
||||
interp[0] = 0;
|
||||
for (int i = 0; i < phnum; i++) {
|
||||
if (ph[i].p_type != PT_INTERP) continue;
|
||||
if (ph[i].p_filesz == 0 || ph[i].p_filesz >= size) die("bad PT_INTERP", path, 0);
|
||||
if (xpread(fd, interp, ph[i].p_filesz, (long)ph[i].p_offset) != (long)ph[i].p_filesz)
|
||||
die("truncated PT_INTERP", path, 0);
|
||||
interp[ph[i].p_filesz] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int read_headers(const char *path, Elf64_Ehdr *eh, Elf64_Phdr *ph) {
|
||||
int fd = (int)sys6(SYS_openat, AT_FDCWD_, (long)path, O_RDONLY_ | O_CLOEXEC_, 0, 0, 0);
|
||||
if (fd < 0) die("cannot open", path, fd);
|
||||
Elf64_Ehdr eh;
|
||||
if (xpread(fd, &eh, sizeof(eh), 0) != (long)sizeof(eh)) die("not an ELF file", path, 0);
|
||||
if (eh.e_ident[EI_MAG0] != ELFMAG0 || eh.e_ident[EI_MAG1] != ELFMAG1 || eh.e_ident[EI_MAG2] != ELFMAG2 ||
|
||||
eh.e_ident[EI_MAG3] != ELFMAG3 || eh.e_ident[EI_CLASS] != ELFCLASS64 || eh.e_machine != EM_AARCH64 ||
|
||||
(eh.e_type != ET_EXEC && eh.e_type != ET_DYN) || eh.e_phentsize != sizeof(Elf64_Phdr) ||
|
||||
eh.e_phnum == 0 || eh.e_phnum > MAX_PHDRS)
|
||||
if (xpread(fd, eh, sizeof(*eh), 0) != (long)sizeof(*eh)) die("not an ELF file", path, 0);
|
||||
if (eh->e_ident[EI_MAG0] != ELFMAG0 || eh->e_ident[EI_MAG1] != ELFMAG1 || eh->e_ident[EI_MAG2] != ELFMAG2 ||
|
||||
eh->e_ident[EI_MAG3] != ELFMAG3 || eh->e_ident[EI_CLASS] != ELFCLASS64 || eh->e_machine != EM_AARCH64 ||
|
||||
(eh->e_type != ET_EXEC && eh->e_type != ET_DYN) || eh->e_phentsize != sizeof(Elf64_Phdr) ||
|
||||
eh->e_phnum == 0 || eh->e_phnum > MAX_PHDRS)
|
||||
die("not a 64-bit ARM ELF program", path, 0);
|
||||
long size = (long)eh->e_phnum * (long)sizeof(Elf64_Phdr);
|
||||
if (xpread(fd, ph, (size_t)size, (long)eh->e_phoff) != size) die("truncated program headers", path, 0);
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void interp_of(const char *path, char *interp, size_t size) {
|
||||
Elf64_Ehdr eh;
|
||||
Elf64_Phdr ph[MAX_PHDRS];
|
||||
long size = (long)eh.e_phnum * (long)sizeof(Elf64_Phdr);
|
||||
if (xpread(fd, ph, (size_t)size, (long)eh.e_phoff) != size) die("truncated program headers", path, 0);
|
||||
int fd = read_headers(path, &eh, ph);
|
||||
read_interp(fd, ph, eh.e_phnum, interp, size, path);
|
||||
sys6(SYS_close, fd, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void load(const char *path, struct image *im, uintptr_t page) {
|
||||
Elf64_Ehdr eh;
|
||||
Elf64_Phdr ph[MAX_PHDRS];
|
||||
int fd = read_headers(path, &eh, ph);
|
||||
|
||||
uintptr_t lo = UINTPTR_MAX, hi = 0;
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
@@ -173,16 +213,9 @@ static void load(const char *path, struct image *im, uintptr_t page) {
|
||||
im->phnum = eh.e_phnum;
|
||||
im->phent = eh.e_phentsize;
|
||||
im->phdr = 0;
|
||||
im->interp[0] = 0;
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
read_interp(fd, ph, eh.e_phnum, im->interp, sizeof(im->interp), path);
|
||||
for (int i = 0; i < eh.e_phnum; i++)
|
||||
if (ph[i].p_type == PT_PHDR) im->phdr = bias + ph[i].p_vaddr;
|
||||
if (ph[i].p_type == PT_INTERP) {
|
||||
if (ph[i].p_filesz == 0 || ph[i].p_filesz >= sizeof(im->interp)) die("bad PT_INTERP", path, 0);
|
||||
if (xpread(fd, im->interp, ph[i].p_filesz, (long)ph[i].p_offset) != (long)ph[i].p_filesz)
|
||||
die("truncated PT_INTERP", path, 0);
|
||||
im->interp[ph[i].p_filesz] = 0;
|
||||
}
|
||||
}
|
||||
if (!im->phdr) {
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
Elf64_Phdr *p = &ph[i];
|
||||
@@ -202,6 +235,36 @@ static unsigned long auxv_get(const uintptr_t *auxv, unsigned long type, unsigne
|
||||
return fallback;
|
||||
}
|
||||
|
||||
static int is_self_exe(const char *execfn) {
|
||||
if (!execfn) return 0;
|
||||
if (seq(execfn, "/proc/self/exe") || seq(execfn, "/proc/thread-self/exe")) return 1;
|
||||
const char *p = "/proc/";
|
||||
while (*p && *p == *execfn) p++, execfn++;
|
||||
if (*p) return 0;
|
||||
char num[24];
|
||||
int i = (int)sizeof(num) - 1;
|
||||
num[i] = 0;
|
||||
unsigned long pid = (unsigned long)sys6(SYS_getpid, 0, 0, 0, 0, 0, 0);
|
||||
do {
|
||||
num[--i] = (char)('0' + pid % 10);
|
||||
pid /= 10;
|
||||
} while (pid && i > 0);
|
||||
const char *d = num + i;
|
||||
while (*d && *d == *execfn) d++, execfn++;
|
||||
return !*d && seq(execfn, "/exe");
|
||||
}
|
||||
|
||||
static const char *guest_interp(char **envp, const char *interp, char *buf, size_t size) {
|
||||
const char *root = env_get(envp, "DDNATV_ROOT");
|
||||
if (!root || interp[0] != '/') return interp;
|
||||
size_t a = slen(root), b = slen(interp);
|
||||
if (a + b + 1 > size) return interp;
|
||||
for (size_t i = 0; i < a; i++) buf[i] = root[i];
|
||||
for (size_t i = 0; i <= b; i++) buf[a + i] = interp[i];
|
||||
if (sys6(SYS_faccessat, AT_FDCWD_, (long)buf, 0, 0, 0, 0) != 0) return interp;
|
||||
return buf;
|
||||
}
|
||||
|
||||
__attribute__((used, noreturn)) void ddexec_main(uintptr_t *sp) {
|
||||
long argc = (long)sp[0];
|
||||
char **argv = (char **)(sp + 1);
|
||||
@@ -211,25 +274,66 @@ __attribute__((used, noreturn)) void ddexec_main(uintptr_t *sp) {
|
||||
uintptr_t *auxv = (uintptr_t *)(envp + nenv + 1);
|
||||
long naux = 0;
|
||||
while (auxv[naux * 2] != AT_NULL) naux++;
|
||||
if (argc < 3) die("usage: libddexec.so <file> <argv0> [args...]", 0, 0);
|
||||
int reexec = is_self_exe((const char *)auxv_get(auxv, AT_EXECFN, 0));
|
||||
const char *path;
|
||||
char **args = argv + 2;
|
||||
long nargs = argc - 2;
|
||||
char interp_buf[4096];
|
||||
char hook_buf[4096];
|
||||
if (reexec) {
|
||||
path = env_get(envp, "DDNATV_REAL_EXE");
|
||||
if (!path || !path[0]) die("re-executed without DDNATV_REAL_EXE", 0, 0);
|
||||
args = argv;
|
||||
nargs = argc;
|
||||
const char *lib_path = env_get(envp, "DDNATV_LIBRARY_PATH");
|
||||
char prog_interp[256];
|
||||
interp_of(path, prog_interp, sizeof(prog_interp));
|
||||
if (prog_interp[0] && lib_path && lib_path[0]) {
|
||||
const char *ld_so = guest_interp(envp, prog_interp, interp_buf, sizeof(interp_buf));
|
||||
const char *hook = guest_interp(envp, "/usr/lib/libddnatv-hook.so", hook_buf, sizeof(hook_buf));
|
||||
if (hook != (const char *)hook_buf) hook = guest_interp(envp, "/lib/libddnatv-hook.so", hook_buf, sizeof(hook_buf));
|
||||
long n = argc > 1 ? argc - 1 : 0;
|
||||
char **v = (char **)__builtin_alloca((size_t)(n + 9) * sizeof(char *));
|
||||
long k = 0;
|
||||
v[k++] = (char *)ld_so;
|
||||
if (hook == (const char *)hook_buf) {
|
||||
v[k++] = (char *)"--preload";
|
||||
v[k++] = (char *)hook;
|
||||
}
|
||||
v[k++] = (char *)"--library-path";
|
||||
v[k++] = (char *)lib_path;
|
||||
v[k++] = (char *)"--argv0";
|
||||
v[k++] = argc > 0 ? argv[0] : (char *)path;
|
||||
v[k++] = (char *)path;
|
||||
for (long i = 0; i < n; i++) v[k++] = argv[1 + i];
|
||||
v[k] = 0;
|
||||
args = v;
|
||||
nargs = k;
|
||||
path = ld_so;
|
||||
}
|
||||
} else if (argc < 3) {
|
||||
die("usage: libddexec.so <file> <argv0> [args...]", 0, 0);
|
||||
} else {
|
||||
path = argv[1];
|
||||
}
|
||||
|
||||
uintptr_t page = auxv_get(auxv, AT_PAGESZ, 4096);
|
||||
const char *path = argv[1];
|
||||
struct image prog, interp;
|
||||
load(path, &prog, page);
|
||||
int has_interp = prog.interp[0] != 0;
|
||||
if (has_interp) load(prog.interp, &interp, page);
|
||||
if (has_interp) load(reexec ? guest_interp(envp, prog.interp, interp_buf, sizeof(interp_buf)) : prog.interp, &interp, page);
|
||||
|
||||
// The new stack: argc, argv, envp and auxv as the kernel lays them out, below the current one.
|
||||
// The strings stay where the kernel put them.
|
||||
static const unsigned long replaced[] = {AT_PHDR, AT_PHENT, AT_PHNUM, AT_BASE, AT_ENTRY, AT_EXECFN};
|
||||
long nreplaced = (long)(sizeof(replaced) / sizeof(replaced[0]));
|
||||
long new_argc = argc - 2;
|
||||
long new_argc = nargs;
|
||||
long words = 1 + (new_argc + 1) + (nenv + 1) + (naux + nreplaced + 1) * 2;
|
||||
uintptr_t *nsp = (uintptr_t *)(((uintptr_t)sp - STACK_GAP - (uintptr_t)words * sizeof(uintptr_t)) & ~(uintptr_t)15);
|
||||
uintptr_t top = (uintptr_t)args < (uintptr_t)sp ? (uintptr_t)args : (uintptr_t)sp;
|
||||
uintptr_t *nsp = (uintptr_t *)((top - STACK_GAP - (uintptr_t)words * sizeof(uintptr_t)) & ~(uintptr_t)15);
|
||||
uintptr_t *w = nsp;
|
||||
*w++ = (uintptr_t)new_argc;
|
||||
for (long i = 0; i < new_argc; i++) *w++ = (uintptr_t)argv[i + 2];
|
||||
for (long i = 0; i < new_argc; i++) *w++ = (uintptr_t)args[i];
|
||||
*w++ = 0;
|
||||
for (long i = 0; i < nenv; i++) *w++ = (uintptr_t)envp[i];
|
||||
*w++ = 0;
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.runtime.DeckyManager
|
||||
import com.droiddeck.launcher.runtime.DeckyStore
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import java.io.File
|
||||
|
||||
@@ -21,6 +22,59 @@ internal class DeckyMenu(private val activity: android.app.Activity, private val
|
||||
var deckySupervisor by mutableStateOf(false)
|
||||
var deckyPendingZip by mutableStateOf<File?>(null)
|
||||
var deckyReleaseRequest = 0
|
||||
var deckyPlugins by mutableStateOf<List<DeckyStore.Installed>>(emptyList())
|
||||
var deckyStore by mutableStateOf<List<DeckyStore.Plugin>?>(null)
|
||||
var deckyStoreFailed by mutableStateOf(false)
|
||||
private var storeRequest = 0
|
||||
|
||||
fun refreshPlugins() {
|
||||
Thread({
|
||||
val found = DeckyStore.installed(activity)
|
||||
ui.post { deckyPlugins = found }
|
||||
}, "decky-plugins").start()
|
||||
}
|
||||
|
||||
fun refreshStore() {
|
||||
val request = ++storeRequest
|
||||
deckyStore = null; deckyStoreFailed = false
|
||||
Thread({
|
||||
val listing = DeckyStore.fetch()
|
||||
ui.post {
|
||||
if (request != storeRequest) return@post
|
||||
deckyStore = listing.orEmpty(); deckyStoreFailed = listing == null
|
||||
}
|
||||
}, "decky-store").start()
|
||||
}
|
||||
|
||||
fun installStorePlugin(plugin: DeckyStore.Plugin) {
|
||||
val version = plugin.latest ?: return
|
||||
if (deckyStage != null || SessionState.running || deckyInstalled == null) return
|
||||
deckyStage = activity.getString(R.string.decky_plugin_starting); deckyPercent = -1
|
||||
Thread({
|
||||
val problem = runCatching {
|
||||
DeckyStore.install(activity, plugin, version) { label, value ->
|
||||
val binary = DeckyManager.downloadingBinary
|
||||
ui.post { deckyStage = label; deckyPercent = value; deckyDownloadingBinary = binary }
|
||||
}
|
||||
}.getOrElse { error -> activity.getString(R.string.decky_plugin_failed, error.message ?: error.javaClass.simpleName) }
|
||||
ui.post {
|
||||
deckyStage = null; deckyPercent = -1; deckyDownloadingBinary = false
|
||||
android.widget.Toast.makeText(activity, problem ?: activity.getString(R.string.decky_plugin_installed), android.widget.Toast.LENGTH_LONG).show()
|
||||
refreshPlugins()
|
||||
}
|
||||
}, "install-decky-store").start()
|
||||
}
|
||||
|
||||
fun removePlugin(plugin: DeckyStore.Installed) {
|
||||
if (deckyStage != null || SessionState.running) return
|
||||
Thread({
|
||||
val problem = DeckyStore.remove(activity, plugin)
|
||||
ui.post {
|
||||
if (problem != null) android.widget.Toast.makeText(activity, problem, android.widget.Toast.LENGTH_LONG).show()
|
||||
refreshPlugins()
|
||||
}
|
||||
}, "remove-decky-plugin").start()
|
||||
}
|
||||
|
||||
fun refreshDecky() {
|
||||
val request = ++deckyReleaseRequest
|
||||
@@ -90,6 +144,7 @@ internal class DeckyMenu(private val activity: android.app.Activity, private val
|
||||
deckyStage = null; deckyPercent = -1; deckyDownloadingBinary = false
|
||||
val message = problem ?: activity.getString(R.string.decky_plugin_installed)
|
||||
android.widget.Toast.makeText(activity, message, android.widget.Toast.LENGTH_LONG).show()
|
||||
refreshPlugins()
|
||||
}
|
||||
}, "import-decky-plugin").start()
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@ import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.Display
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewConfiguration
|
||||
import android.view.WindowManager
|
||||
import android.widget.EditText
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
@@ -184,7 +187,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var gpuClockPin by mutableStateOf(false)
|
||||
private var prootNoSeccomp by mutableStateOf(false)
|
||||
private var prootFastPath by mutableStateOf(true)
|
||||
private var nativeUserland by mutableStateOf(false)
|
||||
private var nativeUserland by mutableStateOf(true)
|
||||
private var cursorComposite by mutableStateOf(false)
|
||||
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
||||
private var phantomWarning by mutableStateOf<String?>(null)
|
||||
@@ -918,7 +921,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
||||
request.data?.takeIf { it.scheme == "droiddeck" && it.host == "settings" }?.let { uri ->
|
||||
val section = uri.pathSegments.firstOrNull()
|
||||
navRequest = if (section in setOf("storage", "sync", "downloads")) section
|
||||
navRequest = if (section in setOf("storage", "sync", "downloads", "decky", "boot-movies")) section
|
||||
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
|
||||
request.data = null
|
||||
gameLinkReading = false
|
||||
@@ -1528,7 +1531,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onAddonImport = { sg, target -> importAddons(sg.name, target) },
|
||||
onAddonDelete = { target, name ->
|
||||
saveAction(getString(R.string.main_addons_deleting, name)) {
|
||||
com.droiddeck.launcher.runtime.WowAddons.delete(target, name)
|
||||
com.droiddeck.launcher.ui.deleteAddon(this, target, name)
|
||||
getString(R.string.main_addons_deleted, name)
|
||||
}
|
||||
},
|
||||
@@ -2013,6 +2016,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (!hasFocus) triggerKeys.cancel()
|
||||
if (hasFocus) {
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
|
||||
applyLauncherFullscreen()
|
||||
@@ -2042,6 +2046,36 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}
|
||||
|
||||
private var touchDownX = 0f
|
||||
private var touchDownY = 0f
|
||||
private var touchDragged = false
|
||||
|
||||
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
|
||||
when (event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
com.droiddeck.launcher.ui.ScreenTaps.count++
|
||||
touchDownX = event.rawX
|
||||
touchDownY = event.rawY
|
||||
touchDragged = false
|
||||
}
|
||||
// A drag that wanders back to where it began is still a drag, not a tap.
|
||||
MotionEvent.ACTION_MOVE -> if (!touchDragged &&
|
||||
kotlin.math.hypot(event.rawX - touchDownX, event.rawY - touchDownY) > ViewConfiguration.get(this).scaledTouchSlop
|
||||
) touchDragged = true
|
||||
MotionEvent.ACTION_CANCEL -> touchDragged = true
|
||||
}
|
||||
val handled = super.dispatchTouchEvent(event)
|
||||
if (event.actionMasked == MotionEvent.ACTION_UP) leaveTextFieldOnOutsideTap(event)
|
||||
return handled
|
||||
}
|
||||
|
||||
private fun leaveTextFieldOnOutsideTap(event: MotionEvent) {
|
||||
val field = currentFocus as? EditText ?: return
|
||||
val slop = ViewConfiguration.get(this).scaledTouchSlop
|
||||
if (touchDragged || kotlin.math.hypot(event.rawX - touchDownX, event.rawY - touchDownY) > slop) return
|
||||
com.droiddeck.launcher.ui.releaseTextField(field, IntArray(2).also(field::getLocationOnScreen), event.rawX, event.rawY)
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
if (com.droiddeck.launcher.ui.AgentPet.handleBack(this, event)) return true
|
||||
if (compatLaunch != null) {
|
||||
@@ -2052,6 +2086,14 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (!compatLaunch!!.loading.ended && event.keyCode !in listOf(
|
||||
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_MUTE)) return true
|
||||
}
|
||||
if (!triggerKeys.synthesizing && triggerKeys.nativeKey(event)) return true
|
||||
val tabStep = com.droiddeck.launcher.ui.dualPageStep(event)
|
||||
val tabs = com.droiddeck.launcher.ui.MainTabSteps.handler
|
||||
if (tabStep != null && tabs != null) {
|
||||
if (controllerHaptics) com.droiddeck.launcher.ui.ControllerHaptics.onKey(this, event)
|
||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) tabs(tabStep)
|
||||
return true
|
||||
}
|
||||
if (controllerHaptics) com.droiddeck.launcher.ui.ControllerHaptics.onKey(this, event)
|
||||
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_A) com.droiddeck.launcher.ui.HeldKeys.confirm = event.action == KeyEvent.ACTION_DOWN
|
||||
if (showComponents && (event.keyCode == KeyEvent.KEYCODE_BUTTON_L1 || event.keyCode == KeyEvent.KEYCODE_BUTTON_R1)) {
|
||||
@@ -2069,9 +2111,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}
|
||||
|
||||
private val triggerKeys = com.droiddeck.launcher.input.TriggerKeys { dispatchKeyEvent(it) }
|
||||
|
||||
override fun dispatchGenericMotionEvent(event: android.view.MotionEvent): Boolean {
|
||||
if (compatLaunch != null && !compatLaunch!!.loading.ended &&
|
||||
com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return true
|
||||
triggerKeys.onMotion(event)
|
||||
return super.dispatchGenericMotionEvent(event)
|
||||
}
|
||||
|
||||
@@ -2201,6 +2246,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
triggerKeys.cancel()
|
||||
gameLaunchRequest.incrementAndGet()
|
||||
cancelCompatLaunch()
|
||||
updates.unregister()
|
||||
@@ -2644,6 +2690,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
deckyChecking = decky.deckyChecking, deckyStage = decky.deckyStage, deckyPercent = decky.deckyPercent,
|
||||
deckyDownloadingBinary = decky.deckyDownloadingBinary,
|
||||
deckyEnabled = decky.deckySupervisor, deckySessionRunning = SessionState.running,
|
||||
deckyPlugins = decky.deckyPlugins, deckyStore = decky.deckyStore, deckyStoreFailed = decky.deckyStoreFailed,
|
||||
),
|
||||
ModeSettingsActions(
|
||||
onIntegration = ::configureIntegration,
|
||||
@@ -2754,6 +2801,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
decky.deckyInstalled = null
|
||||
decky.deckySupervisor = false
|
||||
},
|
||||
onDeckyStoreRefresh = { decky.refreshStore() },
|
||||
onDeckyStoreInstall = { plugin -> decky.installStorePlugin(plugin) },
|
||||
onDeckyRemove = { plugin -> decky.removePlugin(plugin) },
|
||||
onPickDeckyPluginZip = {
|
||||
pickDeckyPluginZip.launch(InAppFilePicker.buildIntent(this, ZIP_EXT, getString(R.string.main_pick_decky_zip)))
|
||||
},
|
||||
@@ -3044,6 +3094,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
decky.deckyInstalled = deckyInstalled
|
||||
decky.deckySupervisor = deckySupervisor
|
||||
decky.refreshDecky()
|
||||
decky.refreshPlugins()
|
||||
}
|
||||
fetchAddedGameArt()
|
||||
}
|
||||
|
||||
@@ -4476,6 +4476,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun pickSecondScreenMode(mode: SecondScreenMode) {
|
||||
typingReturnMode = null
|
||||
automaticPanel = false
|
||||
SessionState.bottomMenu = false
|
||||
if (mode != SecondScreenMode.NONE) SessionPrefs.setSecondScreenPanel(this, desktopSession, mode.id)
|
||||
selectSecondScreenMode(mode)
|
||||
}
|
||||
|
||||
@@ -53,6 +53,13 @@ object AppUiPrefs {
|
||||
context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().putBoolean("hide-home-from-recents", hidden).apply()
|
||||
}
|
||||
|
||||
fun pageSwipe(context: Context): Boolean =
|
||||
context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).getBoolean("page-swipe", true)
|
||||
|
||||
fun setPageSwipe(context: Context, on: Boolean) {
|
||||
context.getSharedPreferences("app-ui", Context.MODE_PRIVATE).edit().putBoolean("page-swipe", on).apply()
|
||||
}
|
||||
|
||||
internal fun normalizeScale(percent: Int): Int = percent.takeIf { it in scales } ?: DEFAULT_SCALE
|
||||
|
||||
fun scale(context: Context): Int = normalizeScale(
|
||||
|
||||
@@ -28,6 +28,7 @@ import androidx.compose.material.icons.filled.ArrowUpward
|
||||
import androidx.compose.material.icons.filled.Checklist
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.FileCopy
|
||||
import androidx.compose.material.icons.filled.FileOpen
|
||||
import androidx.compose.material.icons.filled.Folder
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material.icons.filled.InsertDriveFile
|
||||
@@ -101,8 +102,18 @@ private fun FileContextMenuItems(
|
||||
onToggleFavorite: () -> Unit,
|
||||
onProperties: () -> Unit,
|
||||
onDismissMenu: () -> Unit,
|
||||
onOpen: () -> Unit,
|
||||
) {
|
||||
val isDir = file.isDirectory
|
||||
if (!isDir) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.fm_edit_open)) },
|
||||
leadingIcon = { Icon(Icons.Filled.FileOpen, null, tint = MaterialTheme.colorScheme.primary) },
|
||||
onClick = { onDismissMenu(); onOpen() },
|
||||
modifier = Modifier.focusGlide(),
|
||||
)
|
||||
MenuItemDivider()
|
||||
}
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.fm_select)) },
|
||||
leadingIcon = { Icon(Icons.Filled.Checklist, null, tint = MaterialTheme.colorScheme.primary) },
|
||||
@@ -180,6 +191,7 @@ internal fun FileItemRow(
|
||||
onCut: () -> Unit,
|
||||
onDelete: () -> Unit,
|
||||
onRename: () -> Unit,
|
||||
onOpen: () -> Unit = {},
|
||||
isFavorite: Boolean = false,
|
||||
onToggleFavorite: () -> Unit = {},
|
||||
onProperties: () -> Unit = {},
|
||||
@@ -291,6 +303,7 @@ internal fun FileItemRow(
|
||||
file = file,
|
||||
isFavorite = isFavorite,
|
||||
onSelect = onSelect,
|
||||
onOpen = onOpen,
|
||||
onRename = onRename,
|
||||
onCopy = onCopy,
|
||||
onCut = onCut,
|
||||
@@ -517,6 +530,7 @@ internal fun FileGridTile(
|
||||
isFavorite: Boolean = false,
|
||||
onSelect: () -> Unit = {},
|
||||
onRename: () -> Unit = {},
|
||||
onOpen: () -> Unit = {},
|
||||
onCopy: () -> Unit = {},
|
||||
onCut: () -> Unit = {},
|
||||
onDelete: () -> Unit = {},
|
||||
@@ -605,6 +619,7 @@ internal fun FileGridTile(
|
||||
file = file,
|
||||
isFavorite = isFavorite,
|
||||
onSelect = onSelect,
|
||||
onOpen = onOpen,
|
||||
onRename = onRename,
|
||||
onCopy = onCopy,
|
||||
onCut = onCut,
|
||||
|
||||
@@ -191,6 +191,7 @@ fun FileManagerScreen(
|
||||
var compactRows by remember { mutableStateOf(browsePrefs.getBoolean("fmCompactRows", false)) }
|
||||
var showNewFolderDialog by remember { mutableStateOf(false) }
|
||||
var renameTarget by remember { mutableStateOf<File?>(null) }
|
||||
var editingTarget by remember { mutableStateOf<File?>(null) }
|
||||
var propertiesTarget by remember { mutableStateOf<File?>(null) }
|
||||
var isOperationRunning by remember { mutableStateOf(false) }
|
||||
var operationLabel by remember { mutableStateOf("") }
|
||||
@@ -294,7 +295,7 @@ fun FileManagerScreen(
|
||||
if (isOperationActive()) pendingNavigation = action else navigate(action)
|
||||
}
|
||||
|
||||
BackHandler(enabled = operationActive || cancellingNavigation || showFavorites || currentDir != currentRoot || history.isNotEmpty()) {
|
||||
BackHandler(enabled = editingTarget == null && (operationActive || cancellingNavigation || showFavorites || currentDir != currentRoot || history.isNotEmpty())) {
|
||||
requestNavigation(FileManagerNavigation.BACK)
|
||||
}
|
||||
|
||||
@@ -696,6 +697,14 @@ fun FileManagerScreen(
|
||||
|
||||
val compactToolbar = LocalConfiguration.current.screenWidthDp < 600
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
editingTarget?.let { target ->
|
||||
TextEditorScreen(
|
||||
file = target,
|
||||
onExit = { editingTarget = null },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
return@Column
|
||||
}
|
||||
if (pickMode && !pickerTitle.isNullOrEmpty()) {
|
||||
Text(
|
||||
text = pickerTitle,
|
||||
@@ -1194,6 +1203,8 @@ fun FileManagerScreen(
|
||||
pickPrefs.edit().putString("lastFilePickerDir", currentDir.absolutePath).apply()
|
||||
onPick?.invoke(file)
|
||||
}
|
||||
} else {
|
||||
editingTarget = file
|
||||
}
|
||||
},
|
||||
onMenu = { showMenuFor = file },
|
||||
@@ -1205,6 +1216,7 @@ fun FileManagerScreen(
|
||||
selectedPaths = selectedPaths + file.absolutePath
|
||||
showMenuFor = null
|
||||
},
|
||||
onOpen = { editingTarget = file; showMenuFor = null },
|
||||
onRename = { renameTarget = file; showMenuFor = null },
|
||||
onCopy = { clipboardFiles = listOf(file); isCutOperation = false; showMenuFor = null },
|
||||
onCut = { clipboardFiles = listOf(file); isCutOperation = true; showMenuFor = null },
|
||||
@@ -1273,6 +1285,8 @@ fun FileManagerScreen(
|
||||
pickPrefs.edit().putString("lastFilePickerDir", currentDir.absolutePath).apply()
|
||||
onPick?.invoke(file)
|
||||
}
|
||||
} else {
|
||||
editingTarget = file
|
||||
}
|
||||
},
|
||||
onMenu = { showMenuFor = file },
|
||||
@@ -1286,6 +1300,7 @@ fun FileManagerScreen(
|
||||
onCopy = { clipboardFiles = listOf(file); isCutOperation = false; showMenuFor = null },
|
||||
onCut = { clipboardFiles = listOf(file); isCutOperation = true; showMenuFor = null },
|
||||
onDelete = { selectedEntry = file; showMenuFor = null },
|
||||
onOpen = { editingTarget = file; showMenuFor = null },
|
||||
onRename = { renameTarget = file; showMenuFor = null },
|
||||
isFavorite = isFav,
|
||||
onToggleFavorite = {
|
||||
|
||||
@@ -0,0 +1,726 @@
|
||||
package com.droiddeck.launcher.files
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
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 androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
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.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material.icons.filled.Save
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.layout.onSizeChanged
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextRange
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
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.text.input.TextFieldValue
|
||||
import androidx.compose.ui.text.rememberTextMeasurer
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.ui.focusGlide
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.charset.CharacterCodingException
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.CodingErrorAction
|
||||
import java.nio.file.Files
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
internal const val EDITOR_FONT_SIZE_SP = 13
|
||||
internal const val EDITOR_LINE_HEIGHT_SP = 18
|
||||
internal const val EDITOR_TAB_WIDTH = 4
|
||||
internal const val EDITOR_MAX_OPEN_BYTES = 4L * 1024 * 1024
|
||||
internal const val EDITOR_MAX_EDIT_BYTES = 512L * 1024
|
||||
|
||||
internal enum class EditorCharset(val label: String, private val charsetName: String) {
|
||||
UTF8("UTF-8", "UTF-8"),
|
||||
GB18030("GB18030", "GB18030"),
|
||||
;
|
||||
|
||||
val charset: Charset get() = Charset.forName(charsetName)
|
||||
}
|
||||
|
||||
internal enum class EditorLock { NONE, BINARY, TOO_LARGE, PERMISSION, LOSSY }
|
||||
|
||||
internal enum class EditorLoadState { LOADING, READY, TOO_LARGE, UNREADABLE }
|
||||
|
||||
internal data class DecodedEditorText(val text: String, val charset: EditorCharset, val lossy: Boolean)
|
||||
|
||||
internal fun editorIsBinary(bytes: ByteArray, sample: Int = 8192): Boolean {
|
||||
val limit = minOf(bytes.size, sample)
|
||||
for (i in 0 until limit) if (bytes[i].toInt() == 0) return true
|
||||
return false
|
||||
}
|
||||
|
||||
private fun strictDecode(bytes: ByteArray, charset: Charset): String? = try {
|
||||
charset.newDecoder()
|
||||
.onMalformedInput(CodingErrorAction.REPORT)
|
||||
.onUnmappableCharacter(CodingErrorAction.REPORT)
|
||||
.decode(ByteBuffer.wrap(bytes))
|
||||
.toString()
|
||||
} catch (e: CharacterCodingException) {
|
||||
null
|
||||
}
|
||||
|
||||
internal fun decodeEditorText(bytes: ByteArray): DecodedEditorText {
|
||||
strictDecode(bytes, Charsets.UTF_8)?.let { return DecodedEditorText(it, EditorCharset.UTF8, false) }
|
||||
strictDecode(bytes, EditorCharset.GB18030.charset)?.let { return DecodedEditorText(it, EditorCharset.GB18030, false) }
|
||||
return DecodedEditorText(String(bytes, Charsets.UTF_8), EditorCharset.UTF8, true)
|
||||
}
|
||||
|
||||
internal fun resolveEditorSaveTarget(file: File): File {
|
||||
val isLink = runCatching { Files.isSymbolicLink(file.toPath()) }.getOrDefault(false)
|
||||
if (!isLink) return file
|
||||
// rename(2) replaces the link itself, so stage next to and rename onto the real target
|
||||
return runCatching { file.canonicalFile }.getOrDefault(file)
|
||||
}
|
||||
|
||||
internal fun readCapped(input: InputStream, limit: Long): ByteArray? {
|
||||
val out = ByteArrayOutputStream()
|
||||
val buffer = ByteArray(64 * 1024)
|
||||
var total = 0L
|
||||
while (true) {
|
||||
val n = input.read(buffer)
|
||||
if (n < 0) return out.toByteArray()
|
||||
total += n
|
||||
if (total > limit) return null
|
||||
out.write(buffer, 0, n)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun expandEditorTabs(text: String, width: Int = EDITOR_TAB_WIDTH): String {
|
||||
if (text.indexOf('\t') < 0) return text
|
||||
val out = StringBuilder(text.length)
|
||||
var column = 0
|
||||
for (c in text) {
|
||||
when (c) {
|
||||
'\n' -> {
|
||||
out.append(c)
|
||||
column = 0
|
||||
}
|
||||
'\t' -> {
|
||||
val pad = width - (column % width)
|
||||
repeat(pad) { out.append(' ') }
|
||||
column += pad
|
||||
}
|
||||
else -> {
|
||||
out.append(c)
|
||||
column++
|
||||
}
|
||||
}
|
||||
}
|
||||
return out.toString()
|
||||
}
|
||||
|
||||
internal fun lineCountOf(text: String): Int {
|
||||
var lines = 1
|
||||
for (i in text.indices) if (text[i] == '\n') lines++
|
||||
return lines
|
||||
}
|
||||
|
||||
internal fun lineIndexOfOffset(text: String, offset: Int): Int {
|
||||
val end = offset.coerceIn(0, text.length)
|
||||
var line = 0
|
||||
var i = 0
|
||||
while (i < end) {
|
||||
if (text[i] == '\n') line++
|
||||
i++
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
internal fun columnOfOffset(text: String, offset: Int): Int {
|
||||
val end = offset.coerceIn(0, text.length)
|
||||
var start = end
|
||||
while (start > 0 && text[start - 1] != '\n') start--
|
||||
return end - start + 1
|
||||
}
|
||||
|
||||
internal fun findEditorMatches(
|
||||
text: String,
|
||||
query: String,
|
||||
matchCase: Boolean = false,
|
||||
limit: Int = 10000,
|
||||
): List<IntRange> {
|
||||
if (query.isEmpty()) return emptyList()
|
||||
val out = ArrayList<IntRange>()
|
||||
var at = 0
|
||||
while (out.size < limit) {
|
||||
val found = text.indexOf(query, at, ignoreCase = !matchCase)
|
||||
if (found < 0) break
|
||||
out.add(found until found + query.length)
|
||||
at = found + query.length
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
internal fun replaceEditorMatches(text: String, matches: List<IntRange>, replacement: String): String {
|
||||
if (matches.isEmpty()) return text
|
||||
val out = StringBuilder(text.length)
|
||||
var cursor = 0
|
||||
for (m in matches) {
|
||||
if (m.first < cursor || m.last >= text.length) continue
|
||||
out.append(text, cursor, m.first).append(replacement)
|
||||
cursor = m.last + 1
|
||||
}
|
||||
out.append(text, cursor, text.length)
|
||||
return out.toString()
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun TextEditorScreen(
|
||||
file: File,
|
||||
onExit: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
val density = LocalDensity.current
|
||||
|
||||
var text by remember { mutableStateOf("") }
|
||||
var selection by remember { mutableStateOf(TextRange.Zero) }
|
||||
var composing by remember { mutableStateOf<TextRange?>(null) }
|
||||
var loadState by remember { mutableStateOf(EditorLoadState.LOADING) }
|
||||
var lock by remember { mutableStateOf(EditorLock.NONE) }
|
||||
var charset by remember { mutableStateOf(EditorCharset.UTF8) }
|
||||
var dirty by remember { mutableStateOf(false) }
|
||||
var saving by remember { mutableStateOf(false) }
|
||||
var showDiscard by remember { mutableStateOf(false) }
|
||||
var showSearch by remember { mutableStateOf(false) }
|
||||
var query by remember { mutableStateOf("") }
|
||||
var replacement by remember { mutableStateOf("") }
|
||||
var matchCase by remember { mutableStateOf(false) }
|
||||
var matchIndex by remember { mutableIntStateOf(0) }
|
||||
|
||||
val scrollState = rememberScrollState()
|
||||
val textHorizontalState = rememberScrollState()
|
||||
var viewportHeight by remember { mutableIntStateOf(0) }
|
||||
var viewportWidth by remember { mutableIntStateOf(0) }
|
||||
|
||||
val lineHeightDp = with(density) { EDITOR_LINE_HEIGHT_SP.sp.toDp() }
|
||||
val lineHeightPx = with(density) { lineHeightDp.toPx() }
|
||||
val totalLines = remember(text) { lineCountOf(text) }
|
||||
val cursorLine = lineIndexOfOffset(text, selection.end)
|
||||
val cursorColumn = columnOfOffset(text, selection.end)
|
||||
val matches = remember(text, query, matchCase) { findEditorMatches(text, query, matchCase) }
|
||||
val readOnly = lock != EditorLock.NONE
|
||||
val bodyStyle = TextStyle(
|
||||
fontFamily = FontFamily.Monospace,
|
||||
fontSize = EDITOR_FONT_SIZE_SP.sp,
|
||||
lineHeight = EDITOR_LINE_HEIGHT_SP.sp,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
val textMeasurer = rememberTextMeasurer()
|
||||
val charWidthPx = remember(bodyStyle) { textMeasurer.measure(text = "0", style = bodyStyle).size.width.toFloat() }
|
||||
|
||||
LaunchedEffect(file) {
|
||||
loadState = EditorLoadState.LOADING
|
||||
val size = withContext(Dispatchers.IO) { file.length() }
|
||||
if (size > EDITOR_MAX_OPEN_BYTES) {
|
||||
loadState = EditorLoadState.TOO_LARGE
|
||||
return@LaunchedEffect
|
||||
}
|
||||
val read = withContext(Dispatchers.IO) {
|
||||
runCatching { file.inputStream().use { readCapped(it, EDITOR_MAX_OPEN_BYTES) } }
|
||||
}
|
||||
val bytes = read.getOrNull()
|
||||
if (bytes == null) {
|
||||
loadState = if (read.isFailure) EditorLoadState.UNREADABLE else EditorLoadState.TOO_LARGE
|
||||
return@LaunchedEffect
|
||||
}
|
||||
val decoded = decodeEditorText(bytes)
|
||||
text = expandEditorTabs(decoded.text)
|
||||
charset = decoded.charset
|
||||
lock = when {
|
||||
editorIsBinary(bytes) -> EditorLock.BINARY
|
||||
decoded.lossy -> EditorLock.LOSSY
|
||||
bytes.size > EDITOR_MAX_EDIT_BYTES -> EditorLock.TOO_LARGE
|
||||
!file.canWrite() -> EditorLock.PERMISSION
|
||||
else -> EditorLock.NONE
|
||||
}
|
||||
selection = TextRange.Zero
|
||||
loadState = EditorLoadState.READY
|
||||
}
|
||||
|
||||
suspend fun revealLine(line: Int) {
|
||||
val current = scrollState.value
|
||||
val top = line * lineHeightPx
|
||||
val target = when {
|
||||
top < current -> top
|
||||
top + lineHeightPx > current + viewportHeight -> top + lineHeightPx - viewportHeight
|
||||
else -> return
|
||||
}
|
||||
val clamped = target.roundToInt().coerceIn(0, scrollState.maxValue)
|
||||
if (clamped != current) scrollState.scrollTo(clamped)
|
||||
}
|
||||
|
||||
LaunchedEffect(text, selection.end, viewportHeight, viewportWidth) {
|
||||
if (loadState != EditorLoadState.READY) return@LaunchedEffect
|
||||
revealLine(lineIndexOfOffset(text, selection.end))
|
||||
if (viewportWidth > 0 && charWidthPx > 0) {
|
||||
val x = (columnOfOffset(text, selection.end) - 1) * charWidthPx
|
||||
val current = textHorizontalState.value
|
||||
val target = when {
|
||||
x < current -> x
|
||||
x + charWidthPx > current + viewportWidth -> x + charWidthPx - viewportWidth
|
||||
else -> null
|
||||
}
|
||||
if (target != null) {
|
||||
val clamped = target.roundToInt().coerceIn(0, textHorizontalState.maxValue)
|
||||
if (clamped != current) textHorizontalState.scrollTo(clamped)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(query, matchCase) {
|
||||
if (query.isEmpty()) return@LaunchedEffect
|
||||
matchIndex = 0
|
||||
val first = matches.firstOrNull() ?: return@LaunchedEffect
|
||||
selection = TextRange(first.first, first.last + 1)
|
||||
composing = TextRange.Zero
|
||||
}
|
||||
|
||||
LaunchedEffect(text) { matchIndex = 0 }
|
||||
|
||||
fun gotoMatch(delta: Int) {
|
||||
if (matches.isEmpty()) return
|
||||
matchIndex = Math.floorMod(matchIndex + delta, matches.size)
|
||||
val m = matches[matchIndex]
|
||||
selection = TextRange(m.first, m.last + 1)
|
||||
composing = TextRange.Zero
|
||||
}
|
||||
|
||||
fun replaceCurrent() {
|
||||
if (readOnly) return
|
||||
val m = matches.getOrNull(matchIndex) ?: return
|
||||
text = text.replaceRange(m.first, m.last + 1, replacement)
|
||||
dirty = true
|
||||
matchIndex = 0
|
||||
selection = TextRange(m.first + replacement.length)
|
||||
composing = TextRange.Zero
|
||||
}
|
||||
|
||||
fun replaceAll() {
|
||||
if (readOnly || matches.isEmpty()) return
|
||||
val all = findEditorMatches(text, query, matchCase, limit = Int.MAX_VALUE)
|
||||
text = replaceEditorMatches(text, all, replacement)
|
||||
dirty = true
|
||||
matchIndex = 0
|
||||
selection = TextRange.Zero
|
||||
composing = TextRange.Zero
|
||||
}
|
||||
|
||||
fun save() {
|
||||
if (readOnly || saving || loadState != EditorLoadState.READY) return
|
||||
val snapshot = text
|
||||
val bytes = snapshot.toByteArray(charset.charset)
|
||||
saving = true
|
||||
scope.launch {
|
||||
val ok = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
val target = resolveEditorSaveTarget(file)
|
||||
val parent = target.parentFile
|
||||
if (parent == null) {
|
||||
target.writeBytes(bytes)
|
||||
} else {
|
||||
val tmp = File.createTempFile(".${target.name}.", ".droiddeck-tmp", parent)
|
||||
try {
|
||||
tmp.writeBytes(bytes)
|
||||
runCatching {
|
||||
Files.setPosixFilePermissions(tmp.toPath(), Files.getPosixFilePermissions(target.toPath()))
|
||||
}
|
||||
if (!tmp.renameTo(target)) error("rename to ${target.name} failed")
|
||||
} finally {
|
||||
tmp.delete()
|
||||
}
|
||||
}
|
||||
}.isSuccess
|
||||
}
|
||||
saving = false
|
||||
if (ok) {
|
||||
if (text == snapshot) dirty = false
|
||||
} else {
|
||||
Toast.makeText(context, context.getString(R.string.fm_edit_save_failed, file.name), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun tryExit() {
|
||||
if (saving) return
|
||||
if (dirty && !readOnly) showDiscard = true else onExit()
|
||||
}
|
||||
|
||||
BackHandler { tryExit() }
|
||||
|
||||
if (showDiscard) {
|
||||
OutlinedAlertDialog(
|
||||
onDismissRequest = { showDiscard = false },
|
||||
title = { Text(stringResource(R.string.fm_edit_discard_title)) },
|
||||
text = { Text(stringResource(R.string.fm_edit_discard_text, file.name)) },
|
||||
confirmButton = {
|
||||
TextButton(onClick = onExit, modifier = Modifier.focusGlide(CircleShape)) {
|
||||
Text(stringResource(R.string.fm_edit_discard))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showDiscard = false }, modifier = Modifier.focusGlide(CircleShape)) {
|
||||
Text(stringResource(R.string.common_cancel))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surfaceContainer)
|
||||
.padding(horizontal = 8.dp, vertical = 6.dp),
|
||||
) {
|
||||
IconButton(onClick = { tryExit() }, modifier = Modifier.focusGlide(CircleShape)) {
|
||||
Icon(
|
||||
Icons.Filled.ArrowBack,
|
||||
stringResource(R.string.fm_back),
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f).padding(horizontal = 4.dp)) {
|
||||
Text(
|
||||
text = file.name,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
if (dirty) {
|
||||
Text(
|
||||
text = "\u2022 " + stringResource(R.string.fm_edit_modified),
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
fontSize = 11.sp,
|
||||
maxLines = 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (loadState == EditorLoadState.READY && lock != EditorLock.NONE) {
|
||||
Text(
|
||||
text = stringResource(
|
||||
if (lock == EditorLock.BINARY) R.string.fm_edit_binary else R.string.fm_edit_read_only,
|
||||
),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 10.sp,
|
||||
maxLines = 1,
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant, MaterialTheme.shapes.small)
|
||||
.padding(horizontal = 6.dp, vertical = 2.dp),
|
||||
)
|
||||
Spacer(Modifier.width(6.dp))
|
||||
}
|
||||
IconButton(
|
||||
onClick = { showSearch = !showSearch },
|
||||
enabled = loadState == EditorLoadState.READY,
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.Search,
|
||||
stringResource(R.string.fm_edit_find),
|
||||
tint = if (showSearch) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = { save() },
|
||||
enabled = loadState == EditorLoadState.READY && !readOnly && dirty && !saving,
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.Save,
|
||||
stringResource(R.string.fm_edit_save),
|
||||
tint = if (dirty) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (showSearch && loadState == EditorLoadState.READY) {
|
||||
Column(Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surfaceContainer)) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 8.dp, end = 4.dp, top = 4.dp),
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = query,
|
||||
onValueChange = { query = it; matchIndex = 0 },
|
||||
singleLine = true,
|
||||
placeholder = { Text(stringResource(R.string.fm_edit_find), fontSize = 13.sp) },
|
||||
textStyle = MaterialTheme.typography.bodySmall,
|
||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
||||
keyboardActions = KeyboardActions(onSearch = { gotoMatch(1) }),
|
||||
modifier = Modifier.weight(1f).focusGlide(),
|
||||
)
|
||||
Text(
|
||||
text = if (matches.isEmpty()) "0/${matches.size}" else "${matchIndex.coerceAtMost(matches.size - 1) + 1}/${matches.size}",
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 12.sp,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.padding(horizontal = 6.dp).widthIn(min = 44.dp, max = 80.dp),
|
||||
)
|
||||
IconButton(
|
||||
onClick = { gotoMatch(-1) },
|
||||
enabled = matches.isNotEmpty(),
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.KeyboardArrowUp,
|
||||
stringResource(R.string.fm_edit_find_previous),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.size(20.dp),
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = { gotoMatch(1) },
|
||||
enabled = matches.isNotEmpty(),
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.KeyboardArrowDown,
|
||||
stringResource(R.string.fm_edit_find_next),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.size(20.dp),
|
||||
)
|
||||
}
|
||||
TextButton(onClick = { matchCase = !matchCase }, modifier = Modifier.focusGlide(CircleShape)) {
|
||||
Text(
|
||||
text = "Aa",
|
||||
color = if (matchCase) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 13.sp,
|
||||
)
|
||||
}
|
||||
IconButton(onClick = { showSearch = false }, modifier = Modifier.focusGlide(CircleShape)) {
|
||||
Icon(
|
||||
Icons.Filled.Close,
|
||||
stringResource(R.string.common_cancel),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.size(20.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 8.dp, top = 2.dp, end = 4.dp, bottom = 2.dp),
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = replacement,
|
||||
onValueChange = { replacement = it },
|
||||
singleLine = true,
|
||||
placeholder = { Text(stringResource(R.string.fm_edit_replace), fontSize = 13.sp) },
|
||||
textStyle = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.weight(1f).focusGlide(),
|
||||
)
|
||||
TextButton(
|
||||
onClick = { replaceCurrent() },
|
||||
enabled = !readOnly && matches.isNotEmpty(),
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Text(stringResource(R.string.fm_edit_replace), fontSize = 13.sp)
|
||||
}
|
||||
TextButton(
|
||||
onClick = { replaceAll() },
|
||||
enabled = !readOnly && matches.isNotEmpty(),
|
||||
modifier = Modifier.focusGlide(CircleShape),
|
||||
) {
|
||||
Text(stringResource(R.string.fm_edit_replace_all), fontSize = 13.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth()
|
||||
.onSizeChanged { viewportHeight = it.height },
|
||||
) {
|
||||
when (loadState) {
|
||||
EditorLoadState.LOADING -> CircularProgressIndicator(
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
)
|
||||
|
||||
EditorLoadState.TOO_LARGE, EditorLoadState.UNREADABLE -> Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.align(Alignment.Center).padding(24.dp),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(
|
||||
if (loadState == EditorLoadState.TOO_LARGE) R.string.fm_edit_too_large
|
||||
else R.string.fm_edit_open_failed,
|
||||
if (loadState == EditorLoadState.TOO_LARGE) FileOps.formatBytes(context, file.length())
|
||||
else file.name,
|
||||
),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 14.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
|
||||
EditorLoadState.READY -> Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState),
|
||||
) {
|
||||
Row(modifier = Modifier.fillMaxWidth().height(lineHeightDp * totalLines.toFloat())) {
|
||||
LineNumbers(
|
||||
scrollState = scrollState,
|
||||
viewportHeight = viewportHeight,
|
||||
lineHeightDp = lineHeightDp,
|
||||
lineHeightPx = lineHeightPx,
|
||||
totalLines = totalLines,
|
||||
cursorLine = cursorLine,
|
||||
style = bodyStyle,
|
||||
mutedColor = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
cursorColor = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
Box(modifier = Modifier.weight(1f).onSizeChanged { viewportWidth = it.width }.horizontalScroll(textHorizontalState)) {
|
||||
BasicTextField(
|
||||
value = TextFieldValue(text = text, selection = selection, composition = composing),
|
||||
onValueChange = { next ->
|
||||
val changed = next.text != text
|
||||
text = next.text
|
||||
selection = next.selection
|
||||
composing = next.composition
|
||||
if (changed) dirty = true
|
||||
},
|
||||
readOnly = readOnly,
|
||||
textStyle = bodyStyle,
|
||||
cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Text,
|
||||
capitalization = KeyboardCapitalization.None,
|
||||
),
|
||||
modifier = Modifier.fillMaxHeight().focusGlide(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loadState == EditorLoadState.READY) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.fm_edit_position, cursorLine + 1, cursorColumn),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 12.sp,
|
||||
maxLines = 1,
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
Text(
|
||||
text = charset.label + " \u2022 " + FileOps.formatBytes(context, file.length()),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 12.sp,
|
||||
maxLines = 1,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LineNumbers(
|
||||
scrollState: ScrollState,
|
||||
viewportHeight: Int,
|
||||
lineHeightDp: Dp,
|
||||
lineHeightPx: Float,
|
||||
totalLines: Int,
|
||||
cursorLine: Int,
|
||||
style: TextStyle,
|
||||
mutedColor: Color,
|
||||
cursorColor: Color,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val firstLine = (scrollState.value / lineHeightPx).toInt().coerceIn(0, totalLines - 1)
|
||||
val lastLine = ((scrollState.value + viewportHeight) / lineHeightPx)
|
||||
.toInt()
|
||||
.coerceIn(firstLine, totalLines - 1)
|
||||
Column(
|
||||
horizontalAlignment = Alignment.End,
|
||||
modifier = modifier
|
||||
.width(IntrinsicSize.Min)
|
||||
.padding(top = lineHeightDp * firstLine.toFloat()),
|
||||
) {
|
||||
for (line in firstLine..lastLine) {
|
||||
Text(
|
||||
text = (line + 1).toString(),
|
||||
color = if (line == cursorLine) cursorColor else mutedColor,
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
style = style,
|
||||
modifier = Modifier.fillMaxWidth().height(lineHeightDp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,17 +31,20 @@ object OnScreenLayout {
|
||||
private const val TOLERANCE = .01f
|
||||
private const val KEYBOARD_ID = "builtin:keyboard"
|
||||
private val REAR = setOf(InputControl.L4, InputControl.L5, InputControl.R4, InputControl.R5)
|
||||
private val BAR = setOf(InputControl.GUIDE, InputControl.QAM)
|
||||
|
||||
fun elements(context: Context, saved: SavedInputLayout?, width: Int, height: Int, safe: Rect,
|
||||
buttonsOnly: Boolean = false, dock: Dock? = null, rearButtons: Boolean? = null,
|
||||
trackpads: Boolean? = null): List<InputSurfaceElement> {
|
||||
if (saved == null) return emptyList()
|
||||
if (width <= 0 || height <= 0) return saved.elements
|
||||
val layout = oriented(saved, width, height)
|
||||
val layout = oriented(saved, dock?.portrait ?: (height > width))
|
||||
val stored = layout.elements
|
||||
val generator = LegacyGamepadLayout(context, width, height, safe, layout.scale)
|
||||
val (reference, matched) = reference(context, layout, width, height)
|
||||
if (buttonsOnly && dock == null) return generator.buttonsOnly(stored) + fit(stored.filter { it.alwaysShown }, reference.first, reference.second, width, height, safe)
|
||||
if (dock?.portrait == true && !dock.grips && !matched && layout.aspect > 0f && layout.aspect < 1f && stored.any(::isGamepad))
|
||||
return cluster(stored.filterNot { it.alwaysShown || isGamepad(it) && (it.id == KEYBOARD_ID || it.control in BAR) }, layout.aspect, width, height, safe)
|
||||
val generated = matched || PadKit.forOverlay(context, layout) != null && stored.any(::isGamepad) &&
|
||||
(dock != null || height > width && layout.aspect >= 1f || height <= width && layout.aspect > 0f && layout.aspect < 1f)
|
||||
val gamepad = if (generated) stored.filter(::isGamepad) else emptyList()
|
||||
@@ -70,8 +73,9 @@ object OnScreenLayout {
|
||||
.place(ordered, lowerShortcuts = generated, rearButtons = rearButtons, trackpads = trackpads)
|
||||
}
|
||||
|
||||
fun oriented(layout: SavedInputLayout, width: Int, height: Int): SavedInputLayout {
|
||||
val portrait = height > width
|
||||
fun oriented(layout: SavedInputLayout, width: Int, height: Int): SavedInputLayout = oriented(layout, height > width)
|
||||
|
||||
private fun oriented(layout: SavedInputLayout, portrait: Boolean): SavedInputLayout {
|
||||
if (layout.rotated.isEmpty() || layout.aspect <= 0f || (layout.aspect < 1f) == portrait || (layout.rotatedAspect < 1f) != portrait) return layout
|
||||
val rotated = layout.rotated.associateBy { it.id }
|
||||
return layout.copy(elements = layout.elements.map { e -> rotated[e.id]?.let { e.copy(x = it.x, y = it.y, width = it.width, height = it.height) } ?: e } +
|
||||
@@ -131,6 +135,23 @@ object OnScreenLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private fun cluster(elements: List<InputSurfaceElement>, aspect: Float, width: Int, height: Int, safe: Rect): List<InputSurfaceElement> {
|
||||
if (elements.isEmpty()) return elements
|
||||
val left = elements.minOf { it.x } * aspect
|
||||
val top = elements.minOf { it.y }
|
||||
val spanX = (elements.maxOf { it.x + it.width } * aspect - left).coerceAtLeast(.0001f)
|
||||
val spanY = (elements.maxOf { it.y + it.height } - top).coerceAtLeast(.0001f)
|
||||
val w = (width - safe.left - safe.right).toFloat().coerceAtLeast(1f)
|
||||
val h = (height - safe.top - safe.bottom).toFloat().coerceAtLeast(1f)
|
||||
val scale = minOf(w / aspect, w / spanX, h / spanY)
|
||||
val originX = safe.left + (w - spanX * scale) / 2f - left * scale
|
||||
val originY = safe.top + (h - spanY * scale) / 2f - top * scale
|
||||
return elements.map { e ->
|
||||
e.copy(x = (originX + e.x * aspect * scale) / width, y = (originY + e.y * scale) / height,
|
||||
width = e.width * aspect * scale / width, height = e.height * scale / height)
|
||||
}
|
||||
}
|
||||
|
||||
private fun anchor(start: Float, size: Float, reference: Float, actual: Float, scale: Float): Float {
|
||||
val centre = start + size / 2f
|
||||
val scaled = size * reference * scale
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.SystemClock
|
||||
import android.view.InputDevice
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
|
||||
internal class TriggerKeys(private val dispatch: (KeyEvent) -> Unit) {
|
||||
private class Pull {
|
||||
val held = BooleanArray(2)
|
||||
val sent = BooleanArray(2)
|
||||
}
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val keyed = HashSet<Int>()
|
||||
private val pulls = HashMap<Int, Pull>()
|
||||
var synthesizing = false
|
||||
private set
|
||||
|
||||
/** True when this real trigger key belongs to a pull that already went out as a synthetic press. */
|
||||
fun nativeKey(event: KeyEvent): Boolean {
|
||||
val i = index(event.keyCode) ?: return false
|
||||
keyed += event.deviceId
|
||||
val pull = pulls[event.deviceId] ?: return false
|
||||
if (!pull.sent[i]) return false
|
||||
if (event.action == KeyEvent.ACTION_UP) pull.sent[i] = false
|
||||
return true
|
||||
}
|
||||
|
||||
fun onMotion(event: MotionEvent) {
|
||||
if (event.source and InputDevice.SOURCE_JOYSTICK != InputDevice.SOURCE_JOYSTICK || event.action != MotionEvent.ACTION_MOVE) return
|
||||
val device = event.deviceId
|
||||
if (device in keyed) return
|
||||
val pull = pulls.getOrPut(device) { Pull() }
|
||||
update(pull, 0, maxOf(event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_BRAKE)), event)
|
||||
update(pull, 1, maxOf(event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_GAS)), event)
|
||||
}
|
||||
|
||||
fun cancel() {
|
||||
handler.removeCallbacksAndMessages(null)
|
||||
pulls.clear()
|
||||
}
|
||||
|
||||
private fun update(pull: Pull, i: Int, value: Float, event: MotionEvent) {
|
||||
if (!pull.held[i] && value >= PRESS) {
|
||||
pull.held[i] = true
|
||||
pull.sent[i] = false
|
||||
val device = event.deviceId
|
||||
val source = event.source
|
||||
// A pad that also sends trigger keys delivers them close to the axis; waiting lets that key win.
|
||||
handler.postDelayed({
|
||||
if (device !in keyed && pulls[device] === pull) {
|
||||
pull.sent[i] = true
|
||||
press(CODES[i], device, source)
|
||||
}
|
||||
}, KEY_WAIT_MS)
|
||||
} else if (pull.held[i] && value <= RELEASE) pull.held[i] = false
|
||||
}
|
||||
|
||||
private fun press(code: Int, device: Int, source: Int) {
|
||||
val now = SystemClock.uptimeMillis()
|
||||
synthesizing = true
|
||||
try {
|
||||
dispatch(KeyEvent(now, now, KeyEvent.ACTION_DOWN, code, 0, 0, device, 0, 0, source))
|
||||
dispatch(KeyEvent(now, now, KeyEvent.ACTION_UP, code, 0, 0, device, 0, 0, source))
|
||||
} finally {
|
||||
synthesizing = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun index(code: Int): Int? = CODES.indexOf(code).takeIf { it >= 0 }
|
||||
|
||||
private companion object {
|
||||
val CODES = intArrayOf(KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.KEYCODE_BUTTON_R2)
|
||||
const val PRESS = 0.6f
|
||||
const val RELEASE = 0.3f
|
||||
const val KEY_WAIT_MS = 40L
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ object BattleNet {
|
||||
Title("aqua", "Avowed", "AQUA", 2457220, shop = "avowed", product = "aqua"),
|
||||
)
|
||||
|
||||
val STORE: List<Title> get() = TITLES.distinctBy { it.code }.filter { it.uid != "d3cn" && it.code != "WoWC" && it.code != "WoWF" }
|
||||
val STORE: List<Title> get() = TITLES.distinctBy { it.code }.filter { it.uid != "d3cn" && it.code != "WoWC" }
|
||||
|
||||
// Blizzard's China client installs some products under a CN uid; they are the same games and keep their store identity.
|
||||
private val CN_UIDS = mapOf("s2_cn" to "s2", "osic" to "osi", "anbs_cn" to "anbs")
|
||||
|
||||
@@ -1,10 +1,293 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.stores.battlenet.BattleNetInstall
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.time.Instant
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
object CurseForgeApp {
|
||||
const val NAME = "CurseForge"
|
||||
const val FEED = "https://curseforge.overwolf.com/electron/linux/latest-linux.yml"
|
||||
internal const val WOW = 1
|
||||
const val HELPER = "/usr/local/bin/droiddeck-curseforge"
|
||||
internal const val AGENT = "/usr/local/bin/droiddeck-agent"
|
||||
private const val READY_MS = 120_000L
|
||||
private const val INSTALL_MS = 300_000L
|
||||
private const val OUT_OF_DATE = 2
|
||||
|
||||
enum class Start { READY, BUSY, FAILED }
|
||||
|
||||
class Started(val state: Start, val inspector: String? = null)
|
||||
|
||||
class Project(val id: String, val installedModId: String, val folders: List<String>, val update: Boolean)
|
||||
|
||||
internal val INSPECTOR = Regex("ws://127\\.0\\.0\\.1:[0-9]{4,5}/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
|
||||
|
||||
class Failure(message: String, val code: String? = null) : Exception(message) {
|
||||
val gone get() = code == "DEVTOOLS_UNREACHABLE"
|
||||
}
|
||||
|
||||
fun find(apps: List<UserApps.App>): UserApps.App? = apps.firstOrNull { it.feed == FEED }
|
||||
|
||||
fun request(): UserApps.Request = UserApps.Request(UserApps.Source.Feed(FEED), NAME, null)
|
||||
|
||||
internal fun dir(app: UserApps.App): String? = app.args.firstOrNull()?.takeIf { it.startsWith("/") }
|
||||
|
||||
internal fun helperArgv(command: String, dir: String): List<String> = listOf(HELPER, command, dir)
|
||||
|
||||
internal fun evalArgv(inspector: String, expression: String, timeoutMs: Long): List<String> =
|
||||
listOf(AGENT, "--cdp-inspector", inspector, (timeoutMs / 1000.0).toString(), expression)
|
||||
|
||||
internal fun lastJson(lines: List<String>): JSONObject? =
|
||||
lines.asReversed().firstNotNullOfOrNull { line -> runCatching { JSONObject(line.trim()) }.getOrNull() }
|
||||
|
||||
internal fun inspectorUrl(stdout: String): String? = stdout.lineSequence().map { it.trim() }.lastOrNull { INSPECTOR.matches(it) }
|
||||
|
||||
internal fun startState(exitCode: Int): Start = when (exitCode) {
|
||||
0 -> Start.READY
|
||||
3 -> Start.BUSY
|
||||
else -> Start.FAILED
|
||||
}
|
||||
|
||||
internal fun sortOf(sort: WowAddonCatalog.Sort): Pair<Int, Int> = when (sort) {
|
||||
WowAddonCatalog.Sort.POPULAR -> 8 to 2
|
||||
WowAddonCatalog.Sort.UPDATED -> 16 to 2
|
||||
WowAddonCatalog.Sort.NAME -> 1 to 1
|
||||
WowAddonCatalog.Sort.DOWNLOADS -> 7 to 2
|
||||
}
|
||||
|
||||
internal fun searchRequest(guid: String, text: String, sort: WowAddonCatalog.Sort, page: Int): JSONObject {
|
||||
val (column, order) = sortOf(sort)
|
||||
return JSONObject().put("gameId", WOW).put("searchText", text.trim()).put("page", page + 1)
|
||||
.put("sortColumn", column).put("sortOrder", order).put("gameInstanceGuid", guid)
|
||||
}
|
||||
|
||||
internal fun installRequest(guid: String, projectId: String): JSONObject =
|
||||
JSONObject().put("instanceId", guid).put("projectId", projectId.toLong()).put("categoryClassId", 1)
|
||||
.put("installLatestFile", true).put("installSource", 4)
|
||||
|
||||
private const val SERVICES = """(() => {
|
||||
const seen = new Set(), out = {};
|
||||
const walk = (o, d) => {
|
||||
if (!o || typeof o !== 'object' || seen.has(o) || d > 4) return;
|
||||
seen.add(o);
|
||||
if (typeof o._nameOfService === 'string') { out[o._nameOfService] = o; return; }
|
||||
let keys; try { keys = Object.keys(o); } catch (e) { return; }
|
||||
for (const k of keys.slice(0, 4000)) {
|
||||
let v; try { v = o[k]; } catch (e) { continue; }
|
||||
if (v instanceof Map) { for (const x of v.values()) walk(x, d + 1); } else walk(v, d + 1);
|
||||
}
|
||||
};
|
||||
walk(window, 0);
|
||||
return out;
|
||||
})()"""
|
||||
|
||||
internal fun expression(service: String, method: String, args: JSONArray?, pick: String = "r => r"): String {
|
||||
val name = JSONObject.quote(method)
|
||||
val run = if (args == null) "true" else "($pick)(await s[$name](...$args))"
|
||||
val inner = "(async () => { const s = $SERVICES[${JSONObject.quote(service)}]; " +
|
||||
"if (!s || typeof s[$name] !== 'function') return { missing: true }; " +
|
||||
"return { value: $run }; })()"
|
||||
return "(() => { const w = require('electron').BrowserWindow.getAllWindows()" +
|
||||
".find(w => !w.isDestroyed() && w.webContents.getURL().includes('desktop.html')); " +
|
||||
"if (!w) return JSON.stringify({ missing: true }); " +
|
||||
"return w.webContents.executeJavaScript(${JSONObject.quote(inner)}).then(v => JSON.stringify(v)); })()"
|
||||
}
|
||||
|
||||
internal fun unwrap(answer: JSONObject): Any? {
|
||||
if (!answer.optBoolean("ok")) {
|
||||
val error = answer.optJSONObject("error")
|
||||
throw Failure(error?.optString("message")?.takeIf { it.isNotBlank() } ?: answer.toString(), error?.optString("code")?.takeIf { it.isNotBlank() })
|
||||
}
|
||||
val text = answer.opt("value") as? String ?: throw Failure("CurseForge gave no answer")
|
||||
val reply = JSONObject(text)
|
||||
if (reply.optBoolean("missing")) throw Failure("CurseForge is not ready")
|
||||
return reply.opt("value")
|
||||
}
|
||||
|
||||
internal fun parseSearch(value: Any?): WowAddonCatalog.Page {
|
||||
val reply = value as? JSONObject ?: throw Failure("CurseForge search failed")
|
||||
if (reply.has("success") && !reply.optBoolean("success")) throw Failure("CurseForge search failed")
|
||||
val mods = reply.optJSONArray("mods") ?: JSONArray()
|
||||
val items = (0 until mods.length()).mapNotNull { mods.optJSONObject(it) }.mapNotNull { mod ->
|
||||
val id = mod.optLong("id", 0L).takeIf { it > 0 } ?: return@mapNotNull null
|
||||
val name = mod.optString("name").takeIf { it.isNotBlank() } ?: return@mapNotNull null
|
||||
val author = mod.optJSONObject("primaryAuthor")?.optString("name")?.takeIf { it.isNotBlank() }
|
||||
?: mod.optJSONArray("authors")?.optJSONObject(0)?.optString("name").orEmpty()
|
||||
val date = mod.optJSONObject("updateVersion")?.optString("fileDate")?.takeIf { it.isNotBlank() }
|
||||
?: mod.optString("projectLatestReleaseDate")
|
||||
WowAddonCatalog.Addon(
|
||||
id.toString(), name, author, "", mod.optLong("downloads", 0L).coerceAtLeast(0L),
|
||||
runCatching { Instant.parse(date).toEpochMilli() }.getOrDefault(0L),
|
||||
mod.optString("thumbnailUrl").takeIf { WowAddonCatalog.isHttps(it) },
|
||||
)
|
||||
}
|
||||
val page = reply.optJSONObject("pagination")
|
||||
val more = page != null && page.optInt("index") + page.optInt("resultCount") < page.optInt("totalCount")
|
||||
return WowAddonCatalog.Page(items, more)
|
||||
}
|
||||
|
||||
internal fun samePath(a: String, b: String) = a.trimEnd('/') == b.trimEnd('/')
|
||||
|
||||
internal fun instanceFor(instances: Any?, flavorDir: String, detected: String?): String? {
|
||||
val list = instances as? JSONArray
|
||||
val match = list?.let { all ->
|
||||
(0 until all.length()).mapNotNull { all.optJSONObject(it) }
|
||||
.firstOrNull { samePath(it.optString("installPath"), flavorDir) }?.optString("guid")
|
||||
}
|
||||
if (list != null && list.length() > 0) return match?.takeIf { it.isNotBlank() }
|
||||
return detected?.takeIf { it.isNotBlank() }
|
||||
}
|
||||
|
||||
internal fun parseProjects(value: Any?): List<Project> {
|
||||
val list = value as? JSONArray ?: return emptyList()
|
||||
return (0 until list.length()).mapNotNull { list.optJSONObject(it) }.mapNotNull { p ->
|
||||
val id = p.optString("id").takeIf { it.isNotBlank() && it != "null" } ?: return@mapNotNull null
|
||||
val folders = p.optJSONArray("folders")?.let { f -> (0 until f.length()).mapNotNull { f.optString(it).takeIf(String::isNotBlank) } }.orEmpty()
|
||||
Project(id, p.optString("installedModId"), folders, p.optInt("status") == OUT_OF_DATE && !p.optBoolean("locked"))
|
||||
}
|
||||
}
|
||||
|
||||
internal fun owner(projects: List<Project>, folder: String): Project? =
|
||||
projects.firstOrNull { project -> project.folders.any { it.equals(folder, ignoreCase = true) } }
|
||||
|
||||
internal fun byFolder(projects: List<Project>): Map<String, Project> = projects.flatMap { project -> project.folders.map { it.lowercase() to project } }.toMap()
|
||||
|
||||
internal fun onDisk(projects: List<Project>, addOns: File): List<Project> {
|
||||
val names = addOns.listFiles().orEmpty().filter { it.isDirectory && !it.name.startsWith(".") }.map { it.name.lowercase() }.toSet()
|
||||
return projects.filter { project -> WowAddons.present(project.folders) { it.lowercase() in names } }
|
||||
}
|
||||
|
||||
internal var guest: (Context, List<String>, AtomicBoolean?, (String) -> Unit) -> Int = { context, argv, cancelled, onLine ->
|
||||
GuestCommand.run(context, argv, logName = "curseforge", extraBinds = BattleNetInstall.binds(context), fastPath = true,
|
||||
cancelled = cancelled, redact = INSPECTOR, onLine = onLine)
|
||||
}
|
||||
|
||||
private val holds = ConcurrentHashMap<String, AtomicBoolean>()
|
||||
|
||||
private fun lines(context: Context, argv: List<String>): List<String> {
|
||||
val out = ArrayList<String>()
|
||||
guest(context, argv, null) { out += it }
|
||||
return out
|
||||
}
|
||||
|
||||
private fun call(context: Context, inspector: String, service: String, method: String, args: JSONArray?, timeoutMs: Long, pick: String = "r => r"): Any? =
|
||||
unwrap(lastJson(lines(context, evalArgv(inspector, expression(service, method, args, pick), timeoutMs))) ?: throw Failure("CurseForge gave no answer"))
|
||||
|
||||
private sealed class Launch {
|
||||
class Url(val inspector: String) : Launch()
|
||||
class Exit(val code: Int) : Launch()
|
||||
}
|
||||
|
||||
private fun launch(context: Context, dir: String, hold: AtomicBoolean): Launch? {
|
||||
val first = LinkedBlockingQueue<Launch>()
|
||||
Thread({
|
||||
val code = runCatching {
|
||||
guest(context, helperArgv("start", dir), hold) { line -> inspectorUrl(line)?.let { first.offer(Launch.Url(it)) } }
|
||||
}.getOrDefault(-1)
|
||||
first.offer(Launch.Exit(code))
|
||||
}, "curseforge-headless").apply { isDaemon = true; start() }
|
||||
return first.poll(READY_MS, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
fun start(context: Context, app: UserApps.App, hold: AtomicBoolean): Started {
|
||||
val dir = dir(app) ?: return Started(Start.FAILED)
|
||||
if (hold.get()) return Started(Start.FAILED)
|
||||
holds.put(dir, hold)?.takeIf { it !== hold }?.let {
|
||||
it.set(true)
|
||||
runCatching { lines(context, helperArgv("stop", dir)) }
|
||||
}
|
||||
val inspector = when (val first = launch(context, dir, hold)) {
|
||||
is Launch.Url -> first.inspector
|
||||
is Launch.Exit -> if (startState(first.code) == Start.BUSY) {
|
||||
holds.remove(dir, hold)
|
||||
return Started(Start.BUSY)
|
||||
} else null
|
||||
null -> null
|
||||
}
|
||||
if (inspector == null) {
|
||||
stop(context, app, null, hold)
|
||||
return Started(Start.FAILED)
|
||||
}
|
||||
val deadline = System.currentTimeMillis() + READY_MS
|
||||
while (System.currentTimeMillis() < deadline && !hold.get()) {
|
||||
if (runCatching { call(context, inspector, "InstalledProjectsAppService", "installAddon", null, 10_000) }.isSuccess) return Started(Start.READY, inspector)
|
||||
Thread.sleep(1_000)
|
||||
}
|
||||
stop(context, app, inspector, hold)
|
||||
return Started(Start.FAILED)
|
||||
}
|
||||
|
||||
fun stop(context: Context, app: UserApps.App, inspector: String?, hold: AtomicBoolean) {
|
||||
val dir = dir(app) ?: return
|
||||
if (holds[dir] !== hold) {
|
||||
hold.set(true)
|
||||
return
|
||||
}
|
||||
if (inspector != null) runCatching { call(context, inspector, "CoreService", "shutdown", JSONArray(), 30_000, "r => true") }
|
||||
hold.set(true)
|
||||
if (holds.remove(dir, hold)) runCatching { lines(context, helperArgv("stop", dir)) }
|
||||
}
|
||||
|
||||
private fun connect(context: Context, inspector: String) {
|
||||
call(context, inspector, "CoreService", "connect", JSONArray(), 120_000, "r => true")
|
||||
}
|
||||
|
||||
fun instance(context: Context, inspector: String, root: String, flavorDir: String): String {
|
||||
connect(context, inspector)
|
||||
val detected = call(context, inspector, "GameDetectionAppService", "detectGameFromPath", JSONArray().put(root).put(WOW), 60_000) as? JSONObject
|
||||
val instances = call(context, inspector, "GameAppService", "getGameInstances", JSONArray().put(WOW), 30_000,
|
||||
"r => (r || []).map(i => ({ guid: i.guid, installPath: i.installPath }))")
|
||||
return instanceFor(instances, flavorDir, detected?.optString("gameInstanceGuid")) ?: throw Failure("CurseForge did not find $flavorDir")
|
||||
}
|
||||
|
||||
fun search(context: Context, inspector: String, guid: String, text: String, sort: WowAddonCatalog.Sort, page: Int): WowAddonCatalog.Page =
|
||||
parseSearch(call(context, inspector, "ProjectAppService", "search", JSONArray().put(searchRequest(guid, text, sort, page)), 60_000))
|
||||
|
||||
fun projects(context: Context, inspector: String, guid: String, rescan: Boolean = false): List<Project> {
|
||||
connect(context, inspector)
|
||||
if (rescan) call(context, inspector, "GameDetectionAppService", "scanGameInstance", JSONArray().put(guid), 120_000)
|
||||
return parseProjects(call(context, inspector, "InstalledProjectsAppService", "getProjects", JSONArray().put(guid), 30_000, PROJECTS))
|
||||
}
|
||||
|
||||
private const val PROJECTS = "r => (r || []).map(p => ({ id: String(p.id), installedModId: p.installedModId, status: p.status, " +
|
||||
"locked: !!(p.installedVersion && p.installedVersion.isLocked), " +
|
||||
"folders: ((p.installedVersion && p.installedVersion.addonFolders) || []).map(f => f.name) }))"
|
||||
|
||||
private fun settle(context: Context, inspector: String, guid: String, done: (List<Project>) -> Boolean): Boolean {
|
||||
val deadline = System.currentTimeMillis() + INSTALL_MS
|
||||
while (System.currentTimeMillis() < deadline) {
|
||||
val listed = runCatching { projects(context, inspector, guid) }
|
||||
val error = listed.exceptionOrNull()
|
||||
if (error is Failure && error.gone) throw error
|
||||
listed.getOrNull()?.let { if (done(it)) return true }
|
||||
Thread.sleep(1_000)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun install(context: Context, inspector: String, guid: String, projectId: String): Boolean {
|
||||
connect(context, inspector)
|
||||
if (call(context, inspector, "InstalledProjectsAppService", "installAddon", JSONArray().put(installRequest(guid, projectId)), 300_000) != true) return false
|
||||
return settle(context, inspector, guid) { list -> list.any { it.id == projectId } }
|
||||
}
|
||||
|
||||
fun update(context: Context, inspector: String, guid: String, projectId: String): Boolean {
|
||||
connect(context, inspector)
|
||||
if (call(context, inspector, "InstalledProjectsAppService", "updateMod", JSONArray().put(guid).put(projectId.toLong()), 300_000) != true) return false
|
||||
return settle(context, inspector, guid) { list -> list.any { it.id == projectId && !it.update } }
|
||||
}
|
||||
|
||||
fun uninstall(context: Context, inspector: String, guid: String, project: Project): Boolean {
|
||||
connect(context, inspector)
|
||||
val failed = call(context, inspector, "InstalledProjectsAppService", "deleteMods", JSONArray().put(guid).put(JSONArray().put(project.installedModId)), 120_000) as? JSONArray
|
||||
if (failed == null || failed.length() > 0) return false
|
||||
return settle(context, inspector, guid) { list -> list.none { it.id == project.id } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import java.io.File
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
object DeckyStore {
|
||||
private const val TAG = "DeckyStore"
|
||||
private const val LISTING = "https://plugins.deckbrew.xyz/plugins"
|
||||
private const val ARTIFACTS = "https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/"
|
||||
|
||||
data class Version(val name: String, val hash: String)
|
||||
data class Plugin(val name: String, val author: String, val description: String, val tags: List<String>, val downloads: Long, val imageUrl: String, val versions: List<Version>) {
|
||||
val latest: Version? get() = versions.firstOrNull()
|
||||
}
|
||||
data class Installed(val name: String, val folder: String, val author: String, val version: String)
|
||||
|
||||
fun parseListing(body: String): List<Plugin> {
|
||||
val array = JSONArray(body)
|
||||
return (0 until array.length()).mapNotNull { i ->
|
||||
val row = array.optJSONObject(i) ?: return@mapNotNull null
|
||||
val name = row.optString("name").takeIf { it.isNotBlank() } ?: return@mapNotNull null
|
||||
val versions = row.optJSONArray("versions")?.let { list ->
|
||||
(0 until list.length()).mapNotNull { v ->
|
||||
val version = list.optJSONObject(v) ?: return@mapNotNull null
|
||||
val hash = version.optString("hash")
|
||||
if (!hash.matches(Regex("(?i)[0-9a-f]{64}"))) null else Version(version.optString("name"), hash.lowercase())
|
||||
}
|
||||
}.orEmpty()
|
||||
if (versions.isEmpty()) return@mapNotNull null
|
||||
val tags = row.optJSONArray("tags")?.let { list -> (0 until list.length()).map { list.optString(it) } }.orEmpty()
|
||||
val downloads = row.optJSONArray("versions")?.let { list -> (0 until list.length()).sumOf { list.optJSONObject(it)?.optLong("downloads") ?: 0L } } ?: 0L
|
||||
val image = row.optString("image_url").takeIf { it.startsWith("https://") }.orEmpty()
|
||||
Plugin(name, row.optString("author"), row.optString("description"), tags, downloads, image, versions)
|
||||
}
|
||||
}
|
||||
|
||||
fun fetch(): List<Plugin>? {
|
||||
val body = Downloader.downloadString(LISTING) ?: return null
|
||||
return runCatching { parseListing(body) }.onFailure { Log.w(TAG, "store listing", it) }.getOrNull()
|
||||
}
|
||||
|
||||
fun pluginsDir(context: Context) = File(LinuxRuntime.rootDir(context), "root/homebrew/plugins")
|
||||
|
||||
fun installed(context: Context): List<Installed> =
|
||||
pluginsDir(context).listFiles().orEmpty()
|
||||
.filter { it.isDirectory && !it.name.startsWith(".droiddeck-") }
|
||||
.mapNotNull { folder ->
|
||||
runCatching {
|
||||
val meta = JSONObject(File(folder, "plugin.json").readText())
|
||||
val version = runCatching { JSONObject(File(folder, "package.json").readText()).optString("version") }.getOrDefault("")
|
||||
Installed(meta.getString("name"), folder.name, meta.optString("author"), version)
|
||||
}.getOrNull()
|
||||
}
|
||||
.sortedBy { it.name.lowercase() }
|
||||
|
||||
fun updateAvailable(installed: Installed, plugin: Plugin?): Boolean {
|
||||
val latest = plugin?.latest?.name ?: return false
|
||||
return installed.version.isNotEmpty() && latest != installed.version
|
||||
}
|
||||
|
||||
fun install(context: Context, plugin: Plugin, version: Version, progress: (String, Int) -> Unit): String? {
|
||||
if (SessionState.running) return context.getString(R.string.deckymgr_stop_session_plugin)
|
||||
if (DeckyManager.installed(context) == null) return context.getString(R.string.deckymgr_loader_required)
|
||||
val cache = File(context.cacheDir, "decky-store").apply { mkdirs() }
|
||||
val zip = File(cache, "${version.hash}.zip")
|
||||
try {
|
||||
val label = context.getString(R.string.decky_store_downloading, plugin.name)
|
||||
progress(label, -1)
|
||||
val ok = Downloader.downloadFile("$ARTIFACTS${version.hash}.zip", zip, true, version.hash) { fraction ->
|
||||
progress(label, if (fraction < 0) -1 else (fraction * 100).toInt().coerceIn(0, 100))
|
||||
}
|
||||
if (!ok) return context.getString(R.string.decky_store_download_failed, plugin.name)
|
||||
return DeckyManager.installPluginZip(context, zip, progress)
|
||||
} finally {
|
||||
zip.delete()
|
||||
}
|
||||
}
|
||||
|
||||
fun remove(context: Context, plugin: Installed): String? {
|
||||
if (SessionState.running) return context.getString(R.string.deckymgr_stop_session_plugin)
|
||||
val plugins = pluginsDir(context)
|
||||
val folder = File(plugins, plugin.folder)
|
||||
if (folder.parentFile?.canonicalFile != plugins.canonicalFile) return context.getString(R.string.decky_store_remove_failed)
|
||||
if (!folder.deleteRecursively()) return context.getString(R.string.decky_store_remove_failed)
|
||||
val settings = File(plugins.parentFile, "settings/loader.json")
|
||||
runCatching {
|
||||
val json = JSONObject(settings.readText())
|
||||
for (key in listOf("pluginOrder", "frozenPlugins", "hiddenPlugins", "disabled_plugins")) {
|
||||
val values = json.optJSONArray(key) ?: continue
|
||||
json.put(key, JSONArray((0 until values.length()).map { values.get(it) }.filter { it != plugin.name }))
|
||||
}
|
||||
settings.writeText(json.toString(4))
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -14,20 +14,22 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
object GuestCommand {
|
||||
fun run(context: Context, argv: List<String>, fakeRoot: Boolean = false, logName: String? = null,
|
||||
linkDir: File? = null, extraBinds: List<String>? = null, fastPath: Boolean = false, cancelled: AtomicBoolean? = null,
|
||||
onLine: (String) -> Unit): Int {
|
||||
redact: Regex? = null, onLine: (String) -> Unit): Int {
|
||||
val log = logName?.let {
|
||||
try {
|
||||
File(File(LinuxRuntime.logDir(context), SessionPaths.TOOLS_DIR).apply { mkdirs() }, "$it.log").printWriter()
|
||||
} catch (e: Exception) { null }
|
||||
}
|
||||
log?.println("== ${java.util.Date()} ${argv.joinToString(" ")}")
|
||||
log?.println("== ${java.util.Date()} ${redacted(argv.joinToString(" "), redact)}")
|
||||
try {
|
||||
return runLogged(context, argv, fakeRoot, linkDir, extraBinds, fastPath, cancelled) { line -> log?.println(line); log?.flush(); onLine(line) }
|
||||
return runLogged(context, argv, fakeRoot, linkDir, extraBinds, fastPath, cancelled) { line -> log?.println(redacted(line, redact)); log?.flush(); onLine(line) }
|
||||
} finally {
|
||||
log?.close()
|
||||
}
|
||||
}
|
||||
|
||||
internal fun redacted(text: String, redact: Regex?): String = redact?.replace(text, "<redacted>") ?: text
|
||||
|
||||
private fun runLogged(context: Context, argv: List<String>, fakeRoot: Boolean, linkDir: File?, extraBinds: List<String>?,
|
||||
fastPath: Boolean, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
|
||||
@@ -29,6 +29,7 @@ object WowAddonCatalog {
|
||||
val downloads: Long,
|
||||
val updated: Long,
|
||||
val thumb: String?,
|
||||
val folders: List<String> = emptyList(),
|
||||
)
|
||||
|
||||
class Page(val items: List<Addon>, val more: Boolean)
|
||||
@@ -93,8 +94,7 @@ object WowAddonCatalog {
|
||||
Client(folder, version?.let(::flavorOf) ?: folderFamily(folder))
|
||||
|
||||
fun client(target: WowAddons.Target): Client {
|
||||
val dir = target.addOns.parentFile?.parentFile
|
||||
return client(target.flavor, dir?.let(::clientVersion))
|
||||
return client(target.flavor, WowAddons.flavorDir(target)?.let(::clientVersion))
|
||||
}
|
||||
|
||||
internal fun flavorMatches(flavors: Set<String>?, family: String?): Boolean =
|
||||
@@ -115,9 +115,11 @@ object WowAddonCatalog {
|
||||
}
|
||||
val thumbs = o.optJSONArray("UIIMG_Thumbs")
|
||||
val thumb = if (thumbs != null && thumbs.length() > 0) thumbs.optString(0).ifEmpty { null } else null
|
||||
val dirs = o.optJSONArray("UIDir")
|
||||
val folders = if (dirs == null) emptyList() else (0 until dirs.length()).map { dirs.optString(it).trim() }.filter { it.isNotEmpty() }
|
||||
val addon = Addon(
|
||||
id, o.optString("UIName"), o.optString("UIAuthorName"), o.optString("UIVersion"),
|
||||
o.optString("UIDownloadTotal").toLongOrNull() ?: 0L, o.optLong("UIDate"), thumb,
|
||||
o.optString("UIDownloadTotal").toLongOrNull() ?: 0L, o.optLong("UIDate"), thumb, folders,
|
||||
)
|
||||
out.add(Entry(addon, o.optString("UICATID"), flavors, o.optString("UIDownloadMonthly").toLongOrNull() ?: 0L))
|
||||
}
|
||||
@@ -242,9 +244,32 @@ object WowAddonCatalog {
|
||||
return details.version
|
||||
}
|
||||
|
||||
internal fun sameVersion(a: String, b: String): Boolean {
|
||||
fun norm(v: String) = v.trim().removePrefix("v").removePrefix("V").trim().lowercase()
|
||||
return norm(a) == norm(b)
|
||||
private fun normVersion(v: String) = v.trim().removePrefix("v").removePrefix("V").trim().lowercase()
|
||||
|
||||
internal fun sameVersion(a: String, b: String): Boolean = normVersion(a) == normVersion(b)
|
||||
|
||||
private val NUMERIC_VERSION = Regex("""^(\d+(?:\.\d+)*)(.*)$""")
|
||||
|
||||
private fun numericVersion(v: String): Pair<List<Long>, String>? {
|
||||
val match = NUMERIC_VERSION.matchEntire(normVersion(v)) ?: return null
|
||||
val parts = match.groupValues[1].split('.').map { it.toLongOrNull() ?: return null }
|
||||
return parts to match.groupValues[2]
|
||||
}
|
||||
|
||||
internal fun newer(have: String, latest: String): Boolean? {
|
||||
val (a, aRest) = numericVersion(have) ?: return null
|
||||
val (b, bRest) = numericVersion(latest) ?: return null
|
||||
for (i in 0 until maxOf(a.size, b.size)) {
|
||||
val x = a.getOrElse(i) { 0L }
|
||||
val y = b.getOrElse(i) { 0L }
|
||||
if (x != y) return y > x
|
||||
}
|
||||
return if (aRest == bRest) false else null
|
||||
}
|
||||
|
||||
internal fun offersUpdate(have: String?, latest: String, sameSource: Boolean): Boolean {
|
||||
if (have.isNullOrBlank() || latest.isBlank() || sameVersion(have, latest)) return false
|
||||
return newer(have, latest) ?: sameSource
|
||||
}
|
||||
|
||||
internal fun findUpdates(entries: List<Entry>, installed: List<WowAddons.Installed>): Map<String, Addon> {
|
||||
@@ -254,7 +279,7 @@ object WowAddonCatalog {
|
||||
val id = item.wowiId ?: return@mapNotNull null
|
||||
val version = item.version ?: return@mapNotNull null
|
||||
val latest = byId[id]?.addon?.takeIf { it.summary.isNotBlank() } ?: return@mapNotNull null
|
||||
if (sameVersion(version, latest.summary) || !seen.add(id)) null else item.name to latest
|
||||
if (!offersUpdate(version, latest.summary, sameSource = true) || !seen.add(id)) null else item.name to latest
|
||||
}.toMap()
|
||||
}
|
||||
|
||||
|
||||
@@ -28,15 +28,27 @@ object WowAddons {
|
||||
|
||||
class TooLarge : IOException()
|
||||
|
||||
fun changed() {
|
||||
imports++
|
||||
}
|
||||
|
||||
fun flavorDir(target: Target): File? = target.addOns.parentFile?.parentFile
|
||||
|
||||
fun root(target: Target): File? = flavorDir(target)?.parentFile
|
||||
|
||||
class Target(val flavor: String, val addOns: File)
|
||||
|
||||
class Addon(val name: String, val root: String)
|
||||
|
||||
class Installed(val name: String, val version: String?, val wowiId: String?)
|
||||
class Installed(val name: String, val version: String?, val wowiId: String?, val curseId: String? = null)
|
||||
|
||||
class Origin(val id: String, val version: String)
|
||||
|
||||
private const val ORIGINS = ".droiddeck-sources"
|
||||
private const val TOC_VERSION = "Version"
|
||||
private const val TOC_WOWI_ID = "X-WoWI-ID"
|
||||
private const val TOC_CURSE_ID = "X-Curse-Project-ID"
|
||||
private val TOC_KEYS = setOf(TOC_VERSION, TOC_WOWI_ID, TOC_CURSE_ID)
|
||||
|
||||
internal const val MAX_EXPANDED_BYTES = 4L * 1024 * 1024 * 1024
|
||||
|
||||
@@ -61,33 +73,52 @@ object WowAddons {
|
||||
target.addOns.listFiles().orEmpty().filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
.map { it.name }.sortedBy { it.lowercase() }
|
||||
|
||||
fun present(folders: List<String>, exists: (String) -> Boolean): Boolean = folders.isNotEmpty() && folders.all(exists)
|
||||
|
||||
fun folder(addOns: File, name: String): File? {
|
||||
val dirs = addOns.listFiles().orEmpty().filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
return dirs.firstOrNull { it.name == name } ?: dirs.firstOrNull { it.name.equals(name, ignoreCase = true) }
|
||||
}
|
||||
|
||||
fun details(target: Target): List<Installed> {
|
||||
val origins = origins(target)
|
||||
return installed(target).map { name ->
|
||||
val toc = toc(File(target.addOns, name))
|
||||
val origin = origins[name]
|
||||
Installed(name, origin?.version ?: toc["Version"], origin?.id ?: toc["X-WoWI-ID"])
|
||||
Installed(name, origin?.version ?: toc[TOC_VERSION], origin?.id ?: toc[TOC_WOWI_ID], toc[TOC_CURSE_ID])
|
||||
}
|
||||
}
|
||||
|
||||
internal fun tocFields(text: String): Map<String, String> {
|
||||
internal fun tocFields(lines: Sequence<String>, keys: Set<String> = TOC_KEYS): Map<String, String> {
|
||||
val out = LinkedHashMap<String, String>()
|
||||
for (raw in text.lineSequence()) {
|
||||
for (raw in lines) {
|
||||
val line = raw.trim().removePrefix("\uFEFF")
|
||||
if (!line.startsWith("##") || ':' !in line) continue
|
||||
val key = line.removePrefix("##").substringBefore(':').trim()
|
||||
if (key !in keys || key in out) continue
|
||||
val value = line.substringAfter(':').trim()
|
||||
if (key.isNotEmpty() && value.isNotEmpty() && '@' !in value) out.putIfAbsent(key, value)
|
||||
if (value.isNotEmpty() && '@' !in value) out[key] = value
|
||||
if (out.size == keys.size) break
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
private fun toc(folder: File): Map<String, String> {
|
||||
val tocs = folder.listFiles().orEmpty().filter { it.isFile && it.name.endsWith(".toc", ignoreCase = true) }
|
||||
val main = tocs.firstOrNull { it.name.dropLast(4).equals(folder.name, ignoreCase = true) }
|
||||
?: tocs.firstOrNull { it.name.dropLast(4).replace(SUFFIX, "").equals(folder.name, ignoreCase = true) }
|
||||
?: tocs.minByOrNull { it.name.length } ?: return emptyMap()
|
||||
return runCatching { tocFields(main.readText()) }.getOrDefault(emptyMap())
|
||||
val tocs = folder.listFiles().orEmpty().filter { it.isFile && it.name.endsWith(".toc", ignoreCase = true) }.sortedWith(
|
||||
compareBy<File>(
|
||||
{ !it.name.dropLast(4).equals(folder.name, ignoreCase = true) },
|
||||
{ !it.name.dropLast(4).replace(SUFFIX, "").equals(folder.name, ignoreCase = true) },
|
||||
{ it.name.length },
|
||||
{ it.name },
|
||||
),
|
||||
)
|
||||
val out = LinkedHashMap<String, String>()
|
||||
for (file in tocs) {
|
||||
if (out.size == TOC_KEYS.size) break
|
||||
val missing = TOC_KEYS - out.keys
|
||||
runCatching { file.bufferedReader().useLines { tocFields(it, missing) } }.getOrNull()?.let(out::putAll)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
internal fun parseOrigins(text: String): Map<String, Origin> = text.lineSequence().mapNotNull { line ->
|
||||
|
||||
@@ -180,6 +180,8 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-flatpak-run" to "usr/local/bin/droiddeck-flatpak-run",
|
||||
"usr/local/bin/droiddeck-appimage-run" to "usr/local/bin/droiddeck-appimage-run",
|
||||
"usr/local/bin/droiddeck-appimage-exec" to "usr/local/bin/droiddeck-appimage-exec",
|
||||
"usr/local/bin/droiddeck-curseforge" to "usr/local/bin/droiddeck-curseforge",
|
||||
"usr/local/bin/droiddeck-headless" to "usr/local/bin/droiddeck-headless",
|
||||
"usr/local/bin/droiddeck-script-run" to "usr/local/bin/droiddeck-script-run",
|
||||
"usr/local/bin/droiddeck-open" to "usr/local/bin/droiddeck-open",
|
||||
"usr/local/bin/droiddeck-proton-run" to "usr/local/bin/droiddeck-proton-run",
|
||||
|
||||
@@ -1011,7 +1011,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("prootNoSeccomp", on).apply()
|
||||
}
|
||||
|
||||
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", false)
|
||||
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", true)
|
||||
|
||||
fun setNativeUserland(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("nativeUserland", on).apply()
|
||||
|
||||
@@ -330,7 +330,7 @@ public final class GogDownloadManager {
|
||||
rc = GuestCommand.INSTANCE.run(ctx, Arrays.asList(
|
||||
"/usr/local/bin/droiddeck-innoextract", "--gog", "--silent",
|
||||
"-d", guestDir, guestSetup),
|
||||
false, "gog-innoextract", null, null, false, cancelled,
|
||||
false, "gog-innoextract", null, null, false, cancelled, null,
|
||||
line -> { cb.onLog("gog innoextract: " + line); return kotlin.Unit.INSTANCE; });
|
||||
} catch (Exception e) {
|
||||
throw new InstallException("The installer could not be extracted: " + e.getClass().getSimpleName());
|
||||
|
||||
@@ -360,7 +360,7 @@ internal fun AppDialog(
|
||||
.then(if (scrollable) Modifier.verticalScroll(scrollState) else Modifier)
|
||||
.padding(horizontal = 18.dp, vertical = 16.dp),
|
||||
) {
|
||||
content()
|
||||
androidx.compose.runtime.CompositionLocalProvider(LocalRevealChecked provides true) { content() }
|
||||
if (side != null && !beside) side()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.GridItemSpan
|
||||
import androidx.compose.foundation.lazy.grid.LazyGridState
|
||||
@@ -28,6 +27,7 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
@@ -37,6 +37,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.withFrameNanos
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -53,6 +54,7 @@ import androidx.compose.ui.input.InputMode
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalInputModeManager
|
||||
import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
@@ -60,16 +62,28 @@ import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.CurseForgeApp
|
||||
import com.droiddeck.launcher.runtime.UserApps
|
||||
import com.droiddeck.launcher.runtime.WowAddonCatalog
|
||||
import com.droiddeck.launcher.runtime.WowAddons
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
private class AddonResults {
|
||||
val items = mutableStateListOf<WowAddonCatalog.Addon>()
|
||||
@@ -79,12 +93,157 @@ private class AddonResults {
|
||||
var more by mutableStateOf(false)
|
||||
}
|
||||
|
||||
private enum class AddonStatus { INSTALL, UPDATE, INSTALLED }
|
||||
internal enum class AddonStatus { INSTALL, UPDATE, INSTALLED }
|
||||
|
||||
private enum class AddonSource { WOWI, CURSE }
|
||||
|
||||
internal class CurseState(val notice: Int? = null) : Exception()
|
||||
|
||||
internal class CurseLink(val app: UserApps.App) {
|
||||
class Linked(val inspector: String, val guid: String)
|
||||
|
||||
private val lock = Object()
|
||||
private val work = SupervisorJob()
|
||||
@Volatile private var closed = false
|
||||
@Volatile private var hold: AtomicBoolean? = null
|
||||
@Volatile private var inspector: String? = null
|
||||
private val guids = HashMap<String, String>()
|
||||
private val scanLock = Object()
|
||||
private val scans = HashMap<String, Pair<Any, List<CurseForgeApp.Project>>>()
|
||||
var generation by mutableIntStateOf(0)
|
||||
private set
|
||||
|
||||
fun refresh() {
|
||||
generation++
|
||||
}
|
||||
|
||||
fun installed(context: Context, target: WowAddons.Target, key: Any): List<CurseForgeApp.Project> = CurseForgeApp.onDisk(
|
||||
synchronized(scanLock) {
|
||||
scans[target.addOns.path]?.takeIf { it.first == key }?.second
|
||||
?: call(context, target) { CurseForgeApp.projects(context, it.inspector, it.guid, rescan = true) }.also {
|
||||
scans[target.addOns.path] = key to it
|
||||
report(target, it)
|
||||
}
|
||||
},
|
||||
target.addOns,
|
||||
)
|
||||
|
||||
fun marks(context: Context, target: WowAddons.Target, key: Any): Map<String, String?> =
|
||||
runCatching { installed(context, target, key).associate { it.id to curseMark(it) } }.getOrElse { lastReported(target) }
|
||||
|
||||
fun <T> call(context: Context, target: WowAddons.Target, launch: Boolean = true, block: (Linked) -> T): T {
|
||||
val linked = synchronized(lock) { link(context, target, launch) }
|
||||
try {
|
||||
return block(linked)
|
||||
} catch (e: CurseForgeApp.Failure) {
|
||||
if (e.gone) synchronized(lock) {
|
||||
if (inspector == linked.inspector) {
|
||||
inspector = null
|
||||
guids.clear()
|
||||
current.compareAndSet(this, null)
|
||||
}
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
private fun link(context: Context, target: WowAddons.Target, launch: Boolean): Linked {
|
||||
if (closed) throw CurseState()
|
||||
val url = inspector ?: run {
|
||||
if (!launch) throw CurseState()
|
||||
val hold = AtomicBoolean(false)
|
||||
this.hold = hold
|
||||
if (closed) throw CurseState()
|
||||
val done = CurseForgeApp.start(context, app, hold)
|
||||
when (done.state) {
|
||||
CurseForgeApp.Start.READY -> {
|
||||
inspector = done.inspector
|
||||
if (!closed) current.set(this)
|
||||
done.inspector ?: throw CurseState()
|
||||
}
|
||||
CurseForgeApp.Start.BUSY -> throw CurseState(R.string.addons_curse_busy)
|
||||
else -> throw CurseState()
|
||||
}
|
||||
}
|
||||
if (closed) throw CurseState()
|
||||
guids[target.addOns.path]?.let { return Linked(url, it) }
|
||||
val root = WowAddons.root(target)?.let { AddedGames.guestPath(context, it) } ?: throw CurseState()
|
||||
val flavor = WowAddons.flavorDir(target)?.let { AddedGames.guestPath(context, it) } ?: throw CurseState()
|
||||
val guid = CurseForgeApp.instance(context, url, root, flavor)
|
||||
guids[target.addOns.path] = guid
|
||||
return Linked(url, guid)
|
||||
}
|
||||
|
||||
fun uninstall(context: Context, target: WowAddons.Target, folder: String): Boolean = call(context, target, launch = false) { linked ->
|
||||
val projects = CurseForgeApp.onDisk(CurseForgeApp.projects(context, linked.inspector, linked.guid), target.addOns)
|
||||
val project = CurseForgeApp.owner(projects, folder) ?: return@call false
|
||||
if (!CurseForgeApp.uninstall(context, linked.inspector, linked.guid, project)) throw CurseState()
|
||||
true
|
||||
}
|
||||
|
||||
internal val stopped: Job get() = work
|
||||
|
||||
fun close(context: Context): Job {
|
||||
closed = true
|
||||
current.compareAndSet(this, null)
|
||||
val launch = hold
|
||||
return CoroutineScope(work + Dispatchers.IO).launch {
|
||||
if (launch != null) CurseForgeApp.stop(context, app, inspector, launch)
|
||||
synchronized(lock) {
|
||||
hold = null
|
||||
inspector = null
|
||||
}
|
||||
}.also { work.complete() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val current = AtomicReference<CurseLink?>()
|
||||
private val reported = ConcurrentHashMap<String, List<CurseForgeApp.Project>>()
|
||||
|
||||
fun lastReported(target: WowAddons.Target, disk: () -> List<WowAddons.Installed> = { WowAddons.details(target) }): Map<String, String?> {
|
||||
val last = reported[target.addOns.path] ?: return disk().mapNotNull { it.curseId }.associateWith { null }
|
||||
return CurseForgeApp.onDisk(last, target.addOns).associate { it.id to null }
|
||||
}
|
||||
|
||||
internal fun report(target: WowAddons.Target, projects: List<CurseForgeApp.Project>) {
|
||||
reported[target.addOns.path] = projects
|
||||
}
|
||||
|
||||
fun live(): CurseLink? = current.get()
|
||||
}
|
||||
}
|
||||
|
||||
private const val PAGES_AHEAD = 8
|
||||
private const val CURSE_UPDATE = "update"
|
||||
private const val UNINSTALLING = -1
|
||||
|
||||
private fun curseMark(project: CurseForgeApp.Project): String? = CURSE_UPDATE.takeIf { project.update }
|
||||
|
||||
private class Present(val curse: Map<String, String?> = emptyMap(), val disk: Map<String, WowAddons.Installed> = emptyMap())
|
||||
|
||||
@Composable
|
||||
internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAddons.Target, onDismiss: () -> Unit) {
|
||||
internal fun rememberCurseLink(app: UserApps.App?, sessionRunning: Boolean): CurseLink? {
|
||||
val context = LocalContext.current.applicationContext
|
||||
val owner = LocalLifecycleOwner.current
|
||||
var visible by remember(owner) { mutableStateOf(owner.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) }
|
||||
DisposableEffect(owner) {
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
if (event == Lifecycle.Event.ON_START) visible = true
|
||||
if (event == Lifecycle.Event.ON_STOP) visible = false
|
||||
}
|
||||
owner.lifecycle.addObserver(observer)
|
||||
onDispose { owner.lifecycle.removeObserver(observer) }
|
||||
}
|
||||
val active = visible && !sessionRunning
|
||||
val link = remember(app?.key, active) { app?.takeIf { active }?.let(::CurseLink) }
|
||||
DisposableEffect(link) {
|
||||
onDispose { link?.close(context) }
|
||||
}
|
||||
return link
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAddons.Target, curseForge: UserApps.App?, link: CurseLink?, onDismiss: () -> Unit) {
|
||||
val context = LocalContext.current.applicationContext
|
||||
val scope = rememberCoroutineScope()
|
||||
val shown = rememberShown(onDismiss)
|
||||
@@ -93,20 +252,33 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
var text by remember { mutableStateOf("") }
|
||||
var category by remember { mutableStateOf<WowAddonCatalog.Category?>(null) }
|
||||
var sort by remember { mutableStateOf(WowAddonCatalog.Sort.POPULAR) }
|
||||
val results = remember(text, category, sort, target) { AddonResults() }
|
||||
var source by remember { mutableStateOf(AddonSource.WOWI) }
|
||||
val curse = if (source == AddonSource.CURSE && link != null) curseForge else null
|
||||
LaunchedEffect(link) { link?.refresh() }
|
||||
var notice by remember { mutableStateOf<Int?>(null) }
|
||||
var curseInstalls by remember { mutableIntStateOf(0) }
|
||||
val results = remember(text, category, sort, target, curse) { AddonResults() }
|
||||
val installing = remember { mutableStateMapOf<String, Int>() }
|
||||
val installed = remember { mutableStateMapOf<String, Pair<String, String>>() }
|
||||
val categories by produceState(emptyList<WowAddonCatalog.Category>()) {
|
||||
value = withContext(Dispatchers.IO) { runCatching { WowAddonCatalog.categories(context) }.getOrDefault(emptyList()) }
|
||||
}
|
||||
val present by produceState(emptyMap<String, String?>(), target.addOns, WowAddons.imports) {
|
||||
value = withContext(Dispatchers.IO) { WowAddons.details(target).mapNotNull { item -> item.wowiId?.let { it to item.version } }.toMap() }
|
||||
val presentKey = curse to target.addOns
|
||||
val scanKey = link?.generation to WowAddons.imports
|
||||
val snapshot by produceState(presentKey to Present(), target.addOns, scanKey, curse, curseInstalls, curse == null && results.items.isEmpty()) {
|
||||
val into = target
|
||||
val key = curse to into.addOns
|
||||
if (curse != null && link != null && value.first != key) value = key to withContext(Dispatchers.IO) { Present(curse = CurseLink.lastReported(into)) }
|
||||
value = key to withContext(Dispatchers.IO) {
|
||||
if (curse != null && link != null) Present(curse = link.marks(context, into, scanKey))
|
||||
else Present(disk = WowAddons.details(into).associateBy { it.name.lowercase() })
|
||||
}
|
||||
}
|
||||
val present = snapshot.second.takeIf { snapshot.first == presentKey } ?: Present()
|
||||
fun status(addon: WowAddonCatalog.Addon): AddonStatus {
|
||||
if (addon.id !in present) return AddonStatus.INSTALL
|
||||
val have = present[addon.id]
|
||||
if (curse != null) return if (addon.id !in present.curse) AddonStatus.INSTALL else if (present.curse[addon.id] == CURSE_UPDATE) AddonStatus.UPDATE else AddonStatus.INSTALLED
|
||||
val latest = installed[installKey(addon, target)]?.takeIf { it.first == addon.summary }?.second ?: addon.summary
|
||||
return if (have == null || latest.isBlank() || WowAddonCatalog.sameVersion(have, latest)) AddonStatus.INSTALLED else AddonStatus.UPDATE
|
||||
return diskStatus(addon.folders, present.disk, latest, addon.id)
|
||||
}
|
||||
fun load(page: Int) {
|
||||
if (results.loading) return
|
||||
@@ -116,10 +288,16 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
val words = text
|
||||
val cat = category?.id
|
||||
val order = sort
|
||||
val via = link?.takeIf { curse != null }
|
||||
notice = null
|
||||
scope.launch {
|
||||
val got = withContext(Dispatchers.IO) {
|
||||
runCatching { WowAddonCatalog.search(context, WowAddonCatalog.Query(words, cat, WowAddonCatalog.client(into), order), page) }
|
||||
runCatching {
|
||||
if (via != null) via.call(context, into) { CurseForgeApp.search(context, it.inspector, it.guid, words, order, page) }
|
||||
else WowAddonCatalog.search(context, WowAddonCatalog.Query(words, cat, WowAddonCatalog.client(into), order), page)
|
||||
}
|
||||
}
|
||||
if (results.items.isEmpty()) notice = (got.exceptionOrNull() as? CurseState)?.notice
|
||||
got.onSuccess {
|
||||
if (page == 0) results.items.clear()
|
||||
results.items.addAll(it.items.filter { addon -> results.items.none { seen -> seen.id == addon.id } })
|
||||
@@ -136,6 +314,34 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
fun install(addon: WowAddonCatalog.Addon) {
|
||||
val key = installKey(addon, target)
|
||||
if (key in installing) return
|
||||
val via = link?.takeIf { curse != null }
|
||||
if (via != null) {
|
||||
val into = target
|
||||
val updating = status(addon) == AddonStatus.UPDATE
|
||||
installing[key] = 0
|
||||
scope.launch {
|
||||
val done = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
via.call(context, into) {
|
||||
if (updating) CurseForgeApp.update(context, it.inspector, it.guid, addon.id)
|
||||
else CurseForgeApp.install(context, it.inspector, it.guid, addon.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
installing.remove(key)
|
||||
val ok = done.getOrNull() == true
|
||||
WowAddons.changed()
|
||||
curseInstalls++
|
||||
val message = when {
|
||||
ok && updating -> context.getString(R.string.user_apps_updated, addon.name)
|
||||
ok -> context.resources.getQuantityString(R.plurals.main_addons_imported, 1, 1, into.flavor)
|
||||
else -> (done.exceptionOrNull() as? CurseState)?.notice?.let(context::getString)
|
||||
?: context.getString(R.string.stores_dl_failed_reason, done.exceptionOrNull()?.message ?: addon.name)
|
||||
}
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
return
|
||||
}
|
||||
if (SessionState.running) {
|
||||
Toast.makeText(context, R.string.main_addons_close_session, Toast.LENGTH_LONG).show()
|
||||
return
|
||||
@@ -149,7 +355,33 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
Toast.makeText(context, message.first, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
val sourceName = stringResource(R.string.addons_source_wowi)
|
||||
fun uninstall(addon: WowAddonCatalog.Addon) {
|
||||
val key = installKey(addon, target)
|
||||
if (key in installing) return
|
||||
if (SessionState.running) {
|
||||
Toast.makeText(context, R.string.main_addons_close_session, Toast.LENGTH_LONG).show()
|
||||
return
|
||||
}
|
||||
val into = target
|
||||
val via = link?.takeIf { curse != null }
|
||||
installing[key] = UNINSTALLING
|
||||
scope.launch {
|
||||
val done = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
val folders = if (via != null) curseFolders(into, addon.id, via.call(context, into) { linked ->
|
||||
CurseForgeApp.projects(context, linked.inspector, linked.guid).firstOrNull { it.id == addon.id }?.folders.orEmpty()
|
||||
}) else addon.folders
|
||||
deleteAddons(context, into, folders, link)
|
||||
}
|
||||
}
|
||||
installing.remove(key)
|
||||
installed.remove(key)
|
||||
WowAddons.changed()
|
||||
curseInstalls++
|
||||
if (done.isFailure) Toast.makeText(context, R.string.fm_delete_failed, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
val sourceName = stringResource(if (curse != null) R.string.addons_source_curse else R.string.addons_source_wowi)
|
||||
val grid = rememberLazyGridState()
|
||||
LaunchedEffect(results, grid) {
|
||||
snapshotFlow { grid.layoutInfo.visibleItemsInfo.lastOrNull()?.index to grid.layoutInfo.totalItemsCount }.collect { (last, total) ->
|
||||
@@ -162,7 +394,7 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
LaunchedEffect(results, results.items.isNotEmpty()) {
|
||||
if (results.items.isNotEmpty() && !searching && inputMode.inputMode == InputMode.Keyboard) focusSoon { firstAction }
|
||||
}
|
||||
AppDialog(shown, close, "addonBrowser", wide = true, maxWidth = 980.dp, scrollable = false, fillHeight = true) {
|
||||
AppDialog(shown, close, "addonBrowser", wide = true, maxWidth = 980.dp, scrollable = false, fillHeight = true, modifier = Modifier.releaseTextFieldOnTap()) {
|
||||
val sortChip: @Composable () -> Unit = {
|
||||
BrowseDropdown(sortLabel(sort)) { first, done ->
|
||||
WowAddonCatalog.Sort.entries.forEachIndexed { index, option ->
|
||||
@@ -170,8 +402,14 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
}
|
||||
}
|
||||
}
|
||||
val sourceChip: @Composable () -> Unit = {
|
||||
if (curseForge != null) BrowseDropdown(sourceName) { first, done ->
|
||||
MenuItem(stringResource(R.string.addons_source_wowi), source == AddonSource.WOWI, focusRequester = first) { source = AddonSource.WOWI; done() }
|
||||
MenuItem(stringResource(R.string.addons_source_curse), source == AddonSource.CURSE) { source = AddonSource.CURSE; done() }
|
||||
}
|
||||
}
|
||||
val categoryChip: @Composable () -> Unit = {
|
||||
if (categories.isNotEmpty()) BrowseDropdown(category?.name ?: stringResource(R.string.addons_category_all)) { first, done ->
|
||||
if (curse == null && categories.isNotEmpty()) BrowseDropdown(category?.name ?: stringResource(R.string.addons_category_all)) { first, done ->
|
||||
MenuItem(stringResource(R.string.addons_category_all), category == null, focusRequester = first) { category = null; done() }
|
||||
categories.forEach { option -> MenuItem(option.name, category?.id == option.id) { category = option; done() } }
|
||||
}
|
||||
@@ -195,6 +433,7 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
if (maxWidth >= 640.dp) Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
search(Modifier.weight(1f))
|
||||
sourceChip()
|
||||
sortChip()
|
||||
categoryChip()
|
||||
flavorChip()
|
||||
@@ -208,6 +447,7 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier.horizontalScroll(rememberScrollState()),
|
||||
) {
|
||||
sourceChip()
|
||||
sortChip()
|
||||
categoryChip()
|
||||
flavorChip()
|
||||
@@ -222,12 +462,16 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
) {
|
||||
items(results.items, key = { it.id }) { addon ->
|
||||
val key = installKey(addon, target)
|
||||
AddonRow(addon, status(addon), installing[key], if (addon.id == results.items.firstOrNull()?.id) Modifier.focusRequester(firstAction) else Modifier) { install(addon) }
|
||||
AddonRow(addon, status(addon), installing[key], if (addon.id == results.items.firstOrNull()?.id) Modifier.focusRequester(firstAction) else Modifier, { uninstall(addon) }) { install(addon) }
|
||||
}
|
||||
item(span = { GridItemSpan(maxLineSpan) }) {
|
||||
Column(Modifier.fillMaxWidth().padding(vertical = 8.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
when {
|
||||
results.loading -> LinearProgressIndicator(Modifier.fillMaxWidth())
|
||||
results.failed != null && notice != null -> {
|
||||
Text(stringResource(notice!!), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
BrowseChip(stringResource(R.string.stores_dl_retry), false) { load(0) }
|
||||
}
|
||||
results.failed != null -> {
|
||||
Text(stringResource(R.string.addons_unreachable, sourceName), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
BrowseChip(stringResource(R.string.stores_dl_retry), false) { load(if (results.items.isEmpty()) 0 else results.page + 1) }
|
||||
@@ -241,7 +485,22 @@ internal fun AddonBrowserDialog(targets: List<WowAddons.Target>, initial: WowAdd
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AddonRow(addon: WowAddonCatalog.Addon, status: AddonStatus, progress: Int?, action: Modifier, onInstall: () -> Unit) {
|
||||
internal fun AddonRow(addon: WowAddonCatalog.Addon, status: AddonStatus, progress: Int?, action: Modifier, onUninstall: () -> Unit, onInstall: () -> Unit) {
|
||||
var asking by remember(addon.id) { mutableStateOf(false) }
|
||||
val first = remember(addon.id) { FocusRequester() }
|
||||
var refocus by remember(addon.id) { mutableStateOf(false) }
|
||||
val inputMode = LocalInputModeManager.current
|
||||
LaunchedEffect(status, progress) {
|
||||
if (!refocus) return@LaunchedEffect
|
||||
withFrameNanos { }
|
||||
runCatching { first.requestFocus() }
|
||||
if (progress == null) refocus = false
|
||||
}
|
||||
fun act(block: () -> Unit) {
|
||||
refocus = inputMode.inputMode == InputMode.Keyboard
|
||||
block()
|
||||
}
|
||||
val lead = action.focusRequester(first)
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Row(
|
||||
@@ -259,13 +518,24 @@ private fun AddonRow(addon: WowAddonCatalog.Addon, status: AddonStatus, progress
|
||||
fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
val size = Modifier.widthIn(min = 104.dp).then(action)
|
||||
val uninstall = stringResource(R.string.common_uninstall)
|
||||
when {
|
||||
progress != null -> SecondaryButton(stringResource(R.string.store_installing), compact = true, modifier = size, progress = progress / 100f, onClick = onInstall)
|
||||
status == AddonStatus.INSTALLED -> SecondaryButton(stringResource(R.string.stores_installed_chip), enabled = false, compact = true, modifier = size) {}
|
||||
else -> PrimaryButton(stringResource(if (status == AddonStatus.UPDATE) R.string.common_update else R.string.store_install), compact = true, modifier = size, onClick = onInstall)
|
||||
progress == UNINSTALLING -> SecondaryButton(stringResource(R.string.stores_uninstalling), compact = true, modifier = lead) {}
|
||||
progress != null -> SecondaryButton(stringResource(R.string.store_installing), compact = true, modifier = lead, progress = progress / 100f, onClick = onInstall)
|
||||
status == AddonStatus.INSTALL -> PrimaryButton(stringResource(R.string.store_install), compact = true, modifier = lead) { act(onInstall) }
|
||||
else -> {
|
||||
if (status == AddonStatus.UPDATE) PrimaryButton(stringResource(R.string.common_update), compact = true, modifier = lead) { act(onInstall) }
|
||||
SecondaryButton(uninstall, compact = true, modifier = if (status == AddonStatus.UPDATE) Modifier else lead) { asking = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (asking) ConfirmDialog(
|
||||
title = stringResource(R.string.stores_uninstall_title, addon.name),
|
||||
text = stringResource(R.string.games_delete_addon_body),
|
||||
confirm = stringResource(R.string.common_uninstall),
|
||||
onConfirm = { asking = false; act(onUninstall) },
|
||||
onDismiss = { asking = false },
|
||||
)
|
||||
}
|
||||
|
||||
private fun Modifier.scrollThumb(state: LazyGridState, color: Color): Modifier = drawWithContent {
|
||||
@@ -314,4 +584,25 @@ internal fun installAddon(context: Context, addon: WowAddonCatalog.Addon, target
|
||||
}
|
||||
}
|
||||
|
||||
internal fun diskStatus(folders: List<String>, onDisk: Map<String, WowAddons.Installed>, latest: String, id: String): AddonStatus {
|
||||
if (!WowAddons.present(folders) { it.lowercase() in onDisk }) return AddonStatus.INSTALL
|
||||
val have = onDisk.getValue(folders.first().lowercase())
|
||||
return if (WowAddonCatalog.offersUpdate(have.version, latest, sameSource = have.wowiId == id)) AddonStatus.UPDATE else AddonStatus.INSTALLED
|
||||
}
|
||||
|
||||
internal fun curseFolders(target: WowAddons.Target, id: String, listed: List<String>): List<String> =
|
||||
listed.ifEmpty { WowAddons.details(target).filter { it.curseId == id }.map { it.name } }
|
||||
|
||||
internal fun deleteAddons(context: Context, target: WowAddons.Target, folders: List<String>, link: CurseLink?) {
|
||||
val found = folders.mapNotNull { WowAddons.folder(target.addOns, it) }
|
||||
if (found.isEmpty()) throw IOException("No addon folder to delete")
|
||||
found.forEach { deleteAddon(context, target, it.name, link) }
|
||||
}
|
||||
|
||||
internal fun deleteAddon(context: Context, target: WowAddons.Target, folder: String, link: CurseLink? = CurseLink.live()) {
|
||||
val managed = link?.let { runCatching { it.uninstall(context, target, folder) }.getOrDefault(false) } == true
|
||||
val left = WowAddons.folder(target.addOns, folder)
|
||||
if (managed || left == null) WowAddons.changed() else WowAddons.delete(target, left.name)
|
||||
}
|
||||
|
||||
private fun installKey(addon: WowAddonCatalog.Addon, target: WowAddons.Target) = addon.id + "|" + target.addOns.path
|
||||
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ContextWrapper
|
||||
import android.os.Build
|
||||
import android.view.KeyEvent
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.compose.LocalActivityResultRegistryOwner
|
||||
@@ -10,6 +11,7 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.shrinkHorizontally
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandHorizontally
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
@@ -184,7 +186,11 @@ private fun AgentPageContent(
|
||||
?: generateSequence(view.context) { (it as? ContextWrapper)?.baseContext }
|
||||
.filterIsInstance<Activity>().firstOrNull()?.window
|
||||
val previousMode = window?.attributes?.softInputMode
|
||||
// A window fitted to the system bars with ADJUST_NOTHING reports no keyboard height to Compose.
|
||||
// It stays unfitted after the page leaves: fitting it again insets the other pages twice.
|
||||
val edgeToEdge = visible && hidesPet && !drawer && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
|
||||
if (visible) window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
|
||||
if (edgeToEdge) window?.setDecorFitsSystemWindows(false)
|
||||
onDispose {
|
||||
if (visible && previousMode != null) window?.setSoftInputMode(previousMode)
|
||||
}
|
||||
@@ -223,8 +229,14 @@ private fun AgentPageContent(
|
||||
}
|
||||
val topBar: @Composable () -> Unit = { AgentTopBar(panel, togglePanel, inputModifier, menu) }
|
||||
val inlineControls: (@Composable () -> Unit)? = if (inline) ({
|
||||
ModelChip(panel, togglePanel, inputModifier, compact = true)
|
||||
ContextRing("agent-usage", onClick = { togglePanel(AgentPanel.USAGE) })
|
||||
// The open menu needs the row's width for its own buttons.
|
||||
androidx.compose.animation.AnimatedVisibility(!menuOpen, enter = expandHorizontally(expandFrom = Alignment.Start) + fadeIn(),
|
||||
exit = shrinkHorizontally(shrinkTowards = Alignment.Start) + fadeOut()) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
ModelChip(panel, togglePanel, inputModifier, compact = true)
|
||||
ContextRing("agent-usage", onClick = { togglePanel(AgentPanel.USAGE) })
|
||||
}
|
||||
}
|
||||
menu()
|
||||
}) else null
|
||||
// A host with a title bar shows the top bar there.
|
||||
@@ -240,8 +252,11 @@ private fun AgentPageContent(
|
||||
LaunchedEffect(AgentHost.approvals.size, panel) {
|
||||
if (AgentHost.approvals.isNotEmpty() && (panel == AgentPanel.HISTORY || panel == AgentPanel.PROCESSES || panel == AgentPanel.TOOLS)) panel = AgentPanel.NONE
|
||||
}
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(modifier.fillMaxSize()) {
|
||||
// On a short page the picker would take it all and leave no conversation, so it scrolls within a share of the page.
|
||||
val panelMax = maxHeight * 0.5f
|
||||
Column(
|
||||
modifier.fillMaxSize().imePadding().onPreviewKeyEvent { e ->
|
||||
Modifier.fillMaxSize().imePadding().onPreviewKeyEvent { e ->
|
||||
val k = e.nativeKeyEvent
|
||||
if (k.keyCode != KeyEvent.KEYCODE_BUTTON_Y || composer.focused) return@onPreviewKeyEvent false
|
||||
if (k.action == KeyEvent.ACTION_UP) composer.open()
|
||||
@@ -264,8 +279,8 @@ private fun AgentPageContent(
|
||||
else -> {
|
||||
if (menuSlot == null && !inline) Box(Modifier.padding(bottom = 6.dp)) { topBar() }
|
||||
when (panel) {
|
||||
AgentPanel.MODEL -> Box(Modifier.padding(bottom = 8.dp)) { AgentModelPicker() }
|
||||
AgentPanel.USAGE -> Box(Modifier.padding(bottom = 8.dp)) { AgentUsage() }
|
||||
AgentPanel.MODEL -> Box(Modifier.heightIn(max = panelMax).verticalScroll(rememberScrollState()).padding(bottom = 8.dp)) { AgentModelPicker() }
|
||||
AgentPanel.USAGE -> Box(Modifier.heightIn(max = panelMax).verticalScroll(rememberScrollState()).padding(bottom = 8.dp)) { AgentUsage() }
|
||||
else -> Unit
|
||||
}
|
||||
val list = rememberLazyListState()
|
||||
@@ -317,11 +332,12 @@ private fun AgentPageContent(
|
||||
}
|
||||
}
|
||||
androidx.compose.animation.AnimatedVisibility(!hidden, enter = expandVertically() + fadeIn(), exit = shrinkVertically() + fadeOut()) {
|
||||
AgentComposer(composer, draft, visible && started, inlineControls, onPanel = { panel = it }, onSent = toLatest)
|
||||
AgentComposer(composer, draft, visible && started, inlineControls, onPanel = { panel = it }, onSent = toLatest, hideAttach = inline && menuOpen)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether the editor has the cursor; [open] puts it there. */
|
||||
@@ -392,10 +408,12 @@ private fun AgentMenu(open: Boolean, onOpen: (Boolean) -> Unit, onPanel: (AgentP
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val working = AgentHost.state == AgentHost.State.WORKING
|
||||
// Closed, the outline sits flush against the lone button.
|
||||
val shape = if (open) Shape16 else Shape12
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.clip(Shape16).background(colors.surface.copy(alpha = if (open) 0.97f else 0.88f))
|
||||
.border(1.dp, pal.line, Shape16).padding(end = 2.dp),
|
||||
modifier = Modifier.clip(shape).background(colors.surface.copy(alpha = if (open) 0.97f else 0.88f))
|
||||
.border(1.dp, pal.line, shape).then(if (open) Modifier.padding(top = 3.dp, bottom = 3.dp, end = 4.dp) else Modifier),
|
||||
) {
|
||||
androidx.compose.animation.AnimatedVisibility(open, enter = expandHorizontally(expandFrom = Alignment.End) + fadeIn(),
|
||||
exit = shrinkHorizontally(shrinkTowards = Alignment.End) + fadeOut()) {
|
||||
@@ -418,7 +436,7 @@ private fun AgentMenu(open: Boolean, onOpen: (Boolean) -> Unit, onPanel: (AgentP
|
||||
}
|
||||
}
|
||||
}
|
||||
HeaderAction(Icons.Outlined.MoreHoriz, stringResource(R.string.agent_more), selected = open, size = 36.dp, tag = "agent-menu") { onOpen(!open) }
|
||||
HeaderAction(Icons.Outlined.MoreHoriz, stringResource(R.string.agent_more), selected = open, size = 36.dp, tag = "agent-menu", startPadding = if (open) null else 0.dp) { onOpen(!open) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,12 +450,13 @@ private fun AgentPanelBar(title: String, onClose: () -> Unit) {
|
||||
|
||||
@Composable
|
||||
internal fun HeaderAction(
|
||||
icon: ImageVector, label: String, enabled: Boolean = true, selected: Boolean = false, tag: String? = null, size: Dp = 44.dp, onClick: () -> Unit,
|
||||
icon: ImageVector, label: String, enabled: Boolean = true, selected: Boolean = false, tag: String? = null, size: Dp = 44.dp,
|
||||
startPadding: Dp? = null, onClick: () -> Unit,
|
||||
) {
|
||||
val pal = LocalPalette.current
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.padding(start = if (size < 44.dp) 4.dp else 8.dp).size(size).clip(Shape12)
|
||||
modifier = Modifier.padding(start = startPadding ?: if (size < 44.dp) 4.dp else 8.dp).size(size).clip(Shape12)
|
||||
.background(if (selected) pal.primary.copy(alpha = 0.2f) else pal.surfaceVariant)
|
||||
.clickable(enabled = enabled, onClick = onClick)
|
||||
.then(if (tag != null) Modifier.testTag(tag) else Modifier),
|
||||
@@ -710,7 +729,7 @@ internal fun liveUsed(limit: AgentHost.Limit) = if (limit.resetsAt > 0 && limit.
|
||||
@Composable
|
||||
private fun AgentComposer(
|
||||
composer: ComposerState, draftState: MutableState<String>, visible: Boolean, controls: (@Composable () -> Unit)?,
|
||||
onPanel: (AgentPanel) -> Unit, onSent: () -> Unit,
|
||||
onPanel: (AgentPanel) -> Unit, onSent: () -> Unit, hideAttach: Boolean = false,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var draft by draftState
|
||||
@@ -742,13 +761,13 @@ private fun AgentComposer(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(top = 8.dp).fillMaxWidth().horizontalScroll(rememberScrollState()),
|
||||
) { AgentActivity(labOpen) { labOpen = !labOpen } }
|
||||
AgentEditor(composer, draftState, visible, controls, send)
|
||||
AgentEditor(composer, draftState, visible, controls, send, hideAttach)
|
||||
}
|
||||
}
|
||||
|
||||
/** The text with attach, stop and send beside it, and [controls] while the text is not being typed in. */
|
||||
@Composable
|
||||
private fun AgentEditor(composer: ComposerState, draftState: MutableState<String>, visible: Boolean, controls: (@Composable () -> Unit)?, send: () -> Unit) {
|
||||
private fun AgentEditor(composer: ComposerState, draftState: MutableState<String>, visible: Boolean, controls: (@Composable () -> Unit)?, send: () -> Unit, hideAttach: Boolean = false) {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
@@ -847,14 +866,14 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState<String
|
||||
if (stacked) Column {
|
||||
text(Modifier.fillMaxWidth())
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
|
||||
if (attach) AttachButton()
|
||||
if (AgentAttachments.gameFrame != null) GameFrameButton()
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.weight(1f).height(42.dp)) { if (controls != null && !focused) controls() }
|
||||
AnimatedVisibility(attach && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton() }
|
||||
AnimatedVisibility(AgentAttachments.gameFrame != null && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { GameFrameButton() }
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.weight(1f).height(42.dp).horizontalScroll(rememberScrollState(), reverseScrolling = true)) { if (controls != null && !focused) controls() }
|
||||
actions()
|
||||
}
|
||||
} else Row(verticalAlignment = Alignment.Bottom) {
|
||||
if (attach) AttachButton()
|
||||
if (AgentAttachments.gameFrame != null) GameFrameButton()
|
||||
AnimatedVisibility(attach && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton() }
|
||||
AnimatedVisibility(AgentAttachments.gameFrame != null && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { GameFrameButton() }
|
||||
text(Modifier.weight(1f))
|
||||
if (controls != null && !focused) Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.height(42.dp)) { controls() }
|
||||
actions()
|
||||
|
||||
@@ -117,7 +117,7 @@ private fun rememberMovies(refresh: Int, onSelectionChanged: () -> Unit): MovieS
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
internal fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
|
||||
@@ -1629,7 +1629,7 @@ private fun DeviceChip(s: GpuDriversState) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.onGloballyPositioned { at = it.boundsInRoot() }.heightIn(min = 44.dp).paneItem("gpu-device").clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else colors.surface)
|
||||
.background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.14f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = open)
|
||||
.controllerConfirm(onClick = open)
|
||||
|
||||
@@ -12,6 +12,7 @@ object ControllerHaptics {
|
||||
private val navKeys = setOf(
|
||||
KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_RIGHT,
|
||||
KeyEvent.KEYCODE_BUTTON_A, KeyEvent.KEYCODE_BUTTON_L1, KeyEvent.KEYCODE_BUTTON_R1,
|
||||
KeyEvent.KEYCODE_BUTTON_L2, KeyEvent.KEYCODE_BUTTON_R2,
|
||||
)
|
||||
|
||||
fun onKey(context: Context, event: KeyEvent) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
internal val DeckyIcon: ImageVector = ImageVector.Builder("Decky", 24.dp, 24.dp, 24f, 24f).apply {
|
||||
for (d in listOf(
|
||||
"M8,2h2v6H8Z",
|
||||
"M14,2h2v6h-2Z",
|
||||
"M5,8h14v3a7,7 0 0 1 -5,6.7V19h-4v-1.3A7,7 0 0 1 5,11Z",
|
||||
"M11,19h2v3h-2Z",
|
||||
)) addPath(addPathNodes(d), fill = SolidColor(Color.Black))
|
||||
}.build()
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import coil.compose.AsyncImage
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.DeckyManager
|
||||
import com.droiddeck.launcher.runtime.DeckyStore
|
||||
|
||||
private enum class DeckyTab { INSTALLED, STORE, ZIP }
|
||||
|
||||
private const val STORE_PAGE = 30
|
||||
|
||||
internal fun deckyStoreMatches(plugins: List<DeckyStore.Plugin>, query: String): List<DeckyStore.Plugin> {
|
||||
val words = query.trim().lowercase().split(Regex("\\s+")).filter { it.isNotEmpty() }
|
||||
return plugins.filter { p ->
|
||||
val haystack = (p.name + " " + p.author + " " + p.description + " " + p.tags.joinToString(" ")).lowercase()
|
||||
words.all { it in haystack }
|
||||
}.sortedByDescending { it.downloads }
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DeckyGroups(s: ModeSettings, a: ModeSettingsActions, host: MenuHost) {
|
||||
val idle = s.deckyStage == null && !s.deckySessionRunning
|
||||
SettingsGroup(stringResource(R.string.mode_decky_loader)) {
|
||||
val updateAvailable = s.deckyInstalled != null && s.deckyLatestRelease != null &&
|
||||
s.deckyInstalled != s.deckyLatestRelease.tag
|
||||
val status = when {
|
||||
s.deckyStage != null -> s.deckyStage
|
||||
s.deckyChecking -> stringResource(R.string.mode_decky_checking)
|
||||
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_ready, s.deckyLatestRelease.tag)
|
||||
s.deckyInstalled == null -> stringResource(R.string.mode_decky_none)
|
||||
s.deckyLatestRelease == null -> stringResource(R.string.mode_decky_installed, s.deckyInstalled)
|
||||
updateAvailable -> stringResource(R.string.mode_decky_update, s.deckyLatestRelease.tag)
|
||||
else -> stringResource(R.string.mode_decky_current, s.deckyInstalled)
|
||||
}
|
||||
SettingsRow(stringResource(R.string.decky_status), status) {
|
||||
val action = when {
|
||||
s.deckyStage != null -> stringResource(R.string.common_working)
|
||||
s.deckyChecking -> stringResource(R.string.common_checking)
|
||||
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_install_latest)
|
||||
s.deckyInstalled != null && updateAvailable -> stringResource(R.string.common_update)
|
||||
else -> stringResource(R.string.common_check)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
SecondaryButton(action, enabled = s.deckyStage == null && !s.deckyChecking && !s.deckySessionRunning) {
|
||||
if (s.deckyLatestRelease == null || (s.deckyInstalled != null && !updateAvailable)) a.onDeckyCheck()
|
||||
else s.deckyLatestRelease?.let(a.onDeckyInstall)
|
||||
}
|
||||
if (s.deckyInstalled != null) DeckyUninstall(enabled = idle, onUninstall = a.onDeckyUninstall)
|
||||
}
|
||||
}
|
||||
if (s.deckyInstalled != null) ToggleRow(
|
||||
host, "decky-enabled", stringResource(R.string.decky_enable),
|
||||
null,
|
||||
s.deckyEnabled,
|
||||
enabled = idle,
|
||||
onChange = a.onDeckyEnabled,
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "decky-channel", stringResource(R.string.decky_release_channel),
|
||||
null,
|
||||
listOf(
|
||||
DeckyManager.BRANCH_STABLE to stringResource(R.string.decky_channel_stable),
|
||||
DeckyManager.BRANCH_PRERELEASE to stringResource(R.string.decky_channel_prerelease),
|
||||
) + if (s.deckyBranch == DeckyManager.BRANCH_TESTING) listOf(
|
||||
DeckyManager.BRANCH_TESTING to stringResource(R.string.decky_channel_testing),
|
||||
) else emptyList(),
|
||||
s.deckyBranch,
|
||||
enabled = idle,
|
||||
onPick = a.onDeckyBranch,
|
||||
)
|
||||
if (s.deckyStage != null && s.deckyPercent >= 0) {
|
||||
LinearProgressIndicator(
|
||||
progress = { s.deckyPercent / 100f },
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
if (s.deckyInstalled == null) return
|
||||
var tab by rememberSaveable { mutableStateOf(DeckyTab.INSTALLED) }
|
||||
SettingsGroup(stringResource(R.string.mode_decky_plugins)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
|
||||
TabChip(stringResource(R.string.decky_tab_installed, s.deckyPlugins.size), tab == DeckyTab.INSTALLED, Modifier.weight(1f)) { tab = DeckyTab.INSTALLED }
|
||||
TabChip(stringResource(R.string.decky_tab_store), tab == DeckyTab.STORE, Modifier.weight(1f)) { tab = DeckyTab.STORE }
|
||||
TabChip(stringResource(R.string.decky_tab_zip), tab == DeckyTab.ZIP, Modifier.weight(1f)) { tab = DeckyTab.ZIP }
|
||||
}
|
||||
LaunchedEffect(tab) { if (tab != DeckyTab.ZIP && s.deckyStore == null && !s.deckyStoreFailed) a.onDeckyStoreRefresh() }
|
||||
when (tab) {
|
||||
DeckyTab.INSTALLED -> InstalledPlugins(s, a, idle)
|
||||
DeckyTab.STORE -> PluginStore(s, a, idle)
|
||||
DeckyTab.ZIP -> SettingsRow(
|
||||
stringResource(R.string.decky_tab_zip),
|
||||
stringResource(R.string.mode_decky_plugins_hint),
|
||||
) {
|
||||
SecondaryButton(
|
||||
if (s.deckyStage != null && s.deckyDownloadingBinary) stringResource(R.string.mode_decky_plugin_downloading) else stringResource(R.string.mode_decky_plugin_install_zip),
|
||||
enabled = idle,
|
||||
modifier = Modifier.testTag("decky-install-zip"),
|
||||
onClick = a.onPickDeckyPluginZip,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun InstalledPlugins(s: ModeSettings, a: ModeSettingsActions, idle: Boolean) {
|
||||
var removing by remember { mutableStateOf<DeckyStore.Installed?>(null) }
|
||||
if (s.deckyPlugins.isEmpty()) {
|
||||
Text(stringResource(R.string.decky_none_installed), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp))
|
||||
}
|
||||
for (plugin in s.deckyPlugins) {
|
||||
val listed = s.deckyStore?.firstOrNull { it.name == plugin.name }
|
||||
val update = listed?.takeIf { DeckyStore.updateAvailable(plugin, it) }
|
||||
PluginRow(
|
||||
plugin.name,
|
||||
listOf(plugin.version, plugin.author).filter { it.isNotBlank() }.joinToString(" · ") +
|
||||
(update?.latest?.let { " · " + stringResource(R.string.decky_update_to, it.name) } ?: ""),
|
||||
listed?.imageUrl.orEmpty(),
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
if (update != null) SecondaryButton(stringResource(R.string.common_update), enabled = idle, compact = true) { a.onDeckyStoreInstall(update) }
|
||||
SecondaryButton(stringResource(R.string.decky_remove), enabled = idle, compact = true, modifier = Modifier.testTag("decky-remove-${plugin.folder}")) { removing = plugin }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s.deckyPlugins.isNotEmpty()) Text(stringResource(R.string.decky_changes_next_session), fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp))
|
||||
removing?.let { plugin ->
|
||||
androidx.compose.material3.AlertDialog(
|
||||
onDismissRequest = { removing = null },
|
||||
title = { Text(stringResource(R.string.decky_remove_confirm, plugin.name)) },
|
||||
text = { Text(stringResource(R.string.decky_remove_confirm_body)) },
|
||||
confirmButton = { androidx.compose.material3.TextButton(onClick = { removing = null; a.onDeckyRemove(plugin) }) { Text(stringResource(R.string.decky_remove)) } },
|
||||
dismissButton = { androidx.compose.material3.TextButton(onClick = { removing = null }) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PluginStore(s: ModeSettings, a: ModeSettingsActions, idle: Boolean) {
|
||||
var query by rememberSaveable { mutableStateOf("") }
|
||||
var searching by remember { mutableStateOf(false) }
|
||||
var shown by rememberSaveable { mutableIntStateOf(STORE_PAGE) }
|
||||
val plugins = s.deckyStore
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp).padding(bottom = 12.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
Box(Modifier.weight(1f)) {
|
||||
ListRow(tall = true, onClick = { searching = true }) {
|
||||
androidx.compose.material3.Icon(Icons.Filled.Search, contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(18.dp))
|
||||
Text(
|
||||
query.ifEmpty { stringResource(R.string.decky_store_search) }, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
color = if (query.isEmpty()) MaterialTheme.colorScheme.onSurfaceVariant else MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
if (query.isNotEmpty()) SecondaryButton(stringResource(R.string.boot_movie_repo_clear), compact = true) { query = ""; shown = STORE_PAGE }
|
||||
}
|
||||
when {
|
||||
plugins == null -> Text(stringResource(R.string.common_working), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(vertical = 12.dp))
|
||||
s.deckyStoreFailed -> Row(verticalAlignment = androidx.compose.ui.Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(stringResource(R.string.decky_store_failed), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.weight(1f))
|
||||
SecondaryButton(stringResource(R.string.boot_movie_repo_retry), compact = true) { a.onDeckyStoreRefresh() }
|
||||
}
|
||||
else -> {
|
||||
val matches = remember(plugins, query) { deckyStoreMatches(plugins, query) }
|
||||
if (matches.isEmpty()) Text(stringResource(R.string.decky_store_empty), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(vertical = 12.dp))
|
||||
for (plugin in matches.take(shown)) {
|
||||
val have = s.deckyPlugins.firstOrNull { it.name == plugin.name }
|
||||
val current = have != null && !DeckyStore.updateAvailable(have, plugin)
|
||||
PluginRow(
|
||||
plugin.name,
|
||||
listOf(plugin.latest?.name.orEmpty(), plugin.author, plugin.description).filter { it.isNotBlank() }.joinToString(" · "),
|
||||
plugin.imageUrl,
|
||||
) {
|
||||
SecondaryButton(
|
||||
stringResource(when { current -> R.string.setup_installed; have != null -> R.string.common_update; else -> R.string.boot_movie_repo_install }),
|
||||
enabled = idle && !current, compact = true,
|
||||
modifier = Modifier.testTag("decky-store-${plugin.name}"),
|
||||
) { a.onDeckyStoreInstall(plugin) }
|
||||
}
|
||||
}
|
||||
if (matches.size > shown) SecondaryButton(stringResource(R.string.decky_store_more, matches.size - shown), compact = true) { shown += STORE_PAGE }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (searching) TextEntryDialog(
|
||||
stringResource(R.string.decky_store_search), query, number = false, confirm = stringResource(R.string.stores_search_open),
|
||||
onSubmit = { query = it; shown = STORE_PAGE; searching = false }, onDismiss = { searching = false }, id = "decky-store-entry",
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PluginRow(name: String, detail: String, imageUrl: String, actions: @Composable () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 10.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = androidx.compose.ui.Alignment.CenterVertically) {
|
||||
val shape = RoundedCornerShape(8.dp)
|
||||
Box(Modifier.width(96.dp).aspectRatio(16f / 9f).clip(shape).background(Color(0xFF0E1218))) {
|
||||
if (imageUrl.isNotEmpty()) AsyncImage(model = imageUrl, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(name, fontSize = 15.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(detail, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) { actions() }
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ private fun DesktopCard(
|
||||
Column(
|
||||
Modifier.width(width).paneItem("tile:desktop:$key").then(if (first) Modifier.firstTile() else Modifier)
|
||||
.graphicsLayer { scaleX = scale; scaleY = scale }
|
||||
.clip(shape).background(if (hot) pal.signal.copy(alpha = 0.10f) else colors.surface)
|
||||
.clip(shape).background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.10f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button) { onClick(artAt) }
|
||||
.controllerConfirm { onClick(artAt) }
|
||||
|
||||
@@ -33,7 +33,9 @@ import androidx.compose.ui.graphics.drawscope.translate
|
||||
import androidx.compose.ui.graphics.lerp
|
||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.onSizeChanged
|
||||
import androidx.compose.ui.layout.positionInRoot
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -47,21 +49,30 @@ import kotlin.math.sin
|
||||
|
||||
@Composable
|
||||
internal fun EmptyLibrary(avoid: Rect?, wall: (@Composable () -> Unit)? = null, fade: @Composable () -> Unit) {
|
||||
val clock = rememberMarkClock(avoid)
|
||||
Box(Modifier.fillMaxSize().onSizeChanged { clock.page = Size(it.width.toFloat(), it.height.toFloat()) }) {
|
||||
var origin by remember { mutableStateOf(Offset.Zero) }
|
||||
val clock = rememberMarkClock(avoid?.translate(-origin.x, -origin.y))
|
||||
Box(
|
||||
Modifier.fillMaxSize()
|
||||
.onGloballyPositioned { origin = it.positionInRoot() }
|
||||
.onSizeChanged { clock.page = Size(it.width.toFloat(), it.height.toFloat()) },
|
||||
) {
|
||||
if (wall != null) wall() else EmptyWall(clock)
|
||||
fade()
|
||||
Mark(clock)
|
||||
}
|
||||
}
|
||||
|
||||
private const val TRACE_MS = 1250f
|
||||
private const val FILL_FROM = 450f
|
||||
private const val POP_FROM = 900f
|
||||
private const val IMPACT = 2200f
|
||||
private const val RIPPLE_MS = 1250f
|
||||
private const val HIT_MS = 900f
|
||||
private const val END = 3600f
|
||||
private const val REVEAL_MS = 2300f
|
||||
private const val TRACE_DRAW_MS = 900f
|
||||
private const val TRACE_FADE_MS = 500f
|
||||
private const val REVEAL_FILL_FROM = 600f
|
||||
private const val REVEAL_FILL_MS = 450f
|
||||
private const val REVEAL_FADE_FROM = 1700f
|
||||
private const val POKE = 880f
|
||||
private const val DRIFT_MS = 75_000f
|
||||
|
||||
@@ -82,8 +93,7 @@ private fun rememberMarkClock(avoid: Rect?): MarkClock {
|
||||
val haptics = LocalHapticFeedback.current
|
||||
val keepOff by rememberUpdatedState(avoid)
|
||||
val speed = with(LocalDensity.current) { 64.dp.toPx() }
|
||||
val inset = with(LocalDensity.current) { 10.dp.toPx() }
|
||||
val clearance = with(LocalDensity.current) { 16.dp.toPx() }
|
||||
val clearance = with(LocalDensity.current) { 4.dp.toPx() }
|
||||
LaunchedEffect(clock) {
|
||||
var last = -1L
|
||||
var vx = speed * 0.8f
|
||||
@@ -109,16 +119,28 @@ private fun rememberMarkClock(avoid: Rect?): MarkClock {
|
||||
|
||||
var x = clock.at.x + vx * dt / 1000f
|
||||
var y = clock.at.y + vy * dt / 1000f
|
||||
val hw = f.halfWidth
|
||||
val hh = f.halfHeight
|
||||
if (x - hw < inset) { x = inset + hw; vx = abs(vx) }
|
||||
if (x + hw > clock.page.width - inset) { x = clock.page.width - inset - hw; vx = -abs(vx) }
|
||||
if (y - hh < inset) { y = inset + hh; vy = abs(vy) }
|
||||
if (y + hh > clock.page.height - inset) { y = clock.page.height - inset - hh; vy = -abs(vy) }
|
||||
val hw = f.ball
|
||||
val hh = f.ball
|
||||
if (x - hw < 0f) { x = hw; vx = abs(vx) }
|
||||
if (x + hw > clock.page.width) { x = clock.page.width - hw; vx = -abs(vx) }
|
||||
if (y - hh < 0f) { y = hh; vy = abs(vy) }
|
||||
if (y + hh > clock.page.height) { y = clock.page.height - hh; vy = -abs(vy) }
|
||||
keepOff?.inflate(clearance)?.let { r ->
|
||||
if (x + hw > r.left && x - hw < r.right && y + hh > r.top && y - hh < r.bottom) {
|
||||
val outX = if (x < r.center.x) r.left - (x + hw) else r.right - (x - hw)
|
||||
val outY = if (y < r.center.y) r.top - (y + hh) else r.bottom - (y - hh)
|
||||
val nearX = x.coerceIn(r.left, r.right)
|
||||
val nearY = y.coerceIn(r.top, r.bottom)
|
||||
val gapX = x - nearX
|
||||
val gapY = y - nearY
|
||||
val gap = hypot(gapX, gapY)
|
||||
if (gap in 0.0001f..f.ball) {
|
||||
val nx = gapX / gap
|
||||
val ny = gapY / gap
|
||||
x = nearX + nx * f.ball
|
||||
y = nearY + ny * f.ball
|
||||
val into = vx * nx + vy * ny
|
||||
if (into < 0f) { vx -= 2f * into * nx; vy -= 2f * into * ny }
|
||||
} else if (gap <= 0.0001f) {
|
||||
val outX = if (x < r.center.x) r.left - f.ball - x else r.right + f.ball - x
|
||||
val outY = if (y < r.center.y) r.top - f.ball - y else r.bottom + f.ball - y
|
||||
if (abs(outX) < abs(outY)) { x += outX; vx = if (outX < 0) -abs(vx) else abs(vx) }
|
||||
else { y += outY; vy = if (outY < 0) -abs(vy) else abs(vy) }
|
||||
}
|
||||
@@ -294,30 +316,33 @@ private fun Mark(clock: MarkClock) {
|
||||
} else 0f
|
||||
|
||||
translate(0f, shake) {
|
||||
val fill = Out.transform(clamp01((intro - FILL_FROM) / 450f))
|
||||
if (fill > 0f) {
|
||||
val lift = 8f * k * (1f - fill)
|
||||
val edge = 5f * f.s
|
||||
LogoShape.left(left, 0f) { x, y -> f.px(x, y) + Offset(0f, lift + edge) }
|
||||
LogoShape.right(right) { x, y -> f.px(x, y) + Offset(0f, lift + edge) }
|
||||
drawPath(left, slabEdge.copy(alpha = fill))
|
||||
drawPath(right, slabEdge.copy(alpha = fill))
|
||||
LogoShape.left(left, 0f) { x, y -> f.px(x, y) + Offset(0f, lift) }
|
||||
LogoShape.right(right) { x, y -> f.px(x, y) + Offset(0f, lift) }
|
||||
drawPath(left, ink.copy(alpha = fill))
|
||||
drawPath(right, ink.copy(alpha = fill))
|
||||
}
|
||||
|
||||
if (intro < TRACE_MS) {
|
||||
val drawn = TraceEase.transform(clamp01(intro / 775f))
|
||||
val alpha = if (intro < 775f) 1f else 1f - (intro - 775f) / 475f
|
||||
LogoShape.left(left, 0f, f::px)
|
||||
LogoShape.right(right, f::px)
|
||||
for (half in listOf(left, right)) {
|
||||
measure.setPath(half, false)
|
||||
piece.reset()
|
||||
measure.getSegment(0f, measure.length * drawn, piece, true)
|
||||
drawPath(piece, pal.signal.copy(alpha = alpha), style = Stroke(2f * f.s))
|
||||
val since = t - IMPACT
|
||||
if (since in 0f..REVEAL_MS) {
|
||||
val fade = 1f - clamp01((since - REVEAL_FADE_FROM) / (REVEAL_MS - REVEAL_FADE_FROM))
|
||||
val fill = Out.transform(clamp01((since - REVEAL_FILL_FROM) / REVEAL_FILL_MS)) * fade
|
||||
if (fill > 0f) {
|
||||
val lift = 8f * k * (1f - fill / fade)
|
||||
val edge = 5f * f.s
|
||||
LogoShape.left(left, 0f) { x, y -> f.px(x, y) + Offset(0f, lift + edge) }
|
||||
LogoShape.right(right) { x, y -> f.px(x, y) + Offset(0f, lift + edge) }
|
||||
drawPath(left, slabEdge.copy(alpha = fill))
|
||||
drawPath(right, slabEdge.copy(alpha = fill))
|
||||
LogoShape.left(left, 0f) { x, y -> f.px(x, y) + Offset(0f, lift) }
|
||||
LogoShape.right(right) { x, y -> f.px(x, y) + Offset(0f, lift) }
|
||||
drawPath(left, ink.copy(alpha = fill))
|
||||
drawPath(right, ink.copy(alpha = fill))
|
||||
}
|
||||
val drawn = TraceEase.transform(clamp01(since / TRACE_DRAW_MS))
|
||||
val alpha = (if (since < TRACE_DRAW_MS) 1f else 1f - (since - TRACE_DRAW_MS) / TRACE_FADE_MS).coerceIn(0f, 1f) * fade
|
||||
if (alpha > 0f) {
|
||||
LogoShape.left(left, 0f, f::px)
|
||||
LogoShape.right(right, f::px)
|
||||
for (half in listOf(left, right)) {
|
||||
measure.setPath(half, false)
|
||||
piece.reset()
|
||||
measure.getSegment(0f, measure.length * drawn, piece, true)
|
||||
drawPath(piece, pal.signal.copy(alpha = alpha), style = Stroke(3f * f.s))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,10 @@ private fun Content(
|
||||
SyncTabPage(s, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
}
|
||||
if (selected == "decky" || selected == "boot-movies") {
|
||||
SteamTabPage(selected, a, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
}
|
||||
if (selected == "updates") {
|
||||
UpdatesPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
|
||||
return
|
||||
|
||||
@@ -56,9 +56,9 @@ import androidx.compose.material.icons.filled.Terminal
|
||||
import androidx.compose.material.icons.filled.Apps
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.SdStorage
|
||||
import androidx.compose.material.icons.filled.Movie
|
||||
import androidx.compose.material.icons.filled.Sync
|
||||
import androidx.compose.material.icons.filled.MoreHoriz
|
||||
import androidx.compose.material.icons.filled.SystemUpdate
|
||||
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.material3.Icon
|
||||
@@ -207,8 +207,10 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
|
||||
"setup" -> R.string.rail_setup to Icons.Filled.Settings
|
||||
"storage" -> R.string.rail_storage to Icons.Filled.SdStorage
|
||||
"sync" -> R.string.rail_sync to Icons.Filled.Sync
|
||||
"decky" -> R.string.rail_decky to DeckyIcon
|
||||
"boot-movies" -> R.string.rail_boot_movies to Icons.Filled.Movie
|
||||
NavTabs.MORE -> R.string.rail_more to Icons.Filled.MoreHoriz
|
||||
else -> R.string.rail_updates to Icons.Filled.SystemUpdate
|
||||
else -> R.string.rail_updates to updatesIcon(RunningBuild.kind())
|
||||
}
|
||||
|
||||
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) ||
|
||||
|
||||
@@ -454,6 +454,7 @@ internal suspend fun focusSoon(target: () -> FocusRequester) {
|
||||
@Composable
|
||||
fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)? = null) {
|
||||
val frontFocus = remember { FrontFocus() }
|
||||
androidx.compose.runtime.SideEffect { RunningBuild.channel = s.updates.follow.channel }
|
||||
val textInput = androidx.compose.ui.platform.LocalTextInputService.current
|
||||
val bottomTextInput = remember(textInput) { textInput?.let { androidx.compose.ui.text.input.TextInputService(BottomScreenTextInput(it)) } }
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize().pointerInput(Unit) {
|
||||
@@ -761,24 +762,28 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
focusManager.clearFocus(force = true)
|
||||
onRailSelect(key)
|
||||
}, a)
|
||||
val tabStep = androidx.compose.runtime.rememberUpdatedState { step: Int ->
|
||||
if (!processSettingsPageVisible) {
|
||||
val keys = navigationKeys(s)
|
||||
keys.getOrNull(keys.indexOf(railSelectionNow.value) + step)?.let { key ->
|
||||
PageSwipe.direction = step
|
||||
onRailSelect(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
DisposableEffect(Unit) {
|
||||
val handler: (Int) -> Unit = { tabStep.value(it) }
|
||||
MainTabSteps.handler = handler
|
||||
onDispose { if (MainTabSteps.handler === handler) MainTabSteps.handler = null }
|
||||
}
|
||||
CompositionLocalProvider(LocalShowSection provides { key -> selected = key }) {
|
||||
val swipeContext = androidx.compose.ui.platform.LocalContext.current
|
||||
remember { com.droiddeck.launcher.core.AppUiPrefs.pageSwipe(swipeContext).also { PageSwipe.on = it } }
|
||||
val agentKeyboardOpen = openTab == "agent" && WindowInsets.ime.getBottom(androidx.compose.ui.platform.LocalDensity.current) > 0
|
||||
LauncherLayout(
|
||||
bottomNavigation && !s.dualScreen, pal.line,
|
||||
Modifier.fillMaxSize().onGloballyPositioned { screenAt = it.positionInRoot() }
|
||||
.then(if (openTab == "agent") Modifier.imePadding() else Modifier)
|
||||
.then(if (s.dualScreen) Modifier.onKeyEvent { event ->
|
||||
val step = dualPageStep(event.nativeKeyEvent) ?: return@onKeyEvent false
|
||||
if (event.type == KeyEventType.KeyDown && !processSettingsPageVisible) {
|
||||
val keys = navigationKeys(s)
|
||||
val at = keys.indexOf(railSelectionNow.value)
|
||||
keys.getOrNull(at + step)?.let { key ->
|
||||
PageSwipe.direction = step
|
||||
onRailSelect(key)
|
||||
}
|
||||
}
|
||||
true
|
||||
} else Modifier),
|
||||
.then(if (openTab == "agent") Modifier.imePadding() else Modifier),
|
||||
navigation = {
|
||||
if (s.dualScreen || (bottomNavigation && agentKeyboardOpen)) Unit
|
||||
else if (bottomNavigation) BottomBar(s, railSelection, onRailSelect, onRailFocus, a, railFocus)
|
||||
@@ -787,7 +792,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
) {
|
||||
Pane(
|
||||
s, selected, a, page,
|
||||
Modifier.fillMaxSize().then(paneFocus).pageSwipe({ !processSettingsPageVisible && appToChooseDisplay == null }) { dir ->
|
||||
Modifier.fillMaxSize().then(paneFocus).pageSwipe({ !processSettingsPageVisible && appToChooseDisplay == null }, edgeGuard = { !bottomNavigation }) { dir ->
|
||||
val keys = navigationKeys(s)
|
||||
val at = keys.indexOf(railSelectionNow.value)
|
||||
if (at >= 0) keys.getOrNull(at + dir)?.let { key ->
|
||||
@@ -900,3 +905,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal object MainTabSteps {
|
||||
@Volatile var handler: ((Int) -> Unit)? = null
|
||||
}
|
||||
@@ -516,6 +516,13 @@ internal fun SetupPanel(
|
||||
if (s.launcherFullscreen) stringResource(R.string.setup_fullscreen_on) else stringResource(R.string.setup_fullscreen_off),
|
||||
s.launcherFullscreen,
|
||||
) { a.onLauncherFullscreen(it) }
|
||||
ToggleRow(
|
||||
host, "page-swipe", stringResource(R.string.setup_page_swipe),
|
||||
stringResource(R.string.setup_page_swipe_hint), PageSwipe.on,
|
||||
) { on ->
|
||||
PageSwipe.on = on
|
||||
com.droiddeck.launcher.core.AppUiPrefs.setPageSwipe(ctx, on)
|
||||
}
|
||||
ToggleRow(
|
||||
host, "controller-haptics", stringResource(R.string.setup_controller_haptics),
|
||||
stringResource(R.string.setup_controller_haptics_hint),
|
||||
@@ -1159,7 +1166,7 @@ private fun SettingCard(label: String, value: String, id: String, modifier: Modi
|
||||
verticalArrangement = Arrangement.spacedBy(3.dp),
|
||||
modifier = modifier.paneItem(id)
|
||||
.graphicsLayer { scaleX = scale; scaleY = scale }
|
||||
.then(if (LocalGlass.current != null) Modifier.glass(Shape14, if (hot) 0.04f else 0f) else Modifier.clip(Shape14).background(if (hot) pal.signal.copy(alpha = 0.10f) else colors.surface))
|
||||
.then(if (LocalGlass.current != null) Modifier.glass(Shape14, if (hot) 0.04f else 0f) else Modifier.clip(Shape14).background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.10f)) else Modifier))
|
||||
.glideBorder(hot, Shape14, pal.signal, if (LocalGlass.current != null) Color.Transparent else pal.line2)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
|
||||
.controllerConfirm(onClick = onClick)
|
||||
|
||||
@@ -211,6 +211,7 @@ internal fun PrimaryButton(
|
||||
val pal = LocalPalette.current
|
||||
val pillMode = LocalPillButtons.current
|
||||
val btnShape = if (pillMode) CircleShape else Shape12
|
||||
val outlined = LocalGradientOutline.current && enabled
|
||||
val frontFocus = if (main) LocalFrontFocus.current else null
|
||||
if (frontFocus != null) DisposableEffect(Unit) {
|
||||
frontFocus.primaryAttached++
|
||||
@@ -234,6 +235,7 @@ internal fun PrimaryButton(
|
||||
.clip(btnShape)
|
||||
.background(if (enabled) Brush.linearGradient(listOf(colors.primary, pal.primary2)) else Brush.linearGradient(listOf(colors.surfaceVariant, colors.surfaceVariant)))
|
||||
.then(if (enabled) Modifier else Modifier.border(1.dp, pal.line2, btnShape))
|
||||
.then(if (outlined) Modifier.border(2.dp, Brush.linearGradient(listOf(pal.primary2, colors.primary)), btnShape) else Modifier)
|
||||
.glideBorder(hot, btnShape, pal.signal, hotFillAlpha = 0f)
|
||||
.hoverable(src).clickable(role = Role.Button, interactionSource = src, indication = null, enabled = enabled) {
|
||||
placed[0]?.takeIf { it.isAttached }?.let { LaunchOrigin.mark(it.boundsInRoot(), placed) }
|
||||
|
||||
@@ -75,6 +75,7 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.positionInParent
|
||||
import androidx.compose.ui.layout.onSizeChanged
|
||||
import androidx.compose.ui.layout.positionInRoot
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
@@ -131,6 +132,9 @@ import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.animation.core.Spring
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.layout.offset
|
||||
|
||||
internal class GameRef(val appId: Int?, val store: Store?, val storeId: String?) {
|
||||
fun game(games: List<Library.SteamGame>): Library.SteamGame? = when {
|
||||
@@ -254,12 +258,18 @@ internal fun GameDetail(
|
||||
color = MaterialTheme.colorScheme.error, maxLines = 3, overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
Spacer(Modifier.height(2.dp))
|
||||
GameCapsule(scores) { GameActions(store, id, game, item, installed, s, a, Modifier.focusRequester(lead), compactMenu = stacked, inStore = inStore) }
|
||||
Column {
|
||||
CompositionLocalProvider(LocalPillButtons provides true, LocalGradientOutline provides true) {
|
||||
GameActions(store, id, game, item, installed, s, a, Modifier.focusRequester(lead), compactMenu = stacked, inStore = inStore, part = ActionPart.LEAD)
|
||||
}
|
||||
Spacer(Modifier.height(LeadGap - ActionGap))
|
||||
GameCapsule(scores) { GameActions(store, id, game, item, installed, s, a, Modifier, compactMenu = stacked, inStore = inStore, part = ActionPart.REST) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StoresMotion.heroLands) header() else Rise(1) { header() }
|
||||
if (tab != null) Rise(2) {
|
||||
Column(Modifier.fillMaxWidth().padding(top = 14.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Column(Modifier.fillMaxWidth().padding(top = ActionGap), verticalArrangement = Arrangement.spacedBy(ActionGap)) {
|
||||
val labels = tabs.map { t ->
|
||||
when (t) {
|
||||
GameTab.ABOUT -> stringResource(R.string.game_tab_about)
|
||||
@@ -277,15 +287,17 @@ internal fun GameDetail(
|
||||
focusRequesters = tabs.map { tabFocus.getValue(it) }, bumpers = tabs.size > 1, compact = stacked,
|
||||
)
|
||||
Box(Modifier.fillMaxWidth().onFocusChanged { if (inPanel && !it.hasFocus) dropped++; inPanel = it.hasFocus }.testTag("game-tab-${tab.name.lowercase()}")) {
|
||||
when (tab) {
|
||||
GameTab.ABOUT -> AboutTab(developer, publisher, releaseDate, description, scores, stacked) {
|
||||
if (!s.shortcutPicker) GameResourcesRow(title.takeUnless { it == id }.orEmpty(), game)
|
||||
CompositionLocalProvider(LocalRevealChecked provides false) {
|
||||
when (tab) {
|
||||
GameTab.ABOUT -> AboutTab(developer, publisher, releaseDate, description, scores, stacked) {
|
||||
if (!s.shortcutPicker) GameResourcesRow(title.takeUnless { it == id }.orEmpty(), game)
|
||||
}
|
||||
GameTab.ACHIEVEMENTS -> achievementState?.let { st -> AchievementsTab(StoreAchievements.forSource(store?.id)?.label.orEmpty(), st) }
|
||||
GameTab.LAUNCH -> if (game != null) LaunchTab(game, s, a, hopRail)
|
||||
GameTab.SAVES -> if (game != null && prefix != null) SavesTab(game, prefix, a)
|
||||
GameTab.ADDONS -> if (game != null) AddonsTab(game, addonTargets, s.sessionRunning, a)
|
||||
GameTab.INSTALL -> InstallTab(game, installed, item, store)
|
||||
}
|
||||
GameTab.ACHIEVEMENTS -> achievementState?.let { st -> AchievementsTab(StoreAchievements.forSource(store?.id)?.label.orEmpty(), st) }
|
||||
GameTab.LAUNCH -> if (game != null) LaunchTab(game, s, a, hopRail)
|
||||
GameTab.SAVES -> if (game != null && prefix != null) SavesTab(game, prefix, a)
|
||||
GameTab.ADDONS -> if (game != null) AddonsTab(game, addonTargets, a)
|
||||
GameTab.INSTALL -> InstallTab(game, installed, item, store)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,14 +360,22 @@ private fun StatusChip(text: String, icon: androidx.compose.ui.graphics.vector.I
|
||||
}
|
||||
}
|
||||
|
||||
private val ActionGap = 12.dp
|
||||
private val LeadGap = 20.dp
|
||||
|
||||
@Composable
|
||||
private fun GameCapsule(scores: GameScores?, actions: @Composable () -> Unit) {
|
||||
var noActions by remember { mutableStateOf(false) }
|
||||
val shown = scores?.takeIf { it.metacritic != Lookup.None || it.hltb != Lookup.None }
|
||||
val empty = noActions && shown == null
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().glass(RoundedCornerShape(30.dp)).padding(6.dp),
|
||||
modifier = Modifier.fillMaxWidth().then(if (empty) Modifier else Modifier.padding(top = ActionGap).glass(RoundedCornerShape(30.dp)).padding(6.dp)),
|
||||
) {
|
||||
CompositionLocalProvider(LocalPillButtons provides true) { Box(Modifier.weight(1f)) { actions() } }
|
||||
if (scores != null) CapsuleScores(scores, Modifier.padding(start = 8.dp, end = 10.dp))
|
||||
CompositionLocalProvider(LocalPillButtons provides true) {
|
||||
Box(Modifier.weight(1f).onSizeChanged { noActions = it.height == 0 }) { actions() }
|
||||
}
|
||||
shown?.let { CapsuleScores(it, Modifier.padding(start = 8.dp, end = 10.dp)) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,41 +387,95 @@ private fun GameTabBar(
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val scroll = rememberScrollState()
|
||||
val spans = remember(tabs.size) { androidx.compose.runtime.mutableStateListOf<IntRange?>(*arrayOfNulls<IntRange>(tabs.size)) }
|
||||
var tabHeight by remember { mutableStateOf(0) }
|
||||
var viewport by remember { mutableStateOf(0) }
|
||||
LaunchedEffect(selected, viewport) {
|
||||
val span = spans.getOrNull(selected) ?: return@LaunchedEffect
|
||||
if (viewport > 0) scroll.animateScrollTo((span.first + span.last) / 2 - viewport / 2)
|
||||
}
|
||||
Row(modifier.fillMaxWidth().glass(CircleShape).padding(4.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
if (bumpers) TabBarBumper("LB", stringResource(R.string.widgets_prev_tab), leading = true) { onSelect((selected + tabs.size - 1) % tabs.size) }
|
||||
tabs.forEachIndexed { i, label ->
|
||||
val on = i == selected
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
val pick = { onSelect(i) }
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.weight(1f)
|
||||
.testTag("tab-$i")
|
||||
.then(focusRequesters?.getOrNull(i)?.let { Modifier.focusRequester(it) } ?: Modifier)
|
||||
.clip(CircleShape)
|
||||
.background(if (on) pal.signal.copy(alpha = 0.3f) else if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
|
||||
.glideBorder(hot, CircleShape, pal.signal, if (on) pal.signal.copy(alpha = 0.5f) else Color.Transparent)
|
||||
.hoverable(src).selectable(selected = on, interactionSource = src, indication = null, role = Role.Tab, onClick = pick)
|
||||
.controllerConfirm(onClick = pick)
|
||||
.padding(horizontal = 6.dp, vertical = if (compact) 8.dp else 10.dp),
|
||||
) {
|
||||
Text(
|
||||
label, fontSize = if (compact) 13.sp else 14.sp, fontWeight = if (on) FontWeight.Bold else FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
color = if (on || hot) colors.onBackground else colors.onSurfaceVariant,
|
||||
)
|
||||
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.weight(1f).clip(if (bumpers) RoundedCornerShape(BumperFlat) else CircleShape).onSizeChanged { viewport = it.width }) {
|
||||
val share = maxWidth / tabs.size.coerceAtLeast(1)
|
||||
Box(Modifier.horizontalScroll(scroll)) {
|
||||
spans.getOrNull(selected)?.takeIf { tabHeight > 0 }?.let { span ->
|
||||
TabHighlight(span, tabHeight, flatStart = bumpers && selected == 0, flatEnd = bumpers && selected == tabs.lastIndex)
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
tabs.forEachIndexed { i, label ->
|
||||
val on = i == selected
|
||||
val src = remember { MutableInteractionSource() }
|
||||
val hot = rememberHot(src)
|
||||
val pick = { onSelect(i) }
|
||||
val shape = tabShape(flatStart = bumpers && i == 0, flatEnd = bumpers && i == tabs.lastIndex)
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.widthIn(min = share)
|
||||
.onGloballyPositioned { c -> val x = c.positionInParent().x.toInt(); val r = x..(x + c.size.width); if (spans[i] != r) spans[i] = r; tabHeight = c.size.height }
|
||||
.testTag("tab-$i")
|
||||
.then(focusRequesters?.getOrNull(i)?.let { Modifier.focusRequester(it) } ?: Modifier)
|
||||
.clip(shape)
|
||||
.background(if (hot && !on) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
|
||||
.glideBorder(hot, shape, pal.signal)
|
||||
.hoverable(src).selectable(selected = on, interactionSource = src, indication = null, role = Role.Tab, onClick = pick)
|
||||
.controllerConfirm(onClick = pick)
|
||||
.padding(horizontal = 12.dp, vertical = if (compact) 8.dp else 10.dp),
|
||||
) {
|
||||
Text(
|
||||
label, fontSize = if (compact) 13.sp else 14.sp, fontWeight = if (on) FontWeight.Bold else FontWeight.SemiBold, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
color = if (on || hot) colors.onBackground else colors.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bumpers) TabBarBumper("RB", stringResource(R.string.widgets_next_tab), leading = false) { onSelect((selected + 1) % tabs.size) }
|
||||
}
|
||||
}
|
||||
|
||||
private val BumperFlat = 7.dp
|
||||
|
||||
@Composable
|
||||
private fun TabHighlight(span: IntRange, height: Int, flatStart: Boolean, flatEnd: Boolean) {
|
||||
val pal = LocalPalette.current
|
||||
val density = LocalDensity.current
|
||||
val spring = Motion.sp<Float>(0.8f, Spring.StiffnessMediumLow)
|
||||
val x by animateFloatAsState(span.first.toFloat(), spring, label = "tabX")
|
||||
val width by animateFloatAsState((span.last - span.first).toFloat(), spring, label = "tabWidth")
|
||||
val start by animateFloatAsState(if (flatStart) 1f else 0f, spring, label = "tabFlatStart")
|
||||
val end by animateFloatAsState(if (flatEnd) 1f else 0f, spring, label = "tabFlatEnd")
|
||||
with(density) {
|
||||
val round = (height / 2f).toDp()
|
||||
val shape = RoundedCornerShape(
|
||||
topStart = androidx.compose.ui.unit.lerp(round, BumperFlat, start), topEnd = androidx.compose.ui.unit.lerp(round, BumperFlat, end),
|
||||
bottomEnd = androidx.compose.ui.unit.lerp(round, BumperFlat, end), bottomStart = androidx.compose.ui.unit.lerp(round, BumperFlat, start),
|
||||
)
|
||||
Box(
|
||||
Modifier.offset { androidx.compose.ui.unit.IntOffset(x.toInt(), 0) }
|
||||
.size(width.toDp(), height.toDp())
|
||||
.clip(shape).background(pal.signal.copy(alpha = 0.3f)).border(1.dp, pal.signal.copy(alpha = 0.5f), shape),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun tabShape(flatStart: Boolean, flatEnd: Boolean): androidx.compose.ui.graphics.Shape {
|
||||
if (!flatStart && !flatEnd) return CircleShape
|
||||
val flat = androidx.compose.foundation.shape.CornerSize(BumperFlat)
|
||||
val round = androidx.compose.foundation.shape.CornerSize(50)
|
||||
val start = if (flatStart) flat else round
|
||||
val end = if (flatEnd) flat else round
|
||||
return RoundedCornerShape(topStart = start, topEnd = end, bottomEnd = end, bottomStart = start)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TabBarBumper(label: String, description: String, leading: Boolean, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val round = 22.dp
|
||||
val flat = 7.dp
|
||||
val flat = BumperFlat
|
||||
val cap = if (leading) RoundedCornerShape(round, flat, flat, round) else RoundedCornerShape(flat, round, round, flat)
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
@@ -433,12 +507,17 @@ private fun GameTitle(title: String, logo: Any?, titleSize: TextUnit) {
|
||||
)
|
||||
}
|
||||
|
||||
internal enum class ActionPart { ALL, LEAD, REST }
|
||||
|
||||
@Composable
|
||||
internal fun GameActions(
|
||||
store: Store?, id: String?, game: Library.SteamGame?, item: CatalogItem?, installed: InstalledStoreGame?,
|
||||
s: FrontEndState, a: FrontEndActions, leadOn: Modifier, compactMenu: Boolean = false, inStore: Boolean = false,
|
||||
part: ActionPart = ActionPart.ALL,
|
||||
) {
|
||||
val ctx = LocalContext.current
|
||||
val lead = part != ActionPart.REST
|
||||
val rest = part != ActionPart.LEAD
|
||||
val storeKey = if (store != null && id != null) "${store.id}:$id" else null
|
||||
val rawDownload = storeKey?.let { StoresState.download(it) }
|
||||
val download = rawDownload?.takeIf { it.isActive }
|
||||
@@ -448,127 +527,133 @@ internal fun GameActions(
|
||||
Actions {
|
||||
when {
|
||||
s.shortcutPicker && game != null -> {
|
||||
PrimaryButton(stringResource(R.string.game_shortcut_choose), enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow, modifier = leadOn) { a.onSteamGame(game) }
|
||||
FileButtons(game, a)
|
||||
if (lead) PrimaryButton(stringResource(R.string.game_shortcut_choose), enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow, modifier = leadOn) { a.onSteamGame(game) }
|
||||
if (rest) FileButtons(game, a)
|
||||
}
|
||||
!cloud && (game != null || installed != null) -> {
|
||||
val gone = storeKey?.let { StoresState.uninstalling[it] }
|
||||
val xboxBusy = store == Store.XBOX && id != null && XboxContent.busy(id)
|
||||
val preparing = (game?.launchKey ?: storeKey)?.let { it in s.preparingGames } == true
|
||||
PrimaryButton(
|
||||
if (lead) PrimaryButton(
|
||||
stringResource(if (preparing) R.string.store_starting else R.string.stores_play),
|
||||
enabled = !s.busy && !preparing && gone == null && download == null && !xboxBusy && (store != Store.GOG || installed?.sidecar?.isInstalled != false),
|
||||
main = true, icon = Icons.Filled.PlayArrow, modifier = leadOn,
|
||||
) {
|
||||
if (game != null) a.onSteamGame(game) else if (store != null && id != null) launchStoreGame(store, id, s, a)
|
||||
}
|
||||
if (game != null) {
|
||||
if (compactMenu) GameMoreMenu(game, a) else {
|
||||
FileButtons(game, a)
|
||||
GameShortcutMenu(game, a)
|
||||
}
|
||||
}
|
||||
if (store == Store.ITCH && installed != null) ItchUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GAMEJOLT && installed != null) GameJoltUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GAMEJOLT && installed != null) GameJoltVersionButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (inStore && store == Store.GAMEJOLT && installed != null) {
|
||||
SecondaryButton(stringResource(R.string.stores_view_on, Store.GAMEJOLT.shortLabel)) {
|
||||
openUrl(ctx, item?.storeUrl.orEmpty().ifBlank { GameJoltApi.pageUrl("game", installed.sidecar.id) })
|
||||
}
|
||||
}
|
||||
if (store == Store.EA && installed != null) EaUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GOG && installed != null) GogMaintenanceActions(installed)
|
||||
if (store == Store.XBOX && id != null) XboxInstalledStream(id, game?.name ?: item?.title.orEmpty(), item)
|
||||
if (store == Store.XBOX && installed != null && id != null) {
|
||||
SecondaryButton(stringResource(R.string.stores_xbox_update), enabled = download == null && !XboxRuntime.isActive(id)) {
|
||||
runCatching { XboxBackend.update(ctx, installed) }
|
||||
.onFailure { StoresState.problems[Store.XBOX] = it.message ?: ctx.getString(R.string.stores_xbox_close_first) }
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.stores_xbox_manage), enabled = download == null) { XboxContent.manage(ctx, installed) }
|
||||
}
|
||||
if (store == Store.BATTLENET) {
|
||||
if (installed != null && id != null) {
|
||||
LaunchedEffect(id) { BattleNetInstall.checkUpdate(ctx, installed) }
|
||||
if (download != null) {
|
||||
SteadyDownloadChip(download)
|
||||
if (download.state != DownloadState.PAUSED) SecondaryButton(stringResource(R.string.stores_dl_pause)) { DownloadQueue.pause(download.key) }
|
||||
else SecondaryButton(stringResource(R.string.stores_dl_resume)) { DownloadQueue.resume(ctx, download.key) }
|
||||
} else if (BattleNetInstall.updates[id] == true) {
|
||||
SecondaryButton(stringResource(R.string.bnet_update)) { BattleNetInstall.update(ctx, installed) }
|
||||
if (rest) {
|
||||
if (game != null) {
|
||||
if (compactMenu) GameMoreMenu(game, a) else {
|
||||
FileButtons(game, a)
|
||||
GameShortcutMenu(game, a)
|
||||
}
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
|
||||
}
|
||||
if (game != null && !compactMenu) {
|
||||
HideButton(hideKey(game), game)
|
||||
EditArtButton(game)
|
||||
if (store == Store.ITCH && installed != null) ItchUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GAMEJOLT && installed != null) GameJoltUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GAMEJOLT && installed != null) GameJoltVersionButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (inStore && store == Store.GAMEJOLT && installed != null) {
|
||||
SecondaryButton(stringResource(R.string.stores_view_on, Store.GAMEJOLT.shortLabel)) {
|
||||
openUrl(ctx, item?.storeUrl.orEmpty().ifBlank { GameJoltApi.pageUrl("game", installed.sidecar.id) })
|
||||
}
|
||||
}
|
||||
if (store == Store.EA && installed != null) EaUpdateButton(installed, download == null && StoresState.uninstalling[installed.key] == null)
|
||||
if (store == Store.GOG && installed != null) GogMaintenanceActions(installed)
|
||||
if (store == Store.XBOX && id != null) XboxInstalledStream(id, game?.name ?: item?.title.orEmpty(), item)
|
||||
if (store == Store.XBOX && installed != null && id != null) {
|
||||
SecondaryButton(stringResource(R.string.stores_xbox_update), enabled = download == null && !XboxRuntime.isActive(id)) {
|
||||
runCatching { XboxBackend.update(ctx, installed) }
|
||||
.onFailure { StoresState.problems[Store.XBOX] = it.message ?: ctx.getString(R.string.stores_xbox_close_first) }
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.stores_xbox_manage), enabled = download == null) { XboxContent.manage(ctx, installed) }
|
||||
}
|
||||
if (store == Store.BATTLENET) {
|
||||
if (installed != null && id != null) {
|
||||
LaunchedEffect(id) { BattleNetInstall.checkUpdate(ctx, installed) }
|
||||
if (download != null) {
|
||||
SteadyDownloadChip(download)
|
||||
if (download.state != DownloadState.PAUSED) SecondaryButton(stringResource(R.string.stores_dl_pause)) { DownloadQueue.pause(download.key) }
|
||||
else SecondaryButton(stringResource(R.string.stores_dl_resume)) { DownloadQueue.resume(ctx, download.key) }
|
||||
} else if (BattleNetInstall.updates[id] == true) {
|
||||
SecondaryButton(stringResource(R.string.bnet_update)) { BattleNetInstall.update(ctx, installed) }
|
||||
}
|
||||
}
|
||||
SecondaryButton(stringResource(R.string.bnet_open)) { a.onBattleNet() }
|
||||
}
|
||||
if (game != null && !compactMenu) {
|
||||
HideButton(hideKey(game), game)
|
||||
EditArtButton(game)
|
||||
}
|
||||
}
|
||||
}
|
||||
download != null -> {
|
||||
SteadyDownloadChip(download)
|
||||
if (download.state != DownloadState.PAUSED) SecondaryButton(stringResource(R.string.stores_dl_pause), modifier = leadOn) { DownloadQueue.pause(download.key) }
|
||||
else PrimaryButton(stringResource(R.string.stores_dl_resume), main = true, modifier = leadOn) { DownloadQueue.resume(ctx, download.key) }
|
||||
ConfirmButton(stringResource(R.string.stores_dl_cancel), stringResource(R.string.stores_dl_cancel_confirm)) { DownloadQueue.cancel(ctx, download.key) }
|
||||
if (rest) SteadyDownloadChip(download)
|
||||
if (lead) {
|
||||
if (download.state != DownloadState.PAUSED) SecondaryButton(stringResource(R.string.stores_dl_pause), modifier = leadOn) { DownloadQueue.pause(download.key) }
|
||||
else PrimaryButton(stringResource(R.string.stores_dl_resume), main = true, modifier = leadOn) { DownloadQueue.resume(ctx, download.key) }
|
||||
}
|
||||
if (rest) ConfirmButton(stringResource(R.string.stores_dl_cancel), stringResource(R.string.stores_dl_cancel_confirm)) { DownloadQueue.cancel(ctx, download.key) }
|
||||
}
|
||||
failed != null -> {
|
||||
ActionChip(stringResource(R.string.stores_dl_failed), ok = false)
|
||||
PrimaryButton(stringResource(R.string.stores_dl_resume), main = true, modifier = leadOn) {
|
||||
if (rest) ActionChip(stringResource(R.string.stores_dl_failed), ok = false)
|
||||
if (lead) PrimaryButton(stringResource(R.string.stores_dl_resume), main = true, modifier = leadOn) {
|
||||
if (item != null) StoresState.requestInstall(ctx, item) else DownloadQueue.retry(ctx, failed.key)
|
||||
}
|
||||
ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { DownloadQueue.clear(ctx, failed.key) }
|
||||
if (rest) ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { DownloadQueue.clear(ctx, failed.key) }
|
||||
}
|
||||
cloud -> {
|
||||
val cloudId = game.storeId.orEmpty()
|
||||
XboxStreamButton(cloudId, game.name, main = true, modifier = leadOn)
|
||||
if (item?.installable == true && item.xboxPc) {
|
||||
if (lead) XboxStreamButton(cloudId, game.name, main = true, modifier = leadOn)
|
||||
if (rest && item?.installable == true && item.xboxPc) {
|
||||
SecondaryButton(
|
||||
if (StoresState.isUnfinished(item)) stringResource(R.string.stores_resume_install)
|
||||
else if (downloadBytes > 0) stringResource(R.string.stores_install_size, formatBytes(downloadBytes))
|
||||
else stringResource(R.string.stores_install),
|
||||
) { StoresState.requestInstall(ctx, item) }
|
||||
}
|
||||
if (item != null && StoresState.isUnfinished(item)) ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { StoresState.clearUnfinished(ctx, item) }
|
||||
XboxLibraryButton(cloudId, item)
|
||||
if (rest && item != null && StoresState.isUnfinished(item)) ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { StoresState.clearUnfinished(ctx, item) }
|
||||
if (rest) XboxLibraryButton(cloudId, item)
|
||||
}
|
||||
store == Store.BATTLENET && item != null -> InstallButton(stringResource(R.string.stores_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
store == Store.BATTLENET && item != null -> if (lead) InstallButton(stringResource(R.string.stores_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
store == Store.XBOX && item != null && !item.xboxPc && item.xboxCloud -> {
|
||||
XboxStreamButton(item.id, item.title, main = true, modifier = leadOn)
|
||||
XboxLibraryButton(item.id, item)
|
||||
if (lead) XboxStreamButton(item.id, item.title, main = true, modifier = leadOn)
|
||||
if (rest) XboxLibraryButton(item.id, item)
|
||||
}
|
||||
item?.installable == true && StoresState.isUnfinished(item) -> {
|
||||
InstallButton(stringResource(R.string.stores_resume_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { StoresState.clearUnfinished(ctx, item) }
|
||||
if (lead) InstallButton(stringResource(R.string.stores_resume_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
if (rest) ConfirmButton(stringResource(R.string.stores_dl_clear), stringResource(R.string.stores_dl_cancel_confirm), compact = true) { StoresState.clearUnfinished(ctx, item) }
|
||||
}
|
||||
item?.installable == true -> {
|
||||
InstallButton(
|
||||
if (lead) InstallButton(
|
||||
if (downloadBytes > 0) stringResource(R.string.stores_install_size, formatBytes(downloadBytes)) else stringResource(R.string.stores_install),
|
||||
leadOn,
|
||||
) { StoresState.requestInstall(ctx, item) }
|
||||
if (store == Store.XBOX && item.xboxCloud) {
|
||||
if (rest && store == Store.XBOX && item.xboxCloud) {
|
||||
XboxStreamButton(item.id, item.title)
|
||||
XboxLibraryButton(item.id, item)
|
||||
}
|
||||
if (!item.accessible) SecondaryButton(buyLabel(item)) { openStoreUrl(ctx, item) }
|
||||
if (rest && !item.accessible) SecondaryButton(buyLabel(item)) { openStoreUrl(ctx, item) }
|
||||
}
|
||||
item != null && (item.store == Store.ITCH || item.store == Store.GAMEJOLT) && item.isFree -> {
|
||||
InstallButton(stringResource(R.string.stores_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
SecondaryButton(stringResource(R.string.stores_view_on, item.store.shortLabel)) { openStoreUrl(ctx, item) }
|
||||
if (lead) InstallButton(stringResource(R.string.stores_install), leadOn) { StoresState.requestInstall(ctx, item) }
|
||||
if (rest) SecondaryButton(stringResource(R.string.stores_view_on, item.store.shortLabel)) { openStoreUrl(ctx, item) }
|
||||
}
|
||||
item != null && item.isFree -> {
|
||||
item != null && item.isFree -> if (lead) {
|
||||
val adding = StoresState.claiming[item.key] == true
|
||||
PrimaryButton(stringResource(if (adding) R.string.stores_claiming else R.string.stores_get_free), enabled = !adding, main = true, modifier = leadOn) {
|
||||
if (StoresState.canClaim(item)) StoresState.claim(ctx, item) { openStoreUrl(ctx, item) } else openStoreUrl(ctx, item)
|
||||
}
|
||||
}
|
||||
item != null -> PrimaryButton(buyLabel(item), main = true, modifier = leadOn) { openStoreUrl(ctx, item) }
|
||||
item != null -> if (lead) PrimaryButton(buyLabel(item), main = true, modifier = leadOn) { openStoreUrl(ctx, item) }
|
||||
}
|
||||
val entryKey = game?.let(::hideKey) ?: storeKey
|
||||
if (!s.shortcutPicker && entryKey != null && (game == null || cloud)) HideButton(entryKey, game)
|
||||
if (cloud && (download != null || failed != null)) {
|
||||
XboxStreamButton(game.storeId.orEmpty(), game.name)
|
||||
XboxLibraryButton(game.storeId.orEmpty(), item)
|
||||
if (rest) {
|
||||
val entryKey = game?.let(::hideKey) ?: storeKey
|
||||
if (!s.shortcutPicker && entryKey != null && (game == null || cloud)) HideButton(entryKey, game)
|
||||
if (cloud && (download != null || failed != null)) {
|
||||
XboxStreamButton(game.storeId.orEmpty(), game.name)
|
||||
XboxLibraryButton(game.storeId.orEmpty(), item)
|
||||
}
|
||||
BusyChip(s)
|
||||
}
|
||||
BusyChip(s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -962,9 +1047,11 @@ private fun SavesTab(g: Library.SteamGame, prefix: File, a: FrontEndActions) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AddonsTab(g: Library.SteamGame, targets: List<WowAddons.Target>, a: FrontEndActions) {
|
||||
private fun AddonsTab(g: Library.SteamGame, targets: List<WowAddons.Target>, sessionRunning: Boolean, a: FrontEndActions) {
|
||||
var browsing by remember(g.gameId) { mutableStateOf<WowAddons.Target?>(null) }
|
||||
browsing?.let { AddonBrowserDialog(targets, it) { browsing = null } }
|
||||
val curseForge = CurseForgeApp.find(UserAppsState.items)
|
||||
val link = rememberCurseLink(curseForge, sessionRunning)
|
||||
browsing?.let { AddonBrowserDialog(targets, it, curseForge, link) { browsing = null } }
|
||||
Column(Modifier.fillMaxWidth().tabPanel(), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
CurseForgeEntry(a)
|
||||
targets.forEach { target ->
|
||||
@@ -975,6 +1062,12 @@ private fun AddonsTab(g: Library.SteamGame, targets: List<WowAddons.Target>, a:
|
||||
val updates by produceState(emptyMap<String, WowAddonCatalog.Addon>(), names) {
|
||||
value = withContext(Dispatchers.IO) { WowAddonCatalog.updates(context, names, target) }
|
||||
}
|
||||
val scanKey = link?.generation to WowAddons.imports
|
||||
val managed by produceState(emptyMap<String, CurseForgeApp.Project>(), link, target.addOns, scanKey) {
|
||||
value = if (link == null) emptyMap() else withContext(Dispatchers.IO) {
|
||||
runCatching { CurseForgeApp.byFolder(link.installed(context, target, scanKey)) }.getOrDefault(emptyMap())
|
||||
}
|
||||
}
|
||||
if (targets.size > 1) SectionLabel(target.flavor)
|
||||
MenuItem(stringResource(R.string.addons_download), checked = false) { browsing = target }
|
||||
MenuItem(
|
||||
@@ -985,7 +1078,7 @@ private fun AddonsTab(g: Library.SteamGame, targets: List<WowAddons.Target>, a:
|
||||
target.addOns.mkdirs()
|
||||
a.onBrowseFiles(target.addOns)
|
||||
}
|
||||
names.forEach { item -> key(target.addOns, item.name) { AddonRow(item, updates[item.name], target, a) } }
|
||||
names.forEach { item -> key(target.addOns, item.name) { AddonRow(item, updates[item.name], target, a, link?.let { l -> managed[item.name.lowercase()]?.let { it to l } }) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1039,8 +1132,10 @@ private fun CurseForgeEntry(a: FrontEndActions) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AddonRow(item: WowAddons.Installed, update: WowAddonCatalog.Addon?, target: WowAddons.Target, a: FrontEndActions) {
|
||||
internal fun AddonRow(item: WowAddons.Installed, wowiUpdate: WowAddonCatalog.Addon?, target: WowAddons.Target, a: FrontEndActions, curse: Pair<CurseForgeApp.Project, CurseLink>? = null) {
|
||||
val name = item.name
|
||||
val update = wowiUpdate.takeIf { curse == null }
|
||||
val outdated = update != null || curse?.first?.update == true
|
||||
var asking by remember(target.addOns, name) { mutableStateOf(false) }
|
||||
var progress by remember(target.addOns, name) { mutableStateOf<Int?>(null) }
|
||||
val context = LocalContext.current
|
||||
@@ -1050,26 +1145,33 @@ private fun AddonRow(item: WowAddons.Installed, update: WowAddonCatalog.Addon?,
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(start = 16.dp, top = 2.dp, bottom = 2.dp)) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(name, fontSize = 14.sp, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
val detail = listOfNotNull(item.version, update?.let { stringResource(R.string.upd_available) }).joinToString(" · ")
|
||||
val detail = listOfNotNull(item.version, if (outdated) stringResource(R.string.upd_available) else null).joinToString(" · ")
|
||||
if (detail.isNotEmpty()) Text(
|
||||
progress?.let { stringResource(R.string.ctrl_percent, it) } ?: detail, fontSize = 12.sp,
|
||||
color = if (update != null) LocalPalette.current.signal else colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
color = if (outdated) LocalPalette.current.signal else colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
if (update != null && !SessionState.running) IconAction(Icons.Outlined.Download, stringResource(R.string.common_update), "addon:update:${target.flavor}:$name", enabled = progress == null) {
|
||||
if (outdated && !SessionState.running) IconAction(Icons.Outlined.Download, stringResource(R.string.common_update), "addon:update:${target.flavor}:$name", enabled = progress == null) {
|
||||
progress = 0
|
||||
scope.launch {
|
||||
val message = withContext(Dispatchers.IO) { installAddon(context, update, target) { pct -> scope.launch { progress = pct } } }
|
||||
val message = withContext(Dispatchers.IO) {
|
||||
if (curse != null) {
|
||||
val (project, link) = curse
|
||||
val done = runCatching { link.call(context, target) { CurseForgeApp.update(context, it.inspector, it.guid, project.id) } }.getOrDefault(false)
|
||||
WowAddons.changed()
|
||||
if (done) context.getString(R.string.user_apps_updated, name) else context.getString(R.string.stores_dl_failed_reason, name)
|
||||
} else update?.let { installAddon(context, it, target) { pct -> scope.launch { progress = pct } }.first }
|
||||
}
|
||||
progress = null
|
||||
android.widget.Toast.makeText(context, message.first, android.widget.Toast.LENGTH_LONG).show()
|
||||
if (message != null) android.widget.Toast.makeText(context, message, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
if (!SessionState.running) IconAction(Icons.Outlined.Delete, delete, "addon:delete:${target.flavor}:$name", danger = true) { asking = true }
|
||||
if (!SessionState.running) IconAction(Icons.Outlined.Delete, if (curse != null) stringResource(R.string.common_uninstall) else delete, "addon:delete:${target.flavor}:$name", danger = true) { asking = true }
|
||||
}
|
||||
if (asking) ConfirmDialog(
|
||||
title = stringResource(R.string.games_delete_addon_title, name),
|
||||
title = if (curse != null) stringResource(R.string.stores_uninstall_title, name) else stringResource(R.string.games_delete_addon_title, name),
|
||||
text = stringResource(R.string.games_delete_addon_body),
|
||||
confirm = delete,
|
||||
confirm = if (curse != null) stringResource(R.string.common_uninstall) else delete,
|
||||
onConfirm = { a.onAddonDelete(target, name) },
|
||||
onDismiss = { asking = false },
|
||||
)
|
||||
|
||||
@@ -58,6 +58,7 @@ import coil.size.Precision
|
||||
import kotlin.math.max
|
||||
|
||||
internal val LocalPillButtons = compositionLocalOf { false }
|
||||
internal val LocalGradientOutline = compositionLocalOf { false }
|
||||
|
||||
internal class GlassBackdrop {
|
||||
var painter: Painter? = null
|
||||
|
||||
@@ -60,7 +60,7 @@ internal fun gameResources(title: String, game: Library.SteamGame?): List<GameRe
|
||||
internal fun GameResourcesRow(title: String, game: Library.SteamGame?, modifier: Modifier = Modifier) {
|
||||
val links = remember(title, game) { gameResources(title, game) }
|
||||
if (links.isEmpty()) return
|
||||
FlowRow(modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
FlowRow(modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
links.forEach { ResourceLink(it) }
|
||||
}
|
||||
}
|
||||
@@ -79,14 +79,14 @@ private fun ResourceLink(link: GameResource) {
|
||||
val tint = if (hot) pal.signal else pal.onSurfaceVariant
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp),
|
||||
modifier = Modifier.paneItem("resource:${link.label}").heightIn(min = 44.dp).clip(shape)
|
||||
modifier = Modifier.paneItem("resource:${link.label}").heightIn(min = 34.dp).clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else if (glass) Color.White.copy(alpha = 0.07f) else Color.Transparent)
|
||||
.glideBorder(hot, shape, pal.signal, restColor = if (glass) Color.White.copy(alpha = 0.12f) else Color.Transparent)
|
||||
.semantics { contentDescription = description }
|
||||
.hoverable(source).clickable(interactionSource = source, indication = LocalIndication.current, role = Role.Button, onClick = open)
|
||||
.controllerConfirm(onClick = open).padding(horizontal = if (glass) 14.dp else 8.dp),
|
||||
.controllerConfirm(onClick = open).padding(horizontal = if (glass) 11.dp else 8.dp),
|
||||
) {
|
||||
Text(label, fontSize = if (glass) 13.sp else 12.sp, fontWeight = FontWeight.Medium, color = if (glass && !hot) MaterialTheme.colorScheme.onBackground else tint, maxLines = 1)
|
||||
Text(label, fontSize = 12.sp, fontWeight = FontWeight.Medium, color = if (glass && !hot) MaterialTheme.colorScheme.onBackground else tint, maxLines = 1)
|
||||
Icon(Icons.AutoMirrored.Filled.OpenInNew, contentDescription = null, tint = tint.copy(alpha = 0.65f), modifier = Modifier.size(11.dp))
|
||||
}
|
||||
}
|
||||
@@ -267,12 +267,6 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
}
|
||||
InputPage.SOURCE -> {
|
||||
if (role == InputRole.PRIMARY) SettingsGroup(stringResource(R.string.input_screen_visibility)) {
|
||||
ChoiceRow(host, "controller-osc", stringResource(R.string.mode_osc), stringResource(R.string.input_visibility_shared),
|
||||
listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
SessionPrefs.OSC_STEAM_TOUCH to stringResource(R.string.osc_steam_touch), SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.mode_osc_qam), SessionPrefs.OSC_NEVER to stringResource(R.string.common_never)),
|
||||
oscMode) { SessionPrefs.setOscMode(context, it); oscMode = it; onChanged() }
|
||||
}
|
||||
if (layout != null) SettingsGroup(stringResource(R.string.ctrl_layout)) {
|
||||
if (layout.editable) InputNavigationRow(stringResource(R.string.input_edit_layout), layout.name, Modifier.testTag("input-surface-${role.name.lowercase()}")) { surface = true }
|
||||
else InputHint(layout.name)
|
||||
@@ -288,6 +282,12 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
}
|
||||
if (role == InputRole.SECONDARY) InputHint(stringResource(R.string.input_second_screen_enable))
|
||||
}
|
||||
if (role == InputRole.PRIMARY) SettingsGroup(stringResource(R.string.input_screen_visibility)) {
|
||||
ChoiceRow(host, "controller-osc", stringResource(R.string.mode_osc), stringResource(R.string.input_visibility_shared),
|
||||
listOf(SessionPrefs.OSC_AUTO to stringResource(R.string.common_auto), SessionPrefs.OSC_ALWAYS to stringResource(R.string.common_always),
|
||||
SessionPrefs.OSC_STEAM_TOUCH to stringResource(R.string.osc_steam_touch), SessionPrefs.OSC_STEAM_QAM to stringResource(R.string.mode_osc_qam), SessionPrefs.OSC_NEVER to stringResource(R.string.common_never)),
|
||||
oscMode) { SessionPrefs.setOscMode(context, it); oscMode = it; onChanged() }
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.input_assign_actions)) {
|
||||
val users = library.usersOfBindings(preset.id)
|
||||
if (users.size > 1) InputHint(stringResource(R.string.input_shared_with, users.filterNot { it.id == profileId }.joinToString { it.name }))
|
||||
|
||||
@@ -90,6 +90,7 @@ import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.layout
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.onSizeChanged
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -913,7 +914,6 @@ private fun LibraryFilters(sources: List<String>, source: String, onSource: (Str
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 4.dp, bottom = 2.dp),
|
||||
) {
|
||||
if (manage) ManageStoresChip()
|
||||
Box(Modifier.weight(1f).edgeFade(scroll).horizontalScroll(scroll)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, modifier = Modifier.focusGroup()) {
|
||||
for (id in keys) {
|
||||
@@ -945,6 +945,7 @@ private fun LibraryFilters(sources: List<String>, source: String, onSource: (Str
|
||||
}
|
||||
if (highlighted in keys) ChipGlide(keys.indexOf(highlighted), bounds[highlighted], tint, visible = fillShown)
|
||||
}
|
||||
if (manage) ManageStoresChip()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1121,14 +1122,22 @@ internal fun ArtCard(
|
||||
}
|
||||
val showName = LibraryDisplay.title || hot
|
||||
val showDetail = LibraryDisplay.size || hot
|
||||
if (showName || showDetail) Column(
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp),
|
||||
modifier = Modifier.align(Alignment.BottomCenter).fillMaxWidth()
|
||||
.background(Brush.verticalGradient(0f to Color.Transparent, 0.6f to Color.Black.copy(alpha = 0.78f), 1f to Color.Black.copy(alpha = 0.92f)))
|
||||
.padding(start = 8.dp, end = 8.dp, top = 20.dp, bottom = if (download != null) 14.dp else 6.dp),
|
||||
) {
|
||||
if (showName) Text(title, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = Color.White, maxLines = if (hot) 2 else 1, overflow = TextOverflow.Ellipsis, lineHeight = 13.sp)
|
||||
if (showDetail) detail()
|
||||
if (showName || showDetail) {
|
||||
val top = with(androidx.compose.ui.platform.LocalDensity.current) { 20.dp.roundToPx() }
|
||||
val bottom = with(androidx.compose.ui.platform.LocalDensity.current) { (if (download != null) 14.dp else 6.dp).roundToPx() }
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp),
|
||||
modifier = Modifier.align(Alignment.BottomCenter).fillMaxWidth()
|
||||
.background(Brush.verticalGradient(0f to Color.Transparent, 0.6f to Color.Black.copy(alpha = 0.78f), 1f to Color.Black.copy(alpha = 0.92f)))
|
||||
.layout { measurable, constraints ->
|
||||
val inner = measurable.measure(constraints)
|
||||
if (inner.height == 0) layout(inner.width, 0) {} else layout(inner.width, inner.height + top + bottom) { inner.place(0, top) }
|
||||
}
|
||||
.padding(horizontal = 8.dp),
|
||||
) {
|
||||
if (showName) Text(title, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = Color.White, maxLines = if (hot) 2 else 1, overflow = TextOverflow.Ellipsis, lineHeight = 13.sp)
|
||||
if (showDetail) detail()
|
||||
}
|
||||
}
|
||||
if (download != null) Box(Modifier.align(Alignment.BottomCenter).padding(start = 6.dp, end = 6.dp, bottom = 5.dp)) {
|
||||
ProgressBarThin(download.fraction, paused = download.state == DownloadState.PAUSED, verify = download.stage == DownloadStage.VERIFY)
|
||||
|
||||
@@ -126,6 +126,8 @@ internal object SheetTab {
|
||||
const val LIBRARY = "library"
|
||||
const val STEAM = "steam"
|
||||
const val FILES = "files"
|
||||
const val DECKY = "decky"
|
||||
const val BOOT_MOVIES = "boot-movies"
|
||||
}
|
||||
|
||||
internal fun sheetTop(paneH: Float, buttonH: Float, minAbove: Float, ride: Float): Float =
|
||||
@@ -189,6 +191,7 @@ internal fun LiftHero(
|
||||
onOpenChange: (Boolean) -> Unit = {},
|
||||
start: Dp = 44.dp,
|
||||
bottom: Dp = 44.dp,
|
||||
onTextBounds: (Rect) -> Unit = {},
|
||||
drop: DropSheetState? = null,
|
||||
overlay: @Composable BoxWithConstraintsScope.(lifted: () -> Float) -> Unit = {},
|
||||
) {
|
||||
@@ -573,7 +576,7 @@ internal fun LiftHero(
|
||||
}
|
||||
}
|
||||
|
||||
Column(Modifier.align(Alignment.BottomStart).padding(start = start, bottom = bottom, end = 20.dp)) {
|
||||
Column(Modifier.align(Alignment.BottomStart).padding(start = start, bottom = bottom, end = 20.dp).onGloballyPositioned { onTextBounds(it.boundsInRoot()) }) {
|
||||
Box(Modifier.graphicsLayer { alpha = 1f - wallSink() }) { words() }
|
||||
Spacer(Modifier.height(18.dp))
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
|
||||
@@ -113,6 +113,9 @@ class ModeSettings(
|
||||
val deckyDownloadingBinary: Boolean = false,
|
||||
val deckyEnabled: Boolean = false,
|
||||
val deckySessionRunning: Boolean = false,
|
||||
val deckyPlugins: List<com.droiddeck.launcher.runtime.DeckyStore.Installed> = emptyList(),
|
||||
val deckyStore: List<com.droiddeck.launcher.runtime.DeckyStore.Plugin>? = null,
|
||||
val deckyStoreFailed: Boolean = false,
|
||||
)
|
||||
|
||||
class ModeSettingsActions(
|
||||
@@ -171,6 +174,9 @@ class ModeSettingsActions(
|
||||
val onDeckyEnabled: (Boolean) -> Unit = {},
|
||||
val onDeckyUninstall: () -> Unit = {},
|
||||
val onPickDeckyPluginZip: () -> Unit = {},
|
||||
val onDeckyStoreRefresh: () -> Unit = {},
|
||||
val onDeckyStoreInstall: (com.droiddeck.launcher.runtime.DeckyStore.Plugin) -> Unit = {},
|
||||
val onDeckyRemove: (com.droiddeck.launcher.runtime.DeckyStore.Installed) -> Unit = {},
|
||||
val onDismiss: () -> Unit,
|
||||
)
|
||||
|
||||
@@ -220,6 +226,8 @@ class SheetExtras(
|
||||
fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras: SheetExtras = SheetExtras()) {
|
||||
val steam = s.mode == SessionService.MODE_STEAM
|
||||
val host = rememberMenuHost()
|
||||
if (tab == SheetTab.DECKY) { DeckyGroups(s, a, host); return }
|
||||
if (tab == SheetTab.BOOT_MOVIES) { if (s.bootMovie != null) BootMovieGroup(s, a, host); return }
|
||||
Text(
|
||||
stringResource(when (s.mode) {
|
||||
SessionService.MODE_STEAM -> R.string.sheet_scope_steam
|
||||
@@ -509,75 +517,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
}
|
||||
if (tab == SheetTab.STEAM && steam) {
|
||||
extras.account(host)
|
||||
SettingsGroup(stringResource(R.string.mode_decky)) {
|
||||
val updateAvailable = s.deckyInstalled != null && s.deckyLatestRelease != null &&
|
||||
s.deckyInstalled != s.deckyLatestRelease.tag
|
||||
val status = when {
|
||||
s.deckyStage != null -> s.deckyStage
|
||||
s.deckyChecking -> stringResource(R.string.mode_decky_checking)
|
||||
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_ready, s.deckyLatestRelease.tag)
|
||||
s.deckyInstalled == null -> stringResource(R.string.mode_decky_none)
|
||||
s.deckyLatestRelease == null -> stringResource(R.string.mode_decky_installed, s.deckyInstalled)
|
||||
updateAvailable -> stringResource(R.string.mode_decky_update, s.deckyLatestRelease.tag)
|
||||
else -> stringResource(R.string.mode_decky_current, s.deckyInstalled)
|
||||
}
|
||||
SettingsRow(stringResource(R.string.mode_decky_loader), status) {
|
||||
val action = when {
|
||||
s.deckyStage != null -> stringResource(R.string.common_working)
|
||||
s.deckyChecking -> stringResource(R.string.common_checking)
|
||||
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_install_latest)
|
||||
s.deckyInstalled != null && updateAvailable -> stringResource(R.string.common_update)
|
||||
else -> stringResource(R.string.common_check)
|
||||
}
|
||||
Row(horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(6.dp)) {
|
||||
SecondaryButton(
|
||||
action,
|
||||
enabled = s.deckyStage == null && !s.deckyChecking && !s.deckySessionRunning,
|
||||
) {
|
||||
if (s.deckyLatestRelease == null || (s.deckyInstalled != null && !updateAvailable)) a.onDeckyCheck()
|
||||
else s.deckyLatestRelease?.let(a.onDeckyInstall)
|
||||
}
|
||||
if (s.deckyInstalled != null) DeckyUninstall(enabled = s.deckyStage == null && !s.deckySessionRunning, onUninstall = a.onDeckyUninstall)
|
||||
}
|
||||
}
|
||||
ChoiceRow(
|
||||
host, "decky-channel", stringResource(R.string.decky_channel),
|
||||
stringResource(R.string.decky_channel_hint),
|
||||
listOf(
|
||||
DeckyManager.BRANCH_STABLE to stringResource(R.string.decky_channel_stable),
|
||||
DeckyManager.BRANCH_PRERELEASE to stringResource(R.string.decky_channel_prerelease),
|
||||
) + if (s.deckyBranch == DeckyManager.BRANCH_TESTING) listOf(
|
||||
DeckyManager.BRANCH_TESTING to stringResource(R.string.decky_channel_testing),
|
||||
) else emptyList(),
|
||||
s.deckyBranch,
|
||||
enabled = s.deckyStage == null && !s.deckySessionRunning,
|
||||
onPick = a.onDeckyBranch,
|
||||
)
|
||||
if (s.deckyInstalled != null) ToggleRow(
|
||||
host, "decky-enabled", stringResource(R.string.mode_decky),
|
||||
if (s.deckyEnabled) stringResource(R.string.mode_decky_on)
|
||||
else stringResource(R.string.mode_decky_off),
|
||||
s.deckyEnabled,
|
||||
enabled = !s.deckySessionRunning && s.deckyStage == null,
|
||||
onChange = a.onDeckyEnabled,
|
||||
)
|
||||
SettingsRow(
|
||||
stringResource(R.string.mode_decky_plugins),
|
||||
stringResource(R.string.mode_decky_plugins_hint),
|
||||
) {
|
||||
SecondaryButton(
|
||||
if (s.deckyStage != null && s.deckyDownloadingBinary) stringResource(R.string.mode_decky_plugin_downloading) else stringResource(R.string.mode_decky_plugin_install_zip),
|
||||
enabled = s.deckyInstalled != null && s.deckyStage == null && !s.deckySessionRunning,
|
||||
onClick = a.onPickDeckyPluginZip,
|
||||
)
|
||||
}
|
||||
if (s.deckyStage != null && s.deckyPercent >= 0) {
|
||||
LinearProgressIndicator(
|
||||
progress = { s.deckyPercent / 100f },
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.mode_client)) {
|
||||
ToggleRow(
|
||||
host, "mangoapp", stringResource(R.string.mode_mangoapp),
|
||||
@@ -607,7 +546,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
onPick = a.onSteamClientArch,
|
||||
)
|
||||
}
|
||||
if (s.bootMovie != null) BootMovieGroup(s, a, host)
|
||||
if (s.integration != null) SteamIntegrationGroup(s.integration,
|
||||
onFeature = a.onIntegration, onAppInfo = a.onIntegrationAppInfo, onLocation = a.onIntegrationLocation)
|
||||
}
|
||||
@@ -669,7 +607,7 @@ internal fun DeckyZipWarningDialog(onConfirm: () -> Unit, onCancel: () -> Unit)
|
||||
private const val DECKY_ZIP_WARNING_SECONDS = 5
|
||||
|
||||
@Composable
|
||||
private fun DeckyUninstall(enabled: Boolean, onUninstall: () -> Unit) {
|
||||
internal fun DeckyUninstall(enabled: Boolean, onUninstall: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val label = stringResource(R.string.common_uninstall)
|
||||
val title = stringResource(R.string.mode_decky_remove_title)
|
||||
|
||||
@@ -81,7 +81,7 @@ private fun MoreTile(s: FrontEndState, key: String, first: Boolean, modifier: Mo
|
||||
.then(if (first) Modifier.paneEntry() else Modifier.paneItem("more:$key"))
|
||||
.testTag("more-$key")
|
||||
.height(112.dp).clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.12f) else colors.surface)
|
||||
.background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.12f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.hoverable(src)
|
||||
.clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Tab, onClick = onClick)
|
||||
|
||||
@@ -26,10 +26,10 @@ internal object DeveloperTools {
|
||||
|
||||
internal object NavTabs {
|
||||
const val MORE = "more"
|
||||
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent")
|
||||
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent")
|
||||
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
val DEFAULT_HIDDEN = setOf("android-apps", "agent")
|
||||
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "android-apps", "agent")
|
||||
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
|
||||
private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync")
|
||||
private const val LAYOUT_VERSION = 2
|
||||
|
||||
@@ -6,6 +6,8 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
@@ -13,26 +15,40 @@ import androidx.compose.ui.input.pointer.PointerEventPass
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.input.pointer.util.VelocityTracker
|
||||
import androidx.compose.ui.input.pointer.util.addPointerInputChange
|
||||
import androidx.compose.ui.layout.LayoutCoordinates
|
||||
import androidx.compose.ui.layout.findRootCoordinates
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlin.math.abs
|
||||
|
||||
internal object PageSwipe {
|
||||
var locks by mutableIntStateOf(0)
|
||||
var direction by mutableIntStateOf(0)
|
||||
var on by mutableStateOf(true)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun Modifier.pageSwipe(enabled: () -> Boolean, onSwipe: (Int) -> Unit): Modifier {
|
||||
internal fun Modifier.pageSwipe(enabled: () -> Boolean, edgeGuard: () -> Boolean = { false }, onSwipe: (Int) -> Unit): Modifier {
|
||||
val enabledNow by rememberUpdatedState(enabled)
|
||||
val edgeGuardNow by rememberUpdatedState(edgeGuard)
|
||||
val onSwipeNow by rememberUpdatedState(onSwipe)
|
||||
return pointerInput(Unit) {
|
||||
val placed = remember { arrayOfNulls<LayoutCoordinates>(1) }
|
||||
return onGloballyPositioned { placed[0] = it }.pointerInput(Unit) {
|
||||
val distance = 72.dp.toPx()
|
||||
val flingDistance = 32.dp.toPx()
|
||||
val flingVelocity = 900.dp.toPx()
|
||||
val slop = viewConfiguration.touchSlop
|
||||
val edge = 32.dp.toPx()
|
||||
awaitEachGesture {
|
||||
val down = awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Final)
|
||||
if (!enabledNow() || PageSwipe.locks > 0) return@awaitEachGesture
|
||||
if (!PageSwipe.on || !enabledNow() || PageSwipe.locks > 0) return@awaitEachGesture
|
||||
// A swipe in from the screen's edge brings back hidden system bars; it should not also turn the page.
|
||||
if (edgeGuardNow()) {
|
||||
val at = placed[0]?.takeIf { it.isAttached }
|
||||
val x = at?.localToRoot(down.position)?.x ?: down.position.x
|
||||
val width = at?.findRootCoordinates()?.size?.width?.toFloat() ?: size.width.toFloat()
|
||||
if (x < edge || x > width - edge) return@awaitEachGesture
|
||||
}
|
||||
val tracker = VelocityTracker()
|
||||
tracker.addPointerInputChange(down)
|
||||
var total = Offset.Zero
|
||||
@@ -48,7 +64,7 @@ internal fun Modifier.pageSwipe(enabled: () -> Boolean, onSwipe: (Int) -> Unit):
|
||||
if (!mine && abs(total.x) > slop && abs(total.x) > abs(total.y) * 2f) mine = true
|
||||
if (mine) change.consume()
|
||||
}
|
||||
if (!mine || PageSwipe.locks > 0) return@awaitEachGesture
|
||||
if (!mine || !PageSwipe.on || PageSwipe.locks > 0) return@awaitEachGesture
|
||||
val vx = tracker.calculateVelocity().x
|
||||
val horizontal = abs(total.x) > abs(total.y) * 1.5f
|
||||
val far = abs(total.x) > distance
|
||||
|
||||
@@ -75,6 +75,19 @@ internal fun SyncTabPage(s: FrontEndState, modifier: Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SteamTabPage(key: String, a: FrontEndActions, modifier: Modifier) {
|
||||
LaunchedEffect(Unit) { a.onSteamSettings() }
|
||||
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
PageHeader(stringResource(if (key == "decky") R.string.rail_decky else R.string.rail_boot_movies))
|
||||
a.modeSheet(
|
||||
com.droiddeck.launcher.session.SessionService.MODE_STEAM,
|
||||
if (key == "decky") SheetTab.DECKY else SheetTab.BOOT_MOVIES,
|
||||
SheetExtras(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ResetTabsRow() {
|
||||
val ctx = androidx.compose.ui.platform.LocalContext.current
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import androidx.compose.foundation.gestures.awaitEachGesture
|
||||
import androidx.compose.foundation.gestures.awaitFirstDown
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.input.pointer.PointerEventPass
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.LayoutCoordinates
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import kotlinx.coroutines.flow.first
|
||||
|
||||
internal object ScreenTaps {
|
||||
var count by mutableStateOf(0)
|
||||
}
|
||||
|
||||
/** A field that opens on a heavy page can take focus after the next tap has already finished. */
|
||||
@Composable
|
||||
internal fun CancelPendingFocus(pending: Boolean, askedAtTap: Int, focused: Boolean, cancel: () -> Unit) {
|
||||
val focusedNow by rememberUpdatedState(focused)
|
||||
val cancelNow by rememberUpdatedState(cancel)
|
||||
LaunchedEffect(pending, askedAtTap) {
|
||||
if (!pending) return@LaunchedEffect
|
||||
snapshotFlow { ScreenTaps.count }.first { it != askedAtTap }
|
||||
if (!focusedNow) cancelNow()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tapped controls do not take focus in touch mode, so a text field would otherwise keep it, and its highlight.
|
||||
* [x] and [y] share coordinates with [origin], the field's own position.
|
||||
*/
|
||||
internal fun releaseTextField(field: EditText, origin: IntArray, x: Float, y: Float) {
|
||||
val margin = 12 * field.resources.displayMetrics.density
|
||||
val insideX = x >= origin[0] - margin && x <= origin[0] + field.width + margin
|
||||
val insideY = y >= origin[1] - margin && y <= origin[1] + field.height + margin
|
||||
if (insideX && insideY) return
|
||||
field.clearFocus()
|
||||
(field.context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.hideSoftInputFromWindow(field.windowToken, 0)
|
||||
}
|
||||
|
||||
/** A dialog's touches never reach the activity, so a dialog holding a search field counts its taps and releases the field itself. */
|
||||
internal fun Modifier.releaseTextFieldOnTap(): Modifier = composed {
|
||||
val view = LocalView.current
|
||||
val placed = remember { arrayOfNulls<LayoutCoordinates>(1) }
|
||||
onGloballyPositioned { placed[0] = it }.pointerInput(view) {
|
||||
awaitEachGesture {
|
||||
val down = awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)
|
||||
ScreenTaps.count++
|
||||
var up: Offset? = null
|
||||
while (true) {
|
||||
val change = awaitPointerEvent(PointerEventPass.Final).changes.firstOrNull { it.id == down.id } ?: break
|
||||
if ((change.position - down.position).getDistance() > viewConfiguration.touchSlop) break
|
||||
if (!change.pressed) { up = change.position; break }
|
||||
}
|
||||
val at = up?.let { placed[0]?.takeIf { c -> c.isAttached }?.localToWindow(it) } ?: return@awaitEachGesture
|
||||
view.post {
|
||||
val field = view.findFocus() as? EditText ?: return@post
|
||||
releaseTextField(field, IntArray(2).also(field::getLocationInWindow), at.x, at.y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,8 @@ internal object SettingsIndex {
|
||||
s(SettingsSection.CONTROLLER, R.string.setup_tab_controller, "gamepad", "buttons", "mapping", "profile", "remap"),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_storage, tab = "storage", words = listOf("sd card", "space", "uninstall", "disk")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_sync, tab = "sync", words = listOf("syncthing", "saves")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_decky, tab = "decky", words = listOf("plugins", "plugin store", "homebrew", "loader")),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_boot_movies, tab = "boot-movies", words = listOf("startup movie", "boot video", "animation", "steamdeckrepo")),
|
||||
s(SettingsSection.GLASSES, R.string.setup_tab_glasses, "xreal", "viture", "vr", "ar"),
|
||||
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_theme, "color", "dark"),
|
||||
@@ -108,6 +110,7 @@ internal object SettingsIndex {
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_launcher_orientation, "rotate", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_session_orientation, "rotate", "portrait"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_fullscreen),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_page_swipe, "gesture"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_controller_haptics, "vibration", "rumble"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_dual_screen_launcher, "thor", "second screen", "bottom screen"),
|
||||
s(SettingsSection.LAUNCHER, R.string.setup_low_storage_warning),
|
||||
|
||||
@@ -49,6 +49,12 @@ internal fun SettingsPillSearch(
|
||||
val icon = remember { FocusRequester() }
|
||||
var toIcon by remember { mutableStateOf(false) }
|
||||
var focusOnOpen by remember { mutableStateOf(false) }
|
||||
var focusTap by remember { mutableStateOf(0) }
|
||||
var fieldFocused by remember { mutableStateOf(false) }
|
||||
CancelPendingFocus(focusOnOpen, focusTap, fieldFocused) {
|
||||
focusOnOpen = false
|
||||
if (query.isEmpty()) onClose()
|
||||
}
|
||||
val close = { toIcon = true; focusOnOpen = false; onClose() }
|
||||
BackHandler(enabled = searching) { close() }
|
||||
LaunchedEffect(toIcon, searching, open <= 0.01f) {
|
||||
@@ -73,15 +79,18 @@ internal fun SettingsPillSearch(
|
||||
Box(Modifier.width(w).graphicsLayer { alpha = (open * 1.6f).coerceAtMost(1f) }) {
|
||||
AdbTextField(
|
||||
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
|
||||
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = focusOnOpen,
|
||||
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = focusOnOpen, focusAtTap = focusTap,
|
||||
clearFocus = !searching,
|
||||
onFocusChange = { focused -> if (!focused && query.isEmpty() && searching) { focusOnOpen = false; onClose() } },
|
||||
onFocusChange = { focused ->
|
||||
fieldFocused = focused
|
||||
if (!focused && query.isEmpty() && searching) { focusOnOpen = false; onClose() }
|
||||
},
|
||||
)
|
||||
}
|
||||
SmallIconButton(Icons.Filled.Close, stringResource(R.string.settings_search_clear), tint = colors.onSurfaceVariant) { close() }
|
||||
}
|
||||
} else {
|
||||
Box(Modifier.focusRequester(icon)) { SearchIcon(stringResource(R.string.settings_search)) { focusOnOpen = true; onOpen() } }
|
||||
Box(Modifier.focusRequester(icon)) { SearchIcon(stringResource(R.string.settings_search)) { focusTap = ScreenTaps.count; focusOnOpen = true; onOpen() } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ internal fun Modifier.bumpers(onPrevious: () -> Unit, onNext: () -> Unit): Modif
|
||||
}
|
||||
}
|
||||
|
||||
internal val LocalRevealChecked = androidx.compose.runtime.compositionLocalOf { true }
|
||||
|
||||
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
internal fun TabStrip(
|
||||
@@ -347,7 +349,7 @@ fun AnchoredMenu(
|
||||
}
|
||||
}
|
||||
.verticalScroll(scroll),
|
||||
) { content(firstItemFocus) }
|
||||
) { androidx.compose.runtime.CompositionLocalProvider(LocalRevealChecked provides true) { content(firstItemFocus) } }
|
||||
if (scroll.canScrollForward) Icon(
|
||||
Icons.Filled.KeyboardArrowDown, contentDescription = null, tint = colors.onSurfaceVariant,
|
||||
modifier = Modifier.align(Alignment.BottomCenter).size(20.dp),
|
||||
@@ -377,7 +379,7 @@ fun MenuItem(
|
||||
val hot = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value
|
||||
val shift by animateFloatAsState(if (hot) 2f else 0f, Motion.sp(0.5f), label = "miShift")
|
||||
val reveal = remember { androidx.compose.foundation.relocation.BringIntoViewRequester() }
|
||||
if (checked) LaunchedEffect(Unit) { reveal.bringIntoView() }
|
||||
if (checked && LocalRevealChecked.current) LaunchedEffect(Unit) { reveal.bringIntoView() }
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier.fillMaxWidth()
|
||||
|
||||
@@ -140,6 +140,7 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
onOpen = a.onSteamSettings, onPrimary = a.onPlay,
|
||||
modifier = modifier.clipToBounds(),
|
||||
start = if (narrow) 20.dp else 44.dp, bottom = 44.dp,
|
||||
onTextBounds = { words = it },
|
||||
background = {
|
||||
when {
|
||||
games.isEmpty() -> EmptyLibrary(
|
||||
@@ -160,13 +161,12 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
IntegrationSuggestion(s.integration, { a.onSteamIntegration(null) }, a.onDismissIntegration)
|
||||
}
|
||||
if (narrow) Column(
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.onPlaced { words = it.boundsInParent() },
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
Wordmark(30.dp)
|
||||
runtimeStatus()
|
||||
} else Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = Modifier.onPlaced { words = it.boundsInParent() },
|
||||
) {
|
||||
Wordmark(if (narrow) 30.dp else 40.dp)
|
||||
runtimeStatus()
|
||||
|
||||
@@ -453,7 +453,7 @@ private fun BucketCard(
|
||||
modifier = modifier.paneItem("storage:${bucket.name}")
|
||||
.graphicsLayer { scaleX = scale; scaleY = scale }
|
||||
.clip(Shape14)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.10f) else colors.surface)
|
||||
.background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.10f)) else Modifier)
|
||||
.glideBorder(hot, Shape14, pal.signal, pal.line)
|
||||
.then(if (onClick != null) Modifier.hoverable(src)
|
||||
.clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
|
||||
|
||||
@@ -174,7 +174,7 @@ internal fun AchievementRow(a: Achievement, compact: Boolean, modifier: Modifier
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier.fillMaxWidth().clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.10f) else colors.surface)
|
||||
.background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.10f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.focusable(interactionSource = interaction)
|
||||
.padding(if (compact) 8.dp else 10.dp),
|
||||
@@ -369,7 +369,7 @@ internal fun DrawerAchievementsRow(progress: Pair<Int, Int>?, modifier: Modifier
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = modifier.fillMaxWidth().height(44.dp).clip(shape)
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.14f) else colors.surface)
|
||||
.background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.14f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.clickable(role = androidx.compose.ui.semantics.Role.Button, interactionSource = interaction, indication = LocalIndication.current, onClick = onClick)
|
||||
.controllerConfirm(onClick = onClick)
|
||||
|
||||
@@ -533,7 +533,7 @@ private fun AppCard(app: CardApp, size: Dp, first: Boolean, cards: HashMap<Strin
|
||||
Column(
|
||||
Modifier.width(size).paneItem("tile:store:${app.id}").then(if (first) Modifier.firstTile() else Modifier)
|
||||
.graphicsLayer { scaleX = scale; scaleY = scale }
|
||||
.clip(shape).background(if (hot) pal.signal.copy(alpha = 0.10f) else colors.surface)
|
||||
.clip(shape).background(colors.surface).then(if (hot) Modifier.background(pal.signal.copy(alpha = 0.10f)) else Modifier)
|
||||
.glideBorder(hot, shape, pal.signal, pal.line)
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
|
||||
.controllerConfirm(onClick = onClick)
|
||||
|
||||
@@ -925,6 +925,12 @@ internal fun ModeHeader(
|
||||
val pal = LocalPalette.current
|
||||
var searching by remember { mutableStateOf(query.isNotEmpty()) }
|
||||
var focusOnOpen by remember { mutableStateOf(false) }
|
||||
var focusTap by remember { mutableStateOf(0) }
|
||||
var fieldFocused by remember { mutableStateOf(false) }
|
||||
CancelPendingFocus(focusOnOpen, focusTap, fieldFocused) {
|
||||
focusOnOpen = false
|
||||
if (query.isEmpty()) searching = false
|
||||
}
|
||||
val open by animateFloatAsState(if (searching) 1f else 0f, Motion.sp(0.75f, 420f), label = "searchOpen")
|
||||
// Closing takes the field away with focus still in it; the search button gets it once it is back on screen.
|
||||
val searchIcon = remember { FocusRequester() }
|
||||
@@ -955,9 +961,12 @@ internal fun ModeHeader(
|
||||
Box(Modifier.width(w).graphicsLayer { alpha = (open * 1.6f).coerceAtMost(1f) }) {
|
||||
AdbTextField(
|
||||
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
|
||||
placeholder = placeholder, compact = true, showLabel = false, focusOnShow = focusOnOpen,
|
||||
placeholder = placeholder, compact = true, showLabel = false, focusOnShow = focusOnOpen, focusAtTap = focusTap,
|
||||
clearFocus = clearSearchFocus || !searching,
|
||||
onFocusChange = { focused -> if (!focused && query.isEmpty()) { searching = false; focusOnOpen = false } },
|
||||
onFocusChange = { focused ->
|
||||
fieldFocused = focused
|
||||
if (!focused && query.isEmpty()) { searching = false; focusOnOpen = false }
|
||||
},
|
||||
)
|
||||
}
|
||||
if (searching && closable) SmallIconButton(Icons.Filled.Close, stringResource(R.string.common_close), tint = colors.onSurfaceVariant, onClick = close)
|
||||
@@ -965,7 +974,7 @@ internal fun ModeHeader(
|
||||
}
|
||||
}
|
||||
val searchButton: @Composable () -> Unit = {
|
||||
Box(Modifier.focusRequester(searchIcon)) { SearchIcon(stringResource(R.string.stores_search_open)) { searching = true; focusOnOpen = true } }
|
||||
Box(Modifier.focusRequester(searchIcon)) { SearchIcon(stringResource(R.string.stores_search_open)) { focusTap = ScreenTaps.count; searching = true; focusOnOpen = true } }
|
||||
}
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val stacked = maxWidth < NarrowPaneWidth
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.SystemUpdate
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.update.AppUpdates
|
||||
|
||||
internal enum class BuildKind { STABLE, PREVIEW, TEST, LOCAL }
|
||||
|
||||
internal object RunningBuild {
|
||||
var channel by mutableStateOf(AppUpdates.Channel.STABLE)
|
||||
|
||||
fun kind(me: AppUpdates.Installed = AppUpdates.installed(), channel: AppUpdates.Channel = this.channel): BuildKind = when {
|
||||
me.pr > 0 -> BuildKind.TEST
|
||||
!me.ciBuild -> BuildKind.LOCAL
|
||||
channel == AppUpdates.Channel.NIGHTLY -> BuildKind.PREVIEW
|
||||
else -> BuildKind.STABLE
|
||||
}
|
||||
}
|
||||
|
||||
private const val PHONE = "M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19H7V5h10v14z"
|
||||
private const val LETTER_P = "M9.6,7.6 H12.6 A2.4,2.4 0 0 1 12.6,12.4 H11.4 V16.4 H9.6 Z M11.4,9.2 V10.8 H12.6 A0.8,0.8 0 0 0 12.6,9.2 Z"
|
||||
private const val LETTER_T = "M8.6,7.6 H15.4 V9.3 H12.9 V16.4 H11.1 V9.3 H8.6 Z"
|
||||
private const val LETTER_L = "M9.8,7.6 H11.6 V14.7 H15 V16.4 H9.8 Z"
|
||||
|
||||
private fun phoneWith(name: String, letter: String) =
|
||||
ImageVector.Builder(name, 24.dp, 24.dp, 24f, 24f)
|
||||
.addPath(addPathNodes(PHONE), fill = SolidColor(Color.Black))
|
||||
.addPath(addPathNodes(letter), fill = SolidColor(Color.Black), pathFillType = PathFillType.EvenOdd)
|
||||
.build()
|
||||
|
||||
private val PreviewIcon by lazy { phoneWith("UpdatesPreview", LETTER_P) }
|
||||
private val TestIcon by lazy { phoneWith("UpdatesTest", LETTER_T) }
|
||||
private val LocalIcon by lazy { phoneWith("UpdatesLocal", LETTER_L) }
|
||||
|
||||
internal fun updatesIcon(kind: BuildKind): ImageVector = when (kind) {
|
||||
BuildKind.STABLE -> Icons.Filled.SystemUpdate
|
||||
BuildKind.PREVIEW -> PreviewIcon
|
||||
BuildKind.TEST -> TestIcon
|
||||
BuildKind.LOCAL -> LocalIcon
|
||||
}
|
||||
@@ -365,11 +365,13 @@ internal fun AdbTextField(
|
||||
onDone: (() -> Unit)? = null,
|
||||
focusOnShow: Boolean = false,
|
||||
showLabel: Boolean = true,
|
||||
focusAtTap: Int? = null,
|
||||
onBack: (() -> Unit)? = null,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val onBackLatest = rememberUpdatedState(onBack)
|
||||
val focusAsked = remember { booleanArrayOf(false) }
|
||||
val focusTapAsked = remember { arrayOfNulls<Int>(1) }
|
||||
val palette = LocalPalette.current
|
||||
val onValueChangeLatest = rememberUpdatedState(onValueChange)
|
||||
val onNextLatest = rememberUpdatedState(onNext)
|
||||
@@ -502,9 +504,12 @@ internal fun AdbTextField(
|
||||
},
|
||||
update = { editText ->
|
||||
editText.showSoftInputOnFocus = !bottomTyping
|
||||
if (focusOnShow && !focusAsked[0]) {
|
||||
focusAsked[0] = true
|
||||
// A new tap may ask again: a field still on screen while it closes can be opened once more.
|
||||
val fresh = if (focusAtTap != null) focusTapAsked[0] != focusAtTap else !focusAsked[0]
|
||||
if (focusOnShow && fresh) {
|
||||
if (focusAtTap != null) focusTapAsked[0] = focusAtTap else focusAsked[0] = true
|
||||
editText.post {
|
||||
if (focusAtTap != null && focusAtTap != ScreenTaps.count) return@post
|
||||
editText.requestFocus()
|
||||
if (!bottomTypingLatest.value) (editText.context.getSystemService(android.content.Context.INPUT_METHOD_SERVICE) as? android.view.inputmethod.InputMethodManager)
|
||||
?.showSoftInput(editText, android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT)
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">بدء التشغيل</string>
|
||||
<string name="mode_startup_session">الفتح عند التشغيل</string>
|
||||
<string name="mode_startup_session_hint">يبدأ هذه الجلسة عند تشغيل DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">جارٍ البحث عن إصدارات…</string>
|
||||
<string name="mode_decky_ready">جاهز لتثبيت %1$s.</string>
|
||||
<string name="mode_decky_none">لم يتم العثور على إصدار متوافق. حاول مرة أخرى لاحقًا.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">محدَّث · %1$s</string>
|
||||
<string name="mode_decky_loader">المُحمِّل</string>
|
||||
<string name="mode_decky_install_latest">تثبيت أحدث إصدار</string>
|
||||
<string name="decky_channel">قناة التحديث</string>
|
||||
<string name="decky_channel_hint">إصدارات Decky Loader التي تُثبَّت. يستخدم مُحدِّث Decky نفسه القناة ذاتها.</string>
|
||||
<string name="decky_channel_stable">مستقرة</string>
|
||||
<string name="decky_channel_prerelease">إصدار تجريبي مسبق</string>
|
||||
<string name="decky_channel_testing">اختبار</string>
|
||||
<string name="decky_channel_failed">تعذّر حفظ قناة تحديث Decky</string>
|
||||
<string name="mode_decky_on">يبدأ مع Steam. أثناء تفعيله، قد تتمكن التطبيقات الأخرى على هذا الجهاز من التحكم في Steam.</string>
|
||||
<string name="mode_decky_off">متوقف. يبقى منفذ تصحيح الأخطاء عن بُعد في Steam مغلقًا.</string>
|
||||
<string name="mode_decky_remove_title">هل تريد إلغاء تثبيت Decky Loader؟</string>
|
||||
<string name="mode_decky_remove_text">يزيل المُحمِّل. يتم الاحتفاظ بالمكونات الإضافية والإعدادات.</string>
|
||||
<string name="mode_client">العميل</string>
|
||||
@@ -971,6 +966,8 @@
|
||||
<string name="setup_fullscreen">ملء الشاشة</string>
|
||||
<string name="setup_fullscreen_on">يخفي شريطي الحالة والتنقّل في Android</string>
|
||||
<string name="setup_fullscreen_off">يعرض شريطي الحالة والتنقّل في Android</string>
|
||||
<string name="setup_page_swipe">التمرير بين الصفحات</string>
|
||||
<string name="setup_page_swipe_hint">اسحب عبر الصفحة لتغيير علامة التبويب.</string>
|
||||
<string name="setup_dual_screen_launcher">المشغّل على شاشتين</string>
|
||||
<string name="setup_dual_screen_launcher_hint">يضع الوضع «تلقائي» أقسام المشغّل (Steam والمكتبة والمتاجر وغيرها) على الشاشة الثانية في الأجهزة المحمولة المزوّدة بشاشة ثانية مدمجة. ويستخدم الوضع «تشغيل» أي شاشة ثانية. أما الوضع «إيقاف» فيُبقي المشغّل على شاشة واحدة.</string>
|
||||
<string name="setup_dual_screen_sessions">الجلسات على شاشتين</string>
|
||||
@@ -4175,6 +4172,7 @@
|
||||
<string name="addons_sort_downloads">الأكثر تنزيلًا</string>
|
||||
<string name="addons_category_all">كل الفئات</string>
|
||||
<string name="addons_none_found">لم يتم العثور على إضافات</string>
|
||||
<string name="addons_curse_busy">أغلق CurseForge أولاً</string>
|
||||
<string name="addons_unreachable">تعذّر الوصول إلى %1$s</string>
|
||||
<string name="addons_no_file">لا يوجد ملف لإصدار اللعبة هذا</string>
|
||||
<string name="input_reset_positions">إعادة تعيين المواضع</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Inicio</string>
|
||||
<string name="mode_startup_session">Abrir al iniciar</string>
|
||||
<string name="mode_startup_session_hint">Inicia esta sesión cuando se abre DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Buscando versiones…</string>
|
||||
<string name="mode_decky_ready">Listo para instalar %1$s.</string>
|
||||
<string name="mode_decky_none">No se encontró ninguna versión compatible. Inténtalo más tarde.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Al día · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Instalar la última</string>
|
||||
<string name="decky_channel">Canal de actualizaciones</string>
|
||||
<string name="decky_channel_hint">Qué versiones de Decky Loader se instalan. El actualizador propio de Decky usa el mismo canal.</string>
|
||||
<string name="decky_channel_stable">Estable</string>
|
||||
<string name="decky_channel_prerelease">Preliminar</string>
|
||||
<string name="decky_channel_testing">Pruebas</string>
|
||||
<string name="decky_channel_failed">No se pudo guardar el canal de actualizaciones de Decky</string>
|
||||
<string name="mode_decky_on">Se inicia con Steam. Mientras esté activado, otras apps de este dispositivo podrían controlar Steam.</string>
|
||||
<string name="mode_decky_off">Desactivado. El puerto de depuración remota de Steam permanece cerrado.</string>
|
||||
<string name="mode_decky_remove_title">¿Desinstalar Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Elimina el loader. Tus plugins y ajustes se conservan.</string>
|
||||
<string name="mode_client">Cliente</string>
|
||||
@@ -989,6 +984,8 @@
|
||||
<string name="setup_fullscreen">Pantalla completa</string>
|
||||
<string name="setup_fullscreen_on">Oculta las barras de estado y navegación de Android</string>
|
||||
<string name="setup_fullscreen_off">Muestra las barras de estado y navegación de Android</string>
|
||||
<string name="setup_page_swipe">Deslizar entre páginas</string>
|
||||
<string name="setup_page_swipe_hint">Desliza sobre una página para cambiar de pestaña.</string>
|
||||
<string name="setup_dual_screen_launcher">Lanzador de doble pantalla</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automático coloca las secciones del lanzador (Steam, Biblioteca, Tiendas y las demás) en la segunda pantalla integrada de las consolas portátiles que la tienen. Activado usa cualquier segunda pantalla. Desactivado mantiene el lanzador en una sola pantalla.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesiones de doble pantalla</string>
|
||||
@@ -4055,6 +4052,7 @@
|
||||
<string name="addons_sort_downloads">Más descargados</string>
|
||||
<string name="addons_category_all">Todas las categorías</string>
|
||||
<string name="addons_none_found">No se encontraron complementos</string>
|
||||
<string name="addons_curse_busy">Cierra CurseForge primero</string>
|
||||
<string name="addons_unreachable">No se pudo conectar con %1$s</string>
|
||||
<string name="addons_no_file">No hay archivo para esta versión del juego</string>
|
||||
<string name="input_reset_positions">Restablecer posiciones</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Стартиране</string>
|
||||
<string name="mode_startup_session">Отваряне при стартиране</string>
|
||||
<string name="mode_startup_session_hint">Стартира тази сесия, когато DroidDeck се стартира.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Проверка за издания…</string>
|
||||
<string name="mode_decky_ready">Готово за инсталиране на %1$s.</string>
|
||||
<string name="mode_decky_none">Не е намерена съвместима версия. Опитайте по-късно.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Актуално · %1$s</string>
|
||||
<string name="mode_decky_loader">Зареждач</string>
|
||||
<string name="mode_decky_install_latest">Инсталиране на последната версия</string>
|
||||
<string name="decky_channel">Канал за актуализации</string>
|
||||
<string name="decky_channel_hint">Кои издания на Decky Loader да се инсталират. Собственият актуализатор на Decky използва същия канал.</string>
|
||||
<string name="decky_channel_stable">Стабилен</string>
|
||||
<string name="decky_channel_prerelease">Предварителен</string>
|
||||
<string name="decky_channel_testing">Тестов</string>
|
||||
<string name="decky_channel_failed">Каналът за актуализации на Decky не можа да бъде запазен</string>
|
||||
<string name="mode_decky_on">Стартира заедно със Steam. Докато е включено, други приложения на това устройство може да могат да контролират Steam.</string>
|
||||
<string name="mode_decky_off">Изключено. Портът за отдалечено дебъгване на Steam остава затворен.</string>
|
||||
<string name="mode_decky_remove_title">Деинсталиране на Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Премахва зареждащия модул. Плъгините и настройките ви се запазват.</string>
|
||||
<string name="mode_client">Клиент</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Цял екран</string>
|
||||
<string name="setup_fullscreen_on">Скрива лентите за състояние и навигация на Android</string>
|
||||
<string name="setup_fullscreen_off">Показва лентите за състояние и навигация на Android</string>
|
||||
<string name="setup_page_swipe">Плъзгане между страниците</string>
|
||||
<string name="setup_page_swipe_hint">Плъзнете по страница, за да смените раздела.</string>
|
||||
<string name="setup_dual_screen_launcher">Лаунчер с два екрана</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Автоматично: секциите на лаунчера (Steam, Библиотека, Магазини и останалите) се показват на втория екран при преносими устройства с вграден такъв. Включено: използва се всеки втори дисплей. Изключено: лаунчерът остава на един екран.</string>
|
||||
<string name="setup_dual_screen_sessions">Сесии с два екрана</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Най-изтегляни</string>
|
||||
<string name="addons_category_all">Всички категории</string>
|
||||
<string name="addons_none_found">Няма намерени добавки</string>
|
||||
<string name="addons_curse_busy">Първо затворете CurseForge</string>
|
||||
<string name="addons_unreachable">Няма връзка с %1$s</string>
|
||||
<string name="addons_no_file">Няма файл за тази версия на играта</string>
|
||||
<string name="input_reset_positions">Нулиране на позициите</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Spouštění</string>
|
||||
<string name="mode_startup_session">Otevřít při spuštění</string>
|
||||
<string name="mode_startup_session_hint">Spustí tuto relaci při spuštění DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Hledání vydání…</string>
|
||||
<string name="mode_decky_ready">Připraveno k instalaci %1$s.</string>
|
||||
<string name="mode_decky_none">Nenalezeno žádné kompatibilní sestavení. Zkuste to později.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Aktuální · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Nainstalovat nejnovější</string>
|
||||
<string name="decky_channel">Kanál aktualizací</string>
|
||||
<string name="decky_channel_hint">Která vydání Decky Loader instalovat. Vlastní aktualizátor Decky používá stejný kanál.</string>
|
||||
<string name="decky_channel_stable">Stabilní</string>
|
||||
<string name="decky_channel_prerelease">Předběžné vydání</string>
|
||||
<string name="decky_channel_testing">Testovací</string>
|
||||
<string name="decky_channel_failed">Kanál aktualizací Decky se nepodařilo uložit</string>
|
||||
<string name="mode_decky_on">Spouští se se Steamem. Když je zapnuto, jiné aplikace na tomto zařízení mohou mít možnost ovládat Steam.</string>
|
||||
<string name="mode_decky_off">Vypnuto. Port pro vzdálené ladění Steamu zůstává zavřený.</string>
|
||||
<string name="mode_decky_remove_title">Odinstalovat Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Odstraní loader. Vaše pluginy a nastavení zůstanou zachovány.</string>
|
||||
<string name="mode_client">Klient</string>
|
||||
@@ -965,6 +960,8 @@
|
||||
<string name="setup_fullscreen">Celá obrazovka</string>
|
||||
<string name="setup_fullscreen_on">Skryje stavový a navigační panel Androidu</string>
|
||||
<string name="setup_fullscreen_off">Zobrazí stavový a navigační panel Androidu</string>
|
||||
<string name="setup_page_swipe">Přejíždění mezi stránkami</string>
|
||||
<string name="setup_page_swipe_hint">Přejetím přes stránku přepnete kartu.</string>
|
||||
<string name="setup_dual_screen_launcher">Spouštěč na dvou obrazovkách</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automaticky přesune sekce spouštěče (Steam, Knihovna, Obchody a ostatní) na druhou obrazovku handheldů, které ji mají vestavěnou. Zapnuto použije libovolný druhý displej. Vypnuto ponechá spouštěč na jedné obrazovce.</string>
|
||||
<string name="setup_dual_screen_sessions">Relace na dvou obrazovkách</string>
|
||||
@@ -4095,6 +4092,7 @@
|
||||
<string name="addons_sort_downloads">Nejstahovanější</string>
|
||||
<string name="addons_category_all">Všechny kategorie</string>
|
||||
<string name="addons_none_found">Nenalezeny žádné doplňky</string>
|
||||
<string name="addons_curse_busy">Nejprve zavřete CurseForge</string>
|
||||
<string name="addons_unreachable">Nelze se připojit k %1$s</string>
|
||||
<string name="addons_no_file">Pro tuto verzi hry není k dispozici soubor</string>
|
||||
<string name="input_reset_positions">Obnovit pozice</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Opstart</string>
|
||||
<string name="mode_startup_session">Åbn ved start</string>
|
||||
<string name="mode_startup_session_hint">Starter denne session, når DroidDeck startes.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Søger efter udgivelser…</string>
|
||||
<string name="mode_decky_ready">Klar til at installere %1$s.</string>
|
||||
<string name="mode_decky_none">Ingen kompatibel build fundet. Prøv igen senere.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Opdateret · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Installer nyeste</string>
|
||||
<string name="decky_channel">Opdateringskanal</string>
|
||||
<string name="decky_channel_hint">Hvilke Decky Loader-udgivelser der installeres. Deckys egen opdatering bruger samme kanal.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Forhåndsudgivelse</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Kunne ikke gemme Decky-opdateringskanalen</string>
|
||||
<string name="mode_decky_on">Starter med Steam. Mens den er til, kan andre apps på denne enhed muligvis styre Steam.</string>
|
||||
<string name="mode_decky_off">Fra. Steams fjerndebugport forbliver lukket.</string>
|
||||
<string name="mode_decky_remove_title">Afinstaller Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Fjerner loaderen. Dine plugins og indstillinger bevares.</string>
|
||||
<string name="mode_client">Klient</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Fuldskærm</string>
|
||||
<string name="setup_fullscreen_on">Skjuler Androids status- og navigationsbjælker</string>
|
||||
<string name="setup_fullscreen_off">Viser Androids status- og navigationsbjælker</string>
|
||||
<string name="setup_page_swipe">Stryg mellem sider</string>
|
||||
<string name="setup_page_swipe_hint">Stryg hen over en side for at skifte fane.</string>
|
||||
<string name="setup_dual_screen_launcher">Launcher til to skærme</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatisk placerer launcherens sektioner (Steam, Bibliotek, Butikker og resten) på den anden skærm på håndholdte enheder med en indbygget anden skærm. Til bruger enhver ekstra skærm. Fra holder launcheren på én skærm.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessioner på to skærme</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Mest downloadet</string>
|
||||
<string name="addons_category_all">Alle kategorier</string>
|
||||
<string name="addons_none_found">Ingen tilføjelser fundet</string>
|
||||
<string name="addons_curse_busy">Luk CurseForge først</string>
|
||||
<string name="addons_unreachable">Kunne ikke nå %1$s</string>
|
||||
<string name="addons_no_file">Ingen fil til denne spilversion</string>
|
||||
<string name="input_reset_positions">Nulstil placeringer</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Start</string>
|
||||
<string name="mode_startup_session">Beim Start öffnen</string>
|
||||
<string name="mode_startup_session_hint">Startet diese Sitzung, wenn DroidDeck startet.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Suche nach Releases…</string>
|
||||
<string name="mode_decky_ready">Bereit zur Installation von %1$s.</string>
|
||||
<string name="mode_decky_none">Kein kompatibler Build gefunden. Versuch es später noch einmal.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Aktuell · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Neueste Version installieren</string>
|
||||
<string name="decky_channel">Update-Kanal</string>
|
||||
<string name="decky_channel_hint">Welche Decky-Loader-Releases installiert werden. Deckys eigener Updater nutzt denselben Kanal.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Vorabversion</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Decky-Update-Kanal konnte nicht gespeichert werden</string>
|
||||
<string name="mode_decky_on">Startet mit Steam. Solange aktiv, können andere Apps auf diesem Gerät Steam möglicherweise steuern.</string>
|
||||
<string name="mode_decky_off">Aus. Der Remote-Debugging-Port von Steam bleibt geschlossen.</string>
|
||||
<string name="mode_decky_remove_title">Decky Loader deinstallieren?</string>
|
||||
<string name="mode_decky_remove_text">Entfernt den Loader. Deine Plugins und Einstellungen bleiben erhalten.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -951,6 +946,8 @@
|
||||
<string name="setup_fullscreen">Vollbild</string>
|
||||
<string name="setup_fullscreen_on">Blendet die Status- und Navigationsleiste von Android aus</string>
|
||||
<string name="setup_fullscreen_off">Zeigt die Status- und Navigationsleiste von Android an</string>
|
||||
<string name="setup_page_swipe">Zwischen Seiten wischen</string>
|
||||
<string name="setup_page_swipe_hint">Über eine Seite wischen, um den Tab zu wechseln.</string>
|
||||
<string name="setup_dual_screen_launcher">Dual-Screen-Launcher</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Bei Automatisch liegen die Launcher-Bereiche (Steam, Bibliothek, Shops und die übrigen) auf dem zweiten Bildschirm von Handhelds mit integriertem zweitem Bildschirm. Ein nutzt einen beliebigen zweiten Bildschirm. Aus belässt den Launcher auf einem Bildschirm.</string>
|
||||
<string name="setup_dual_screen_sessions">Dual-Screen-Sitzungen</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Meistgeladen</string>
|
||||
<string name="addons_category_all">Alle Kategorien</string>
|
||||
<string name="addons_none_found">Keine Addons gefunden</string>
|
||||
<string name="addons_curse_busy">Schließe zuerst CurseForge</string>
|
||||
<string name="addons_unreachable">%1$s ist nicht erreichbar</string>
|
||||
<string name="addons_no_file">Keine Datei für diese Spielversion</string>
|
||||
<string name="input_reset_positions">Positionen zurücksetzen</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Εκκίνηση</string>
|
||||
<string name="mode_startup_session">Άνοιγμα κατά την εκκίνηση</string>
|
||||
<string name="mode_startup_session_hint">Ξεκινά αυτή τη συνεδρία όταν ανοίγει το DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Έλεγχος για εκδόσεις…</string>
|
||||
<string name="mode_decky_ready">Έτοιμο για εγκατάσταση %1$s.</string>
|
||||
<string name="mode_decky_none">Δεν βρέθηκε συμβατό build. Δοκιμάστε ξανά αργότερα.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Ενημερωμένο · %1$s</string>
|
||||
<string name="mode_decky_loader">Φορτωτής</string>
|
||||
<string name="mode_decky_install_latest">Εγκατάσταση τελευταίας έκδοσης</string>
|
||||
<string name="decky_channel">Κανάλι ενημερώσεων</string>
|
||||
<string name="decky_channel_hint">Ποιες εκδόσεις του Decky Loader θα εγκατασταθούν. Το πρόγραμμα ενημέρωσης του Decky χρησιμοποιεί το ίδιο κανάλι.</string>
|
||||
<string name="decky_channel_stable">Σταθερό</string>
|
||||
<string name="decky_channel_prerelease">Προέκδοση</string>
|
||||
<string name="decky_channel_testing">Δοκιμαστικό</string>
|
||||
<string name="decky_channel_failed">Δεν ήταν δυνατή η αποθήκευση του καναλιού ενημερώσεων του Decky</string>
|
||||
<string name="mode_decky_on">Ξεκινά με το Steam. Όσο είναι ενεργό, άλλες εφαρμογές σε αυτή τη συσκευή μπορεί να είναι σε θέση να ελέγξουν το Steam.</string>
|
||||
<string name="mode_decky_off">Ανενεργό. Η θύρα απομακρυσμένου εντοπισμού σφαλμάτων του Steam παραμένει κλειστή.</string>
|
||||
<string name="mode_decky_remove_title">Κατάργηση εγκατάστασης του Decky Loader;</string>
|
||||
<string name="mode_decky_remove_text">Καταργεί τον loader. Τα plugins και οι ρυθμίσεις σας διατηρούνται.</string>
|
||||
<string name="mode_client">Πελάτης</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Πλήρης οθόνη</string>
|
||||
<string name="setup_fullscreen_on">Αποκρύπτει τις γραμμές κατάστασης και πλοήγησης του Android</string>
|
||||
<string name="setup_fullscreen_off">Εμφανίζει τις γραμμές κατάστασης και πλοήγησης του Android</string>
|
||||
<string name="setup_page_swipe">Σάρωση μεταξύ σελίδων</string>
|
||||
<string name="setup_page_swipe_hint">Σαρώστε κατά μήκος μιας σελίδας για να αλλάξετε καρτέλα.</string>
|
||||
<string name="setup_dual_screen_launcher">Εκκινητής διπλής οθόνης</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Η επιλογή Αυτόματα τοποθετεί τις ενότητες του εκκινητή (Steam, Βιβλιοθήκη, Καταστήματα και τις υπόλοιπες) στη δεύτερη οθόνη των φορητών κονσολών με ενσωματωμένη δεύτερη οθόνη. Η επιλογή Ενεργό χρησιμοποιεί οποιαδήποτε δεύτερη οθόνη. Η επιλογή Ανενεργό κρατά τον εκκινητή σε μία οθόνη.</string>
|
||||
<string name="setup_dual_screen_sessions">Συνεδρίες διπλής οθόνης</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Περισσότερες λήψεις</string>
|
||||
<string name="addons_category_all">Όλες οι κατηγορίες</string>
|
||||
<string name="addons_none_found">Δεν βρέθηκαν πρόσθετα</string>
|
||||
<string name="addons_curse_busy">Κλείστε πρώτα το CurseForge</string>
|
||||
<string name="addons_unreachable">Δεν ήταν δυνατή η σύνδεση με %1$s</string>
|
||||
<string name="addons_no_file">Δεν υπάρχει αρχείο για αυτή την έκδοση του παιχνιδιού</string>
|
||||
<string name="input_reset_positions">Επαναφορά θέσεων</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Inicio</string>
|
||||
<string name="mode_startup_session">Abrir al iniciar</string>
|
||||
<string name="mode_startup_session_hint">Inicia esta sesión cuando se abre DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Buscando versiones…</string>
|
||||
<string name="mode_decky_ready">Listo para instalar %1$s.</string>
|
||||
<string name="mode_decky_none">No se encontró ninguna versión compatible. Inténtalo más tarde.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Al día · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Instalar la última</string>
|
||||
<string name="decky_channel">Canal de actualizaciones</string>
|
||||
<string name="decky_channel_hint">Qué versiones de Decky Loader se instalan. El actualizador propio de Decky usa el mismo canal.</string>
|
||||
<string name="decky_channel_stable">Estable</string>
|
||||
<string name="decky_channel_prerelease">Preliminar</string>
|
||||
<string name="decky_channel_testing">Pruebas</string>
|
||||
<string name="decky_channel_failed">No se ha podido guardar el canal de actualizaciones de Decky</string>
|
||||
<string name="mode_decky_on">Se inicia con Steam. Mientras esté activado, otras apps de este dispositivo podrían controlar Steam.</string>
|
||||
<string name="mode_decky_off">Desactivado. El puerto de depuración remota de Steam permanece cerrado.</string>
|
||||
<string name="mode_decky_remove_title">¿Desinstalar Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Elimina el loader. Tus plugins y ajustes se conservan.</string>
|
||||
<string name="mode_client">Cliente</string>
|
||||
@@ -962,6 +957,8 @@
|
||||
<string name="setup_fullscreen">Pantalla completa</string>
|
||||
<string name="setup_fullscreen_on">Oculta las barras de estado y navegación de Android</string>
|
||||
<string name="setup_fullscreen_off">Muestra las barras de estado y navegación de Android</string>
|
||||
<string name="setup_page_swipe">Deslizar entre páginas</string>
|
||||
<string name="setup_page_swipe_hint">Desliza sobre una página para cambiar de pestaña.</string>
|
||||
<string name="setup_dual_screen_launcher">Lanzador de doble pantalla</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automático coloca las secciones del lanzador (Steam, Biblioteca, Tiendas y el resto) en la segunda pantalla de las consolas portátiles que la llevan integrada. Activado usa cualquier segunda pantalla. Desactivado mantiene el lanzador en una sola pantalla.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesiones de doble pantalla</string>
|
||||
@@ -4055,6 +4052,7 @@
|
||||
<string name="addons_sort_downloads">Más descargados</string>
|
||||
<string name="addons_category_all">Todas las categorías</string>
|
||||
<string name="addons_none_found">No se han encontrado complementos</string>
|
||||
<string name="addons_curse_busy">Cierra CurseForge primero</string>
|
||||
<string name="addons_unreachable">No se pudo conectar con %1$s</string>
|
||||
<string name="addons_no_file">No hay ningún archivo para esta versión del juego</string>
|
||||
<string name="input_reset_positions">Restablecer posiciones</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Käynnistys</string>
|
||||
<string name="mode_startup_session">Avaa käynnistyksessä</string>
|
||||
<string name="mode_startup_session_hint">Käynnistää tämän istunnon, kun DroidDeck avataan.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Tarkistetaan julkaisuja…</string>
|
||||
<string name="mode_decky_ready">Valmiina asentamaan %1$s.</string>
|
||||
<string name="mode_decky_none">Yhteensopivaa versiota ei löytynyt. Yritä myöhemmin uudelleen.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Ajan tasalla · %1$s</string>
|
||||
<string name="mode_decky_loader">Lataaja</string>
|
||||
<string name="mode_decky_install_latest">Asenna uusin</string>
|
||||
<string name="decky_channel">Päivityskanava</string>
|
||||
<string name="decky_channel_hint">Mitkä Decky Loader -julkaisut asennetaan. Deckyn oma päivitysohjelma käyttää samaa kanavaa.</string>
|
||||
<string name="decky_channel_stable">Vakaa</string>
|
||||
<string name="decky_channel_prerelease">Esijulkaisu</string>
|
||||
<string name="decky_channel_testing">Testaus</string>
|
||||
<string name="decky_channel_failed">Deckyn päivityskanavaa ei voitu tallentaa</string>
|
||||
<string name="mode_decky_on">Käynnistyy Steamin kanssa. Päällä ollessaan muut tämän laitteen sovellukset voivat pystyä ohjaamaan Steamia.</string>
|
||||
<string name="mode_decky_off">Pois. Steamin etävianmääritysportti pysyy suljettuna.</string>
|
||||
<string name="mode_decky_remove_title">Poistetaanko Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Poistaa loaderin. Laajennuksesi ja asetuksesi säilyvät.</string>
|
||||
<string name="mode_client">Asiakasohjelma</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Koko näyttö</string>
|
||||
<string name="setup_fullscreen_on">Piilottaa Androidin tila- ja navigointipalkit</string>
|
||||
<string name="setup_fullscreen_off">Näyttää Androidin tila- ja navigointipalkit</string>
|
||||
<string name="setup_page_swipe">Pyyhkäise sivujen välillä</string>
|
||||
<string name="setup_page_swipe_hint">Vaihda välilehteä pyyhkäisemällä sivun poikki.</string>
|
||||
<string name="setup_dual_screen_launcher">Kahden näytön käynnistin</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automaattinen siirtää käynnistimen osiot (Steam, Kirjasto, Kaupat ja muut) käsikonsolin sisäänrakennetulle toiselle näytölle. Päällä käyttää mitä tahansa toista näyttöä. Pois päältä pitää käynnistimen yhdellä näytöllä.</string>
|
||||
<string name="setup_dual_screen_sessions">Kahden näytön istunnot</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Ladatuimmat</string>
|
||||
<string name="addons_category_all">Kaikki luokat</string>
|
||||
<string name="addons_none_found">Lisäosia ei löytynyt</string>
|
||||
<string name="addons_curse_busy">Sulje CurseForge ensin</string>
|
||||
<string name="addons_unreachable">Yhteyttä palveluun %1$s ei saatu</string>
|
||||
<string name="addons_no_file">Tälle peliversiolle ei ole tiedostoa</string>
|
||||
<string name="input_reset_positions">Palauta sijainnit</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Démarrage</string>
|
||||
<string name="mode_startup_session">Ouvrir au démarrage</string>
|
||||
<string name="mode_startup_session_hint">Lance cette session au démarrage de DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Vérification des versions…</string>
|
||||
<string name="mode_decky_ready">Prêt à installer %1$s.</string>
|
||||
<string name="mode_decky_none">Aucune version compatible trouvée. Veuillez réessayer plus tard.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">À jour · %1$s</string>
|
||||
<string name="mode_decky_loader">Chargeur</string>
|
||||
<string name="mode_decky_install_latest">Installer la dernière version</string>
|
||||
<string name="decky_channel">Canal de mise à jour</string>
|
||||
<string name="decky_channel_hint">Les versions de Decky Loader à installer. Le programme de mise à jour de Decky utilise le même canal.</string>
|
||||
<string name="decky_channel_stable">Stable</string>
|
||||
<string name="decky_channel_prerelease">Préversion</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Impossible d\'enregistrer le canal de mise à jour de Decky</string>
|
||||
<string name="mode_decky_on">Démarre avec Steam. Une fois activé, d\'autres applications sur cet appareil peuvent contrôler Steam.</string>
|
||||
<string name="mode_decky_off">Désactivé. Le port de débogage distant de Steam reste fermé.</string>
|
||||
<string name="mode_decky_remove_title">Désinstaller Decky Loader ?</string>
|
||||
<string name="mode_decky_remove_text">Supprime le chargeur. Vos plugins et paramètres seront conservés.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -962,6 +957,8 @@
|
||||
<string name="setup_fullscreen">Plein écran</string>
|
||||
<string name="setup_fullscreen_on">Masquer la barre d\'état et la barre de navigation Android</string>
|
||||
<string name="setup_fullscreen_off">Afficher la barre d\'état et la barre de navigation Android</string>
|
||||
<string name="setup_page_swipe">Balayer entre les pages</string>
|
||||
<string name="setup_page_swipe_hint">Balayez une page pour changer d\'onglet.</string>
|
||||
<string name="setup_dual_screen_launcher">Lanceur double écran</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatique place les sections du lanceur (Steam, Bibliothèque, Boutiques et les autres) sur le second écran intégré des consoles portables qui en sont équipées. Activé utilise n\'importe quel écran secondaire. Désactivé conserve le lanceur sur un seul écran.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessions double écran</string>
|
||||
@@ -4054,6 +4051,7 @@
|
||||
<string name="addons_sort_downloads">Les plus téléchargés</string>
|
||||
<string name="addons_category_all">Toutes les catégories</string>
|
||||
<string name="addons_none_found">Aucun addon trouvé</string>
|
||||
<string name="addons_curse_busy">Fermez d\'abord CurseForge</string>
|
||||
<string name="addons_unreachable">Impossible de joindre %1$s</string>
|
||||
<string name="addons_no_file">Aucun fichier pour cette version du jeu</string>
|
||||
<string name="input_reset_positions">Réinitialiser les positions</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">स्टार्टअप</string>
|
||||
<string name="mode_startup_session">लॉन्च पर खोलें</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck खुलने पर यह सेशन शुरू करता है।</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">रिलीज़ देखी जा रही हैं…</string>
|
||||
<string name="mode_decky_ready">%1$s इंस्टॉल करने के लिए तैयार।</string>
|
||||
<string name="mode_decky_none">कोई कम्पैटिबल बिल्ड नहीं मिला। बाद में फिर कोशिश करें।</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">नवीनतम · %1$s</string>
|
||||
<string name="mode_decky_loader">लोडर</string>
|
||||
<string name="mode_decky_install_latest">नवीनतम इंस्टॉल करें</string>
|
||||
<string name="decky_channel">अपडेट चैनल</string>
|
||||
<string name="decky_channel_hint">कौन-सी Decky Loader रिलीज़ इंस्टॉल करनी हैं। Decky का अपना अपडेटर भी यही चैनल इस्तेमाल करता है।</string>
|
||||
<string name="decky_channel_stable">स्टेबल</string>
|
||||
<string name="decky_channel_prerelease">प्री-रिलीज़</string>
|
||||
<string name="decky_channel_testing">टेस्टिंग</string>
|
||||
<string name="decky_channel_failed">Decky अपडेट चैनल सेव नहीं हो सका</string>
|
||||
<string name="mode_decky_on">Steam के साथ शुरू होता है। चालू रहते हुए, इस डिवाइस के दूसरे ऐप Steam को नियंत्रित कर सकते हैं।</string>
|
||||
<string name="mode_decky_off">बंद। Steam का रिमोट डिबगिंग पोर्ट बंद रहता है।</string>
|
||||
<string name="mode_decky_remove_title">Decky Loader अनइंस्टॉल करें?</string>
|
||||
<string name="mode_decky_remove_text">लोडर हटाता है। आपके प्लगइन और सेटिंग बनी रहती हैं।</string>
|
||||
<string name="mode_client">क्लाइंट</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">फ़ुलस्क्रीन</string>
|
||||
<string name="setup_fullscreen_on">Android स्टेटस और नेविगेशन बार छिपाता है</string>
|
||||
<string name="setup_fullscreen_off">Android स्टेटस और नेविगेशन बार दिखाता है</string>
|
||||
<string name="setup_page_swipe">पेजों के बीच स्वाइप करें</string>
|
||||
<string name="setup_page_swipe_hint">टैब बदलने के लिए किसी पेज पर स्वाइप करें।</string>
|
||||
<string name="setup_dual_screen_launcher">डुअल स्क्रीन लॉन्चर</string>
|
||||
<string name="setup_dual_screen_launcher_hint">स्वचालित पर, बिल्ट-इन दूसरी स्क्रीन वाले हैंडहेल्ड में लॉन्चर के सेक्शन (Steam, लाइब्रेरी, स्टोर्स और बाकी) दूसरी स्क्रीन पर चले जाते हैं। चालू पर कोई भी दूसरी डिस्प्ले इस्तेमाल होती है। बंद पर लॉन्चर एक ही स्क्रीन पर रहता है।</string>
|
||||
<string name="setup_dual_screen_sessions">डुअल स्क्रीन सत्र</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">सबसे ज़्यादा डाउनलोड</string>
|
||||
<string name="addons_category_all">सभी श्रेणियाँ</string>
|
||||
<string name="addons_none_found">कोई ऐडऑन नहीं मिला</string>
|
||||
<string name="addons_curse_busy">पहले CurseForge बंद करें</string>
|
||||
<string name="addons_unreachable">%1$s तक नहीं पहुँच सके</string>
|
||||
<string name="addons_no_file">गेम के इस संस्करण के लिए कोई फ़ाइल नहीं है</string>
|
||||
<string name="input_reset_positions">स्थितियाँ रीसेट करें</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Indítás</string>
|
||||
<string name="mode_startup_session">Megnyitás indításkor</string>
|
||||
<string name="mode_startup_session_hint">A DroidDeck indulásakor elindítja ezt a munkamenetet.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Kiadások keresése…</string>
|
||||
<string name="mode_decky_ready">Készen áll a %1$s telepítésére.</string>
|
||||
<string name="mode_decky_none">Nem található kompatibilis build. Próbálja újra később.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Naprakész · %1$s</string>
|
||||
<string name="mode_decky_loader">Betöltő</string>
|
||||
<string name="mode_decky_install_latest">Legújabb telepítése</string>
|
||||
<string name="decky_channel">Frissítési csatorna</string>
|
||||
<string name="decky_channel_hint">Mely Decky Loader-kiadások települjenek. A Decky saját frissítője ugyanezt a csatornát használja.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Előzetes kiadás</string>
|
||||
<string name="decky_channel_testing">Tesztelés</string>
|
||||
<string name="decky_channel_failed">Nem sikerült menteni a Decky frissítési csatornáját</string>
|
||||
<string name="mode_decky_on">A Steammel együtt indul. Amíg be van kapcsolva, az eszközön lévő más alkalmazások is irányíthatják a Steamet.</string>
|
||||
<string name="mode_decky_off">Ki. A Steam távoli hibakeresési portja zárva marad.</string>
|
||||
<string name="mode_decky_remove_title">Eltávolítja a Decky Loadert?</string>
|
||||
<string name="mode_decky_remove_text">Eltávolítja a betöltőt. A bővítményei és beállításai megmaradnak.</string>
|
||||
<string name="mode_client">Kliens</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Teljes képernyő</string>
|
||||
<string name="setup_fullscreen_on">Elrejti az Android állapot- és navigációs sávokat</string>
|
||||
<string name="setup_fullscreen_off">Megjeleníti az Android állapot- és navigációs sávokat</string>
|
||||
<string name="setup_page_swipe">Lapozás csúsztatással</string>
|
||||
<string name="setup_page_swipe_hint">Csúsztasson végig egy oldalon a lapváltáshoz.</string>
|
||||
<string name="setup_dual_screen_launcher">Kétképernyős indító</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Az Automatikus mód a beépített második képernyővel rendelkező kézi eszközökön a második képernyőre helyezi az indító szakaszait (Steam, Könyvtár, Áruházak és a többi). A Be mód bármely második kijelzőt használ. A Ki mód egy képernyőn tartja az indítót.</string>
|
||||
<string name="setup_dual_screen_sessions">Kétképernyős munkamenetek</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Legtöbbet letöltött</string>
|
||||
<string name="addons_category_all">Minden kategória</string>
|
||||
<string name="addons_none_found">Nem található kiegészítő</string>
|
||||
<string name="addons_curse_busy">Előbb zárd be a CurseForge-ot</string>
|
||||
<string name="addons_unreachable">A(z) %1$s nem érhető el</string>
|
||||
<string name="addons_no_file">Nincs fájl ehhez a játékverzióhoz</string>
|
||||
<string name="input_reset_positions">Pozíciók visszaállítása</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Mulai</string>
|
||||
<string name="mode_startup_session">Buka saat peluncuran</string>
|
||||
<string name="mode_startup_session_hint">Memulai sesi ini saat DroidDeck diluncurkan.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Memeriksa rilis…</string>
|
||||
<string name="mode_decky_ready">Siap menginstal %1$s.</string>
|
||||
<string name="mode_decky_none">Tidak ditemukan build yang kompatibel. Coba lagi nanti.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Terbaru · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Instal versi terbaru</string>
|
||||
<string name="decky_channel">Saluran Pembaruan</string>
|
||||
<string name="decky_channel_hint">Rilis Decky Loader mana yang akan diinstal. Pembaru bawaan Decky menggunakan saluran yang sama.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Prarilis</string>
|
||||
<string name="decky_channel_testing">Pengujian</string>
|
||||
<string name="decky_channel_failed">Tidak dapat menyimpan saluran pembaruan Decky</string>
|
||||
<string name="mode_decky_on">Dimulai bersama Steam. Saat aktif, aplikasi lain di perangkat ini mungkin dapat mengendalikan Steam.</string>
|
||||
<string name="mode_decky_off">Nonaktif. Port debugging jarak jauh Steam tetap tertutup.</string>
|
||||
<string name="mode_decky_remove_title">Hapus instalasi Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Menghapus loader. Plugin dan setelan Anda tetap disimpan.</string>
|
||||
<string name="mode_client">Klien</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">Layar penuh</string>
|
||||
<string name="setup_fullscreen_on">Menyembunyikan bilah status dan navigasi Android</string>
|
||||
<string name="setup_fullscreen_off">Menampilkan bilah status dan navigasi Android</string>
|
||||
<string name="setup_page_swipe">Geser antarhalaman</string>
|
||||
<string name="setup_page_swipe_hint">Geser melintasi halaman untuk berganti tab.</string>
|
||||
<string name="setup_dual_screen_launcher">Peluncur layar ganda</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Otomatis menempatkan bagian peluncur (Steam, Pustaka, Toko, dan bagian lainnya) pada layar kedua bawaan perangkat genggam. Aktif memakai layar kedua mana pun. Nonaktif membuat peluncur tetap di satu layar saja.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesi layar ganda</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">Paling banyak diunduh</string>
|
||||
<string name="addons_category_all">Semua kategori</string>
|
||||
<string name="addons_none_found">Tidak ada addon ditemukan</string>
|
||||
<string name="addons_curse_busy">Tutup CurseForge terlebih dahulu</string>
|
||||
<string name="addons_unreachable">Tidak dapat menjangkau %1$s</string>
|
||||
<string name="addons_no_file">Tidak ada file untuk versi game ini</string>
|
||||
<string name="input_reset_positions">Atur ulang posisi</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Avvio</string>
|
||||
<string name="mode_startup_session">Apri all\'avvio</string>
|
||||
<string name="mode_startup_session_hint">Avvia questa sessione all\'avvio di DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Ricerca di release…</string>
|
||||
<string name="mode_decky_ready">Pronto per installare %1$s.</string>
|
||||
<string name="mode_decky_none">Nessuna build compatibile trovata. Riprova più tardi.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Ultima versione · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Installa l\'ultima versione</string>
|
||||
<string name="decky_channel">Canale di aggiornamento</string>
|
||||
<string name="decky_channel_hint">Quali release di Decky Loader installare. Anche l\'aggiornamento integrato di Decky usa lo stesso canale.</string>
|
||||
<string name="decky_channel_stable">Stabile</string>
|
||||
<string name="decky_channel_prerelease">Pre-release</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Impossibile salvare il canale di aggiornamento di Decky</string>
|
||||
<string name="mode_decky_on">Si avvia con Steam. Quando è attivo, altre app su questo dispositivo potrebbero controllare Steam.</string>
|
||||
<string name="mode_decky_off">Disattivato. La porta di debug remoto di Steam resta chiusa.</string>
|
||||
<string name="mode_decky_remove_title">Disinstallare Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Rimuove il loader. I tuoi plugin e le impostazioni vengono mantenuti.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -954,6 +949,8 @@
|
||||
<string name="setup_fullscreen">Schermo intero</string>
|
||||
<string name="setup_fullscreen_on">Nasconde la barra di stato e la barra di navigazione di Android</string>
|
||||
<string name="setup_fullscreen_off">Mostra la barra di stato e la barra di navigazione di Android</string>
|
||||
<string name="setup_page_swipe">Scorri tra le pagine</string>
|
||||
<string name="setup_page_swipe_hint">Scorri su una pagina per cambiare scheda.</string>
|
||||
<string name="setup_dual_screen_launcher">Launcher a doppio schermo</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatico colloca le sezioni del launcher (Steam, Libreria, Store e le altre) sullo schermo secondario integrato delle console portatili che ne hanno uno. Con Attivo si usa qualsiasi display secondario. Con Disattivo il launcher resta su un solo schermo.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessioni a doppio schermo</string>
|
||||
@@ -4054,6 +4051,7 @@
|
||||
<string name="addons_sort_downloads">Più scaricati</string>
|
||||
<string name="addons_category_all">Tutte le categorie</string>
|
||||
<string name="addons_none_found">Nessun addon trovato</string>
|
||||
<string name="addons_curse_busy">Chiudi prima CurseForge</string>
|
||||
<string name="addons_unreachable">Impossibile raggiungere %1$s</string>
|
||||
<string name="addons_no_file">Nessun file per questa versione del gioco</string>
|
||||
<string name="input_reset_positions">Ripristina posizioni</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">起動</string>
|
||||
<string name="mode_startup_session">起動時に開く</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck の起動時にこのセッションを開始します。</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">リリースを確認中…</string>
|
||||
<string name="mode_decky_ready">%1$sをインストールする準備ができました。</string>
|
||||
<string name="mode_decky_none">互換性のあるバージョンが見つかりません。後でもう一度お試しください。</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">最新です · %1$s</string>
|
||||
<string name="mode_decky_loader">ローダー</string>
|
||||
<string name="mode_decky_install_latest">最新バージョンをインストール</string>
|
||||
<string name="decky_channel">アップデートチャンネル</string>
|
||||
<string name="decky_channel_hint">インストールするDecky Loaderのリリースです。Decky自身のアップデーターも同じチャンネルを使用します。</string>
|
||||
<string name="decky_channel_stable">安定版</string>
|
||||
<string name="decky_channel_prerelease">プレリリース版</string>
|
||||
<string name="decky_channel_testing">テスト版</string>
|
||||
<string name="decky_channel_failed">Deckyのアップデートチャンネルを保存できませんでした</string>
|
||||
<string name="mode_decky_on">Steamと共に起動します。有効にすると、このデバイス上の他のアプリがSteamを制御できる場合があります。</string>
|
||||
<string name="mode_decky_off">オフ。Steamのリモートデバッグポートは閉じたままになります。</string>
|
||||
<string name="mode_decky_remove_title">Decky Loaderをアンインストールしますか?</string>
|
||||
<string name="mode_decky_remove_text">ローダーを削除します。プラグインと設定は保持されます。</string>
|
||||
<string name="mode_client">クライアント</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">全画面</string>
|
||||
<string name="setup_fullscreen_on">Androidのステータスバーとナビゲーションバーを非表示</string>
|
||||
<string name="setup_fullscreen_off">Androidのステータスバーとナビゲーションバーを表示</string>
|
||||
<string name="setup_page_swipe">スワイプでページを切り替え</string>
|
||||
<string name="setup_page_swipe_hint">ページを横切るようにスワイプすると、タブを切り替えます。</string>
|
||||
<string name="setup_dual_screen_launcher">デュアルスクリーンランチャー</string>
|
||||
<string name="setup_dual_screen_launcher_hint">自動では、内蔵セカンドスクリーンを搭載した携帯ゲーム機で、ランチャーの各セクション(Steam、ライブラリ、ストアなど)を2画面目に表示します。オンでは任意のセカンドディスプレイを使用します。オフではランチャーを1画面に留めます。</string>
|
||||
<string name="setup_dual_screen_sessions">デュアルスクリーンセッション</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">ダウンロード数順</string>
|
||||
<string name="addons_category_all">すべてのカテゴリ</string>
|
||||
<string name="addons_none_found">アドオンが見つかりません</string>
|
||||
<string name="addons_curse_busy">先に CurseForge を閉じてください</string>
|
||||
<string name="addons_unreachable">%1$s に接続できませんでした</string>
|
||||
<string name="addons_no_file">このゲームバージョン用のファイルがありません</string>
|
||||
<string name="input_reset_positions">位置をリセット</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">시작</string>
|
||||
<string name="mode_startup_session">실행 시 열기</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck을 실행할 때 이 세션을 시작합니다.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">릴리스 확인 중…</string>
|
||||
<string name="mode_decky_ready">%1$s을(를) 설치할 준비가 되었습니다.</string>
|
||||
<string name="mode_decky_none">호환되는 버전을 찾을 수 없습니다. 나중에 다시 시도하세요.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">최신 버전 · %1$s</string>
|
||||
<string name="mode_decky_loader">로더</string>
|
||||
<string name="mode_decky_install_latest">최신 버전 설치</string>
|
||||
<string name="decky_channel">업데이트 채널</string>
|
||||
<string name="decky_channel_hint">설치할 Decky Loader 릴리스입니다. Decky 자체 업데이터도 같은 채널을 사용합니다.</string>
|
||||
<string name="decky_channel_stable">안정판</string>
|
||||
<string name="decky_channel_prerelease">사전 출시판</string>
|
||||
<string name="decky_channel_testing">테스트판</string>
|
||||
<string name="decky_channel_failed">Decky 업데이트 채널을 저장할 수 없습니다</string>
|
||||
<string name="mode_decky_on">Steam과 함께 시작됩니다. 활성화하면 이 기기의 다른 앱이 Steam을 제어할 수 있습니다.</string>
|
||||
<string name="mode_decky_off">끔. Steam의 원격 디버깅 포트가 닫힌 상태로 유지됩니다.</string>
|
||||
<string name="mode_decky_remove_title">Decky Loader를 제거하시겠습니까?</string>
|
||||
<string name="mode_decky_remove_text">로더를 제거합니다. 플러그인과 설정은 유지됩니다.</string>
|
||||
<string name="mode_client">클라이언트</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">전체 화면</string>
|
||||
<string name="setup_fullscreen_on">Android 상태 표시줄 및 탐색 표시줄 숨기기</string>
|
||||
<string name="setup_fullscreen_off">Android 상태 표시줄 및 탐색 표시줄 표시</string>
|
||||
<string name="setup_page_swipe">스와이프로 페이지 전환</string>
|
||||
<string name="setup_page_swipe_hint">페이지를 가로질러 스와이프하면 탭이 바뀝니다.</string>
|
||||
<string name="setup_dual_screen_launcher">듀얼 화면 런처</string>
|
||||
<string name="setup_dual_screen_launcher_hint">자동은 내장 두 번째 화면이 있는 휴대용 기기에서 런처 섹션(Steam, 라이브러리, 스토어 등)을 두 번째 화면에 표시합니다. 켜기는 어떤 두 번째 디스플레이든 사용합니다. 끄기는 런처를 한 화면에 유지합니다.</string>
|
||||
<string name="setup_dual_screen_sessions">듀얼 화면 세션</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">다운로드 많은 순</string>
|
||||
<string name="addons_category_all">모든 카테고리</string>
|
||||
<string name="addons_none_found">애드온을 찾을 수 없음</string>
|
||||
<string name="addons_curse_busy">먼저 CurseForge를 닫으세요</string>
|
||||
<string name="addons_unreachable">%1$s에 연결할 수 없습니다</string>
|
||||
<string name="addons_no_file">이 게임 버전용 파일이 없습니다</string>
|
||||
<string name="input_reset_positions">위치 초기화</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Permulaan</string>
|
||||
<string name="mode_startup_session">Buka semasa pelancaran</string>
|
||||
<string name="mode_startup_session_hint">Memulakan sesi ini apabila DroidDeck dilancarkan.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Menyemak keluaran…</string>
|
||||
<string name="mode_decky_ready">Sedia untuk memasang %1$s.</string>
|
||||
<string name="mode_decky_none">Tiada binaan serasi ditemui. Cuba lagi kemudian.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Terkini · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Pasang yang terbaharu</string>
|
||||
<string name="decky_channel">Saluran Kemas Kini</string>
|
||||
<string name="decky_channel_hint">Keluaran Decky Loader yang hendak dipasang. Pengemas kini Decky sendiri menggunakan saluran yang sama.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Prakeluaran</string>
|
||||
<string name="decky_channel_testing">Pengujian</string>
|
||||
<string name="decky_channel_failed">Tidak dapat menyimpan saluran kemas kini Decky</string>
|
||||
<string name="mode_decky_on">Bermula bersama Steam. Semasa dihidupkan, apl lain pada peranti ini mungkin boleh mengawal Steam.</string>
|
||||
<string name="mode_decky_off">Mati. Port debug jauh Steam kekal tertutup.</string>
|
||||
<string name="mode_decky_remove_title">Nyahpasang Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Mengalih keluar loader. Plugin dan tetapan anda dikekalkan.</string>
|
||||
<string name="mode_client">Klien</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">Skrin penuh</string>
|
||||
<string name="setup_fullscreen_on">Menyembunyikan bar status dan navigasi Android</string>
|
||||
<string name="setup_fullscreen_off">Memaparkan bar status dan navigasi Android</string>
|
||||
<string name="setup_page_swipe">Leret antara halaman</string>
|
||||
<string name="setup_page_swipe_hint">Leret merentasi halaman untuk menukar tab.</string>
|
||||
<string name="setup_dual_screen_launcher">Pelancar dwi skrin</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatik meletakkan bahagian pelancar (Steam, Pustaka, Kedai dan selebihnya) pada skrin kedua terbina dalam peranti genggam. Hidup menggunakan sebarang paparan kedua. Mati mengekalkan pelancar pada satu skrin.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesi dwi skrin</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">Paling banyak dimuat turun</string>
|
||||
<string name="addons_category_all">Semua kategori</string>
|
||||
<string name="addons_none_found">Tiada addon ditemui</string>
|
||||
<string name="addons_curse_busy">Tutup CurseForge dahulu</string>
|
||||
<string name="addons_unreachable">Tidak dapat mencapai %1$s</string>
|
||||
<string name="addons_no_file">Tiada fail untuk versi permainan ini</string>
|
||||
<string name="input_reset_positions">Tetapkan semula kedudukan</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Oppstart</string>
|
||||
<string name="mode_startup_session">Åpne ved oppstart</string>
|
||||
<string name="mode_startup_session_hint">Starter denne økten når DroidDeck starter.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Ser etter utgivelser…</string>
|
||||
<string name="mode_decky_ready">Klar til å installere %1$s.</string>
|
||||
<string name="mode_decky_none">Ingen kompatibel build funnet. Prøv igjen senere.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Oppdatert · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Installer nyeste</string>
|
||||
<string name="decky_channel">Oppdateringskanal</string>
|
||||
<string name="decky_channel_hint">Hvilke Decky Loader-utgivelser som installeres. Deckys egen oppdatering bruker samme kanal.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Forhåndsutgivelse</string>
|
||||
<string name="decky_channel_testing">Testing</string>
|
||||
<string name="decky_channel_failed">Kunne ikke lagre oppdateringskanalen for Decky</string>
|
||||
<string name="mode_decky_on">Starter med Steam. Mens på, kan andre apper på denne enheten kanskje styre Steam.</string>
|
||||
<string name="mode_decky_off">Av. Steams fjernsøkeport for feilsøking forblir stengt.</string>
|
||||
<string name="mode_decky_remove_title">Avinstaller Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Fjerner loaderen. Programtilleggene og innstillingene dine beholdes.</string>
|
||||
<string name="mode_client">Klient</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Fullskjerm</string>
|
||||
<string name="setup_fullscreen_on">Skjuler Androids status- og navigasjonslinjer</string>
|
||||
<string name="setup_fullscreen_off">Viser Androids status- og navigasjonslinjer</string>
|
||||
<string name="setup_page_swipe">Sveip mellom sider</string>
|
||||
<string name="setup_page_swipe_hint">Sveip over en side for å bytte fane.</string>
|
||||
<string name="setup_dual_screen_launcher">Startprogram på to skjermer</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatisk plasserer startprogrammets deler (Steam, Bibliotek, Butikker og resten) på den andre skjermen på håndholdte enheter med innebygd sekundærskjerm. På bruker en hvilken som helst annen skjerm. Av holder startprogrammet på én skjerm.</string>
|
||||
<string name="setup_dual_screen_sessions">Økter på to skjermer</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Mest nedlastet</string>
|
||||
<string name="addons_category_all">Alle kategorier</string>
|
||||
<string name="addons_none_found">Fant ingen tillegg</string>
|
||||
<string name="addons_curse_busy">Lukk CurseForge først</string>
|
||||
<string name="addons_unreachable">Fikk ikke kontakt med %1$s</string>
|
||||
<string name="addons_no_file">Ingen fil for denne spillversjonen</string>
|
||||
<string name="input_reset_positions">Tilbakestill plasseringer</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Opstarten</string>
|
||||
<string name="mode_startup_session">Openen bij start</string>
|
||||
<string name="mode_startup_session_hint">Start deze sessie wanneer DroidDeck start.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Zoeken naar releases…</string>
|
||||
<string name="mode_decky_ready">Klaar om %1$s te installeren.</string>
|
||||
<string name="mode_decky_none">Geen compatibele build gevonden. Probeer het later opnieuw.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Up-to-date · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Nieuwste installeren</string>
|
||||
<string name="decky_channel">Updatekanaal</string>
|
||||
<string name="decky_channel_hint">Welke Decky Loader-releases worden geïnstalleerd. De eigen updater van Decky gebruikt hetzelfde kanaal.</string>
|
||||
<string name="decky_channel_stable">Stabiel</string>
|
||||
<string name="decky_channel_prerelease">Voorlopige release</string>
|
||||
<string name="decky_channel_testing">Testversie</string>
|
||||
<string name="decky_channel_failed">Kan het Decky-updatekanaal niet opslaan</string>
|
||||
<string name="mode_decky_on">Start met Steam. Zolang dit aan staat, kunnen andere apps op dit apparaat Steam mogelijk bedienen.</string>
|
||||
<string name="mode_decky_off">Uit. De poort voor foutopsporing op afstand van Steam blijft dicht.</string>
|
||||
<string name="mode_decky_remove_title">Decky Loader verwijderen?</string>
|
||||
<string name="mode_decky_remove_text">Verwijdert de loader. Je plug-ins en instellingen blijven behouden.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Volledig scherm</string>
|
||||
<string name="setup_fullscreen_on">Verbergt de statusbalk en navigatiebalk van Android</string>
|
||||
<string name="setup_fullscreen_off">Toont de statusbalk en navigatiebalk van Android</string>
|
||||
<string name="setup_page_swipe">Vegen tussen pagina\'s</string>
|
||||
<string name="setup_page_swipe_hint">Veeg over een pagina om van tabblad te wisselen.</string>
|
||||
<string name="setup_dual_screen_launcher">Launcher op twee schermen</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatisch zet de launchersecties (Steam, Bibliotheek, Winkels en de rest) op het tweede scherm van handhelds met een ingebouwd exemplaar. Aan gebruikt elk tweede scherm. Uit houdt de launcher op één scherm.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessies op twee schermen</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Meest gedownload</string>
|
||||
<string name="addons_category_all">Alle categorieën</string>
|
||||
<string name="addons_none_found">Geen add-ons gevonden</string>
|
||||
<string name="addons_curse_busy">Sluit eerst CurseForge</string>
|
||||
<string name="addons_unreachable">Kan %1$s niet bereiken</string>
|
||||
<string name="addons_no_file">Geen bestand voor deze gameversie</string>
|
||||
<string name="input_reset_positions">Posities herstellen</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Uruchamianie</string>
|
||||
<string name="mode_startup_session">Otwórz przy uruchomieniu</string>
|
||||
<string name="mode_startup_session_hint">Uruchamia tę sesję po uruchomieniu DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Sprawdzanie wydań…</string>
|
||||
<string name="mode_decky_ready">Gotowe do instalacji: %1$s.</string>
|
||||
<string name="mode_decky_none">Nie znaleziono zgodnej wersji. Spróbuj ponownie później.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Aktualna · %1$s</string>
|
||||
<string name="mode_decky_loader">Program ładujący</string>
|
||||
<string name="mode_decky_install_latest">Zainstaluj najnowszą</string>
|
||||
<string name="decky_channel">Kanał aktualizacji</string>
|
||||
<string name="decky_channel_hint">Które wydania Decky Loader instalować. Wbudowany aktualizator Decky używa tego samego kanału.</string>
|
||||
<string name="decky_channel_stable">Stabilny</string>
|
||||
<string name="decky_channel_prerelease">Przedpremierowy</string>
|
||||
<string name="decky_channel_testing">Testowy</string>
|
||||
<string name="decky_channel_failed">Nie udało się zapisać kanału aktualizacji Decky</string>
|
||||
<string name="mode_decky_on">Uruchamia się ze Steam. Gdy jest włączony, inne aplikacje na tym urządzeniu mogą sterować Steam.</string>
|
||||
<string name="mode_decky_off">Wyłączony. Port zdalnego debugowania Steam pozostaje zamknięty.</string>
|
||||
<string name="mode_decky_remove_title">Odinstalować Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Usuwa program ładujący. Twoje wtyczki i ustawienia zostaną zachowane.</string>
|
||||
<string name="mode_client">Klient</string>
|
||||
@@ -965,6 +960,8 @@
|
||||
<string name="setup_fullscreen">Pełny ekran</string>
|
||||
<string name="setup_fullscreen_on">Ukrywa systemowe paski stanu i nawigacji</string>
|
||||
<string name="setup_fullscreen_off">Pokazuje systemowe paski stanu i nawigacji</string>
|
||||
<string name="setup_page_swipe">Przesuwanie między stronami</string>
|
||||
<string name="setup_page_swipe_hint">Przesuń palcem po stronie, aby zmienić kartę.</string>
|
||||
<string name="setup_dual_screen_launcher">Launcher na dwóch ekranach</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatycznie umieszcza sekcje launchera (Steam, Biblioteka, Sklepy i pozostałe) na wbudowanym drugim ekranie konsol przenośnych. Włączone używa dowolnego drugiego wyświetlacza. Wyłączone pozostawia launcher na jednym ekranie.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesje na dwóch ekranach</string>
|
||||
@@ -4095,6 +4092,7 @@
|
||||
<string name="addons_sort_downloads">Najczęściej pobierane</string>
|
||||
<string name="addons_category_all">Wszystkie kategorie</string>
|
||||
<string name="addons_none_found">Nie znaleziono dodatków</string>
|
||||
<string name="addons_curse_busy">Najpierw zamknij CurseForge</string>
|
||||
<string name="addons_unreachable">Nie można połączyć się z %1$s</string>
|
||||
<string name="addons_no_file">Brak pliku dla tej wersji gry</string>
|
||||
<string name="input_reset_positions">Resetuj położenie</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Arranque</string>
|
||||
<string name="mode_startup_session">Abrir ao iniciar</string>
|
||||
<string name="mode_startup_session_hint">Inicia esta sessão quando o DroidDeck é aberto.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">A procurar versões…</string>
|
||||
<string name="mode_decky_ready">Pronto para instalar %1$s.</string>
|
||||
<string name="mode_decky_none">Nenhuma versão compatível encontrada. Tente novamente mais tarde.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Atualizado · %1$s</string>
|
||||
<string name="mode_decky_loader">Carregador</string>
|
||||
<string name="mode_decky_install_latest">Instalar a versão mais recente</string>
|
||||
<string name="decky_channel">Canal de atualização</string>
|
||||
<string name="decky_channel_hint">Que versões do Decky Loader instalar. O atualizador do próprio Decky utiliza o mesmo canal.</string>
|
||||
<string name="decky_channel_stable">Estável</string>
|
||||
<string name="decky_channel_prerelease">Pré-lançamento</string>
|
||||
<string name="decky_channel_testing">Testes</string>
|
||||
<string name="decky_channel_failed">Não foi possível guardar o canal de atualização do Decky</string>
|
||||
<string name="mode_decky_on">Inicia com o Steam. Enquanto estiver ligado, outras apps neste dispositivo poderão controlar o Steam.</string>
|
||||
<string name="mode_decky_off">Desligado. A porta de depuração remota do Steam mantém-se fechada.</string>
|
||||
<string name="mode_decky_remove_title">Desinstalar o Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Remove o carregador. Os seus plugins e definições são mantidos.</string>
|
||||
<string name="mode_client">Cliente</string>
|
||||
@@ -954,6 +949,8 @@
|
||||
<string name="setup_fullscreen">Ecrã inteiro</string>
|
||||
<string name="setup_fullscreen_on">Oculta as barras de estado e de navegação do Android</string>
|
||||
<string name="setup_fullscreen_off">Mostra as barras de estado e de navegação do Android</string>
|
||||
<string name="setup_page_swipe">Deslizar entre páginas</string>
|
||||
<string name="setup_page_swipe_hint">Deslize sobre uma página para mudar de separador.</string>
|
||||
<string name="setup_dual_screen_launcher">Iniciador de ecrã duplo</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automático coloca as secções do iniciador (Steam, Biblioteca, Lojas e as restantes) no segundo ecrã das consolas portáteis com um segundo ecrã integrado. Ativado utiliza qualquer segundo ecrã. Desativado mantém o iniciador num único ecrã.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessões de ecrã duplo</string>
|
||||
@@ -4068,6 +4065,7 @@
|
||||
<string name="addons_sort_downloads">Mais transferidos</string>
|
||||
<string name="addons_category_all">Todas as categorias</string>
|
||||
<string name="addons_none_found">Nenhum addon encontrado</string>
|
||||
<string name="addons_curse_busy">Feche primeiro o CurseForge</string>
|
||||
<string name="addons_unreachable">Não foi possível contactar %1$s</string>
|
||||
<string name="addons_no_file">Não há ficheiro para esta versão do jogo</string>
|
||||
<string name="input_reset_positions">Repor posições</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Inicialização</string>
|
||||
<string name="mode_startup_session">Abrir ao iniciar</string>
|
||||
<string name="mode_startup_session_hint">Inicia esta sessão quando o DroidDeck é aberto.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Procurando versões…</string>
|
||||
<string name="mode_decky_ready">Pronto para instalar %1$s.</string>
|
||||
<string name="mode_decky_none">Nenhuma versão compatível encontrada. Tente novamente mais tarde.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Atualizado · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Instalar a mais recente</string>
|
||||
<string name="decky_channel">Canal de atualização</string>
|
||||
<string name="decky_channel_hint">Quais versões do Decky Loader instalar. O atualizador do próprio Decky usa o mesmo canal.</string>
|
||||
<string name="decky_channel_stable">Estável</string>
|
||||
<string name="decky_channel_prerelease">Pré-lançamento</string>
|
||||
<string name="decky_channel_testing">Testes</string>
|
||||
<string name="decky_channel_failed">Não foi possível salvar o canal de atualização do Decky</string>
|
||||
<string name="mode_decky_on">Inicia com a Steam. Enquanto estiver ativado, outros apps neste dispositivo podem conseguir controlar a Steam.</string>
|
||||
<string name="mode_decky_off">Desativado. A porta de depuração remota da Steam fica fechada.</string>
|
||||
<string name="mode_decky_remove_title">Desinstalar o Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Remove o loader. Seus plugins e configurações são mantidos.</string>
|
||||
<string name="mode_client">Cliente</string>
|
||||
@@ -961,6 +956,8 @@
|
||||
<string name="setup_fullscreen">Tela cheia</string>
|
||||
<string name="setup_fullscreen_on">Oculta as barras de status e de navegação do Android</string>
|
||||
<string name="setup_fullscreen_off">Mostra as barras de status e de navegação do Android</string>
|
||||
<string name="setup_page_swipe">Deslizar entre páginas</string>
|
||||
<string name="setup_page_swipe_hint">Deslize sobre uma página para mudar de aba.</string>
|
||||
<string name="setup_dual_screen_launcher">Iniciador em duas telas</string>
|
||||
<string name="setup_dual_screen_launcher_hint">O modo automático coloca as seções do iniciador (Steam, Biblioteca, Lojas e as demais) na segunda tela de consoles portáteis com uma tela secundária integrada. Ativado usa qualquer tela secundária. Desativado mantém o iniciador em uma única tela.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessões em duas telas</string>
|
||||
@@ -4076,6 +4073,7 @@
|
||||
<string name="addons_sort_downloads">Mais baixados</string>
|
||||
<string name="addons_category_all">Todas as categorias</string>
|
||||
<string name="addons_none_found">Nenhum addon encontrado</string>
|
||||
<string name="addons_curse_busy">Feche o CurseForge primeiro</string>
|
||||
<string name="addons_unreachable">Não foi possível acessar %1$s</string>
|
||||
<string name="addons_no_file">Não há arquivo para esta versão do jogo</string>
|
||||
<string name="input_reset_positions">Redefinir posições</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Pornire</string>
|
||||
<string name="mode_startup_session">Deschide la pornire</string>
|
||||
<string name="mode_startup_session_hint">Pornește această sesiune când se lansează DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Se verifică versiunile…</string>
|
||||
<string name="mode_decky_ready">Pregătit pentru instalarea %1$s.</string>
|
||||
<string name="mode_decky_none">Nu s-a găsit o versiune compatibilă. Încearcă din nou mai târziu.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Actualizat · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Instalează cea mai recentă versiune</string>
|
||||
<string name="decky_channel">Canal de actualizare</string>
|
||||
<string name="decky_channel_hint">Ce versiuni Decky Loader se instalează. Actualizatorul propriu al Decky folosește același canal.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Pre-lansare</string>
|
||||
<string name="decky_channel_testing">Testare</string>
|
||||
<string name="decky_channel_failed">Canalul de actualizare Decky nu a putut fi salvat</string>
|
||||
<string name="mode_decky_on">Pornește odată cu Steam. Cât timp este activ, alte aplicații de pe acest dispozitiv pot fi capabile să controleze Steam.</string>
|
||||
<string name="mode_decky_off">Dezactivat. Portul de depanare la distanță al Steam rămâne închis.</string>
|
||||
<string name="mode_decky_remove_title">Dezinstalezi Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Elimină loader-ul. Pluginurile și setările tale sunt păstrate.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -962,6 +957,8 @@
|
||||
<string name="setup_fullscreen">Ecran complet</string>
|
||||
<string name="setup_fullscreen_on">Ascunde barele de stare și de navigare Android</string>
|
||||
<string name="setup_fullscreen_off">Arată barele de stare și de navigare Android</string>
|
||||
<string name="setup_page_swipe">Glisare între pagini</string>
|
||||
<string name="setup_page_swipe_hint">Glisați peste o pagină pentru a schimba fila.</string>
|
||||
<string name="setup_dual_screen_launcher">Lansator pe două ecrane</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automat plasează secțiunile lansatorului (Steam, Bibliotecă, Magazine și celelalte) pe ecranul secundar al consolelor portabile cu unul integrat. Activat folosește orice ecran secundar. Dezactivat păstrează lansatorul pe un singur ecran.</string>
|
||||
<string name="setup_dual_screen_sessions">Sesiuni pe două ecrane</string>
|
||||
@@ -4055,6 +4052,7 @@
|
||||
<string name="addons_sort_downloads">Cele mai descărcate</string>
|
||||
<string name="addons_category_all">Toate categoriile</string>
|
||||
<string name="addons_none_found">Nu s-au găsit suplimente</string>
|
||||
<string name="addons_curse_busy">Închide mai întâi CurseForge</string>
|
||||
<string name="addons_unreachable">Nu s-a putut accesa %1$s</string>
|
||||
<string name="addons_no_file">Nu există fișier pentru această versiune a jocului</string>
|
||||
<string name="input_reset_positions">Resetează pozițiile</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Запуск</string>
|
||||
<string name="mode_startup_session">Открывать при запуске</string>
|
||||
<string name="mode_startup_session_hint">Запускает этот сеанс при запуске DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Проверка выпусков…</string>
|
||||
<string name="mode_decky_ready">Готово к установке %1$s.</string>
|
||||
<string name="mode_decky_none">Совместимая версия не найдена. Повторите попытку позже.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Актуально · %1$s</string>
|
||||
<string name="mode_decky_loader">Загрузчик</string>
|
||||
<string name="mode_decky_install_latest">Установить последнюю</string>
|
||||
<string name="decky_channel">Канал обновлений</string>
|
||||
<string name="decky_channel_hint">Какие выпуски Decky Loader устанавливать. Встроенное средство обновления Decky использует тот же канал.</string>
|
||||
<string name="decky_channel_stable">Стабильный</string>
|
||||
<string name="decky_channel_prerelease">Предварительный</string>
|
||||
<string name="decky_channel_testing">Тестовый</string>
|
||||
<string name="decky_channel_failed">Не удалось сохранить канал обновлений Decky</string>
|
||||
<string name="mode_decky_on">Запускается вместе со Steam. Пока включено, другие приложения на этом устройстве могут управлять Steam.</string>
|
||||
<string name="mode_decky_off">Выкл. Порт удаленной отладки Steam остается закрытым.</string>
|
||||
<string name="mode_decky_remove_title">Удалить Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Удаляет загрузчик. Ваши плагины и настройки сохранятся.</string>
|
||||
<string name="mode_client">Клиент</string>
|
||||
@@ -965,6 +960,8 @@
|
||||
<string name="setup_fullscreen">Полноэкранный режим</string>
|
||||
<string name="setup_fullscreen_on">Скрывает строку состояния и панель навигации Android</string>
|
||||
<string name="setup_fullscreen_off">Показывает строку состояния и панель навигации Android</string>
|
||||
<string name="setup_page_swipe">Перелистывание страниц свайпом</string>
|
||||
<string name="setup_page_swipe_hint">Проведите по странице, чтобы сменить вкладку.</string>
|
||||
<string name="setup_dual_screen_launcher">Лаунчер на двух экранах</string>
|
||||
<string name="setup_dual_screen_launcher_hint">«Автоматически» переносит разделы лаунчера (Steam, Библиотека, Магазины и остальные) на второй экран портативных устройств со встроенным вторым экраном. «Вкл.» использует любой второй дисплей. «Выкл.» оставляет лаунчер на одном экране.</string>
|
||||
<string name="setup_dual_screen_sessions">Сессии на двух экранах</string>
|
||||
@@ -4095,6 +4092,7 @@
|
||||
<string name="addons_sort_downloads">Самые скачиваемые</string>
|
||||
<string name="addons_category_all">Все категории</string>
|
||||
<string name="addons_none_found">Аддоны не найдены</string>
|
||||
<string name="addons_curse_busy">Сначала закройте CurseForge</string>
|
||||
<string name="addons_unreachable">Не удалось подключиться к %1$s</string>
|
||||
<string name="addons_no_file">Нет файла для этой версии игры</string>
|
||||
<string name="input_reset_positions">Сбросить положение</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Uppstart</string>
|
||||
<string name="mode_startup_session">Öppna vid start</string>
|
||||
<string name="mode_startup_session_hint">Startar den här sessionen när DroidDeck startar.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Söker efter utgåvor…</string>
|
||||
<string name="mode_decky_ready">Redo att installera %1$s.</string>
|
||||
<string name="mode_decky_none">Inget kompatibelt bygge hittades. Försök igen senare.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Senaste versionen · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Installera senaste</string>
|
||||
<string name="decky_channel">Uppdateringskanal</string>
|
||||
<string name="decky_channel_hint">Vilka Decky Loader-utgåvor som installeras. Deckys egen uppdaterare använder samma kanal.</string>
|
||||
<string name="decky_channel_stable">Stabil</string>
|
||||
<string name="decky_channel_prerelease">Förhandsversion</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Det gick inte att spara Deckys uppdateringskanal</string>
|
||||
<string name="mode_decky_on">Startar med Steam. Medan det är på kan andra appar på enheten eventuellt styra Steam.</string>
|
||||
<string name="mode_decky_off">Av. Steams fjärrfelsökningsport förblir stängd.</string>
|
||||
<string name="mode_decky_remove_title">Avinstallera Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Tar bort inläsaren. Dina tillägg och inställningar behålls.</string>
|
||||
<string name="mode_client">Klient</string>
|
||||
@@ -959,6 +954,8 @@
|
||||
<string name="setup_fullscreen">Helskärm</string>
|
||||
<string name="setup_fullscreen_on">Döljer Androids statusfält och navigeringsfält</string>
|
||||
<string name="setup_fullscreen_off">Visar Androids statusfält och navigeringsfält</string>
|
||||
<string name="setup_page_swipe">Svep mellan sidor</string>
|
||||
<string name="setup_page_swipe_hint">Svep över en sida för att byta flik.</string>
|
||||
<string name="setup_dual_screen_launcher">Startprogram för två skärmar</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Automatiskt: placerar startprogrammets avsnitt (Steam, Bibliotek, Butiker med flera) på den inbyggda andra skärmen på handhållna enheter som har en. På: använder vilken andra bildskärm som helst. Av: behåller startprogrammet på en skärm.</string>
|
||||
<string name="setup_dual_screen_sessions">Sessioner med två skärmar</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">Mest nedladdade</string>
|
||||
<string name="addons_category_all">Alla kategorier</string>
|
||||
<string name="addons_none_found">Inga tillägg hittades</string>
|
||||
<string name="addons_curse_busy">Stäng CurseForge först</string>
|
||||
<string name="addons_unreachable">Kunde inte nå %1$s</string>
|
||||
<string name="addons_no_file">Ingen fil för den här spelversionen</string>
|
||||
<string name="input_reset_positions">Återställ positioner</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">การเริ่มทำงาน</string>
|
||||
<string name="mode_startup_session">เปิดเมื่อเริ่มต้น</string>
|
||||
<string name="mode_startup_session_hint">เริ่มเซสชันนี้เมื่อเปิด DroidDeck</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">กำลังค้นหารุ่นที่เผยแพร่…</string>
|
||||
<string name="mode_decky_ready">พร้อมติดตั้ง %1$s</string>
|
||||
<string name="mode_decky_none">ไม่พบบิลด์ที่เข้ากันได้ ลองใหม่อีกครั้งในหลัง</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">เป็นรุ่นล่าสุดแล้ว · %1$s</string>
|
||||
<string name="mode_decky_loader">ตัวโหลด</string>
|
||||
<string name="mode_decky_install_latest">ติดตั้งรุ่นล่าสุด</string>
|
||||
<string name="decky_channel">ช่องทางอัปเดต</string>
|
||||
<string name="decky_channel_hint">รุ่นของ Decky Loader ที่จะติดตั้ง ตัวอัปเดตของ Decky เองก็ใช้ช่องทางเดียวกัน</string>
|
||||
<string name="decky_channel_stable">เสถียร</string>
|
||||
<string name="decky_channel_prerelease">ก่อนเปิดตัว</string>
|
||||
<string name="decky_channel_testing">ทดสอบ</string>
|
||||
<string name="decky_channel_failed">บันทึกช่องทางอัปเดตของ Decky ไม่ได้</string>
|
||||
<string name="mode_decky_on">เริ่มพร้อมกับ Steam เมื่อเปิดใช้งาน แอปอื่นบนอุปกรณ์นี้อาจสามารถควบคุม Steam ได้</string>
|
||||
<string name="mode_decky_off">ปิดอยู่ พอร์ตดีบักระยะไกลของ Steam ยังคงปิดอยู่</string>
|
||||
<string name="mode_decky_remove_title">ถอนการติดตั้ง Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">ลบตัวโหลดออก พลักอินและการตั้งค่าของคุณจะยังคงอยู่</string>
|
||||
<string name="mode_client">ไคลเอนต์</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">เต็มจอ</string>
|
||||
<string name="setup_fullscreen_on">ซ่อนแถบสถานะและแถบนำทางของ Android</string>
|
||||
<string name="setup_fullscreen_off">แสดงแถบสถานะและแถบนำทางของ Android</string>
|
||||
<string name="setup_page_swipe">ปัดเพื่อเปลี่ยนหน้า</string>
|
||||
<string name="setup_page_swipe_hint">ปัดผ่านหน้าเพื่อเปลี่ยนแท็บ</string>
|
||||
<string name="setup_dual_screen_launcher">ลอนเชอร์แบบสองจอ</string>
|
||||
<string name="setup_dual_screen_launcher_hint">โหมดอัตโนมัติจะแสดงส่วนต่างๆ ของลอนเชอร์ (Steam, คลังเกม, ร้านค้า และส่วนอื่นๆ) บนจอที่สองของเครื่องเล่นพกพาที่มีจอที่สองในตัว โหมดเปิดใช้จอที่สองใดก็ได้ โหมดปิดจะแสดงลอนเชอร์บนจอเดียว</string>
|
||||
<string name="setup_dual_screen_sessions">เซสชันแบบสองจอ</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">ดาวน์โหลดมากที่สุด</string>
|
||||
<string name="addons_category_all">ทุกหมวดหมู่</string>
|
||||
<string name="addons_none_found">ไม่พบแอดออน</string>
|
||||
<string name="addons_curse_busy">ปิด CurseForge ก่อน</string>
|
||||
<string name="addons_unreachable">ไม่สามารถเชื่อมต่อ %1$s ได้</string>
|
||||
<string name="addons_no_file">ไม่มีไฟล์สำหรับเกมเวอร์ชันนี้</string>
|
||||
<string name="input_reset_positions">รีเซ็ตตำแหน่ง</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Başlangıç</string>
|
||||
<string name="mode_startup_session">Açılışta başlat</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck açıldığında bu oturumu başlatır.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Sürümler kontrol ediliyor…</string>
|
||||
<string name="mode_decky_ready">%1$s yüklenmeye hazır.</string>
|
||||
<string name="mode_decky_none">Uyumlu derleme bulunamadı. Daha sonra tekrar deneyin.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Güncel · %1$s</string>
|
||||
<string name="mode_decky_loader">Yükleyici</string>
|
||||
<string name="mode_decky_install_latest">En yenisini yükle</string>
|
||||
<string name="decky_channel">Güncelleme kanalı</string>
|
||||
<string name="decky_channel_hint">Hangi Decky Loader sürümlerinin yükleneceği. Decky\'nin kendi güncelleyicisi de aynı kanalı kullanır.</string>
|
||||
<string name="decky_channel_stable">Kararlı</string>
|
||||
<string name="decky_channel_prerelease">Ön sürüm</string>
|
||||
<string name="decky_channel_testing">Test</string>
|
||||
<string name="decky_channel_failed">Decky güncelleme kanalı kaydedilemedi</string>
|
||||
<string name="mode_decky_on">Steam ile başlar. Açıkken bu cihazdaki diğer uygulamalar Steam\'i kontrol edebilir.</string>
|
||||
<string name="mode_decky_off">Kapalı. Steam\'in uzaktan hata ayıklama bağlantı noktası kapalı kalır.</string>
|
||||
<string name="mode_decky_remove_title">Decky Loader kaldırılsın mı?</string>
|
||||
<string name="mode_decky_remove_text">Yükleyiciyi kaldırır. Eklentileriniz ve ayarlarınız korunur.</string>
|
||||
<string name="mode_client">İstemci</string>
|
||||
@@ -951,6 +946,8 @@
|
||||
<string name="setup_fullscreen">Tam ekran</string>
|
||||
<string name="setup_fullscreen_on">Android durum ve gezinme çubuklarını gizler</string>
|
||||
<string name="setup_fullscreen_off">Android durum ve gezinme çubuklarını gösterir</string>
|
||||
<string name="setup_page_swipe">Sayfalar arasında kaydır</string>
|
||||
<string name="setup_page_swipe_hint">Sekme değiştirmek için sayfa boyunca kaydırın.</string>
|
||||
<string name="setup_dual_screen_launcher">Çift ekranlı başlatıcı</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Otomatik, yerleşik ikinci ekranı olan el konsollarında başlatıcı bölümlerini (Steam, Kitaplık, Mağazalar ve diğerleri) ikinci ekrana yerleştirir. Açık, herhangi bir ikinci ekranı kullanır. Kapalı, başlatıcıyı tek ekranda tutar.</string>
|
||||
<string name="setup_dual_screen_sessions">Çift ekranlı oturumlar</string>
|
||||
@@ -4015,6 +4012,7 @@
|
||||
<string name="addons_sort_downloads">En çok indirilen</string>
|
||||
<string name="addons_category_all">Tüm kategoriler</string>
|
||||
<string name="addons_none_found">Eklenti bulunamadı</string>
|
||||
<string name="addons_curse_busy">Önce CurseForge\'u kapatın</string>
|
||||
<string name="addons_unreachable">%1$s adresine ulaşılamadı</string>
|
||||
<string name="addons_no_file">Bu oyun sürümü için dosya yok</string>
|
||||
<string name="input_reset_positions">Konumları sıfırla</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Запуск</string>
|
||||
<string name="mode_startup_session">Відкривати під час запуску</string>
|
||||
<string name="mode_startup_session_hint">Запускає цей сеанс під час запуску DroidDeck.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Пошук випусків…</string>
|
||||
<string name="mode_decky_ready">Можна встановити %1$s.</string>
|
||||
<string name="mode_decky_none">Сумісну збірку не знайдено. Спробуйте пізніше.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Актуальна версія · %1$s</string>
|
||||
<string name="mode_decky_loader">Завантажувач</string>
|
||||
<string name="mode_decky_install_latest">Установити останню версію</string>
|
||||
<string name="decky_channel">Канал оновлень</string>
|
||||
<string name="decky_channel_hint">Які випуски Decky Loader встановлювати. Власний засіб оновлення Decky використовує той самий канал.</string>
|
||||
<string name="decky_channel_stable">Стабільний</string>
|
||||
<string name="decky_channel_prerelease">Попередній</string>
|
||||
<string name="decky_channel_testing">Тестовий</string>
|
||||
<string name="decky_channel_failed">Не вдалося зберегти канал оновлень Decky</string>
|
||||
<string name="mode_decky_on">Запускається разом зі Steam. Поки його ввімкнено, інші додатки на цьому пристрої можуть керувати Steam.</string>
|
||||
<string name="mode_decky_off">Вимкнено. Порт віддаленого налагодження Steam залишається закритим.</string>
|
||||
<string name="mode_decky_remove_title">Видалити Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Видаляє завантажувач. Ваші плагіни й налаштування зберігаються.</string>
|
||||
<string name="mode_client">Клієнт</string>
|
||||
@@ -965,6 +960,8 @@
|
||||
<string name="setup_fullscreen">Повний екран</string>
|
||||
<string name="setup_fullscreen_on">Приховує рядок стану та панель навігації Android</string>
|
||||
<string name="setup_fullscreen_off">Показує рядок стану та панель навігації Android</string>
|
||||
<string name="setup_page_swipe">Гортання сторінок свайпом</string>
|
||||
<string name="setup_page_swipe_hint">Проведіть по сторінці, щоб змінити вкладку.</string>
|
||||
<string name="setup_dual_screen_launcher">Лаунчер для двох екранів</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Автоматичний режим розміщує розділи лаунчера (Steam, Бібліотека, Магазини тощо) на вбудованому другому екрані портативних пристроїв. У режимі «Увімкнено» використовується будь-який другий дисплей. У режимі «Вимкнено» лаунчер залишається на одному екрані.</string>
|
||||
<string name="setup_dual_screen_sessions">Сеанси для двох екранів</string>
|
||||
@@ -4095,6 +4092,7 @@
|
||||
<string name="addons_sort_downloads">Найбільше завантажень</string>
|
||||
<string name="addons_category_all">Усі категорії</string>
|
||||
<string name="addons_none_found">Аддонів не знайдено</string>
|
||||
<string name="addons_curse_busy">Спочатку закрийте CurseForge</string>
|
||||
<string name="addons_unreachable">Не вдалося під’єднатися до %1$s</string>
|
||||
<string name="addons_no_file">Немає файлу для цієї версії гри</string>
|
||||
<string name="input_reset_positions">Скинути розташування</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">Khởi động</string>
|
||||
<string name="mode_startup_session">Mở khi khởi chạy</string>
|
||||
<string name="mode_startup_session_hint">Bắt đầu phiên này khi DroidDeck khởi chạy.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Đang kiểm tra bản phát hành…</string>
|
||||
<string name="mode_decky_ready">Sẵn sàng cài %1$s.</string>
|
||||
<string name="mode_decky_none">Không tìm thấy bản build tương thích. Hãy thử lại sau.</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">Đã mới nhất · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Cài bản mới nhất</string>
|
||||
<string name="decky_channel">Kênh cập nhật</string>
|
||||
<string name="decky_channel_hint">Các bản phát hành Decky Loader sẽ cài. Trình cập nhật riêng của Decky dùng cùng kênh này.</string>
|
||||
<string name="decky_channel_stable">Ổn định</string>
|
||||
<string name="decky_channel_prerelease">Tiền phát hành</string>
|
||||
<string name="decky_channel_testing">Thử nghiệm</string>
|
||||
<string name="decky_channel_failed">Không thể lưu kênh cập nhật Decky</string>
|
||||
<string name="mode_decky_on">Khởi động cùng Steam. Khi đang bật, các ứng dụng khác trên thiết bị này có thể điều khiển được Steam.</string>
|
||||
<string name="mode_decky_off">Tắt. Cổng gỡ lỗi từ xa của Steam luôn đóng.</string>
|
||||
<string name="mode_decky_remove_title">Gỡ cài đặt Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Gỡ bỏ loader. Plugin và thiết lập của bạn được giữ lại.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">Toàn màn hình</string>
|
||||
<string name="setup_fullscreen_on">Ẩn thanh trạng thái và thanh điều hướng của Android</string>
|
||||
<string name="setup_fullscreen_off">Hiện thanh trạng thái và thanh điều hướng của Android</string>
|
||||
<string name="setup_page_swipe">Vuốt để chuyển trang</string>
|
||||
<string name="setup_page_swipe_hint">Vuốt ngang trang để đổi thẻ.</string>
|
||||
<string name="setup_dual_screen_launcher">Trình khởi chạy hai màn hình</string>
|
||||
<string name="setup_dual_screen_launcher_hint">Tự động đưa các phần của trình khởi chạy (Steam, Thư viện, Cửa hàng và phần còn lại) lên màn hình thứ hai tích hợp của máy cầm tay. Bật dùng bất kỳ màn hình thứ hai nào. Tắt giữ trình khởi chạy trên một màn hình.</string>
|
||||
<string name="setup_dual_screen_sessions">Phiên chơi hai màn hình</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">Tải nhiều nhất</string>
|
||||
<string name="addons_category_all">Tất cả danh mục</string>
|
||||
<string name="addons_none_found">Không tìm thấy addon</string>
|
||||
<string name="addons_curse_busy">Hãy đóng CurseForge trước</string>
|
||||
<string name="addons_unreachable">Không thể kết nối tới %1$s</string>
|
||||
<string name="addons_no_file">Không có tệp cho phiên bản trò chơi này</string>
|
||||
<string name="input_reset_positions">Đặt lại vị trí</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">启动</string>
|
||||
<string name="mode_startup_session">启动时打开</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck 启动时开始此会话。</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">正在检查发布版本…</string>
|
||||
<string name="mode_decky_ready">已就绪,可安装 %1$s。</string>
|
||||
<string name="mode_decky_none">未找到兼容的构建。请稍后重试。</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">已是最新 · %1$s</string>
|
||||
<string name="mode_decky_loader">加载器</string>
|
||||
<string name="mode_decky_install_latest">安装最新版</string>
|
||||
<string name="decky_channel">更新通道</string>
|
||||
<string name="decky_channel_hint">要安装哪种 Decky Loader 版本。Decky 自带的更新程序也使用相同的通道。</string>
|
||||
<string name="decky_channel_stable">稳定版</string>
|
||||
<string name="decky_channel_prerelease">预发布版</string>
|
||||
<string name="decky_channel_testing">测试版</string>
|
||||
<string name="decky_channel_failed">无法保存 Decky 更新通道</string>
|
||||
<string name="mode_decky_on">随 Steam 启动。开启期间,本设备上的其他应用可能可以控制 Steam。</string>
|
||||
<string name="mode_decky_off">已关闭。Steam 的远程调试端口保持关闭。</string>
|
||||
<string name="mode_decky_remove_title">卸载 Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">移除加载器。你的插件和设置会保留。</string>
|
||||
<string name="mode_client">客户端</string>
|
||||
@@ -956,6 +951,8 @@
|
||||
<string name="setup_fullscreen">全屏</string>
|
||||
<string name="setup_fullscreen_on">隐藏 Android 状态栏和导航栏</string>
|
||||
<string name="setup_fullscreen_off">显示 Android 状态栏和导航栏</string>
|
||||
<string name="setup_page_swipe">滑动切换页面</string>
|
||||
<string name="setup_page_swipe_hint">在页面上滑动即可切换标签。</string>
|
||||
<string name="setup_dual_screen_launcher">双屏启动器</string>
|
||||
<string name="setup_dual_screen_launcher_hint">自动会把启动器的各个板块(Steam、库、商店等)放到带内置副屏的掌机的第二块屏幕上。开启使用任意第二块显示屏。关闭则让启动器只显示在一块屏幕上。</string>
|
||||
<string name="setup_dual_screen_sessions">双屏会话</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">下载最多</string>
|
||||
<string name="addons_category_all">所有类别</string>
|
||||
<string name="addons_none_found">未找到插件</string>
|
||||
<string name="addons_curse_busy">请先关闭 CurseForge</string>
|
||||
<string name="addons_unreachable">无法连接到 %1$s</string>
|
||||
<string name="addons_no_file">没有适用于此游戏版本的文件</string>
|
||||
<string name="input_reset_positions">重置位置</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">啟動</string>
|
||||
<string name="mode_startup_session">啟動時開啟</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck 啟動時開始此工作階段。</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">正在檢查發佈版本…</string>
|
||||
<string name="mode_decky_ready">可安裝 %1$s。</string>
|
||||
<string name="mode_decky_none">找不到兼容的版本,請稍後再試。</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">已是最新 · %1$s</string>
|
||||
<string name="mode_decky_loader">載入器</string>
|
||||
<string name="mode_decky_install_latest">安裝最新版本</string>
|
||||
<string name="decky_channel">更新頻道</string>
|
||||
<string name="decky_channel_hint">要安裝哪一種 Decky Loader 版本。Decky 本身的更新程式也會使用相同的頻道。</string>
|
||||
<string name="decky_channel_stable">穩定版</string>
|
||||
<string name="decky_channel_prerelease">預發佈版</string>
|
||||
<string name="decky_channel_testing">測試版</string>
|
||||
<string name="decky_channel_failed">無法儲存 Decky 更新頻道</string>
|
||||
<string name="mode_decky_on">隨 Steam 啟動。啟用時,此裝置上的其他應用程式可能可以控制 Steam。</string>
|
||||
<string name="mode_decky_off">已關閉。Steam 的遠端偵錯連接埠保持關閉。</string>
|
||||
<string name="mode_decky_remove_title">解除安裝 Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">移除載入器,你的插件和設定會保留。</string>
|
||||
<string name="mode_client">用戶端</string>
|
||||
@@ -955,6 +950,8 @@
|
||||
<string name="setup_fullscreen">全螢幕</string>
|
||||
<string name="setup_fullscreen_on">隱藏 Android 狀態列和導覽列</string>
|
||||
<string name="setup_fullscreen_off">顯示 Android 狀態列和導覽列</string>
|
||||
<string name="setup_page_swipe">滑動切換頁面</string>
|
||||
<string name="setup_page_swipe_hint">在頁面上滑動即可切換標籤。</string>
|
||||
<string name="setup_dual_screen_launcher">雙螢幕啟動器</string>
|
||||
<string name="setup_dual_screen_launcher_hint">自動會把啟動器各部分(Steam、收藏庫、商店及其他部分)放到內建雙螢幕手持裝置的第二螢幕。開啟會使用任何第二顯示器。關閉會將啟動器保持在單一螢幕。</string>
|
||||
<string name="setup_dual_screen_sessions">雙螢幕工作階段</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">下載最多</string>
|
||||
<string name="addons_category_all">所有類別</string>
|
||||
<string name="addons_none_found">找不到插件</string>
|
||||
<string name="addons_curse_busy">請先關閉 CurseForge</string>
|
||||
<string name="addons_unreachable">無法連接 %1$s</string>
|
||||
<string name="addons_no_file">沒有適用於此遊戲版本的檔案</string>
|
||||
<string name="input_reset_positions">重設位置</string>
|
||||
|
||||
@@ -332,7 +332,6 @@
|
||||
<string name="mode_startup">啟動</string>
|
||||
<string name="mode_startup_session">啟動時開啟</string>
|
||||
<string name="mode_startup_session_hint">DroidDeck 啟動時開始此工作階段。</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">正在檢查發行版本…</string>
|
||||
<string name="mode_decky_ready">已準備好安裝 %1$s。</string>
|
||||
<string name="mode_decky_none">未找到相容版本。請稍後再試。</string>
|
||||
@@ -341,14 +340,10 @@
|
||||
<string name="mode_decky_current">已是最新 · %1$s</string>
|
||||
<string name="mode_decky_loader">載入器</string>
|
||||
<string name="mode_decky_install_latest">安裝最新版本</string>
|
||||
<string name="decky_channel">更新頻道</string>
|
||||
<string name="decky_channel_hint">要安裝哪一種 Decky Loader 版本。Decky 本身的更新程式也會使用相同的頻道。</string>
|
||||
<string name="decky_channel_stable">穩定版</string>
|
||||
<string name="decky_channel_prerelease">預先發行版</string>
|
||||
<string name="decky_channel_testing">測試版</string>
|
||||
<string name="decky_channel_failed">無法儲存 Decky 更新頻道</string>
|
||||
<string name="mode_decky_on">隨 Steam 啟動。啟用後,此裝置上的其他應用程式可能可以控制 Steam。</string>
|
||||
<string name="mode_decky_off">關閉。Steam 的遠端偵錯連接埠保持關閉。</string>
|
||||
<string name="mode_decky_remove_title">解除安裝 Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">移除載入器。你的外掛程式和設定會保留。</string>
|
||||
<string name="mode_client">用戶端</string>
|
||||
@@ -955,6 +950,8 @@
|
||||
<string name="setup_fullscreen">全螢幕</string>
|
||||
<string name="setup_fullscreen_on">隱藏 Android 狀態列和導覽列</string>
|
||||
<string name="setup_fullscreen_off">顯示 Android 狀態列和導覽列</string>
|
||||
<string name="setup_page_swipe">滑動切換頁面</string>
|
||||
<string name="setup_page_swipe_hint">在頁面上滑動即可切換分頁。</string>
|
||||
<string name="setup_dual_screen_launcher">雙螢幕啟動器</string>
|
||||
<string name="setup_dual_screen_launcher_hint">自動:在內建第二螢幕的掌機上,將啟動器區塊(Steam、收藏庫、商店等)放到第二螢幕。開啟:使用任一第二螢幕。關閉:啟動器維持在單一螢幕。</string>
|
||||
<string name="setup_dual_screen_sessions">雙螢幕工作階段</string>
|
||||
@@ -3985,6 +3982,7 @@
|
||||
<string name="addons_sort_downloads">下載最多</string>
|
||||
<string name="addons_category_all">所有類別</string>
|
||||
<string name="addons_none_found">找不到插件</string>
|
||||
<string name="addons_curse_busy">請先關閉 CurseForge</string>
|
||||
<string name="addons_unreachable">無法連線至 %1$s</string>
|
||||
<string name="addons_no_file">沒有適用於此遊戲版本的檔案</string>
|
||||
<string name="input_reset_positions">重設位置</string>
|
||||
|
||||
@@ -362,7 +362,6 @@
|
||||
<string name="mode_startup">Startup</string>
|
||||
<string name="mode_startup_session">Open at launch</string>
|
||||
<string name="mode_startup_session_hint">Starts this session when DroidDeck launches.</string>
|
||||
<string name="mode_decky">Decky</string>
|
||||
<string name="mode_decky_checking">Checking for releases…</string>
|
||||
<string name="mode_decky_ready">Ready to install %1$s.</string>
|
||||
<string name="mode_decky_none">No compatible build found. Try again later.</string>
|
||||
@@ -371,14 +370,10 @@
|
||||
<string name="mode_decky_current">Up to date · %1$s</string>
|
||||
<string name="mode_decky_loader">Loader</string>
|
||||
<string name="mode_decky_install_latest">Install latest</string>
|
||||
<string name="decky_channel">Update Channel</string>
|
||||
<string name="decky_channel_hint">Which Decky Loader releases to install. Decky\'s own updater uses the same channel.</string>
|
||||
<string name="decky_channel_stable">Stable</string>
|
||||
<string name="decky_channel_prerelease">Prerelease</string>
|
||||
<string name="decky_channel_testing">Testing</string>
|
||||
<string name="decky_channel_failed">Could not save the Decky update channel</string>
|
||||
<string name="mode_decky_on">Starts with Steam. While on, other apps on this device may be able to control Steam.</string>
|
||||
<string name="mode_decky_off">Off. Steam\'s remote debugging port stays closed.</string>
|
||||
<string name="mode_decky_remove_title">Uninstall Decky Loader?</string>
|
||||
<string name="mode_decky_remove_text">Removes the loader. Your plugins and settings are kept.</string>
|
||||
<string name="mode_client">Client</string>
|
||||
@@ -1035,6 +1030,8 @@
|
||||
<string name="setup_fullscreen">Fullscreen</string>
|
||||
<string name="setup_fullscreen_on">Hides the Android status and navigation bars</string>
|
||||
<string name="setup_fullscreen_off">Shows the Android status and navigation bars</string>
|
||||
<string name="setup_page_swipe">Swipe between pages</string>
|
||||
<string name="setup_page_swipe_hint">Swipe across a page to change tabs.</string>
|
||||
<string name="setup_controller_haptics">Controller haptics</string>
|
||||
<string name="setup_controller_haptics_hint">A light tick when the D-pad, A or the shoulder buttons move or select in the launcher. Touch stays silent</string>
|
||||
<string name="setup_dual_screen_launcher">Dual screen launcher</string>
|
||||
@@ -2219,6 +2216,23 @@
|
||||
<string name="fm_favorite_removed">Removed \"%1$s\" from Favorites</string>
|
||||
<string name="fm_empty_directory">Empty directory</string>
|
||||
<string name="fm_up_one_level">Up one level</string>
|
||||
<string name="fm_edit_open">Open</string>
|
||||
<string name="fm_edit_save">Save</string>
|
||||
<string name="fm_edit_read_only">Read only</string>
|
||||
<string name="fm_edit_binary">Binary</string>
|
||||
<string name="fm_edit_modified">Modified</string>
|
||||
<string name="fm_edit_position">Ln %1$d, Col %2$d</string>
|
||||
<string name="fm_edit_find">Find</string>
|
||||
<string name="fm_edit_find_previous">Find previous</string>
|
||||
<string name="fm_edit_find_next">Find next</string>
|
||||
<string name="fm_edit_replace">Replace</string>
|
||||
<string name="fm_edit_replace_all">All</string>
|
||||
<string name="fm_edit_discard_title">Discard changes?</string>
|
||||
<string name="fm_edit_discard_text">Changes to \"%1$s\" will be lost.</string>
|
||||
<string name="fm_edit_discard">Discard</string>
|
||||
<string name="fm_edit_save_failed">Couldn\'t save \"%1$s\"</string>
|
||||
<string name="fm_edit_open_failed">Couldn\'t open \"%1$s\"</string>
|
||||
<string name="fm_edit_too_large">Too large to open (%1$s)</string>
|
||||
<string name="fm_choose_folder">Choose a folder</string>
|
||||
<string name="fm_choose_file">Choose a file</string>
|
||||
<string name="ctrl_tint_steam_blue">Steam blue</string>
|
||||
@@ -4200,6 +4214,7 @@
|
||||
<string name="addons_sort_downloads">Most downloaded</string>
|
||||
<string name="addons_category_all">All categories</string>
|
||||
<string name="addons_none_found">No addons found</string>
|
||||
<string name="addons_curse_busy">Close CurseForge first</string>
|
||||
<string name="addons_unreachable">Could not reach %1$s</string>
|
||||
<string name="addons_no_file">No file for this game version</string>
|
||||
<string name="addons_source_wowi" translatable="false">WoWInterface</string>
|
||||
@@ -4321,6 +4336,27 @@
|
||||
<string name="dev_preview_drawer">In-game menu</string>
|
||||
<string name="dev_preview_drawer_backdrop">In-game menu preview · Back to close</string>
|
||||
<string name="settings_place_tab">Tabs</string>
|
||||
<string name="decky_status">Status</string>
|
||||
<string name="decky_enable">Enable</string>
|
||||
<string name="decky_release_channel">Release channel</string>
|
||||
<string name="rail_decky">Decky</string>
|
||||
<string name="rail_boot_movies">Boot movies</string>
|
||||
<string name="decky_tab_installed">Installed · %1$d</string>
|
||||
<string name="decky_tab_store">Store</string>
|
||||
<string name="decky_tab_zip">From ZIP</string>
|
||||
<string name="decky_none_installed">No plugins installed. Browse the Store or install a ZIP.</string>
|
||||
<string name="decky_update_to">Update to %1$s</string>
|
||||
<string name="decky_remove">Remove</string>
|
||||
<string name="decky_remove_confirm">Remove %1$s?</string>
|
||||
<string name="decky_remove_confirm_body">Deletes the plugin from Decky. Its settings are kept.</string>
|
||||
<string name="decky_changes_next_session">Plugin changes apply the next time Steam starts.</string>
|
||||
<string name="decky_store_search">Search plugins</string>
|
||||
<string name="decky_store_failed">Could not reach the Decky plugin store</string>
|
||||
<string name="decky_store_empty">No plugins found</string>
|
||||
<string name="decky_store_more">Show %1$d more</string>
|
||||
<string name="decky_store_downloading">Downloading %1$s…</string>
|
||||
<string name="decky_store_download_failed">Could not download %1$s</string>
|
||||
<string name="decky_store_remove_failed">Could not remove the plugin</string>
|
||||
<string name="rail_storage">Storage</string>
|
||||
<string name="rail_sync">Syncthing</string>
|
||||
<string name="downloads_settings">Download settings</string>
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.droiddeck.launcher.files
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.file.Files
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class TextEditorLogicTest {
|
||||
|
||||
@Test
|
||||
fun nulByteMarksBinary() {
|
||||
val clean = "hello world".toByteArray()
|
||||
assertFalse(editorIsBinary(clean))
|
||||
val withNul = byteArrayOf(1, 2, 0, 3)
|
||||
assertTrue(editorIsBinary(withNul))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun binaryScanStopsAtSampleLimit() {
|
||||
val bytes = ByteArray(9000) { if (it == 8999) 0 else 65 }
|
||||
assertFalse(editorIsBinary(bytes))
|
||||
assertTrue(editorIsBinary(bytes, sample = 9000))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun utf8TextDecodesAsUtf8() {
|
||||
val decoded = decodeEditorText("你好, world".toByteArray(Charsets.UTF_8))
|
||||
assertEquals(EditorCharset.UTF8, decoded.charset)
|
||||
assertFalse(decoded.lossy)
|
||||
assertEquals("你好, world", decoded.text)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun gbkBytesFallBackToGb18030() {
|
||||
val gbk = "你好".toByteArray(Charset.forName("GBK"))
|
||||
val decoded = decodeEditorText(gbk)
|
||||
assertEquals(EditorCharset.GB18030, decoded.charset)
|
||||
assertFalse(decoded.lossy)
|
||||
assertEquals("你好", decoded.text)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun undecodableBytesStayLossyUtf8() {
|
||||
val decoded = decodeEditorText(byteArrayOf(0xFF.toByte()))
|
||||
assertEquals(EditorCharset.UTF8, decoded.charset)
|
||||
assertTrue(decoded.lossy)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun literalReplacementCharStaysCleanUtf8() {
|
||||
val decoded = decodeEditorText("�A".toByteArray(Charsets.UTF_8))
|
||||
assertEquals(EditorCharset.UTF8, decoded.charset)
|
||||
assertFalse(decoded.lossy)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readCappedRefusesOverLimit() {
|
||||
val data = ByteArray(100) { 65 }
|
||||
assertArrayEquals(data, readCapped(ByteArrayInputStream(data), 100L))
|
||||
assertNull(readCapped(ByteArrayInputStream(data), 99L))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun tabsExpandToTabStops() {
|
||||
assertEquals("ab c", expandEditorTabs("ab\tc"))
|
||||
assertEquals(" x", expandEditorTabs("\tx"))
|
||||
assertEquals("abcd e", expandEditorTabs("abcd\te"))
|
||||
assertEquals("abc def g", expandEditorTabs("abc\tdef\tg"))
|
||||
assertEquals("a \n b", expandEditorTabs("a\t\n\tb"))
|
||||
assertEquals("plain text", expandEditorTabs("plain text"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun lineCountCountsTrailingEmptyLine() {
|
||||
assertEquals(1, lineCountOf(""))
|
||||
assertEquals(1, lineCountOf("abc"))
|
||||
assertEquals(2, lineCountOf("a\nb"))
|
||||
assertEquals(2, lineCountOf("a\n"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun offsetMapsToZeroBasedLineAndOneBasedColumn() {
|
||||
val text = "ab\ncd"
|
||||
assertEquals(0, lineIndexOfOffset(text, 0))
|
||||
assertEquals(0, lineIndexOfOffset(text, 2))
|
||||
assertEquals(1, lineIndexOfOffset(text, 3))
|
||||
assertEquals(1, lineIndexOfOffset(text, 5))
|
||||
assertEquals(1, columnOfOffset(text, 0))
|
||||
assertEquals(3, columnOfOffset(text, 2))
|
||||
assertEquals(2, columnOfOffset(text, 4))
|
||||
assertEquals(3, columnOfOffset(text, 5))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun findMatchesHonorsCaseAndLimit() {
|
||||
val text = "abcABCabc"
|
||||
val all = findEditorMatches(text, "abc", matchCase = false)
|
||||
assertEquals(listOf(0..2, 3..5, 6..8), all)
|
||||
val exact = findEditorMatches(text, "abc", matchCase = true)
|
||||
assertEquals(listOf(0..2, 6..8), exact)
|
||||
assertEquals(2, findEditorMatches(text, "abc", matchCase = false, limit = 2).size)
|
||||
assertEquals(emptyList<IntRange>(), findEditorMatches(text, ""))
|
||||
assertEquals(listOf(0..1), findEditorMatches("aaa", "aa"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun replaceSpansEveryMatch() {
|
||||
val text = "one two one"
|
||||
val matches = findEditorMatches(text, "one", matchCase = true)
|
||||
assertEquals("1 two 1", replaceEditorMatches(text, matches, "1"))
|
||||
assertEquals(text, replaceEditorMatches(text, emptyList(), "x"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun saveTargetResolvesSymbolicLink() {
|
||||
val dir = Files.createTempDirectory("editor-link").toFile()
|
||||
try {
|
||||
val target = File(dir, "real.txt").apply { writeText("hi") }
|
||||
val link = File(dir, "link.txt")
|
||||
Files.createSymbolicLink(link.toPath(), target.toPath())
|
||||
assertEquals(target.canonicalFile, resolveEditorSaveTarget(link))
|
||||
} finally {
|
||||
dir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun saveTargetKeepsRegularFile() {
|
||||
val dir = Files.createTempDirectory("editor-plain").toFile()
|
||||
try {
|
||||
val plain = File(dir, "plain.txt").apply { writeText("hi") }
|
||||
assertEquals(plain, resolveEditorSaveTarget(plain))
|
||||
} finally {
|
||||
dir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,51 @@ class OnScreenLayoutTest {
|
||||
assertEquals(.1f * 2208f / 1768 / .2f, fitted.width * 2208 / (fitted.height * 800), .01f)
|
||||
}
|
||||
|
||||
@Test fun controlsEditedInPortraitKeepTheirPlacesInThePanelBelowTheGame() {
|
||||
SessionPrefs.setSteamController(context, SessionPrefs.CONTROLLER_NONE)
|
||||
val (w, h) = 1080 to 2400
|
||||
val stock = gamepad()
|
||||
val shown = OnScreenLayout.editorElements(context, stock, w, h)
|
||||
val moved = shown.map { if (it.id == "legacy:a") it.copy(x = .05f) else if (it.id == "legacy:ls") it.copy(x = .6f) else it }
|
||||
val edited = OnScreenLayout.withFrame(context, stock, OnScreenLayout.editorFrame(stock, moved), w.toFloat() / h)
|
||||
val shownA = shown.first { it.id == "legacy:a" }
|
||||
for (panelHeight in listOf(1100, 800)) {
|
||||
val placed = OnScreenLayout.elements(context, edited, w, panelHeight, Rect(), dock = OnScreenLayout.Dock(true, false))
|
||||
val a = placed.first { it.id == "legacy:a" }
|
||||
val ls = placed.first { it.id == "legacy:ls" }
|
||||
val b = placed.first { it.id == "legacy:b" }
|
||||
assertTrue(a.x < .2f)
|
||||
assertTrue(ls.x > .5f)
|
||||
assertTrue(b.x > a.x)
|
||||
assertNull(placed.firstOrNull { it.id == "builtin:keyboard" || it.control == InputControl.GUIDE || it.control == InputControl.QAM })
|
||||
assertInside(placed, w, panelHeight)
|
||||
assertEquals(shownA.width * w / (shownA.height * h), a.width * w / (a.height * panelHeight), .01f)
|
||||
val untouched = OnScreenLayout.elements(context, stock, w, panelHeight, Rect(), dock = OnScreenLayout.Dock(true, false))
|
||||
assertTrue(untouched.first { it.id == "legacy:a" }.x > .5f)
|
||||
assertTrue(untouched.first { it.id == "legacy:ls" }.x < .5f)
|
||||
}
|
||||
val landscape = OnScreenLayout.elements(context, edited, 2400, 1080, Rect())
|
||||
assertTrue(landscape.first { it.id == "legacy:a" }.x > .5f)
|
||||
SessionPrefs.setSteamController(context, SessionPrefs.CONTROLLER_DECK)
|
||||
val deck = OnScreenLayout.elements(context, edited, w, 1100, Rect(), dock = OnScreenLayout.Dock.deck(true, null), trackpads = true)
|
||||
assertTrue(deck.none { it.id == "legacy:rs" })
|
||||
assertTrue(deck.any { it.kind == InputElementKind.TRACKPAD && it.x + it.width / 2f > .5f })
|
||||
SessionPrefs.setSteamController(context, SessionPrefs.CONTROLLER_NONE)
|
||||
val tiny = stock.copy(aspect = .45f, elements = stock.elements.map {
|
||||
when (it.id) {
|
||||
"legacy:a" -> it.copy(x = .05f, y = .05f, width = .1f, height = .045f)
|
||||
"legacy:b" -> it.copy(x = .16f, y = .05f, width = .1f, height = .045f)
|
||||
"legacy:ls" -> it.copy(x = .8f, y = .85f, width = .15f, height = .1f)
|
||||
else -> it
|
||||
}
|
||||
}, rotated = emptyList())
|
||||
val short = OnScreenLayout.elements(context, tiny, w, 385, Rect(), dock = OnScreenLayout.Dock(true, false))
|
||||
val sa = short.first { it.id == "legacy:a" }
|
||||
val sb = short.first { it.id == "legacy:b" }
|
||||
assertTrue(sa.x + sa.width <= sb.x)
|
||||
assertEquals(1f, sa.width * w / (sa.height * 385), .01f)
|
||||
}
|
||||
|
||||
@Test fun thePortraitAndBelowGameKitsKeepDirectionalArtClearOfTheSticksAndFaceButtons() {
|
||||
val directions = setOf(InputControl.UP, InputControl.RIGHT, InputControl.DOWN, InputControl.LEFT)
|
||||
val face = setOf(InputControl.A, InputControl.B, InputControl.X, InputControl.Y)
|
||||
|
||||
@@ -108,6 +108,15 @@ class SecondScreenProfileMigrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun pickingAnotherModeClearsTheMenuRestoreLeftByATeardown() {
|
||||
customLibrary(desktop = false)
|
||||
SessionState.bottomMenu = true
|
||||
ReflectionHelpers.callInstanceMethod<Unit>(activity, "pickSecondScreenMode",
|
||||
ReflectionHelpers.ClassParameter.from(SecondScreenMode::class.java, SecondScreenMode.KEYBOARD_TRACKPAD))
|
||||
assertFalse(SessionState.bottomMenu)
|
||||
assertEquals(SecondScreenMode.KEYBOARD_TRACKPAD.id, SessionPrefs.secondScreenPanel(activity, false))
|
||||
}
|
||||
|
||||
private fun customLibrary(desktop: Boolean): InputLibrary {
|
||||
session(desktop)
|
||||
return InputLibraries.update(activity) { library ->
|
||||
|
||||
@@ -354,13 +354,15 @@ class BattleNetTest {
|
||||
assertEquals(codes.distinct(), codes)
|
||||
assertTrue("Fen" in codes && "OSI" in codes && "WTCG" in codes)
|
||||
assertFalse(BattleNet.STORE.any { it.uid == "d3cn" || it.uid == "fen" })
|
||||
assertFalse(BattleNet.STORE.any { it.code == "WoWC" || it.code == "WoWF" })
|
||||
assertFalse(BattleNet.STORE.any { it.code == "WoWC" })
|
||||
assertEquals("wow_forever", BattleNet.STORE.first { it.code == "WoWF" }.uid)
|
||||
assertEquals("fenris", BattleNet.STORE.first { it.code == "Fen" }.uid)
|
||||
assertTrue(BattleNet.STORE.all { it.uid.matches(Regex("[a-z0-9_]{1,32}")) })
|
||||
val installed = listOf("fenris", "diablo3_enus", null)
|
||||
val offered = BattleNet.STORE.filter { BattleNet.notInstalled(it, installed) }.map { it.code }
|
||||
assertFalse("Fen" in offered || "D3" in offered)
|
||||
assertTrue("OSI" in offered)
|
||||
assertTrue("OSI" in offered && "WoWF" in offered)
|
||||
assertFalse("WoWF" in BattleNet.STORE.filter { BattleNet.notInstalled(it, listOf("wow_forever")) }.map { it.code })
|
||||
}
|
||||
|
||||
@Test fun aBattleNetGameStartsWithoutSteamThroughItsShortcutUntilThatIsSwitchedOff() {
|
||||
|
||||
@@ -0,0 +1,570 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.app.Application
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.After
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33], manifest = Config.NONE, application = Application::class)
|
||||
class CurseForgeAppTest {
|
||||
@get:Rule val temp = TemporaryFolder()
|
||||
|
||||
private val original = CurseForgeApp.guest
|
||||
private val url = "ws://127.0.0.1:43117/0f8fad5b-d9cb-469f-a165-70867728950e"
|
||||
private val app = UserApps.App("appimage:c", UserApps.Kind.APPIMAGE, "CurseForge", null, null, AppImageManager.LAUNCHER, listOf("/root/apps/curseforge"), feed = CurseForgeApp.FEED)
|
||||
|
||||
@After
|
||||
fun restoreGuest() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
launches.forEach { CurseForgeApp.stop(context, app, null, it) }
|
||||
holder.get()?.set(true)
|
||||
CurseForgeApp.guest = original
|
||||
}
|
||||
|
||||
private val launches = mutableListOf<java.util.concurrent.atomic.AtomicBoolean>()
|
||||
|
||||
private fun launch(): java.util.concurrent.atomic.AtomicBoolean = java.util.concurrent.atomic.AtomicBoolean(false).also { launches += it }
|
||||
|
||||
private val holder = java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicBoolean?>()
|
||||
private val released = java.util.concurrent.CountDownLatch(1)
|
||||
|
||||
private fun fakeGuest(startExit: Int, ready: Boolean = true): MutableList<List<String>> {
|
||||
val calls = java.util.Collections.synchronizedList(mutableListOf<List<String>>())
|
||||
CurseForgeApp.guest = { _, argv, cancelled, onLine ->
|
||||
calls += argv
|
||||
when {
|
||||
argv[0] == CurseForgeApp.HELPER && argv[1] == "start" -> {
|
||||
if (startExit == 0) {
|
||||
holder.set(cancelled)
|
||||
onLine(url)
|
||||
while (cancelled?.get() != true) Thread.sleep(10)
|
||||
released.countDown()
|
||||
} else onLine("busy")
|
||||
startExit
|
||||
}
|
||||
argv[0] == CurseForgeApp.HELPER -> 0
|
||||
ready -> { onLine(JSONObject().put("ok", true).put("value", """{"value":true}""").toString()); 0 }
|
||||
else -> { onLine(JSONObject().put("ok", false).put("error", JSONObject().put("code", "DEVTOOLS_UNREACHABLE").put("message", "no")).toString()); 0 }
|
||||
}
|
||||
}
|
||||
return calls
|
||||
}
|
||||
|
||||
private val search = """{"success":true,"injectedCount":0,
|
||||
"pagination":{"index":0,"pageSize":20,"resultCount":20,"totalCount":150},
|
||||
"mods":[
|
||||
{"id":486246,"name":"RestedXP Guide","summary":"Leveling guide","downloads":12345678,
|
||||
"thumbnailUrl":"https://media.forgecdn.net/avatars/rxp.png","authors":[{"name":"RestedXP"}],
|
||||
"updateVersion":{"id":7,"filename":"RXPGuides.zip","fileDate":"2026-11-20T10:00:00.000Z"}},
|
||||
{"id":2,"name":"Plain","downloads":5,"thumbnailUrl":"http://insecure/x.png","primaryAuthor":{"name":"Main"},
|
||||
"authors":[{"name":"Other"}],"projectLatestReleaseDate":"2026-01-01T00:00:00Z"},
|
||||
{"id":0,"name":"No id"},
|
||||
{"id":3,"name":""}
|
||||
]}"""
|
||||
|
||||
@Test
|
||||
fun searchResultsBecomeCatalogEntries() {
|
||||
val page = CurseForgeApp.parseSearch(JSONObject(search))
|
||||
assertEquals(listOf("486246", "2"), page.items.map { it.id })
|
||||
val rxp = page.items[0]
|
||||
assertEquals("RestedXP Guide", rxp.name)
|
||||
assertEquals("RestedXP", rxp.author)
|
||||
assertEquals(12345678L, rxp.downloads)
|
||||
assertEquals(java.time.Instant.parse("2026-11-20T10:00:00Z").toEpochMilli(), rxp.updated)
|
||||
assertEquals("https://media.forgecdn.net/avatars/rxp.png", rxp.thumb)
|
||||
assertEquals("Main", page.items[1].author)
|
||||
assertNull(page.items[1].thumb)
|
||||
assertTrue(page.more)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theLastPageHasNoMore() {
|
||||
val last = JSONObject(search).put("pagination", JSONObject("""{"index":140,"resultCount":10,"totalCount":150}"""))
|
||||
assertFalse(CurseForgeApp.parseSearch(last).more)
|
||||
assertThrows(CurseForgeApp.Failure::class.java) { CurseForgeApp.parseSearch(JSONObject("""{"success":false}""")) }
|
||||
assertThrows(CurseForgeApp.Failure::class.java) { CurseForgeApp.parseSearch(null) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun searchRequestsUseTheInstanceAndOneBasedPages() {
|
||||
val request = CurseForgeApp.searchRequest("guid-1", " Rested ", WowAddonCatalog.Sort.NAME, 0)
|
||||
assertEquals(1, request.getInt("gameId"))
|
||||
assertEquals("Rested", request.getString("searchText"))
|
||||
assertEquals(1, request.getInt("page"))
|
||||
assertEquals(1, request.getInt("sortColumn"))
|
||||
assertEquals(1, request.getInt("sortOrder"))
|
||||
assertEquals("guid-1", request.getString("gameInstanceGuid"))
|
||||
assertEquals(2, CurseForgeApp.searchRequest("g", "", WowAddonCatalog.Sort.DOWNLOADS, 1).getInt("page"))
|
||||
assertEquals(WowAddonCatalog.Sort.entries.size, WowAddonCatalog.Sort.entries.map(CurseForgeApp::sortOf).toSet().size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun installRequestsInstallTheLatestFileIntoTheInstance() {
|
||||
val request = CurseForgeApp.installRequest("guid-1", "486246")
|
||||
assertEquals("guid-1", request.getString("instanceId"))
|
||||
assertEquals(486246L, request.getLong("projectId"))
|
||||
assertTrue(request.getBoolean("installLatestFile"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theInstanceIsPickedByItsFlavorFolder() {
|
||||
val instances = JSONArray("""[
|
||||
{"guid":"retail","installPath":"/root/Games/WoW/_retail_/"},
|
||||
{"guid":"forever","installPath":"/root/Games/WoW/_forever_/"}
|
||||
]""")
|
||||
assertEquals("forever", CurseForgeApp.instanceFor(instances, "/root/Games/WoW/_forever_", "retail"))
|
||||
assertEquals("retail", CurseForgeApp.instanceFor(instances, "/root/Games/WoW/_retail_", null))
|
||||
assertNull(CurseForgeApp.instanceFor(instances, "/root/Games/WoW/_classic_", "retail"))
|
||||
val single = JSONArray("""[{"guid":"retail","installPath":"/root/Games/WoW/_retail_/"}]""")
|
||||
assertNull(CurseForgeApp.instanceFor(single, "/root/Games/WoW/_classic_", "retail"))
|
||||
assertEquals("retail", CurseForgeApp.instanceFor(single, "/root/Games/WoW/_retail_", "other"))
|
||||
assertEquals("only", CurseForgeApp.instanceFor(JSONArray(), "/x/_forever_", "only"))
|
||||
assertEquals("only", CurseForgeApp.instanceFor(null, "/x/_forever_", "only"))
|
||||
assertNull(CurseForgeApp.instanceFor(JSONArray(), "/x/_forever_", ""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun answersAreUnwrapped() {
|
||||
val ok = JSONObject().put("ok", true).put("value", """{"value":{"resultStatus":3,"gameInstanceGuid":"g"}}""")
|
||||
assertEquals("g", (CurseForgeApp.unwrap(ok) as JSONObject).getString("gameInstanceGuid"))
|
||||
assertEquals(true, CurseForgeApp.unwrap(JSONObject().put("ok", true).put("value", """{"value":true}""")))
|
||||
val missing = JSONObject().put("ok", true).put("value", """{"missing":true}""")
|
||||
assertThrows(CurseForgeApp.Failure::class.java) { CurseForgeApp.unwrap(missing) }
|
||||
val failed = JSONObject().put("ok", false).put("error", JSONObject().put("code", "NO_TARGET").put("message", "no node"))
|
||||
val failure = assertThrows(CurseForgeApp.Failure::class.java) { CurseForgeApp.unwrap(failed) }
|
||||
assertEquals("no node", failure.message)
|
||||
assertEquals("NO_TARGET", failure.code)
|
||||
assertFalse(failure.gone)
|
||||
val lost = JSONObject().put("ok", false).put("error", JSONObject().put("code", "DEVTOOLS_UNREACHABLE").put("message", "refused"))
|
||||
assertTrue(assertThrows(CurseForgeApp.Failure::class.java) { CurseForgeApp.unwrap(lost) }.gone)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun expressionsDriveTheHiddenDesktopWindow() {
|
||||
val text = CurseForgeApp.expression("ProjectAppService", "search", JSONArray().put(JSONObject().put("searchText", "it's \"x\"")))
|
||||
assertTrue(text.startsWith("(() => { const w = require('electron').BrowserWindow.getAllWindows()"))
|
||||
assertTrue(text.contains("desktop.html"))
|
||||
assertTrue(text.contains("executeJavaScript("))
|
||||
assertFalse(text.contains("show()"))
|
||||
val probe = CurseForgeApp.expression("InstalledProjectsAppService", "installAddon", null)
|
||||
assertFalse(probe.contains("await s["))
|
||||
val connect = CurseForgeApp.expression("CoreService", "connect", JSONArray(), "r => true")
|
||||
assertTrue(connect.contains("(r => true)(await s[\\\"connect\\\"](...[]))"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun installedProjectsAndExitCodes() {
|
||||
val projects = CurseForgeApp.parseProjects(JSONArray("""[
|
||||
{"id":"486246","installedModId":"a_486246","status":3,"locked":false,"folders":["RXPGuides","RXPGuides_Extra"]},
|
||||
{"id":"2","installedModId":"b_2","status":2,"locked":true,"folders":[]},
|
||||
{"id":null}]"""))
|
||||
assertEquals(listOf("486246", "2"), projects.map { it.id })
|
||||
assertEquals("486246", CurseForgeApp.owner(projects, "RXPGuides_Extra")?.id)
|
||||
assertNull(CurseForgeApp.owner(projects, "TomTom"))
|
||||
assertFalse(projects[1].update)
|
||||
assertTrue(CurseForgeApp.parseProjects(JSONObject()).isEmpty())
|
||||
assertEquals(CurseForgeApp.Start.READY, CurseForgeApp.startState(0))
|
||||
assertEquals(CurseForgeApp.Start.BUSY, CurseForgeApp.startState(3))
|
||||
assertEquals(CurseForgeApp.Start.FAILED, CurseForgeApp.startState(4))
|
||||
assertEquals(CurseForgeApp.Start.FAILED, CurseForgeApp.startState(5))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onlyASecretInspectorUrlIsTaken() {
|
||||
val url = "ws://127.0.0.1:43117/0f8fad5b-d9cb-469f-a165-70867728950e"
|
||||
assertEquals(url, CurseForgeApp.inspectorUrl("noise\n$url\n"))
|
||||
assertNull(CurseForgeApp.inspectorUrl("ready\n"))
|
||||
assertNull(CurseForgeApp.inspectorUrl("ws://127.0.0.1:9229/\n"))
|
||||
assertNull(CurseForgeApp.inspectorUrl("ws://10.0.0.2:43117/0f8fad5b-d9cb-469f-a165-70867728950e"))
|
||||
assertNull(CurseForgeApp.inspectorUrl("$url/json"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theWowRootIsTheParentOfEveryFlavor() {
|
||||
val root = temp.newFolder("World of Warcraft")
|
||||
for (flavor in listOf("_classic_", "_classic_era_")) {
|
||||
File(root, "$flavor/Interface/AddOns").mkdirs()
|
||||
File(root, "$flavor/.flavor.info").writeText("x")
|
||||
}
|
||||
val title = BattleNet.TITLES.first { it.flavor == "_classic_" }
|
||||
val targets = WowAddons.targets(title, File(root, "_classic_"))
|
||||
assertEquals(listOf("_classic_", "_classic_era_"), targets.map { it.flavor }.sorted())
|
||||
for (target in targets) {
|
||||
assertEquals(root, WowAddons.root(target))
|
||||
assertEquals(File(root, target.flavor), WowAddons.flavorDir(target))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theAppStartsInTheGuestWithoutASessionAndIsAskedThroughItsInspector() {
|
||||
val calls = fakeGuest(0)
|
||||
val started = CurseForgeApp.start(org.robolectric.RuntimeEnvironment.getApplication(), app, launch())
|
||||
assertEquals(CurseForgeApp.Start.READY, started.state)
|
||||
assertEquals(url, started.inspector)
|
||||
assertEquals(listOf(CurseForgeApp.HELPER, "start", "/root/apps/curseforge"), calls.first())
|
||||
val probe = calls[1]
|
||||
assertEquals(listOf(CurseForgeApp.AGENT, "--cdp-inspector", url), probe.take(3))
|
||||
assertEquals("10.0", probe[3])
|
||||
assertTrue(probe[4].contains("InstalledProjectsAppService"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theLaunchLivesUntilItIsStopped() {
|
||||
fakeGuest(0)
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val hold = launch()
|
||||
assertEquals(CurseForgeApp.Start.READY, CurseForgeApp.start(context, app, hold).state)
|
||||
assertEquals(false, holder.get()?.get())
|
||||
assertEquals(1L, released.count)
|
||||
CurseForgeApp.stop(context, app, url, hold)
|
||||
assertTrue(released.await(5, java.util.concurrent.TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAppThatIsAlreadyOpenIsNeitherUsedNorStopped() {
|
||||
val calls = fakeGuest(3)
|
||||
assertEquals(CurseForgeApp.Start.BUSY, CurseForgeApp.start(org.robolectric.RuntimeEnvironment.getApplication(), app, launch()).state)
|
||||
assertEquals(listOf(listOf(CurseForgeApp.HELPER, "start", "/root/apps/curseforge")), calls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun stoppingAsksTheAppToQuitThenStopsItsHeadlessLaunchOnce() {
|
||||
val calls = fakeGuest(0)
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val hold = launch()
|
||||
CurseForgeApp.start(context, app, hold)
|
||||
calls.clear()
|
||||
CurseForgeApp.stop(context, app, url, hold)
|
||||
assertEquals(CurseForgeApp.AGENT, calls[0][0])
|
||||
assertTrue(calls[0][4].contains("shutdown"))
|
||||
assertEquals(listOf(CurseForgeApp.HELPER, "stop", "/root/apps/curseforge"), calls[1])
|
||||
assertTrue(hold.get())
|
||||
calls.clear()
|
||||
CurseForgeApp.stop(context, app, url, hold)
|
||||
assertTrue(calls.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLateStopLeavesTheNewerLaunchRunning() {
|
||||
val calls = fakeGuest(0)
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val old = launch()
|
||||
val newer = launch()
|
||||
CurseForgeApp.start(context, app, old)
|
||||
CurseForgeApp.start(context, app, newer)
|
||||
assertTrue(old.get())
|
||||
calls.clear()
|
||||
CurseForgeApp.stop(context, app, url, old)
|
||||
assertTrue(calls.isEmpty())
|
||||
assertEquals(false, newer.get())
|
||||
CurseForgeApp.stop(context, app, null, newer)
|
||||
assertEquals(listOf(listOf(CurseForgeApp.HELPER, "stop", "/root/apps/curseforge")), calls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aStoppedLaunchNeverStarts() {
|
||||
val calls = fakeGuest(0)
|
||||
val hold = launch().apply { set(true) }
|
||||
assertEquals(CurseForgeApp.Start.FAILED, CurseForgeApp.start(org.robolectric.RuntimeEnvironment.getApplication(), app, hold).state)
|
||||
assertTrue(calls.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAppWithoutADirectoryIsNeverLaunched() {
|
||||
val calls = fakeGuest(0)
|
||||
val bare = UserApps.App("appimage:d", UserApps.Kind.APPIMAGE, "CurseForge", null, null, AppImageManager.LAUNCHER, emptyList(), feed = CurseForgeApp.FEED)
|
||||
val hold = launch()
|
||||
assertEquals(CurseForgeApp.Start.FAILED, CurseForgeApp.start(org.robolectric.RuntimeEnvironment.getApplication(), bare, hold).state)
|
||||
CurseForgeApp.stop(org.robolectric.RuntimeEnvironment.getApplication(), bare, url, hold)
|
||||
assertTrue(calls.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theInspectorUrlIsRedactedFromCommandLogs() {
|
||||
val line = CurseForgeApp.evalArgv(url, "x", 1_000).joinToString(" ")
|
||||
assertTrue(line.contains(url))
|
||||
assertTrue(!GuestCommand.redacted(line, CurseForgeApp.INSPECTOR).contains("127.0.0.1"))
|
||||
assertTrue(!GuestCommand.redacted(url, CurseForgeApp.INSPECTOR).contains(url))
|
||||
}
|
||||
|
||||
private class Curse(val addOns: File, val flavor: String = "") {
|
||||
val projects = java.util.concurrent.CopyOnWriteArrayList<JSONObject>()
|
||||
val methods = java.util.Collections.synchronizedList(mutableListOf<String>())
|
||||
@Volatile var unreachableAfterDelete = false
|
||||
@Volatile var unreachable = false
|
||||
|
||||
fun add(id: String, folder: String, status: Int) = add(id, listOf(folder), status)
|
||||
|
||||
fun add(id: String, folders: List<String>, status: Int, onDisk: List<String> = folders) {
|
||||
onDisk.forEach { File(addOns, it).mkdirs() }
|
||||
projects += JSONObject().put("id", id).put("installedModId", "m_$id").put("status", status).put("locked", false).put("folders", JSONArray(folders))
|
||||
}
|
||||
|
||||
private fun folders(p: JSONObject) = (0 until p.getJSONArray("folders").length()).map { p.getJSONArray("folders").getString(it) }
|
||||
|
||||
fun answer(expression: String): Any? {
|
||||
val method = Regex("s\\[\\\\\"(\\w+)\\\\\"\\]").find(expression)?.groupValues?.get(1) ?: return true
|
||||
methods += method
|
||||
return when (method) {
|
||||
"scanGameInstance" -> {
|
||||
projects.removeAll { p -> !File(addOns, p.getJSONArray("folders").getString(0)).isDirectory }
|
||||
true
|
||||
}
|
||||
"getProjects" -> JSONArray(projects.map { JSONObject(it.toString()) })
|
||||
"updateMod" -> {
|
||||
projects.forEach { it.put("status", 1) }
|
||||
true
|
||||
}
|
||||
"detectGameFromPath" -> JSONObject().put("gameInstanceGuid", "g")
|
||||
"getGameInstances" -> JSONArray().put(JSONObject().put("guid", "g").put("installPath", flavor))
|
||||
"deleteMods" -> {
|
||||
projects.removeAll { p ->
|
||||
(p.getString("installedModId") in expression).also { gone ->
|
||||
if (gone) folders(p).forEach { name -> WowAddons.folder(addOns, name)?.deleteRecursively() }
|
||||
}
|
||||
}
|
||||
if (unreachableAfterDelete) unreachable = true
|
||||
JSONArray()
|
||||
}
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fakeCurse(addOns: File = temp.newFolder("AddOns"), flavor: String = "", calls: MutableList<List<String>> = mutableListOf()): Curse {
|
||||
val curse = Curse(addOns, flavor)
|
||||
CurseForgeApp.guest = { _, argv, cancelled, onLine ->
|
||||
calls += argv
|
||||
when {
|
||||
argv[0] == CurseForgeApp.HELPER && argv[1] == "start" -> {
|
||||
onLine(url)
|
||||
while (cancelled?.get() != true) Thread.sleep(10)
|
||||
0
|
||||
}
|
||||
argv[0] == CurseForgeApp.HELPER -> 0
|
||||
curse.unreachable -> {
|
||||
onLine(JSONObject().put("ok", false).put("error", JSONObject().put("code", "DEVTOOLS_UNREACHABLE").put("message", "gone")).toString())
|
||||
0
|
||||
}
|
||||
else -> {
|
||||
val value = JSONObject().put("value", curse.answer(argv[4]) ?: JSONObject.NULL)
|
||||
onLine(JSONObject().put("ok", true).put("value", value.toString()).toString())
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
return curse
|
||||
}
|
||||
|
||||
private fun wow(): WowAddons.Target {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val games = temp.newFolder("Games")
|
||||
val addOns = File(games, "World of Warcraft/_retail_/Interface/AddOns").apply { mkdirs() }
|
||||
com.droiddeck.launcher.session.SessionPrefs.setGameFolderBinds(context, listOf(games.absolutePath to "/root/Games"))
|
||||
return WowAddons.Target("_retail_", addOns)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anEntryCurseForgeStillListsShowsAsNotInstalledOnceItsFolderIsGone() {
|
||||
val curse = fakeCurse()
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
curse.add("18808", "TomTom", 1)
|
||||
assertTrue(File(curse.addOns, "Leatrix_Maps").deleteRecursively())
|
||||
val listed = CurseForgeApp.projects(context, url, "g")
|
||||
assertEquals(listOf("298842", "18808"), listed.map { it.id })
|
||||
assertEquals(listOf("18808"), CurseForgeApp.onDisk(listed, curse.addOns).map { it.id })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aProjectWithAnyFolderMissingOrNoFoldersIsNotInstalled() {
|
||||
val addOns = temp.newFolder("Split")
|
||||
File(addOns, "DBM-Core").mkdirs()
|
||||
val split = CurseForgeApp.Project("3358", "m_3358", listOf("DBM-Core", "DBM-StatusBarTimers"), false)
|
||||
val bare = CurseForgeApp.Project("1", "m_1", emptyList(), false)
|
||||
assertTrue(CurseForgeApp.onDisk(listOf(split, bare), addOns).isEmpty())
|
||||
File(addOns, "DBM-StatusBarTimers").mkdirs()
|
||||
assertEquals(listOf("3358"), CurseForgeApp.onDisk(listOf(split, bare), addOns).map { it.id })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aDeleteWhileCurseForgeIsLinkedGoesThroughItsUninstall() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_")
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
curse.add("18808", "TomTom", 1)
|
||||
val link = com.droiddeck.launcher.ui.CurseLink(app)
|
||||
try {
|
||||
link.call(context, target) { CurseForgeApp.projects(context, it.inspector, it.guid) }
|
||||
assertTrue(com.droiddeck.launcher.ui.CurseLink.live() === link)
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Leatrix_Maps")
|
||||
assertTrue("deleteMods" in curse.methods)
|
||||
assertFalse(File(target.addOns, "Leatrix_Maps").exists())
|
||||
assertEquals(listOf("18808"), CurseForgeApp.projects(context, url, "g").map { it.id })
|
||||
} finally {
|
||||
link.close(context)
|
||||
}
|
||||
assertNull(com.droiddeck.launcher.ui.CurseLink.live())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aDeleteWithoutALiveLinkRemovesTheFolderAtOnceWithoutStartingCurseForge() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val calls = java.util.Collections.synchronizedList(mutableListOf<List<String>>())
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_", calls)
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
assertNull(com.droiddeck.launcher.ui.CurseLink.live())
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Leatrix_Maps")
|
||||
assertFalse(File(target.addOns, "Leatrix_Maps").exists())
|
||||
assertTrue(calls.isEmpty())
|
||||
assertTrue(CurseForgeApp.projects(context, url, "g", rescan = true).none { it.id == "298842" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLinkThatNeverStartedIsNotUsedToDelete() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val calls = java.util.Collections.synchronizedList(mutableListOf<List<String>>())
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_", calls)
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Leatrix_Maps", com.droiddeck.launcher.ui.CurseLink(app))
|
||||
assertFalse(File(target.addOns, "Leatrix_Maps").exists())
|
||||
assertTrue(calls.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAddonWhoseFolderWasDeletedShowsAsNotInstalledAfterTheRescan() {
|
||||
val curse = fakeCurse()
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
assertEquals(listOf("298842"), CurseForgeApp.projects(context, url, "g", rescan = true).map { it.id })
|
||||
assertTrue(File(curse.addOns, "Leatrix_Maps").deleteRecursively())
|
||||
assertTrue(CurseForgeApp.projects(context, url, "g").isNotEmpty())
|
||||
assertTrue(CurseForgeApp.projects(context, url, "g", rescan = true).isEmpty())
|
||||
assertTrue("scanGameInstance" in curse.methods)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNewerFileShowsAsAnUpdateUntilCurseForgeUpdatesIt() {
|
||||
val curse = fakeCurse()
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
curse.add("298842", "Leatrix_Maps", 2)
|
||||
curse.add("18808", "TomTom", 1)
|
||||
val before = CurseForgeApp.projects(context, url, "g", rescan = true).associate { it.id to it.update }
|
||||
assertEquals(mapOf("298842" to true, "18808" to false), before)
|
||||
assertTrue(CurseForgeApp.update(context, url, "g", "298842"))
|
||||
assertTrue("updateMod" in curse.methods)
|
||||
assertTrue(CurseForgeApp.projects(context, url, "g").none { it.update })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun uninstallingThroughCurseForgeClearsItsListAndTheFolder() {
|
||||
val curse = fakeCurse()
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
curse.add("18808", "TomTom", 1)
|
||||
val project = CurseForgeApp.owner(CurseForgeApp.projects(context, url, "g"), "Leatrix_Maps")!!
|
||||
assertTrue(CurseForgeApp.uninstall(context, url, "g", project))
|
||||
assertEquals(listOf("18808"), CurseForgeApp.projects(context, url, "g").map { it.id })
|
||||
assertFalse(File(curse.addOns, "Leatrix_Maps").exists())
|
||||
assertTrue(File(curse.addOns, "TomTom").isDirectory)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anUninstallThatRemovedTheFolderBeforeCurseForgeWentAwayCountsAsDeleted() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_")
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
curse.unreachableAfterDelete = true
|
||||
val link = com.droiddeck.launcher.ui.CurseLink(app)
|
||||
try {
|
||||
link.call(context, target) { CurseForgeApp.projects(context, it.inspector, it.guid) }
|
||||
val before = WowAddons.imports
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Leatrix_Maps")
|
||||
assertTrue("deleteMods" in curse.methods)
|
||||
assertFalse(File(target.addOns, "Leatrix_Maps").exists())
|
||||
assertTrue(WowAddons.imports > before)
|
||||
} finally {
|
||||
kotlinx.coroutines.runBlocking { link.close(context).join() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLocalDeleteInAProjectWithAMissingFolderKeepsItsOtherFolders() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_")
|
||||
curse.add("3358", listOf("DBM-Core", "DBM-GUI", "DBM-StatusBarTimers"), 1, onDisk = listOf("DBM-Core", "DBM-GUI"))
|
||||
curse.add("298842", "Leatrix_Maps", 1)
|
||||
val link = com.droiddeck.launcher.ui.CurseLink(app)
|
||||
try {
|
||||
link.call(context, target) { CurseForgeApp.projects(context, it.inspector, it.guid) }
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "DBM-Core")
|
||||
assertFalse("deleteMods" in curse.methods)
|
||||
assertFalse(File(target.addOns, "DBM-Core").exists())
|
||||
assertTrue(File(target.addOns, "DBM-GUI").isDirectory)
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Leatrix_Maps")
|
||||
assertTrue("deleteMods" in curse.methods)
|
||||
assertFalse(File(target.addOns, "Leatrix_Maps").exists())
|
||||
} finally {
|
||||
kotlinx.coroutines.runBlocking { link.close(context).join() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun foldersMatchCurseForgesNamesWhateverTheirCase() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
val curse = fakeCurse(target.addOns, "/root/Games/World of Warcraft/_retail_")
|
||||
curse.add("12345", listOf("Questie"), 1, onDisk = listOf("questie"))
|
||||
val listed = CurseForgeApp.projects(context, url, "g")
|
||||
assertEquals(listOf("12345"), CurseForgeApp.onDisk(listed, target.addOns).map { it.id })
|
||||
assertEquals("12345", CurseForgeApp.byFolder(listed)["questie"]?.id)
|
||||
assertEquals("questie", WowAddons.folder(target.addOns, "Questie")?.name)
|
||||
val link = com.droiddeck.launcher.ui.CurseLink(app)
|
||||
try {
|
||||
link.call(context, target) { CurseForgeApp.projects(context, it.inspector, it.guid) }
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Questie")
|
||||
assertTrue("deleteMods" in curse.methods)
|
||||
assertNull(WowAddons.folder(target.addOns, "Questie"))
|
||||
} finally {
|
||||
kotlinx.coroutines.runBlocking { link.close(context).join() }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLocalDeleteFindsTheFolderWhateverItsCaseAndAnAbsentFolderIsAlreadyDeleted() {
|
||||
val context = org.robolectric.RuntimeEnvironment.getApplication()
|
||||
val target = wow()
|
||||
File(target.addOns, "questie").mkdirs()
|
||||
File(target.addOns, "TomTom").mkdirs()
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Questie", null)
|
||||
assertNull(WowAddons.folder(target.addOns, "Questie"))
|
||||
assertTrue(File(target.addOns, "TomTom").isDirectory)
|
||||
val before = WowAddons.imports
|
||||
com.droiddeck.launcher.ui.deleteAddon(context, target, "Gone", null)
|
||||
assertTrue(WowAddons.imports > before)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theAgentAnswerIsTheLastJsonLine() {
|
||||
assertEquals("a", CurseForgeApp.lastJson(listOf("noise", """{"v":"a"}""", "== done"))?.getString("v"))
|
||||
assertNull(CurseForgeApp.lastJson(listOf("noise")))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import com.droiddeck.launcher.ui.deckyStoreMatches
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@org.junit.runner.RunWith(org.robolectric.RobolectricTestRunner::class)
|
||||
@org.robolectric.annotation.Config(sdk = [33], application = android.app.Application::class)
|
||||
class DeckyStoreTest {
|
||||
private val hash = "a".repeat(64)
|
||||
private val listing = """[
|
||||
{"id":1,"name":"Alpha","author":"Ann","description":"Does alpha things","tags":["audio"],"image_url":"https://cdn.example/a.png",
|
||||
"versions":[{"name":"2.0.0","hash":"$hash","downloads":10},{"name":"1.0.0","hash":"${"b".repeat(64)}","downloads":5}]},
|
||||
{"id":2,"name":"Beta","author":"Bob","description":"Themes","tags":["css"],"versions":[{"name":"1.0.0","hash":"${"c".repeat(64)}","downloads":100}]},
|
||||
{"id":3,"name":"NoVersions","author":"X","description":"","tags":[],"versions":[]},
|
||||
{"id":4,"name":"BadHash","author":"X","description":"","tags":[],"versions":[{"name":"1","hash":"nope","downloads":1}]}
|
||||
]"""
|
||||
|
||||
@Test fun listingKeepsOnlyPluginsWithAUsableVersionAndSumsDownloads() {
|
||||
val plugins = DeckyStore.parseListing(listing)
|
||||
assertEquals(listOf("Alpha", "Beta"), plugins.map { it.name })
|
||||
assertEquals("2.0.0", plugins[0].latest?.name)
|
||||
assertEquals(15L, plugins[0].downloads)
|
||||
assertEquals("https://cdn.example/a.png", plugins[0].imageUrl)
|
||||
assertEquals("", plugins[1].imageUrl)
|
||||
}
|
||||
|
||||
@Test fun searchMatchesNameAuthorDescriptionAndTagsAndSortsByDownloads() {
|
||||
val plugins = DeckyStore.parseListing(listing)
|
||||
assertEquals(listOf("Beta", "Alpha"), deckyStoreMatches(plugins, "").map { it.name })
|
||||
assertEquals(listOf("Alpha"), deckyStoreMatches(plugins, "ann audio").map { it.name })
|
||||
assertEquals(listOf("Beta"), deckyStoreMatches(plugins, "THEMES").map { it.name })
|
||||
assertTrue(deckyStoreMatches(plugins, "missing").isEmpty())
|
||||
}
|
||||
|
||||
@Test fun anUpdateNeedsAKnownInstalledVersionThatDiffersFromTheLatest() {
|
||||
val alpha = DeckyStore.parseListing(listing).first()
|
||||
assertTrue(DeckyStore.updateAvailable(DeckyStore.Installed("Alpha", "Alpha", "Ann", "1.0.0"), alpha))
|
||||
assertFalse(DeckyStore.updateAvailable(DeckyStore.Installed("Alpha", "Alpha", "Ann", "2.0.0"), alpha))
|
||||
assertFalse(DeckyStore.updateAvailable(DeckyStore.Installed("Alpha", "Alpha", "Ann", ""), alpha))
|
||||
assertFalse(DeckyStore.updateAvailable(DeckyStore.Installed("Alpha", "Alpha", "Ann", "1.0.0"), null))
|
||||
assertNull(DeckyStore.parseListing("[]").firstOrNull())
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ class WowAddonCatalogTest {
|
||||
private val context get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
private val files = """[
|
||||
{"UID":"1","UICATID":"19","UIVersion":"1.0","UIDate":300,"UIName":"Bartender","UIAuthorName":"Nevcairiel","UIDownloadTotal":"500","UICompatibility":[{"version":"12.0.0","name":"Midnight"}],"UIIMG_Thumbs":["https://cdn.example/a.jpg"]},
|
||||
{"UID":"1","UICATID":"19","UIVersion":"1.0","UIDate":300,"UIName":"Bartender","UIAuthorName":"Nevcairiel","UIDownloadTotal":"500","UICompatibility":[{"version":"12.0.0","name":"Midnight"}],"UIIMG_Thumbs":["https://cdn.example/a.jpg"],"UIDir":["Bartender4"," Bartender4_Options "]},
|
||||
{"UID":"2","UICATID":"20","UIVersion":"2.0","UIDate":100,"UIName":"Zygor","UIAuthorName":"Kappa","UIDownloadTotal":"900","UICompatibility":[{"version":"1.15.7","name":"Classic"},{"version":"4.4.2","name":"Cataclysm Classic"}],"UIIMG_Thumbs":null},
|
||||
{"UID":"3","UICATID":"21","UIVersion":"3.0","UIDate":200,"UIName":"Alpha","UIAuthorName":"bartuser","UIDownloadTotal":"10","UIDownloadMonthly":"9","UICompatibility":null},
|
||||
{"UID":"4","UICATID":"19","UIVersion":"4.0","UIDate":400,"UIName":"TBCOnly","UIAuthorName":"x","UIDownloadTotal":"20","UIDownloadMonthly":"5","UICompatibility":[{"version":"2.5.4","name":"The Burning Crusade Classic"}]}
|
||||
@@ -44,6 +44,12 @@ class WowAddonCatalogTest {
|
||||
assertEquals("19", e[0].category)
|
||||
}
|
||||
|
||||
@Test fun fileListEntriesCarryTheirAddonFolders() {
|
||||
val e = WowAddonCatalog.parseWowiFiles(files)
|
||||
assertEquals(listOf("Bartender4", "Bartender4_Options"), e[0].addon.folders)
|
||||
assertEquals(emptyList<String>(), e[1].addon.folders)
|
||||
}
|
||||
|
||||
@Test fun versionsMapToFlavors() {
|
||||
assertEquals("_retail_", WowAddonCatalog.flavorOf("12.1.0"))
|
||||
assertEquals("_retail_", WowAddonCatalog.flavorOf("11.0.5"))
|
||||
@@ -198,6 +204,32 @@ us|1|aa|bb|cc||tpr/wow|h|s|t||1|12.1.0.65000|kk|wowf
|
||||
assertFalse(WowAddonCatalog.sameVersion("1.2.3", "1.2.4"))
|
||||
}
|
||||
|
||||
@Test fun versionsCompareNumericSegmentsFirst() {
|
||||
assertEquals(true, WowAddonCatalog.newer("v4.11.38-7-ge56e9d8", "4.11.39"))
|
||||
assertEquals(true, WowAddonCatalog.newer("1.9", "1.10"))
|
||||
assertEquals(true, WowAddonCatalog.newer("2", "2.0.1"))
|
||||
assertEquals(false, WowAddonCatalog.newer("11.2.0", "6.2.5"))
|
||||
assertEquals(false, WowAddonCatalog.newer("2.0", "2"))
|
||||
assertNull(WowAddonCatalog.newer("11.4.10-beta1", "11.4.10"))
|
||||
assertNull(WowAddonCatalog.newer("release", "1.0"))
|
||||
}
|
||||
|
||||
@Test fun anUpdateIsOfferedOnlyForANewerVersionOrTheSameSourcesCurrentFile() {
|
||||
assertTrue(WowAddonCatalog.offersUpdate("1.9", "1.10", sameSource = false))
|
||||
assertFalse(WowAddonCatalog.offersUpdate("11.2.0", "6.2.5", sameSource = true))
|
||||
assertFalse(WowAddonCatalog.offersUpdate("v1.2", "1.2", sameSource = true))
|
||||
assertTrue(WowAddonCatalog.offersUpdate("11.4.10-beta1", "11.4.10", sameSource = true))
|
||||
assertFalse(WowAddonCatalog.offersUpdate("11.4.10-beta1", "11.4.10", sameSource = false))
|
||||
assertFalse(WowAddonCatalog.offersUpdate(null, "1.0", sameSource = true))
|
||||
assertFalse(WowAddonCatalog.offersUpdate("1.0", "", sameSource = true))
|
||||
}
|
||||
|
||||
@Test fun findUpdatesNeverOffersADowngrade() {
|
||||
val installed = listOf(WowAddons.Installed("Ahead", "3.0", "10"), WowAddons.Installed("Tagged", "r55-alpha", "20"))
|
||||
val updates = WowAddonCatalog.findUpdates(listOf(entry("10", "2.9"), entry("20", "r56")), installed)
|
||||
assertEquals(setOf("Tagged"), updates.keys)
|
||||
}
|
||||
|
||||
@Test fun md5Check() {
|
||||
val f = File(context.cacheDir, "wowaddon-md5-test.zip")
|
||||
f.writeText("hello")
|
||||
|
||||
Loaded 100 of 162 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user