解释了屏幕状态检查对按钮显示的影响

pull/11/head
gq 3 months ago
parent acbc52c966
commit a9b8c1222e

@ -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);
}

Loading…
Cancel
Save