issue #879 closed

parent 5b774f27
Showing with 181 additions and 51 deletions
...@@ -10,7 +10,10 @@ android { ...@@ -10,7 +10,10 @@ android {
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string", "db_name", "PCB.db" 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", "core_vocabulary", "core_vocabulary"
resValue "string", "apk", "to_be_set_in_subproject"
} }
buildTypes { buildTypes {
release { release {
......
...@@ -54,9 +54,9 @@ public class Device extends SQLiteOpenHelper { ...@@ -54,9 +54,9 @@ public class Device extends SQLiteOpenHelper {
*/ */
public Device(Context context, CursorFactory factory, int version) { 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)) { 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)); context.deleteDatabase(DeviceHelper.getDBName(context));
Log.i(this.getClass().getCanonicalName(), "Database dropped"); 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; ...@@ -2,14 +2,12 @@ package com.yottacode.pictogram.dao;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor; 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.util.Log; import android.util.Log;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.action.Action; import com.yottacode.pictogram.action.Action;
import com.yottacode.pictogram.grammar.Vocabulary; import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
...@@ -17,37 +15,10 @@ import com.yottacode.pictogram.tools.PCBcontext; ...@@ -17,37 +15,10 @@ import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.InputStream;
import java.util.Calendar; import java.util.Calendar;
import java.util.Vector; 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 * Data Access Object to manage Pictogram Communicator Board database regarding a logged user
* This class requires: * This class requires:
* The script to create the DB allocated in res/raw/pcbdb_create.sql * The script to create the DB allocated in res/raw/pcbdb_create.sql
...@@ -70,7 +41,7 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -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 * @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) { 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.user_online=false;
this.setCurrentUser(user == null ? this.getCurrentUser() : user); this.setCurrentUser(user == null ? this.getCurrentUser() : user);
} }
......
...@@ -29,13 +29,14 @@ public class User { ...@@ -29,13 +29,14 @@ public class User {
} }
public final static class JSON_STUDENT_ATTTRS{ public final static class JSON_STUDENT_ATTTRS{
public enum delivery {clean, one, many}
static String CATEGORIES = "categories"; static String CATEGORIES = "categories";
static String INPUT_FEEDBACK = "input_feedback"; static String INPUT_FEEDBACK = "input_feedback";
static String INPUT_SELECTION = "input_selection"; static String INPUT_SELECTION = "input_selection";
static String PICTOGRAM_SIZE ="size"; static String PICTOGRAM_SIZE ="size";
static String TTS_ENGINE = "tts engine"; static String TTS_ENGINE = "tts engine";
static String TTS_VOICE = "tts voice"; 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 final static class JSON_STUDENT_INPUT_FEEDBACK {
public static String VIBRATION="vibration"; public static String VIBRATION="vibration";
...@@ -270,8 +271,27 @@ public class User { ...@@ -270,8 +271,27 @@ public class User {
* *
* @return input feedback of the student configuration (default: "vibration") * @return input feedback of the student configuration (default: "vibration")
*/ */
public boolean delete_tape_after_delivery() { public JSON_STUDENT_ATTTRS.delivery delivery() {
return input_feedback_on(JSON_STUDENT_ATTTRS.DELETE_STRIP); 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; package com.yottacode.pictogram.net;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent;
import android.widget.TextView;
import com.yottacode.net.RestapiWrapper; import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.R; import com.yottacode.pictogram.R;
import com.yottacode.pictogram.dao.DeviceHelper;
import com.yottacode.pictogram.dao.LoginException; import com.yottacode.pictogram.dao.LoginException;
import com.yottacode.pictogram.dao.User; import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
...@@ -18,6 +27,8 @@ import java.util.Vector; ...@@ -18,6 +27,8 @@ import java.util.Vector;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static android.app.Activity.RESULT_OK;
/** /**
* Background services to be executed every "delay" seconds. Tasks to be executed: * Background services to be executed every "delay" seconds. Tasks to be executed:
...@@ -41,6 +52,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -41,6 +52,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
private long lastRestfullSynchro; private long lastRestfullSynchro;
public NetService(int delay, iNetServiceStatus listener) { public NetService(int delay, iNetServiceStatus listener) {
this.updated=RestapiWrapper.ping(PCBcontext.getContext().getResources().getString(R.string.server), ping_session); this.updated=RestapiWrapper.ping(PCBcontext.getContext().getResources().getString(R.string.server), ping_session);
this.listeners = new Vector<>(2); this.listeners = new Vector<>(2);
this.listeners.add(listener); this.listeners.add(listener);
if (listener instanceof iNetServiceDevice) ((iNetServiceDevice)listener).build(); if (listener instanceof iNetServiceDevice) ((iNetServiceDevice)listener).build();
...@@ -74,7 +86,6 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -74,7 +86,6 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
} }
@Override @Override
...@@ -156,6 +167,15 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -156,6 +167,15 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override @Override
public void result(JSONObject result) { 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) { if (!updated) {
lastRestfullSynchro=new Date().getTime(); lastRestfullSynchro=new Date().getTime();
updated = true; updated = true;
...@@ -252,7 +272,39 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -252,7 +272,39 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
device=(iNetServiceDevice)listener; device=(iNetServiceDevice)listener;
return device; 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. * Created by Fernando on 12/08/2016.
*/ */
......
...@@ -27,6 +27,7 @@ public final class PCBcontext { ...@@ -27,6 +27,7 @@ public final class PCBcontext {
private static ActionLog actionLog; private static ActionLog actionLog;
private static boolean init=false; private static boolean init=false;
private static StudentTalk studentTalk; private static StudentTalk studentTalk;
private static Context activityContext;
/** /**
...@@ -38,6 +39,7 @@ public final class PCBcontext { ...@@ -38,6 +39,7 @@ public final class PCBcontext {
init = true; init = true;
context = c; context = c;
device = new Device(c, null, 2); device = new Device(c, null, 2);
activityContext=null;
SSLDummyContext.init(context.getResources().getBoolean(R.bool.ssl_connect)); SSLDummyContext.init(context.getResources().getBoolean(R.bool.ssl_connect));
service = new NetService(context.getResources().getInteger(R.integer.netservice_timing),listener); service = new NetService(context.getResources().getInteger(R.integer.netservice_timing),listener);
wrapper = new RestapiWrapper(context.getResources().getString(R.string.server), null, service); wrapper = new RestapiWrapper(context.getResources().getString(R.string.server), null, service);
...@@ -225,4 +227,12 @@ public final class PCBcontext { ...@@ -225,4 +227,12 @@ public final class PCBcontext {
} }
return actionLog; return actionLog;
} }
public static void setActivityContext(Context context) {
PCBcontext.activityContext = context;
}
public static Context getActivityContext() {
return activityContext;
}
} }
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
<string name="mirror_mode_off">Mirror mode off</string> <string name="mirror_mode_off">Mirror mode off</string>
<string name="mirror_mode_on">Mirror mode on</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--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string> <string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string>
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
<string name="mirror_mode_off">Modo espejo desactivado</string> <string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</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--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">es-es-x-ana#male_1-local</string> <string name="default_tts_voice_male">es-es-x-ana#male_1-local</string>
......
...@@ -82,6 +82,10 @@ ...@@ -82,6 +82,10 @@
<string name="mirror_mode_off">Modo espejo desactivado</string> <string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</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--> <!--default tts engine and voice-->
<string name="default_tts_engine">com.google.android.tts</string> <string name="default_tts_engine">com.google.android.tts</string>
<string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string> <string name="default_tts_voice_male">en-gb-x-rjs#male_1-local</string>
......
...@@ -19,6 +19,7 @@ android { ...@@ -19,6 +19,7 @@ android {
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.supervisor_tablet.gui.Supervisor_SerialActivity" resValue "string","SerialClass","com.yottacode.pictogram.supervisor_tablet.gui.Supervisor_SerialActivity"
resValue "string","apk","pictograms.apk"
// signingConfig signingConfigs.config // signingConfig signingConfigs.config
} }
productFlavors { productFlavors {
......
...@@ -16,6 +16,7 @@ import android.widget.ImageView; ...@@ -16,6 +16,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
...@@ -110,7 +111,7 @@ public class PictoAnimation { ...@@ -110,7 +111,7 @@ public class PictoAnimation {
public void onAnimationUpdate(ValueAnimator animation) { public void onAnimationUpdate(ValueAnimator animation) {
int i=(int)animation.getAnimatedValue(); int i=(int)animation.getAnimatedValue();
v.setTranslationY(i); 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; ...@@ -30,8 +30,6 @@ import com.yottacode.pictogram.tabletlibrary.cropper.CropImageView;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static android.graphics.Color.BLACK; import static android.graphics.Color.BLACK;
...@@ -425,7 +423,7 @@ public class PictoMenu { ...@@ -425,7 +423,7 @@ public class PictoMenu {
activity.setContentView(R.layout.crop_layout); activity.setContentView(R.layout.crop_layout);
final CropImageView cropImageView = (CropImageView) activity.findViewById(R.id.CropImageView); 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 ImageView croppedImageView = (ImageView) activity.findViewById(R.id.croppedImageView);
final Button cropButton = (Button) activity.findViewById(R.id.Button_crop); final Button cropButton = (Button) activity.findViewById(R.id.Button_crop);
......
...@@ -117,7 +117,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -117,7 +117,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// blockNotificationBar(); // blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? R.layout.activity_pictogram_big : R.layout.activity_pictogram); 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 ...@@ -245,6 +244,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
PCBcontext.setActivityContext(this);
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+ Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+
(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()
? " ("+ PCBcontext.getPcbdb().getCurrentUser().get_name_sup()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_sup()+")" ? " ("+ PCBcontext.getPcbdb().getCurrentUser().get_name_sup()+" "+PCBcontext.getPcbdb().getCurrentUser().get_surname_sup()+")"
...@@ -872,7 +872,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -872,7 +872,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
PCBcontext.getActionLog().log(new PictosAction(lp)); PCBcontext.getActionLog().log(new PictosAction(lp));
tapeAdapter.ttsAllNew(tts); tapeAdapter.ttsAllNew(tts);
new PictoAnimation().animateTapeView(0,(ViewGroup)arg0.getParent()); 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); showOnlyTape(true);
} }
} }
...@@ -884,7 +884,8 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -884,7 +884,8 @@ protected void showOnlyTape(boolean onlyTape) {
this.tape_delivered=onlyTape; this.tape_delivered=onlyTape;
if (onlyTape) { if (onlyTape) {
if (!tape_delivered_prev) { 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) { if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.INVISIBLE); this.showPictoCategoriesViewButton.setVisibility(View.INVISIBLE);
this.pictoCategoryGridView.setVisibility(View.INVISIBLE); this.pictoCategoryGridView.setVisibility(View.INVISIBLE);
...@@ -900,7 +901,8 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -900,7 +901,8 @@ protected void showOnlyTape(boolean onlyTape) {
} }
} }
else { else {
//ttsButton.setEnabled(true); if (PCBcontext.getPcbdb().getCurrentUser().delivery()== User.JSON_STUDENT_ATTTRS.delivery.one)
ttsButton.setEnabled(true);
new PictoAnimation().animateTapeViewVertical(this,true); new PictoAnimation().animateTapeViewVertical(this,true);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) { if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE); this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE);
......
...@@ -9,6 +9,7 @@ import android.view.ViewGroup; ...@@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import com.yottacode.pictogram.dao.Picto; import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.tts.TTSHelper; import com.yottacode.pictogram.tts.TTSHelper;
...@@ -66,7 +67,7 @@ public class TapeAdapter extends BaseAdapter { ...@@ -66,7 +67,7 @@ public class TapeAdapter extends BaseAdapter {
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR // ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
public void endPlay() { public void endPlay() {
if (PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery()) if (PCBcontext.getPcbdb().getCurrentUser().delivery()==User.JSON_STUDENT_ATTTRS.delivery.clean)
clear(); clear();
play = false; play = false;
} }
......
...@@ -69,7 +69,6 @@ public class LoginActivity extends FragmentActivity { ...@@ -69,7 +69,6 @@ public class LoginActivity extends FragmentActivity {
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
// Set supervisor information on topbar // Set supervisor information on topbar
final TextView supervisorFullNameView = (TextView) findViewById(R.id.loginTopbarSupervisorFullName); final TextView supervisorFullNameView = (TextView) findViewById(R.id.loginTopbarSupervisorFullName);
final TextView supervisorUserNameView = (TextView) findViewById(R.id.loginTopbarSupervisorUserName); final TextView supervisorUserNameView = (TextView) findViewById(R.id.loginTopbarSupervisorUserName);
final ImageView supervisorPhotoView = (ImageView) findViewById(R.id.loginTopbarSupervisorPhoto); final ImageView supervisorPhotoView = (ImageView) findViewById(R.id.loginTopbarSupervisorPhoto);
...@@ -115,4 +114,9 @@ public class LoginActivity extends FragmentActivity { ...@@ -115,4 +114,9 @@ public class LoginActivity extends FragmentActivity {
Log.i(LOG_TAG,"Closing Login window"); Log.i(LOG_TAG,"Closing Login window");
PCBcontext.getNetService().closeNotifyStatus(); PCBcontext.getNetService().closeNotifyStatus();
} }
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
} }
...@@ -10,7 +10,6 @@ import android.view.Window; ...@@ -10,7 +10,6 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
public class MainActivity extends Activity { public class MainActivity extends Activity {
......
...@@ -198,5 +198,4 @@ public class SerialActivity extends Activity { ...@@ -198,5 +198,4 @@ public class SerialActivity extends Activity {
} }
} }
...@@ -402,7 +402,11 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -402,7 +402,11 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
} }
} }
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
@Override @Override
public void onDestroy() { public void onDestroy() {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<facet type="android" name="Android"> <facet type="android" name="Android">
<configuration> <configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" /> <option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks> <afterSyncTasks>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> <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="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" /> <option name="LIBRARY_PROJECT" value="true" />
</configuration> </configuration>
</facet> </facet>
</component> </component>
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <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/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" 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/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
...@@ -60,6 +62,7 @@ ...@@ -60,6 +62,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" /> <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/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" 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/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
...@@ -67,6 +70,7 @@ ...@@ -67,6 +70,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" /> <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/aidl" isTestSource="false" />
<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/jni" 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/res" type="java-test-resource" />
...@@ -74,6 +78,7 @@ ...@@ -74,6 +78,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" 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/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" 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/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" 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" />
...@@ -81,8 +86,10 @@ ...@@ -81,8 +86,10 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" 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/aidl" isTestSource="true" />
<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/jni" 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" />
<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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
...@@ -98,10 +105,16 @@ ...@@ -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/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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <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/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <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" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
...@@ -117,6 +130,7 @@ ...@@ -117,6 +130,7 @@
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" /> <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="library" exported="" name="support-core-utils-24.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="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="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
......
...@@ -19,11 +19,12 @@ android { ...@@ -19,11 +19,12 @@ android {
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity" resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
resValue "string","apk","pictogram.apk"
// signingConfig signingConfigs.config // signingConfig signingConfigs.config
} }
productFlavors { productFlavors {
CIFlavor { CIFlavor {
resValue "string", "server", "https://ci.yottacode.com" resValue "string", "server", "http://ci.yottacode.com"
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
} }
DevFlavor { DevFlavor {
......
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