Commit 1fa1fb59 by Arturo Montejo Ráez

Merge branch 'develop' into issue825

parents df6eb0ed 095eb04b
Showing with 391 additions and 127 deletions
......@@ -10,7 +10,10 @@ android {
versionCode 1
versionName "1.0"
resValue "string", "db_name", "PCB.db"
resValue "integer", "db_version", "2"
resValue "string", "app_version", "0.0"
resValue "string", "core_vocabulary", "core_vocabulary"
resValue "string", "apk", "to_be_set_in_subproject"
}
buildTypes {
release {
......
......@@ -54,9 +54,9 @@ public class Device extends SQLiteOpenHelper {
*/
public Device(Context context, CursorFactory factory, int version) {
super(context, DeviceHelper.getDBName(context), factory, version);
super(context, DeviceHelper.getDBName(context), factory, DeviceHelper.getDBVersion(context));
if (DeviceHelper.force_create(context)) {
Log.i(this.getClass().getCanonicalName(),"Forcing create new Database "+DeviceHelper.getDBName(context));
Log.i(this.getClass().getCanonicalName(),"Forcing create new Database "+DeviceHelper.getDBName(context)+" v."+ DeviceHelper.getDBVersion(context));
context.deleteDatabase(DeviceHelper.getDBName(context));
Log.i(this.getClass().getCanonicalName(), "Database dropped");
}
......
package com.yottacode.pictogram.dao;
import android.content.Context;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.tools.PCBcontext;
import java.io.InputStream;
/**
* Platform abstraction (Android)
* @see PCBDBHelper
* *
*
* @author Fernando Martinez Santiago
* @version 1.0
*/
public class DeviceHelper {
public static float version= Float.valueOf(PCBcontext.getContext().getResources().getString(R.string.app_version)).floatValue();
public static String getDBName(Context context) {
return context.getResources().getString(R.string.db_name);
}
public static int getDBVersion(Context context) {
return context.getResources().getInteger(R.integer.db_version);
}
public static float getAppVersion(Context context) {
return version;
}
public static float setAppVersion(float version) {
return DeviceHelper.version=version;
}
public static InputStream getDBScriptStream(Context context) {
return context.getResources().openRawResource(R.raw.pcbdb_create);
}
public static boolean force_create(Context context) {
return context.getResources().getBoolean(R.bool.force_db_create);
}
}
......@@ -2,14 +2,12 @@ package com.yottacode.pictogram.dao;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.action.Action;
import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.tools.PCBcontext;
......@@ -17,37 +15,10 @@ import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
import java.util.Calendar;
import java.util.Vector;
/**
* Platform abstraction (Android)
* @see PCBDBHelper
* *
*
* @author Fernando Martinez Santiago
* @version 1.0
*/
class DeviceHelper {
static String getTimestamp() {
return (new android.text.format.Time()).toString();
}
static String getDBName(Context context) {
return context.getResources().getString(R.string.db_name);
}
static InputStream getDBScriptStream(Context context) {
return context.getResources().openRawResource(R.raw.pcbdb_create);
}
static boolean force_create(Context context) {
return context.getResources().getBoolean(R.bool.force_db_create);
}
}
/**
* Data Access Object to manage Pictogram Communicator Board database regarding a logged user
* This class requires:
* The script to create the DB allocated in res/raw/pcbdb_create.sql
......@@ -70,7 +41,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
* @param user the user of the PCB, if any. If not, last user is loaded from the DB
*/
public PCBDBHelper(CursorFactory factory, int version, User user) {
super(PCBcontext.getContext(), DeviceHelper.getDBName(PCBcontext.getContext()), factory, version);
super(PCBcontext.getContext(), DeviceHelper.getDBName(PCBcontext.getContext()), factory, DeviceHelper.getDBVersion(PCBcontext.getContext()));
this.user_online=false;
this.setCurrentUser(user == null ? this.getCurrentUser() : user);
}
......
......@@ -29,13 +29,14 @@ public class User {
}
public final static class JSON_STUDENT_ATTTRS{
public enum delivery {clean, one, many}
static String CATEGORIES = "categories";
static String INPUT_FEEDBACK = "input_feedback";
static String INPUT_SELECTION = "input_selection";
static String PICTOGRAM_SIZE ="size";
static String TTS_ENGINE = "tts engine";
static String TTS_VOICE = "tts voice";
static String DELETE_STRIP = "delete_strip_after_delivery";
static String DELIVERY = "delivery";
}
public final static class JSON_STUDENT_INPUT_FEEDBACK {
public static String VIBRATION="vibration";
......@@ -270,8 +271,27 @@ public class User {
*
* @return input feedback of the student configuration (default: "vibration")
*/
public boolean delete_tape_after_delivery() {
return input_feedback_on(JSON_STUDENT_ATTTRS.DELETE_STRIP);
public JSON_STUDENT_ATTTRS.delivery delivery() {
JSON_STUDENT_ATTTRS.delivery delivery;
try {
switch (this.attributes_stu.getInt(JSON_STUDENT_ATTTRS.DELIVERY)) {
case 0:
delivery = JSON_STUDENT_ATTTRS.delivery.clean;
break;
case 1:
delivery = JSON_STUDENT_ATTTRS.delivery.one;
break;
case 2:
delivery = JSON_STUDENT_ATTTRS.delivery.many;
break;
default:
delivery = JSON_STUDENT_ATTTRS.delivery.one;
break;
}
} catch (JSONException e) {
delivery=JSON_STUDENT_ATTTRS.delivery.one;
}
return delivery;
}
/**
......
package com.yottacode.pictogram.net;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.TextView;
import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.dao.DeviceHelper;
import com.yottacode.pictogram.dao.LoginException;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tools.PCBcontext;
......@@ -18,6 +27,8 @@ import java.util.Vector;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import static android.app.Activity.RESULT_OK;
/**
* Background services to be executed every "delay" seconds. Tasks to be executed:
......@@ -41,6 +52,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
private long lastRestfullSynchro;
public NetService(int delay, iNetServiceStatus listener) {
this.updated=RestapiWrapper.ping(PCBcontext.getContext().getResources().getString(R.string.server), ping_session);
this.listeners = new Vector<>(2);
this.listeners.add(listener);
if (listener instanceof iNetServiceDevice) ((iNetServiceDevice)listener).build();
......@@ -74,7 +86,6 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override
public void result(JSONObject result) {
}
@Override
......@@ -156,6 +167,15 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override
public void result(JSONObject result) {
try {
float version=Float.valueOf(result.getString("version")).floatValue();
if (PCBcontext.getActivityContext()!=null && version> DeviceHelper.getAppVersion(PCBcontext.getActivityContext())) {
Log.e(LOG_TAG,"New version is required! from v"+DeviceHelper.getAppVersion(PCBcontext.getContext())+" to v"+version);
newVersionAlert(PCBcontext.getActivityContext(),version);
}
} catch (JSONException e) {
Log.e(LOG_TAG,"PING JSON ERROR: "+result+" "+e.getMessage());
}
if (!updated) {
lastRestfullSynchro=new Date().getTime();
updated = true;
......@@ -252,7 +272,39 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
device=(iNetServiceDevice)listener;
return device;
}
static void newVersionAlert(Context contex, final float vnew) {
final SpannableString s = new SpannableString(contex.getResources().getString(R.string.server)
+ "/" + contex.getResources().getString(R.string.apk));
final TextView tx1 = new TextView(contex);
tx1.setText("\t"+contex.getResources().getString(R.string.new_version_detail) +
"\n\t\t"+ s);
tx1.setTextSize(16);
tx1.setAutoLinkMask(RESULT_OK);
tx1.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(s, Linkify.WEB_URLS);
AlertDialog.Builder builder = new AlertDialog.Builder(contex);
builder.setTitle(contex.getResources().getString(R.string.app_name)+": "+contex.getResources().getString(R.string.new_version_title)+" v"+vnew)
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
DeviceHelper.setAppVersion(vnew);
}
})
.setView(tx1).setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
return false;
}
}).show();
PCBcontext.setActivityContext(null);
}
/**
* Created by Fernando on 12/08/2016.
*/
......
......@@ -27,6 +27,7 @@ public final class PCBcontext {
private static ActionLog actionLog;
private static boolean init=false;
private static StudentTalk studentTalk;
private static Context activityContext;
/**
......@@ -38,6 +39,7 @@ public final class PCBcontext {
init = true;
context = c;
device = new Device(c, null, 2);
activityContext=null;
SSLDummyContext.init(context.getResources().getBoolean(R.bool.ssl_connect));
service = new NetService(context.getResources().getInteger(R.integer.netservice_timing),listener);
wrapper = new RestapiWrapper(context.getResources().getString(R.string.server), null, service);
......@@ -225,4 +227,12 @@ public final class PCBcontext {
}
return actionLog;
}
public static void setActivityContext(Context context) {
PCBcontext.activityContext = context;
}
public static Context getActivityContext() {
return activityContext;
}
}
......@@ -66,6 +66,9 @@
<string name="mirror_mode_off">Mirror mode off</string>
<string name="mirror_mode_on">Mirror mode on</string>
<string name="new_version_title">New version available</string>
<string name="new_version_detail">Please, download and install the new version available at</string>
<!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string>
......
......@@ -66,6 +66,8 @@
<string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</string>
<string name="new_version_title">Nueva versión disponible</string>
<string name="new_version_detail">Por favor descargue e instale la nueva versión disponible en</string>
<!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">es-es-x-ana#male_1-local</string>
......
......@@ -82,6 +82,10 @@
<string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</string>
<!--new app version alertbox-->
<string name="new_version_title">Nueva versión disponible</string>
<string name="new_version_detail">Por favor descargue e instale la nueva versión disponible en</string>
<!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string>
......
......@@ -19,6 +19,7 @@ android {
versionCode 1
versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.supervisor_tablet.gui.Supervisor_SerialActivity"
resValue "string","apk","pictograms.apk"
// signingConfig signingConfigs.config
}
productFlavors {
......
......@@ -16,6 +16,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext;
......@@ -110,7 +111,7 @@ public class PictoAnimation {
public void onAnimationUpdate(ValueAnimator animation) {
int i=(int)animation.getAnimatedValue();
v.setTranslationY(i);
//if (i<=255) activity.ttsButton.setImageAlpha(255-i);
if (PCBcontext.getPcbdb().getCurrentUser().delivery()== User.JSON_STUDENT_ATTTRS.delivery.one && i<=255) activity.ttsButton.setImageAlpha(255-i);
}
......
......@@ -30,8 +30,6 @@ import com.yottacode.pictogram.tabletlibrary.cropper.CropImageView;
import com.yottacode.pictogram.tools.PCBcontext;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static android.graphics.Color.BLACK;
......@@ -425,7 +423,7 @@ public class PictoMenu {
activity.setContentView(R.layout.crop_layout);
final CropImageView cropImageView = (CropImageView) activity.findViewById(R.id.CropImageView);
cropImageView.setImageResource(R.drawable.descarga);
cropImageView.setImageResource(R.drawable.common_full_open_on_phone);
final ImageView croppedImageView = (ImageView) activity.findViewById(R.id.croppedImageView);
final Button cropButton = (Button) activity.findViewById(R.id.Button_crop);
......
......@@ -117,7 +117,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? R.layout.activity_pictogram_big : R.layout.activity_pictogram);
......@@ -245,6 +244,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override
protected void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+
(PCBcontext.getPcbdb().getCurrentUser().is_supervisor()
? " ("+ PCBcontext.getPcbdb().getCurrentUser().get_name_sup()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_sup()+")"
......@@ -872,7 +872,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
PCBcontext.getActionLog().log(new PictosAction(lp));
tapeAdapter.ttsAllNew(tts);
new PictoAnimation().animateTapeView(0,(ViewGroup)arg0.getParent());
if (!PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery()) {
if (PCBcontext.getPcbdb().getCurrentUser().delivery()!= User.JSON_STUDENT_ATTTRS.delivery.clean) {
showOnlyTape(true);
}
}
......@@ -884,7 +884,8 @@ protected void showOnlyTape(boolean onlyTape) {
this.tape_delivered=onlyTape;
if (onlyTape) {
if (!tape_delivered_prev) {
//ttsButton.setEnabled(false);
if (PCBcontext.getPcbdb().getCurrentUser().delivery()== User.JSON_STUDENT_ATTTRS.delivery.one)
ttsButton.setEnabled(false);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.INVISIBLE);
this.pictoCategoryGridView.setVisibility(View.INVISIBLE);
......@@ -900,7 +901,8 @@ protected void showOnlyTape(boolean onlyTape) {
}
}
else {
//ttsButton.setEnabled(true);
if (PCBcontext.getPcbdb().getCurrentUser().delivery()== User.JSON_STUDENT_ATTTRS.delivery.one)
ttsButton.setEnabled(true);
new PictoAnimation().animateTapeViewVertical(this,true);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE);
......
......@@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.tts.TTSHelper;
......@@ -66,7 +67,7 @@ public class TapeAdapter extends BaseAdapter {
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
public void endPlay() {
if (PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery())
if (PCBcontext.getPcbdb().getCurrentUser().delivery()==User.JSON_STUDENT_ATTTRS.delivery.clean)
clear();
play = false;
}
......
......@@ -69,7 +69,6 @@ public class LoginActivity extends FragmentActivity {
protected void onStart() {
super.onStart();
// Set supervisor information on topbar
final TextView supervisorFullNameView = (TextView) findViewById(R.id.loginTopbarSupervisorFullName);
final TextView supervisorUserNameView = (TextView) findViewById(R.id.loginTopbarSupervisorUserName);
final ImageView supervisorPhotoView = (ImageView) findViewById(R.id.loginTopbarSupervisorPhoto);
......@@ -115,4 +114,9 @@ public class LoginActivity extends FragmentActivity {
Log.i(LOG_TAG,"Closing Login window");
PCBcontext.getNetService().closeNotifyStatus();
}
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
}
......@@ -10,7 +10,6 @@ import android.view.Window;
import android.view.WindowManager;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext;
public class MainActivity extends Activity {
......
......@@ -402,7 +402,11 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
}
}
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
@Override
public void onDestroy() {
......
......@@ -15,6 +15,7 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
......@@ -25,7 +26,7 @@
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
......@@ -53,6 +54,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
......@@ -60,6 +62,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
......@@ -67,6 +70,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" 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/test/res" type="java-test-resource" />
......@@ -74,6 +78,7 @@
<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/jni" 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" />
......@@ -81,8 +86,10 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
......@@ -98,10 +105,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/typedefs.txt" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
......@@ -117,6 +130,7 @@
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<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="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
......
......@@ -19,11 +19,12 @@ android {
versionCode 1
versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
resValue "string","apk","pictogram.apk"
// signingConfig signingConfigs.config
}
productFlavors {
CIFlavor {
resValue "string", "server", "https://ci.yottacode.com"
resValue "string", "server", "http://ci.yottacode.com"
resValue "bool", "ssl_connect", "false"
}
DevFlavor {
......
......@@ -8,11 +8,12 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="LocalFlavorDebug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleLocalFlavorDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileLocalFlavorDebugSources" />
<option name="SELECTED_BUILD_VARIANT" value="DevFlavorDebug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDevFlavorDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDevFlavorDebugSources" />
<afterSyncTasks>
<task>generateLocalFlavorDebugSources</task>
<task>generateDevFlavorDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
......@@ -23,8 +24,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/LocalFlavor/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/LocalFlavor/debug" />
<output url="file://$MODULE_DIR$/build/intermediates/classes/DevFlavor/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/DevFlavor/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/LocalFlavor/debug" isTestSource="false" generated="true" />
......@@ -81,6 +82,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
......@@ -88,6 +90,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
......@@ -95,15 +98,17 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" 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/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/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" 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/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/jni" 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/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" />
......@@ -121,6 +126,17 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
......@@ -135,6 +151,7 @@
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="module" module-name="tabletlibrary" 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="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
......@@ -161,4 +178,4 @@
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
</component>
</module>
\ No newline at end of file
</module>
#!/bin/bash
cd /vagrant/
echo "--Descargando coleccion de pictogramas"
wget http://dev.yottacode.com/symbolstx.tgz.gpg /vagrant/
wget http://dev.yottacode.com/upload.tgz.gpg /vagrant/
wget http://dev.yottacode.com/symbolstx.tgz.gpg
wget http://dev.yottacode.com/upload.tgz.gpg
echo "--Desencriptando coleccion"
echo r\"YjtnB+a4$.M*nJ | gpg --batch --no-tty --yes --passphrase-fd 0 symbolstx.tgz.gpg
echo r\"YjtnB+a4$.M*nJ | gpg --batch --no-tty --yes --passphrase-fd 0 upload.tgz.gpg
echo "--Descomprimiendo coleccion"
tar zxvf /vagrant/upload.tgz
tar zxvf /vagrant/symbolstx.tgz
tar zxvf /vagrant/upload.tgz
echo "--Renombrado y borrado de archivos"
rm upload.tgz
rm upload.tgz.gpg
rm symbolstx.tgz
rm symbolstx.tgz.gpg
mv /vagrant/symbolstx_96x82 /vagrant/symbolstx
mv symbolstx_96x82 symbolstx
......@@ -11,7 +11,9 @@ module.exports = {
* @param {response} res {}
*/
ping: function (req, res) {
res.ok();
res.ok({
version: sails.config.pictogram.version
});
},
/**
......@@ -21,6 +23,8 @@ module.exports = {
* @param {response} res {}
*/
ping_session: function (req, res) {
res.ok();
res.ok({
version: sails.config.pictogram.version
});
}
};
......@@ -184,6 +184,7 @@
"man": "Man",
"March": "March",
"mark": "Mark",
"max_expression": "Expression must be a maximun of 11-12 characters.",
"max_licenses_reached": "Maximum number of licenses reached by the office",
"May": "May",
"method_name_duplicated": "Template '{{method_name}}' already exists",
......@@ -226,9 +227,11 @@
"office_not_updated": "Office not updated",
"office_updated": "Office updated",
"offices": "Offices",
"options": "Options",
"own_instructions": "Own method templates",
"own_labels": "Your labels",
"own_pictos": "Your pictograms",
"tos": "Your pictograms",
"pages": "Pages",
"password": "Password",
"password_changed": "Password changed sucessfully",
......
......@@ -184,6 +184,7 @@
"man": "Hombre",
"March": "Marzo",
"mark": "Marcar",
"max_expression": "La expresión debe tener un máximo de 11-12 caracteres.",
"max_licenses_reached": "Número de licencias máximo alcanzado por la oficina",
"May": "Mayo",
"method_name_duplicated": "La plantilla '{{method_name}}' ya existe",
......@@ -227,9 +228,10 @@
"office_not_updated": "El gabinete no se ha podido actualizar",
"office_updated": "Gabinete actualizado",
"offices": "Gabinetes",
"options": "Opciones",
"own_instructions": "Plantillas de métodos propias",
"own_labels": "Propias",
"own_pictos": "Propios",
"own_labels": "Etiquetas propias",
"own_pictos": "Pictogramas propios",
"pages": "Páginas",
"password": "Contraseña",
"password_changed": "La clave ha sido modificada exitosamente.",
......
......@@ -23,8 +23,8 @@
</div>
</div>
<div class="col-xs-6">
<div class="alert alert-info" style="margin: 0 auto;">
<strong>¡Atención!</strong> La expresión debe tener un máximo de 8-10 caracteres.
<div class="alert alert-info" style="margin: 0 auto;" translate>
max_expression
</div>
</div>
</div>
......
......@@ -49,8 +49,18 @@
</div>
<div class="form-group">
<label translate>license_number</label>
<input type="text" id="setup_license" mask="9999-9999-9999-9999" clean="true" placeholder="{{ 'license_number' | translate }}" ng-model="formUser.license_number" required>
<br/>
<input type="text" id="setup_license" class="form-control" mask="9999-9999-9999-9999" clean="true" placeholder="{{ 'license_number' | translate }}" ng-model="formUser.license_number" required>
<div ng-show="studentData.license && !studentData.license_expired" class="alert alert-info" role="alert">
<i class="fa fa-info-circle" aria-hidden="true"></i> {{ 'license_expires' | translate }} {{ studentData.expiration_date }}
</div>
<div ng-show="studentData.license && studentData.license_expired" class="alert alert-warning" role="alert">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> {{ 'license_expired' | translate }} {{ studentData.expiration_date }}
</div>
<div ng-show="!studentData.license" class="alert alert-danger" role="alert">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> {{ 'license_missing' | translate }}
</div>
<!-- VERSION SOLO TEXTO
<span ng-show="studentData.license && !studentData.license_expired" class="text-info">
({{ 'license_expires' | translate }} {{ studentData.expiration_date }})
</span>
......@@ -60,6 +70,7 @@
<span ng-show="!studentData.license" class="text-danger">
({{ 'license_missing' | translate }})
</span>
-->
</div>
</fieldset>
</div>
......
......@@ -5,7 +5,7 @@
//-----------------------
// Supervisor Controller
//-----------------------
dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl($scope, $window, $location, IOService) {
dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl($scope, $window, $location, IOService, $modal) {
// Restore user data from session
var user = JSON.parse($window.sessionStorage.user);
......@@ -32,4 +32,62 @@ dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl($scope
id_sup: $scope.user.id
}
});
//
// Own Pictos
//
$scope.own_pictos = function () {
console.log();
var modalInstance = $modal.open({
animation: true,
templateUrl: 'modules/supervisor/views/own_pictos.html',
controller: 'AddPictoCtrl',
size: 'lg',
resolve: {
student: function () {
return $scope.studentData;
},
supervisor: function () {
return $scope.user;
}
}
});
// Returned data from the modal window
modalInstance.result.then(function (pictoId) {
// Send the picto to the server
$http.post(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + pictoId, {
attributes: {
id_cat: $scope.showFreeCategory ? null : $scope.getCategoryId($scope.selectedCategory),
coord_x: $scope.showFreeCategory ? null : col,
coord_y: $scope.showFreeCategory ? null : row,
status: 'enabled',
free_category_coord_x: $scope.showFreeCategory ? col : null,
free_category_coord_y: $scope.showFreeCategory ? row : null
}
})
.success(function (studentPicto) {
console.log(studentPicto);
placePicto(studentPicto);
io.socket.post('/stu/vocabulary', {
action: 'add',
attributes: {
id_stu: $scope.studentData.id,
stu_picto: studentPicto
}
}, function () {});
})
.error(function (err) {
if (err.code && err.code == 1) // codes are in sails/config/pictogram.js
ngToast.danger({ content: $translate.instant('error_duplicated_picto') });
else
ngToast.danger({ content: $translate.instant('error_adding_picto') });
});
// not needed
// $scope.loadPictos();
});
};
});
......@@ -3,18 +3,33 @@
//--------------------------
// Admin Supervisors Controller
//--------------------------
dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisorsCtrl($scope, $window, $http, config, $translate, ngToast) {
dashboardControllers.controller('SupervisorsCtrl', function SupervisorsCtrl($scope, $window, $http, config, $translate, ngToast) {
// List of supervisors
//Office ID
$http
.get(config.backend+'/office/get/:id/supervisors')
.success(function(data, status, headers, config) {
$scope.supervisors_list = data;
.get(config.backend+'/office/get_all')
.success(function(data, status, headers, config) {
// Add to list
$scope.office = data[0];
$scope.supervisors_list();
})
.error(function(data, status, headers, config) {
$translate('error_downloading_supervisors').then(function (translation) {
ngToast.danger({ content: translation });
});
console.log("Error from API: " + data.error);
});
// List of supervisors
$scope.supervisors_list = function(){
$http
.get(config.backend+'/office/get/' + $scope.office.id + '/supervisors')
.success(function(data, status, headers, config) {
$scope.supervisors_list = data;
console.log($scope.supervisors_list);
})
.error(function(data, status, headers, config) {
$translate('error_downloading_supervisors').then(function (translation) {
ngToast.danger({ content: translation });
});
});
};
});
......@@ -32,8 +32,8 @@
{{ 'students' | translate }}
</a>
</li>
<li>
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/supervisors_list">
<li ng-if="user.isSupAdmin == true">
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/supervisor/list">
<i class="fa fa-users" aria-hidden="true"></i>
{{ 'supervisors' | translate }}
</a>
......@@ -44,6 +44,12 @@
</a>
</li>
<li>
<a ng-click="own_pictos()" class="pointer" role="menuitem" tabindex="0" href="">
<i class="glyphicon glyphicon-picture" aria-hidden="true"></i>
{{ 'own_pictos' | translate }}
</a>
</li>
<li>
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/setup">
<i class="glyphicon glyphicon-cog" aria-hidden="true"></i>
{{ 'setup' | translate }}
......
<!-- Supervisors -->
<div class="panel panel-default">
<div class="row">
<div ng-class="{'col-md-12':hidesupervisoradd === true && hidesupervisorupdate === true, 'col-md-8':hidesupervisoradd === false || hidesupervisorupdate === false}">
<h3 translate>supervisors</h3>
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<a ng-click="resetForm(); hidesupervisoradd = false" class="btn btn-success btn-sm" role="button">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {{ 'add_supervisor' | translate }}
</a>
<div class="col-xs-4">
<h5 translate>supervisors</h5>
</div>
<div class="col-xs-6 input-group">
<input type="text" ng-model="search_sups" id="search_sups" placeholder="{{ 'filter' | translate }}" class="form-control" aria-describedby="basic-addon2">
<span class="input-group-addon glyphicon glyphicon-search" id="basic-addon2" aria-hidden="true"></span>
<div class="col-xs-4">
</div>
<div class="col-xs-3">
<div class="col-xs-4">
<div class=" input-group">
<input type="text" ng-model="search_sups" id="search_sups" placeholder="{{ 'filter' | translate }}" class="form-control" aria-describedby="basic-addon2">
<span class="input-group-addon glyphicon glyphicon-search" id="basic-addon2" aria-hidden="true"></span>
</div>
</div>
</div>
</div>
<table class="table table-striped">
<tr>
<th translate>name</th>
<th translate>email</th>
<th>Ops</th>
</tr>
<tr ng-repeat="supervisor in supervisors | filter:search_sups | orderBy: 'name'">
<td class="color_blue">{{supervisor.name}} {{supervisor.surname}}</td>
<td>{{supervisor.email}}</td>
<td class="ops">
<a ng-click="update_supervisor(supervisor)" title="{{'edit'|translate}}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a ng-click="delete_supervisor(supervisor)" title="{{'delete'|translate}}"><span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>
</td>
</tr>
<div class="table-responsive">
<table class="table">
<thead class="thead-default">
<tr>
<th translate>supervisors</th>
<th translate>students</th>
</tr>
</thead>
<tbody>
<tr class="active" ng-repeat="supervisor in supervisors_list | filter:search_sups | orderBy: 'name'">
<td>
<div>
<div class="col-xs-2">
<div class="thumbnail">
<img ng-src="/upload/supervisorAvatar/{{supervisor.pic}}" alt="Supervisor" title="Supervisor" />
</div>
</div>
<div class="col-xs-10">
<h4>{{supervisor.name}} {{supervisor.surname}}</h4>
<p><i class="fa fa-envelope" aria-hidden="true">&nbsp</i><a href="mailto:{{supervisor.email}}">{{supervisor.email}}</a></p>
<p><i class="fa fa-phone-square" aria-hidden="true"></i>&nbsp<a href="tel:{{supervisor.phone}}">{{supervisor.phone}}</a></p>
</div>
</div>
</td>
<td>
<div class="list-group">
<a ng-repeat="student in supervisor.students" href="/app/#/student/{{student.id}}/setup" class="list-group-item">
<img class="thumbnail img_profile_small" ng-src="{{student.pic}}" alt="" title="" />
{{ student.name }} {{ student.surname }}
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Add Supervisor Form -->
<div ng-include="'modules/admin/views/supervisors_add.html'" class="col-md-4" ng-init="hidesupervisoradd = true" ng-hide="hidesupervisoradd"></div>
<!-- Update Supervisor Form -->
<div ng-include="'modules/admin/views/supervisors_update.html'" class="col-md-4" ng-init="hidesupervisorupdate = true" ng-hide="hidesupervisorupdate"></div>
</div>
......@@ -77,6 +77,12 @@ img.preview{
max-height: 200px;
margin-top: 10px;
}
.thumbnail.img_profile_small{
width: 50px;
height: 50px;
margin-bottom: 0;
display: inline-block;
}
.checkbox{ /* Para todos los checkbox toggle */
margin-top: 0;
......@@ -960,10 +966,6 @@ input[type=range]:focus::-ms-fill-upper {
font: 32px Arial, sans-serif;
}
.input-group-addon:first-child{
top: 0px;
}
/*
ng-file-upload and ngImgCrop
*/
......
......@@ -5,6 +5,7 @@ var ASSETS_PATH = path.join(__dirname, '..', 'assets');
var UPLOAD_PATH = path.join(__dirname, '..', '..', 'upload');
module.exports.pictogram = {
version: "0.1", // actual version of the server, to be checked by the client
admin: {
email: 'amontejo@ujaen.es',
password: '$2a$06$flEEOc15SerMeYWARrN9w.KSpJuM.jDsaTgrtD0ESzbxKHPl0f/zq' //y00ttaa!!
......
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