Commit 5b198380 authored by mistermad's avatar mistermad

- Add consent file (pdf) generation

- Bug fix on speaker profile managment
parent 6973a854
......@@ -9,9 +9,8 @@ android {
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
versionCode 2
versionName "2.0"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 3
versionName "3.0"
}
buildTypes {
release {
......@@ -20,18 +19,12 @@ android {
}
}
configurations {
//all*.exclude group: 'com.android.support', module: 'support-v4'
//all*.exclude group: 'com.android.support', module: 'support-compat'
//all*.exclude group: 'com.android.support', module: 'support-annotations'
}
configurations {}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/aikuma-cloud-storage-0.8.0.jar')
//compile files('libs/android-support-v4.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.1.jar')
compile files('libs/commons-net-3.1.jar')
......@@ -43,16 +36,14 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
//exclude module: 'support-v4'
})
compile('com.android.support:appcompat-v7:25.3.1') {
//exclude module: 'support-annotations'
}
compile project(path: ':library')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-core-utils:25.3.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.itextpdf:itextg:5.5.10'
testCompile 'junit:junit:4.12'
}
......@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.getalp.ligaikuma.lig_aikuma.lig_aikuma"
android:versionCode="1"
android:versionName="1.0">
android:versionCode="3"
android:versionName="3.0">
<uses-sdk android:minSdkVersion="14"/>
......@@ -274,6 +274,8 @@
android:configChanges="orientation|screenSize"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.SpeakerActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ShareFile">
</activity>
</application>
</manifest>
\ No newline at end of file
......@@ -651,19 +651,6 @@ public class MainActivity extends ListActivity {
}}):
new String[0];
}
/* OLD
if(dir.exists()) {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String filename) {
File sel = new File(dir, filename);
return filename.contains(fileType) || sel.isDirectory();
}
};
mFileList = mPath.list(filter);
}
else
mFileList = new String[0];
*/
/**
* Presents the dialog for choosing audio files to the user.
......@@ -673,7 +660,6 @@ public class MainActivity extends ListActivity {
new FilebrowserDialogFragment().show(getFragmentManager().beginTransaction(), "dialog");
}
/**
* Used to display audio files that the user can choose to load from.
* Reported as an error but is it not.
......
......@@ -18,8 +18,10 @@ import org.getalp.ligaikuma.lig_aikuma.ui.CheckTranscription;
import org.getalp.ligaikuma.lig_aikuma.ui.CheckWordVariant;
import org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode;
import org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitation;
import org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity1;
import org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig;
import org.getalp.ligaikuma.lig_aikuma.ui.RespeakingSelection;
import org.getalp.ligaikuma.lig_aikuma.ui.ShareFile;
import org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivityLig;
import org.getalp.ligaikuma.lig_aikuma.ui.sensors.LocationDetector;
import org.getalp.ligaikuma.lig_aikuma.util.AikumaSettings;
......@@ -161,6 +163,11 @@ public class ModeSelection extends Activity implements OnClickListener{
super.onDestroy();
MainActivity.locationDetector.stop();
}
public void onShareButtonClick(View _v)
{
startActivity(new Intent(this, ShareFile.class));
}
public void showSessionDialog() {
new UserSessionDiaglogFragment().show(getFragmentManager(), "SessionDialogFragment");
......
......@@ -12,6 +12,9 @@ public class SpeakerProfile
{
public static String TAG = "SpeakerProfile";
public static String splitKey1="§!§";
public static String splitKey2="§:§";
private String _name;
private int _birthYear;
private int _gender;
......@@ -22,6 +25,9 @@ public class SpeakerProfile
private String _region;
private String _note;
private boolean _signature;
private static SpeakerProfile _lastSpeaker = null;
/** Build profile with all informations
*
......@@ -35,9 +41,10 @@ public class SpeakerProfile
* @param note free field for annotation
*/
public SpeakerProfile(String name, int birthYear, int gender, Language recordLang, Language motherTongue,
ArrayList<Language> otherLanguages, String region, String note)
ArrayList<Language> otherLanguages, String region, String note, boolean signature)
{
init(name, birthYear, gender, recordLang, motherTongue, otherLanguages, region, note);
update(name, birthYear, gender, recordLang, motherTongue, otherLanguages, region, note);
_signature = signature;
}
/** Build new profile with key and context
......@@ -58,17 +65,19 @@ public class SpeakerProfile
ArrayList<Language> otherLanguages = new ArrayList<>();
String t = sp.getString("otherLanguages", null);
if(t != null)
for(String tmpS : t.split("§§"))
for(String tmpS : t.split(splitKey2))
{
tmpL = tmpS.split(" : ");
otherLanguages.add(new Language(tmpL[0],tmpL[1]));
}
init(sp.getString("name",""), sp.getInt("birdthYear",0), sp.getInt("gender",2),
update(sp.getString("name",""), sp.getInt("birdthYear",0), sp.getInt("gender",2),
recordLang, motherTongue, otherLanguages, sp.getString("region",""), sp.getString("note",""));
_signature = sp.getBoolean("signature",false);
}
private void init(String name, int birthYear, int gender, Language recordLang, Language motherTongue,
public void update(String name, int birthYear, int gender, Language recordLang, Language motherTongue,
ArrayList<Language> otherLanguages, String region, String note)
{
_name = name;
......@@ -79,6 +88,7 @@ public class SpeakerProfile
_otherLanguages = otherLanguages;
_region = region;
_note = note;
_lastSpeaker = this;
}
/**
......@@ -87,7 +97,7 @@ public class SpeakerProfile
*/
public String getKey()
{
return _name+"_"+_recordLang.getCode();//+"_"+new SimpleDateFormat("yyMMdd").format(new Date());
return _name+splitKey1+_recordLang.getCode()+splitKey1+_motherTongue.getCode()+splitKey1+_name+splitKey1+_region+splitKey1+_birthYear+splitKey1+String.valueOf(_gender);
}
/** Checks if key exists in SharedPreferences
......@@ -116,12 +126,13 @@ public class SpeakerProfile
.putInt("gender", _gender)
.putString("recordLang", _recordLang.toString())
.putString("region", _region)
.putString("note", _note);
.putString("note", _note)
.putBoolean("signature", _signature);
if(_motherTongue!=null) edit.putString("motherTongue", _motherTongue.toString());
String l="";
for(int i=0;i<_otherLanguages.size();i++)
{
if(i!=0) l+="§§";
if(i!=0) l+=splitKey2;
l+=_otherLanguages.get(i).toString();
}
edit.putString("otherLanguages", l).apply();
......@@ -129,7 +140,7 @@ public class SpeakerProfile
// Save on key register
SharedPreferences sp = c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE);
String s = sp.getString("_all_keys","");
if(!s.isEmpty()) s+="§§";
if(!s.isEmpty()) s+=splitKey2;
sp.edit().putString("_all_keys",s+getKey()).apply();
return this;
......@@ -148,9 +159,10 @@ public class SpeakerProfile
// Remove key
SharedPreferences sp = c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE);
String t = sp.getString("_all_keys","").replace(key,"");
while(t.contains("§§§§")) t=t.replace("§§§§","§§");
sp.edit().putString("_all_keys",((t.equals("§§"))?"":t)).apply();
t=t.replace(splitKey2+splitKey2,splitKey2);
if(t.matches("^"+splitKey2))t=t.replaceFirst(splitKey2,"");
if(t.matches(splitKey2+"$"))t=t.substring(0,t.length()-splitKey2.length());
sp.edit().putString("_all_keys",((t.equals(splitKey2))?"":t)).apply();
}
/** Create new profile from profile key
......@@ -173,14 +185,14 @@ public class SpeakerProfile
String t = sp.getString("otherLanguages", null);
if(t != null && !t.isEmpty()) {
Log.d(TAG, "otherLanguages = "+t);
for(String tmpS : t.split("§§")) {
for(String tmpS : t.split(splitKey2)) {
tmpL = tmpS.split(" : ");
otherLanguages.add(new Language(tmpL[0], tmpL[1]));
}
}
return new SpeakerProfile(sp.getString("name",""), sp.getInt("birdthYear",0), sp.getInt("gender",RecordingMetadataLig.GENDER_UNSPECIFIED),
recordLang, motherTongue, otherLanguages, sp.getString("region",""), sp.getString("note",""));
recordLang, motherTongue, otherLanguages, sp.getString("region",""), sp.getString("note",""), sp.getBoolean("signature", false));
}
/** Get all speaker key
......@@ -192,8 +204,8 @@ public class SpeakerProfile
{
//c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE).edit().putString("_all_keys","").apply();
String t = c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE).getString("_all_keys",null);
Log.d(TAG, t.replace("§§", " | "));
return (t!=null&&!t.isEmpty())? t.split("§§"): null;
Log.d(TAG, "MAD ALL Keys: "+t.replace(splitKey2, " | "));
return !t.isEmpty() ? t.split(splitKey2): null;
}
/** get String to display it
......@@ -202,30 +214,46 @@ public class SpeakerProfile
*/
public String toString()
{
String r = _name+" | ";
r+= _birthYear+" | ";
String r = _name+" | " + _birthYear+" | ";
switch(_gender)
{
case RecordingMetadataLig.GENDER_MALE: r+= "Male | "; break;
case RecordingMetadataLig.GENDER_FEMALE: r+= "Female | "; break;
case RecordingMetadataLig.GENDER_UNSPECIFIED: r+= "Unspecified | "; break;
}
r+= _recordLang.toString()+" | ";
r+= ((_motherTongue!=null)?_motherTongue.toString():"")+" | ";
r+= _recordLang.toString()+" | " + ((_motherTongue!=null)?_motherTongue.toString():"")+" | ";
if(_otherLanguages!=null) for(Language l : _otherLanguages) r+= l.toString()+" | ";
return r+_region+" | "+_note;
return r+_region+" | "+_note+((_signature)?" | signed":" | unsigned");
}
/** Checks if a speaker profile already exists in the list using the identification key
*
* @param c Contexe of activity
* @param speaker_profile Speaker profile to check
* @return true if profile exist, false otherwise.
*/
public static boolean profilExist(Context c, SpeakerProfile speaker_profile)
{
String[] ak = getAllKeys(c);
if(ak == null) return false;
String s = speaker_profile.getKey();
for(String p : ak) if(p.equals(s)) return true;
return false;
}
// ######################################
// # GETTERS #
// ######################################
public String getName() {return _name;}
public String getRegion() {return _region;}
public String getNote() {return _note;}
public int getBirthYear() {return _birthYear;}
public int getGender() {return _gender;}
public Language getRecordLang() {return _recordLang;}
public Language getMotherTongue() {return _motherTongue;}
public ArrayList<Language> getOtherLanguages() {return _otherLanguages;}
// #####################################
// # GETTERS & SETTERS #
// #####################################
public static SpeakerProfile getLastSpeaker() {return _lastSpeaker;}
public String getName() {return _name;}
public String getRegion() {return _region;}
public String getNote() {return _note;}
public int getBirthYear() {return _birthYear;}
public int getGender() {return _gender;}
public Language getRecordLang() {return _recordLang;}
public Language getMotherTongue() {return _motherTongue;}
public ArrayList<Language> getOtherLanguages() {return _otherLanguages;}
public boolean getSignature() {return _signature;}
public SpeakerProfile setSignature(boolean signature) {_signature=signature;return this;}
}
\ No newline at end of file
......@@ -98,7 +98,7 @@ public class ListFolderAdapter extends ArrayAdapter {
case ElicitationMode.VIDEO_MODE:
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".mp4") || files[i].getAbsolutePath().contains(".avi"))))
i++;
if (i == files.length && i>0) {
if(i == files.length && i>0) {
holder.imageTypeOfFolder.setImageResource(R.drawable.type_folder_video);
holder.imageTypeOfFolder.setVisibility(ImageView.VISIBLE);
}
......
......@@ -44,8 +44,7 @@ public class RecordActivity extends AikumaActivity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
this.soundUUID = UUID.randomUUID();
// Disable the stopButton(saveButton) before the recording starts
ImageButton stopButton =
(ImageButton) findViewById(R.id.stopButton);
ImageButton stopButton = (ImageButton) findViewById(R.id.stopButton);
stopButton.setImageResource(R.drawable.ok_disabled_48);
stopButton.setEnabled(false);
......@@ -83,10 +82,6 @@ public class RecordActivity extends AikumaActivity {
timeDisplay.post(new Runnable() {
public void run() {
int time = recorder.getCurrentMsec();
/*
BigDecimal bd = new BigDecimal(recorder.getCurrentMsec()/1000f);
bd = bd.round(new MathContext(1));
*/
//Lets method in superclass know to ask user if
//they are willing to discard audio if time>250msec
if(time > 250) {
......
......@@ -22,7 +22,10 @@ import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import org.getalp.ligaikuma.lig_aikuma.model.Language;
import org.getalp.ligaikuma.lig_aikuma.model.Recording;
import org.getalp.ligaikuma.lig_aikuma.model.RecordingLig;
import org.getalp.ligaikuma.lig_aikuma.model.SpeakerProfile;
import org.getalp.ligaikuma.lig_aikuma.util.AikumaSettings;
import org.getalp.ligaikuma.lig_aikuma.util.FileIO;
import org.getalp.ligaikuma.lig_aikuma.util.PDFBuilder;
import java.io.File;
import java.io.IOException;
......@@ -67,10 +70,8 @@ public class RecordActivityLig extends RecordActivity {
speakerNote = bundle.getString(RecordingMetadataLig.metaSpkrNote);
speakerAge = bundle.getInt(RecordingMetadataLig.metaSpkrBirthYr, 0);
speakerGender = bundle.getInt(RecordingMetadataLig.metaSpkrGender, 0);
// DateFormat dateformat = DateFormat.getDateTimeInstance();// Never use
try {
date = new SimpleDateFormat().parse(bundle.getString(RecordingMetadataLig.metaDate));
// date = dateformat.parse(metaIntent.getStringExtra(RecordingMetadataLig.metaDate));
} catch (ParseException e1) {
date = new Date();
} catch (Exception e) {
......@@ -78,12 +79,13 @@ public class RecordActivityLig extends RecordActivity {
}
// DEBUG
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - selected languages: " + selectedLanguages.toString());
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - region of origin: " + regionOrigin);
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - speaker name: " + speakerName);
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - speaker age: " + speakerAge);
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - speaker gender: " + speakerGender);
if(BuildConfig.DEBUG)Log.i(TAG, "start intent - date: " + date);
if(BuildConfig.DEBUG){
Log.i(TAG, "start intent - selected languages: " + selectedLanguages.toString());
Log.i(TAG, "start intent - region of origin: " + regionOrigin);
Log.i(TAG, "start intent - speaker name: " + speakerName);
Log.i(TAG, "start intent - speaker age: " + speakerAge);
Log.i(TAG, "start intent - speaker gender: " + speakerGender);
Log.i(TAG, "start intent - date: " + date);}
// code from inherited class RecordActivity
super.onCreate(savedInstanceState);
......@@ -106,10 +108,8 @@ public class RecordActivityLig extends RecordActivity {
if(BuildConfig.DEBUG)Log.i("RecordActivity", "in onCompletion, recording:" + recording);
if (recording) {
recorder.listen();
ImageButton recordButton = (ImageButton) findViewById(R.id.recordButton);
ImageButton pauseButton = (ImageButton) findViewById(R.id.pauseButton);
recordButton.setVisibility(View.GONE);
pauseButton.setVisibility(View.VISIBLE);
findViewById(R.id.recordButton).setVisibility(View.GONE);
findViewById(R.id.pauseButton).setVisibility(View.VISIBLE);
}
}
});
......@@ -128,11 +128,6 @@ public class RecordActivityLig extends RecordActivity {
timeDisplay.post(new Runnable() {
public void run() {
int time = recorder.getCurrentMsec();
/*
BigDecimal bd = new
BigDecimal(recorder.getCurrentMsec()/1000f);
bd = bd.round(new MathContext(1));
*/
//Lets method in superclass know to ask user if
//they are willing to discard audio if time>250msec
if(time > 250) {
......@@ -166,8 +161,7 @@ public class RecordActivityLig extends RecordActivity {
String name = new SimpleDateFormat("yyMMdd-HHmmss").format(date) + "_" + recordLang.getCode()
+ "_" + Aikuma.getDeviceId();
if(BuildConfig.DEBUG)Log.d("new_name", name);
// + "_" + deviceName + "_" + selectedLanguages.get(0).getCode();
if(BuildConfig.DEBUG)Log.d("new_name", name);//+ "_" + deviceName + "_" + selectedLanguages.get(0).getCode();
String gender="ERROR";
switch (speakerGender)
......@@ -176,12 +170,12 @@ public class RecordActivityLig extends RecordActivity {
case RecordingMetadataLig.GENDER_FEMALE: gender = "Female"; break;
case RecordingMetadataLig.GENDER_UNSPECIFIED: gender = "Unspecified"; break;
}
RecordingLig recording = new RecordingLig(soundUUID, name, date,
AikumaSettings.getLatestVersion(),
AikumaSettings.getCurrentUserId(), recordLang, motherTong,
selectedLanguages, speakerIds, Aikuma.getDeviceName(), Aikuma.getAndroidID(),
null, null, super.sampleRate, duration,
null, null, super.sampleRate, duration,
super.recorder.getFormat(), super.recorder.getNumChannels(),
super.recorder.getBitsPerSample(), MainActivity.locationDetector.getLatitude(), MainActivity.locationDetector.getLongitude(),
regionOrigin, speakerName, speakerAge, gender, speakerNote);
......@@ -202,6 +196,17 @@ public class RecordActivityLig extends RecordActivity {
Intent intent;
if (!respeak) {
// PDF Génération
SpeakerProfile tsp = SpeakerProfile.getLastSpeaker();
if(tsp!=null && !tsp.getSignature())
{
tsp.setSignature(true).saveOnSharedPreferences(this);
new PDFBuilder(this).BuildConsentForm(FileIO.getOwnerPath()+"/recordings/"+name+"/",
"form_consent.pdf", tsp.getName());
}
intent = new Intent(this, ModeSelection.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Toast.makeText(RecordActivityLig.this,
......
......@@ -35,9 +35,11 @@ import org.getalp.ligaikuma.lig_aikuma.model.Language;
import org.getalp.ligaikuma.lig_aikuma.model.MetadataSession;
import org.getalp.ligaikuma.lig_aikuma.model.Recording;
import org.getalp.ligaikuma.lig_aikuma.model.RecordingLig;
import org.getalp.ligaikuma.lig_aikuma.model.SpeakerProfile;
import org.getalp.ligaikuma.lig_aikuma.util.AikumaSettings;
import org.getalp.ligaikuma.lig_aikuma.util.FileIO;
import org.getalp.ligaikuma.lig_aikuma.util.IdUtils;
import org.getalp.ligaikuma.lig_aikuma.util.PDFBuilder;
import java.io.BufferedReader;
import java.io.BufferedWriter;
......@@ -205,7 +207,7 @@ public class RecordElicitation extends AikumaActivity {
private void loadTextViews() throws IOException {
String phrase;
while((phrase = reader.readLine()) != null && (phrase.isEmpty() || phrase.split("##").length <= 1));
if (phrase == null) { throw new IOException("Empty text file"); }
if(phrase == null) { throw new IOException("Empty text file"); }
String[] phrasePair = phrase.split("##");
TextView tvFrPhrase = (TextView) findViewById(R.id.tv_elicit_phrase);
......@@ -221,7 +223,6 @@ public class RecordElicitation extends AikumaActivity {
if (entityId >= numberOfEntities){
Toast.makeText(this, getResources().getString(R.string.file_saved) + strFolderDate + "_" + MetadataSession.getMetadataSession().getRecordLanguage().getCode()
+ "_" + Aikuma.getDeviceId() + mode + "_" + entityId, Toast.LENGTH_SHORT).show();
// if ((choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) && bufferedWriter != null) {
if(bufferedWriter != null) {
try {
bufferedWriter.close();
......@@ -231,12 +232,9 @@ public class RecordElicitation extends AikumaActivity {
}
this.finish();
} else {
ImageView selected_photo = (ImageView) findViewById(R.id.img_orig);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
new BitmapWorkerTask(selected_photo).execute(images[entityId]);
TextView tv_numImage = (TextView) findViewById(R.id.image_x);
tv_numImage.setText(getString(R.string.image) + entityId);
new BitmapFactory.Options().inPreferredConfig = Bitmap.Config.ARGB_8888;
new BitmapWorkerTask((ImageView) findViewById(R.id.img_orig)).execute(images[entityId]);
((TextView) findViewById(R.id.image_x)).setText(getString(R.string.image) + entityId);
}
}
......@@ -262,7 +260,8 @@ public class RecordElicitation extends AikumaActivity {
@SuppressWarnings("unchecked")
private void initSession() {
if (prefsUserSession.getBoolean("active", false)) {
if(prefsUserSession.getBoolean("active", false))
{
strFolderDate=prefsUserSession.getString("date", "");
recordLang = new Language(prefsUserSession.getString("Language name", ""), prefsUserSession.getString("LanguageCode", ""));
try {
......@@ -279,16 +278,12 @@ public class RecordElicitation extends AikumaActivity {
recordingName = prefsUserSession.getString("session_output_file", "");
if(BuildConfig.DEBUG)Log.d(TAG, "last saved recorded filename: " + recordingName);
prefsUserSession.edit().clear().apply();
try {
numberOfEntities = countNumberOfEntities();
} catch (IOException e) {
e.printStackTrace();
}
/*if (choiceMode == ElicitationMode.TEXT_MODE)
goToGoodPlaceInTextFile();*/
isNewSession = false;
} else {
ptrSelectedReference = getIntent().getStringExtra(ElicitationMode.importFileName);
......@@ -315,16 +310,21 @@ public class RecordElicitation extends AikumaActivity {
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
//if (choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) {
String idDevice = Aikuma.getDeviceId();
// String name = strFolderDate + "_" +
// recordLang.getCode() + "_" + idDevice;
dirName = strFolderDate + "_" + recordLang.getCode() + "_" + idDevice + mode;
textFile = new File(FileIO.getOwnerPath()+"/recordings/"+dirName + "/" + dirName + "_linker.txt");
textFile = new File(FileIO.getOwnerPath()+"/recordings/"+dirName+"/"+dirName+"_linker.txt");
images = new File(ptrSelectedReference).listFiles();
// PDF Génération
SpeakerProfile tsp = SpeakerProfile.getLastSpeaker();
if(tsp!=null && !tsp.getSignature())
{
tsp.setSignature(true).saveOnSharedPreferences(this);
new PDFBuilder(RecordElicitation.this).BuildConsentForm(FileIO.getOwnerPath()+
"/recordings/"+dirName+"/", "form_consent.pdf", tsp.getName());
}
if (!isNewSession) {
try {
initBufferedWriter();
......@@ -403,9 +403,8 @@ public class RecordElicitation extends AikumaActivity {
default:
break;
}
TextView tv2 = (TextView) findViewById(R.id.elicit_phrase_number);
tv2.setText(entityId + "");
((TextView) findViewById(R.id.elicit_phrase_number)).setText(entityId + "");
updateProgressBar();
if(BuildConfig.DEBUG)Log.d(TAG, "Progress bar (saveOneRecord state) = "+ entityId +"/"+numberOfEntities);
......@@ -461,6 +460,7 @@ public class RecordElicitation extends AikumaActivity {
saveOneRecord();
if(entityId >= numberOfEntities-1)
deleteAllTempFiles();
_button_undo.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.undo2));
_button_undo.setEnabled(false);
ImageButton recordButton = (ImageButton) findViewById(R.id.btn_record_elicit);
......@@ -566,7 +566,6 @@ public class RecordElicitation extends AikumaActivity {
MetadataSession.getMetadataSession().getSpeakerName(),
MetadataSession.getMetadataSession().getSpeakerAge(), gender,
MetadataSession.getMetadataSession().getSpeakerNote());
} else
restoreMetaDataFromJson();
}
......@@ -589,6 +588,8 @@ public class RecordElicitation extends AikumaActivity {
setRecordingLig();
try {
recordingLig.write();
String filePath = recordingLig.getFile().getAbsolutePath(); //absolute path of the file
......
......@@ -100,6 +100,7 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
/** Called when the activity is first created. */
@Override
@SuppressWarnings("ResourceType")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -109,9 +110,7 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
respeak = getIntent().getBooleanExtra(RespeakingSelection.RESPEAK, false);
elicitation = getIntent().getBooleanExtra(ElicitationMode.ELICITATION, false);
if (respeak) {
Toast.makeText(this, R.string.please_fill_in_the_details_of_the_imported_recording,
Toast.LENGTH_LONG)
.show();
Toast.makeText(this, R.string.please_fill_in_the_details_of_the_imported_recording, Toast.LENGTH_LONG).show();
// TODO add a frame layout for the listener
TableLayout l_parent = (TableLayout) findViewById(R.id.title_layout);
// LinearLayout l_parent = ((LinearLayout) findViewById(R.id.layout_spokenLanguages).getParent());
......@@ -140,11 +139,10 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
super.onStart();
if (respeak) {
try {
File f = new File(Recording.getNoSyncRecordingsPath(), importWavUUID + ".wav");
listenFragment.setPlayer(new SimplePlayer(f, importWavRate, true));