diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 340e2d0..f8dbc1b 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -5,7 +5,7 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index 74a6c5b..7cf92b6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,13 @@ + + + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/release/HBRecorderDemo.apk b/app/release/HBRecorderDemo.apk index 6df95a4..e77df69 100644 Binary files a/app/release/HBRecorderDemo.apk and b/app/release/HBRecorderDemo.apk differ diff --git a/app/src/main/java/com/hbisoft/hbrecorderexample/MainActivity.java b/app/src/main/java/com/hbisoft/hbrecorderexample/MainActivity.java index 482dcfa..30e64c6 100644 --- a/app/src/main/java/com/hbisoft/hbrecorderexample/MainActivity.java +++ b/app/src/main/java/com/hbisoft/hbrecorderexample/MainActivity.java @@ -503,7 +503,8 @@ private void quickSettings() { hbRecorder.recordHDVideo(wasHDSelected); hbRecorder.isAudioEnabled(isAudioEnabled); //Customise Notification - hbRecorder.setNotificationSmallIcon(drawable2ByteArray(R.drawable.icon)); + hbRecorder.setNotificationSmallIcon(R.drawable.icon); + //hbRecorder.setNotificationSmallIconVector(R.drawable.ic_baseline_videocam_24); hbRecorder.setNotificationTitle(getString(R.string.stop_recording_notification_title)); hbRecorder.setNotificationDescription(getString(R.string.stop_recording_notification_message)); } diff --git a/hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java b/hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java index c6f484c..aef46d9 100644 --- a/hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java +++ b/hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java @@ -58,6 +58,7 @@ public class HBRecorder implements MyListener { private FileObserver observer; private final HBRecorderListener hbRecorderListener; private byte[] byteArray; + private int vectorDrawable = 0; private String audioSource = "MIC"; private String videoEncoder = "DEFAULT"; private boolean enableCustomSettings = false; @@ -260,7 +261,7 @@ public boolean isBusyRecording() { return false; } - /*Change notification icon*/ + /*Change notification icon Drawable*/ public void setNotificationSmallIcon(@DrawableRes int drawable) { Bitmap icon = BitmapFactory.decodeResource(context.getResources(), drawable); ByteArrayOutputStream stream = new ByteArrayOutputStream(); @@ -268,7 +269,12 @@ public void setNotificationSmallIcon(@DrawableRes int drawable) { byteArray = stream.toByteArray(); } - /*Change notification icon*/ + /*Change notification icon using Vector Drawable*/ + public void setNotificationSmallIconVector(@DrawableRes int VectorDrawable) { + vectorDrawable = VectorDrawable; + } + + /*Change notification icon using byte[]*/ public void setNotificationSmallIcon(byte[] bytes) { byteArray = bytes; } @@ -318,6 +324,7 @@ private void startService(Intent data) { service.putExtra("audioBitrate", audioBitrate); service.putExtra("audioSamplingRate", audioSamplingRate); service.putExtra("notificationSmallBitmap", byteArray); + service.putExtra("notificationSmallVector", vectorDrawable); service.putExtra("notificationTitle", notificationTitle); service.putExtra("notificationDescription", notificationDescription); service.putExtra("notificationButtonText", notificationButtonText); diff --git a/hbrecorder/src/main/java/com/hbisoft/hbrecorder/ScreenRecordService.java b/hbrecorder/src/main/java/com/hbisoft/hbrecorder/ScreenRecordService.java index 7dde5e1..318e198 100755 --- a/hbrecorder/src/main/java/com/hbisoft/hbrecorder/ScreenRecordService.java +++ b/hbrecorder/src/main/java/com/hbisoft/hbrecorder/ScreenRecordService.java @@ -108,6 +108,7 @@ else if (pauseResumeAction != null && pauseResumeAction.equals("resume")){ mIntent = intent; maxFileSize = intent.getLongExtra(MAX_FILE_SIZE_KEY, NO_SPECIFIED_MAX_SIZE); byte[] notificationSmallIcon = intent.getByteArrayExtra("notificationSmallBitmap"); + int notificationSmallVector = intent.getIntExtra("notificationSmallVector", 0); String notificationTitle = intent.getStringExtra("notificationTitle"); String notificationDescription = intent.getStringExtra("notificationDescription"); String notificationButtonText = intent.getStringExtra("notificationButtonText"); @@ -208,7 +209,11 @@ else if (pauseResumeAction != null && pauseResumeAction.equals("resume")){ //Modify notification badge notification = new Notification.Builder(getApplicationContext(), channelId).setOngoing(true).setSmallIcon(Icon.createWithBitmap(bmp)).setContentTitle(notificationTitle).setContentText(notificationDescription).addAction(action).build(); - } else { + } else if (notificationSmallVector != 0){ + notification = new Notification.Builder(getApplicationContext(), channelId).setOngoing(true).setSmallIcon(notificationSmallVector).setContentTitle(notificationTitle).setContentText(notificationDescription).addAction(action).build(); + } + + else { //Modify notification badge notification = new Notification.Builder(getApplicationContext(), channelId).setOngoing(true).setSmallIcon(R.drawable.icon).setContentTitle(notificationTitle).setContentText(notificationDescription).addAction(action).build(); }