Commit b11287c3 authored by mistermad's avatar mistermad

- Deleting the session backup in elicitation mode if it in step one

- Changing the display of the distinction between file/folder translated and respected in the file exploreur.
- Fixed a bug corrupting files when using the undo button in elicitation mode.
- Fixed bug on dialog boxes at the end of the metadata entry
- Fixed various display bugs (RespeakingSelection, CheckTranscrition, CheckWordVariant, LanguageFilterList, RespeakingMetadataLig, RecordingMetadataLig...)
parent feababba
...@@ -7,7 +7,7 @@ import android.support.test.runner.AndroidJUnit4; ...@@ -7,7 +7,7 @@ import android.support.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
/** /**
* Instrumentation test, which will execute on an Android device. * Instrumentation test, which will execute on an Android device.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<uses-sdk android:minSdkVersion="14"/> <uses-sdk android:minSdkVersion="14"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
......
...@@ -14,6 +14,7 @@ import android.net.NetworkInfo; ...@@ -14,6 +14,7 @@ import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.Settings.Secure; import android.provider.Settings.Secure;
import android.support.annotation.RequiresApi;
import org.getalp.ligaikuma.lig_aikuma.model.FileModel; import org.getalp.ligaikuma.lig_aikuma.model.FileModel;
import org.getalp.ligaikuma.lig_aikuma.model.Language; import org.getalp.ligaikuma.lig_aikuma.model.Language;
...@@ -28,9 +29,6 @@ import java.util.List; ...@@ -28,9 +29,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import android.support.annotation.RequiresApi;
/** /**
* Offers a collection of static methods that require a context independently * Offers a collection of static methods that require a context independently
* of an Activity. * of an Activity.
......
...@@ -168,7 +168,7 @@ public class Mapper { ...@@ -168,7 +168,7 @@ public class Mapper {
originalEndOfSegment = null; originalEndOfSegment = null;
return true; return true;
} }
/** Remap an existing map file with index file, used the create a no speak map file /** Remap an existing map file with index file, used the create a temp no speak map file
* *
* @param index index used for remap * @param index index used for remap
*/ */
......
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
*/ */
package org.getalp.ligaikuma.lig_aikuma.audio.record; package org.getalp.ligaikuma.lig_aikuma.audio.record;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.File;
import android.media.AudioFormat; import android.media.AudioFormat;
import android.media.AudioRecord; import android.media.AudioRecord;
import android.util.Log; import android.util.Log;
...@@ -16,6 +11,11 @@ import android.util.Log; ...@@ -16,6 +11,11 @@ import android.util.Log;
import org.getalp.ligaikuma.lig_aikuma.audio.Sampler; import org.getalp.ligaikuma.lig_aikuma.audio.Sampler;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig; import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
/** /**
* A writer that can handle PCM/WAV files. * A writer that can handle PCM/WAV files.
......
...@@ -182,13 +182,9 @@ public class ThresholdSpeechAnalyzer extends Analyzer { ...@@ -182,13 +182,9 @@ public class ThresholdSpeechAnalyzer extends Analyzer {
// //
afterBuffer = Arrays.copyOf(afterBuffer, afterBuffer.length + buffer.length); afterBuffer = Arrays.copyOf(afterBuffer, afterBuffer.length + buffer.length);
// Copy the buffer to avoid reference problems.
//
short[] copiedBuffer = Arrays.copyOf(buffer, buffer.length);
// Add the copied current buffer onto the end. // Add the copied current buffer onto the end.
// //
System.arraycopy(copiedBuffer, 0, afterBuffer, offset, buffer.length); System.arraycopy(Arrays.copyOf(buffer, buffer.length), 0, afterBuffer, offset, buffer.length);
} }
//TODO Duplicate method. See addToAfterBuffer. //TODO Duplicate method. See addToAfterBuffer.
...@@ -204,13 +200,9 @@ public class ThresholdSpeechAnalyzer extends Analyzer { ...@@ -204,13 +200,9 @@ public class ThresholdSpeechAnalyzer extends Analyzer {
// //
onsetBuffer = Arrays.copyOf(onsetBuffer, onsetBuffer.length + buffer.length); onsetBuffer = Arrays.copyOf(onsetBuffer, onsetBuffer.length + buffer.length);
// Copy the buffer to avoid reference problems.
//
short[] copiedBuffer = Arrays.copyOf(buffer, buffer.length);
// Add the copied current buffer onto the end. // Add the copied current buffer onto the end.
// //
System.arraycopy(copiedBuffer, 0, onsetBuffer, offset, buffer.length); System.arraycopy(Arrays.copyOf(buffer, buffer.length), 0, onsetBuffer, offset, buffer.length);
} }
/** Clear the before speech buffer. */ /** Clear the before speech buffer. */
......
...@@ -181,13 +181,14 @@ public class RecordingLig extends Recording { ...@@ -181,13 +181,14 @@ public class RecordingLig extends Recording {
dir.mkdir(); dir.mkdir();
if(BuildConfig.DEBUG)Log.i(TAG, "start write - iniate directory " + dir.getAbsolutePath()); if(BuildConfig.DEBUG)Log.i(TAG, "start write - iniate directory " + dir.getAbsolutePath());
// Import the wave file into the new recording directory. // Import the wave file into the new recording directory.
Log.d(TAG, "A1");
if(this.isMovie()) if(this.isMovie())
// TODO update importMov // TODO update importMov
super.importMov(recordingUUID, getId()); super.importMov(recordingUUID, getId());
else else
this.importWav(recordingUUID, WAV_EXT); this.importWav(recordingUUID, WAV_EXT);
Log.d(TAG, "A2");
// if the recording is original // if the recording is original
if(isOriginal() || isElicit()) { if(isOriginal() || isElicit()) {
// Import the sample wave file into the new recording directory // Import the sample wave file into the new recording directory
...@@ -203,12 +204,15 @@ public class RecordingLig extends Recording { ...@@ -203,12 +204,15 @@ public class RecordingLig extends Recording {
} }
JSONObject encodedRecording = this.encode(); JSONObject encodedRecording = this.encode();
Log.d(TAG, "A3");
// Write the json metadata. // Write the json metadata.
File metadataFile = new File(getIndividualRecordingPath(), this.name + METADATA_SUFFIX); File metadataFile = new File(dir.toString(), this.name + METADATA_SUFFIX);
FileIO.writeJSONObject(metadataFile,encodedRecording); FileIO.writeJSONObject(metadataFile,encodedRecording);
Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath());
Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath());
Log.d(TAG, "A4");
} }
/** /**
...@@ -276,7 +280,7 @@ public class RecordingLig extends Recording { ...@@ -276,7 +280,7 @@ public class RecordingLig extends Recording {
* @return True if the recording is an elicitation. * @return True if the recording is an elicitation.
*/ */
public boolean isElicit() { public boolean isElicit() {
return this.name.contains("_elicit_")/* && !this.name.contains("rspk") || !this.name.contains("trsl")*/; return this.name.contains("_elicit_") && !this.name.contains("_rspk") && !this.name.contains("_trsl");
} }
......
...@@ -46,7 +46,6 @@ public class AddSpeakerActivity1 extends AikumaActivity { ...@@ -46,7 +46,6 @@ public class AddSpeakerActivity1 extends AikumaActivity {
textField.addTextChangedListener(new TextWatcher(){ textField.addTextChangedListener(new TextWatcher(){
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
if(s.toString().length() > 0) { if(s.toString().length() > 0) {
ImageButton okButton = ImageButton okButton =
(ImageButton) findViewById(R.id.okButton1); (ImageButton) findViewById(R.id.okButton1);
...@@ -74,7 +73,6 @@ public class AddSpeakerActivity1 extends AikumaActivity { ...@@ -74,7 +73,6 @@ public class AddSpeakerActivity1 extends AikumaActivity {
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if((event.getAction() == KeyEvent.ACTION_DOWN && if((event.getAction() == KeyEvent.ACTION_DOWN &&
(event.getKeyCode() == KeyEvent.KEYCODE_ENTER))) { (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))) {
onOkButtonPressed(null); onOkButtonPressed(null);
......
...@@ -12,11 +12,10 @@ import android.provider.MediaStore; ...@@ -12,11 +12,10 @@ import android.provider.MediaStore;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import org.getalp.ligaikuma.lig_aikuma.model.Language; import org.getalp.ligaikuma.lig_aikuma.model.Language;
import org.getalp.ligaikuma.lig_aikuma.util.ImageUtils; import org.getalp.ligaikuma.lig_aikuma.util.ImageUtils;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
......
...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint; ...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.app.FragmentTransaction;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
......
package org.getalp.ligaikuma.lig_aikuma.ui; package org.getalp.ligaikuma.lig_aikuma.ui;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.getalp.ligaikuma.lig_aikuma.ModeSelection;
import org.getalp.ligaikuma.lig_aikuma.audio.SimplePlayer;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
...@@ -34,6 +17,23 @@ import android.widget.SeekBar; ...@@ -34,6 +17,23 @@ import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.getalp.ligaikuma.lig_aikuma.ModeSelection;
import org.getalp.ligaikuma.lig_aikuma.audio.SimplePlayer;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class CheckTranscription extends AikumaActivity { public class CheckTranscription extends AikumaActivity {
public static final String TAG = "CheckTranscription"; public static final String TAG = "CheckTranscription";
...@@ -149,6 +149,7 @@ public class CheckTranscription extends AikumaActivity { ...@@ -149,6 +149,7 @@ public class CheckTranscription extends AikumaActivity {
* find a way to fix it for phones AND for tablets * find a way to fix it for phones AND for tablets
*/ */
int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics()); int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics());
if((getResources().getBoolean(R.bool.is_small_screen))) tsizepx*=0.5;
if(BuildConfig.DEBUG)Log.i(TAG,"Text size in px: "+tsizepx); if(BuildConfig.DEBUG)Log.i(TAG,"Text size in px: "+tsizepx);
//transcription + checkbox //transcription + checkbox
transcriptOK = new CheckBox(this); transcriptOK = new CheckBox(this);
...@@ -253,6 +254,7 @@ public class CheckTranscription extends AikumaActivity { ...@@ -253,6 +254,7 @@ public class CheckTranscription extends AikumaActivity {
* find a way to fix it for phones AND for tablets * find a way to fix it for phones AND for tablets
*/ */
int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics()); int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics());
if((getResources().getBoolean(R.bool.is_small_screen))) tsizepx*=0.5;
//transcription + checkbox //transcription + checkbox
transcriptOK = new CheckBox(this); transcriptOK = new CheckBox(this);
transcriptOK.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); transcriptOK.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
......
package org.getalp.ligaikuma.lig_aikuma.ui; package org.getalp.ligaikuma.lig_aikuma.ui;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
...@@ -28,6 +16,18 @@ import android.widget.Toast; ...@@ -28,6 +16,18 @@ import android.widget.Toast;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig; import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R; import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class CheckWordVariant extends AikumaActivity { public class CheckWordVariant extends AikumaActivity {
public static final String TAG = "CheckWordVariant"; public static final String TAG = "CheckWordVariant";
...@@ -127,18 +127,19 @@ public class CheckWordVariant extends AikumaActivity { ...@@ -127,18 +127,19 @@ public class CheckWordVariant extends AikumaActivity {
String[] variantlist = wordlist[1].split(" ; "); String[] variantlist = wordlist[1].split(" ; ");
CheckBox variant; CheckBox variant;
checkboxCount=0; checkboxCount=0;
final float scale = getResources().getDisplayMetrics().density; int padding_in_px = (int) (10 * getResources().getDisplayMetrics().density + 0.5f);
int padding_in_px = (int) (10 * scale + 0.5f);
/** TODO /** TODO
* tsizepx matches for tablets but is too large for phones (applyDimension to 10 is better) * tsizepx matches for tablets but is too large for phones (applyDimension to 10 is better)
* find a way to fix it for phones AND for tablets * find a way to fix it for phones AND for tablets
*/ */
int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics()); int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics());
if((getResources().getBoolean(R.bool.is_small_screen))) tsizepx*=0.5;
for (String element : variantlist){ for (String element : variantlist){
//variant + checkbox //variant + checkbox
variant = new CheckBox(this); variant = new CheckBox(this);
variant.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); variant.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
variant.setPadding(padding_in_px, 0, 0, padding_in_px); variant.setPadding(padding_in_px, 0, 0, padding_in_px);
if((getResources().getBoolean(R.bool.is_small_screen)))
variant.setTextSize(tsizepx); variant.setTextSize(tsizepx);
//variant.setTypeface(null, Typeface.ITALIC); //variant.setTypeface(null, Typeface.ITALIC);
variant.setTypeface(Typeface.SERIF); variant.setTypeface(Typeface.SERIF);
...@@ -215,6 +216,7 @@ public class CheckWordVariant extends AikumaActivity { ...@@ -215,6 +216,7 @@ public class CheckWordVariant extends AikumaActivity {
* find a way to fix it for phones AND for tablets * find a way to fix it for phones AND for tablets
*/ */
int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics()); int tsizepx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 25, getResources().getDisplayMetrics());
if((getResources().getBoolean(R.bool.is_small_screen))) tsizepx*=0.5;
for (String element : variantlist){ for (String element : variantlist){
//variant + checkbox //variant + checkbox
variant = new CheckBox(this); variant = new CheckBox(this);
......
...@@ -2,10 +2,10 @@ package org.getalp.ligaikuma.lig_aikuma.ui; ...@@ -2,10 +2,10 @@ package org.getalp.ligaikuma.lig_aikuma.ui;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -32,7 +32,6 @@ import static org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode.importFileName; ...@@ -32,7 +32,6 @@ import static org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode.importFileName;
public class ElicitationFileSearch extends AikumaActivity public class ElicitationFileSearch extends AikumaActivity
{ {
public static final String TAG = "ElicitationFileSearch"; public static final String TAG = "ElicitationFileSearch";
private static String _current_folder_position; private static String _current_folder_position;
...@@ -55,6 +54,10 @@ public class ElicitationFileSearch extends AikumaActivity ...@@ -55,6 +54,10 @@ public class ElicitationFileSearch extends AikumaActivity
_mode = getIntent().getIntExtra("mode",ElicitationMode.TEXT_MODE); _mode = getIntent().getIntExtra("mode",ElicitationMode.TEXT_MODE);
// Force portrait on phone
if(getResources().getBoolean(R.bool.is_small_screen))
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
if(!_is_init) if(!_is_init)
{ {
_nav_list = new ArrayList<>(); _nav_list = new ArrayList<>();
...@@ -90,7 +93,6 @@ public class ElicitationFileSearch extends AikumaActivity ...@@ -90,7 +93,6 @@ public class ElicitationFileSearch extends AikumaActivity
* Loads the list of files in the specified directory into mFileList * Loads the list of files in the specified directory into mFileList
*