Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

fix(android): 小本本 keeps the picked tab in view after the card rebuilds

booboosui0e485ec07a16
diff --git a/app/src/main/java/net/kuafuai/andee/ui/NotebookUi.kt b/app/src/main/java/net/kuafuai/andee/ui/NotebookUi.kt
index ef401be..baa9617 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/NotebookUi.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/NotebookUi.kt
@@ -233,13 +233,17 @@ class NotebookUi(
orientation = LinearLayout.HORIZONTAL
setPadding(dp(8), dp(8), dp(8), dp(8))
}
+ var selected: View? = null
TABS.forEachIndexed { i, t ->
if (i > 0) bar.addView(View(context), LinearLayout.LayoutParams(dp(4), 1))
- bar.addView(tabButton(i, lctx.getString(t.label)))
+ bar.addView(tabButton(i, lctx.getString(t.label)).also { if (i == tab) selected = it })
}
return android.widget.HorizontalScrollView(context).apply {
isHorizontalScrollBarEnabled = false
addView(bar)
+ // Picking a tab rebuilds the card, and a new scroll view starts at 0 — which left 记忆 and 待办 cut off at
+ // the edge right after they were tapped. Bring the selected one fully into view once it is laid out.
+ post { selected?.let { v -> if (v.right > scrollX + width || v.left < scrollX) scrollTo((v.right - width + dp(8)).coerceAtLeast(0), 0) } }
}
}