Commit e100c387 authored by mistermad's avatar mistermad

* Clean projet:

- unnecessary classes remove
- unused resources remove
- permission "camera" and "get-account" remove
- unnecessary dependency remove (aikuma-cloud-storage-0.8.0.jar, nanohttpd-2.0.5.jar, commons-net-3.1.jar et 'com.google.android.gms:play-services:10.2.1')
parent a12f3a38
...@@ -24,14 +24,11 @@ android { ...@@ -24,14 +24,11 @@ android {
dependencies { dependencies {
compile files('libs/aikuma-cloud-storage-0.8.0.jar')
compile files('libs/commons-io-2.4.jar') compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.1.jar') compile files('libs/commons-lang3-3.1.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/guava-13.0.1.jar') compile files('libs/guava-13.0.1.jar')
compile files('libs/json-simple-1.1.1.jar') compile files('libs/json-simple-1.1.1.jar')
compile files('libs/musicg-1.4.2.0.jar') compile files('libs/musicg-1.4.2.0.jar')
compile files('libs/nanohttpd-2.0.5.jar')
compile files('libs/opencsv-2.3.jar') compile files('libs/opencsv-2.3.jar')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
...@@ -40,7 +37,6 @@ dependencies { ...@@ -40,7 +37,6 @@ dependencies {
compile project(path: ':library') compile project(path: ':library')
compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-core-utils: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 'com.android.support:multidex:1.0.1'
compile 'javax.annotation:javax.annotation-api:1.2' compile 'javax.annotation:javax.annotation-api:1.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2'
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <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" package="org.getalp.ligaikuma.lig_aikuma.lig_aikuma"
android:versionCode="3" android:versionCode="3"
android:versionName="3.0"> android:versionName="3.0">
<uses-sdk android:minSdkVersion="14"/> <uses-sdk android:minSdkVersion="14"/>
<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"/>
...@@ -18,13 +15,10 @@ ...@@ -18,13 +15,10 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <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_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_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"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:name="android.hardware.camera"/>
<application <application
android:name="android.support.multidex.MultiDexApplication" android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true" android:allowBackup="true"
...@@ -32,179 +26,21 @@ ...@@ -32,179 +26,21 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/MyTheme"> android:theme="@style/MyTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<receiver android:name="org.getalp.ligaikuma.lig_aikuma.service.BootReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.MainActivity" android:name="org.getalp.ligaikuma.lig_aikuma.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
</activity> </activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenRespeakingActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSearchActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordVideoActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.SettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity1"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity2"
android:configChanges="orientation"
android:label="@string/app_name"
tools:targetApi="jelly_bean">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity3"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity4"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterList"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingSpeakersActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.MainSpeakersActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity1"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity2"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity3"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity4"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivity" android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:label="@string/app_name"> android:label="@string/app_name">
</activity> </activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.PhoneRespeakActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddCustomLanguageActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.DefaultLanguagesActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.SyncSettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AboutActivity"
android:configChanges="orientation"
android:label="@string/app_name">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.HttpServerActivity"
android:label="@string/http_server_activity_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.getalp.ligaikuma.lig_aikuma.MainActivity"/>
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.HowtoActivity"
android:label="@string/http_server_activity_title"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.getalp.ligaikuma.lig_aikuma.MainActivity"/>
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.DebugInfo"
android:label="@string/title_activity_debug_info"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.ui.AboutActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.getalp.ligaikuma.lig_aikuma.ui.AboutActivity"/>
</activity>
<service android:name="org.getalp.ligaikuma.lig_aikuma.service.GoogleCloudService"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ModeSelection"> <activity android:name="org.getalp.ligaikuma.lig_aikuma.ModeSelection">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
...@@ -212,7 +48,7 @@ ...@@ -212,7 +48,7 @@
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig" android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig"
android:configChanges="orientation|screenSize"> android:configChanges="orientation|screenSize">
</activity> </activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterListLIG"/> <activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterList"/>
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivityLig" android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivityLig"
android:configChanges="orientation|screenSize"/> android:configChanges="orientation|screenSize"/>
...@@ -230,15 +66,9 @@ ...@@ -230,15 +66,9 @@
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode" android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode"
android:configChanges="orientation|screenSize"/> android:configChanges="orientation|screenSize"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.TranslationSelection"/>
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitation" android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitation"
android:configChanges="orientation|screenSize"/> android:configChanges="orientation|screenSize"/>
<!--
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitationImage"
android:configChanges="orientation|screenSize" /> Not found in project
-->
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckMode" android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckMode"
android:configChanges="orientation|screenSize"/> android:configChanges="orientation|screenSize"/>
...@@ -248,12 +78,9 @@ ...@@ -248,12 +78,9 @@
<activity <activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckTranscription" android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckTranscription"
android:configChanges="orientation|screenSize"/> android:configChanges="orientation|screenSize"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.SpeakerActivity"> <activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.SpeakerActivity"/>
</activity> <activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ShareFileActivity"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ShareFileActivity"> <activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationFileSearch"/>
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationFileSearch">
</activity>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package org.getalp.ligaikuma.lig_aikuma.audio; package org.getalp.ligaikuma.lig_aikuma.audio;
import android.app.Activity; import android.app.Activity;
import android.widget.TextView;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.R;
import org.getalp.ligaikuma.lig_aikuma.model.Recording; import org.getalp.ligaikuma.lig_aikuma.model.Recording;
import org.getalp.ligaikuma.lig_aikuma.model.Segments.Segment; import org.getalp.ligaikuma.lig_aikuma.model.Segments.Segment;
import org.getalp.ligaikuma.lig_aikuma.model.TempTranscript; import org.getalp.ligaikuma.lig_aikuma.model.TempTranscript;
...@@ -62,21 +59,10 @@ public class TranscriptPlayer extends MarkedPlayer ...@@ -62,21 +59,10 @@ public class TranscriptPlayer extends MarkedPlayer
// Updates the transcript Ui and prepares the notification marker position. // Updates the transcript Ui and prepares the notification marker position.
private void updateTranscriptStatus(long sample) { private void updateTranscriptStatus(long sample) {
Segment segment = transcript.getSegmentOfSample(sample); Segment segment = transcript.getSegmentOfSample(sample);
updateTranscriptUi(segment);
setNotificationMarkerPosition(segment); setNotificationMarkerPosition(segment);
} }
// Update the UI such that the transcript reflects the current segment.
private void updateTranscriptUi(Segment segment) {
if (segment != null) {
((TextView) activity.findViewById(R.id.transcriptView)).setText(transcript.getTranscriptPair(segment).transcript);
((TextView) activity.findViewById(R.id.transcriptView2)).setText(transcript.getTranscriptPair(segment).translation);
}
else
((TextView) activity.findViewById(R.id.transcriptView)).setText("");
}
@Override @Override
public void seekToMsec(int msec) { public void seekToMsec(int msec) {
super.seekToMsec(msec); super.seekToMsec(msec);
......
/*
Copyright (C) 2013, The Aikuma Project
AUTHORS: Oliver Adams and Florian Hanke
*/
/**
* The audio package offers classes to facilitate playing, recording, and
* respeaking of audio in Aikuma.
*
* @author Oliver Adams <oliver.adams@gmail.com>
* @author Florian Hanke <florian.hanke@gmail.com>
*/
package org.getalp.ligaikuma.lig_aikuma.audio;
...@@ -146,8 +146,9 @@ public class PCMWriter implements Sampler { ...@@ -146,8 +146,9 @@ public class PCMWriter implements Sampler {
*/ */
public void write(short[] buffer, int len) { public void write(short[] buffer, int len) {
byte[] byteBuffer = new byte[len * 2]; byte[] byteBuffer = new byte[len * 2];
short sample;
for(int i = 0; i < len; i++) { for(int i = 0; i < len; i++) {
short sample = buffer[i]; sample = buffer[i];
byteBuffer[i * 2] = (byte) sample; byteBuffer[i * 2] = (byte) sample;
byteBuffer[i * 2 + 1] = (byte) (sample >>> 8); byteBuffer[i * 2 + 1] = (byte) (sample >>> 8);
} }
...@@ -201,7 +202,6 @@ public class PCMWriter implements Sampler { ...@@ -201,7 +202,6 @@ public class PCMWriter implements Sampler {
private void createRandomAccessFile() { private void createRandomAccessFile() {
try { try {
// Random access file. // Random access file.
//
File file = new File(this.fullFilename); File file = new File(this.fullFilename);
if(BuildConfig.DEBUG)Log.i("mkdirs", " " + file.getParentFile().mkdirs() + ", on " + if(BuildConfig.DEBUG)Log.i("mkdirs", " " + file.getParentFile().mkdirs() + ", on " +
file.getParentFile()); file.getParentFile());
...@@ -326,19 +326,16 @@ public class PCMWriter implements Sampler { ...@@ -326,19 +326,16 @@ public class PCMWriter implements Sampler {
try { try {
// Write size to RIFF header. // Write size to RIFF header.
//
randomAccessWriter.seek(4); randomAccessWriter.seek(4);
randomAccessWriter.writeInt(Integer.reverseBytes(36 + payloadSize)); randomAccessWriter.writeInt(Integer.reverseBytes(36 + payloadSize));
// Write size to Sub-chunk size header. // Write size to Sub-chunk size header.
//
randomAccessWriter.seek(40); randomAccessWriter.seek(40);
randomAccessWriter.writeInt(Integer.reverseBytes(payloadSize)); randomAccessWriter.writeInt(Integer.reverseBytes(payloadSize));
randomAccessWriter.close(); randomAccessWriter.close();
} catch (IOException e) { } catch (IOException e) {
if(BuildConfig.DEBUG)Log.e(PCMWriter.class.getName(), if(BuildConfig.DEBUG)Log.e(PCMWriter.class.getName(),"I/O exception occured while closing output file");
"I/O exception occured while closing output file");
} }
} }
......
/*
Copyright (C) 2013, The Aikuma Project
AUTHORS: Oliver Adams and Florian Hanke
*/
/**
* This package contains Analyzers take samples and analyze them, calling
* audioTriggered or silenceTriggered on an AudioHandler when appropriate.
*
* @author Oliver Adams <oliver.adams@gmail.com>
* @author Florian Hanke <florian.hanke@gmail.com>
*/
package org.getalp.ligaikuma.lig_aikuma.audio.record.analyzers;
/*
Copyright (C) 2013, The Aikuma Project
AUTHORS: Oliver Adams and Florian Hanke
*/
/**
* The record package contains classes that facilitate recording and respeaking
* of audio in Aikuma.
*
* @author Oliver Adams <oliver.adams@gmail.com>
* @author Florian Hanke <florian.hanke@gmail.com>
*/
package org.getalp.ligaikuma.lig_aikuma.audio.record;
/*
Copyright (C) 2013, The Aikuma Project
AUTHORS: Oliver Adams and Florian Hanke
*/
/**
* Recognizers are used to determine whether buffers contain speech or silence.
*
* @author Oliver Adams <oliver.adams@gmail.com>
* @author Florian Hanke <florian.hanke@gmail.com>
*/
package org.getalp.ligaikuma.lig_aikuma.audio.record.recognizers;
package org.getalp.ligaikuma.lig_aikuma.http;
import java.util.ArrayList;
import java.util.List;
import fi.iki.elonen.NanoHTTPD.IHTTPSession;
import fi.iki.elonen.NanoHTTPD.Response;
/**
* Allows to create a chain of HTTP request processors.
*
* @author Haejoong Lee <haejoong@ldc.upenn.edu>
*/
abstract public class Proc {
private List<Proc> procs;
/**
* Add a new processor to the processor chain and returns itself.
*
* @param p Proc object
* @return this object.
*/
public Proc add(Proc p) {
if (procs == null) {
procs = new ArrayList<Proc>();
procs.add(this);
}
procs.add(p);
return this;
}
/**
* The actual behavior of the object should be implemented here.
* @param session An HTTP session object.
* @return a Response object, or null if the HTTP request, described by
* the session object, was not handled.
*/
abstract public Response run(IHTTPSession session);
/**
* Execute the processor chain.
* @param session HTTP session object given to the serve() method of
* NanoHTTPD object.
* @return a Response object, or null if the HTTP request was not
* handled.
*/
public Response exec(IHTTPSession session) {
for(Proc proc : procs) {
Response r = proc.run(session);
if(r != null)
return r;
}
return null;
}
}
package org.getalp.ligaikuma.lig_aikuma.http;
import android.content.res.AssetManager;
import org.apache.http.conn.util.InetAddressUtils;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
import org.getalp.ligaikuma.lig_aikuma.model.Recording;
import org.getalp.ligaikuma.lig_aikuma.model.Speaker;
import org.getalp.ligaikuma.lig_aikuma.model.Transcript;
import org.getalp.ligaikuma.lig_aikuma.util.FileIO;