fix crashes
This commit is contained in:
parent
4e08a66863
commit
571fe9e226
12 changed files with 58 additions and 4 deletions
|
|
@ -55,5 +55,5 @@ android {
|
|||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.github.axet:android-audio-library:1.0.94' // compile project(':android-audio-library')
|
||||
compile 'com.github.axet:android-audio-library:1.0.96' // compile project(':android-audio-library')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import android.widget.Toast;
|
|||
import com.github.axet.androidlibrary.animations.MarginBottomAnimation;
|
||||
import com.github.axet.androidlibrary.sound.AudioTrack;
|
||||
import com.github.axet.androidlibrary.widgets.AppCompatThemeActivity;
|
||||
import com.github.axet.androidlibrary.widgets.OpenFileDialog;
|
||||
import com.github.axet.audiolibrary.app.RawSamples;
|
||||
import com.github.axet.audiolibrary.app.Sound;
|
||||
import com.github.axet.audiolibrary.encoders.Encoder;
|
||||
|
|
@ -632,7 +633,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
stopRecording();
|
||||
storage.delete(storage.getTempRecording());
|
||||
Storage.delete(storage.getTempRecording());
|
||||
finish();
|
||||
}
|
||||
}, null);
|
||||
|
|
@ -969,6 +970,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
}
|
||||
} catch (RuntimeException e) {
|
||||
Error(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1001,7 +1003,11 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
if (shared.getBoolean(MainApplication.PREFERENCE_SKIP, false))
|
||||
encoder.filters.add(new SkipSilenceFilter(getInfo()));
|
||||
|
||||
RecordingService.startService(this, Storage.getDocumentName(targetUri), thread != null, encoder != null);
|
||||
encoding(encoder, fly, last);
|
||||
}
|
||||
|
||||
void encoding(final FileEncoder encoder, final OnFlyEncoding fly, final Runnable last) {
|
||||
RecordingService.startService(this, Storage.getDocumentName(fly.targetUri), thread != null, encoder != null);
|
||||
|
||||
final ProgressDialog d = new ProgressDialog(this);
|
||||
d.setTitle(R.string.encoding_title);
|
||||
|
|
@ -1020,7 +1026,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
}, new Runnable() {
|
||||
@Override
|
||||
public void run() { // success
|
||||
Storage.delete(in); // delete raw recording
|
||||
Storage.delete(encoder.in); // delete raw recording
|
||||
|
||||
last.run();
|
||||
|
||||
|
|
@ -1087,6 +1093,29 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
finish();
|
||||
}
|
||||
});
|
||||
final File in = storage.getTempRecording();
|
||||
if (in.length() > 0) {
|
||||
builder.setNeutralButton(R.string.save_as_wav, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final OpenFileDialog d = new OpenFileDialog(RecordingActivity.this, OpenFileDialog.DIALOG_TYPE.FOLDER_DIALOG);
|
||||
d.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
OnFlyEncoding fly = new OnFlyEncoding(storage, storage.getNewFile(d.getCurrentPath(), "wav"), getInfo());
|
||||
FileEncoder encoder = new FileEncoder(RecordingActivity.this, in, fly);
|
||||
encoding(encoder, fly, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.show();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,4 +50,20 @@ public class Storage extends com.github.axet.audiolibrary.app.Storage {
|
|||
}
|
||||
}
|
||||
|
||||
public File getNewFile(File path, String ext) {
|
||||
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
String format = "%s";
|
||||
|
||||
format = shared.getString(MainApplication.PREFERENCE_FORMAT, format);
|
||||
|
||||
format = getFormatted(format, new Date());
|
||||
|
||||
File f = path;
|
||||
if (!f.exists() && !f.mkdirs()) {
|
||||
throw new RuntimeException("Unable to create: " + path);
|
||||
}
|
||||
return getNextFile(f, format, ext);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -59,4 +59,5 @@
|
|||
<string name="pref_fly_summary">Η ενεργοποίηση της άμεσης κωδικοποίησης απενεργοποιεί την επεξεργασία και την ανάκτηση από κατάρευση</string>
|
||||
<string name="hold_by_bluetooth">παύση (αποσύνδεση bluetooth)</string>
|
||||
<string name="menu_search">Αναζήτηση</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_title">Кодирование на лету</string>
|
||||
<string name="pref_fly_summary">Кодирование на лету отключает редактирование и восстановление в случае ошибок</string>
|
||||
<string name="menu_search">Поиск</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -65,4 +65,5 @@
|
|||
<string name="pref_fly_summary">Encoding on fly disable editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -102,4 +102,5 @@
|
|||
<string name="pref_fly_summary">Enabling encoding on fly disables editing, and crash recovery</string>
|
||||
<string name="hold_by_bluetooth">pause (bluetooth disconnected)</string>
|
||||
<string name="menu_search">Search</string>
|
||||
<string name="save_as_wav">Save as WAV</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue