Merge branch 'audiorecorder-3.2.16'
This commit is contained in:
commit
c32e788047
16 changed files with 56 additions and 18 deletions
|
|
@ -10,8 +10,8 @@ android {
|
|||
applicationId "com.github.axet.audiorecorder"
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 23 // 24+ file:// unable to open
|
||||
versionCode 273
|
||||
versionName "3.2.15"
|
||||
versionCode 274
|
||||
versionName "3.2.16"
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
|
|
@ -57,5 +57,5 @@ android {
|
|||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation 'com.github.axet:android-audio-library:1.0.113' // implementation project(':android-audio-library')
|
||||
implementation 'com.github.axet:android-audio-library:1.0.115' // implementation project(':android-audio-library')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import android.media.AudioManager;
|
|||
import android.media.AudioRecord;
|
||||
import android.media.MediaRecorder;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
|
|
@ -61,6 +62,7 @@ import com.github.axet.audiorecorder.services.RecordingService;
|
|||
|
||||
import java.io.File;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class RecordingActivity extends AppCompatThemeActivity {
|
||||
|
|
@ -700,7 +702,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
|
||||
void startRecording() {
|
||||
try {
|
||||
startRecordingError();
|
||||
startRecordingTry();
|
||||
} catch (RuntimeException e) {
|
||||
Log.d(TAG, "unable to start", e);
|
||||
Toast.makeText(RecordingActivity.this, "Unable to initialize AudioRecord", Toast.LENGTH_SHORT).show();
|
||||
|
|
@ -708,7 +710,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
}
|
||||
}
|
||||
|
||||
void startRecordingError() {
|
||||
void startRecordingTry() {
|
||||
headset(true, true);
|
||||
|
||||
edit(false, true);
|
||||
|
|
@ -723,13 +725,22 @@ public class RecordingActivity extends AppCompatThemeActivity {
|
|||
|
||||
pitch.record();
|
||||
|
||||
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
TreeMap<String, Integer> map = new TreeMap<>();
|
||||
map.put(getString(R.string.source_mic), MediaRecorder.AudioSource.MIC);
|
||||
map.put(getString(R.string.source_default), MediaRecorder.AudioSource.DEFAULT);
|
||||
if (Sound.isUnprocessedSupported(this))
|
||||
map.put(getString(R.string.source_raw), MediaRecorder.AudioSource.UNPROCESSED);
|
||||
else
|
||||
map.put(getString(R.string.source_raw), MediaRecorder.AudioSource.VOICE_RECOGNITION);
|
||||
|
||||
int[] ss = new int[]{
|
||||
map.get(shared.getString(MainApplication.PREFERENCE_SOURCE, getString(R.string.source_mic))),
|
||||
MediaRecorder.AudioSource.MIC,
|
||||
MediaRecorder.AudioSource.DEFAULT
|
||||
};
|
||||
|
||||
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
if (shared.getBoolean(MainApplication.PREFERENCE_FLY, false)) {
|
||||
final OnFlyEncoding fly = new OnFlyEncoding(storage, targetUri, getInfo());
|
||||
if (e == null) { // do not recreate encoder if on-fly mode enabled
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import android.preference.PreferenceActivity;
|
|||
import android.preference.PreferenceFragment;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
|
|
@ -24,17 +22,14 @@ import android.support.v7.preference.PreferenceManager;
|
|||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.axet.androidlibrary.widgets.AppCompatSettingsThemeActivity;
|
||||
import com.github.axet.androidlibrary.widgets.NameFormatPreferenceCompat;
|
||||
import com.github.axet.androidlibrary.widgets.OpenFileDialog;
|
||||
import com.github.axet.androidlibrary.widgets.SeekBarPreference;
|
||||
import com.github.axet.androidlibrary.widgets.SilencePreferenceCompat;
|
||||
import com.github.axet.androidlibrary.widgets.StoragePathPreferenceCompat;
|
||||
import com.github.axet.androidlibrary.widgets.ThemeUtils;
|
||||
import com.github.axet.audiolibrary.app.Sound;
|
||||
import com.github.axet.audiolibrary.encoders.Factory;
|
||||
import com.github.axet.audiolibrary.widgets.RecordingVolumePreference;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
|
|
@ -204,6 +199,12 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
|
|||
if (key.equals(MainApplication.PREFERENCE_STORAGE)) {
|
||||
Storage.migrateLocalStorageDialog(this, handler, new Storage(this));
|
||||
}
|
||||
if (key.equals(MainApplication.PREFERENCE_RATE)) {
|
||||
int sampleRate = Integer.parseInt(sharedPreferences.getString(MainApplication.PREFERENCE_RATE, ""));
|
||||
if (sampleRate != Sound.getValidRecordRate(Sound.getInMode(this), sampleRate)) {
|
||||
Toast.makeText(this, "Not supported Hz", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -273,7 +274,7 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
|
|||
s.setStorageAccessFramework(this, RESULT_STORAGE);
|
||||
|
||||
AudioManager am = (AudioManager) context.getSystemService(AUDIO_SERVICE);
|
||||
Preference bluetooth = pm.findPreference(MainApplication.PREFERENCE_BLUETOOTH);
|
||||
Preference bluetooth = pm.findPreference(MainApplication.PREFERENCE_SOURCE);
|
||||
if (!am.isBluetoothScoAvailableOffCall()) {
|
||||
bluetooth.setVisible(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import android.content.SharedPreferences;
|
|||
import android.os.Build;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
|
||||
import com.github.axet.audiolibrary.encoders.FormatFLAC;
|
||||
import com.github.axet.audiolibrary.encoders.FormatM4A;
|
||||
import com.github.axet.audiolibrary.encoders.FormatOGG;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
|
||||
|
|
@ -13,7 +15,7 @@ public class MainApplication extends com.github.axet.audiolibrary.app.MainApplic
|
|||
public static final String PREFERENCE_CONTROLS = "controls";
|
||||
public static final String PREFERENCE_TARGET = "target";
|
||||
public static final String PREFERENCE_FLY = "fly";
|
||||
public static final String PREFERENCE_BLUETOOTH = "bluetooth";
|
||||
public static final String PREFERENCE_SOURCE = "bluetooth";
|
||||
|
||||
public static final String PREFERENCE_VERSION = "version";
|
||||
|
||||
|
|
@ -31,9 +33,9 @@ public class MainApplication extends com.github.axet.audiolibrary.app.MainApplic
|
|||
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor edit = shared.edit();
|
||||
if (Build.VERSION.SDK_INT >= 18)
|
||||
edit.putString(MainApplication.PREFERENCE_ENCODING, "m4a");
|
||||
edit.putString(MainApplication.PREFERENCE_ENCODING, FormatM4A.EXT);
|
||||
else
|
||||
edit.putString(MainApplication.PREFERENCE_ENCODING, "flac");
|
||||
edit.putString(MainApplication.PREFERENCE_ENCODING, FormatFLAC.EXT);
|
||||
edit.commit();
|
||||
}
|
||||
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public class BluetoothReceiver extends BroadcastReceiver {
|
|||
|
||||
public boolean isRecordingReady() {
|
||||
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (shared.getString(MainApplication.PREFERENCE_BLUETOOTH, context.getString(R.string.source_mic)).equals(context.getString(R.string.source_bluetooth))) {
|
||||
if (shared.getString(MainApplication.PREFERENCE_SOURCE, context.getString(R.string.source_mic)).equals(context.getString(R.string.source_bluetooth))) {
|
||||
bluetoothSource = true;
|
||||
if (!startBluetooth())
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
</string-array>
|
||||
<string-array name="source_text">
|
||||
<item>Μικρόφωνο</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
<string-array name="themes_text">
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mikrofon</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Микрофон</item>
|
||||
<item>По умолчанию</item>
|
||||
<item>Необработанный</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mikrofón</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@
|
|||
<attr name="recColor" format="color" />
|
||||
<attr name="cutColor" format="color" />
|
||||
<string name="source_mic" translatable="false">mic</string>
|
||||
<string name="source_default" translatable="false">default</string>
|
||||
<string name="source_raw" translatable="false">raw</string>
|
||||
<string name="source_bluetooth" translatable="false">bluetooth</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -23,11 +23,15 @@
|
|||
|
||||
<string-array name="source_text">
|
||||
<item>Mic</item>
|
||||
<item>Default</item>
|
||||
<item>Unprocessed</item>
|
||||
<item>Bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="source_values" translatable="false">
|
||||
<item>@string/source_mic</item>
|
||||
<item>@string/source_default</item>
|
||||
<item>@string/source_raw</item>
|
||||
<item>@string/source_bluetooth</item>
|
||||
</string-array>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue