Commit 1d8247e0 authored by mistermad's avatar mistermad

- Changing the file browsing system

- Adding a file sharing system
- Bug fix (profile)
parent 5b198380
......@@ -12,17 +12,18 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
......@@ -274,7 +275,9 @@
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 android:name="org.getalp.ligaikuma.lig_aikuma.ui.ShareFileActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationFileSearch">
</activity>
</application>
......
......@@ -18,10 +18,9 @@ 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.ShareFileActivity;
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;
......@@ -166,7 +165,7 @@ public class ModeSelection extends Activity implements OnClickListener{
public void onShareButtonClick(View _v)
{
startActivity(new Intent(this, ShareFile.class));
startActivity(new Intent(this, ShareFileActivity.class));
}
public void showSessionDialog() {
......
......@@ -151,17 +151,6 @@ public class SimplePlayer extends Player implements Sampler
return 0;
}
}
/*Old
public int getDurationMsec() {
return mediaPlayer.getDuration();
//try {
//} catch (IllegalStateException e) {
//If this fails then we won't be in an activity where a duration is
//actually required. -1 is returned so we at least know it was
//erroneous if we ever need to.
return -1;
//}
}*/
/**
* Seek to a given point in the recording in milliseconds.
......@@ -207,14 +196,6 @@ public class SimplePlayer extends Player implements Sampler
new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer _mp) {
listener.onCompletion(SimplePlayer.this);
/* try {
if(recording != null)
incrementViewCount();
} catch (IOException e) {
// There is likely an issue writing to the
// filesystem, but it's probably not worth
// reporting to the user with at Toast.
}*/
SimplePlayer.this.finishedPlaying = true;
}
});
......
......@@ -18,6 +18,8 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.UUID;
import static org.getalp.ligaikuma.lig_aikuma.model.RecordingLig.MAP_EXT;
/**
* Facilitates creation of segment mappings (Segments). To be used when
* recording a respeaking.
......@@ -47,10 +49,11 @@ public class Mapper {
*
* @param uuid The UUID of the respeaking.
*/
public Mapper(UUID uuid) {
public Mapper(UUID uuid)
{
this.segments = new Segments();
try {
this.mappingFile = new File(Recording.getNoSyncRecordingsPath(), uuid + ".map");
this.mappingFile = new File(Recording.getNoSyncRecordingsPath(), uuid + MAP_EXT);
reader = new BufferedReader(new InputStreamReader(new FileInputStream(this.mappingFile)));
restoreFromMappingFile();
if(BuildConfig.DEBUG)Log.d("mapper generation", "yes");
......@@ -88,12 +91,12 @@ public class Mapper {
private void restoreFromMappingFile() throws IOException {
String line;
while ((line = reader.readLine()) != null && (line.isEmpty() || line.split(":").length <= 1));
while((line = reader.readLine()) != null && (line.isEmpty() || line.split(":").length <= 1));
if(BuildConfig.DEBUG && line!=null)Log.d("line", line);
do {
String[] pair = (line != null) ? line.split(":"):new String[0];
String[] strFirstSeg = pair[0].split(",");
String[] strSecondSeg = pair[1].split(",");
String[] pair = (line != null) ? line.split(":"):new String[0],
strFirstSeg = pair[0].split(","),
strSecondSeg = pair[1].split(",");
Segments.Segment original = new Segments.Segment(Long.parseLong(strFirstSeg[0]), Long.parseLong(strFirstSeg[1]));
if(BuildConfig.DEBUG)Log.d("original seg ", original.getStartSample() + " -> " + original.getEndSample());
Segments.Segment rspkSeg = new Segments.Segment(Long.parseLong(strSecondSeg[0]), Long.parseLong(strSecondSeg[1]));
......@@ -113,10 +116,9 @@ public class Mapper {
// If we have already specified an end of the segment then we're
// starting a new one. Otherwise just continue with the old
// originalStartOfSegment
if (originalEndOfSegment != null) {
originalStartOfSegment = original.getCurrentSample();
if(BuildConfig.DEBUG)Log.d("mark", "mark original segment : " + original.getCurrentSample());
}
if(originalEndOfSegment == null) return;
originalStartOfSegment = original.getCurrentSample();
if(BuildConfig.DEBUG)Log.d("mark", "mark original segment : " + original.getCurrentSample());
}
/**
......@@ -153,12 +155,11 @@ public class Mapper {
// This could only have happened if no original had been recorded at all.
originalSegment = new Segments.Segment(0l, 0l);
}
Segments.Segment respeakingSegment = new Segments.Segment(respeakingStartOfSegment, respeakingEndOfSegment);
segments.put(originalSegment, respeakingSegment);
segments.put(originalSegment, new Segments.Segment(respeakingStartOfSegment, respeakingEndOfSegment));
//Now we say we're marking the start of the new original and respekaing
//segments
originalStartOfSegment = original.getCurrentSample();
respeakingStartOfSegment = respoken.getCurrentSample();
respeakingStartOfSegment = respeakingEndOfSegment;
//We currently have no end for these segments.
originalEndOfSegment = null;
return true;
......
......@@ -46,7 +46,7 @@ public class PCMWriter implements Sampler {
return this.sampleRate;
}
String fullFilename;
private String fullFilename;
/**
* @param sampleRate Eg. 1000
* @param channelConfig Eg. AudioFormat.CHANNEL_IN_MONO
......@@ -54,8 +54,7 @@ public class PCMWriter implements Sampler {
*
* @return an instance of a PCMWriter.
*/
public static PCMWriter getInstance(int sampleRate, int channelConfig,
int audioFormat) {
public static PCMWriter getInstance(int sampleRate, int channelConfig, int audioFormat) {
return new PCMWriter(sampleRate, channelConfig, audioFormat);
}
......@@ -78,13 +77,6 @@ public class PCMWriter implements Sampler {
private short numberOfChannels;
private int sampleRate;
private short sampleSize;
private int bufferSize;
/**
* Number of frames written to file on each output (only in uncompressed
* mode)
*/
private int framePeriod;
/**
* Number of bytes written to file after header (only in uncompressed mode)
......@@ -104,8 +96,6 @@ public class PCMWriter implements Sampler {
public void setPayloadSize(int payloadSize) {
this.payloadSize = payloadSize;
}
public void setCurrentSample(long currentSample) {
this.currentSample = currentSample;
......@@ -132,17 +122,11 @@ public class PCMWriter implements Sampler {
payloadSize += buffer.length;
if(BuildConfig.DEBUG)Log.d("payLoadSize", "payLoadSize = " + payloadSize);
} catch (IOException e) {
if(BuildConfig.DEBUG)Log.e(PCMWriter.class.getName(),
"Error occured in updateListener, recording is aborted");
if(BuildConfig.DEBUG)Log.e(PCMWriter.class.getName(), "Error occured in updateListener, recording is aborted");
}
if (sampleSize == 16) {
this.currentSample += buffer.length / 2;
if(BuildConfig.DEBUG)Log.d("currentSaple", "currentSample = " + this.currentSample);
} else {
//Assume sample size is 8.
this.currentSample += buffer.length;
}
this.currentSample += (sampleSize == 16)? buffer.length / 2: buffer.length;
if(BuildConfig.DEBUG)Log.d("currentSample", "currentSample = " + this.currentSample);
}
/**
......@@ -194,8 +178,11 @@ public class PCMWriter implements Sampler {
//
this.sampleRate = sampleRate;
framePeriod = sampleRate * TIMER_INTERVAL / 1000;
bufferSize = framePeriod * 2 * sampleSize * numberOfChannels / 8;
/*
Number of frames written to file on each output (only in uncompressed
mode)
*/
int bufferSize = (sampleRate * TIMER_INTERVAL / 1000) * 2 * sampleSize * numberOfChannels / 8;
// Check to make sure buffer size is not smaller than
// the smallest allowed size.
......@@ -203,14 +190,7 @@ public class PCMWriter implements Sampler {
if (bufferSize < AudioRecord.getMinBufferSize(sampleRate,channelConfig, audioFormat))
{
bufferSize = AudioRecord.getMinBufferSize(sampleRate,channelConfig, audioFormat);
// Set frame period and timer interval accordingly
//
framePeriod = bufferSize
/ (2 * sampleSize * numberOfChannels / 8);
if(BuildConfig.DEBUG)Log.w(PCMWriter.class.getName(), "Increasing buffer size to "
+ Integer.toString(bufferSize));
if(BuildConfig.DEBUG)Log.w(PCMWriter.class.getName(), "Increasing buffer size to " + Integer.toString(bufferSize));
}
}
......@@ -311,8 +291,8 @@ public class PCMWriter implements Sampler {
//
randomAccessWriter.writeInt(0);
} else {
if(BuildConfig.DEBUG)Log.d("payLoadSize", "payLoadSize = " + getPayloadSize());
if(BuildConfig.DEBUG)Log.d("length", "length = " + (this.randomAccessWriter.length()-44));
if(BuildConfig.DEBUG){Log.d("payLoadSize", "payLoadSize = " + getPayloadSize());
Log.d("length", "length = " + (this.randomAccessWriter.length()-44));}
//randomAccessWriter.seek(getPayloadSize()+44);
randomAccessWriter.seek(this.randomAccessWriter.length()+44);
}
......
......@@ -98,7 +98,6 @@ public class PhoneRespeaker implements
*/
public void resume() {
microphone.listen(this);
//mapper.markOriginal(player);
switchToPlay();
}
......@@ -120,11 +119,7 @@ public class PhoneRespeaker implements
player.release();
try {
mapper.stop();
} catch (IOException e) {
//If the mapping couldn't be written to file, the recording would
//not have been able to either, which would have resulted in an
//error. This block is unreachable.
}
} catch (IOException ignored) {}
file.close();
}
......@@ -132,16 +127,13 @@ public class PhoneRespeaker implements
private void stopMic() {
try {
microphone.stop();
} catch (MicException e) {
//Do nothing.
}
} catch (MicException ignored) {}
}
@Override
public void audioTriggered(short[] buffer, boolean justChanged) {
if (justChanged) {
if(justChanged)
switchToRecord();
}
file.write(buffer);
}
......@@ -158,14 +150,13 @@ public class PhoneRespeaker implements
@Override
public void silenceTriggered(short[] buffer, boolean justChanged) {
if (justChanged) {
mapper.store(player, file);
if (this.player.isFinishedPlaying()) {
stop();
} else {
player.rewind(rewindAmount);
switchToPlay();
}
if(!justChanged) return;
mapper.store(player, file);
if (this.player.isFinishedPlaying())
stop();
else {
player.rewind(rewindAmount);
switchToPlay();
}
}
......@@ -173,9 +164,8 @@ public class PhoneRespeaker implements
* Releases the resources associated with this respeaker.
*/
public void release() {
if (player != null) {
if(player != null)
player.release();
}
}
// The following two methods handle silences/speech discovered in the input
......@@ -198,12 +188,7 @@ public class PhoneRespeaker implements
* @return The number of channels of the WAV.
*/
public int getNumChannels() {
if (microphone.getChannelConfiguration() ==
AudioFormat.CHANNEL_IN_MONO) {
return 1;
}else {
return 2;
}
return (microphone.getChannelConfiguration() == AudioFormat.CHANNEL_IN_MONO) ? 1:2;
}
/**
......@@ -212,11 +197,7 @@ public class PhoneRespeaker implements
* @return The bits per sample of the WAV.
*/
public int getBitsPerSample() {
if (microphone.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) {
return 16;
} else {
return 8;
}
return (microphone.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT)?16:8;
}
/**
......@@ -230,8 +211,7 @@ public class PhoneRespeaker implements
}
//public void rewindToSegmentStart() {
// int msecs = player.sampleToMsec(mapper.getOriginalStartSample());
// msecs = msecs - getRewindAmount();
// int msecs = player.sampleToMsec(mapper.getOriginalStartSample()) - getRewindAmount();
// player.seekTo(msecs >= 0 ? msecs : 0);
//}
......@@ -241,11 +221,8 @@ public class PhoneRespeaker implements
private Microphone microphone;
/** The file to write to */
private PCMWriter file;
private PCMWriter sampleFile;
/** Player to play the original with. */
private SimplePlayer player;
/** Indicates whether the recording has finished playing. */
private boolean finishedPlaying = false;
/** The mapper used to store mapping data. */
private Mapper mapper;
......
......@@ -6,7 +6,6 @@ package org.getalp.ligaikuma.lig_aikuma.audio.record;
import android.util.Log;
import org.getalp.ligaikuma.lig_aikuma.audio.Player;
import org.getalp.ligaikuma.lig_aikuma.audio.SimplePlayer;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
......@@ -82,8 +81,6 @@ public class ThumbRespeaker {
*/
public void playOriginal(int playMode) {
switch(playMode) {
case 0: // Continue playing
break;
case 1: //Rewind and record the start-sample in mapper
player.seekToSample(mapper.getOriginalStartSample());
if(BuildConfig.DEBUG)Log.d("original sample", "get original start sample : " + mapper.getOriginalStartSample());
......@@ -172,13 +169,6 @@ public class ThumbRespeaker {
public int getCurrentMsec() {
return recorder.getCurrentMsec();
}
/**
* read the mapping file and create segments.
*/
public void restoreMapper() {
}
/**
* finishedPlaying accessor
......@@ -217,8 +207,7 @@ public class ThumbRespeaker {
* Releases the resources associated with this respeaker.
*/
public void release() {
if (player != null)
player.release();
if(player != null) player.release();
}
public Recorder getRecorder() {
......
......@@ -27,6 +27,8 @@ import java.util.regex.Pattern;
import fi.iki.elonen.NanoHTTPD;
import fi.iki.elonen.NanoHTTPD.Response.Status;
import static org.getalp.ligaikuma.lig_aikuma.model.RecordingLig.MAP_EXT;
/**
* A web server class designed for a web-based transcription tool
* (see github.com/langtech/transcriber).
......@@ -331,7 +333,7 @@ public class Server extends NanoHTTPD {
try {
File mapfile = new File(Recording.getRecordingsPath(
FileIO.getOwnerPath(a[2], a[3])), group_id + "/" + a[4] + ".map");
FileIO.getOwnerPath(a[2], a[3])), group_id + "/" + a[4] + MAP_EXT);
InputStream is = new FileInputStream(mapfile);
return new Response(Status.OK, "text/plain", is);
}
......
......@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.UUID;
import static junit.framework.Assert.assertTrue;
import static org.getalp.ligaikuma.lig_aikuma.model.RecordingLig.MAP_EXT;
/**
* The class that stores the metadata of a recording, including it's ID,
......@@ -267,7 +268,7 @@ public class Recording extends FileModel {
// Similar to importWav, except for the mapping file.
private void importMapping(UUID wavUUID, String id)
throws IOException {
File mapFile = new File(getNoSyncRecordingsPath(), wavUUID + ".map");
File mapFile = new File(getNoSyncRecordingsPath(), wavUUID + MAP_EXT);
FileUtils.moveFile(mapFile, getMapFile());
}
......@@ -621,7 +622,7 @@ public class Recording extends FileModel {
".json");
if (!isOriginal()) {
File mapFile = new File(getRecordingsPath(),
this.getUUID().toString() + ".map");
this.getUUID().toString() + MAP_EXT);
boolean result;
result = mapFile.delete();
if (!result) {
......
......@@ -21,7 +21,6 @@ public class RecordingLig extends Recording {
public static final String TAG = "RecordingLig";
public static final String RECORDINGS = "recordings/";
public static final String WAV_EXT = ".wav";
//public static final String PRVW_WAV_EXT = SAMPLE_SUFFIX; // Never use
public static final String MAP_EXT = ".map";
private Language recordLang;
......@@ -162,7 +161,7 @@ public class RecordingLig extends Recording {
private void importMapping(UUID wavUUID, String id)
throws IOException {
if(BuildConfig.DEBUG)Log.i(TAG, "importmapping - started");
File mapFile = new File(getNoSyncRecordingsPath(), wavUUID + ".map");
File mapFile = new File(getNoSyncRecordingsPath(), wavUUID + MAP_EXT);
if(BuildConfig.DEBUG)Log.i(TAG, "importmapping - map file " + mapFile.getAbsolutePath() + " and exists: " + mapFile.exists());
File destFile = new File(getIndividualRecordingPath(), this.name + MAP_EXT);
if(BuildConfig.DEBUG)Log.i(TAG, "importmapping - dest file: " + destFile.getAbsolutePath());
......
......@@ -104,7 +104,7 @@ public class Segments {
private void readSegments(File path) throws IOException {
String mapString = FileIO.read(path);
String[] lines = mapString.split("\n");
segmentMap = new LinkedHashMap<Segment, Segment>();
segmentMap = new LinkedHashMap<>();
for (String line : lines) {
String[] segmentMatch = line.split(":");
if (segmentMatch.length != 2) {
......
......@@ -2,8 +2,8 @@ package org.getalp.ligaikuma.lig_aikuma.model;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import org.apache.commons.lang3.ArrayUtils;
import org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig;
import java.util.ArrayList;
......@@ -80,14 +80,14 @@ public class SpeakerProfile
public void update(String name, int birthYear, int gender, Language recordLang, Language motherTongue,
ArrayList<Language> otherLanguages, String region, String note)
{
_name = name;
_name = (name!=null)?name:"";
_birthYear = birthYear;
_gender = gender;
_recordLang = recordLang;
_motherTongue = motherTongue;
_otherLanguages = otherLanguages;
_region = region;
_note = note;
_recordLang = (recordLang!=null)?recordLang:new Language(" "," ");
_motherTongue = (motherTongue!=null)?motherTongue:new Language(" "," ");
_otherLanguages = (otherLanguages!=null)?otherLanguages:new ArrayList<Language>();
_region = (region!=null)?region:"";
_note = (note!=null)?note:"";
_lastSpeaker = this;
}
......@@ -108,7 +108,7 @@ public class SpeakerProfile
*/
public boolean keyExist(Context c, String key)
{
return c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE).getString("_all_keys",null).contains(key);
return c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE).getString("_all_keys","").contains(key);
}
/** save current profile on SharedPreferences
......@@ -183,13 +183,11 @@ public class SpeakerProfile
ArrayList<Language> otherLanguages = new ArrayList<>();
String t = sp.getString("otherLanguages", null);
if(t != null && !t.isEmpty()) {
Log.d(TAG, "otherLanguages = "+t);
if(t != null && !t.isEmpty())
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",""), sp.getBoolean("signature", false));
......@@ -203,9 +201,9 @@ public class SpeakerProfile
public static String[] getAllKeys(Context c)
{
//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, "MAD ALL Keys: "+t.replace(splitKey2, " | "));
return !t.isEmpty() ? t.split(splitKey2): null;
String t = c.getSharedPreferences("_master_speaker_keys", Context.MODE_PRIVATE).getString("_all_keys",""), t2[] = t.split(splitKey2);
ArrayUtils.reverse(t2);
return !t.isEmpty() ? t2: null;
}
/** get String to display it
......@@ -245,15 +243,15 @@ public class SpeakerProfile
// # 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 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
package org.getalp.ligaikuma.lig_aikuma.ui;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.apache.commons.lang3.ArrayUtils;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode.ELICITATION;
import static org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode.importFileName;
public class ElicitationFileSearch extends AikumaActivity
{
public static final String TAG = "ElicitationFileSearch";
private static String _current_folder_position;
private static boolean _is_init = false;
private static ElicitationFileSearch.FileAdapter _adapteur;
private static ArrayList<String> _nav_list;
private static int _mode;
public static String[] FILE_IMAGE = new String[]{".jpg",".jpeg",".JPG",".JPEG"};
public static String[] FILE_VIDEO = new String[]{".mp4",".avi",".MP4",".AVI"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.elicitation_file_search);
if(!_is_init)
{
_nav_list = new ArrayList<>();
_adapteur = new ElicitationFileSearch.FileAdapter(this, _nav_list);
_is_init = true;
_current_folder_position = Environment.getExternalStorageDirectory().toString()+"/";
_mode = getIntent().getIntExtra("mode",ElicitationMode.IMAGE_MODE);
}
((ListView) findViewById(R.id.elicit_file_list)).setAdapter(_adapteur);
loadFileList(_current_folder_position);
}
/**
* Loads the list of files in the specified directory into mFileList
*
* @param folder The directory to go