Skip to content

Commit

Permalink
Updated HBRecorder class for when no parameters are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
HBiSoft committed Aug 14, 2019
1 parent 3510b24 commit 73b2f37
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
15 changes: 0 additions & 15 deletions hbrecorder/src/main/java/com/hbisoft/hbrecorder/HBRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,6 @@ private void startService(Intent data) {
observer = new FileObserver(String.valueOf(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)), activity, HBRecorder.this);
observer.startWatching();

if (audioBitrate == 0){
audioBitrate = 128000;
}
if (audioSamplingRate == 0){
audioSamplingRate = 44100;
}

if (notificationTitle.equals("")){
notificationTitle = "Recording your screen";
}

if (notificationDescription.equals("")){
notificationDescription = "Drag down to stop the recording";
}

Intent service = new Intent(context, ScreenRecordService.class);
service.putExtra("code", resultCode);
service.putExtra("data", data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,39 @@ public int onStartCommand(Intent intent, int flags, int startId) {
String notificationDescription = intent.getStringExtra("notificationDescription");
boolean shouldShowNotification = intent.getBooleanExtra("shouldShowNotification", true);
String notificationButtonText = intent.getStringExtra("notificationButtonText");
mResultCode = intent.getIntExtra("code", -1);
mResultData = intent.getParcelableExtra("data");
mScreenWidth = intent.getIntExtra("width", 720);
mScreenHeight = intent.getIntExtra("height", 1280);
mScreenDensity = intent.getIntExtra("density", 1);
isVideoHD = intent.getBooleanExtra("quality", true);
isAudioEnabled = intent.getBooleanExtra("audio", true);
path = intent.getStringExtra("path");
name = intent.getStringExtra("fileName");

filePath = name;
audioBitrate = intent.getIntExtra("audioBitrate", 128000);
audioSamplingRate = intent.getIntExtra("audioSamplingRate", 44100);

if (notificationButtonText==null){
notificationButtonText = "STOP RECORDING";
}

if (audioBitrate == 0){
audioBitrate = 128000;
}
if (audioSamplingRate == 0){
audioSamplingRate = 44100;
}

if (notificationTitle == null || notificationTitle.equals("")){
notificationTitle = "Recording your screen";
}

if (notificationDescription == null || notificationDescription.equals("")){
notificationDescription = "Drag down to stop the recording";
}

//Check if notification should be shown
if (shouldShowNotification) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand Down Expand Up @@ -110,19 +138,6 @@ public int onStartCommand(Intent intent, int flags, int startId) {
* Notification End
*/

mResultCode = intent.getIntExtra("code", -1);
mResultData = intent.getParcelableExtra("data");
mScreenWidth = intent.getIntExtra("width", 720);
mScreenHeight = intent.getIntExtra("height", 1280);
mScreenDensity = intent.getIntExtra("density", 1);
isVideoHD = intent.getBooleanExtra("quality", true);
isAudioEnabled = intent.getBooleanExtra("audio", true);
path = intent.getStringExtra("path");
name = intent.getStringExtra("fileName");

filePath = name;
audioBitrate = intent.getIntExtra("audioBitrate", 128000);
audioSamplingRate = intent.getIntExtra("audioSamplingRate", 44100);

if (path == null) {
path = String.valueOf(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES));
Expand Down

0 comments on commit 73b2f37

Please sign in to comment.