实现拾见像素可爱风界面并记录真机验收

This commit is contained in:
2026-11-27 17:14:40 +08:00
parent c9a74443d8
commit d083c9488b
15 changed files with 1259 additions and 129 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ android {
applicationId = "com.jieliu.app" applicationId = "com.jieliu.app"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 46 versionCode = 47
versionName = "0.1.45" versionName = "0.1.46"
} }
compileOptions { compileOptions {
+135 -48
View File
@@ -9,16 +9,20 @@ import android.content.res.ColorStateList
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.RippleDrawable import android.graphics.drawable.RippleDrawable
import android.graphics.drawable.StateListDrawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.provider.Settings import android.provider.Settings
import android.text.InputType import android.text.InputType
import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.view.ViewGroup
import android.view.WindowInsets import android.view.WindowInsets
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.AdapterView import android.widget.AdapterView
@@ -52,6 +56,14 @@ import java.util.concurrent.FutureTask
class MainActivity : Activity() { class MainActivity : Activity() {
private enum class Tab { TASK, SETTINGS, LOGS } private enum class Tab { TASK, SETTINGS, LOGS }
private enum class ButtonStyle(val fill: Int, val text: Int) {
PRIMARY(R.color.ui_coral, R.color.ui_paper),
SECONDARY(R.color.ui_blue_tint, R.color.ui_blue),
DESTRUCTIVE(R.color.ui_coral_tint, R.color.ui_coral_pressed),
CONFIRM_DESTRUCTIVE(R.color.ui_coral_pressed, R.color.ui_paper),
TAB(R.color.ui_nav_surface, R.color.ui_blue),
SELECTED_TAB(R.color.ui_selected, R.color.ui_blue),
}
private data class TaskView( private data class TaskView(
val checkpoint: TaskCheckpoint?, val connected: Boolean, val step: String?, val notificationsOff: Boolean, val checkpoint: TaskCheckpoint?, val connected: Boolean, val step: String?, val notificationsOff: Boolean,
@@ -110,6 +122,7 @@ class MainActivity : Activity() {
} }
if (Build.VERSION.SDK_INT in 30..34) configureEdgeToEdge() if (Build.VERSION.SDK_INT in 30..34) configureEdgeToEdge()
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
findViewById<ImageView>(R.id.brand_mascot).clipToOutline = true
val root = findViewById<View>(R.id.root) val root = findViewById<View>(R.id.root)
if (Build.VERSION.SDK_INT >= 30) { if (Build.VERSION.SDK_INT >= 30) {
root.setOnApplyWindowInsetsListener { view, insets -> root.setOnApplyWindowInsetsListener { view, insets ->
@@ -234,7 +247,10 @@ class MainActivity : Activity() {
currentFocus?.let { getSystemService(InputMethodManager::class.java).hideSoftInputFromWindow(it.windowToken, 0) } currentFocus?.let { getSystemService(InputMethodManager::class.java).hideSoftInputFromWindow(it.windowToken, 0) }
} }
selected = tab selected = tab
tabs.forEachIndexed { index, button -> styleButton(button, index == selected.ordinal) } tabs.forEachIndexed { index, button ->
button.isSelected = index == selected.ordinal
styleButton(button, if (button.isSelected) ButtonStyle.SELECTED_TAB else ButtonStyle.TAB)
}
taskView = null taskView = null
logVersion = -1 logVersion = -1
content.removeAllViews() content.removeAllViews()
@@ -294,15 +310,16 @@ class MainActivity : Activity() {
else -> "准备运行" else -> "准备运行"
} }
return column().apply { return column().apply {
addView(card(title).apply { addView(card(title, status = true).apply {
val modeLabel = bilibiliScope?.label ?: if (plan.replyMode == ReplyMode.BROWSE) ReplyMode.BROWSE.label else ReplyMode.TEMPLATES.label val modeLabel = bilibiliScope?.label ?: if (plan.replyMode == ReplyMode.BROWSE) ReplyMode.BROWSE.label else ReplyMode.TEMPLATES.label
addView(label("$platform · $modeLabel", 15)) addView(label("$platform · $modeLabel", 15, bold = true))
addView(label(view.step ?: checkpoint?.message ?: "内容类型 ${searchTypes.size} 个 · 单次 ${plan.limit} 个$contentUnit", 15)) addView(label(view.step ?: checkpoint?.message ?: "内容类型 ${searchTypes.size} 个 · 单次 ${plan.limit} 个$contentUnit", 15))
val limit = checkpoint?.plan?.limit ?: plan.limit val limit = checkpoint?.plan?.limit ?: plan.limit
addView(ProgressBar(this@MainActivity, null, android.R.attr.progressBarStyleHorizontal).apply { addView(ProgressBar(this@MainActivity, null, android.R.attr.progressBarStyleHorizontal).apply {
max = limit max = limit
progress = completed progress = completed
progressTintList = ColorStateList.valueOf(GREEN) progressTintList = ColorStateList.valueOf(getColor(R.color.ui_green))
progressBackgroundTintList = ColorStateList.valueOf(getColor(R.color.ui_grass_line))
contentDescription = "已处理 $completed 个$contentUnit,共 $limit 个" contentDescription = "已处理 $completed 个$contentUnit,共 $limit 个"
}, LinearLayout.LayoutParams(-1, dp(18))) }, LinearLayout.LayoutParams(-1, dp(18)))
addView(label("已处理$contentUnit $completed / $limit · $confirmedLabel ${checkpoint?.sentCount ?: 0} 条", 14)) addView(label("已处理$contentUnit $completed / $limit · $confirmedLabel ${checkpoint?.sentCount ?: 0} 条", 14))
@@ -360,22 +377,18 @@ class MainActivity : Activity() {
private fun settingsPage() = column().apply { private fun settingsPage() = column().apply {
addView(guardedPage(::configPage)) addView(guardedPage(::configPage))
addView(card("本机数据").apply { addView(card("本机数据").apply {
addView(action("一键清除所有已保存数据", click = ::confirmClearSavedData).apply { (layoutParams as LinearLayout.LayoutParams).topMargin = dp(12)
setTextColor(ALERT) addView(action("一键清除所有已保存数据", destructive = true, click = ::confirmClearSavedData))
background = RippleDrawable(ColorStateList.valueOf(0x22863c15), rounded(0xffffeee6.toInt(), 12), null)
})
}) })
} }
private fun confirmClearSavedData() { private fun confirmClearSavedData() {
checkSavedDataCanBeCleared() checkSavedDataCanBeCleared()
val dialog = AlertDialog.Builder(this) showDialog(AlertDialog.Builder(this)
.setTitle("清除所有已保存数据?") .setTitle("清除所有已保存数据?")
.setMessage("将清除拾见本机保存的配置、内容库、绑定图片、任务检查点和运行日志。DeepSeek 密钥会保留。清除后恢复默认设置,此操作无法撤销。") .setMessage("将清除拾见本机保存的配置、内容库、绑定图片、任务检查点和运行日志。DeepSeek 密钥会保留。清除后恢复默认设置,此操作无法撤销。")
.setNegativeButton("取消", null) .setNegativeButton("取消", null)
.setPositiveButton("清除数据") { _, _ -> perform(::startSavedDataReset) } .setPositiveButton("清除数据") { _, _ -> perform(::startSavedDataReset) }, destructive = true)
.show()
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ALERT)
} }
private fun checkSavedDataCanBeCleared() { private fun checkSavedDataCanBeCleared() {
@@ -719,7 +732,7 @@ class MainActivity : Activity() {
Triple("移除图片", true, null), Triple("移除图片", true, null),
) )
photoControls.addView(buttonRow(operations.map { (title, available, movedTo) -> photoControls.addView(buttonRow(operations.map { (title, available, movedTo) ->
action(title) { action(title, destructive = movedTo == null) {
val latest = findPhrase(target) ?: return@action val latest = findPhrase(target) ?: return@action
if (latest.photos != entries || photoImport != null) return@action if (latest.photos != entries || photoImport != null) return@action
val reordered = entries.toMutableList() val reordered = entries.toMutableList()
@@ -742,21 +755,38 @@ class MainActivity : Activity() {
private fun logsPage() = column().apply { private fun logsPage() = column().apply {
val lines = store.recentLog() val lines = store.recentLog()
addView(card("运行日志").apply { addView(card("运行日志").apply {
if (lines.isEmpty()) addView(label("启动任务后会在这里显示运行步骤。", 15)) if (lines.isEmpty()) addView(label("启动任务后会在这里显示运行步骤。", 15, color = getColor(R.color.ui_muted)))
lines.forEach { addView(label(it, 14, color = if (" 异常 " in it) ALERT else INK)) } lines.forEach { addView(logEntry(it)) }
}) })
} }
private fun logEntry(line: String) = column().apply {
val warning = " 异常 " in line
val dateEnd = line.indexOf(" ")
val fill = getColor(if (warning) R.color.ui_coral_tint else R.color.ui_grass_tint)
val border = getColor(if (warning) R.color.ui_coral_tint else R.color.ui_grass_line)
val text = getColor(if (warning) R.color.ui_coral_pressed else R.color.ui_ink)
background = rounded(fill, 10, border)
setPadding(dp(10), dp(6), dp(10), dp(6))
layoutParams = LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = dp(7) }
if (dateEnd >= 0) {
addView(label(line.substring(0, dateEnd), 12, color = getColor(R.color.ui_muted)).apply { setPadding(0, 0, 0, 0) })
}
addView(label(line.substring(if (dateEnd >= 0) dateEnd + 2 else 0), 14, color = text).apply { setPadding(0, 0, 0, 0) })
}
private fun photoPreview(photo: TemplatePhoto, index: Int) = column().apply { private fun photoPreview(photo: TemplatePhoto, index: Int) = column().apply {
addView(label("图片 ${index + 1} · ${photo.displayName}", 14)) addView(label("图片 ${index + 1} · ${photo.displayName}", 14))
val bitmap = photos.thumbnail(photo) val bitmap = photos.thumbnail(photo)
if (bitmap == null) { if (bitmap == null) {
addView(label("图片缺失或无法预览。", 14, color = ALERT)) addView(label("图片缺失或无法预览。", 14, color = getColor(R.color.ui_coral_pressed)))
} else { } else {
addView(ImageView(this@MainActivity).apply { addView(ImageView(this@MainActivity).apply {
setImageBitmap(bitmap) setImageBitmap(bitmap)
adjustViewBounds = true adjustViewBounds = true
scaleType = ImageView.ScaleType.FIT_CENTER scaleType = ImageView.ScaleType.FIT_CENTER
background = rounded(getColor(R.color.ui_field), 9, getColor(R.color.ui_line))
clipToOutline = true
contentDescription = "第 ${index + 1} 张图片预览" contentDescription = "第 ${index + 1} 张图片预览"
}, LinearLayout.LayoutParams(dp(96), dp(76))) }, LinearLayout.LayoutParams(dp(96), dp(76)))
} }
@@ -773,7 +803,7 @@ class MainActivity : Activity() {
photoCount > 1 -> "已在目标应用看到这条评论的文字和全部 $photoCount 张图片?" photoCount > 1 -> "已在目标应用看到这条评论的文字和全部 $photoCount 张图片?"
else -> "已在目标应用看到这条评论?" else -> "已在目标应用看到这条评论?"
} }
AlertDialog.Builder(this).setMessage(prompt) showDialog(AlertDialog.Builder(this).setMessage(prompt)
.setNegativeButton("返回", null) .setNegativeButton("返回", null)
.setPositiveButton("确认") { _, _ -> perform { .setPositiveButton("确认") { _, _ -> perform {
check(!TaskControl.inProgress) { "请先暂停任务。" } check(!TaskControl.inProgress) { "请先暂停任务。" }
@@ -788,18 +818,18 @@ class MainActivity : Activity() {
} }
store.appendLog(message) store.appendLog(message)
renderTask() renderTask()
} }.show() } }, destructive = outcome != Outcome.USER_CONFIRMED)
} }
private fun abandon() { private fun abandon() {
AlertDialog.Builder(this).setMessage("放弃当前任务并清空这次的恢复进度?") showDialog(AlertDialog.Builder(this).setMessage("放弃当前任务并清空这次的恢复进度?")
.setNegativeButton("返回", null) .setNegativeButton("返回", null)
.setPositiveButton("放弃") { _, _ -> perform { .setPositiveButton("放弃") { _, _ -> perform {
check(!TaskControl.inProgress && store.readCheckpoint()?.pending == null) { "请先核对待确认的评论。" } check(!TaskControl.inProgress && store.readCheckpoint()?.pending == null) { "请先核对待确认的评论。" }
store.clearCheckpoint() store.clearCheckpoint()
store.appendLog("用户放弃了当前任务") store.appendLog("用户放弃了当前任务")
renderTask() renderTask()
} }.show() } }, destructive = true)
} }
private fun column() = LinearLayout(this).apply { private fun column() = LinearLayout(this).apply {
@@ -807,14 +837,30 @@ class MainActivity : Activity() {
isFocusableInTouchMode = true isFocusableInTouchMode = true
} }
private fun card(title: String) = column().apply { private fun card(title: String, status: Boolean = false) = column().apply {
background = rounded(Color.WHITE, 18) val fill = getColor(if (status) R.color.ui_grass_card else R.color.ui_paper)
val border = getColor(if (status) R.color.ui_grass_line else R.color.ui_line)
val marker = getColor(if (status) R.color.ui_marker_green else R.color.ui_marker_blue)
background = rounded(fill, 19, border)
elevation = dp(1).toFloat()
setPadding(dp(16), dp(12), dp(16), dp(14)) setPadding(dp(16), dp(12), dp(16), dp(14))
layoutParams = LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = dp(12) } layoutParams = LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = dp(12) }
addView(label(title, 19, bold = true)) addView(LinearLayout(this@MainActivity).apply {
gravity = Gravity.CENTER_VERTICAL
addView(View(this@MainActivity).apply {
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
background = LayerDrawable(arrayOf(rounded(border, 0), rounded(marker, 0))).apply {
setLayerInset(0, dp(3), dp(3), 0, 0)
setLayerInset(1, 0, 0, dp(3), dp(3))
}
}, LinearLayout.LayoutParams(dp(10), dp(10)).apply { marginEnd = dp(9) })
addView(label(title, 18, bold = true, color = getColor(if (status) R.color.ui_green else R.color.ui_ink)).apply {
if (Build.VERSION.SDK_INT >= 28) isAccessibilityHeading = true
}, LinearLayout.LayoutParams(0, -2, 1f))
})
} }
private fun label(text: String, size: Int, bold: Boolean = false, color: Int = INK) = TextView(this).apply { private fun label(text: String, size: Int, bold: Boolean = false, color: Int = getColor(R.color.ui_ink)) = TextView(this).apply {
this.text = text this.text = text
textSize = size.toFloat() textSize = size.toFloat()
setTextColor(color) setTextColor(color)
@@ -826,10 +872,21 @@ class MainActivity : Activity() {
adapter = choiceAdapter(values) adapter = choiceAdapter(values)
setSelection(selected) setSelection(selected)
minimumHeight = dp(48) minimumHeight = dp(48)
setBackgroundResource(R.drawable.ui_dropdown)
setPaddingRelative(dp(12), 0, dp(34), 0)
setPopupBackgroundDrawable(rounded(getColor(R.color.ui_paper), 12, getColor(R.color.ui_line)))
} }
private fun choiceAdapter(values: List<String>) = ArrayAdapter(this, android.R.layout.simple_spinner_item, values).apply { private fun choiceAdapter(values: List<String>) = object : ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, values) {
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) init { setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) }
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View =
(super.getView(position, convertView, parent) as TextView).apply {
setTextColor(getColor(R.color.ui_ink))
textSize = 15f
ellipsize = TextUtils.TruncateAt.END
maxLines = 1
}
} }
private fun libraryChoices(entries: List<Pair<String, String>>, selectedId: String?, placeholder: String, select: (String) -> Unit): Spinner = private fun libraryChoices(entries: List<Pair<String, String>>, selectedId: String?, placeholder: String, select: (String) -> Unit): Spinner =
@@ -851,15 +908,17 @@ class MainActivity : Activity() {
contentDescription = "编辑$entity" contentDescription = "编辑$entity"
applyEnabled(hasSelection) applyEnabled(hasSelection)
}, },
action("删除", click = delete).apply { action("删除", destructive = true, click = delete).apply {
contentDescription = "删除$entity" contentDescription = "删除$entity"
applyEnabled(hasSelection) applyEnabled(hasSelection)
}, },
)) ))
private fun buttonRow(buttons: List<Button>) = LinearLayout(this).apply { private fun buttonRow(buttons: List<Button>) = LinearLayout(this).apply {
buttons.forEach { button -> buttons.forEachIndexed { index, button ->
addView(button, LinearLayout.LayoutParams(0, -2, 1f).apply { marginEnd = dp(4) }) addView(button, LinearLayout.LayoutParams(0, -2, 1f).apply {
if (index < buttons.lastIndex) marginEnd = dp(5)
})
} }
} }
@@ -869,8 +928,8 @@ class MainActivity : Activity() {
setPadding(dp(20), dp(12), dp(20), 0) setPadding(dp(20), dp(12), dp(20), 0)
addView(input, LinearLayout.LayoutParams(-1, -2)) addView(input, LinearLayout.LayoutParams(-1, -2))
} }
val dialog = AlertDialog.Builder(this).setTitle(title).setView(fields) val dialog = showDialog(AlertDialog.Builder(this).setTitle(title).setView(fields)
.setNegativeButton("取消", null).setPositiveButton("完成", null).show() .setNegativeButton("取消", null).setPositiveButton("完成", null))
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
perform { perform {
val text = input.value() val text = input.value()
@@ -883,8 +942,23 @@ class MainActivity : Activity() {
} }
private fun confirmDelete(prompt: String, delete: () -> Unit) { private fun confirmDelete(prompt: String, delete: () -> Unit) {
AlertDialog.Builder(this).setMessage(prompt).setNegativeButton("取消", null) showDialog(AlertDialog.Builder(this).setMessage(prompt).setNegativeButton("取消", null)
.setPositiveButton("删除") { _, _ -> perform(delete) }.show() .setPositiveButton("删除") { _, _ -> perform(delete) }, destructive = true)
}
private fun showDialog(builder: AlertDialog.Builder, destructive: Boolean = false): AlertDialog = builder.show().apply {
window?.setBackgroundDrawable(rounded(getColor(R.color.ui_paper), 23, getColor(R.color.ui_coral_tint)))
findViewById<TextView>(android.R.id.message)?.setTextColor(getColor(R.color.ui_ink))
getButton(AlertDialog.BUTTON_NEGATIVE)?.let { button ->
styleButton(button, ButtonStyle.SECONDARY)
(button.layoutParams as? ViewGroup.MarginLayoutParams)?.marginEnd = dp(8)
}
getButton(AlertDialog.BUTTON_POSITIVE)?.let { button ->
styleButton(button, if (destructive) ButtonStyle.CONFIRM_DESTRUCTIVE else ButtonStyle.PRIMARY)
(button.parent as? View)?.let { row ->
row.setPaddingRelative(row.paddingStart, row.paddingTop, row.paddingEnd, row.paddingBottom + dp(8))
}
}
} }
private fun field(value: String, hint: String, multiline: Boolean = false, number: Boolean = false) = EditText(this).apply { private fun field(value: String, hint: String, multiline: Boolean = false, number: Boolean = false) = EditText(this).apply {
@@ -898,10 +972,15 @@ class MainActivity : Activity() {
setText(value) setText(value)
this.hint = hint this.hint = hint
textSize = 15f textSize = 15f
setTextColor(INK) setTextColor(getColor(R.color.ui_ink))
setHintTextColor(getColor(R.color.ui_muted))
setPadding(dp(12), dp(9), dp(12), dp(9)) setPadding(dp(12), dp(9), dp(12), dp(9))
minimumHeight = dp(46) minimumHeight = dp(48)
background = rounded(SURFACE, 9) background = StateListDrawable().apply {
val fill = getColor(R.color.ui_field)
addState(intArrayOf(android.R.attr.state_focused), rounded(fill, 12, getColor(R.color.ui_blue)))
addState(intArrayOf(), rounded(fill, 12, getColor(R.color.ui_line)))
}
} }
private fun LinearLayout.addField(title: String, field: View): TextView { private fun LinearLayout.addField(title: String, field: View): TextView {
@@ -921,30 +1000,43 @@ class MainActivity : Activity() {
}, LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = dp(8) }) }, LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = dp(8) })
} }
private fun action(title: String, primary: Boolean = false, click: () -> Unit) = Button(this).apply { private fun action(title: String, primary: Boolean = false, destructive: Boolean = false, click: () -> Unit) = Button(this).apply {
text = title text = title
layoutParams = LinearLayout.LayoutParams(-1, -2).apply { topMargin = dp(7) } layoutParams = LinearLayout.LayoutParams(-1, -2).apply { topMargin = dp(7) }
styleButton(this, primary) styleButton(this, when {
destructive -> ButtonStyle.DESTRUCTIVE
primary -> ButtonStyle.PRIMARY
else -> ButtonStyle.SECONDARY
})
setOnClickListener { perform(click) } setOnClickListener { perform(click) }
} }
private fun styleButton(button: Button, primary: Boolean) = with(button) { private fun styleButton(button: Button, style: ButtonStyle) = with(button) {
isAllCaps = false isAllCaps = false
textSize = 15f textSize = 15f
setTextColor(if (primary) Color.WHITE else GREEN) setTypeface(typeface, Typeface.BOLD)
val disabled = intArrayOf(-android.R.attr.state_enabled)
setTextColor(ColorStateList(arrayOf(disabled, intArrayOf()), intArrayOf(getColor(R.color.ui_muted), getColor(style.text))))
minHeight = dp(48) minHeight = dp(48)
setPaddingRelative(dp(8), dp(7), dp(8), dp(7))
stateListAnimator = null stateListAnimator = null
background = RippleDrawable(ColorStateList.valueOf(0x220b412c), rounded(if (primary) GREEN else TINT, 12), null) val surface = StateListDrawable().apply {
addState(disabled, rounded(getColor(R.color.ui_disabled), 13))
addState(intArrayOf(), rounded(getColor(style.fill), 13))
}
val filledCoral = style == ButtonStyle.PRIMARY || style == ButtonStyle.CONFIRM_DESTRUCTIVE
val ripple = if (filledCoral) 0x30ffffff else 0x2431588f
background = RippleDrawable(ColorStateList.valueOf(ripple), surface, null)
} }
private fun View.applyEnabled(enabled: Boolean) { private fun View.applyEnabled(enabled: Boolean) {
isEnabled = enabled isEnabled = enabled
alpha = if (enabled) 1f else .48f
} }
private fun rounded(color: Int, radius: Int) = GradientDrawable().apply { private fun rounded(color: Int, radius: Int, stroke: Int = Color.TRANSPARENT) = GradientDrawable().apply {
setColor(color) setColor(color)
cornerRadius = dp(radius).toFloat() cornerRadius = dp(radius).toFloat()
if (stroke != Color.TRANSPARENT) setStroke(dp(1), stroke)
} }
private fun needsNotificationPermission() = Build.VERSION.SDK_INT >= 33 && private fun needsNotificationPermission() = Build.VERSION.SDK_INT >= 33 &&
@@ -977,10 +1069,5 @@ class MainActivity : Activity() {
private companion object { private companion object {
const val PICK_TEMPLATE_PHOTO = 32 const val PICK_TEMPLATE_PHOTO = 32
val INK = Color.rgb(23, 42, 36)
val GREEN = Color.rgb(7, 108, 83)
val SURFACE = Color.rgb(243, 245, 240)
val TINT = Color.rgb(229, 240, 232)
val ALERT = Color.rgb(134, 60, 21)
} }
} }
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#2231588F">
<item>
<layer-list>
<item>
<shape>
<solid android:color="@color/ui_field" />
<corners android:radius="12dp" />
<stroke android:width="1dp" android:color="@color/ui_line" />
</shape>
</item>
<item
android:drawable="@drawable/ui_dropdown_arrow"
android:end="13dp"
android:gravity="end|center_vertical"
android:height="6dp"
android:width="10dp" />
</layer-list>
</item>
</ripple>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="10dp"
android:height="6dp"
android:viewportWidth="10"
android:viewportHeight="6">
<path android:fillColor="@color/ui_blue" android:pathData="M0,1h10L5,6z" />
</vector>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="315" android:startColor="#FFF3F5" android:endColor="@color/ui_coral_tint" />
<corners android:radius="20dp" />
<stroke android:width="1dp" android:color="#F5CED7" />
</shape>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="36dp"
android:height="28dp"
android:viewportWidth="36"
android:viewportHeight="28">
<path android:fillColor="#E49AAB" android:pathData="M6,8h5v5h5v5h-5v5H6v-5H1v-5h5z" />
<path android:fillColor="#88AEE0" android:pathData="M21,2h5v5h-5z" />
<path android:fillColor="#A7CDA9" android:pathData="M30,22h5v5h-5z" />
</vector>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/launcher_sky" />
<corners android:radius="12dp" />
</shape>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/ui_nav_surface" />
<item
android:height="1dp"
android:gravity="top"
android:drawable="@color/ui_line" />
</layer-list>
+49 -15
View File
@@ -5,18 +5,51 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<TextView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="22dp" android:layout_marginStart="14dp"
android:paddingTop="12dp" android:layout_marginTop="10dp"
android:paddingEnd="22dp" android:layout_marginEnd="14dp"
android:paddingBottom="6dp" android:layout_marginBottom="8dp"
android:background="@drawable/ui_header"
android:gravity="center_vertical"
android:minHeight="76dp"
android:orientation="horizontal"
android:paddingStart="13dp"
android:paddingTop="11dp"
android:paddingEnd="13dp"
android:paddingBottom="11dp">
<ImageView
android:id="@+id/brand_mascot"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/ui_mascot_thumbnail"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/launcher_artwork" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_weight="1"
android:text="@string/app_name" android:text="@string/app_name"
android:textColor="#172A24" android:textColor="@color/ui_ink"
android:textSize="30sp" android:textSize="27sp"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView
android:layout_width="36dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:src="@drawable/ui_header_pixels" />
</LinearLayout>
<ScrollView <ScrollView
android:id="@+id/page_scroll" android:id="@+id/page_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -24,10 +57,10 @@
android:layout_weight="1" android:layout_weight="1"
android:clipToPadding="false" android:clipToPadding="false"
android:fillViewport="true" android:fillViewport="true"
android:paddingStart="20dp" android:paddingStart="14dp"
android:paddingTop="6dp" android:paddingTop="4dp"
android:paddingEnd="20dp" android:paddingEnd="14dp"
android:paddingBottom="8dp"> android:paddingBottom="12dp">
<FrameLayout <FrameLayout
android:id="@+id/page_content" android:id="@+id/page_content"
@@ -39,11 +72,12 @@
style="?android:attr/buttonBarStyle" style="?android:attr/buttonBarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/ui_navigation"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="18dp" android:paddingStart="14dp"
android:paddingTop="6dp" android:paddingTop="8dp"
android:paddingEnd="18dp" android:paddingEnd="14dp"
android:paddingBottom="7dp"> android:paddingBottom="8dp">
<Button <Button
android:id="@+id/tab_task" android:id="@+id/tab_task"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.Shijian" parent="Theme.Shijian.Base"> <style name="Theme.Shijian" parent="Theme.Shijian.Base">
<item name="android:navigationBarColor">#F3F5F0</item> <item name="android:navigationBarColor">@color/ui_nav_surface</item>
<item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightNavigationBar">true</item>
</style> </style>
</resources> </resources>
+20
View File
@@ -1,4 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="launcher_sky">#7BABF8</color> <color name="launcher_sky">#7BABF8</color>
<color name="ui_ink">#25354E</color>
<color name="ui_muted">#50627C</color>
<color name="ui_screen">#EDF5FF</color>
<color name="ui_paper">#FFFFFF</color>
<color name="ui_line">#CCDDF5</color>
<color name="ui_blue">#31588F</color>
<color name="ui_blue_tint">#E7F0FF</color>
<color name="ui_field">#F3F8FF</color>
<color name="ui_selected">#DCE9FE</color>
<color name="ui_disabled">#E2EBF8</color>
<color name="ui_nav_surface">#F6FAFF</color>
<color name="ui_marker_blue">#82ADE6</color>
<color name="ui_coral">#B64154</color>
<color name="ui_coral_pressed">#9D354B</color>
<color name="ui_coral_tint">#FFE8EC</color>
<color name="ui_green">#267252</color>
<color name="ui_grass_tint">#E9F7EB</color>
<color name="ui_grass_line">#CDE7D3</color>
<color name="ui_marker_green">#77AF86</color>
<color name="ui_grass_card">#F6FCF7</color>
</resources> </resources>
+14 -4
View File
@@ -2,12 +2,22 @@
<resources> <resources>
<style name="Theme.Shijian.Base" parent="android:style/Theme.Material.Light.NoActionBar"> <style name="Theme.Shijian.Base" parent="android:style/Theme.Material.Light.NoActionBar">
<item name="android:fontFamily">sans</item> <item name="android:fontFamily">sans</item>
<item name="android:colorAccent">#076C53</item> <item name="android:colorAccent">@color/ui_coral</item>
<item name="android:windowBackground">#F3F5F0</item> <item name="android:colorControlNormal">@color/ui_blue</item>
<item name="android:statusBarColor">#F3F5F0</item> <item name="android:textColorPrimary">@color/ui_ink</item>
<item name="android:navigationBarColor">#172A24</item> <item name="android:textColorSecondary">@color/ui_muted</item>
<item name="android:windowBackground">@color/ui_screen</item>
<item name="android:statusBarColor">@color/ui_screen</item>
<item name="android:navigationBarColor">@color/ui_ink</item>
<item name="android:windowLightStatusBar">true</item> <item name="android:windowLightStatusBar">true</item>
<item name="android:windowActionModeOverlay">true</item> <item name="android:windowActionModeOverlay">true</item>
<item name="android:alertDialogTheme">@style/Theme.Shijian.Dialog</item>
</style> </style>
<style name="Theme.Shijian" parent="Theme.Shijian.Base" /> <style name="Theme.Shijian" parent="Theme.Shijian.Base" />
<style name="Theme.Shijian.Dialog" parent="android:style/Theme.Material.Light.Dialog.Alert">
<item name="android:colorAccent">@color/ui_coral</item>
<item name="android:colorControlNormal">@color/ui_blue</item>
<item name="android:textColorPrimary">@color/ui_ink</item>
<item name="android:textColorSecondary">@color/ui_muted</item>
</style>
</resources> </resources>
+844
View File
@@ -0,0 +1,844 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<link rel="icon" href="../app/src/main/res/drawable-nodpi/launcher_artwork.jpg" type="image/jpeg">
<title>拾见 · 像素风界面提案</title>
<style>
:root {
--ink: #25354e;
--muted: #50627c;
--screen: #edf5ff;
--paper: #fff;
--line: #ccddf5;
--blue: #31588f;
--blue-tint: #e7f0ff;
--coral: #b64154;
--coral-pressed: #9d354b;
--coral-tint: #ffe8ec;
--green: #267252;
--grass-tint: #e9f7eb;
--launcher-art: url('../app/src/main/res/drawable-nodpi/launcher_artwork.jpg');
font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
color: var(--ink);
background: #f4f8ff;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: radial-gradient(ellipse at 9% 0%, #e3eeff 0, transparent 480px),
radial-gradient(ellipse at 90% 0%, #ffedf1 0, transparent 430px);
}
a { color: inherit; }
a:focus-visible, [tabindex]:focus-visible {
outline: 2px solid var(--blue);
outline-offset: 3px;
}
.preview {
max-width: 1312px;
margin-inline: auto;
padding: 42px clamp(20px, 4vw, 56px) 48px;
}
.preview-header {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 32px;
}
.mark {
display: block;
flex: 0 0 52px;
width: 52px;
height: 52px;
border-radius: 14px;
object-fit: cover;
box-shadow: 0 2px 0 #b8cee8, 0 6px 14px #31588f1c;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 740; line-height: 1.15; }
.preview-header p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.screen-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: clamp(16px, 2.15vw, 30px);
align-items: start;
}
.screen-figure {
display: grid;
gap: 9px;
margin: 0;
min-width: 0;
scroll-margin-top: 18px;
}
.screen-figure figcaption { padding-inline: 8px; color: var(--blue); font-size: 15px; font-weight: 700; }
.screen-figure:target .phone { border-color: #96b4e0; }
.phone {
display: grid;
grid-template-rows: auto minmax(0, 1fr) auto;
min-width: 0;
height: 735px;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 28px;
background: var(--screen);
box-shadow: 0 3px 0 #dbe8fa, 0 14px 28px #31588f16;
}
.app-name {
position: relative;
display: flex;
align-items: center;
gap: 12px;
margin: 14px 14px 8px;
min-height: 76px;
padding: 11px 13px;
border: 1px solid #f5ced7;
border-radius: 20px;
background: linear-gradient(108deg, #fff3f5, var(--coral-tint));
color: var(--ink);
font-size: 27px;
font-weight: 740;
line-height: 1.2;
}
.app-name::before {
content: '';
flex: 0 0 48px;
height: 48px;
border-radius: 12px;
background: #7babf8 var(--launcher-art) center / cover;
box-shadow: 0 2px 0 #eac2d1;
}
.app-name::after {
content: '';
position: absolute;
inset: 29px 34px auto auto;
width: 5px;
height: 5px;
background: #e49aab;
box-shadow: -5px 5px #e49aab, 0 5px #e49aab, 5px 5px #e49aab, 0 10px #e49aab,
15px -6px #88aee0, 24px 14px #a7cda9;
pointer-events: none;
}
.phone-content {
overflow: auto;
padding: 4px 14px 12px;
scrollbar-color: #afc6e7 transparent;
scrollbar-width: thin;
}
.card {
margin-bottom: 12px;
padding: 14px 15px 15px;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--paper);
box-shadow: 0 2px 0 #dce9fa;
}
.card h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; font-size: 18px; line-height: 1.45; }
.card h3::before { content: ''; width: 7px; height: 7px; flex: 0 0 7px; background: #82ade6; box-shadow: 3px 3px #cedff7; }
.task-state { border-color: #cde7d3; background: #f6fcf7; box-shadow: 0 2px 0 #deeddf; }
.task-state h3 { color: var(--green); }
.task-state h3::before { background: #77af86; box-shadow: 3px 3px #c8e5ce; }
.card p { margin-top: 6px; font-size: 14px; }
.card .mode { font-size: 15px; font-weight: 650; }
.hint, .summary { color: var(--muted); }
.phone-content > details.card { margin-top: 12px; }
summary { color: var(--blue); font-weight: 650; cursor: pointer; }
progress {
display: block;
width: 100%;
height: 7px;
margin: 12px 0 8px;
appearance: none;
overflow: hidden;
border: 0;
border-radius: 4px;
background: #dcefe0;
}
progress::-webkit-progress-bar { background: #dcefe0; }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
.action, .app-nav a {
display: grid;
place-items: center;
min-height: 46px;
padding: 6px 10px;
border-radius: 12px;
background: var(--blue-tint);
color: var(--blue);
font-size: 15px;
font-weight: 650;
text-align: center;
text-decoration: none;
}
.action {
width: 100%;
margin-top: 7px;
}
[hidden] { display: none !important; }
button.action { border: 0; cursor: pointer; font-family: inherit; }
.action:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.action:disabled { color: #63758e; background: #edf2fa; cursor: default; }
#photo-items { display: grid; gap: 10px; margin-top: 8px; }
.photo-item { padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #f6f9ff; }
.photo-item img { display: block; width: 96px; height: 76px; margin-top: 5px; border-radius: 7px; object-fit: contain; }
.library-actions, .photo-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.library-level { margin-top: 14px; }
.library-level label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; }
#photo-binding { margin-top: 14px; }
dialog {
width: min(390px, calc(100% - 32px));
padding: 20px;
border: 1px solid #f1cad3;
border-radius: 22px;
background: var(--paper);
color: var(--ink);
box-shadow: 0 8px 32px #293b6560, inset 0 5px var(--coral-tint);
}
dialog::backdrop { background: #26355470; }
dialog h2 { margin-bottom: 12px; font-size: 20px; }
dialog .library-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
#library-status { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
#library-error, #library-status.error { color: var(--coral-pressed); font-size: 14px; }
.action.primary {
color: #fff;
background: var(--coral);
}
button.action.primary:hover { background: var(--coral-pressed); }
.action.danger { color: var(--coral-pressed); background: var(--coral-tint); }
.action.primary.danger { color: #fff; background: var(--coral-pressed); }
.action[aria-disabled="true"] {
color: #63758e;
background: #e3ecf9;
}
.app-nav {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 6px;
padding: 8px 14px 11px;
border-top: 1px solid var(--line);
background: #f8fbff;
}
.app-nav a { color: var(--muted); background: transparent; }
.app-nav [aria-current="page"] { background: #dceaff; color: var(--blue); }
.app-nav a:hover { box-shadow: inset 0 0 0 1px var(--line); }
.fields {
display: grid;
gap: 10px;
margin: 7px 0 0;
}
.fields dt { margin-bottom: 3px; font-size: 14px; font-weight: 700; }
.fields dd { margin: 0; }
.control {
display: flex;
align-items: center;
min-height: 44px;
padding: 8px 11px;
border: 1px solid var(--line);
border-radius: 11px;
background: #f6f9ff;
font-size: 15px;
overflow-wrap: anywhere;
}
.select { justify-content: space-between; gap: 9px; }
.select::after {
content: "";
width: 7px;
height: 7px;
flex: 0 0 7px;
margin: -4px 2px 0 0;
transform: rotate(45deg);
border-right: 1.5px solid currentColor;
border-bottom: 1.5px solid currentColor;
}
.multiline { min-height: 60px; align-items: start; }
.settings-input {
display: block;
width: 100%;
color: inherit;
font: inherit;
font-size: 15px;
}
.settings-input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.settings-input:disabled { color: #63758e; background: #edf2fa; }
select.settings-input {
appearance: none;
padding-right: 28px;
background-image: linear-gradient(45deg, transparent 50%, #6984a9 50%), linear-gradient(135deg, #6984a9 50%, transparent 50%);
background-position: right 15px center, right 10px center;
background-size: 5px 5px;
background-repeat: no-repeat;
}
textarea.settings-input { resize: vertical; }
.range {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 8px;
font-size: 14px;
}
code { font-size: .92em; overflow-wrap: anywhere; }
.entries {
display: grid;
gap: 7px;
margin: 8px 0 0;
padding: 0;
list-style: none;
font-size: 14px;
overflow-wrap: anywhere;
}
.entries li { padding: 7px 9px; border-left: 3px solid #b9d8c3; border-radius: 8px; background: var(--grass-tint); }
.entries time { display: block; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; white-space: nowrap; }
.entries .warning { border-color: #e8aebc; color: var(--coral-pressed); background: var(--coral-tint); }
@media (max-width: 970px) {
.screen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 610px) {
.preview { max-width: 442px; padding-top: 25px; }
.preview-header { gap: 12px; margin-bottom: 22px; }
.mark { flex-basis: 44px; width: 44px; height: 44px; border-radius: 12px; }
.screen-grid { grid-template-columns: 1fr; gap: 26px; }
.phone { height: min(735px, max(530px, 80svh)); }
}
@media print {
:root { background: #fff; }
.preview { padding: 0; }
.screen-grid { display: block; }
.screen-figure { margin-bottom: 20px; }
.phone { height: auto; overflow: visible; box-shadow: none; }
.phone-content { overflow: visible; }
.card { break-inside: avoid; border: 1px solid var(--line); }
}
</style>
</head>
<body>
<main class="preview">
<header class="preview-header">
<img class="mark" src="../app/src/main/res/drawable-nodpi/launcher_artwork.jpg" width="52" height="52" alt="">
<div>
<h1>拾见 · 像素风界面提案</h1>
<p>离线预览,可编辑内容库并试用图片绑定。修改仅在本页保留。</p>
</div>
</header>
<div class="screen-grid">
<figure class="screen-figure" id="task">
<figcaption>任务</figcaption>
<section class="phone" aria-label="拾见任务页">
<h2 class="app-name">拾见</h2>
<div class="phone-content">
<div class="card task-state">
<h3>准备运行</h3>
<p class="mode" id="task-mode">抖音 · 仅浏览</p>
<p id="task-scope">内容类型 1 个 · 单次 3 个视频</p>
<progress id="task-progress" value="0" max="3" aria-label="已处理 0 个视频,共 3 个"></progress>
<p class="summary" id="task-summary">已处理视频 0 / 3 · 已确认回复 0 条</p>
<p id="task-content-type">内容类型 · 模型服务</p>
</div>
<div class="card">
<h3>无障碍服务未连接</h3>
<p>在系统设置中开启「拾见任务服务」,然后返回这里。</p>
<span class="action primary">打开无障碍设置</span>
</div>
<span class="action primary" aria-disabled="true">开始任务</span>
<span class="action">启用通知栏暂停按钮</span>
<details class="card" id="pending-receipt-preview">
<summary>等待核对状态</summary>
<p>到抖音核对这条评论</p>
<span class="action primary">自动核对回复</span>
<span class="action primary">确认已发送</span>
<span class="action">跳过此回复</span>
</details>
</div>
<nav class="app-nav" aria-label="任务页导航">
<a href="#task" aria-current="page">任务</a>
<a href="#settings">配置</a>
<a href="#logs">日志</a>
</nav>
</section>
</figure>
<figure class="screen-figure" id="settings">
<figcaption>配置</figcaption>
<section class="phone" aria-label="拾见配置页">
<h2 class="app-name">拾见</h2>
<div class="phone-content" tabindex="0" role="region" aria-label="可滚动的配置预览">
<div class="card">
<h3>任务范围</h3>
<dl class="fields">
<div>
<dt><label for="target-platform">平台</label></dt>
<dd><select id="target-platform" class="control settings-input">
<option value="douyin" data-unit="视频">抖音</option>
<option value="xiaohongshu" data-unit="笔记">小红书</option>
<option value="bilibili" data-unit="视频">哔哩哔哩</option>
<option value="kuaishou" data-unit="作品">快手</option>
</select></dd>
</div>
<div><dt><label for="search-scope">搜索范围</label></dt><dd><select id="search-scope" class="control settings-input"></select></dd></div>
<div><dt><label id="content-limit-label" for="video-limit">单次任务视频上限</label></dt><dd><input id="video-limit" class="control settings-input" type="number" inputmode="numeric" min="1" max="100" value="3" required></dd></div>
</dl>
</div>
<div class="card">
<h3>动作节奏</h3>
<dl class="fields">
<div>
<dt>观看时长(秒)</dt>
<dd class="range"><span class="control">5</span><span>至</span><span class="control">12</span></dd>
</div>
<div>
<dt>动作间隔(毫秒)</dt>
<dd class="range"><span class="control">600</span><span>至</span><span class="control">1800</span></dd>
</div>
</dl>
</div>
<div class="card">
<h3>评论设置</h3>
<dl class="fields">
<div>
<dt><label for="reply-mode">处理方式</label></dt>
<dd><select id="reply-mode" class="control settings-input">
<option>仅浏览</option>
<option>匹配评论并回复</option>
</select></dd>
</div>
<div id="bilibili-comment-scope-field" hidden>
<dt><label for="bilibili-comment-scope">评论发布位置</label></dt>
<dd>
<select id="bilibili-comment-scope" class="control settings-input" aria-describedby="bilibili-comment-scope-hint">
<option value="REPLY_TO_ORIGINAL">回复原评论(仅文字)</option>
<option value="VIDEO_COMMENT">发布视频评论(可带图片)</option>
</select>
<p class="hint" id="bilibili-comment-scope-hint">将话术作为文字回复发到命中的原评论下。已绑定的图片会保留。</p>
</dd>
</div>
<div><dt><label id="reply-limit-label" for="replies-per-video">每条视频回复上限</label></dt><dd><input id="replies-per-video" class="control settings-input" type="number" inputmode="numeric" min="1" max="100" value="1" required></dd></div>
</dl>
<p class="hint" id="reply-scope-hint">达到回复上限或找不到更多匹配评论时,进入下一个视频。</p>
</div>
<div class="card" id="content-library">
<h3>内容库</h3>
<p class="hint" id="content-scope-hint">按内容类型搜索视频,按关键词匹配评论。每个关键词可配置多条话术。</p>
<div class="library-level" id="type-level">
<label for="content-type">内容类型</label>
<select id="content-type" class="control settings-input"></select>
<div class="library-actions">
<button type="button" class="action" data-level="type" data-action="add" aria-label="新增内容类型">新增</button>
<button type="button" class="action" data-level="type" data-action="edit" aria-label="编辑内容类型">编辑</button>
<button type="button" class="action" data-level="type" data-action="delete" aria-label="删除内容类型">删除</button>
</div>
</div>
<div class="library-level" id="rule-level">
<label for="keyword-rule">关键词</label>
<select id="keyword-rule" class="control settings-input"></select>
<div class="library-actions">
<button type="button" class="action" data-level="rule" data-action="add" aria-label="新增关键词">新增</button>
<button type="button" class="action" data-level="rule" data-action="edit" aria-label="编辑关键词">编辑</button>
<button type="button" class="action" data-level="rule" data-action="delete" aria-label="删除关键词">删除</button>
</div>
</div>
<div class="library-level" id="phrase-level">
<label for="reply-phrase">回复话术</label>
<select id="reply-phrase" class="control settings-input"></select>
<div class="library-actions">
<button type="button" class="action" data-level="phrase" data-action="add" aria-label="新增话术">新增</button>
<button type="button" class="action" data-level="phrase" data-action="edit" aria-label="编辑话术">编辑</button>
<button type="button" class="action" data-level="phrase" data-action="delete" aria-label="删除话术">删除</button>
</div>
</div>
<div id="photo-binding" hidden>
<p id="photo-count" class="hint"></p>
<div id="photo-items"></div>
<input id="template-photo" type="file" accept="image/jpeg,image/png" multiple hidden>
<button id="photo-choose" type="button" class="action">添加本机图片</button>
<p id="photo-status" class="hint" role="status" hidden></p>
<p class="hint">支持 JPEG 和 PNG。修改名称、关键词或话术时,保留已绑定图片。</p>
</div>
</div>
<button type="button" class="action primary" id="save-preview">保存配置</button>
<div class="card" style="margin-top: 12px">
<h3>本机数据</h3>
<button type="button" class="action danger" id="reset-preview">一键清除所有已保存数据</button>
</div>
<p id="library-status" role="status" hidden></p>
</div>
<nav class="app-nav" aria-label="配置页导航">
<a href="#task">任务</a>
<a href="#settings" aria-current="page">配置</a>
<a href="#logs">日志</a>
</nav>
</section>
</figure>
<figure class="screen-figure" id="logs">
<figcaption>日志</figcaption>
<section class="phone" aria-label="拾见日志页">
<h2 class="app-name">拾见</h2>
<div class="phone-content">
<div class="card">
<h3>运行日志</h3>
<p id="empty-log" hidden>启动任务后会在这里显示运行步骤。</p>
<ul class="entries" id="log-entries">
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 任务完成 · 处理 1 条 · 确认发送 1 条</li>
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 第 1 条视频已确认 1/1 条回复</li>
<li class="warning"><time datetime="2026-11-25T15:22:14+08:00">11-25 15:22:14</time> 异常 抖音评论未回读到完整内容或未看到唯一发送按钮</li>
<li><time datetime="2026-11-25T15:22:01+08:00">11-25 15:22:01</time> 运行 搜索内容类型 模型服务</li>
<li><time datetime="2026-11-25T15:22:00+08:00">11-25 15:22:00</time> 运行 开始任务 · 匹配评论并回复 · 上限 3 条</li>
<li><time datetime="2026-11-25T15:19:09+08:00">11-25 15:19:09</time> 运行 任务完成 · 处理 3 条 · 确认发送 0 条</li>
<li><time datetime="2026-11-25T15:19:02+08:00">11-25 15:19:02</time> 运行 观看第 3 条 · 7 秒</li>
<li><time datetime="2026-11-25T15:18:47+08:00">11-25 15:18:47</time> 运行 观看第 2 条 · 11 秒</li>
<li><time datetime="2026-11-25T15:18:37+08:00">11-25 15:18:37</time> 运行 观看第 1 条 · 8 秒</li>
</ul>
</div>
</div>
<nav class="app-nav" aria-label="日志页导航">
<a href="#task">任务</a>
<a href="#settings">配置</a>
<a href="#logs" aria-current="page">日志</a>
</nav>
</section>
</figure>
</div>
</main>
<dialog id="library-editor" aria-labelledby="editor-title">
<form id="library-form">
<h2 id="editor-title"></h2>
<input id="library-value" class="control settings-input" autocomplete="off">
<textarea id="library-phrase-text" class="control multiline settings-input" rows="3" autocomplete="off" hidden></textarea>
<p id="library-error" role="alert" hidden></p>
<div class="library-actions">
<button type="button" class="action" id="edit-cancel">取消</button>
<button type="submit" class="action primary">完成</button>
</div>
</form>
</dialog>
<dialog id="library-delete" aria-labelledby="delete-message">
<p id="delete-message"></p>
<div class="library-actions">
<button type="button" class="action" id="delete-cancel">取消</button>
<button type="button" class="action primary" id="delete-confirm">删除</button>
</div>
</dialog>
<dialog id="reset-dialog" aria-labelledby="reset-title" aria-describedby="reset-message">
<h2 id="reset-title">清除所有已保存数据?</h2>
<p id="reset-message">将清除拾见本机保存的配置、内容库、绑定图片、任务检查点和运行日志。DeepSeek 密钥会保留。清除后恢复默认设置,此操作无法撤销。</p>
<div class="library-actions">
<button type="button" class="action" id="reset-cancel" autofocus>取消</button>
<button type="button" class="action primary danger" id="reset-confirm">清除数据</button>
</div>
</dialog>
<script>
const byId = id => document.getElementById(id);
const scope = byId("search-scope");
const platformPicker = byId("target-platform");
const replyMode = byId("reply-mode");
const bilibiliScopeField = byId("bilibili-comment-scope-field");
const bilibiliScope = byId("bilibili-comment-scope");
const typePicker = byId("content-type");
const rulePicker = byId("keyword-rule");
const phrasePicker = byId("reply-phrase");
const editDialog = byId("library-editor");
const deleteDialog = byId("library-delete");
const resetDialog = byId("reset-dialog");
const singleLine = byId("library-value");
const multiLine = byId("library-phrase-text");
const editError = byId("library-error");
const photoBinding = document.getElementById("photo-binding");
const photoCount = document.getElementById("photo-count");
const photoItems = document.getElementById("photo-items");
const fileInput = document.getElementById("template-photo");
const choosePhoto = document.getElementById("photo-choose");
const photoStatus = document.getElementById("photo-status");
const maxPhotos = 9;
const types = [{ id: "model-services", name: "模型服务", rules: [
{ id: "model-recharge", keyword: "国外大模型充值", phrases: [
{ id: "recharge-regions", text: "这条视频里提到的方式适用于哪些地区?", photos: [] },
] },
] }];
const pick = (list, picker) => list.find(item => item.id === picker.value);
const activeType = () => pick(types, typePicker);
const activeRule = () => pick(activeType()?.rules ?? [], rulePicker);
const activePhrase = () => pick(activeRule()?.phrases ?? [], phrasePicker);
const normalizeKeyword = keyword => keyword.normalize("NFKC").toLowerCase().trim().replace(/\s+/gu, " ");
const levels = {
type: { picker: typePicker, name: "内容类型", key: "name", entries: () => types, extra: () => ({ rules: [] }) },
rule: { picker: rulePicker, name: "关键词", key: "keyword", entries: () => activeType()?.rules ?? [], extra: () => ({ phrases: [] }) },
phrase: { picker: phrasePicker, name: "话术", key: "text", entries: () => activeRule()?.phrases ?? [], extra: () => ({ photos: [] }) },
};
let nextId = 0;
let editing;
let deleting;
let photoTarget;
const fillPicker = (picker, options, selected, placeholder) => {
picker.replaceChildren(...(options.length ? options.map(([id, title]) => new Option(title, id)) : [new Option(placeholder, "")]));
if (options.some(([id]) => id === selected)) picker.value = selected;
picker.disabled = !options.length;
};
const setStatus = (message = "") => {
photoStatus.textContent = message;
photoStatus.hidden = !message;
};
const photoItem = (phrase, entry, index) => {
const item = document.createElement("div");
item.className = "photo-item";
const name = document.createElement("p");
name.textContent = `图片 ${index + 1} · ${entry.name}`;
const thumbnail = document.createElement("img");
thumbnail.alt = `第 ${index + 1} 张图片预览`;
thumbnail.src = entry.url;
const actions = document.createElement("div");
actions.className = "photo-actions";
for (const [title, position, disabled] of [["上移", index - 1, index === 0], ["下移", index + 1, index === phrase.photos.length - 1], ["移除图片", null, false]]) {
const button = document.createElement("button");
button.type = "button";
button.className = "action";
button.textContent = title;
button.setAttribute("aria-label", `${title === "移除图片" ? "移除" : title}第 ${index + 1} 张图片`);
button.disabled = disabled;
button.addEventListener("click", () => {
const [selected] = phrase.photos.splice(index, 1);
if (position === null) URL.revokeObjectURL(selected.url);
else phrase.photos.splice(position, 0, selected);
setStatus();
redrawPhoto();
});
actions.append(button);
}
item.append(name, thumbnail, actions);
return item;
};
const redrawPhoto = () => {
const phrase = activePhrase();
const entries = phrase?.photos ?? [];
photoBinding.hidden = !phrase;
photoCount.textContent = `已绑定 ${entries.length} / ${maxPhotos} 张图片`;
photoItems.replaceChildren(...entries.map((entry, index) => photoItem(phrase, entry, index)));
choosePhoto.disabled = entries.length >= maxPhotos;
};
const redrawLibrary = (typeId = typePicker.value, ruleId = rulePicker.value, phraseId = phrasePicker.value) => {
const typeOptions = types.map(type => [type.id, type.name]);
fillPicker(scope, [["", "全部内容类型"], ...typeOptions], scope.value, "");
fillPicker(typePicker, typeOptions, typeId, "请先新增内容类型");
fillPicker(rulePicker, (activeType()?.rules ?? []).map(rule => [rule.id, rule.keyword]), ruleId, "请先新增关键词");
fillPicker(phrasePicker, (activeRule()?.phrases ?? []).map((phrase, index) => [phrase.id, `${index + 1}. ${phrase.text.replace(/\s+/gu, " ")}`]), phraseId, "请先新增话术");
byId("rule-level").hidden = !activeType();
byId("phrase-level").hidden = !activeRule();
for (const button of document.querySelectorAll("[data-level][data-action]")) {
button.disabled = button.dataset.action !== "add" && levels[button.dataset.level].picker.disabled;
}
redrawPhoto();
};
for (const button of document.querySelectorAll("[data-level][data-action]")) {
button.addEventListener("click", () => {
const level = button.dataset.level;
const config = levels[level];
const entries = config.entries();
const existing = pick(entries, config.picker);
if (button.dataset.action === "delete") {
if (!existing) return;
const messages = {
type: () => `删除「${existing.name}」及其中的关键词、话术和图片绑定?`,
rule: () => `删除关键词「${existing.keyword}」及其话术和图片绑定?`,
phrase: () => "删除这条话术及其图片绑定?",
};
deleting = { entries, existing };
byId("delete-message").textContent = messages[level]();
deleteDialog.showModal();
return;
}
const edit = button.dataset.action === "edit";
editing = { level, config, entries, item: edit ? existing : undefined };
byId("editor-title").textContent = `${edit ? "编辑" : "新增"}${config.name}`;
const isPhrase = level === "phrase";
singleLine.hidden = isPhrase;
multiLine.hidden = !isPhrase;
editError.hidden = true;
const field = isPhrase ? multiLine : singleLine;
field.value = editing.item?.[config.key] ?? "";
field.placeholder = isPhrase ? "输入回复文字" : level === "type" ? "内容类型名称" : "一个关键词";
field.setAttribute("aria-label", field.placeholder);
editDialog.showModal();
field.focus();
});
}
byId("edit-cancel").addEventListener("click", () => editDialog.close());
byId("delete-cancel").addEventListener("click", () => deleteDialog.close());
byId("library-form").addEventListener("submit", event => {
event.preventDefault();
const { level, config, entries, item } = editing;
const field = level === "phrase" ? multiLine : singleLine;
const value = field.value.trim();
const error = !value ? `请填写${field.placeholder}。`
: level === "type" && value.length > 120 ? "内容类型名称最多 120 个字符。"
: level === "rule" && (value.length > 120 || /[\r\n]/u.test(value)) ? "每个关键词最多 120 个字符,请填一行。"
: level === "rule" && entries.some(entry => entry !== item && normalizeKeyword(entry.keyword) === normalizeKeyword(value)) ? "这个内容类型已有相同的关键词。"
: level === "phrase" && [...value].length > 120 ? "每条话术最多 120 个字符。"
: level === "phrase" && !item && entries.length >= 100 ? "每个关键词最多 100 条话术。" : "";
if (error) {
editError.textContent = error;
editError.hidden = false;
return;
}
const updated = item ?? { id: `preview-${++nextId}`, ...config.extra() };
updated[config.key] = value;
if (!item) entries.push(updated);
editDialog.close();
setStatus();
redrawLibrary(level === "type" ? updated.id : typePicker.value,
level === "rule" ? updated.id : rulePicker.value, level === "phrase" ? updated.id : phrasePicker.value);
});
byId("delete-confirm").addEventListener("click", () => {
const { entries, existing } = deleting;
const affected = existing.rules ? existing.rules.flatMap(rule => rule.phrases) : existing.phrases ?? [existing];
for (const phrase of affected) phrase.photos.forEach(photo => URL.revokeObjectURL(photo.url));
entries.splice(entries.indexOf(existing), 1);
deleteDialog.close();
setStatus();
redrawLibrary();
});
choosePhoto.addEventListener("click", () => {
photoTarget = activePhrase();
fileInput.click();
});
fileInput.addEventListener("change", () => {
const stillPresent = types.some(type => type.rules.some(rule => rule.phrases.includes(photoTarget)));
if (stillPresent && fileInput.files.length) {
const current = photoTarget.photos;
const available = maxPhotos - current.length;
const selected = [...fileInput.files].slice(0, available);
const imported = selected.filter(file => ["image/jpeg", "image/png"].includes(file.type));
current.push(...imported.map(file => ({ name: file.name, url: URL.createObjectURL(file) })));
const issues = [];
if (selected.length > imported.length) issues.push(`${selected.length - imported.length} 张图片无法导入。`);
if (fileInput.files.length > available) issues.push(`超出数量上限的 ${fileInput.files.length - available} 张图片未导入。`);
setStatus(issues.join(" "));
}
photoTarget = undefined;
fileInput.value = "";
redrawPhoto();
});
for (const picker of [typePicker, rulePicker, phrasePicker]) {
picker.addEventListener("change", () => {
setStatus();
redrawLibrary();
});
}
function updateCommentSettings() {
const unit = platformPicker.selectedOptions[0].dataset.unit;
const showBilibiliScope = platformPicker.value === "bilibili" && replyMode.selectedIndex === 1;
const videoComment = showBilibiliScope && bilibiliScope.value === "VIDEO_COMMENT";
const operation = videoComment ? "发布" : "回复";
bilibiliScopeField.hidden = !showBilibiliScope;
byId("bilibili-comment-scope-hint").textContent = videoComment
? "根据匹配结果在当前视频发布评论,话术绑定的图片会随正文发送。"
: "将话术作为文字回复发到命中的原评论下。已绑定的图片会保留。";
byId("content-limit-label").textContent = `单次任务${unit}上限`;
byId("reply-limit-label").textContent = `每条${unit}${videoComment ? "评论发布" : "回复"}上限`;
byId("reply-scope-hint").textContent = `达到${operation}上限或找不到更多匹配评论时,进入下一个${unit}。`;
byId("content-scope-hint").textContent = platformPicker.value === "kuaishou"
? "按内容类型搜索,轮流处理「图片」和「视频」中的作品。每个关键词可配置多条话术。"
: `按内容类型搜索${unit},按关键词匹配评论。每个关键词可配置多条话术。`;
}
for (const picker of [platformPicker, replyMode, bilibiliScope]) {
picker.addEventListener("change", updateCommentSettings);
}
function updateTaskPreview() {
const platform = platformPicker.selectedOptions[0];
const unit = platform.dataset.unit;
const limit = byId("video-limit").valueAsNumber;
const selectedType = pick(types, scope);
const searchTypes = selectedType ? [selectedType] : types;
const type = byId("task-content-type");
const progress = byId("task-progress");
const modeLabel = bilibiliScopeField.hidden ? replyMode.value : bilibiliScope.selectedOptions[0].text;
const confirmedLabel = !bilibiliScopeField.hidden && bilibiliScope.value === "VIDEO_COMMENT" ? "已确认发布评论" : "已确认回复";
byId("task-mode").textContent = `${platform.text} · ${modeLabel}`;
byId("task-scope").textContent = `内容类型 ${searchTypes.length} 个 · 单次 ${limit} 个${unit}`;
byId("task-summary").textContent = `已处理${unit} 0 / ${limit} · ${confirmedLabel} 0 条`;
progress.max = limit;
progress.value = 0;
progress.setAttribute("aria-label", `已处理 0 个${unit},共 ${limit} 个`);
type.hidden = searchTypes.length === 0;
type.textContent = searchTypes.length ? `内容类型 · ${searchTypes[0].name}` : "";
}
function showConfigStatus(message, invalid) {
const status = byId("library-status");
status.textContent = message;
status.classList.toggle("error", Boolean(invalid));
status.hidden = false;
invalid?.focus({ preventScroll: true });
status.scrollIntoView({ block: "nearest", inline: "nearest" });
}
byId("save-preview").addEventListener("click", () => {
const invalid = [byId("video-limit"), byId("replies-per-video")].find(input => !input.validity.valid);
if (!invalid) updateTaskPreview();
showConfigStatus(invalid ? `${invalid.labels[0].textContent}须为 1–100 的整数。` : "预览配置已更新。", invalid);
});
byId("reset-preview").addEventListener("click", () => resetDialog.showModal());
byId("reset-cancel").addEventListener("click", () => resetDialog.close());
byId("reset-confirm").addEventListener("click", () => {
for (const type of types) {
for (const rule of type.rules) {
for (const phrase of rule.phrases) phrase.photos.forEach(photo => URL.revokeObjectURL(photo.url));
}
}
types.length = 0;
nextId = 0;
editing = deleting = photoTarget = undefined;
singleLine.value = multiLine.value = fileInput.value = "";
for (const picker of [platformPicker, replyMode, bilibiliScope, scope]) picker.selectedIndex = 0;
for (const input of [byId("video-limit"), byId("replies-per-video")]) input.value = input.defaultValue;
const pending = byId("pending-receipt-preview");
pending.open = false;
pending.hidden = true;
byId("log-entries").replaceChildren();
byId("log-entries").hidden = true;
byId("empty-log").hidden = false;
resetDialog.close();
setStatus();
updateCommentSettings();
redrawLibrary();
updateTaskPreview();
showConfigStatus("已清除所有已保存数据。");
});
updateCommentSettings();
redrawLibrary();
</script>
</body>
</html>
+121 -56
View File
@@ -8,25 +8,33 @@
<title>拾见 · 界面预览</title> <title>拾见 · 界面预览</title>
<style> <style>
:root { :root {
--ink: #172a24; --ink: #25354e;
--muted: #4e6358; --muted: #50627c;
--green: #076c53; --screen: #edf5ff;
--screen: #f3f5f0; --paper: #fff;
--tint: #e5f0e8; --line: #ccddf5;
--line: #cbd7ce; --blue: #31588f;
--alert: #863c15; --blue-tint: #e7f0ff;
--danger: #9a342b; --coral: #b64154;
--danger-tint: #f7e9e6; --coral-pressed: #9d354b;
--coral-tint: #ffe8ec;
--green: #267252;
--grass-tint: #e9f7eb;
--launcher-art: url('../app/src/main/res/drawable-nodpi/launcher_artwork.jpg');
font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif; font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
color: var(--ink); color: var(--ink);
background: #e8ede6; background: #f4f8ff;
} }
* { box-sizing: border-box; } * { box-sizing: border-box; }
body { margin: 0; } body {
margin: 0;
background: radial-gradient(ellipse at 9% 0%, #e3eeff 0, transparent 480px),
radial-gradient(ellipse at 90% 0%, #ffedf1 0, transparent 430px);
}
a { color: inherit; } a { color: inherit; }
a:focus-visible, [tabindex]:focus-visible { a:focus-visible, [tabindex]:focus-visible {
outline: 2px solid var(--green); outline: 2px solid var(--blue);
outline-offset: 3px; outline-offset: 3px;
} }
@@ -50,6 +58,7 @@
height: 52px; height: 52px;
border-radius: 14px; border-radius: 14px;
object-fit: cover; object-fit: cover;
box-shadow: 0 2px 0 #b8cee8, 0 6px 14px #31588f1c;
} }
h1, h2, h3, p { margin: 0; } h1, h2, h3, p { margin: 0; }
@@ -71,8 +80,8 @@
scroll-margin-top: 18px; scroll-margin-top: 18px;
} }
.screen-figure figcaption { padding-inline: 8px; font-size: 16px; font-weight: 700; } .screen-figure figcaption { padding-inline: 8px; color: var(--blue); font-size: 15px; font-weight: 700; }
.screen-figure:target .phone { border-color: var(--green); } .screen-figure:target .phone { border-color: #96b4e0; }
.phone { .phone {
display: grid; display: grid;
@@ -80,50 +89,89 @@
min-width: 0; min-width: 0;
height: 735px; height: 735px;
overflow: hidden; overflow: hidden;
border: 1px solid #aebfb2; border: 1px solid var(--line);
border-radius: 26px; border-radius: 28px;
background: var(--screen); background: var(--screen);
box-shadow: 0 12px 28px #172a2411; box-shadow: 0 3px 0 #dbe8fa, 0 14px 28px #31588f16;
} }
.app-name { .app-name {
padding: 21px 20px 8px; position: relative;
font-size: 30px; display: flex;
align-items: center;
gap: 12px;
margin: 14px 14px 8px;
min-height: 76px;
padding: 11px 13px;
border: 1px solid #f5ced7;
border-radius: 20px;
background: linear-gradient(108deg, #fff3f5, var(--coral-tint));
color: var(--ink);
font-size: 27px;
font-weight: 740; font-weight: 740;
line-height: 1.2; line-height: 1.2;
} }
.app-name::before {
content: '';
flex: 0 0 48px;
height: 48px;
border-radius: 12px;
background: #7babf8 var(--launcher-art) center / cover;
box-shadow: 0 2px 0 #eac2d1;
}
.app-name::after {
content: '';
position: absolute;
inset: 29px 34px auto auto;
width: 5px;
height: 5px;
background: #e49aab;
box-shadow: -5px 5px #e49aab, 0 5px #e49aab, 5px 5px #e49aab, 0 10px #e49aab,
15px -6px #88aee0, 24px 14px #a7cda9;
pointer-events: none;
}
.phone-content { .phone-content {
overflow: auto; overflow: auto;
padding: 6px 17px 8px; padding: 4px 14px 12px;
scrollbar-color: #a9c2b2 transparent; scrollbar-color: #afc6e7 transparent;
scrollbar-width: thin; scrollbar-width: thin;
} }
.card { .card {
margin-bottom: 12px; margin-bottom: 12px;
padding: 12px 16px 14px; padding: 14px 15px 15px;
border: 1px solid var(--line);
border-radius: 18px; border-radius: 18px;
background: #fff; background: var(--paper);
box-shadow: 0 2px 0 #dce9fa;
} }
.card h3 { margin-bottom: 4px; font-size: 19px; line-height: 1.45; } .card h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; font-size: 18px; line-height: 1.45; }
.card h3::before { content: ''; width: 7px; height: 7px; flex: 0 0 7px; background: #82ade6; box-shadow: 3px 3px #cedff7; }
.task-state { border-color: #cde7d3; background: #f6fcf7; box-shadow: 0 2px 0 #deeddf; }
.task-state h3 { color: var(--green); }
.task-state h3::before { background: #77af86; box-shadow: 3px 3px #c8e5ce; }
.card p { margin-top: 6px; font-size: 14px; } .card p { margin-top: 6px; font-size: 14px; }
.card .mode { font-size: 15px; } .card .mode { font-size: 15px; font-weight: 650; }
.hint, .summary { color: var(--muted); } .hint, .summary { color: var(--muted); }
.phone-content > details.card { margin-top: 12px; }
summary { color: var(--blue); font-weight: 650; cursor: pointer; }
progress { progress {
display: block; display: block;
width: 100%; width: 100%;
height: 4px; height: 7px;
margin: 12px 0 8px; margin: 12px 0 8px;
appearance: none; appearance: none;
overflow: hidden; overflow: hidden;
border: 0; border: 0;
border-radius: 4px; border-radius: 4px;
background: var(--tint); background: #dcefe0;
} }
progress::-webkit-progress-bar { background: var(--tint); } progress::-webkit-progress-bar { background: #dcefe0; }
progress::-webkit-progress-value { background: var(--green); } progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); } progress::-moz-progress-bar { background: var(--green); }
@@ -133,8 +181,8 @@
min-height: 46px; min-height: 46px;
padding: 6px 10px; padding: 6px 10px;
border-radius: 12px; border-radius: 12px;
background: var(--tint); background: var(--blue-tint);
color: var(--green); color: var(--blue);
font-size: 15px; font-size: 15px;
font-weight: 650; font-weight: 650;
text-align: center; text-align: center;
@@ -147,10 +195,12 @@
} }
[hidden] { display: none !important; } [hidden] { display: none !important; }
button.action { border: 0; cursor: pointer; } button.action { border: 0; cursor: pointer; font-family: inherit; }
button.action:disabled { opacity: .48; cursor: default; } .action:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.action:disabled { color: #63758e; background: #edf2fa; cursor: default; }
#photo-items { display: grid; gap: 10px; margin-top: 8px; } #photo-items { display: grid; gap: 10px; margin-top: 8px; }
.photo-item img { display: block; width: 96px; height: 76px; object-fit: contain; } .photo-item { padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #f6f9ff; }
.photo-item img { display: block; width: 96px; height: 76px; margin-top: 5px; border-radius: 7px; object-fit: contain; }
.library-actions, .photo-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; } .library-actions, .photo-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.library-level { margin-top: 14px; } .library-level { margin-top: 14px; }
.library-level label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; } .library-level label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; }
@@ -158,37 +208,44 @@
dialog { dialog {
width: min(390px, calc(100% - 32px)); width: min(390px, calc(100% - 32px));
padding: 20px; padding: 20px;
border: 1px solid var(--line); border: 1px solid #f1cad3;
border-radius: 18px; border-radius: 22px;
background: var(--paper);
color: var(--ink); color: var(--ink);
box-shadow: 0 8px 32px #293b6560, inset 0 5px var(--coral-tint);
} }
dialog::backdrop { background: #172a2460; } dialog::backdrop { background: #26355470; }
dialog h2 { margin-bottom: 12px; font-size: 20px; } dialog h2 { margin-bottom: 12px; font-size: 20px; }
dialog .library-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; } dialog .library-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
#library-status { margin: 6px 0 0; color: var(--muted); font-size: 14px; } #library-status { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
#library-error, #library-status.error { color: var(--alert); font-size: 14px; } #library-error, #library-status.error { color: var(--coral-pressed); font-size: 14px; }
.action.primary, .app-nav [aria-current="page"] { .action.primary {
color: #fff; color: #fff;
background: var(--green); background: var(--coral);
} }
button.action.primary:hover { background: var(--coral-pressed); }
.action.danger { color: var(--danger); background: var(--danger-tint); } .action.danger { color: var(--coral-pressed); background: var(--coral-tint); }
.action.primary.danger { color: #fff; background: var(--danger); } .action.primary.danger { color: #fff; background: var(--coral-pressed); }
.action[aria-disabled="true"] { .action[aria-disabled="true"] {
color: #fff; color: #63758e;
background: #668b7a; background: #e3ecf9;
} }
.app-nav { .app-nav {
display: grid; display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 4px; gap: 6px;
padding: 7px 16px 12px; padding: 8px 14px 11px;
border-top: 1px solid var(--line);
background: #f8fbff;
} }
.app-nav a:hover { box-shadow: inset 0 0 0 1px var(--green); } .app-nav a { color: var(--muted); background: transparent; }
.app-nav [aria-current="page"] { background: #dceaff; color: var(--blue); }
.app-nav a:hover { box-shadow: inset 0 0 0 1px var(--line); }
.fields { .fields {
display: grid; display: grid;
@@ -202,10 +259,11 @@
.control { .control {
display: flex; display: flex;
align-items: center; align-items: center;
min-height: 42px; min-height: 44px;
padding: 8px 11px; padding: 8px 11px;
border-radius: 9px; border: 1px solid var(--line);
background: var(--screen); border-radius: 11px;
background: #f6f9ff;
font-size: 15px; font-size: 15px;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
@@ -225,12 +283,20 @@
.settings-input { .settings-input {
display: block; display: block;
width: 100%; width: 100%;
border: 0;
color: inherit; color: inherit;
font: inherit; font: inherit;
font-size: 15px; font-size: 15px;
} }
.settings-input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; } .settings-input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.settings-input:disabled { color: #63758e; background: #edf2fa; }
select.settings-input {
appearance: none;
padding-right: 28px;
background-image: linear-gradient(45deg, transparent 50%, #6984a9 50%), linear-gradient(135deg, #6984a9 50%, transparent 50%);
background-position: right 15px center, right 10px center;
background-size: 5px 5px;
background-repeat: no-repeat;
}
textarea.settings-input { resize: vertical; } textarea.settings-input { resize: vertical; }
.range { .range {
display: grid; display: grid;
@@ -251,10 +317,9 @@
font-size: 14px; font-size: 14px;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.entries li { padding: 0 0 7px; border-bottom: 1px solid var(--line); } .entries li { padding: 7px 9px; border-left: 3px solid #b9d8c3; border-radius: 8px; background: var(--grass-tint); }
.entries li:last-child { padding-bottom: 0; border-bottom: 0; } .entries time { display: block; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; white-space: nowrap; }
.entries time { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; } .entries .warning { border-color: #e8aebc; color: var(--coral-pressed); background: var(--coral-tint); }
.entries .warning { color: var(--alert); }
@media (max-width: 970px) { @media (max-width: 970px) {
.screen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .screen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@@ -295,7 +360,7 @@
<section class="phone" aria-label="拾见任务页"> <section class="phone" aria-label="拾见任务页">
<h2 class="app-name">拾见</h2> <h2 class="app-name">拾见</h2>
<div class="phone-content"> <div class="phone-content">
<div class="card"> <div class="card task-state">
<h3>准备运行</h3> <h3>准备运行</h3>
<p class="mode" id="task-mode">抖音 · 仅浏览</p> <p class="mode" id="task-mode">抖音 · 仅浏览</p>
<p id="task-scope">内容类型 1 个 · 单次 3 个视频</p> <p id="task-scope">内容类型 1 个 · 单次 3 个视频</p>
+14 -1
View File
@@ -1,6 +1,19 @@
# 拾见开发进度 # 拾见开发进度
最近更新于 2026-11-27 16:52(UTC+8)。以下按开发轮次倒序记录。 最近更新于 2026-11-27 17:13(UTC+8)。以下按开发轮次倒序记录。
## 2026-11-27 · 拾见 0.1.46 像素可爱风界面
- 根据确认的设计稿更新 Android 的任务、配置和日志页。统一使用带新图标的珊瑚粉页头、天空蓝页面、圆角卡片、青草绿任务状态和蓝色选中页签。配置表单、平台下拉、照片预览和操作弹窗采用同一套配色和圆角。
- [界面预览](ui-preview.html)已同步。离线 Chrome 在 1440×975 和 390×880 尺寸回归验证了导航、四个平台配置、图片绑定和排序,以及恢复默认设置的确认与取消。
- vivo Android 12 已覆盖安装 0.1.46。核对任务、配置、日志空状态及平台下拉的四个选项。新增内容类型与清除数据两个弹窗均实际打开并取消,配置、检查点和日志的存储状态一致。
- 头像圆角使用最低支持版本可用的裁切接口,主题统一绘制背景。最终包重新装机并通过上述复查。APK 通过 v2 签名校验,装机文件与本地构建产物的 SHA-256 一致,74 项 JVM 单元测试通过,Lint 为 0 个错误、5 个既有警告。
## 2026-11-27 · 像素可爱风界面提案
- 新增独立的[可点击设计稿](ui-cute-preview.html)。沿用桌面图标原图,统一任务、配置、日志和弹窗的天空蓝背景、珊瑚色操作按钮、青草绿状态和像素点缀。
- 离线 Chrome 在 1440×975 和 390×880 两种尺寸通过验证,覆盖页面导航、四个平台配置、图片绑定和排序,以及清除确认和取消。
- 用户已确认提案,Android 实现见 0.1.46 记录。
## 2026-11-27 · 拾见 0.1.45 更换桌面图标 ## 2026-11-27 · 拾见 0.1.45 更换桌面图标