diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f71345..09ffcf3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# 变更记录
+## 2026-11-28 · 列表星标紧贴标题、开始按钮圆底自动开跑;主题弹窗圆角化与版权V化
+
+- 同步源码更新 6 个文件(新增/修改 6,删除 0)。
+
## 2026-11-28 · v0.5.7:任务完成后消失、紧急度五角星与通知间距
- **通知按钮间距**:锁屏/通知右侧「结束」按钮与「暂停/继续」之间加 8dp 间距,不再贴在一起。
diff --git a/src/main/java/com/focusbox/app/ui/MainActivity.kt b/src/main/java/com/focusbox/app/ui/MainActivity.kt
index 5bbe9a2..df06299 100644
--- a/src/main/java/com/focusbox/app/ui/MainActivity.kt
+++ b/src/main/java/com/focusbox/app/ui/MainActivity.kt
@@ -225,13 +225,18 @@ class MainActivity : AppCompatActivity() {
(fragments[TAB_TASKS] as? TasksFragment)?.applyProjectFilter(projectId)
}
- /** 任务行的播放键:把该任务设为当前任务并回到首页,圆环套用任务时长 */
+ /** 任务行的播放键:把该任务设为当前任务并回到首页,圆环套用任务时长并直接开始 */
fun startFocusOn(task: Task) {
TimerCore.setCountUp(false)
TimerCore.setTask(task.id, task.projectId, task.focusMinutes)
if (!TimerCore.running && TimerCore.mode != TimerCore.MODE_FOCUS) {
TimerCore.setMode(TimerCore.MODE_FOCUS)
}
+ // 空闲时自动开跑,不用回到专注页再点一次「开始专注」;
+ // 已在计时(本轮进行中)则只换任务与时长,不打断当前进度
+ if (!TimerCore.running && TimerCore.elapsedNow() <= 0) {
+ TimerCore.start()
+ }
showTab(TAB_FOCUS)
}
diff --git a/src/main/java/com/focusbox/app/ui/settings/SettingsFragment.kt b/src/main/java/com/focusbox/app/ui/settings/SettingsFragment.kt
index 12ca5d7..76fb149 100644
--- a/src/main/java/com/focusbox/app/ui/settings/SettingsFragment.kt
+++ b/src/main/java/com/focusbox/app/ui/settings/SettingsFragment.kt
@@ -6,7 +6,6 @@ import android.view.Gravity
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
-import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SwitchCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
@@ -19,6 +18,7 @@ import com.focusbox.app.util.Dates
import com.focusbox.app.util.Prefs
import com.focusbox.app.util.col
import com.focusbox.app.util.dpi
+import com.focusbox.app.util.roundBg
import com.focusbox.app.util.tint
/**
@@ -266,40 +266,113 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) {
// ------------------------------------------------------------ 交互
private fun pickTheme() {
- val labels = arrayOf(
- getString(R.string.theme_follow),
- getString(R.string.theme_light),
- getString(R.string.theme_dark),
+ val ctx = requireContext()
+ val labels = intArrayOf(
+ R.string.theme_follow,
+ R.string.theme_light,
+ R.string.theme_dark,
)
- AlertDialog.Builder(requireContext())
- .setTitle(R.string.theme)
- .setSingleChoiceItems(labels, Prefs.themeMode) { dialog, which ->
- Prefs.themeMode = which
- (requireActivity().application as App).applyTheme()
- dialog.dismiss()
- requireActivity().recreate()
+ val dialog = android.app.Dialog(ctx)
+ dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
+
+ val panel = LinearLayout(ctx).apply {
+ orientation = LinearLayout.VERTICAL
+ // 与全局卡片一致:圆角 16dp、surface 底色随深浅色自动切换
+ background = ctx.roundBg(ctx.col(R.color.surface), 16f, ctx.col(R.color.card_stroke), 1f)
+ setPadding(dpi(16f), dpi(14f), dpi(16f), dpi(14f))
+ }
+
+ labels.forEachIndexed { index, res ->
+ val selected = Prefs.themeMode == index
+ val row = TextView(ctx).apply {
+ text = getString(res)
+ textSize = 15f
+ gravity = Gravity.CENTER
+ setTextColor(col(if (selected) R.color.brand else R.color.text))
+ typeface = if (selected) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
+ background = if (selected) {
+ ctx.roundBg(ctx.col(R.color.brand_soft), 12f)
+ } else {
+ ctx.roundBg(ctx.col(R.color.surface), 12f)
+ }
+ setPadding(0, dpi(14f), 0, dpi(14f))
+ setOnClickListener {
+ dialog.dismiss()
+ if (Prefs.themeMode != index) {
+ Prefs.themeMode = index
+ (requireActivity().application as App).applyTheme()
+ requireActivity().recreate()
+ }
+ }
}
- .show()
+ panel.addView(row, LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ ).apply { topMargin = dpi(6f) })
+ }
+
+ dialog.setContentView(panel)
+ dialog.show()
}
private fun confirmClear() {
- AlertDialog.Builder(requireContext())
- .setTitle(R.string.clear_data)
- .setMessage(R.string.clear_confirm)
- .setNegativeButton(R.string.cancel, null)
- .setPositiveButton(R.string.delete) { _, _ ->
- TimerCore.reset()
- Store.clearAll()
- Prefs.clearTimer()
- Prefs.timerRound = 0
- TimerCore.resetRound()
- (activity as? MainActivity)?.refreshAll()
- build()
- }
- .show()
+ val ctx = requireContext()
+ val dialog = android.app.Dialog(ctx)
+ dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
+
+ val panel = LinearLayout(ctx).apply {
+ orientation = LinearLayout.VERTICAL
+ background = ctx.roundBg(ctx.col(R.color.surface), 16f, ctx.col(R.color.card_stroke), 1f)
+ setPadding(dpi(20f), dpi(20f), dpi(20f), dpi(14f))
+ }
+ panel.addView(TextView(ctx).apply {
+ text = getString(R.string.clear_data)
+ textSize = 16f
+ typeface = Typeface.DEFAULT_BOLD
+ setTextColor(col(R.color.text))
+ })
+ panel.addView(TextView(ctx).apply {
+ text = getString(R.string.clear_confirm)
+ textSize = 14f
+ setTextColor(col(R.color.text_secondary))
+ setPadding(0, dpi(10f), 0, dpi(6f))
+ })
+
+ val btnRow = LinearLayout(ctx).apply {
+ orientation = LinearLayout.HORIZONTAL
+ gravity = Gravity.END
+ setPadding(0, dpi(12f), 0, 0)
+ }
+ fun btn(labelRes: Int, danger: Boolean, onClick: () -> Unit) = TextView(ctx).apply {
+ text = getString(labelRes)
+ textSize = 14f
+ typeface = Typeface.DEFAULT_BOLD
+ gravity = Gravity.CENTER
+ setTextColor(col(if (danger) R.color.danger else R.color.brand))
+ background = ctx.roundBg(ctx.col(R.color.surface_alt), 12f)
+ setPadding(dpi(22f), dpi(10f), dpi(22f), dpi(10f))
+ setOnClickListener { onClick() }
+ }
+ btnRow.addView(btn(R.string.cancel, false) { dialog.dismiss() })
+ btnRow.addView(btn(R.string.delete, true) {
+ dialog.dismiss()
+ TimerCore.reset()
+ Store.clearAll()
+ Prefs.clearTimer()
+ Prefs.timerRound = 0
+ TimerCore.resetRound()
+ (activity as? MainActivity)?.refreshAll()
+ build()
+ }, LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
+ marginStart = dpi(10f)
+ })
+ panel.addView(btnRow)
+
+ dialog.setContentView(panel)
+ dialog.show()
}
companion object {
- const val VERSION = "0.2.0"
+ const val VERSION = "0.5.8"
}
}
diff --git a/src/main/java/com/focusbox/app/ui/tasks/TaskAdapter.kt b/src/main/java/com/focusbox/app/ui/tasks/TaskAdapter.kt
index 9b63ff0..0b10e3d 100644
--- a/src/main/java/com/focusbox/app/ui/tasks/TaskAdapter.kt
+++ b/src/main/java/com/focusbox/app/ui/tasks/TaskAdapter.kt
@@ -2,6 +2,8 @@ package com.focusbox.app.ui.tasks
import android.graphics.Paint
import android.graphics.Typeface
+import android.text.SpannableStringBuilder
+import android.text.style.RelativeSizeSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -67,7 +69,6 @@ class TaskAdapter(
private inner class TaskViewHolder(v: View) : RecyclerView.ViewHolder(v) {
private val tvTitle: TextView = v.findViewById(R.id.tvTitle)
- private val tvStars: TextView = v.findViewById(R.id.tvStars)
private val tvMeta: TextView = v.findViewById(R.id.tvMeta)
private val tvNote: TextView = v.findViewById(R.id.tvNote)
private val checkCircle: View = v.findViewById(R.id.checkCircle)
@@ -79,7 +80,23 @@ class TaskAdapter(
val task = row.task
val ctx = itemView.context
- tvTitle.text = task.title
+ // 紧急度五角星直接拼在标题后:紧急三颗红 / 中两颗绿 / 不急一颗灰;
+ // 完成任务不再显示。用 spannable 保证星星紧贴标题而不是被推到行尾。
+ val title = SpannableStringBuilder(task.title)
+ if (!task.done) {
+ val (stars, color) = when (task.urgency) {
+ 2 -> " ★★★" to R.color.urgent_high
+ 1 -> " ★★" to R.color.urgent_mid
+ else -> " ★" to R.color.urgent_low
+ }
+ val start = title.length
+ title.append(stars)
+ title.setSpan(
+ android.text.style.ForegroundColorSpan(ctx.col(color)), start, title.length, 0
+ )
+ title.setSpan(RelativeSizeSpan(0.95f), start, title.length, 0)
+ }
+ tvTitle.text = title
tvTitle.paintFlags = if (task.done) {
tvTitle.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
} else {
@@ -88,20 +105,6 @@ class TaskAdapter(
tvTitle.setTextColor(ctx.col(if (task.done) R.color.text_tertiary else R.color.text))
tvTitle.typeface = if (task.priority >= 2 && !task.done) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
- // 紧急度五角星:紧急三颗红 / 中两颗绿 / 不急一颗灰;完成任务不再显示
- if (!task.done) {
- val (stars, color) = when (task.urgency) {
- 2 -> "★★★" to R.color.urgent_high
- 1 -> "★★" to R.color.urgent_mid
- else -> "★" to R.color.urgent_low
- }
- tvStars.text = stars
- tvStars.setTextColor(ctx.col(color))
- tvStars.visible(true)
- } else {
- tvStars.visible(false)
- }
-
if (task.done) {
checkCircle.background = ctx.circleBg(ctx.col(R.color.brand))
checkMark.visible(true)
@@ -128,7 +131,7 @@ class TaskAdapter(
tvNote.visible(task.note.isNotBlank())
btnPlay.visible(!task.done)
- btnPlay.tint(ctx.col(R.color.text_tertiary))
+ btnPlay.tint(ctx.col(R.color.brand))
checkWrap.setOnClickListener { onToggle(task) }
itemView.setOnClickListener { onEdit(task) }
diff --git a/src/main/res/drawable/bg_play_circle.xml b/src/main/res/drawable/bg_play_circle.xml
new file mode 100644
index 0000000..46a8832
--- /dev/null
+++ b/src/main/res/drawable/bg_play_circle.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/src/main/res/layout/item_task.xml b/src/main/res/layout/item_task.xml
index bc60e29..d78b840 100644
--- a/src/main/res/layout/item_task.xml
+++ b/src/main/res/layout/item_task.xml
@@ -52,16 +52,6 @@
android:textColor="@color/text"
android:maxLines="2"
android:ellipsize="end" />
-
-
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 70d8527..c281241 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -172,14 +172,14 @@
振动
计时时保持屏幕常亮
每日目标
- 深色模式
+ 深浅色
跟随系统
浅色
深色
清空所有数据
项目、任务、专注记录全部删除,不可恢复
确定清空全部数据?此操作不可恢复。
- 版本 %1$s · 自用版
+ V%1$s
%1$d 分钟
%1$d 轮