issues #323, #327, #326 fixed

parent 62dcb069
...@@ -10,7 +10,7 @@ android { ...@@ -10,7 +10,7 @@ android {
versionCode 1 versionCode 1
versionName "1.3" versionName "1.3"
resValue "string", "db_name", "PCB.db" resValue "string", "db_name", "PCB.db"
resValue "integer", "db_version", "8" resValue "integer", "db_version", "10"
//resValue "string", "app_version", "1.1" //resValue "string", "app_version", "1.1"
resValue "string", "core_vocabulary", "core_vocabulary" resValue "string", "core_vocabulary", "core_vocabulary"
resValue "string", "apk", "to_be_set_in_subproject" resValue "string", "apk", "to_be_set_in_subproject"
......
...@@ -330,7 +330,7 @@ public class Device extends SQLiteOpenHelper { ...@@ -330,7 +330,7 @@ public class Device extends SQLiteOpenHelper {
"'" + user.get_lang_sup() + "'," + "'" + user.get_lang_sup() + "'," +
"'" + user.get_tts_engine_sup() + "'," + "'" + user.get_tts_engine_sup() + "'," +
"'" + user.get_office() + "'" + "'" + user.get_office() + "'" +
")"; ")"; Log.e(LOG_TAG,sentence);
db.execSQL(sentence); db.execSQL(sentence);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
......
package com.yottacode.pictogram.net; package com.yottacode.pictogram.net;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.util.Log; import android.util.Log;
import com.yottacode.net.RestapiWrapper; import com.yottacode.net.RestapiWrapper;
...@@ -76,7 +75,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -76,7 +75,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
} }
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) { PCBcontext.getPcbdb().user_online(true);
} }
@Override @Override
...@@ -100,7 +99,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -100,7 +99,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
PCBcontext.getPcbdb().user_online(true);
} }
@Override @Override
...@@ -217,7 +216,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -217,7 +216,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
return restfullSynchroTimming; return restfullSynchroTimming;
} }
private void synchronizeStudentAttributes() { public void synchronizeStudentAttributes() {
int id=PCBcontext.getPcbdb().getCurrentUser().get_id_stu(); int id=PCBcontext.getPcbdb().getCurrentUser().get_id_stu();
PCBcontext.getRestapiWrapper().ask("stu/" + id, new RestapiWrapper.iRestapiListener() { PCBcontext.getRestapiWrapper().ask("stu/" + id, new RestapiWrapper.iRestapiListener() {
@Override @Override
......
...@@ -47,7 +47,7 @@ public class ServerLogin { ...@@ -47,7 +47,7 @@ public class ServerLogin {
try { try {
if (PCBcontext.is_user_offline()) { if (PCBcontext.is_user_offline()) {
final String TAG_TOKEN="token"; final String TAG_TOKEN="token";
PCBcontext.getPcbdb().user_online(true); PCBcontext.getPcbdb().user_online(true); ;
PCBcontext.getRestapiWrapper().setToken(result.getString(TAG_TOKEN)); PCBcontext.getRestapiWrapper().setToken(result.getString(TAG_TOKEN));
PCBcontext.getVocabulary().synchronize(); PCBcontext.getVocabulary().synchronize();
PCBcontext.getRoom().connect(); PCBcontext.getRoom().connect();
......
...@@ -72,7 +72,7 @@ public final class PCBcontext { ...@@ -72,7 +72,7 @@ public final class PCBcontext {
wrapper.setToken(token); wrapper.setToken(token);
pcbdb = new PCBDBHelper(null, 2, student); pcbdb = new PCBDBHelper(null, 2, student);
pcbdb.user_online(token!=null); pcbdb.user_online(token!=null);Log.e("pcbcontextborra", "JSON:");
room = new Room(); room = new Room();
actionLog = new ActionLog(); actionLog = new ActionLog();
vocabulary = new Vocabulary(listener); vocabulary = new Vocabulary(listener);
......
...@@ -49,7 +49,7 @@ pwd TEXT(40) NOT NULL, ...@@ -49,7 +49,7 @@ pwd TEXT(40) NOT NULL,
name TEXT(40) NOT NULL, name TEXT(40) NOT NULL,
surname TEXT(60) NOT NULL, surname TEXT(60) NOT NULL,
url_img VARCHAR(250) NOT NULL, url_img VARCHAR(250) NOT NULL,
gender TEXT(1) NOT NULL CHECK (gender IN ('M','F')), gender TEXT(1) NULL CHECK (gender IN (NULL, 'M','F')),
lang TEXT(5) NOT NULL CHECK (lang in ('en-gb','en-us','es-es')), lang TEXT(5) NOT NULL CHECK (lang in ('en-gb','en-us','es-es')),
tts_engine TEXT(100) NULL, tts_engine TEXT(100) NULL,
office TEXT(140) NULL office TEXT(140) NULL
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">Invalid user or password. Please, try it again.</string> <string name="loginErrorMsg">Invalid user or password. Please, try it again.</string>
<string name="loginNoLicenseMsg">Not valid user license. Please, contact with Yotta.</string> <string name="loginNoLicenseMsg">Not valid user license. Please, contact with Yotta.</string>
<string name="loginExpiredLicenseMsg">User license was expired on</string> <string name="loginExpiredLicenseMsg">User license was expired. Please contact with Yotta.</string>
<string name="userInetErrorMsg">Unknown new user name because Internet conection is not available</string> <string name="userInetErrorMsg">Unknown new user name because Internet conection is not available</string>
<string name="userLoadingTxt">Loading</string> <string name="userLoadingTxt">Loading</string>
<string name="userLoadingMsg">Loading students. Please wait.</string> <string name="userLoadingMsg">Loading students. Please wait.</string>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string> <string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="loginNoLicenseMsg">Licencia incorrecta o caducada. Contacte con Yotta para adquirir una.</string> <string name="loginNoLicenseMsg">Licencia incorrecta o caducada. Contacte con Yotta para adquirir una.</string>
<string name="loginExpiredLicenseMsg">La licencia del usuario expiró con fecha</string> <string name="loginExpiredLicenseMsg">La licencia del usuario expiró. Contacte con Yotta para ampliar la licencia actual</string>
<string name="imguserLoadingMsg">Cargando imágenes de los alumnos. Por favor espere.</string> <string name="imguserLoadingMsg">Cargando imágenes de los alumnos. Por favor espere.</string>
<string name="imguserLoadingErrMsg">Imagen con formato no válido.</string> <string name="imguserLoadingErrMsg">Imagen con formato no válido.</string>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<string name="loginErrorTxt">Login</string> <string name="loginErrorTxt">Login</string>
<string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string> <string name="loginErrorMsg">El usuario no existe o la contraseña indicada no es correcta. Inténtelo de nuevo.</string>
<string name="loginNoLicenseMsg">El usuario no tiene una licencia válida. Contacte con Yotta para adquirir una.</string> <string name="loginNoLicenseMsg">El usuario no tiene una licencia válida. Contacte con Yotta para adquirir una.</string>
<string name="loginExpiredLicenseMsg">La licencia del usuario expiró con fecha</string> <string name="loginExpiredLicenseMsg">La licencia del usuario expiró. Contacte con Yotta para ampliar la licencia actual</string>
<string name="userInetErrorMsg">Este usuario requiere conexión a internet para ser validado</string> <string name="userInetErrorMsg">Este usuario requiere conexión a internet para ser validado</string>
<string name="userLoadingTxt">Cargando</string> <string name="userLoadingTxt">Cargando</string>
<string name="userLoadingMsg">Cargando alumnos. Por favor espere.</string> <string name="userLoadingMsg">Cargando alumnos. Por favor espere.</string>
......
...@@ -8,7 +8,6 @@ import android.content.Intent; ...@@ -8,7 +8,6 @@ import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -116,7 +115,8 @@ public class StudentFragmentGrid extends Fragment { ...@@ -116,7 +115,8 @@ public class StudentFragmentGrid extends Fragment {
return; return;
} }
new_user(i); new_user(i, licenseStudents[i].equals("pro") || licenseStudents[i].equals("trial") );
download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()); download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu());
} }
} }
...@@ -179,8 +179,9 @@ public class StudentFragmentGrid extends Fragment { ...@@ -179,8 +179,9 @@ public class StudentFragmentGrid extends Fragment {
/** /**
* Change user data, load vocabulary and goes to VOCA Activity * Change user data, load vocabulary and goes to VOCA Activity
* @param i Position on students downloaded collection * @param i Position on students downloaded collection
* @param license_valid
*/ */
private void new_user(int i) { private void new_user(int i, final boolean license_valid) {
JSONObject st = this.downloaded_students.get(i); JSONObject st = this.downloaded_students.get(i);
Intent intent = getActivity().getIntent(); Intent intent = getActivity().getIntent();
...@@ -220,6 +221,7 @@ public class StudentFragmentGrid extends Fragment { ...@@ -220,6 +221,7 @@ public class StudentFragmentGrid extends Fragment {
public void loadComplete() { public void loadComplete() {
if (progressDialog != null && progressDialog.isShowing()) if (progressDialog != null && progressDialog.isShowing())
progressDialog.dismiss(); progressDialog.dismiss();
PCBcontext.getPcbdb().user_valid(license_valid);
Intent pictogramActivity = new Intent(getActivity(), VOCA.class); Intent pictogramActivity = new Intent(getActivity(), VOCA.class);
startActivity(pictogramActivity); startActivity(pictogramActivity);
} }
......
...@@ -60,6 +60,12 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -60,6 +60,12 @@ public class ListInstructionsFragment extends Fragment{
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
checkStudent();
initMethods(getView());
initInstructions(getView());
setMethods();
methodPosition=-1;
instructionPosition=-1;
} }
public void initAdapters() { public void initAdapters() {
...@@ -106,14 +112,10 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -106,14 +112,10 @@ public class ListInstructionsFragment extends Fragment{
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_instructions_session, container, false); View view = inflater.inflate(R.layout.fragment_instructions_session, container, false);
progressDialog = ProgressDialog.show(getActivity(), getString(R.string.session_instruction), getString(R.string.session_loading)); progressDialog = ProgressDialog.show(getActivity(), getString(R.string.session_instruction), getString(R.string.session_loading));
checkStudent();
initMethods(view);
initInstructions(view);
setMethods();
methodPosition=-1;
instructionPosition=-1;
return view; return view;
} }
void close() { void close() {
ListInstructionsFragment.this.getActivity().finish(); ListInstructionsFragment.this.getActivity().finish();
startActivity(new Intent(getActivity(), VOCA.class)); startActivity(new Intent(getActivity(), VOCA.class));
......
...@@ -177,7 +177,7 @@ public class SessionWrapper { ...@@ -177,7 +177,7 @@ public class SessionWrapper {
public static void getMethods(final iMethodWrapper listener) { public static void getMethods(final iMethodWrapper listener) {
int id=PCBcontext.getPcbdb().getCurrentUser().get_id_stu(); int id=PCBcontext.getPcbdb().getCurrentUser().get_id_stu();
Log.i(LOG_TAG,"License valid:"+ PCBcontext.getPcbdb().isUser_valid()+" User:"+id+","+PCBcontext.getPcbdb().getCurrentUser().get_name_stu());
PCBcontext.getRestapiWrapper().ask("stu/" + id+"/methods",null,"get",true, new RestapiWrapper.iRestapiListener() { PCBcontext.getRestapiWrapper().ask("stu/" + id+"/methods",null,"get",true, new RestapiWrapper.iRestapiListener() {
@Override @Override
public void preExecute() { public void preExecute() {
...@@ -194,6 +194,7 @@ public class SessionWrapper { ...@@ -194,6 +194,7 @@ public class SessionWrapper {
try { try {
listener.methods(new JSONArray(1).put(result)); listener.methods(new JSONArray(1).put(result));
} catch (JSONException e) { } catch (JSONException e) {
listener.methods(new JSONArray());
listener.error(e.getMessage()); listener.error(e.getMessage());
} }
} }
......
...@@ -62,13 +62,6 @@ ...@@ -62,13 +62,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
...@@ -76,6 +69,13 @@ ...@@ -76,6 +69,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
...@@ -121,5 +121,17 @@ ...@@ -121,5 +121,17 @@
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" /> <orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
</component> </component>
</module> </module>
\ 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