From 57e835edac572413fbcc345828cf133cc4767711 Mon Sep 17 00:00:00 2001 From: ziji Wu <2193177243@qq.com> Date: Fri, 11 Oct 2019 23:43:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/ziji_wu' into develop # Conflicts: # src/.gradle/5.4.1/executionHistory/executionHistory.bin # src/.gradle/5.4.1/executionHistory/executionHistory.lock # src/.gradle/5.4.1/fileHashes/fileHashes.bin # src/.gradle/5.4.1/fileHashes/fileHashes.lock # src/.gradle/5.4.1/fileHashes/resourceHashesCache.bin # src/.gradle/5.4.1/javaCompile/javaCompile.lock # src/.gradle/buildOutputCleanup/buildOutputCleanup.lock # src/.gradle/buildOutputCleanup/outputFiles.bin # src/.idea/caches/build_file_checksums.ser # src/.idea/caches/gradle_models.ser # src/.idea/sonarlint/issuestore/1/e/1eb2363b523dbcae43d3c6e4790c64436af61b13 # src/.idea/sonarlint/issuestore/3/e/3e688be40dc69cfd1062f41d0fc27fe261a26710 # src/.idea/sonarlint/issuestore/5/7/577f30d26378ec8a2bd2e4a43f3c79b3f04c402c # src/.idea/sonarlint/issuestore/6/a/6a65e747031f27aef20597b4181148a9fbf963d5 # src/.idea/sonarlint/issuestore/a/7/a7641cfac724321d508c2a284223a711011a93f5 # src/.idea/sonarlint/issuestore/a/d/ad72331a1bed265bb9c0fe838faa74dbf69fce32 # src/.idea/sonarlint/issuestore/d/d/dd970bd8ce083850fca1d4d159647ccd110e57cb # src/.idea/workspace.xml # src/app/app.iml # src/app/build.gradle # src/app/build/intermediates/dex/debug/mergeDexDebug/out/classes.dex # src/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt # src/app/build/intermediates/incremental/packageDebug/tmp/debug/zip-cache/dPcwR9oS2EmiImbvDZ1Qg_iwk3M= # src/app/build/intermediates/javac/debug/classes/net/micode/notes/data/NotesDatabaseHelper.class # src/app/build/intermediates/javac/debug/classes/net/micode/notes/data/NotesProvider.class # src/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_ # src/app/build/intermediates/transforms/dexBuilder/debug/0/net/micode/notes/data/NotesDatabaseHelper.dex # src/app/build/intermediates/transforms/dexBuilder/debug/0/net/micode/notes/data/NotesProvider.dex # src/app/build/outputs/apk/debug/app-debug.apk # src/app/src/main/java/net/micode/notes/data/NotesProvider.java --- src/.idea/workspace.xml | 191 +++++++++--------- .../micode/notes/ui/AlarmAlertActivity.java | 11 + 2 files changed, 104 insertions(+), 98 deletions(-) diff --git a/src/.idea/workspace.xml b/src/.idea/workspace.xml index e52b0b1..3e7b652 100644 --- a/src/.idea/workspace.xml +++ b/src/.idea/workspace.xml @@ -2,14 +2,15 @@ - + + zh-rTW + - - - + + - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - + + @@ -150,15 +124,15 @@ @@ -327,6 +301,17 @@ + + @@ -497,17 +482,6 @@ - - @@ -819,7 +793,21 @@ @@ -833,9 +821,10 @@ + - + @@ -853,7 +842,7 @@ - + @@ -903,16 +892,10 @@ - - - - - - - - @@ -920,13 +903,6 @@ - - - - - - - @@ -983,7 +959,6 @@ - @@ -998,6 +973,7 @@ + @@ -1109,13 +1085,6 @@ - - - - - - - @@ -1217,29 +1186,8 @@ - - - - - - - - - - - - - - - - - - - - - - - + + @@ -1257,6 +1205,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java b/src/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java index 3812b49..0c49456 100644 --- a/src/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java +++ b/src/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java @@ -45,6 +45,7 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD private long mNoteId; private String mSnippet; private static final int SNIPPET_PREW_MAX_LEN = 60; + //实例化播放器类 MediaPlayer mPlayer; /** @@ -54,14 +55,17 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD */ @Override protected void onCreate(Bundle savedInstanceState) { + //调用父类onCreate方法 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 @@ -87,8 +91,10 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD mPlayer = new MediaPlayer(); if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { showActionDialog(); + //播放提示音 playAlarmSound(); } else { + //结束activity finish(); } } @@ -99,9 +105,12 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD return pm.isScreenOn(); } + //播放提示音的方法 private void playAlarmSound() { + //获取默认提示音id Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM); + //是否为静音模式 int silentModeStreams = Settings.System.getInt(getContentResolver(), Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); @@ -160,6 +169,8 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD } //该方法实现了停止闹钟铃声 + //如果实例化播放器类存在,执行操作 + //否则,跳过此方法 private void stopAlarmSound() { if (mPlayer != null) { mPlayer.stop();