diff --git a/app/build.gradle b/app/build.gradle
index 0a0670d..7fc2533 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 29
+ compileSdkVersion 30
defaultConfig {
applicationId "com.hbisoft.hbrecorderexample"
minSdkVersion 17
- targetSdkVersion 29
+ targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -20,12 +20,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.2.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test:runner:1.3.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation project(path: ':hbrecorder')
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a7cdaa1..cfcdf8a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,10 +7,13 @@
-
+
= Build.VERSION_CODES.LOLLIPOP) {
//Update gallery depending on SDK Level
if (hbRecorder.wasUriSet()) {
- updateGalleryUri();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ) {
+ updateGalleryUri();
+ } else {
+ refreshGalleryFile();
+ }
}else{
refreshGalleryFile();
}
@@ -282,6 +290,7 @@ public void onScanCompleted(String path, Uri uri) {
});
}
+ @RequiresApi(api = Build.VERSION_CODES.Q)
private void updateGalleryUri(){
contentValues.clear();
contentValues.put(MediaStore.Video.Media.IS_PENDING, 0);
@@ -297,10 +306,12 @@ public void HBRecorderOnError(int errorCode, String reason) {
//It is best to use device default
- if (errorCode == 38) {
- showLongToast("Some settings are not supported by your device");
+ if (errorCode == SETTINGS_ERROR) {
+ showLongToast(getString(R.string.settings_not_supported_message));
+ } else if ( errorCode == MAX_FILE_SIZE_REACHED_ERROR) {
+ showLongToast(getString(R.string.max_file_size_reached_message));
} else {
- showLongToast("HBRecorderOnError - See Log");
+ showLongToast(getString(R.string.general_recording_error_message));
Log.e("HBRecorderOnError", reason);
}
@@ -320,14 +331,13 @@ private void startRecordingScreen() {
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
Intent permissionIntent = mediaProjectionManager != null ? mediaProjectionManager.createScreenCaptureIntent() : null;
startActivityForResult(permissionIntent, SCREEN_RECORD_REQUEST_CODE);
- startbtn.setText(R.string.stop_recording);
} else {
quickSettings();
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
Intent permissionIntent = mediaProjectionManager != null ? mediaProjectionManager.createScreenCaptureIntent() : null;
startActivityForResult(permissionIntent, SCREEN_RECORD_REQUEST_CODE);
- startbtn.setText(R.string.stop_recording);
}
+ startbtn.setText(R.string.stop_recording);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@@ -477,6 +487,9 @@ private void customSettings() {
}
}
+ // Max File Size
+ setRecorderMaxFileSize();
+
}
//Get/Set the selected settings
@@ -488,8 +501,21 @@ private void quickSettings() {
hbRecorder.isAudioEnabled(isAudioEnabled);
//Customise Notification
hbRecorder.setNotificationSmallIcon(drawable2ByteArray(R.drawable.icon));
- hbRecorder.setNotificationTitle("Recording your screen");
- hbRecorder.setNotificationDescription("Drag down to stop the recording");
+ hbRecorder.setNotificationTitle(getString(R.string.stop_recording_notification_title));
+ hbRecorder.setNotificationDescription(getString(R.string.stop_recording_notification_message));
+ setRecorderMaxFileSize();
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ private void setRecorderMaxFileSize() {
+ String s = maxFileSizeInK.getText().toString();
+ long maxFileSizeInKilobytes;
+ try {
+ maxFileSizeInKilobytes = Long.parseLong(s);
+ } catch (NumberFormatException e) {
+ maxFileSizeInKilobytes = 0;
+ }
+ hbRecorder.setMaxFileSize(maxFileSizeInKilobytes * 1024); // Convert to bytes
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index bf4ac6d..3912106 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,24 +1,50 @@
-
+
+
+
+
+
+
+
+
+ android:alpha="0.5"
+ tools:ignore="ContentDescription" />
+ app:theme="@style/CheckboxStyle"/>
+ android:alpha="0.5"
+ tools:ignore="ContentDescription" />
- Record Audio
High Definition
Standard Definition
+ Max File Size (k)
Settings
Settings
@@ -23,4 +24,13 @@
key_video_encoder
key_audio_source
key_output_format
+ QUICK SETTINGS
+ USE CUSTOM SETTINGS
+ or
+ Blank == no max
+ Drag down to stop the recording
+ Recording your screen
+ Some settings are not supported by your device
+ The file reached the designated max size
+ HBRecorderOnError - See Log
diff --git a/app/src/main/res/xml/backup_descriptor.xml b/app/src/main/res/xml/backup_descriptor.xml
new file mode 100644
index 0000000..c5a9969
--- /dev/null
+++ b/app/src/main/res/xml/backup_descriptor.xml
@@ -0,0 +1,5 @@
+
+
+
+
+