Commit 6973a854 authored by mistermad's avatar mistermad

- Add speaker profiles

- Bug fix: added language in RecordMetadataLig
- Minor change UI
- Minor bug fix
parent e10cb60b
......@@ -45,13 +45,14 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
//exclude module: 'support-v4'
})
compile ('com.android.support:appcompat-v7:25.3.1') {
compile('com.android.support:appcompat-v7:25.3.1') {
//exclude module: 'support-annotations'
}
compile "com.android.support:support-core-utils:25.3.1"
compile project(path: ':library')
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'
testCompile 'junit:junit:4.12'
compile 'javax.annotation:javax.annotation-api:1.2'
compile project(path: ':library')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
<?xml version="1.0" encoding="utf-8"?>
<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"
android:versionCode="1"
android:versionName="1.0">
xmlns:tools="http://schemas.android.com/tools"
package="org.getalp.ligaikuma.lig_aikuma.lig_aikuma"
android:versionCode="1"
android:versionName="1.0">
<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.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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-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"
......@@ -27,212 +30,250 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/MyTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
android:value="@integer/google_play_services_version"/>
<receiver android:name="org.getalp.ligaikuma.lig_aikuma.service.BootReceiver" >
<receiver android:name="org.getalp.ligaikuma.lig_aikuma.service.BootReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.MainActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan">
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.ModeSelection">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenRespeakingActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ListenRespeakingActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSearchActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSearchActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordVideoActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordVideoActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.SettingsActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.SettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity1"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity1"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity2"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity2"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity"
tools:targetApi="jelly_bean">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity3"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity3"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity4"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataActivity4"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterList"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterList"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingSpeakersActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingSpeakersActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.MainSpeakersActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.MainSpeakersActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity1"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity1"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity2"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity2"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity3"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity3"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity4"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddSpeakerActivity4"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.PhoneRespeakActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.PhoneRespeakActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddCustomLanguageActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AddCustomLanguageActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.DefaultLanguagesActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.DefaultLanguagesActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSettingsActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CloudSettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.SyncSettingsActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.SyncSettingsActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.AboutActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.AboutActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:parentActivityName="org.getalp.ligaikuma.lig_aikuma.MainActivity">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.HttpServerActivity"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.HttpServerActivity"
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" />
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.HowtoActivity"
<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" />
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"
<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" />
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" />
<service android:name="org.getalp.ligaikuma.lig_aikuma.service.GoogleCloudService"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ModeSelection">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig"
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig"
android:configChanges="orientation|screenSize">
</activity>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterListLIG" />
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.LanguageFilterListLIG"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordActivityLig"
android:configChanges="orientation|screenSize" />
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RespeakingSelection" />
android:configChanges="orientation|screenSize"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.RespeakingSelection"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RespeakingMetadataLig"
android:configChanges="orientation|screenSize" />
android:configChanges="orientation|screenSize"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakActivityLig"
android:configChanges="orientation|screenSize" />
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakSummaryLig"
android:configChanges="orientation|screenSize"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ThumbRespeakSummaryLig"
android:configChanges="orientation|screenSize">
</activity>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.ElicitationMode"
android:configChanges="orientation|screenSize" />
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.TranslationSelection" />
android:configChanges="orientation|screenSize"/>
<activity android:name="org.getalp.ligaikuma.lig_aikuma.ui.TranslationSelection"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitation"
android:configChanges="orientation|screenSize" />
<!--<activity
android:configChanges="orientation|screenSize"/>
<!--
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.RecordElicitationImage"
android:configChanges="orientation|screenSize" /> Not found in project-->
android:configChanges="orientation|screenSize" /> Not found in project
-->
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckMode"
android:configChanges="orientation|screenSize" />
android:configChanges="orientation|screenSize"/>
<activity
android:name="org.getalp.ligaikuma.lig_aikuma.ui.CheckWordVariant"
android:configChanges="orientation|screenSize" />
android:configChanges="orientation|screenSize"/>
<activity
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>
</application>
</manifest>
</manifest>
\ No newline at end of file
......@@ -99,12 +99,7 @@ public class Speaker extends FileModel {
*
* @return A String object.
*/
public String getName() {
if (name == null) {
return "";
}
return name;
}
public String getName() {return (name != null)? name: "";}
/**
* Gets the list of languages associated with the Speaker.
......@@ -146,9 +141,7 @@ public class Speaker extends FileModel {
* @return A Bitmap object.
* @throws IOException If the image cannot be retrieved.
*/
public Bitmap getImage() throws IOException {
return ImageUtils.retrieveFromFile(getImageFile());
}
public Bitmap getImage() throws IOException {return ImageUtils.retrieveFromFile(getImageFile());}
/**
* Gets the small version of the Speaker's image.
......@@ -169,12 +162,9 @@ public class Speaker extends FileModel {
* @return A Bitmap object.
* @throws IOException If the image cannot be retrieved.
*/
public static Bitmap getSmallImage(String verName, String ownerAccount,
String speakerId) throws IOException {
public static Bitmap getSmallImage(String verName, String ownerAccount, String speakerId) throws IOException {
File ownerDir = FileIO.getOwnerPath(verName, ownerAccount);
return ImageUtils.retrieveFromFile(
new File(getSpeakersPath(ownerDir),
speakerId + "/" + speakerId + "-image-small.jpg"));
return ImageUtils.retrieveFromFile(new File(getSpeakersPath(ownerDir), speakerId + "/" + speakerId + "-image-small.jpg"));
}
......@@ -202,7 +192,7 @@ public class Speaker extends FileModel {
*/
public static JSONArray encodeList(List<Speaker> speakers) {
JSONArray speakerArray = new JSONArray();
for (Speaker speaker : speakers)
for(Speaker speaker : speakers)
speakerArray.add(speaker.getId());
return speakerArray;
}
......@@ -214,9 +204,9 @@ public class Speaker extends FileModel {
* @return A list of the speakers in the JSONArray
*/
public static List<String> decodeJSONArray(JSONArray speakerArray) {
List<String> speakerIDs = new ArrayList<String>();
List<String> speakerIDs = new ArrayList<>();
if(speakerArray != null)
for (Object speakerObj : speakerArray)
for(Object speakerObj : speakerArray)
speakerIDs.add(((String) speakerObj));
return speakerIDs;
}
......@@ -249,11 +239,10 @@ public class Speaker extends FileModel {
String id) throws IOException {
File ownerDir = FileIO.getOwnerPath(verName, ownerAccount);
JSONObject jsonObj = FileIO.readJSONObject(
new File(getSpeakersPath(ownerDir), id + "/" + id + METADATA_SUFFIX));
JSONObject jsonObj = FileIO.readJSONObject(new File(getSpeakersPath(ownerDir), id + "/" + id + METADATA_SUFFIX));
String name = (String) jsonObj.get("name");
JSONArray languageArray = (JSONArray) jsonObj.get("languages");
if (languageArray == null)
if(languageArray == null)
throw new IOException("Null languages in the JSON file.");
List<Language> languages = Language.decodeJSONArray(languageArray);
String versionName = (String) jsonObj.get("version");
......@@ -261,7 +250,7 @@ public class Speaker extends FileModel {
return new Speaker(name, languages, id, versionName, ownerId);
}
/**
/* *
* Read all users from file
*
* @return A list of the users found in the users directory.
......@@ -362,9 +351,9 @@ public class Speaker extends FileModel {
* false otherwise.
*/
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj == this) return true;
if (obj.getClass() != getClass()) return false;
if(obj == null) return false;
if(obj == this) return true;
if(obj.getClass() != getClass()) return false;
Speaker rhs = (Speaker) obj;
return new EqualsBuilder()
.append(id, rhs.id).append(name, rhs.name)
......@@ -425,9 +414,8 @@ public class Speaker extends FileModel {
* associated with the Speaker.
* @throws IllegalArgumentException If the language list is null
*/
private void setLanguages(List<Language> languages) throws
IllegalArgumentException {
if (languages == null)
private void setLanguages(List<Language> languages) throws IllegalArgumentException {
if(languages == null)
throw new IllegalArgumentException("Speaker languages cannot be null.");
this.languages = languages;
}
......@@ -444,7 +432,8 @@ public class Speaker extends FileModel {
* @param _flags Unused additional flags about how the object should be
* written.
*/
public void writeToParcel(Parcel out, int _flags) {
public void writeToParcel(Parcel out, int _flags)
{
out.writeString(versionName);
out.writeString(ownerId);
out.writeString(id.toString());
......@@ -455,8 +444,8 @@ public class Speaker extends FileModel {
/**
* Generates instances of a Speaker from a parcel.
*/
public static final Parcelable.Creator<Speaker> CREATOR =
new Parcelable.Creator<Speaker>() {
public static final Parcelable.Creator<Speaker> CREATOR = new Parcelable.Creator<Speaker>()
{
public Speaker createFromParcel(Parcel in) {
return new Speaker(in);
}
......@@ -470,17 +459,19 @@ public class Speaker extends FileModel {
*
* @param in The parcel representing the Speaker to be constructed.
*/
public Speaker(Parcel in) {
public Speaker(Parcel in)
{
super(in);
setId(in.readString());
setName(in.readString());
List<Language> languages = new ArrayList<Language>();
List<Language> languages = new ArrayList<>();
in.readTypedList(languages, Language.CREATOR);
setLanguages(languages);
}
// Creates a purely numeric speaker ID
private String createId(String name) {
private String createId(String name)
{
// Generate 12 random uppercase alphabets.
return IdUtils.sampleFromAlphabet(12, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
......@@ -488,10 +479,11 @@ public class Speaker extends FileModel {
// Extracts the first character of each token in a string and uppercases, but
// stops after 4 characters have been extracted.
// Never use
private String extractInitials(String name) {
/*private String extractInitials(String name) {
StringBuilder initials = new StringBuilder();
int count = 0;
for (String token : name.split("\\s+")) {
for (String token : name.split("\\s+"))
{
if (token.length() > 0) {
initials.append(Character.toUpperCase(token.charAt(0)));
count += 1;
......@@ -502,7 +494,7 @@ public class Speaker extends FileModel {
if(BuildConfig.DEBUG)Log.i("extractInitials", "Extracting initials of: " + name + ". " +
"Returning " + initials.toString());
return initials.toString();
}
}*/
/**
* The name of the Speaker.
......
package org.getalp.ligaikuma.lig_aikuma.model;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import org.getalp.ligaikuma.lig_aikuma.ui.RecordingMetadataLig;
import java.util.ArrayList;
public class SpeakerProfile
{
public static String TAG = "SpeakerProfile";
private String _name;
private int _birthYear;
private int _gender;
private Language _recordLang;
private Language _motherTongue;
private ArrayList<Language> _otherLanguages;
private String _region;
private String _note;
/** Build profile with all informations
*
* @param name speaker name
* @param birthYear speaker birth year
* @param gender gender of speaker
* @param recordLang language of record
* @param motherTongue mother tongue of speaker
* @param otherLanguages other tongue of speaker
* @param region region of record
* @param note free field for annotation
*/
public SpeakerProfile(String name, int birthYear, int gender, Language recordLang, Language motherTongue,
ArrayList<Language> otherLanguages, String region, String note)
{
init(name, birthYear, gender, recordLang, motherTongue, otherLanguages, region, note);
}
/** Build new profile with key and context
*
* @param c Current context to access to SharedPreferences
* @param key key of profile
*/
public SpeakerProfile(Context c, String key)
{
SharedPreferences sp = c.getSharedPreferences(key, Context.MODE_PRIVATE);
String[] tmpL = sp.getString("recordLang"," : ").split(" : ");
Language recordLang = new Language(tmpL[0],tmpL[1]);
tmpL = sp.getString("motherTongue"," : ").split(" : ");
Language motherTongue = new Language(tmpL[0],tmpL[1]);
ArrayList<Language> otherLanguages = new ArrayList<>();
String t = sp.getString("otherLanguages", null);
if(t != null)
for(String tmpS : t.split("§§"))
{
tmpL = tmpS.split(" : ");
otherLanguages.add(new Language(tmpL[0],tmpL[1]));
}
init(sp.getString("name",""), sp.getInt("birdthYear",0), sp.getInt("gender",2),
recordLang, motherTongue, otherLanguages, sp.getString("region",""), sp.getString("note",""));
}