Commit 3e0c1d65 by Arturo Montejo Ráez

Merge branch 'master' of http://scm.ujaen.es/softuno/pictogram

parents f9dcb0c8 27930438
Showing with 741 additions and 403 deletions
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
signingConfigs {
release_config {
/*
storeFile file('F:/Users/Fernando/GoogleDrive/tmp/keystore.jks')
keyAlias 'default_key'
keyPassword 'danoia'
storePassword 'danoia'
*/
}
}
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion "21.1.2" buildToolsVersion "21.1.2"
defaultConfig { defaultConfig {
...@@ -9,12 +19,13 @@ android { ...@@ -9,12 +19,13 @@ android {
targetSdkVersion 21 targetSdkVersion 21
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
signingConfig signingConfigs.release_config
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "server", "https://pre.yottacode.com:1337" resValue "string", "server", "https://pre.yottacode.com"
resValue "string", "db_name", "PCB.db" resValue "string", "db_name", "PCB.db"
resValue "bool", "force_db_create", "false" resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
...@@ -43,7 +54,8 @@ android { ...@@ -43,7 +54,8 @@ android {
resValue "string", "server", "https://192.168.1.37:1337" resValue "string", "server", "https://192.168.1.37:1337"
} }
DefaultFlavor { DefaultFlavor {
resValue "string", "server", "https://pre.yottacode.com:1337" resValue "string", "server", "https://pre.yottacode.com"
signingConfig signingConfigs.release_config
} }
ArturoFlavorNoSSL { ArturoFlavorNoSSL {
resValue "string", "server", "http://192.168.1.37:1337" resValue "string", "server", "http://192.168.1.37:1337"
...@@ -58,5 +70,5 @@ dependencies { ...@@ -58,5 +70,5 @@ dependencies {
compile 'com.github.nkzawa:socket.io-client:0.5.0' compile 'com.github.nkzawa:socket.io-client:0.5.0'
compile 'com.koushikdutta.async:androidasync:2.+' compile 'com.koushikdutta.async:androidasync:2.+'
compile 'com.android.support:support-v4:21.0.+' compile 'com.android.support:support-v4:21.0.+'
compile 'com.koushikdutta.ion:ion:2.1.6'
} }
...@@ -18,7 +18,7 @@ package com.yottacode.pictogrammar; ...@@ -18,7 +18,7 @@ package com.yottacode.pictogrammar;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Vector; import java.util.Vector;
//import org.grammaticalframework.PGF; import org.grammaticalframework.PGF;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -38,7 +38,7 @@ package com.yottacode.pictogrammar; ...@@ -38,7 +38,7 @@ package com.yottacode.pictogrammar;
public class Translate extends Activity implements iVocabularyListener, iImgDownloaderListener public class Translate extends Activity implements iVocabularyListener, iImgDownloaderListener
{ {
private ArrayAdapter mArrayAdapter; private ArrayAdapter mArrayAdapter;
//private PGF mPGF; private PGF mPGF;
private TTSHelper tts; private TTSHelper tts;
LinkedList<Picto> pictos; LinkedList<Picto> pictos;
...@@ -215,7 +215,7 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown ...@@ -215,7 +215,7 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown
/** /**
* This class is used to load the PGF file asychronously. * This class is used to load the PGF file asychronously.
* It display a blocking progress dialog while doing so. * It display a blocking progress dialog while doing so.
*//* */
private class LoadPGFTask extends AsyncTask<Void, Void, PGF> { private class LoadPGFTask extends AsyncTask<Void, Void, PGF> {
private ProgressDialog progress; private ProgressDialog progress;
...@@ -238,12 +238,12 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown ...@@ -238,12 +238,12 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown
} }
protected void onPostExecute(PGF result) { protected void onPostExecute(PGF result) {
//mPGF = result; mPGF = result;
if (this.progress != null) if (this.progress != null)
this.progress.dismiss(); // Remove loading popup this.progress.dismiss(); // Remove loading popup
} }
} }
*/
/** /**
* This class is used to parse a sentence asychronously. * This class is used to parse a sentence asychronously.
* It display a blocking progress dialog while doing so. * It display a blocking progress dialog while doing so.
...@@ -262,13 +262,13 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown ...@@ -262,13 +262,13 @@ public class Translate extends Activity implements iVocabularyListener, iImgDown
try { try {
// Creating a Parser object for the FoodEng concrete grammar // Creating a Parser object for the FoodEng concrete grammar
tts.speakText(s[0]); tts.speakText(s[0]);
// Parser mParser = new Parser(mPGF, "SUpO_ES"); Parser mParser = new Parser(mPGF, "SUpO_ES");
// Spliting the input (basic tokenization) // Spliting the input (basic tokenization)
// String[] tokens = s[0].split(" "); String[] tokens = s[0].split(" ");
// parsing the tokens //parsing the tokens
// ParseState mParseState = mParser.parse(tokens); ParseState mParseState = mParser.parse(tokens);
//Tree[] trees = (Tree[])mParseState.getTrees(); Tree[] trees = (Tree[])mParseState.getTrees();
// tokens=mParseState.predict(); tokens=mParseState.predict();
/* String[] translations = new String[trees.length]; /* String[] translations = new String[trees.length];
// Creating a Linearizer object for the FoodCat concrete grammar // Creating a Linearizer object for the FoodCat concrete grammar
Linearizer mLinearizer = new Linearizer(mPGF, "SUpO_EN"); Linearizer mLinearizer = new Linearizer(mPGF, "SUpO_EN");
......
...@@ -37,17 +37,11 @@ ...@@ -37,17 +37,11 @@
android:name=".gui.MainActivity" android:name=".gui.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape"> android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".gui.SerialActivity" android:name=".gui.SerialActivity"
android:label="@string/title_activity_serial" android:label="@string/title_activity_serial"
android:screenOrientation="landscape"> android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".gui.LoginActivity" android:name=".gui.LoginActivity"
...@@ -55,17 +49,6 @@ ...@@ -55,17 +49,6 @@
android:label="@string/title_activity_login_activity_fragments" android:label="@string/title_activity_login_activity_fragments"
android:screenOrientation="landscape"/> android:screenOrientation="landscape"/>
<activity <activity
android:name="com.yottacode.pictogrammar.UploadActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".gui.PictogramActivity" android:name=".gui.PictogramActivity"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
......
...@@ -11,6 +11,7 @@ package com.yottacode.net; ...@@ -11,6 +11,7 @@ package com.yottacode.net;
import java.net.URL; import java.net.URL;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.concurrent.Executor;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
...@@ -73,7 +74,7 @@ public class RestapiWrapper { ...@@ -73,7 +74,7 @@ public class RestapiWrapper {
httpAsyncTaskParams.listener=listener; httpAsyncTaskParams.listener=listener;
httpAsyncTaskParams.url_params=params; httpAsyncTaskParams.url_params=params;
httpAsyncTaskParams.url=this.server + '/' + operation; httpAsyncTaskParams.url=this.server + '/' + operation;
new HttpAsyncTask().execute(httpAsyncTaskParams); new HttpAsyncTask().executeOnExecutor(HttpAsyncTask.THREAD_POOL_EXECUTOR,httpAsyncTaskParams);
} }
public void ask(String operation, iRestapiListener listener) { public void ask(String operation, iRestapiListener listener) {
...@@ -177,15 +178,14 @@ public class RestapiWrapper { ...@@ -177,15 +178,14 @@ public class RestapiWrapper {
os.close(); os.close();
int responseCode=urlConnection.getResponseCode(); int responseCode=urlConnection.getResponseCode();
if (responseCode == HttpsURLConnection.HTTP_OK) { Log.d(LOG_TAG, "RESPONSECODE: " + responseCode);
String line;
BufferedReader br=new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line;
while ((line=br.readLine()) != null) { BufferedReader br = new BufferedReader(new InputStreamReader(responseCode == HttpsURLConnection.HTTP_OK
response+=line; ? urlConnection.getInputStream()
} : urlConnection.getErrorStream()));
} while ((line=br.readLine()) != null) {
else { response+=line;
response="";
} }
} catch (IOException e) { } catch (IOException e) {
Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error:" + e.getLocalizedMessage() + " when asking for " + surl); Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error:" + e.getLocalizedMessage() + " when asking for " + surl);
...@@ -228,6 +228,7 @@ public class RestapiWrapper { ...@@ -228,6 +228,7 @@ public class RestapiWrapper {
@Override @Override
protected void onPostExecute(HttpAsyncTaskParams params) { protected void onPostExecute(HttpAsyncTaskParams params) {
try { try {
//if (params.e)
if(params.result!=null) { if(params.result!=null) {
Log.d(LOG_TAG, "JSON: " + params.result); Log.d(LOG_TAG, "JSON: " + params.result);
......
...@@ -7,12 +7,14 @@ import android.database.Cursor; ...@@ -7,12 +7,14 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.os.AsyncTask;
import android.util.Log; import android.util.Log;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Vector; import java.util.Vector;
import com.yottacode.pictogram.action.Action; import com.yottacode.pictogram.action.Action;
...@@ -285,9 +287,13 @@ public class Device extends SQLiteOpenHelper { ...@@ -285,9 +287,13 @@ public class Device extends SQLiteOpenHelper {
* @see com.yottacode.pictogram.dao.PCBDBHelper * @see com.yottacode.pictogram.dao.PCBDBHelper
*/ */
public void synchronizeUsers(Vector<User> users, iImgDownloaderListener imgListener) throws JSONException { public void synchronizeUsers(Vector<User> users, iImgDownloaderListener imgListener) throws JSONException {
Log.d("LoginActivity", "1:" + new SimpleDateFormat("HH:mm:ss"));
Vector<User> prev_users = getUsers(); Vector<User> prev_users = getUsers();
Vector<Img> imgs = new Vector<Img>(users.size() * 2); Vector<Img> imgs = new Vector<Img>(users.size() * 2);
SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = this.getWritableDatabase();
for (User user : users) { for (User user : users) {
if (prev_users.contains(user)) { if (prev_users.contains(user)) {
updateUser(user, db); updateUser(user, db);
...@@ -303,7 +309,7 @@ public class Device extends SQLiteOpenHelper { ...@@ -303,7 +309,7 @@ public class Device extends SQLiteOpenHelper {
db.execSQL("DELETE FROM users_detail WHERE id_stu=" + user.get_id_stu() + " AND id_sup=" + user.get_id_sup()); db.execSQL("DELETE FROM users_detail WHERE id_stu=" + user.get_id_stu() + " AND id_sup=" + user.get_id_sup());
ImgDownloader downloader = new ImgDownloader(this.context, imgListener); ImgDownloader downloader = new ImgDownloader(this.context, imgListener);
downloader.execute(imgs); downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,imgs);
db.close(); db.close();
} }
......
...@@ -210,7 +210,7 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -210,7 +210,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
db.insert("collection_detail", null, values); db.insert("collection_detail", null, values);
} }
int seconds2 = Calendar.getInstance().get(Calendar.SECOND); int seconds2 = Calendar.getInstance().get(Calendar.SECOND);
Log.i(this.getClass().getName(), " Local student vocabulary updated, id:" + id_stu + ", pictos: "+vocabulary.size() +" time:"+(seconds2-seconds1)); Log.i(this.getClass().getName(), " Local student vocabulary updated, id:" + id_stu + ", cats: "+vocabulary.size() +" time:"+(seconds2-seconds1));
db.close(); db.close();
} }
......
package com.yottacode.pictogram.grammar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.yottacode.pictogram.R;
import org.grammaticalframework.PGF;
import org.grammaticalframework.Linearizer;
import org.grammaticalframework.PGFBuilder;
import org.grammaticalframework.Parser;
import org.grammaticalframework.UnknownLanguageException;
import org.grammaticalframework.parser.ParseState;
import org.grammaticalframework.Trees.Absyn.Tree;
import java.io.InputStream;
public class SemanticGrammar
{
protected Activity activity;
private PGF mPGF;
Parser mParser;
Linearizer mLinearizer;
// String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
public void SemanticGrammar(Activity activity) {
this.activity=activity;
new LoadPGFTask().execute();
}
/**
* This class is used to load the PGF file asychronously.
* It display a blocking progress dialog while doing so.
*/
private class LoadPGFTask extends AsyncTask<Void, Void, PGF> {
private ProgressDialog progress;
protected void onPreExecute() {
// Display loading popup
this.progress =
ProgressDialog.show(activity, activity.getResources().getString(R.string.app_name)
,activity.getResources().getString(R.string.loadingGrammar),true);
}
protected PGF doInBackground(Void... a) {
int pgf_res = R.raw.supo;
InputStream is = activity.getResources().openRawResource(pgf_res);
try {
PGF pgf = PGFBuilder.fromInputStream(is, new String[] {activity.getString(R.string.pictogrammar),activity.getString(R.string.naturalgrammar)});
return pgf;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
protected void onPostExecute(PGF result) {
mPGF = result;
if (this.progress != null) {
this.progress.dismiss(); // Remove loading popup
try {
mParser=new Parser(mPGF, activity.getString(R.string.pictogrammar));
mLinearizer = new Linearizer(mPGF, activity.getString(R.string.naturalgrammar));
} catch (Exception e) {
Log.e(this.getClass().getSimpleName(), e.getMessage());
Toast.makeText(activity.getApplicationContext(), activity.getResources().getString(R.string.nogrammar), Toast.LENGTH_SHORT).show();
}
}
}
protected String[] translate(String[] tokens) {
try {
//parsing the tokens
ParseState mParseState = mParser.parse(tokens);
Tree[] trees = (Tree[])mParseState.getTrees();
String[] translations = new String[trees.length];
// Linearizing all the trees
for (int i = 0 ; i < trees.length ; i++) {
try {
String t = mLinearizer.linearizeString(trees[i]);
translations[i] = t;
} catch (java.lang.Exception e) {
translations[i] = "/!\\ Linearization error";
}
}
return translations;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
protected String[] predict(String[] tokens) {
try {
//parsing the tokens
ParseState mParseState = mParser.parse(tokens);
return mParseState.predict();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
\ No newline at end of file
package com.yottacode.pictogram.grammar; package com.yottacode.pictogram.grammar;
import android.os.AsyncTask;
import android.os.Environment; import android.os.Environment;
import android.util.Log; import android.util.Log;
...@@ -31,7 +32,7 @@ import java.util.Vector; ...@@ -31,7 +32,7 @@ import java.util.Vector;
* @author Fernando Martinez Santiago * @author Fernando Martinez Santiago
* @version 1.0 * @version 1.0
*/ */
public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabularyListener { public class Vocabulary implements Iterable<Picto> {
Hashtable<Integer,LinkedList<Picto>> pictos; Hashtable<Integer,LinkedList<Picto>> pictos;
...@@ -61,7 +62,38 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -61,7 +62,38 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
} }
public void listen(Room room, iVocabularyListener listener) { public void listen(Room room, iVocabularyListener listener) {
iVocabularyListener listeners[] = {this,listener}; iVocabularyListener listeners[] = {new iVocabularyListener() {
@Override
public void change(action action, int picto_cat, int picto_id, JSONObject args) {
switch (action) {
case delete: {
removePicto(picto_cat, picto_id);
break;
}
case update:{
modifyAttsPicto(picto_cat, picto_id, args);
break;
}
case add:{
try{
String text= args.getJSONObject("expression").getString("text");
String uri=args.getJSONObject("picto").getString("uri");
JSONObject attrs_picto = args.getJSONObject("attributes");
addPicto(new Picto(picto_id, uri, text, attrs_picto));
} catch (JSONException e) {
Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e);
// System.exit(-1);
}
break;
}
}
}
},listener};
talk = new VocabularyTalk(room, listeners); talk = new VocabularyTalk(room, listeners);
} }
/** /**
...@@ -70,7 +102,53 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -70,7 +102,53 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
public void download() { public void download() {
final String picto_str="/pictos"; final String picto_str="/pictos";
String operation=PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu()+picto_str; String operation=PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu()+picto_str;
PCBcontext.getRestapiWrapper().ask(operation, this); PCBcontext.getRestapiWrapper().ask(operation, new iRestapiListener() {
@Override
public void preExecute() {
}
@Override
public void result(JSONArray result) {
if (result != null) {
final String jpicto = "picto";
final String jid = "id";
final String juri = "uri";
final String jattributes = "attributes";
final String jexpression = "expression";
final String jexpression_text = "text";
Picto[] pictos = new Picto[result.length()];
JSONObject picto = null;
try {
for (int i = 0; i < result.length(); i++) {
picto = result.getJSONObject(i).getJSONObject(jpicto);
JSONObject expression = result.getJSONObject(i).getJSONObject(jexpression);
JSONObject attributes = result.getJSONObject(i).getJSONObject(jattributes);
pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri),
expression.getString(jexpression_text),
attributes);
}
synchronizeImgs(pictos);
Log.i(this.getClass().getName(), " Pictos downloaded: " + result.length());
} catch (JSONException e) {
Log.e(this.getClass().getName(), " Picto json error from server: " + picto.toString());
this.error(e);
}
}
}
@Override
public void result(JSONObject result) {
}
@Override
public void error(Exception e) {
Log.e(this.getClass().getName(), " Server restapi error: " + e.getLocalizedMessage());
}
});
} }
...@@ -83,7 +161,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -83,7 +161,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
private void synchronizeImgs(Picto updated_collection[]) throws JSONException { private void synchronizeImgs(Picto updated_collection[]) throws JSONException {
Vector<Img> imgs=new Vector<Img>(updated_collection.length); Vector<Img> imgs=new Vector<Img>(updated_collection.length);
Log.d(this.getClass().getName(), "Vocabulary size: " + updated_collection.length);
this.pictos.clear(); this.pictos.clear();
for (Picto updated_picto: updated_collection) { for (Picto updated_picto: updated_collection) {
...@@ -101,9 +179,9 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -101,9 +179,9 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
pictos_cat.add(picto); pictos_cat.add(picto);
imgs.add(new Img(picto.get_id(), picto.get_url(), Img.VOCABULARY)); imgs.add(new Img(picto.get_id(), picto.get_url(), Img.VOCABULARY));
} }
Log.d(this.getClass().getName(), "Vocabulary size: " + updated_collection.length);
ImgDownloader downloader = new ImgDownloader(PCBcontext.getContext(), imgListener); ImgDownloader downloader = new ImgDownloader(PCBcontext.getContext(), imgListener);
downloader.execute(imgs); downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs);
PCBcontext.getPcbdb().setStudentVocabulary(this); PCBcontext.getPcbdb().setStudentVocabulary(this);
} }
...@@ -117,7 +195,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -117,7 +195,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
Vector<Img> imgs=new Vector<Img>(1); Vector<Img> imgs=new Vector<Img>(1);
imgs.add(new Img(pic.get_id(), pic.get_url(), Img.VOCABULARY)); imgs.add(new Img(pic.get_id(), pic.get_url(), Img.VOCABULARY));
ImgDownloader downloader = new ImgDownloader(PCBcontext.getContext(), imgListener); ImgDownloader downloader = new ImgDownloader(PCBcontext.getContext(), imgListener);
downloader.execute(imgs); downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs);
loadPicto(pic); loadPicto(pic);
...@@ -138,27 +216,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -138,27 +216,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
params.put("id", String.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_stu())); params.put("id", String.valueOf(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()));
params.put("file", String.valueOf(imageData)); params.put("file", String.valueOf(imageData));
PCBcontext.getRestapiWrapper().ask("upload", params, "post", new iRestapiListener() { PCBcontext.getRestapiWrapper().ask("upload", params, "post", null);
@Override
public void preExecute() {
}
@Override
public void result(JSONArray result) {
}
@Override
public void result(JSONObject result) {
}
@Override
public void error(Exception e) {
}
});
} }
/** /**
...@@ -294,85 +352,4 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -294,85 +352,4 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
return vocabulary; return vocabulary;
} }
@Override
public void preExecute() {
}
@Override
public void result(JSONArray result) {
if (result!=null) {
final String jpicto = "picto";
final String jid = "id";
final String juri = "uri";
final String jattributes = "attributes";
final String jexpression = "expression";
final String jexpression_text = "text";
Picto[] pictos = new Picto[result.length()];
JSONObject picto=null;
try {
for (int i = 0; i < result.length(); i++) {
picto = result.getJSONObject(i).getJSONObject(jpicto);
JSONObject expression = result.getJSONObject(i).getJSONObject(jexpression);
JSONObject attributes = result.getJSONObject(i).getJSONObject(jattributes);
pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri),
expression.getString(jexpression_text),
attributes);
}
this.synchronizeImgs(pictos);
Log.i(this.getClass().getName(), " Pictos downloaded: " + result.length());
} catch (JSONException e) {
Log.e(this.getClass().getName(), " Picto json error from server: " + picto.toString());
this.error(e);
}
}
}
@Override
public void result(JSONObject result) {
if (result!=null) {
Log.d("-PROPIOS-Objetodevuelto", result.toString());
}
}
@Override
public void error(Exception e) {
Log.e(this.getClass().getName()," Server restapi error: "+e.getLocalizedMessage());
}
@Override
public void change(action action, int picto_cat, int picto_id, JSONObject args) {
switch (action) {
case delete: {
removePicto(picto_cat, picto_id);
break;
}
case update:{
modifyAttsPicto(picto_cat, picto_id, args);
break;
}
case add:{
try{
String text= args.getJSONObject("expression").getString("text");
String uri=args.getJSONObject("picto").getString("uri");
JSONObject attrs_picto = args.getJSONObject("attributes");
addPicto(new Picto(picto_id, uri, text, attrs_picto));
} catch (JSONException e) {
Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e);
// System.exit(-1);
}
break;
}
}
}
} }
\ No newline at end of file
...@@ -33,6 +33,8 @@ import org.json.JSONException; ...@@ -33,6 +33,8 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector; import java.util.Vector;
/** /**
...@@ -42,7 +44,7 @@ import java.util.Vector; ...@@ -42,7 +44,7 @@ import java.util.Vector;
* @version 1.0 * @version 1.0
*/ */
public class LoginActivity extends FragmentActivity implements iRestapiListener, iImgDownloaderListener { public class LoginActivity extends FragmentActivity implements iRestapiListener{
private static final String TAG_ID = "id"; private static final String TAG_ID = "id";
private static final String TAG_NAME = "name"; private static final String TAG_NAME = "name";
...@@ -154,8 +156,6 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -154,8 +156,6 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
public void result(JSONArray students_supervisors) { //FERNANDO public void result(JSONArray students_supervisors) { //FERNANDO
try { try {
// Saco los pares estudiante-supervisor // Saco los pares estudiante-supervisor
//Log.d(LOG_TAG, "JSON:"+students_supervisors);
Log.d(LOG_TAG, "students_supervisors size:" + students_supervisors.length());
// looping through All Students // looping through All Students
Vector<User> users = new Vector<User>(students_supervisors.length()); Vector<User> users = new Vector<User>(students_supervisors.length());
...@@ -205,19 +205,62 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -205,19 +205,62 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
} }
} }
Log.d(LOG_TAG, "users size:" + users.size());
// Si sólo hay 1 estudiante, cargo el st_id // Si sólo hay 1 estudiante, cargo el st_id
if (students_supervisors.length() == 1){ if (users.size() == 1){
//User student = PCBcontext.getDevice().findUser(st_id_int, sup_id); //User student = PCBcontext.getDevice().findUser(st_id_int, sup_id);
PCBcontext.set_user(student, token, this); PCBcontext.set_user(student, token, null); // no hay que hacer nada cuando termine
} else{ } else{
student = new User(-1, "", "", "", "M", "es-es", "", student = new User(-1, "", "", "", "M", "es-es", "",
sup_id, "", "", "", "M", "es-es", ""); sup_id, "", "", "", "M", "es-es", "");
PCBcontext.set_user(student, token, this); PCBcontext.set_user(student, token, new iImgDownloaderListener() {
@Override
public void loadComplete() {
//close the progress dialog
//progressDialog.dismiss();
//setContentView(R.layout.activity_login);
}
@Override
public void loadImg(Img image) {
//close the progress dialog
//progressDialog.dismiss();
//setContentView(R.layout.activity_login);
}
});
} }
//Device device = new Device(getApplicationContext(), null, 1); //Device device = new Device(getApplicationContext(), null, 1);
if (users.size() > 0){ if (users.size() > 0){
PCBcontext.getDevice().synchronizeUsers(users, this); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentDateandTime = sdf.format(new Date());
Log.d(LOG_TAG, "Entro en synchronizeUsers en " + currentDateandTime);
PCBcontext.getDevice().synchronizeUsers(users, new iImgDownloaderListener() {
@Override
public void loadComplete() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentDateandTime = sdf.format(new Date());
Log.d(LOG_TAG, "LoadComplete en " + currentDateandTime);
Vector<User> users = null;
try {
users = PCBcontext.getDevice().getUsers();
} catch (JSONException e) {
e.printStackTrace();
}
if (users.size() > 1) {
//close the progress dialog
progressDialog.dismiss();
setContentView(R.layout.activity_login);
}
}
@Override
public void loadImg(Img image) {
}
});
PCBcontext.getDevice().deleteDeprecatedImgs(); PCBcontext.getDevice().deleteDeprecatedImgs();
// Si sólo hay 1 estudiante paso a Pictogram // Si sólo hay 1 estudiante paso a Pictogram
if (users.size() == 1){ if (users.size() == 1){
...@@ -225,9 +268,10 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -225,9 +268,10 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
progressDialog.dismiss(); progressDialog.dismiss();
Intent pictogramActivity = new Intent(this, PictogramActivity.class); Intent pictogramActivity = new Intent(this, PictogramActivity.class);
pictogramActivity.putExtra("isSupervisor",true);
startActivity(pictogramActivity); startActivity(pictogramActivity);
} }
} else{ } else {
AlertDialog.Builder builder = AlertDialog.Builder builder =
new AlertDialog.Builder(this); new AlertDialog.Builder(this);
...@@ -254,47 +298,8 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener, ...@@ -254,47 +298,8 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
public void result(JSONObject result) { public void result(JSONObject result) {
} }
@Override
public void loadComplete() {
Log.d(LOG_TAG, "Load images complete");
try {
// Aquí filtro si sólo tiene un único usuario o varios
Vector<User> users = PCBcontext.getDevice().getUsers();
if (users.size()>1){
//close the progress dialog
progressDialog.dismiss();
setContentView(R.layout.activity_login);
}
}catch(NullPointerException e){
e.printStackTrace();
Log.e(LOG_TAG, "Las imágenes de usuarios todavía no se han cargado o fallo en los fragments");
} catch(JSONException e){
e.printStackTrace();
Log.e(LOG_TAG, "Fallo al procesar JSON");
}
}
// De la interfaz iImgDownloaderListener
@Override
public void loadImg(Img img) {
Log.d(LOG_TAG, "Load a single image with ID: " + img.get_id());
// Aquí filtro si sólo tiene un único usuario o varios
Vector<User> users = null;
try {
users = PCBcontext.getDevice().getUsers();
if (users.size()>1){
setContentView(R.layout.activity_login);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override protected void onResume() { @Override protected void onResume() {
super.onResume(); super.onResume();
Toast.makeText(this, "onResume", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "onResume", Toast.LENGTH_SHORT).show();
} }
} }
\ No newline at end of file
...@@ -7,6 +7,8 @@ import android.graphics.BitmapFactory; ...@@ -7,6 +7,8 @@ import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech;
...@@ -15,6 +17,7 @@ import android.view.View; ...@@ -15,6 +17,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.GridLayout; import android.widget.GridLayout;
import android.widget.GridView; import android.widget.GridView;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -183,6 +186,32 @@ public class PanelAdapter extends ArrayAdapter { ...@@ -183,6 +186,32 @@ public class PanelAdapter extends ArrayAdapter {
*/ */
} }
else{ else{
/* AÑADO UN BORDE */
/*
final int BORDER_WIDTH = 1;
final int BORDER_COLOR = Color.WHITE;
Bitmap res = Bitmap.createBitmap(bmp1.getWidth() + 2 * BORDER_WIDTH,
bmp1.getHeight() + 2 * BORDER_WIDTH,
bmp1.getConfig());
Canvas c = new Canvas(res);
Paint p = new Paint();
p.setColor(BORDER_COLOR);
c.drawRect(0, 0, res.getWidth(), res.getHeight(), p);
p = new Paint(Paint.FILTER_BITMAP_FLAG);
c.drawBitmap(res, BORDER_WIDTH, BORDER_WIDTH, p);
*/
/* FIN BORDE */
/*
Drawable d = null;
imageView.setImageDrawable(d);
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setBackgroundColor(Color.WHITE); //providing color to the background.
imageView.setPadding(3, 3, 3, 3);//providing padding to the image.
imageView.setLayoutParams(new Gallery.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
*/
imageView.setImageAlpha(255); imageView.setImageAlpha(255);
imageView.setImageBitmap(bmp1); imageView.setImageBitmap(bmp1);
} }
......
...@@ -4,6 +4,7 @@ import android.app.Activity; ...@@ -4,6 +4,7 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.database.Cursor;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
...@@ -12,7 +13,9 @@ import android.content.ClipDescription; ...@@ -12,7 +13,9 @@ import android.content.ClipDescription;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech;
import android.util.Log; import android.util.Log;
...@@ -81,6 +84,10 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -81,6 +84,10 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
private int count_deletelong = 0; private int count_deletelong = 0;
private boolean isSupervisor = false;
private String selectedImagePath;
private static final int SELECT_PICTURE = 1;
/* /*
float xAxis = 0f; float xAxis = 0f;
float yAxis = 0f; float yAxis = 0f;
...@@ -95,6 +102,13 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -95,6 +102,13 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_pictogram); setContentView(R.layout.activity_pictogram);
Intent intent=getIntent();
isSupervisor = intent.getBooleanExtra("isSupervisor", false);
//isSupervisor = true;// QUITAR
//Log.d(LOG_TAG, "isSupervisor vale " + isSupervisor);
context = this; context = this;
actualCategory = null; // this for refresh vocabulary when a websocket action arrived from the dashboard actualCategory = null; // this for refresh vocabulary when a websocket action arrived from the dashboard
...@@ -183,7 +197,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -183,7 +197,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
*/ */
final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view); final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view);
final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete); final ImageButton deleteButton = (ImageButton) findViewById(R.id .button_delete);
//final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all); //final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all);
final ImageButton ttsButton = (ImageButton) findViewById(R.id.button_tts); final ImageButton ttsButton = (ImageButton) findViewById(R.id.button_tts);
...@@ -288,26 +302,47 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -288,26 +302,47 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
panelGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { panelGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override @Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
ClipData.Item item = new ClipData.Item("" + position); if (isSupervisor){
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN}; // Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
ClipData data = new ClipData("" + position, mimeTypes, item); Picto p = panelAdapter.getItem(position);
if (p==null){
Picto p = panelAdapter.getItem(position); // No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device
Log.d(LOG_TAG, "No tengo pictograma. Abro carrete...");
chooseImage();
// ...
}
else if (p.is_enabled()){
// Lo deshabilito
Log.d(LOG_TAG, "Lo deshabilitaría");
// ....
} else if (!p.is_enabled()){
// Lo habilito
Log.d(LOG_TAG, "Lo habilitaría");
// ....
}
if (p!=null && !p.is_invisible() && p.is_enabled()){ } else{
// If is not the blank picto, it isn't invisible or disabled ClipData.Item item = new ClipData.Item("" + position);
if(p.get_id() != 0 && String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
!p.get_status().equalsIgnoreCase("invisible") && ClipData data = new ClipData("" + position, mimeTypes, item);
!p.get_status().equalsIgnoreCase("disabled") &&
tapeAdapter.getCount() < 8) { Picto p = panelAdapter.getItem(position);
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
if (p!=null && !p.is_invisible() && p.is_enabled()){
view.startDrag(data, //data to be dragged // If is not the blank picto, it isn't invisible or disabled
shadowBuilder, //drag shadow if(p.get_id() != 0 &&
view, //local data about the drag and drop operation !p.get_status().equalsIgnoreCase("invisible") &&
0 //no needed flags !p.get_status().equalsIgnoreCase("disabled") &&
); tapeAdapter.getCount() < 8) {
//view.setVisibility(View.INVISIBLE); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, //data to be dragged
shadowBuilder, //drag shadow
view, //local data about the drag and drop operation
0 //no needed flags
);
//view.setVisibility(View.INVISIBLE);
}
} }
} }
return true; return true;
...@@ -315,6 +350,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -315,6 +350,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
}); });
// onLongClick picto del tapeGridView (para empezar a arrastrarlo fuera del tape y eliminar de ahí) // onLongClick picto del tapeGridView (para empezar a arrastrarlo fuera del tape y eliminar de ahí)
/*
tapeGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { tapeGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override @Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
...@@ -334,6 +370,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -334,6 +370,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
return true; return true;
} }
}); });
*/
// onClick ttsButton (enviar frase a server o guardar en log local) // onClick ttsButton (enviar frase a server o guardar en log local)
ttsButton.setOnClickListener(new View.OnClickListener() { ttsButton.setOnClickListener(new View.OnClickListener() {
...@@ -389,12 +426,11 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -389,12 +426,11 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
count_deletelong++; count_deletelong++;
if (count_deletelong >= 3){ if (count_deletelong >= 3){
Log.d(LOG_TAG, "SALTO A LOGIN"); //Log.d(LOG_TAG, "SALTO A LOGIN");
// Paso un parámetro a la SerialActivity, para controlar de dónde viene // Paso un parámetro a la SerialActivity, para controlar de dónde viene
Intent serialActivity = new Intent(getBaseContext(), SerialActivity.class); Intent serialActivity = new Intent(getBaseContext(), SerialActivity.class);
serialActivity.putExtra("activity_name","PictogramActivity"); serialActivity.putExtra("activity_name","PictogramActivity");
startActivity(serialActivity); startActivity(serialActivity);
// ....
} }
return false; return false;
...@@ -402,6 +438,57 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -402,6 +438,57 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
}); });
} }
/**
* función para la selección de una foto del carrete
*/
public void chooseImage(){
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, SELECT_PICTURE);
}
/**
* Función para la selección de una foto del carrete
* @param requestCode
* @param resultCode
* @param data
*/
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.d(LOG_TAG, "selectedImagePath:" + selectedImagePath);
// Ahora guardaría la imagen en la bbdd local y habría que subirla al server y sincronizar las bbdd
// ...
}
}
}
/**
* Función para la selección de una foto del carrete
* @param uri
* @return
*/
public String getPath(Uri uri) {
if( uri == null ) {
return null;
}
// this will only work for images selected from gallery
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(uri, projection, null, null, null);
if( cursor != null ){
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
return uri.getPath();
}
@Override @Override
public void onInit(int status) { public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) { if (status == TextToSpeech.SUCCESS) {
......
...@@ -55,7 +55,7 @@ import com.yottacode.pictogram.tools.PCBcontext; ...@@ -55,7 +55,7 @@ import com.yottacode.pictogram.tools.PCBcontext;
/** /**
* A login screen that offers login via email/password. * A login screen that offers login via email/password.
*/ */
public class SerialActivity extends Activity implements iRestapiListener, iImgDownloaderListener { public class SerialActivity extends Activity implements iRestapiListener {
// UI references. // UI references.
private EditText mSerialViewMail; private EditText mSerialViewMail;
...@@ -181,13 +181,6 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -181,13 +181,6 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
public void onClick(View view) { public void onClick(View view) {
String username = mSerialViewMail.getText().toString(); String username = mSerialViewMail.getText().toString();
String password = mSerialViewPass.getText().toString(); String password = mSerialViewPass.getText().toString();
// DE PRUEBA
// Alumno
username = "faf0001";
password = "faf0001";
// Supervisor
//username = "dofer@ujaen.es";
//password = "dofer";
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit(); SharedPreferences.Editor editor = settings.edit();
...@@ -195,6 +188,14 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -195,6 +188,14 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
editor.putString("password", password); editor.putString("password", password);
editor.commit(); editor.commit();
// DE PRUEBA
// Alumno
//username = "faf0001";
//password = "faf0001";
// Supervisor
//username = "dofer@ujaen.es";
//password = "dofer";
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper(); RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
if (username.contains("@")){ if (username.contains("@")){
// Es un supervisor // Es un supervisor
...@@ -246,57 +247,130 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -246,57 +247,130 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
public void result(JSONObject result) { public void result(JSONObject result) {
// Si llego aquí es porque hay un único valor, no un array // Si llego aquí es porque hay un único valor, no un array
try { try {
Log.d(LOG_TAG, "User:"+result.toString()); Log.d(LOG_TAG, "JSON en result:"+result.toString());
// Saco el token y los demás valores
Vector<User> users = new Vector<User>(1); if (result.toString().contains("error")){
progressDialog.dismiss();
String jsonToken = result.getString(TAG_TOKEN);
JSONObject user = result.getJSONObject(TAG_USER); AlertDialog.Builder builder = new AlertDialog.Builder(SerialActivity.this);
try{
Boolean is_student = user.has(TAG_ISSTUDENT); if (result.toString().contains("Invalid password")){
builder.setMessage("La contraseña indicada no es correcta. Inténtelo de nuevo.")
if (is_student) { .setCancelable(false)
// Es un estudiante .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
st_id = user.getInt(TAG_ID); public void onClick(DialogInterface dialog, int id) {
int st_id_int = st_id.intValue(); }
String st_name = user.getString(TAG_NAME); });
String st_surname = user.getString(TAG_SURNAME); } else if (result.toString().contains("User not found")){
String st_pic = user.getString(TAG_PIC); builder.setMessage("El usuario indicado no es correcto. Inténtelo de nuevo.")
String st_gender = user.getString(TAG_GENDER); .setCancelable(false)
String st_lang = user.getString(TAG_LANG); .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
String st_attributes = user.getString(TAG_ATTRIBUTES); public void onClick(DialogInterface dialog, int id) {
}
users.add(new User(st_id_int, st_name, st_surname, st_pic, st_gender, st_lang, st_attributes, });
-1, "", "", "", "M", "es-es", "")); }
Log.d(LOG_TAG, "jsonToken válido:" + jsonToken);
User student = PCBcontext.getDevice().findUser(st_id, -1);
PCBcontext.set_user(student, jsonToken, null);
PCBcontext.getDevice().synchronizeUsers(users, this);
PCBcontext.getDevice().deleteDeprecatedImgs();
} else{
// Es un Supervisor
Log.d(LOG_TAG, "Es un SUPERVISOR. Sigo...");
Log.d(LOG_TAG, "jsonToken válido:" + jsonToken);
Integer su_id = user.getInt(TAG_ID);
int su_id_int = su_id.intValue();
//close the progress dialog
if (!username.contains("@")){
progressDialog.dismiss();
}
// Llamo a LoginActivity AlertDialog alert = builder.create();
Intent loginActivity = new Intent(this, LoginActivity.class); alert.show();
loginActivity.putExtra("token", jsonToken);
loginActivity.putExtra("sup_id", su_id_int); } else{ // No hay error. Sigo
startActivity(loginActivity); // Saco el token y los demás valores
Vector<User> users = new Vector<User>(1);
String jsonToken = result.getString(TAG_TOKEN);
JSONObject user = result.getJSONObject(TAG_USER);
try{
Boolean is_student = user.has(TAG_ISSTUDENT);
if (is_student) {
// Es un estudiante
st_id = user.getInt(TAG_ID);
int st_id_int = st_id.intValue();
String st_name = user.getString(TAG_NAME);
String st_surname = user.getString(TAG_SURNAME);
String st_pic = user.getString(TAG_PIC);
String st_gender = user.getString(TAG_GENDER);
String st_lang = user.getString(TAG_LANG);
String st_attributes = user.getString(TAG_ATTRIBUTES);
//users=PCBcontext.getDevice().getUsers();
//if (users.contains(user)) users.remove(user);
User student = new User(st_id_int, st_name, st_surname, st_pic, st_gender, st_lang, st_attributes,
-1, "", "", "", "M", "es-es", "");
users.add(student);
Log.d(LOG_TAG, "jsonToken válido:" + jsonToken);
//User student = PCBcontext.getDevice().findUser(st_id_int, -1);
//Log.d(LOG_TAG, "student id:" + student.get_id_stu());
PCBcontext.set_user(student, jsonToken, new iImgDownloaderListener() {
@Override
public void loadComplete() {
progressDialog.dismiss();
Intent pictogramActivity = new Intent(SerialActivity.this, PictogramActivity.class);
startActivity(pictogramActivity);
}
@Override
public void loadImg(Img image) {
}
});
PCBcontext.getDevice().synchronizeUsers(users, new iImgDownloaderListener() {
@Override
public void loadComplete() {
}
@Override
public void loadImg(Img image) {
Log.d(LOG_TAG, "Load a single image with ID: " + image.get_id());
setContentView(R.layout.activity_serial);
}
});
PCBcontext.getDevice().deleteDeprecatedImgs();
} else{
// Es un Supervisor
Log.d(LOG_TAG, "Es un SUPERVISOR. Sigo...");
Log.d(LOG_TAG, "jsonToken válido:" + jsonToken);
Integer su_id = user.getInt(TAG_ID);
int su_id_int = su_id.intValue();
//close the progress dialog
if (!username.contains("@")){
progressDialog.dismiss();
}
/*
AlertDialog.Builder builder = new AlertDialog.Builder(SerialActivity.this);
builder.setMessage("Es un supervisor. Sigo...")
.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.show();
*/
// Llamo a LoginActivity
Intent loginActivity = new Intent(this, LoginActivity.class);
loginActivity.putExtra("token", jsonToken);
loginActivity.putExtra("sup_id", su_id_int);
startActivity(loginActivity);
}
} catch (JSONException ex){
//Log.d(LOG_TAG, "ERROR 1");
ex.printStackTrace();
} }
} catch (JSONException ex){
ex.printStackTrace();
} }
} catch (JSONException e) { } catch (JSONException e) {
//Log.d(LOG_TAG, "ERROR 2");
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -318,23 +392,4 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -318,23 +392,4 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
}
@Override \ No newline at end of file
public void loadComplete() {
Log.d(LOG_TAG, "Load images complete");
//close the progress dialog
progressDialog.dismiss();
// Entro directamente a Pictogram con ese alumno
Intent pictogramActivity = new Intent(this, PictogramActivity.class);
startActivity(pictogramActivity);
}
@Override
public void loadImg(Img image) {
Log.d(LOG_TAG, "Load a single image with ID: " + image.get_id());
setContentView(R.layout.activity_serial);
}
}
...@@ -141,11 +141,12 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -141,11 +141,12 @@ public class StudentFragmentGrid extends Fragment{
PCBcontext.set_user(student, jsonToken, new iImgDownloaderListener() { PCBcontext.set_user(student, jsonToken, new iImgDownloaderListener() {
@Override @Override
public void loadComplete() { public void loadComplete( ) {
//Vocabulary vocabulary = PCBcontext.getVocabulary(); //Vocabulary vocabulary = PCBcontext.getVocabulary();
//Log.d(LOG_TAG, "Vocabulario de tam:" + vocabulary.size()); //Log.d(LOG_TAG, "Vocabulario de tam:" + vocabulary.size());
progressDialog.dismiss(); progressDialog.dismiss();
Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class); Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class);
pictogramActivity.putExtra("isSupervisor",true);
startActivity(pictogramActivity); startActivity(pictogramActivity);
} }
......
...@@ -112,9 +112,10 @@ public class TapeAdapter extends BaseAdapter { ...@@ -112,9 +112,10 @@ public class TapeAdapter extends BaseAdapter {
if(convertView == null){ if(convertView == null){
view = new ImageView(PCBcontext.getContext()); view = new ImageView(PCBcontext.getContext());
// Ancho y alto de la imagen en la vista donde se va a colocar (en pixels) // Ancho y alto de la imagen en la vista donde se va a colocar (en pixels)
view.setLayoutParams(new GridView.LayoutParams(getPx(90), getPx(70))); view.setLayoutParams(new GridView.LayoutParams(getPx(80), getPx(60)));
view.setScaleType(ImageView.ScaleType.CENTER_CROP); view.setScaleType(ImageView.ScaleType.CENTER_CROP);
view.setPadding(10,15,10,10); view.setPadding(5,10,5,5);
//view.setPadding(10,15,10,10);
}else{ }else{
view = (ImageView) convertView; view = (ImageView) convertView;
} }
...@@ -133,21 +134,6 @@ public class TapeAdapter extends BaseAdapter { ...@@ -133,21 +134,6 @@ public class TapeAdapter extends BaseAdapter {
return (int) (dimensionDp * density + 0.5f); return (int) (dimensionDp * density + 0.5f);
} }
// NO SE ESTÄ USANDO ACTUALMENTE
public void ttsAll(){
// NOTA: coger todas las palabras de la cinta
String input = lPictos.getFirst().get_translation();
Log.d("TapeAdapterPictos.java", "Traduccion picto: " + input);
// Create TTS object
TTSHelper tts = new TTSHelper(PCBcontext.getContext(), "IVONA Text-to-Speech HQ");
//tts = new TTSHelper(this.mContext);
tts.createTTS(PCBcontext.getContext(), "IVONA Text-to-Speech HQ");
tts.setVoice(PCBcontext.getContext(), "es");
// DE PRUEBA
//input = "Hola Salud. ¿No te has ido hoy de fiesta?";
tts.speakText(input);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void ttsAllNew(TextToSpeech tts){ public void ttsAllNew(TextToSpeech tts){
// DE PRUEBA // DE PRUEBA
......
...@@ -13,6 +13,7 @@ import java.io.IOException; ...@@ -13,6 +13,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Vector; import java.util.Vector;
...@@ -42,15 +43,21 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> { ...@@ -42,15 +43,21 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
this.force_download=context.getResources().getBoolean(R.bool.force_img_download); this.force_download=context.getResources().getBoolean(R.bool.force_img_download);
} }
@Override
protected void onPreExecute() {
Log.d(this.getClass().getCanonicalName(), "Pre-EXEC");
}
protected Img doInBackground( Vector<Img> imgs) { protected Img doInBackground( Vector<Img> imgs) {
InputStream is=null; InputStream is=null;
Log.d(this.getClass().getCanonicalName(), "Required images: " + imgs.size());
this.current= ImgDownloader.status.downloading; this.current= ImgDownloader.status.downloading;
int i=0,j=0; int i=0,j=0,allsize=0;
Long availableMegs = mi.availMem / 1048576L; Long availableMegs = mi.availMem / 1048576L;
int seconds = Calendar.getInstance().get(Calendar.SECOND); int seconds = Calendar.getInstance().get(Calendar.SECOND);
Log.i(this.getClass().getCanonicalName(), "Required images: " + imgs.size());
try { try {
String surl=null; String surl=null;
for (Img img: imgs) { for (Img img: imgs) {
...@@ -61,12 +68,12 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> { ...@@ -61,12 +68,12 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
this.activityManager.getMemoryInfo(mi); this.activityManager.getMemoryInfo(mi);
URL url = new URL(surl); URL url = new URL(surl);
/* Open a connection to that URL. */
URLConnection ucon = url.openConnection(); URLConnection ucon = url.openConnection();
is = ucon.getInputStream(); is = ucon.getInputStream();
img.save_bitmap(this.context, is); int size=img.save_bitmap(this.context, is);
allsize+=size;
i++; i++;
} catch (IOException e) { } catch (IOException e) {
j++; j++;
Log.e(this.getClass().getCanonicalName(), surl + " was not downloaded: "+e); Log.e(this.getClass().getCanonicalName(), surl + " was not downloaded: "+e);
...@@ -81,14 +88,14 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> { ...@@ -81,14 +88,14 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
} }
seconds=Calendar.getInstance().get(Calendar.SECOND)-seconds; seconds=Calendar.getInstance().get(Calendar.SECOND)-seconds;
Log.i(this.getClass().getCanonicalName(), Log.i(this.getClass().getCanonicalName(),
"Images: Downloaded: " + i+"/"+imgs.size()+ "LoginActivity: Downloaded: " + i+"/"+imgs.size()+ " (size:"+allsize/1024+" Kbytes)"+
". Cached: "+ (imgs.size()-i)+"/"+imgs.size()+ ". Cached: "+ (imgs.size()-i)+"/"+imgs.size()+
". Download failed: "+ j+"/"+imgs.size()+ ". Download failed: "+ j+"/"+imgs.size()+
". Memory required:"+((mi.availMem / 1048576L)-availableMegs)+" MB"+ ". Memory required:"+((mi.availMem / 1048576L)-availableMegs)+" MB"+
". Used time: "+seconds+" seconds"); ". Used time: "+seconds+" seconds at "+new SimpleDateFormat("HH:mm:ss"));
;
return imgs.size() > 1 ? null return imgs.size() > 1 ? null
: imgs.get(0); : imgs.get(0);
} }
@Override @Override
...@@ -99,7 +106,7 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> { ...@@ -99,7 +106,7 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
@Override @Override
protected void onPostExecute(Img img) { protected void onPostExecute(Img img) {
Log.d(this.getClass().getCanonicalName(), "Inside OnPostExecute()"); Log.d(this.getClass().getCanonicalName(), "LoginActivity: Inside OnPostExecute()"+new SimpleDateFormat("HH:mm:ss"));
if (imgListener!=null) if (imgListener!=null)
if(img == null) imgListener.loadComplete(); if(img == null) imgListener.loadComplete();
else imgListener.loadImg(img); else imgListener.loadImg(img);
......
...@@ -40,6 +40,10 @@ public class NetService implements Runnable, iRestapiListener { ...@@ -40,6 +40,10 @@ public class NetService implements Runnable, iRestapiListener {
exec.scheduleWithFixedDelay(this, 0, delay, TimeUnit.SECONDS); exec.scheduleWithFixedDelay(this, 0, delay, TimeUnit.SECONDS);
} }
public NetService(){
}
public boolean online() {return updated;} public boolean online() {return updated;}
/** /**
......
...@@ -108,7 +108,7 @@ public class Img { ...@@ -108,7 +108,7 @@ public class Img {
* @param is the stream where the image is available * @param is the stream where the image is available
* @throws IOException * @throws IOException
*/ */
public void save_bitmap(Context context, InputStream is) throws IOException { public int save_bitmap(Context context, InputStream is) throws IOException {
File file = file(context, this.type); File file = file(context, this.type);
FileOutputStream os = new FileOutputStream(file); FileOutputStream os = new FileOutputStream(file);
...@@ -123,6 +123,7 @@ public class Img { ...@@ -123,6 +123,7 @@ public class Img {
byte[] byteArray = outstream.toByteArray(); byte[] byteArray = outstream.toByteArray();
os.write(byteArray); os.write(byteArray);
outstream.close(); outstream.close();
return byteArray.length;
} }
......

6.02 KB | W: | H:

3.29 KB | W: | H:

android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
  • 2-up
  • Swipe
  • Onion skin

3.33 KB | W: | H:

2.03 KB | W: | H:

android/Pictogram/app/src/main/res/drawable-mdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-mdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-mdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-mdpi/ic_launcher.png
  • 2-up
  • Swipe
  • Onion skin

8.93 KB | W: | H:

4.5 KB | W: | H:

android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
  • 2-up
  • Swipe
  • Onion skin

9.04 KB | W: | H:

4.5 KB | W: | H:

android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
  • 2-up
  • Swipe
  • Onion skin

15.1 KB | W: | H:

7.08 KB | W: | H:

android/Pictogram/app/src/main/res/drawable-xxhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xxhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xxhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xxhdpi/ic_launcher.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<fragment <fragment
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="600px" android:layout_height="400px"
class="com.yottacode.pictogram.gui.StudentFragmentGrid" class="com.yottacode.pictogram.gui.StudentFragmentGrid"
android:id="@+id/alumnos" android:id="@+id/alumnos"
android:layout_below="@+id/logintitle"/> android:layout_below="@+id/logintitle"/>
......
...@@ -13,48 +13,50 @@ ...@@ -13,48 +13,50 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<GridView <GridView
android:id="@+id/tape_grid_view" android:id="@+id/tape_grid_view"
android:layout_width="560dp" android:layout_width="850dp"
android:layout_height="85dp" android:layout_height="85dp"
android:gravity="center" android:gravity="center"
android:numColumns="@integer/columns" android:numColumns="@integer/columns"
android:accessibilityLiveRegion="none" android:accessibilityLiveRegion="none"
android:background="@android:color/holo_red_light" android:background="@android:color/holo_red_light"
android:clickable="false" android:clickable="false"
android:layout_alignParentTop="true"> android:layout_alignParentTop="true">
</GridView> </GridView>
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:paddingLeft="850dp"
android:src="@drawable/play64" android:paddingTop="20dp"
android:background="@null" android:src="@drawable/back64"
android:id="@+id/button_tts" android:background="@null"
android:layout_toRightOf="@+id/tape_grid_view" android:id="@+id/button_delete"
android:layout_alignParentTop="true"/> android:layout_alignParentTop="true"/>
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:src="@drawable/back64" android:paddingTop="20dp"
android:background="@null" android:src="@drawable/play64"
android:id="@+id/button_delete" android:background="@null"
android:layout_toRightOf="@+id/tape_grid_view" android:id="@+id/button_tts"
android:layout_below="@+id/button_tts"/> android:layout_toRightOf="@+id/tape_grid_view"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"/>
<GridView <GridView
android:id="@+id/panel_grid_view" android:id="@+id/panel_grid_view"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingTop="20dp" android:paddingTop="20dp"
android:columnWidth="120dp" android:columnWidth="100dp"
android:verticalSpacing="20dp" android:verticalSpacing="15dp"
android:horizontalSpacing="5dp" android:horizontalSpacing="5dp"
android:stretchMode="columnWidth" android:stretchMode="columnWidth"
android:layout_below="@+id/tape_grid_view"> android:layout_below="@+id/tape_grid_view">
</GridView> </GridView>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -15,7 +15,16 @@ ...@@ -15,7 +15,16 @@
android:src="@drawable/yottalogo72p" android:src="@drawable/yottalogo72p"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="140dp" /> android:layout_marginTop="120dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="presenta..."
android:id="@+id/textView2"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<ImageView <ImageView
android:layout_width="200px" android:layout_width="200px"
...@@ -25,17 +34,17 @@ ...@@ -25,17 +34,17 @@
android:src="@drawable/logo_pictogram" android:src="@drawable/logo_pictogram"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="151dp" android:layout_marginBottom="120dp"
android:id="@+id/imageView" /> android:id="@+id/imageView" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:text="presenta..." android:text="Pictogram"
android:id="@+id/textView2" android:id="@+id/textView3"
android:layout_centerVertical="true" android:paddingTop="70dp"
android:layout_alignBottom="@+id/imageView"
android:layout_centerHorizontal="true" /> android:layout_centerHorizontal="true" />
</RelativeLayout> </RelativeLayout>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:padding="2dp" android:padding="2dp"
android:numColumns="5" android:numColumns="5"
android:verticalSpacing="5dp" android:verticalSpacing="1dp"
android:horizontalSpacing="5dp" android:horizontalSpacing="5dp"
android:gravity="center" android:gravity="center"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ImageView> \ No newline at end of file
\ No newline at end of file
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
android:id="@+id/txt" android:id="@+id/txt"
android:layout_width="140dp" android:layout_width="140dp"
android:layout_height="140dp" android:layout_height="140dp"
android:layout_centerHorizontal="true"
android:layout_below="@+id/img"/> android:layout_below="@+id/img"/>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Strings de serial -->
<string name="title_activity_serial">Access data</string>
<string name="action_entrar">Login</string> <string name="action_entrar">Login</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="app_name">Pictogram</string> <string name="app_name">Pictogram</string>
<string name="db_script_error">Fail updating the data base</string>
<string name="error_invalid_serial">These access data are not correct</string>
<string name="prompt_serial_mail">User</string> <string name="prompt_serial_mail">User</string>
<string name="prompt_serial_pass">Password</string> <string name="prompt_serial_pass">Password</string>
<string name="title_activity_login">Login</string> <string name="title_activity_login">Login</string>
<string name="title_activity_login_activity_fragment">Users login</string> <string name="title_activity_login_activity_fragment">Users login</string>
<string name="title_activity_login_activity_fragments">Users login</string>
<string name="title_activity_pictogram">PictogramActivity</string> <string name="title_activity_pictogram">PictogramActivity</string>
<string name="title_activity_serial">Write the access data</string>
<string name="title_activity_splash_screen">SplashScreenActivity</string> <string name="title_activity_splash_screen">SplashScreenActivity</string>
<string name="db_script_error">Fail updating the data base</string>
<string name="loginTitle">Who are you?</string> <string name="loginTitle">Who are you?</string>
<string name="toggle_turn_on">Supervisor mode off</string> <string name="passErrorTxt">Invalid password</string>
<string name="toggle_turn_off">Supervisor mode on</string> <string name="passErrorMsg">This password is not correct. Try again.</string>
<string name="userErrorTxt">User not found</string>
<string name="userErrorMsg">The user is not correct. Inténtelo de nuevo.</string>
<!-- Alert dialogs --> <!-- Alert dialogs -->
<string name="exitPictogram">Exit Pictogram</string> <string name="exitPictogram">Exit Pictogram</string>
...@@ -39,4 +42,9 @@ ...@@ -39,4 +42,9 @@
<string name="exitingApp">Exiting the app</string> <string name="exitingApp">Exiting the app</string>
<string name="serverError">There is a server error. Try again later</string> <string name="serverError">There is a server error. Try again later</string>
<!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading semmantic grammar</string>
<string name="naturalgrammar">SUpO_EN</string>
<string name="pictogrammar">SUpO_PICTOEN</string>
<string name="nogrammar">Warning: unknown language</string>
</resources> </resources>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<string name="title_activity_login_activity_fragments">Entrada de usuarios</string> <string name="title_activity_login_activity_fragments">Entrada de usuarios</string>
<string name="title_activity_login_activity_fragment">Entrada de usuarios</string> <string name="title_activity_login_activity_fragment">Entrada de usuarios</string>
<string name="title_activity_pictogram">PictogramActivity</string> <string name="title_activity_pictogram">PictogramActivity</string>
<string name="db_script_error">Error al actualizar la base de datos</string>
<string name="title_activity_splash_screen">SplashScreenActivity</string> <string name="title_activity_splash_screen">SplashScreenActivity</string>
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
<string name="prompt_serial_mail">Usuario</string> <string name="prompt_serial_mail">Usuario</string>
<string name="prompt_serial_pass">Contraseña</string> <string name="prompt_serial_pass">Contraseña</string>
<string name="action_entrar">Entrar</string> <string name="action_entrar">Entrar</string>
<string name="error_invalid_serial">Este nº de serie no es correcto</string>
<string name="loginTitle">¿Quién eres?</string> <string name="loginTitle">¿Quién eres?</string>
<string name="toggle_turn_on">Desactivar modo supervisor</string> <string name="passErrorTxt">Invalid password</string>
<string name="toggle_turn_off">Activar modo supervisor</string> <string name="passErrorMsg">La contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="userErrorTxt">User not found</string>
<string name="userErrorMsg">El usuario indicado no es correcto. Inténtelo de nuevo.</string>
<!-- Alert dialogs --> <!-- Alert dialogs -->
<string name="exitPictogram">Salir de Pictogram</string> <string name="exitPictogram">Salir de Pictogram</string>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
<string name="cancel">Cancelar</string> <string name="cancel">Cancelar</string>
<string name="tabletNoYotta">Importante: anote este nº de dispositivo para indicárselo al responsable de su asociación o gabinete</string> <string name="tabletNoYotta">Importante: anote este nº de dispositivo para indicárselo al responsable de su asociación o gabinete</string>
<string name="loginNoUsers">No está asignado ningún alumno con tu tablet. Consulte con el responsable de su asociación o gabinete</string> <string name="loginNoUsers">No está asignado ningún alumno con tu tablet. Consulte con el responsable de su asociación o gabinete</string>
<string name="serialRepeated">Este tablet ya ha sido registrado previamente o el nº de serie no es correcto. Inténtelo de nuevo o consulte con nuestro servicio técnico</string>
<!-- Login --> <!-- Login -->
<string name="systemMessage">Mensaje del sistema</string> <string name="systemMessage">Mensaje del sistema</string>
...@@ -43,6 +43,13 @@ ...@@ -43,6 +43,13 @@
<string name="exitingApp">Saliendo de la aplicación</string> <string name="exitingApp">Saliendo de la aplicación</string>
<string name="serverError">Error en el servidor de datos. Inténtelo más tarde</string> <string name="serverError">Error en el servidor de datos. Inténtelo más tarde</string>
<!--Semantic grammar -->
<string name="loadingGrammar">Por favor espere, cargando gramática semántica</string>
<string name="naturalgrammar">SUpO_ES</string>
<string name="pictogrammar">SUpO_PICTOES</string>
<string name="nogrammar">Advertencia: Lenguaje no soportado</string>
<item type="integer" name="maxInTape">8</item> <item type="integer" name="maxInTape">8</item>
</resources> </resources>
...@@ -24,5 +24,4 @@ ...@@ -24,5 +24,4 @@
<item>@color/darkorange</item> <item>@color/darkorange</item>
<item>@color/darkred</item> <item>@color/darkred</item>
</integer-array> </integer-array>
</resources>
</resources> \ No newline at end of file
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="title_activity_translate2">Translate2</string>
<string name="hello_world">Hello world!</string> <string name="app_name">Pictogram</string>
<string name="action_settings">Settings</string> <string name="action_settings">Parámetros</string>
<string name="title_activity_picto_board">PictoBoard</string> <string name="title_activity_login">Entrada de usuarios</string>
<string name="title_activity_login_activity_fragments">Entrada de usuarios</string>
<string name="title_activity_login_activity_fragment">Entrada de usuarios</string>
<string name="title_activity_pictogram">PictogramActivity</string>
<string name="db_script_error">Error al actualizar la base de datos</string>
<!-- TODO: Remove or change this placeholder text --> <string name="title_activity_splash_screen">SplashScreenActivity</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="toggle_turn_on">Desactivar modo supervisor</string>
<string name="toggle_turn_off">Activar modo supervisor</string>
</resources> <!-- Strings de serial -->
<string name="title_activity_serial">Indique los datos de acceso</string>
<string name="prompt_serial_mail">Usuario</string>
<string name="prompt_serial_pass">Contraseña</string>
<string name="action_entrar">Entrar</string>
<string name="loginTitle">¿Quién eres?</string>
<string name="passErrorTxt">Invalid password</string>
<string name="passErrorMsg">La contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="userErrorTxt">User not found</string>
<string name="userErrorMsg">El usuario indicado no es correcto. Inténtelo de nuevo.</string>
<!-- Alert dialogs -->
<string name="exitPictogram">Salir de Pictogram</string>
<string name="enterEscapeCode">Introduce código de escape</string>
<string name="editEscapeCode">Cambiar el código de escape</string>
<string name="newEscapeCode">Nuevo código de escape</string>
<string name="enterNewEscapeCode">Escribe el nuevo código de escape</string>
<string name="reEnterNewEscapeCode">Vuelve a escribirlo</string>
<string name="codeModified">El código de desbloqueo ha sido modificado correctamente</string>
<string name="wrongCode">El código introducido no es correcto</string>
<string name="codesNotEqual">Los codigos introducidos no coinciden</string>
<string name="ok">Aceptar</string>
<string name="cancel">Cancelar</string>
<string name="tabletNoYotta">Importante: anote este nº de dispositivo para indicárselo al responsable de su asociación o gabinete</string>
<string name="loginNoUsers">No está asignado ningún alumno con tu tablet. Consulte con el responsable de su asociación o gabinete</string>
<!-- Login -->
<string name="systemMessage">Mensaje del sistema</string>
<string name="noInternetConnection">No hay conexión a internet. Inténtelo más tarde</string>
<string name="exitingApp">Saliendo de la aplicación</string>
<string name="serverError">Error en el servidor de datos. Inténtelo más tarde</string>
<!--Semantic grammar -->
<string name="loadingGrammar">Please wait, loading semmantic grammar</string>
<string name="grammar">SUpO_EN</string>
<string name="nogrammar">Warning: unknown language</string>
<item type="integer" name="maxInTape">8</item>
</resources>
\ No newline at end of file
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 sign in to comment