Finish reading AlarmAlerActivity.OnCreat

zhengkunpeng_branch
parent eedd44c11a
commit 176ce2e8c3

@ -15,7 +15,6 @@
*/
package net.micode.notes.gtask.exception;
public class NetworkFailureException extends Exception {
private static final long serialVersionUID = 2107610287180234136L;
@ -26,8 +25,7 @@ public class NetworkFailureException extends Exception {
public NetworkFailureException(String paramString) {
super(paramString);
}
public NetworkFailureException(String paramString, Throwable paramThrowable) {
super(paramString, paramThrowable);
}
}
}

@ -135,8 +135,22 @@ public class DataUtils {
}
return count;
}
/**
* @Method visibleInNoteDatabase
* @Date 2023/12/13 9:08
* @param resolver
* @param noteId
* @param type
* @Author lenovo
* @Return boolean
* @Description 访 noteId 便
*/
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
/**
* withAppendedId URI ID URI
* query Uri selection
* lenovo 2023/12/13 9:06
*/
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
null,
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,

@ -47,14 +47,28 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
MediaPlayer mPlayer;
@Override
//TODO add comments of this method
/**
* @Method onCreate
* @Date 2023/12/13 8:15
* @param savedInstanceState
* @Author lenovo
* @Return void
* @Description
*/
protected void onCreate(Bundle savedInstanceState) {
/**
* Bundel mapkey-value
* super , onCreate
* lenovo 2023/12/13 8:39
*/
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
final Window win = getWindow();
// 在屏幕锁定时显示
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
// 锁屏时到闹钟提示时间后,点亮屏幕
if (!isScreenOn()) {
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
@ -67,6 +81,7 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
try {
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
// 超出长度则变为 substr + "..."
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)
: mSnippet;
@ -76,7 +91,8 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
}
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { //在这里做时间判断?定时器怎么实现的?
// 查找数据库中有没有 mNoteId 的便签, 如果有则激发对话框 + 闹钟提示音
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
showActionDialog();
playAlarmSound();
} else {

Loading…
Cancel
Save