Merge branch 'audiorecorder-3.1.25'

This commit is contained in:
Alexey Kuznetsov 2018-03-16 21:56:40 +03:00
commit f87ad60408
5 changed files with 32 additions and 10 deletions

View file

@ -10,8 +10,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 23 // 24+ file:// unable to open
versionCode 255
versionName "3.1.24"
versionCode 256
versionName "3.1.25"
}
signingConfigs {
release {
@ -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.91' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:1.0.93' // compile project(':android-audio-library')
}

View file

@ -993,10 +993,10 @@ public class RecordingActivity extends AppCompatThemeActivity {
encoder = new FileEncoder(this, in, fly);
if (shared.getBoolean(MainApplication.PREFERENCE_VOICE, false))
encoder.filters.add(new VoiceFilter(getInfo().hz));
encoder.filters.add(new VoiceFilter(getInfo()));
float amp = shared.getFloat(MainApplication.PREFERENCE_VOLUME, 0);
if (amp > 0)
encoder.filters.add(new AmplifierFilter(1 + amp));
if (amp != 1)
encoder.filters.add(new AmplifierFilter(amp));
RecordingService.startService(this, Storage.getDocumentName(targetUri), thread != null, encoder != null);

View file

@ -35,6 +35,7 @@ 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.encoders.Factory;
import com.github.axet.audiolibrary.widgets.RecordingVolumePreference;
import com.github.axet.audiorecorder.R;
import com.github.axet.audiorecorder.app.MainApplication;
import com.github.axet.audiorecorder.app.Storage;
@ -80,7 +81,7 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
String key = preference.getKey();
if (preference instanceof SeekBarPreference) {
preference.setSummary(((SeekBarPreference) preference).format(Float.valueOf(stringValue)));
preference.setSummary(((SeekBarPreference) preference).format((Float) value));
} else if (preference instanceof NameFormatPreferenceCompat) {
preference.setSummary(((NameFormatPreferenceCompat) preference).getFormatted(stringValue));
} else if (preference instanceof ListPreference) {
@ -218,7 +219,7 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
return true;
}
if (pref instanceof SeekBarPreference) {
SeekBarPreference.show(caller, pref.getKey());
RecordingVolumePreference.show(caller, pref.getKey());
return true;
}
return false;

View file

@ -15,6 +15,8 @@ public class MainApplication extends com.github.axet.audiolibrary.app.MainApplic
public static final String PREFERENCE_FLY = "fly";
public static final String PREFERENCE_BLUETOOTH = "bluetooth";
public static final String PREFERENCE_VERSION = "version";
public int getUserTheme() {
return getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark);
}
@ -34,8 +36,27 @@ public class MainApplication extends com.github.axet.audiolibrary.app.MainApplic
edit.putString(MainApplication.PREFERENCE_ENCODING, "flac");
edit.commit();
}
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = shared.edit();
edit.putInt(PREFERENCE_VERSION, 1);
edit.commit();
} else { // second start, check version
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
switch (shared.getInt(PREFERENCE_VERSION, 0)) {
case 0:
version_0_to_1();
break;
}
}
setTheme(getUserTheme());
}
void version_0_to_1() {
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = shared.edit();
edit.putInt(PREFERENCE_VERSION, 1);
edit.putFloat(PREFERENCE_VOLUME, shared.getFloat(PREFERENCE_VOLUME, 0) + 1); // update volume from 0..1 to 0..1..4
edit.commit();
}
}

View file

@ -63,8 +63,8 @@
android:key="voice"
android:summary="@string/pref_voice_summary"
android:title="@string/pref_voice_title" />
<com.github.axet.androidlibrary.widgets.SeekBarPreference
android:defaultValue="0"
<com.github.axet.audiolibrary.widgets.RecordingVolumePreference
android:defaultValue="1"
android:key="volume"
android:summary=""
android:title="@string/pref_volume_title" />