add recording name format
This commit is contained in:
parent
8302f9d464
commit
634a11feed
7 changed files with 78 additions and 2 deletions
|
|
@ -43,5 +43,5 @@ android {
|
|||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.github.axet:android-audio-library:0.0.49' // compile project(':android-audio-library')
|
||||
compile 'com.github.axet:android-audio-library:0.0.50' // compile project(':android-audio-library')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import com.github.axet.androidlibrary.animations.MarginBottomAnimation;
|
|||
import com.github.axet.androidlibrary.sound.AudioTrack;
|
||||
import com.github.axet.audiolibrary.app.RawSamples;
|
||||
import com.github.axet.audiolibrary.app.Sound;
|
||||
import com.github.axet.audiolibrary.app.Storage;
|
||||
import com.github.axet.audiolibrary.encoders.Encoder;
|
||||
import com.github.axet.audiolibrary.encoders.EncoderInfo;
|
||||
import com.github.axet.audiolibrary.encoders.Factory;
|
||||
|
|
@ -45,6 +44,7 @@ import com.github.axet.audiolibrary.encoders.FileEncoder;
|
|||
import com.github.axet.audiolibrary.widgets.PitchView;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
import com.github.axet.audiorecorder.app.MainApplication;
|
||||
import com.github.axet.audiorecorder.app.Storage;
|
||||
import com.github.axet.audiorecorder.services.RecordingService;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
|||
bindPreferenceSummaryToValue(pm.findPreference(MainApplication.PREFERENCE_RATE));
|
||||
bindPreferenceSummaryToValue(pm.findPreference(MainApplication.PREFERENCE_THEME));
|
||||
bindPreferenceSummaryToValue(pm.findPreference(MainApplication.PREFERENCE_CHANNELS));
|
||||
bindPreferenceSummaryToValue(pm.findPreference(MainApplication.PREFERENCE_FORMAT));
|
||||
}
|
||||
|
||||
public static int getAppTheme(Context context) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.github.axet.audiorecorder.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class Storage extends com.github.axet.audiolibrary.app.Storage {
|
||||
|
||||
SimpleDateFormat SIMPLE = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
|
||||
SimpleDateFormat ISO8601 = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
|
||||
|
||||
public Storage(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getNewFile() {
|
||||
|
||||
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String ext = shared.getString(MainApplication.PREFERENCE_ENCODING, "");
|
||||
|
||||
String format = "%s";
|
||||
|
||||
format = shared.getString(MainApplication.PREFERENCE_FORMAT, format);
|
||||
|
||||
format = format.replaceAll("%s", SIMPLE.format(new Date()));
|
||||
format = format.replaceAll("%I", ISO8601.format(new Date()));
|
||||
format = format.replaceAll("%T", "" + System.currentTimeMillis() / 1000);
|
||||
|
||||
File parent = getStoragePath();
|
||||
if (!parent.exists()) {
|
||||
if (!parent.mkdirs())
|
||||
throw new RuntimeException("Unable to create: " + parent);
|
||||
}
|
||||
|
||||
return getNextFile(parent, format, ext);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,6 +41,18 @@
|
|||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="format_text" translatable="false">
|
||||
<item>2017-02-01 09.08.01.wav</item>
|
||||
<item>1487926249.wav</item>
|
||||
<item>20170528T043902.wav</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="format_values" formatted="false" translatable="false">
|
||||
<item>%s</item>
|
||||
<item>%T</item>
|
||||
<item>%I</item>
|
||||
</string-array>
|
||||
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="not_permitted">Not permitted</string>
|
||||
<string name="no_folder_app">No folder view application installed</string>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@
|
|||
android:summary="Режим записи"
|
||||
android:title="Режим" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="%s"
|
||||
android:entries="@array/format_text"
|
||||
android:entryValues="@array/format_values"
|
||||
android:key="format"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:summary="2015-12-31 22:11:34"
|
||||
android:title="Имя Нового Файла" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="call"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@
|
|||
android:summary="Recording channels"
|
||||
android:title="Mode" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="%s"
|
||||
android:entries="@array/format_text"
|
||||
android:entryValues="@array/format_values"
|
||||
android:key="format"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:summary="2015-12-31 22:11:34"
|
||||
android:title="Name Format" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="call"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue