Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。

## [0.0.30] — 2026-11-24

### 新增

- **手机端遮挡治理**:统一所有面板为 edge-to-edge `Dialog`,外层一次性吃掉状态栏、导航栏与软键盘 inset;卡片最大高度等于键盘上方可用高度。标题、footer 输入框和底部按钮固定,只有正文滚动,长设置/长对话不再把输入框或按钮顶出屏幕。
- **终端全屏自适应**:终端面板从固定 330dp 对话框改为全屏可伸缩布局。PTY 主体用 `weight(1f)` 吃掉键盘上方空间,Esc/Tab/Ctrl/方向键条固定贴在键盘上方;非 PTY 的输入框固定在底部,长输出不会把它滚走。
- **键盘不再误触发布局切换**:横竖屏判断从「内容区宽高比」改为系统 `Configuration.orientation`。软键盘把可用高度压矮时,竖屏手机不会突然变成左右分栏,避免界面重排造成遮挡。
- **输出面板高度分离偏好与可见值**:用户拖出的高度(preferred)与当前键盘/横屏下的可见高度(visible)分开计算;键盘弹起只临时夹取 visible,不写回设置,键盘收起后编辑器恢复原高度。展开 stdin 输入行时通常保留 220dp;极矮屏自动降到 150dp,优先保证输入框和编辑器都在屏内,并收起 40dp 的大运行按钮。
- **底部状态栏归位**:状态栏移入 `Scaffold.bottomBar`,Snackbar 自动落在它上方,不再盖住行号/保存状态或终端按键条。

### 改变

- **对话框**:`QuietDialog` 改为自定义 edge-to-edge `Dialog`,手机宽度占满左右 16dp,平板最大 560dp;正文滚动、footer 与按钮固定。AI 助手和 Agent 的输入框移入 footer,键盘弹起时始终可见。
- **命令面板**:列表高度改为自适应,最大 380dp;键盘弹起时整体留在键盘上方,不越过屏幕。
- **小屏细节**:顶栏文件名/语言标签改为单行省略;状态栏左侧信息可横向滚动、「已保存」固定贴右;输出头状态单行省略;Tab 名最大 180dp;AI 快捷动作与输出方向键改为横向滚动;编辑器在 IME inset 变化时重新把光标滚回可视区。

### 边界

- 本轮未取得 Android 真机/模拟器交互验收:x86_64 TCG 在单核模式下仍停在 `emulator-5556 offline`,未完成开机;没有伪造运行截图。布局与 inset 逻辑通过 Kotlin 编译、136 个 JVM 单测和 lint 验证,Android WebView/IME 的最终触感仍需真机确认。
- edge-to-edge Dialog 依赖 Android 的 WindowInsets 分发;极老机型或自定义 ROM 若不上报 IME inset,仍可能出现键盘覆盖,需要在设置里手动收起键盘作为兜底。

### 构建

- `versionCode 30` / `versionName 0.0.30`。
- 单元测试 **136 个通过**(新增 6 个 `LayoutMetrics` 测试),0 failures / 0 errors。
- release APK **31,722,051 B(约 30.3MiB)**,SHA-256 `de3d41a6419a2820c30ab2ec6892da3280797097b9b6a41aa50f56184dec16dc`;debug APK **51,337,601 B(约 49.0MiB)**,SHA-256 `de5220970bc299324f9ebdcb88bb60924c1c023b4a30f096079c4a6d1df9a508`。
- lint Release **36 Warning + 2 Information**,Fatal 0 / Error 0。
- 签名证书不变:`CN=CodePocket`,SHA-256 `1b02135746d1426d7beda47e706fdb2c77a7145ea41e0f7e14addb191b87fac5`。
- APK 仍包含 `assets/terminal/` 的 xterm.js 5.5.0 与双 ABI `libptybridge.so`。

## [0.0.29] — 2026-11-24

### 新增
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ Three runtimes are bundled inside the APK: a natively cross-compiled CPython 3.1
- **Python pdb debugger**: real stdlib `pdb`; breakpoints, next/step/continue, `p locals()`, stack, quit; quick-action bar in output panel
- **Offline by design**: no language server process, no model download, hard caps at 300 `.py` files / 512KB per file

### Mobile layout & keyboard (0.0.30)
- **No more clipped panels**: every dialog is edge-to-edge and sized to the area above the IME; title, footer input and action buttons stay fixed while only the body scrolls
- **Terminal resizes with the keyboard**: PTY body uses the remaining height, so Esc/Tab/Ctrl/arrow keys stay visible instead of being pushed under the soft keyboard
- **Stable orientation**: screen mode follows the system orientation, not the content height, so opening the keyboard no longer flips a portrait phone into the landscape layout
- **Output height remembers you**: keyboard-only clamping is temporary; the preferred draggable height is not overwritten, and the stdin row keeps 220dp when space allows and yields to 150dp on very short screens
- **Small-screen polish**: one-line ellipsis for title/status, scrollable status text, capped tab width, and scrollable quick-action/special-key rows

### Agent & terminal (0.0.29)
- **Agent plan mode**: plan → approval → tool execution, with cross-turn context and token budgets
- **Project rules**: reads `AGENTS.md` / `CLAUDE.md` / `.cursorrules` / `.windsurfrules` / Copilot instructions
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId = "com.devterminal"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 29
versionName = "0.0.29"
versionCode = 30
versionName = "0.0.30"
vectorDrawables { useSupportLibrary = true }
// 原生 CPython 引擎:同时打 arm64 与 x86_64(后者用于模拟器/ChromeOS)
ndk { abiFilters += listOf("arm64-v8a", "x86_64") }
Expand Down
58 changes: 27 additions & 31 deletions app/src/main/java/com/devterminal/ui/AgentPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
Expand Down Expand Up @@ -78,6 +77,19 @@ fun AgentPanelDialog(
title = "Agent",
confirmLabel = if (configured && inputDraft.isNotBlank() && !busy) "执行" else null,
onConfirm = if (configured && inputDraft.isNotBlank() && !busy) onSend else null,
// 输入框固定在底部,键盘弹出时不被正文或按钮遮住。
footer = {
QuietTextField(
value = inputDraft,
onValueChange = onInputChange,
modifier = Modifier.fillMaxWidth(),
placeholder = if (busy) "Agent 正在执行…" else "让 Agent 改点什么…",
mono = false,
enabled = !busy,
imeAction = androidx.compose.ui.text.input.ImeAction.Send,
onImeAction = { if (inputDraft.isNotBlank() && !busy) onSend() },
)
},
) {
if (!configured) {
QuietHint(
Expand Down Expand Up @@ -185,40 +197,24 @@ fun AgentPanelDialog(
}
}
}

Spacer(Modifier.height(Dimens.sm))
QuietTextField(
value = inputDraft,
onValueChange = onInputChange,
modifier = Modifier.fillMaxWidth(),
placeholder = if (busy) "Agent 正在执行…" else "让 Agent 改点什么…",
mono = false,
enabled = !busy,
imeAction = androidx.compose.ui.text.input.ImeAction.Send,
onImeAction = { if (inputDraft.isNotBlank() && !busy) onSend() },
)
}

if (confirmRestore) {
AlertDialog(
onDismissRequest = { confirmRestore = false },
title = { Text("恢复到 Agent 修改前") },
text = {
Text(
"将把本次修改过的文件(${lastCheckpoint?.label ?: "检查点"})恢复为快照内容。" +
"当前未保存的编辑会丢失,确定继续?",
)
QuietDialog(
onDismiss = { confirmRestore = false },
title = "恢复到 Agent 修改前",
confirmLabel = "恢复",
onConfirm = {
confirmRestore = false
onRestoreCheckpoint()
},
confirmButton = {
TextButton(onClick = {
confirmRestore = false
onRestoreCheckpoint()
}) { Text("恢复") }
},
dismissButton = {
TextButton(onClick = { confirmRestore = false }) { Text("取消") }
},
)
dismissLabel = "取消",
) {
Text(
"将把本次修改过的文件(${lastCheckpoint?.label ?: "检查点"})恢复为快照内容。" +
"当前未保存的编辑会丢失,确定继续?",
)
}
}
}

Expand Down
36 changes: 20 additions & 16 deletions app/src/main/java/com/devterminal/ui/AiPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
Expand Down Expand Up @@ -73,7 +75,20 @@ fun AiPanelDialog(
onDismiss = onDismiss,
title = "AI 助手",
confirmLabel = "发送",
onConfirm = if (configured && inputDraft.isNotBlank() && !busy) onSend else null
onConfirm = if (configured && inputDraft.isNotBlank() && !busy) onSend else null,
// 输入框固定在底部,不跟正文一起滚动;键盘弹出时始终可见。
footer = {
QuietTextField(
value = inputDraft,
onValueChange = onInputChange,
modifier = Modifier.fillMaxWidth(),
placeholder = if (configured) "问点什么…" else "先在上方完成 AI 配置",
mono = false,
enabled = configured && !busy,
imeAction = ImeAction.Send,
onImeAction = { if (inputDraft.isNotBlank() && !busy) onSend() }
)
},
) {
if (!configured) {
QuietHint(
Expand Down Expand Up @@ -113,16 +128,16 @@ fun AiPanelDialog(
}
}
Spacer(Modifier.height(Dimens.sm))
// 快捷动作:等宽细条,横排等分
// 快捷动作:横向滚动,不强行四等分。
// 320-360dp 手机四等分后每个按钮约 70dp,中文标签会被挤到换行或裁切。
Row(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(Dimens.xs)
) {
QUICK_ACTIONS.forEach { label ->
TextButton(
onClick = { onQuick(label) },
enabled = !busy,
modifier = Modifier.weight(1f)
enabled = !busy
) {
Text(
label,
Expand Down Expand Up @@ -154,17 +169,6 @@ fun AiPanelDialog(
}
}
}
Spacer(Modifier.height(Dimens.sm))
QuietTextField(
value = inputDraft,
onValueChange = onInputChange,
modifier = Modifier.fillMaxWidth(),
placeholder = if (configured) "问点什么…" else "先在上方完成 AI 配置",
mono = false,
enabled = configured && !busy,
imeAction = ImeAction.Send,
onImeAction = { if (inputDraft.isNotBlank() && !busy) onSend() }
)
}
}

Expand Down
24 changes: 23 additions & 1 deletion app/src/main/java/com/devterminal/ui/CodeEditorView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.devterminal.ui

import android.util.TypedValue
import android.view.KeyEvent
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTransformGestures
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -125,8 +127,28 @@ fun CodeEditorView(
// 避免光标被顶起的 IME 或自身滚动条压在屏幕外。
LaunchedEffect(Unit) {
editor.setOnFocusChangeListener { _, hasFocus ->
if (hasFocus) editor.post { runCatching { editor.ensureSelectionVisible() } }
if (hasFocus) {
editor.postDelayed(
{ runCatching { editor.ensureSelectionVisible() } },
60,
)
}
}
}

// 键盘尺寸变化(弹出、收起、切换输入法)时,SoraEditor 的 View 高度会变,
// 但焦点没有重新变化;这里监听 IME inset,再主动把光标滚回可视区。
DisposableEffect(editor) {
ViewCompat.setOnApplyWindowInsetsListener(editor) { _, insets ->
if (insets.isVisible(WindowInsetsCompat.Type.ime())) {
editor.postDelayed(
{ runCatching { editor.ensureSelectionVisible() } },
80,
)
}
insets
}
onDispose { ViewCompat.setOnApplyWindowInsetsListener(editor, null) }
}

// 语法/主题注册表全局只需初始化一次;读 assets 是 IO,放到后台线程
Expand Down
23 changes: 16 additions & 7 deletions app/src/main/java/com/devterminal/ui/CommandPalette.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
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.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -39,7 +40,7 @@ import androidx.compose.ui.text.input.ImeAction
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.devterminal.ui.components.EdgeToEdgeDialog
import com.devterminal.ui.components.QuietHint
import com.devterminal.ui.components.SectionLabel
import com.devterminal.ui.theme.Dimens
Expand Down Expand Up @@ -86,14 +87,17 @@ fun CommandPalette(

LaunchedEffect(Unit) { runCatching { focus.requestFocus() } }

Dialog(onDismissRequest = onDismiss) {
EdgeToEdgeDialog(onDismiss = onDismiss, contentAlignment = Alignment.TopCenter) {
Surface(
modifier = Modifier
.widthIn(max = 560.dp)
.fillMaxWidth()
.heightIn(max = maxHeight),
shape = RoundedCornerShape(24.dp),
color = cs.surface,
// imePadding:软键盘弹起时整个面板随之上推,列表不被键盘遮掉
modifier = Modifier.fillMaxWidth().imePadding()
shadowElevation = 8.dp,
) {
Column(Modifier.padding(top = Dimens.lg, bottom = Dimens.sm)) {
Column(Modifier.fillMaxWidth().padding(top = Dimens.lg, bottom = Dimens.sm)) {
TextField(
value = query,
onValueChange = { query = it },
Expand Down Expand Up @@ -128,7 +132,12 @@ fun CommandPalette(
.height(1.dp)
.background(cs.hairline)
)
LazyColumn(modifier = Modifier.fillMaxWidth().height(340.dp)) {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f, fill = false)
.heightIn(max = 380.dp)
) {
// 最近打开:仅在未输入查询时展示,命中搜索时只显示过滤后的命令
if (query.isBlank() && recent.isNotEmpty()) {
item(key = "hdr_recent") {
Expand Down
Loading
Loading