From a9b8c1222e8d8e83335c89537dbe2b269ad70f4c Mon Sep 17 00:00:00 2001 From: gq <15933486098@qq.com> Date: Wed, 14 May 2025 22:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=87=8A=E4=BA=86=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5=E5=AF=B9=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../micode/notes/ui/AlarmAlertActivity.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Notesmaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java b/Notesmaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java index 095b8a8..f32b267 100644 --- a/Notesmaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java +++ b/Notesmaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java @@ -138,14 +138,34 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD e.printStackTrace(); } } + /** + * 显示操作选择对话框 + * 1. 设置对话框标题为应用名称 + * 2. 显示笔记内容片段作为对话框消息 + * 3. 提供确定按钮 + * 4. 如果屏幕是亮屏状态,额外提供进入按钮 + * 5. 设置对话框关闭监听器 + */ private void showActionDialog() { + // 创建AlertDialog构建器 AlertDialog.Builder dialog = new AlertDialog.Builder(this); + + // 设置对话框标题(使用应用名称资源ID) dialog.setTitle(R.string.app_name); + + // 设置对话框消息内容(显示笔记片段) dialog.setMessage(mSnippet); + + // 添加确定按钮(使用资源ID设置按钮文字,并设置当前Activity为点击监听器) dialog.setPositiveButton(R.string.notealert_ok, this); + + // 检查屏幕是否亮屏 if (isScreenOn()) { + // 如果是亮屏状态,添加进入按钮 dialog.setNegativeButton(R.string.notealert_enter, this); } + + // 显示对话框并设置关闭监听器(当前Activity实现OnDismissListener接口) dialog.show().setOnDismissListener(this); }