feat: ResultFlashView 操作结果指示器(Apple Watch 风格)

全屏深色遮罩 + 大圆圈图标,属性动画弹出+淡出,1.5秒自动消失。
- 成功:绿色圆圈 + ✓,OvershootInterpolator 回弹效果
- 失败:红色圆圈 + ✗
- 替代 QuTipDialog 用于 NFC 打卡和按钮操作的结果反馈
- 所有操作统一视觉风格

应用到:
- TaskDetailFragment NFC 打卡
- TaskListFragment NFC 打卡
- MainActivity 返回键主动打卡

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-05-06 14:25:57 +09:30
parent 306af795a6
commit 7f6e9cf039
7 changed files with 192 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ import com.xiaoqu.watch.service.manager.NfcTaskManager
import com.xiaoqu.watch.service.manager.NotificationManager
import com.xiaoqu.watch.service.manager.SystemStateMonitor
import com.xiaoqu.watch.service.manager.UpdateManager
import com.xiaoqu.watch.ui.widget.ResultFlashView
import com.xiaoqu.watch.ui.widget.UpdateDialogView
import com.xiaoqu.watch.ui.widget.NotificationBannerView
import dagger.hilt.android.AndroidEntryPoint
@@ -50,6 +51,8 @@ class MainActivity : AppCompatActivity() {
/** NFC 任务打卡管理器 */
@Inject lateinit var nfcTaskManager: NfcTaskManager
@Inject lateinit var userPrefs: UserPrefs
/** 操作结果指示器Apple Watch 风格) */
lateinit var resultFlash: ResultFlashView
/** OTA 更新弹窗 */
lateinit var updateDialog: UpdateDialogView
lateinit var notificationBanner: NotificationBannerView
@@ -85,6 +88,9 @@ class MainActivity : AppCompatActivity() {
// 初始化通知横幅
notificationBanner = binding.notificationBanner
// 初始化结果指示器
resultFlash = binding.resultFlash
// 初始化 OTA 更新弹窗
updateDialog = binding.updateDialog
setupUpdateDialog()
@@ -205,8 +211,10 @@ class MainActivity : AppCompatActivity() {
Timber.d("返回键: 触发主动打卡")
nfcTaskManager.startActivePunch { success, message ->
if (message.isNotEmpty()) {
android.widget.Toast.makeText(this@MainActivity, message, android.widget.Toast.LENGTH_SHORT).show()
if (success) {
resultFlash.showSuccess()
} else if (message.isNotEmpty()) {
resultFlash.showFailure()
}
}
}