Merge branch 'audiorecorder-3.0.35'

This commit is contained in:
Alexey Kuznetsov 2017-08-15 15:24:53 +03:00
commit a1ea5d58d2
3 changed files with 9 additions and 21 deletions

View file

@ -8,8 +8,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 23
versionCode 199
versionName "3.0.34"
versionCode 200
versionName "3.0.35"
}
signingConfigs {
release {
@ -43,5 +43,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.axet:android-audio-library:1.0.31' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:1.0.33' // compile project(':android-audio-library')
}

View file

@ -886,20 +886,8 @@ public class RecordingActivity extends AppCompatActivity {
try {
Uri root = Storage.getDocumentTreeUri(targetUri);
resolver.takePersistableUriPermission(root, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
String d = Storage.getDocumentName(targetUri);
String ee = storage.getExt(targetUri);
Uri docUri = DocumentsContract.buildDocumentUriUsingTree(targetUri, DocumentsContract.getTreeDocumentId(targetUri));
String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ee);
Uri childrenUri = DocumentsContract.createDocument(resolver, docUri, mime, d);
if (childrenUri == null)
throw new IOException("unable to create document " + d);
InputStream is = new FileInputStream(out);
OutputStream os = resolver.openOutputStream(childrenUri);
IOUtils.copy(is, os);
is.close();
os.close();
Storage.delete(out); // delete tmp encoding file
} catch (IOException e) {
storage.move(out, root, Storage.getDocumentPath(targetUri));
} catch (RuntimeException e) {
Storage.delete(out); // delete tmp encoding file
try {
storage.delete(targetUri); // delete SAF encoding file

View file

@ -61,11 +61,11 @@ public class RecordingService extends Service {
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
String f = shared.getString(MainApplication.PREFERENCE_TARGET, "");
String d;
Uri u = Uri.parse(f);
String s = u.getScheme();
if (s.equals(ContentResolver.SCHEME_CONTENT)) {
if (f.startsWith(ContentResolver.SCHEME_CONTENT)) {
Uri u = Uri.parse(f);
d = Storage.getDocumentName(u);
} else if (s.equals(ContentResolver.SCHEME_FILE)) {
} else if (f.startsWith(ContentResolver.SCHEME_FILE)) {
Uri u = Uri.parse(f);
File file = new File(u.getPath());
d = file.getName();
} else {