Commit 6e7e27b7 authored by mistermad's avatar mistermad

- Many bug fix

- New luncher icon
- Better undo working
parent cb2f21ad
......@@ -6,7 +6,7 @@ android {
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "org.getalp.ligaikuma"
minSdkVersion 14
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
versionCode 2
......
......@@ -5,6 +5,7 @@
package org.getalp.ligaikuma.lig_aikuma;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.Dialog;
......@@ -718,6 +719,7 @@ public class MainActivity extends ListActivity {
* Used to display audio files that the user can choose to load from.
* Reported as an error but is it not.
*/
@SuppressLint("ValidFragment")
public class FilebrowserDialogFragment extends DialogFragment {
@Override
......
......@@ -25,6 +25,7 @@ import org.getalp.ligaikuma.lig_aikuma.ui.sensors.LocationDetector;
import org.getalp.ligaikuma.lig_aikuma.util.AikumaSettings;
import org.getalp.ligaikuma.lig_aikuma.util.FileIO;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
......@@ -162,6 +163,7 @@ public class ModeSelection extends Activity implements OnClickListener{
dialog.show(getFragmentManager(), "SessionDialogFragment");
}
@SuppressLint("ValidFragment")
public class UserSessionDiaglogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
......
package org.getalp.ligaikuma.lig_aikuma.ui;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
......@@ -92,6 +93,7 @@ public class CheckMode extends AikumaActivity{
* Used to display audio files that the user can choose to load from.
* Copied from RespeakingSelection.java
*/
@SuppressLint("ValidFragment")
public class FilebrowserDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
......
package org.getalp.ligaikuma.lig_aikuma.ui;
import android.annotation.SuppressLint;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.DialogFragment;
......@@ -122,6 +123,7 @@ public class ElicitationMode extends AikumaActivity{
* Used to display audio files that the user can choose to load from.
* Copied from RespeakingSelection.java
*/
@SuppressLint("ValidFragment")
public class FilebrowserDialogFragment extends DialogFragment {
@Override
......@@ -176,7 +178,7 @@ public class ElicitationMode extends AikumaActivity{
File[] files = f.listFiles();
switch (selectedFileType) {
case ElicitationMode.IMAGE_MODE:
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg") || files[i].getAbsolutePath().contains(".JPG")))
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg") || files[i].getAbsolutePath().contains(".JPG") || files[i].getAbsolutePath().contains(".JPEG")))
i++;
return files.length == i && i>0;
case ElicitationMode.VIDEO_MODE:
......
......@@ -21,7 +21,7 @@ import java.util.List;
* @author Oliver Adams <oliver.adams@gmail.com>
* @author Florian Hanke <florian.hanke@gmail.com>
*/
class InterleavedSeekBar extends android.support.v7.widget.AppCompatSeekBar {
public class InterleavedSeekBar extends android.support.v7.widget.AppCompatSeekBar {
public InterleavedSeekBar(Context context) {
super(context, null, R.attr.seekBarStyle);
......
......@@ -26,7 +26,7 @@ public class ListFolderAdapter extends ArrayAdapter {
public ImageView imageTypeOfFolder;
}
public ListFolderAdapter(Context context, String[] files, File parentFile, int mode) {
public ListFolderAdapter(Context context, String[] files, File parentFile, int mode) {
super(context, R.layout.content_dialog_selected_folder_frag, files);
this.layoutInflater = LayoutInflater.from(context);
this.parentFile = parentFile;
......@@ -91,9 +91,12 @@ public class ListFolderAdapter extends ArrayAdapter {
switch (this.mode) {
case ElicitationMode.IMAGE_MODE:
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg"))))
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg") || files[i].getAbsolutePath().contains(".JPG") || files[i].getAbsolutePath().contains(".JPEG"))))
i++;
holder.imageTypeOfFolder.setVisibility((i == files.length && i>0)?ImageView.VISIBLE:ImageView.INVISIBLE);
if(i == files.length && i>0)
holder.imageTypeOfFolder.setVisibility(ImageView.VISIBLE);
else
holder.imageTypeOfFolder.setVisibility(ImageView.INVISIBLE);
break;
case ElicitationMode.VIDEO_MODE:
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".mp4") || files[i].getAbsolutePath().contains(".avi"))))
......
......@@ -460,13 +460,29 @@ public class RecordElicitation extends AikumaActivity {
* @param _view the next button
*/
public void onNextClick(View _view) {
if(!saveRecording() && (entityId < numberOfEntities)) {
if(BuildConfig.DEBUG)Log.d(TAG,"onNextClick => entityId was "+entityId+" next it will be "+(entityId+1));
Toast.makeText(this, R.string.going_next, Toast.LENGTH_SHORT).show();
}
_button_undo.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.undo2));
_button_undo.setEnabled(false);
ImageButton recordButton = (ImageButton) findViewById(R.id.btn_record_elicit);
recordButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.record));
recordButton.setEnabled(true);
saveOneRecord();
if(!saveRecording() && (entityId < numberOfEntities-1))
Toast.makeText(this, R.string.going_next, Toast.LENGTH_SHORT).show();
else
deleteAllTempFiles();
}
/**
* Delete all temporary files in dedicated folder
*/
private void deleteAllTempFiles()
{
for(File f : Recording.getNoSyncRecordingsPath().listFiles())
if(!f.delete() && BuildConfig.DEBUG)
Log.i(TAG, "Failed to delete file : "+f.toString());
}
public void onValidate(View _view) {
saveRecording();
if(entityId == 0) this.finish();
......@@ -596,17 +612,16 @@ public class RecordElicitation extends AikumaActivity {
recordingLig.write();
String filePath = recordingLig.getFile().getAbsolutePath(); //absolute path of the file
String filenamePath = ""; //name of the file with its absolute path;
if (entityId >= 0 && entityId < 10) {
if (entityId >= 0 && entityId < 10)
filenamePath = filePath.substring(0, filePath.length()-6)+".wav";
} else if (entityId < 100) {
else if (entityId < 100)
filenamePath = filePath.substring(0, filePath.length()-7)+".wav";
} else if (entityId < 1000) {
else if (entityId < 1000)
filenamePath = filePath.substring(0, filePath.length()-8)+".wav";
} else if (entityId < 10000) {
else if (entityId < 10000)
filenamePath = filePath.substring(0, filePath.length()-9)+".wav";
} else if (entityId < 100000) {
else if (entityId < 100000)
filenamePath = filePath.substring(0, filePath.length()-10)+".wav";
}
if(BuildConfig.DEBUG)Log.i(TAG, "filename path = "+filenamePath);
/*audio file*/
......@@ -652,7 +667,8 @@ public class RecordElicitation extends AikumaActivity {
_button_undo.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.undo));
_button_undo.setEnabled(true);
ImageButton recordButton = (ImageButton) findViewById(R.id.btn_record_elicit);
recordButton.setImageResource(R.drawable.record);
recordButton.setImageResource(R.drawable.record_disabled);
recordButton.setEnabled(false);
ImageButton nextButton = (ImageButton) findViewById(R.id.btn_next);
nextButton.setEnabled(true);
ImageButton validateButton = (ImageButton) findViewById(R.id.btn_validate);
......@@ -672,14 +688,14 @@ public class RecordElicitation extends AikumaActivity {
}
catch (IOException e) {
if(BuildConfig.DEBUG)Log.e(TAG, "Could not start the fragment of the file "
+ new File(Recording.getNoSyncRecordingsPath(), recordUUID.toString() + ".wav")
+ " : " + e);
+new File(Recording.getNoSyncRecordingsPath(),recordUUID.toString()+".wav")+" : " + e);
}
}
}
// Activates recording
private void record() {
private void record()
{
if (!recording) {
recording = true;
ImageButton recordButton = (ImageButton) findViewById(R.id.btn_record_elicit);
......@@ -880,37 +896,38 @@ public class RecordElicitation extends AikumaActivity {
}
}
////////////////////////////////// UNDO PART
/**
* Call by Undo button. Reset player and recorder and delete last temps file.
*
* @param _view Unuse param
*/
public void onUndoClick(View _view) {
// Button management
_button_undo.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.undo2));
_button_undo.setEnabled(false);
ImageButton recordButton = (ImageButton) findViewById(R.id.btn_record_elicit);
recordButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.record));
recordButton.setEnabled(true);
// Reset player
getFragmentManager().beginTransaction().replace(R.id.phrase_player, new ListenFragment()).commit();
fragment = (ListenFragment) getFragmentManager().findFragmentById(R.id.phrase_player);
fragment.releasePlayer();
try {
fragment.setPlayer(new SimplePlayer(new File(recorder.getWriter().getFullFileName()), sampleRate, true));
} catch (IOException ignored) {}
fragment.setProgress(0);
fragment.releasePlayer();
// Delete last temp file
File file = new File(Recording.getNoSyncRecordingsPath(), recordUUID.toString()+".wav");
try {
FileIO.delete(file);
if(BuildConfig.DEBUG)Log.i(TAG, "Deleting " + file.getAbsolutePath());
} catch (IOException e) {if(BuildConfig.DEBUG)Log.e(TAG, "failed to delete " + file.getAbsolutePath() + " - maybe the file didn't exist");}
} catch (IOException e) {if(BuildConfig.DEBUG)Log.e(TAG, "Failed to delete " + file.getAbsolutePath() + " - maybe the file didn't exist");}
// Reset recorder
recordUUID = UUID.randomUUID();
if (recorder != null) recorder.release();
try {
recorder = new Recorder(0, new File(Recording.getNoSyncRecordingsPath(), recordUUID.toString()+".wav"), sampleRate);
} catch (MicException ignored) {}
fragment.releasePlayer();
} catch (MicException ignored) {if(BuildConfig.DEBUG)Log.i(TAG, "Failed to create new recorder");}
}
}
......@@ -223,6 +223,7 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
*
* @param _view
*/
@SuppressWarnings("ResourceType")
public void onClickMoreLanguages(View _view) {
LinearLayout l_parent = (LinearLayout) findViewById(R.id.layout_languages); //retrieval of the parent LinearLayout
......@@ -251,9 +252,9 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
if(BuildConfig.DEBUG)Log.i("Retrieved text:", tsize);
float textSize = Float.parseFloat(tsize.split("sp")[0]);
tv_otherLanguage.setTextSize(textSize); //set textSize
//if(BuildConfig.DEBUG)Log.i("set textSize is:", Float.toString(textSize));
if(BuildConfig.DEBUG)Log.i("set textSize is:", Float.toString(textSize));
int tcolor = ta.getColor(1, Color.BLACK); //fetching color
//if(BuildConfig.DEBUG)Log.i("Retrieved textColor as hex:", Integer.toHexString(tcolor));
if(BuildConfig.DEBUG)Log.i(TAG, "Retrieved textColor as hex:"+ Integer.toHexString(tcolor));
String getcolorcode = Integer.toHexString(tcolor).substring(2);
String color = "#"+getcolorcode;
tv_otherLanguage.setTextColor(Color.parseColor(color)); //set textColor
......@@ -275,7 +276,7 @@ public class RecordingMetadataLig extends AikumaActivity implements OnClickListe
ll_more.addView(et_otherLanguage);
*/
TextView tv_selectedSdLanguage = (TextView) findViewById(R.id.tv_selectedSecondLanguage);
//TextView tv_selectedSdLanguage = (TextView) findViewById(R.id.tv_selectedSecondLanguage);
TextView tv_selectedOtherLanguage = new TextView(l_parent.getContext());
RelativeLayout.LayoutParams tv_selected_params = (RelativeLayout.LayoutParams) new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
tv_selected_params.addRule(RelativeLayout.RIGHT_OF, tv_otherLanguage.getId());
......
......@@ -156,7 +156,8 @@ public class RespeakingMetadataLig extends AikumaActivity implements OnClickList
Toast.makeText(this, R.string.failed_to_retrieve_language_from_selection, Toast.LENGTH_SHORT).show();
}
}
@SuppressWarnings("ResourceType")
public void onAddMoreLanguagesField(View _view) {
LinearLayout l_parent = (LinearLayout) findViewById(R.id.respeak_layout_languages);
LinearLayout l_language = (LinearLayout) l_parent.getChildAt(l_parent.getChildCount()-1);
......
package org.getalp.ligaikuma.lig_aikuma.ui;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
......@@ -106,6 +107,7 @@ public class RespeakingSelection extends AikumaActivity {
/**
* Used to display audio files that the user can choose to load from.
*/
@SuppressLint("ValidFragment")
public class FilebrowserDialogFragment extends DialogFragment {
ListView listElement;
......
......@@ -13,12 +13,14 @@ import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import org.getalp.ligaikuma.lig_aikuma.lig_aikuma.BuildConfig;
/**
* A simple location detector using GPS and NETWORK
*
* @author Sangyeop Lee <sangl1@student.unimelb.edu.au>
* @author Baudson Guillaume <baudson.guillaume@hotmail.fr>
*/
public class LocationDetector implements LocationListener
{
......@@ -27,9 +29,10 @@ public class LocationDetector implements LocationListener
* MIN_TIME_INTERVAL, MIN_DISTANCE_INTERVAL
* for location updates
*/
public static final double FALSE_LOCATION = -1000;
private final long MIN_TIME_INTERVAL = 1000 * 60;
private final long MIN_DISTANCE_INTERVAL = 10;
private final long MIN_TIME_INTERVAL = 60000;
private final long MIN_DISTANCE_INTERVAL = 0; //Only time
private final String TAG ="LocationDetector";
/**
* locationMagaer which provides location data
*/
......@@ -78,6 +81,8 @@ public class LocationDetector implements LocationListener
c.setSpeedRequired(false);
c.setCostAllowed(false);
this.provider = locationManager.getBestProvider(c, true);
for(String s : locationManager.getProviders(true))if(BuildConfig.DEBUG)Log.d(TAG, "Potential provider: "+s);
if(BuildConfig.DEBUG)Log.d(TAG, "Provider: "+this.provider);
}
/**
......@@ -139,8 +144,10 @@ public class LocationDetector implements LocationListener
@Override
public void onLocationChanged(Location location)
{
if(BuildConfig.DEBUG)Log.d(TAG, "onLocationChanged called");
if(null == bestLocation || location.getAccuracy() < bestLocation.getAccuracy())
{
if(BuildConfig.DEBUG)Log.d(TAG, "New best location find");
bestLocation = location;
if(!isLocation) isLocation = true;
}
......
......@@ -13,7 +13,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:textSize = "16dp"
android:textSize = "16sp"
android:layout_toRightOf="@+id/image_file_type"
android:gravity="center_vertical"
android:id="@+id/textFolderName"/>
......
......@@ -24,6 +24,5 @@
android:id="@+id/image_folder_type"
android:layout_alignParentRight="true"
android:src="@drawable/type_folder_image"
android:visibility="invisible"
/>
android:visibility="invisible"/>
</RelativeLayout>
......@@ -413,10 +413,12 @@
<TextView
android:id="@+id/textView17"
style="@style/respeak_TextviewMetadata2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/speaker_name"/>
android:text="@string/speaker_name"
style="@style/respeak_TextviewMetadata2"
android:textColor="#6FA9C8"
android:textStyle="bold"/>
<EditText
android:id="@+id/respeak_edit_spkr_name"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment