Commit 00cc5c41 authored by mistermad's avatar mistermad

- Add waveform visualization of the original audio file in the Elicitation and Traslating mode

parent 6e7e27b7
...@@ -53,4 +53,5 @@ dependencies { ...@@ -53,4 +53,5 @@ dependencies {
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile 'javax.annotation:javax.annotation-api:1.2' compile 'javax.annotation:javax.annotation-api:1.2'
compile project(path: ':library')
} }
...@@ -8,6 +8,8 @@ import android.media.AudioManager; ...@@ -8,6 +8,8 @@ import android.media.AudioManager;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.util.Log; import android.util.Log;
import com.semantive.waveformandroid.waveform.MediaPlayerFactory;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig; import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.model.Recording; import org.getalp.ligaikuma.lig_aikuma.model.Recording;
...@@ -39,7 +41,7 @@ public class SimplePlayer extends Player implements Sampler ...@@ -39,7 +41,7 @@ public class SimplePlayer extends Player implements Sampler
*/ */
public SimplePlayer(Recording recording, boolean playThroughSpeaker) throws IOException { public SimplePlayer(Recording recording, boolean playThroughSpeaker) throws IOException {
setRecording(recording); setRecording(recording);
mediaPlayer = new MediaPlayer(); mediaPlayer = MediaPlayerFactory.getNewMediaPlayer();
mediaPlayer.setAudioStreamType((playThroughSpeaker)?AudioManager.STREAM_MUSIC:AudioManager.STREAM_VOICE_CALL); mediaPlayer.setAudioStreamType((playThroughSpeaker)?AudioManager.STREAM_MUSIC:AudioManager.STREAM_VOICE_CALL);
if(BuildConfig.DEBUG)Log.i("SimplePlayer", "Media Player - data source: " + recording.getFile().getCanonicalPath()); if(BuildConfig.DEBUG)Log.i("SimplePlayer", "Media Player - data source: " + recording.getFile().getCanonicalPath());
mediaPlayer.setDataSource(recording.getFile().getCanonicalPath()); mediaPlayer.setDataSource(recording.getFile().getCanonicalPath());
...@@ -190,7 +192,7 @@ public class SimplePlayer extends Player implements Sampler ...@@ -190,7 +192,7 @@ public class SimplePlayer extends Player implements Sampler
//Never use //Never use
//protected void setFinishedPlaying(boolean finished) {this.finishedPlaying = finished;} //protected void setFinishedPlaying(boolean finished) {this.finishedPlaying = finished;}
protected Recording getRecording() { public Recording getRecording() {
return recording; return recording;
} }
......
...@@ -151,17 +151,15 @@ public class Microphone { ...@@ -151,17 +151,15 @@ public class Microphone {
private static AudioRecord getListener( private static AudioRecord getListener(
int sampleRate, int audioFormat, int channelConfig) { int sampleRate, int audioFormat, int channelConfig) {
// Sample size. // Sample size and Channels.
int sampleSize = (audioFormat == AudioFormat.ENCODING_PCM_16BIT)? 16: 8; int sampleSize = (audioFormat == AudioFormat.ENCODING_PCM_16BIT)? 16: 8,
numberOfChannels = (channelConfig == AudioFormat.CHANNEL_IN_MONO)? 1: 2,
// Channels.
int numberOfChannels = (channelConfig == AudioFormat.CHANNEL_IN_MONO)? 1: 2;
// Calculate buffer size. // Calculate buffer size.
/** The period used for callbacks to onBufferFull. */ /** The period used for callbacks to onBufferFull. */
int framePeriod = sampleRate * 120 / 1000; framePeriod = sampleRate * 120 / 1000,
/** The buffer needed for the above period */ /** The buffer needed for the above period */
int bufferSize = framePeriod * 2 * sampleSize * numberOfChannels / 8; bufferSize = framePeriod * 2 * sampleSize * numberOfChannels / 8;
return new AudioRecord(MediaRecorder.AudioSource.MIC, return new AudioRecord(MediaRecorder.AudioSource.MIC,
sampleRate, AudioFormat.CHANNEL_IN_MONO, sampleRate, AudioFormat.CHANNEL_IN_MONO,
......
...@@ -274,8 +274,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler { ...@@ -274,8 +274,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler {
// Append all audio-values in srcBuffer to audioBuffer // Append all audio-values in srcBuffer to audioBuffer
private void storeBuffer(short[] srcBuffer) { private void storeBuffer(short[] srcBuffer) {
if(audioBuffer.length < audioBufLength + srcBuffer.length) { if(audioBuffer.length < audioBufLength + srcBuffer.length) {
int newBufLength = 2 * audioBuffer.length; short[] newBuffer = new short[(2 * audioBuffer.length)];
short[] newBuffer = new short[newBufLength];
System.arraycopy(audioBuffer, 0, newBuffer, 0, audioBufLength); System.arraycopy(audioBuffer, 0, newBuffer, 0, audioBufLength);
audioBuffer = newBuffer; audioBuffer = newBuffer;
} }
...@@ -303,9 +302,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler { ...@@ -303,9 +302,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler {
totalAudioLength += buffer.length; totalAudioLength += buffer.length;
if (this.type == 0 && if (this.type == 0 &&
Math.round((double) totalAudioLength / sampleRate) < Recording.SAMPLE_SEC) // 15sec sample Math.round((double) totalAudioLength / sampleRate) < Recording.SAMPLE_SEC) // 15sec sample
{
sampleFile.write(buffer); sampleFile.write(buffer);
}
} }
......
...@@ -41,8 +41,7 @@ public class ThumbRespeaker { ...@@ -41,8 +41,7 @@ public class ThumbRespeaker {
public ThumbRespeaker(Recording original, UUID respeakingUUID, public ThumbRespeaker(Recording original, UUID respeakingUUID,
int rewindAmount) throws Microphone.MicException, IOException { int rewindAmount) throws Microphone.MicException, IOException {
if(BuildConfig.DEBUG)Log.d("Rte-ThumbRespeaker", "smp : " + original.getSampleRate()); if(BuildConfig.DEBUG)Log.d("Rte-ThumbRespeaker", "smp : " + original.getSampleRate());
recorder = new Recorder(1, new File(Recording.getNoSyncRecordingsPath(), recorder = new Recorder(1, new File(Recording.getNoSyncRecordingsPath(), respeakingUUID + ".wav"), original.getSampleRate());
respeakingUUID + ".wav"), original.getSampleRate());
player = new SimplePlayer(original, true); player = new SimplePlayer(original, true);
mapper = new Mapper(respeakingUUID); mapper = new Mapper(respeakingUUID);
setFinishedPlaying(false); setFinishedPlaying(false);
...@@ -60,10 +59,9 @@ public class ThumbRespeaker { ...@@ -60,10 +59,9 @@ public class ThumbRespeaker {
* @throws MicException If the microphone couldn't be used. * @throws MicException If the microphone couldn't be used.
* @throws IOException If there is an I/O issue. * @throws IOException If there is an I/O issue.
*/ */
public ThumbRespeaker(RecordingLig original, UUID respeakingUUID, public ThumbRespeaker(RecordingLig original, UUID respeakingUUID, int rewindAmount)
int rewindAmount) throws MicException, IOException { throws MicException, IOException {
recorder = new Recorder(1, new File(Recording.getNoSyncRecordingsPath(), recorder = new Recorder(1, new File(Recording.getNoSyncRecordingsPath(), respeakingUUID + ".wav"), original.getSampleRate());
respeakingUUID + ".wav"), original.getSampleRate());
player = new SimplePlayer(original, true); player = new SimplePlayer(original, true);
mapper = new Mapper(respeakingUUID); mapper = new Mapper(respeakingUUID);
setFinishedPlaying(false); setFinishedPlaying(false);
......
...@@ -1410,8 +1410,8 @@ public class Recording extends FileModel { ...@@ -1410,8 +1410,8 @@ public class Recording extends FileModel {
*/ */
/* /*
public static void enableSync(String id) throws IOException { public static void enableSync(String id) throws IOException {
File wavFile = new File(getNoSyncRecordingsPath(), uuid + ".wav"); File WavFile = new File(getNoSyncRecordingsPath(), uuid + ".wav");
FileUtils.moveFileToDirectory(wavFile, getRecordingsPath(), false); FileUtils.moveFileToDirectory(WavFile, getRecordingsPath(), false);
} }
*/ */
......
...@@ -66,33 +66,31 @@ public class CheckTranscription extends AikumaActivity { ...@@ -66,33 +66,31 @@ public class CheckTranscription extends AikumaActivity {
initProgressBars(); initProgressBars();
if(BuildConfig.DEBUG)Log.d("dataPath", dataPath); if(BuildConfig.DEBUG)Log.d("dataPath", dataPath);
prefsUserSession = getSharedPreferences(getString(R.string.userSession), MODE_PRIVATE); prefsUserSession = getSharedPreferences("userSession", MODE_PRIVATE);
date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date()); date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date());
//case: session already exists //case: session already exists
boolean append; boolean append;
if (prefsUserSession.getBoolean(getString(R.string.sessionActive), false)) { if (prefsUserSession.getBoolean("active", false)) {
//retrieve selected file handled in the last session //retrieve selected file handled in the last session
transcripTextFile = prefsUserSession.getString(getString(R.string.sessionInputFile),null); transcripTextFile = prefsUserSession.getString("inputFile",null);
if(BuildConfig.DEBUG)Log.i(TAG, "Selected import file: " + transcripTextFile); if(BuildConfig.DEBUG)Log.i(TAG, "Selected import file: " + transcripTextFile);
//retrieve result file handled in the last session //retrieve result file handled in the last session
transcriptChecked = prefsUserSession.getString(getString(R.string.sessionCheckExportFile),null); transcriptChecked = prefsUserSession.getString("checkExportFile",null);
if(BuildConfig.DEBUG)Log.i(TAG, "Selected export file: " + transcriptChecked); if(BuildConfig.DEBUG)Log.i(TAG, "Selected export file: " + transcriptChecked);
//retrieve number of lines already handled in the last session //retrieve number of lines already handled in the last session
//nbReadLines = Integer.parseInt(prefsUserSession.getString(getString(R.string.sessionProgress),"0")); //nbReadLines = Integer.parseInt(prefsUserSession.getString(getString(R.string.sessionProgress),"0"));
nbReadLines = prefsUserSession.getInt(getString(R.string.currentLine), 0); nbReadLines = prefsUserSession.getInt("currentLine", 0);
if(BuildConfig.DEBUG)Log.i(TAG, "onCreate - #sentences treated: " + nbReadLines); if(BuildConfig.DEBUG)Log.i(TAG, "onCreate - #sentences treated: " + nbReadLines);
append = true; append = true;
// clear the current stored session // clear the current stored session
SharedPreferences.Editor ed = prefsUserSession.edit(); prefsUserSession.edit().clear().apply();
ed.clear();
ed.commit();
isNewSession = false; isNewSession = false;
if(BuildConfig.DEBUG)Log.i(TAG, "Is it a new session ? "+isNewSession); if(BuildConfig.DEBUG)Log.i(TAG, "Is it a new session ? "+ false);
//case: no session //case: no session
} else { } else {
transcripTextFile = getIntent().getStringExtra(CheckMode.importFileName); transcripTextFile = getIntent().getStringExtra(CheckMode.importFileName);
if(BuildConfig.DEBUG)Log.i(TAG, "Is it a new session ? "+isNewSession); if(BuildConfig.DEBUG){Log.i(TAG, "Is it a new session ? "+isNewSession);
if(BuildConfig.DEBUG)Log.i(TAG, "Selected file: " + transcripTextFile); Log.i(TAG, "Selected file: " + transcripTextFile);}
append = false; append = false;
//output filename //output filename
transcriptChecked = transcripTextFile.replace(".txt", "_"+date+"_CHECKED.txt"); transcriptChecked = transcripTextFile.replace(".txt", "_"+date+"_CHECKED.txt");
...@@ -307,13 +305,13 @@ public class CheckTranscription extends AikumaActivity { ...@@ -307,13 +305,13 @@ public class CheckTranscription extends AikumaActivity {
*/ */
date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date()); date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date());
SharedPreferences.Editor ed = prefsUserSession.edit(); SharedPreferences.Editor ed = prefsUserSession.edit();
ed.putBoolean(getString(R.string.sessionActive), true); //session activated ed.putBoolean("active", true); //session activated
ed.putInt(getString(R.string.currentLine), nbReadLines); //nb lines ed.putInt("currentLine", nbReadLines); //nb lines
ed.putString(getString(R.string.sessionProgress), nbReadLines + " / " + nb_total_lines); ed.putString("progress", nbReadLines + " / " + nb_total_lines);
ed.putString(getString(R.string.sessionInputFile), transcripTextFile); //handled file ed.putString("inputFile", transcripTextFile); //handled file
ed.putString(getString(R.string.sessionCheckExportFile), transcriptChecked); //resulting file ed.putString("checkExportFile", transcriptChecked); //resulting file
ed.putString(getString(R.string.sessionDate), date); //set date ed.putString("date", date); //set date
ed.putString(getString(R.string.sessionMode),TAG); //set mode ed.putString("mode",TAG); //set mode
// ed.putBoolean(getString(R.string.checkTranscript), true); //set submode // ed.putBoolean(getString(R.string.checkTranscript), true); //set submode
//save infos //save infos
ed.commit(); ed.commit();
...@@ -354,13 +352,12 @@ public class CheckTranscription extends AikumaActivity { ...@@ -354,13 +352,12 @@ public class CheckTranscription extends AikumaActivity {
try { try {
if(BuildConfig.DEBUG)Log.i("saveFile", "Writing on file"); if(BuildConfig.DEBUG)Log.i("saveFile", "Writing on file");
//if checked //if checked
if (transcriptOK.isChecked()) { if(transcriptOK.isChecked())
outputFile.write(transcriptID.getText()+" : "+transcriptOK.getText()+"\n"); outputFile.write(transcriptID.getText()+" : "+transcriptOK.getText()+"\n");
}
} catch (IOException e1) {e1.printStackTrace();} } catch (IOException e1) {e1.printStackTrace();}
return true; return true;
} }
private void interruptionCallback() { private void interruptionCallback() {
if (nbReadLines == 0) { if (nbReadLines == 0) {
......
...@@ -53,9 +53,9 @@ public class CheckWordVariant extends AikumaActivity { ...@@ -53,9 +53,9 @@ public class CheckWordVariant extends AikumaActivity {
setContentView(R.layout.check_word_variant); setContentView(R.layout.check_word_variant);
initProgressBars(); initProgressBars();
date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date()); date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date());
prefsUserSession = getSharedPreferences(getString(R.string.userSession), MODE_PRIVATE); prefsUserSession = getSharedPreferences("userSession", MODE_PRIVATE);
//case: session already exists //case: session already exists
if (prefsUserSession.getBoolean(getString(R.string.sessionActive), false)) { if (prefsUserSession.getBoolean("active", false)) {
/* /*
* TODO rajouter une condition en && * TODO rajouter une condition en &&
* soustraire date.now à date session : * soustraire date.now à date session :
...@@ -63,18 +63,17 @@ public class CheckWordVariant extends AikumaActivity { ...@@ -63,18 +63,17 @@ public class CheckWordVariant extends AikumaActivity {
* sinon continue; * sinon continue;
*/ */
//retrieve selected file handled in the last session //retrieve selected file handled in the last session
variantTextFile = prefsUserSession.getString(getString(R.string.sessionInputFile),null); variantTextFile = prefsUserSession.getString("inputFile", null);
if(BuildConfig.DEBUG)Log.i(TAG, "Selected import file: " + variantTextFile); if(BuildConfig.DEBUG)Log.i(TAG, "Selected import file: " + variantTextFile);
//retrieve result file handled in the last session //retrieve result file handled in the last session
variantchecked = prefsUserSession.getString(getString(R.string.sessionCheckExportFile),null); variantchecked = prefsUserSession.getString("checkExportFile",null);
if(BuildConfig.DEBUG)Log.i(TAG, "Selected export file: " + variantchecked); if(BuildConfig.DEBUG)Log.i(TAG, "Selected export file: " + variantchecked);
//retrieve number of lines already handled in the last session //retrieve number of lines already handled in the last session
nbReadLines = prefsUserSession.getInt(getString(R.string.nbReadLines),0); nbReadLines = prefsUserSession.getInt("nbReadLine",0);
append = true; append = true;
// clear the current stored session // clear the current stored session
SharedPreferences.Editor ed = prefsUserSession.edit(); prefsUserSession.edit().clear().apply();
ed.clear(); ed.commit();
//case: no session //case: no session
} else { } else {
variantTextFile = getIntent().getStringExtra(CheckMode.importFileName); variantTextFile = getIntent().getStringExtra(CheckMode.importFileName);
...@@ -304,16 +303,16 @@ public class CheckWordVariant extends AikumaActivity { ...@@ -304,16 +303,16 @@ public class CheckWordVariant extends AikumaActivity {
Toast.makeText(this, R.string.the_session_has_been_saved, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.the_session_has_been_saved, Toast.LENGTH_SHORT).show();
date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date()); date = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.FRANCE).format(new Date());
SharedPreferences.Editor ed = prefsUserSession.edit(); SharedPreferences.Editor ed = prefsUserSession.edit();
ed.putBoolean(getString(R.string.sessionActive), true); //session activated ed.putBoolean("active", true); //session activated
ed.putInt(getString(R.string.nbReadLines), nbReadLines); //nb lines ed.putInt("nbReadLine", nbReadLines); //nb lines
ed.putString(getString(R.string.sessionProgress), nbReadLines + "/" + totalNumberOfExpressions); ed.putString("progress", nbReadLines + "/" + totalNumberOfExpressions);
ed.putString(getString(R.string.sessionInputFile), variantTextFile); //handled file ed.putString("inputFile", variantTextFile); //handled file
ed.putString(getString(R.string.sessionCheckExportFile), variantchecked); //resulting file ed.putString("checkExportFile", variantchecked); //resulting file
ed.putString(getString(R.string.sessionDate), date); //set date ed.putString("date", date); //set date
ed.putString(getString(R.string.sessionMode),TAG); //set mode ed.putString("mode",TAG); //set mode
// ed.putBoolean(getString(R.string.checkVariant), true); //set submode // ed.putBoolean(getString(R.string.checkVariant), true); //set submode
//save infos //save infos
ed.commit(); ed.apply();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -91,8 +91,8 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -91,8 +91,8 @@ public class CloudSearchActivity extends AikumaListActivity {
isMediaPlayerPrepared = false; isMediaPlayerPrepared = false;
setUpQuickMenu(); setUpQuickMenu();
recordings = new ArrayList<Recording>(); recordings = new ArrayList<>();
itemIdsToDownload = new ArrayList<String>(); itemIdsToDownload = new ArrayList<>();
adapter = new RecordingArrayAdapter(this, recordings, quickMenu); adapter = new RecordingArrayAdapter(this, recordings, quickMenu);
setListAdapter(adapter); setListAdapter(adapter);
...@@ -176,7 +176,7 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -176,7 +176,7 @@ public class CloudSearchActivity extends AikumaListActivity {
// Creates the quickMenu for the original recording // Creates the quickMenu for the original recording
//(quickMenu: download) //(quickMenu: download)
private void setUpQuickMenu() { private void setUpQuickMenu() {
quickMenu = new QuickActionMenu<Recording>(this); quickMenu = new QuickActionMenu<>(this);
if(AikumaSettings.getCurrentUserToken() != null) { if(AikumaSettings.getCurrentUserToken() != null) {
QuickActionItem sampleDownloadAct = new QuickActionItem("Sample", R.drawable.download_32); QuickActionItem sampleDownloadAct = new QuickActionItem("Sample", R.drawable.download_32);
...@@ -224,7 +224,7 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -224,7 +224,7 @@ public class CloudSearchActivity extends AikumaListActivity {
String sampleCloudId = new FileModel(recording.getVersionName(), String sampleCloudId = new FileModel(recording.getVersionName(),
recording.getOwnerId(), recording.getPreviewId(), "preview", "wav"). recording.getOwnerId(), recording.getPreviewId(), "preview", "wav").
getCloudIdentifier(0); getCloudIdentifier(0);
List<String> cloudId = new ArrayList<String>(); List<String> cloudId = new ArrayList<>();
cloudId.add(sampleCloudId); cloudId.add(sampleCloudId);
new RequestShareFileTask(cloudId, googleEmailAccount, googleAuthToken).execute(); new RequestShareFileTask(cloudId, googleEmailAccount, googleAuthToken).execute();
...@@ -290,10 +290,10 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -290,10 +290,10 @@ public class CloudSearchActivity extends AikumaListActivity {
this.mAccessToken = accessToken; this.mAccessToken = accessToken;
this.mQuery = query; this.mQuery = query;
constraints = new TreeMap<String, String>(); constraints = new TreeMap<>();
cloudIdsToDownload = new ArrayList<String>(); cloudIdsToDownload = new ArrayList<>();
metadataToWrite = new HashMap<String, String>(); metadataToWrite = new HashMap<>();
speakerIdsToDownload = new ArrayList<String>(); speakerIdsToDownload = new ArrayList<>();
} }
@Override @Override
...@@ -390,7 +390,7 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -390,7 +390,7 @@ public class CloudSearchActivity extends AikumaListActivity {
// String metadataJSONStr = result.get("metadata"); // String metadataJSONStr = result.get("metadata");
// metadataToWrite.put(identifier, metadataJSONStr); // metadataToWrite.put(identifier, metadataJSONStr);
FileModel fm = FileModel.fromCloudId(identifier); FileModel fm = FileModel.fromCloudId(identifier);
String metadataCloudId = fm.getCloudIdentifier(1); String metadataCloudId = (fm != null)?fm.getCloudIdentifier(1):null;
cloudIdsToDownload.add(metadataCloudId); cloudIdsToDownload.add(metadataCloudId);
} }
...@@ -419,7 +419,7 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -419,7 +419,7 @@ public class CloudSearchActivity extends AikumaListActivity {
File dir = new File(FileIO.getAppRootPath(), relPath); File dir = new File(FileIO.getAppRootPath(), relPath);
dir.mkdirs(); dir.mkdirs();
if(BuildConfig.DEBUG)Log.i(TAG, dir.getAbsolutePath() + ", " + fileModel.getMetadataIdExt()); if(BuildConfig.DEBUG)Log.i(TAG, dir.getAbsolutePath() + ", " + ((fileModel != null)?fileModel.getMetadataIdExt():""));
FileIO.writeJSONObject(new File(dir, fileModel.getMetadataIdExt()), jsonObj); FileIO.writeJSONObject(new File(dir, fileModel.getMetadataIdExt()), jsonObj);
} catch (ParseException | IOException e) { } catch (ParseException | IOException e) {
if(BuildConfig.DEBUG)Log.e(TAG, e.getMessage()); if(BuildConfig.DEBUG)Log.e(TAG, e.getMessage());
...@@ -507,10 +507,8 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -507,10 +507,8 @@ public class CloudSearchActivity extends AikumaListActivity {
if(BuildConfig.DEBUG)Log.i(TAG, "autodownload start"); if(BuildConfig.DEBUG)Log.i(TAG, "autodownload start");
Intent syncIntent = new Intent(CloudSearchActivity.this, GoogleCloudService.class); Intent syncIntent = new Intent(CloudSearchActivity.this, GoogleCloudService.class);
syncIntent.putExtra(GoogleCloudService.ACTION_KEY, "autoDownload"); syncIntent.putExtra(GoogleCloudService.ACTION_KEY, "autoDownload");
syncIntent.putExtra(GoogleCloudService.ACCOUNT_KEY, syncIntent.putExtra(GoogleCloudService.ACCOUNT_KEY, AikumaSettings.getCurrentUserId());
AikumaSettings.getCurrentUserId()); syncIntent.putExtra(GoogleCloudService.TOKEN_KEY, AikumaSettings.getCurrentUserToken());
syncIntent.putExtra(GoogleCloudService.TOKEN_KEY,
AikumaSettings.getCurrentUserToken());
syncIntent.putStringArrayListExtra("downloadItems", mSharedFileCloudIds); syncIntent.putStringArrayListExtra("downloadItems", mSharedFileCloudIds);
startService(syncIntent); startService(syncIntent);
...@@ -543,8 +541,7 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -543,8 +541,7 @@ public class CloudSearchActivity extends AikumaListActivity {
protected Boolean doInBackground(Void... params) { protected Boolean doInBackground(Void... params) {
DataStore gd; DataStore gd;
try { try {
gd = new GoogleDriveStorage(mAccessToken, gd = new GoogleDriveStorage(mAccessToken, AikumaSettings.ROOT_FOLDER_ID, AikumaSettings.CENTRAL_USER_ID);
AikumaSettings.ROOT_FOLDER_ID, AikumaSettings.CENTRAL_USER_ID);
} catch (DataStore.StorageException e) { } catch (DataStore.StorageException e) {
if(BuildConfig.DEBUG)Log.e(TAG, "Failed to initialize GoogleDriveStorage"); if(BuildConfig.DEBUG)Log.e(TAG, "Failed to initialize GoogleDriveStorage");
return false; return false;
...@@ -578,15 +575,13 @@ public class CloudSearchActivity extends AikumaListActivity { ...@@ -578,15 +575,13 @@ public class CloudSearchActivity extends AikumaListActivity {
@Override @Override
protected void onPostExecute(final Boolean result) { protected void onPostExecute(final Boolean result) {
if (result) { if (result) {
Toast.makeText(CloudSearchActivity.this, Toast.makeText(CloudSearchActivity.this, R.string.sample_is_downloaded, Toast.LENGTH_LONG).show();
R.string.sample_is_downloaded,
Toast.LENGTH_LONG).show();
/* /*
if(!isMediaPlayerReleased) { if(!isMediaPlayerReleased) {
setUpPlayer(mFile); setUpPlayer(mFile);
mediaPlayer.start(); mediaPlayer.start();
}*/ }*/
} else { //} else {
//Aikuma.showAlertDialog(getApplicationContext(), "Error in downloading a file"); //Aikuma.showAlertDialog(getApplicationContext(), "Error in downloading a file");
} }
......
...@@ -94,7 +94,7 @@ public class DebugInfo extends Activity { ...@@ -94,7 +94,7 @@ public class DebugInfo extends Activity {
mPref.edit() mPref.edit()
.putString(AikumaSettings.SETTING_AUTH_TOKEN_KEY, toks[0]) .putString(AikumaSettings.SETTING_AUTH_TOKEN_KEY, toks[0])
.putString("id_token", toks[1]) .putString("id_token", toks[1])
.commit(); .apply();
displayTokens(); displayTokens();
break; break;
default: default:
...@@ -158,11 +158,11 @@ public class DebugInfo extends Activity { ...@@ -158,11 +158,11 @@ public class DebugInfo extends Activity {
if (tokens == null) if (tokens == null)
if(BuildConfig.DEBUG)Log.i(TAG, "failed"); if(BuildConfig.DEBUG)Log.i(TAG, "failed");
else { else {
final String[] toks = tokens; final String[] toks = null;
mPref.edit() mPref.edit()
.putString(AikumaSettings.SETTING_AUTH_TOKEN_KEY, tokens[0]) .putString(AikumaSettings.SETTING_AUTH_TOKEN_KEY, tokens[0])
.putString("id_token", tokens[1]) .putString("id_token", tokens[1])
.commit(); .apply();
new AsyncTask<Void,Void,Void>() { new AsyncTask<Void,Void,Void>() {
@Override @Override
...@@ -388,14 +388,13 @@ public class DebugInfo extends Activity { ...@@ -388,14 +388,13 @@ public class DebugInfo extends Activity {
StringBuffer hexString = new StringBuffer(); StringBuffer hexString = new StringBuffer();
String prefix = ""; String prefix = "";
for (int i = 0; i < publicKey.length; i++) { for(byte aPublicKey : publicKey) {
String appendString = Integer.toHexString(0xFF & publicKey[i]); String appendString = Integer.toHexString(0xFF & aPublicKey);
if (appendString.length() == 1) hexString.append("0"); if (appendString.length() == 1) hexString.append("0");
hexString.append(prefix); hexString.append(prefix);
hexString.append(appendString.toUpperCase()); hexString.append(appendString.toUpperCase());
prefix = ":"; prefix = ":";
} }
return hexString.toString(); return hexString.toString();
} catch (CertificateEncodingException e) { } catch (CertificateEncodingException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -195,7 +195,7 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -195,7 +195,7 @@ public class ElicitationMode extends AikumaActivity{
intent.putExtra(importFileName, mPath.getAbsolutePath()); intent.putExtra(importFileName, mPath.getAbsolutePath());
if(BuildConfig.DEBUG)Log.i(TAG, "selected file: " + mPath.getAbsolutePath()); if(BuildConfig.DEBUG)Log.i(TAG, "selected file: " + mPath.getAbsolutePath());
intent.putExtra(ELICITATION, true); intent.putExtra(ELICITATION, true);
intent.putExtra(getString(R.string.selectedFileType), selectedFileType); intent.putExtra("selectedFileType", selectedFileType);
startActivity(intent); startActivity(intent);
} }
......
...@@ -26,7 +26,6 @@ import android.widget.VideoView; ...@@ -26,7 +26,6 @@ import android.widget.VideoView;
import org.getalp.ligaikuma.lig_aikuma.Aikuma; import org.getalp.ligaikuma.lig_aikuma.Aikuma;
import org.getalp.ligaikuma.lig_aikuma.audio.InterleavedPlayer; import org.getalp.ligaikuma.lig_aikuma.audio.InterleavedPlayer;
import org.getalp.ligaikuma.lig_aikuma.audio.Player;
import org.getalp.ligaikuma.lig_aikuma.audio.SimplePlayer; import org.getalp.ligaikuma.lig_aikuma.audio.SimplePlayer;
import org.getalp.ligaikuma.lig_aikuma.audio.TranscriptPlayer; import org.getalp.ligaikuma.lig_aikuma.audio.TranscriptPlayer;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig; import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
......
...@@ -108,7 +108,7 @@ public class ListenFragment extends Fragment implements OnClickListener { ...@@ -108,7 +108,7 @@ public class ListenFragment extends Fragment implements OnClickListener {
isPlayed = false; isPlayed = false;
play (); play ();
} }
}; }
public void onStartTrackingTouch(SeekBar _seekBar) {}; public void onStartTrackingTouch(SeekBar _seekBar) {};
}); });
seekBar.invalidate(); seekBar.invalidate();
......
...@@ -8,7 +8,6 @@ import android.content.pm.ActivityInfo; ...@@ -8,7 +8,6 @@ import android.content.pm.ActivityInfo;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;