Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
21bf9507
authored
Sep 13, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on several issues
parent
80feaacd
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
24 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/ServerLogin.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/websockets/StudentTalk.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
android/Pictogram/commonlibrary/src/main/res/values-en/strings.xml
android/Pictogram/commonlibrary/src/main/res/values-es/strings.xml
android/Pictogram/commonlibrary/src/main/res/values/strings.xml
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
View file @
21bf9507
...
...
@@ -330,7 +330,7 @@ public class Device extends SQLiteOpenHelper {
"'"
+
user
.
get_lang_sup
()
+
"',"
+
"'"
+
user
.
get_tts_engine_sup
()
+
"',"
+
"'"
+
user
.
get_office
()
+
"'"
+
")"
;
Log
.
e
(
LOG_TAG
,
sentence
);
")"
;
db
.
execSQL
(
sentence
);
db
.
setTransactionSuccessful
();
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
21bf9507
...
...
@@ -5,7 +5,6 @@ import android.util.Log;
import
com.yottacode.net.RestapiWrapper
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.action.PictoAction
;
import
com.yottacode.pictogram.action.VocabularyAction
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.net.ImgDownloader
;
...
...
@@ -23,6 +22,7 @@ import org.json.JSONObject;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.Hashtable
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
...
...
@@ -169,7 +169,7 @@ public class Vocabulary implements Iterable<Picto> {
*/
public
void
synchronize
()
{
Log
.
e
(
LOG_TAG
,
"SYNCRO from "
+
Arrays
.
toString
(
Thread
.
currentThread
().
getStackTrace
()));
boolean
upload_pending
=
synchronize_upload
();
// (i) uploading
// and (ii) downloading
...
...
@@ -189,7 +189,7 @@ public class Vocabulary implements Iterable<Picto> {
@Override
public
void
result
(
JSONObject
result
)
{
if
(
result
!=
null
)
{
if
(
result
!=
null
&&
PCBcontext
.
is_user_logged
()
)
{
JSONObject
picto
,
attributes
;
JSONObject
stupicto
=
null
;
try
{
...
...
@@ -207,12 +207,11 @@ public class Vocabulary implements Iterable<Picto> {
stupicto
.
getInt
(
"id"
),
attributes
);
}
synchronizeImgs
(
pictos
);
if
(
PCBcontext
.
is_user_logged
())
{
PCBcontext
.
getPcbdb
().
setStudentVocabulary
(
Vocabulary
.
this
);
PCBcontext
.
getPcbdb
().
setActiveSceneForStudent
(
result
);
//Aqui inserto en scene los datos que llegan de la activa
}
else
Log
.
i
(
this
.
getClass
().
getName
(),
"Downloaded images ended when the user comes to logout"
);
PCBcontext
.
getPcbdb
().
setStudentVocabulary
(
Vocabulary
.
this
);
PCBcontext
.
getPcbdb
().
setActiveSceneForStudent
(
result
);
//Aqui inserto en scene los datos que llegan de la activa
Log
.
i
(
this
.
getClass
().
getName
(),
" Pictos downloaded: "
+
result
.
getJSONArray
(
"pictos"
).
length
());
}
catch
(
JSONException
e
)
{
StackTraceElement
traces
[]
=
e
.
getStackTrace
();
...
...
@@ -222,6 +221,7 @@ public class Vocabulary implements Iterable<Picto> {
this
.
error
(
new
RestapiWrapper
.
HTTPException
(
"JSON Error:"
+
e
.
getMessage
(),
-
1
));
}
}
else
Log
.
e
(
this
.
getClass
().
getName
(),
"Downloaded images ended when the user comes to logout"
);
}
@Override
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
21bf9507
...
...
@@ -80,7 +80,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
@Override
public
void
error
(
RestapiWrapper
.
HTTPException
e
)
{
Log
.
e
(
this
.
getClass
().
getSimpleName
(),
"Error
un
when server login:"
+
e
.
getMessage
()+
"( error "
+
e
.
getCode
()+
")"
);
Log
.
e
(
this
.
getClass
().
getSimpleName
(),
"Error when server login:"
+
e
.
getMessage
()+
"( error "
+
e
.
getCode
()+
")"
);
if
(
e
instanceof
LoginException
)
for
(
iNetServiceStatus
listener:
listeners
)
if
(
listener
instanceof
iNetServiceDevice
)
((
iNetServiceDevice
)
listener
).
restart_app
(
false
);
...
...
@@ -188,7 +188,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
if
(!
PCBcontext
.
getRoom
().
inRoom
()){
PCBcontext
.
getRoom
().
connect
();
}
PCBcontext
.
getVocabulary
().
synchronize
();
//
PCBcontext.getVocabulary().synchronize();
synchronizeStudentAttributes
();
nextSynchro
(
now
+
restfullSynchroTimming
);
}
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/ServerLogin.java
View file @
21bf9507
...
...
@@ -47,7 +47,7 @@ public class ServerLogin {
try
{
if
(
PCBcontext
.
is_user_offline
())
{
final
String
TAG_TOKEN
=
"token"
;
PCBcontext
.
getPcbdb
().
user_online
(
true
);
;
PCBcontext
.
getPcbdb
().
user_online
(
true
);
PCBcontext
.
getRestapiWrapper
().
setToken
(
result
.
getString
(
TAG_TOKEN
));
PCBcontext
.
getVocabulary
().
synchronize
();
PCBcontext
.
getRoom
().
connect
();
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/websockets/StudentTalk.java
View file @
21bf9507
...
...
@@ -41,7 +41,9 @@ public class StudentTalk implements Emitter.Listener {
String
pic
=
msg
.
getString
(
"pic"
);
String
lang
=
msg
.
getString
(
"lang"
);
String
attributes
=
msg
.
getString
(
"attributes"
);
JSONObject
license
=
msg
.
getJSONObject
(
"license"
);
//JSONObject license= msg.getJSONObject("license");
Log
.
e
(
"STUDENT"
,
"change...remove license in hard when lincense is not null"
);
JSONObject
license
=
new
JSONObject
().
put
(
"isValid"
,
true
);
User
user
=
PCBcontext
.
getPcbdb
().
getCurrentUser
();
User
updatedUser
=
new
User
(
id
,
username
,
user
.
get_pwd_stu
(),
name
,
surname
,
id_active_scene
,
pic
,
gender
,
lang
,
attributes
,
user
.
get_id_sup
(),
user
.
get_email_sup
(),
user
.
get_pwd_sup
(),
user
.
get_name_sup
(),
user
.
get_surname_sup
(),
user
.
get_url_img_sup
(),
user
.
get_gender_sup
(),
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
View file @
21bf9507
...
...
@@ -23,6 +23,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
public
final
class
PCBcontext
{
private
static
final
String
LOG_TAG
=
PCBcontext
.
class
.
getName
();
private
static
Context
context
;
private
static
PCBDBHelper
pcbdb
;
private
static
Device
device
=
null
;
...
...
@@ -72,7 +73,7 @@ public final class PCBcontext {
wrapper
.
setToken
(
token
);
pcbdb
=
new
PCBDBHelper
(
null
,
2
,
student
);
pcbdb
.
user_online
(
token
!=
null
);
Log
.
e
(
"pcbcontextborra"
,
"JSON:"
);
pcbdb
.
user_online
(
token
!=
null
);
room
=
new
Room
();
actionLog
=
new
ActionLog
();
vocabulary
=
new
Vocabulary
(
listener
);
...
...
@@ -107,8 +108,10 @@ public final class PCBcontext {
PCBcontext
.
getDevice
().
insertUser
(
updatedStudent
);
if
(
updatedStudent
.
is_picto_size_big
()!=
getPcbdb
().
getCurrentUser
().
is_picto_size_big
()
||
PCBcontext
.
getVocabulary
().
has_categories
()
!=
vocabulary
.
has_categories
()
||
updatedStudent
.
get_active_scene
()
!=
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_active_scene
())
PCBcontext
.
getNetService
().
restart_app
(
false
);
||
updatedStudent
.
get_active_scene
()
!=
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_active_scene
())
{
Log
.
e
(
LOG_TAG
,
"Major config modification. Restarting is mandatory"
);
PCBcontext
.
getNetService
().
restart_app
(
false
);
}
else
{
PCBcontext
.
getPcbdb
().
setCurrentUser
(
updatedStudent
);
PCBcontext
.
getNetService
().
getNetServiceDevice
().
updateUserConfig
(
updatedStudent
,
valid_license
);
...
...
android/Pictogram/commonlibrary/src/main/res/values-en/strings.xml
View file @
21bf9507
...
...
@@ -84,6 +84,7 @@
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"fa_question_circle"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
...
...
android/Pictogram/commonlibrary/src/main/res/values-es/strings.xml
View file @
21bf9507
...
...
@@ -78,6 +78,7 @@
<string
name=
"fa_certificate"
>

</string>
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_question_circle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
...
...
android/Pictogram/commonlibrary/src/main/res/values/strings.xml
View file @
21bf9507
...
...
@@ -84,6 +84,7 @@
<string
name=
"fa_flask"
>

</string>
<string
name=
"fa_exclamation_triangle"
>

</string>
<string
name=
"fa_user_plus"
>

</string>
<string
name=
"fa_question_circle"
>

</string>
<string
name=
"google_play_student_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.yotta_tablet
</string>
<string
name=
"google_play_supervisor_apk"
>
https://play.google.com/store/apps/details?id=com.yottacode.supervisor_tablet
</string>
</resources>
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
View file @
21bf9507
...
...
@@ -2,12 +2,8 @@ package com.yottacode.pictogram.tabletlibrary.gui.login;
import
android.app.Activity
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Color
;
import
android.graphics.Typeface
;
import
android.provider.ContactsContract
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -22,9 +18,8 @@ import java.util.Vector;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_certificate
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_flask
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_exclamation_triangle
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_user_plus
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_question_circle
;
/**
* Creates a View for each student on the list with a photo and his/her name.
* It uses list_single.xml for the layout creation.
...
...
@@ -73,8 +68,10 @@ public class CustomList extends ArrayAdapter<String>{
// License, except add student view
TextView
licenseView
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentLicense
);
licenseView
.
setTypeface
(
fontAwesome
);
if
(
licenses
[
position
].
equals
(
"pro"
))
{
if
(!
PCBcontext
.
getNetService
().
online
())
{
licenseView
.
setText
(
fa_question_circle
);
licenseView
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
text_danger
));
}
else
if
(
licenses
[
position
].
equals
(
"pro"
))
{
licenseView
.
setText
(
fa_certificate
);
licenseView
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
text_primary
));
}
else
if
(
licenses
[
position
].
equals
(
"trial"
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment