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
e5859603
authored
Jul 19, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://scm.ujaen.es/softuno/pictogram
into develop
parents
80347944
38b0b019
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
31 deletions
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/Picto.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/PictoUploader.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
android/Pictogram/app/src/main/res/raw/pcbdb_create.sql
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/Picto.java
View file @
e5859603
...
...
@@ -368,8 +368,8 @@ public class Picto extends Img {
/**
* when the status is locally modified, it is required to remove when it is uploaded since it is no longer a local modification
*/
public
void
set_local_status
(
boolean
modified
)
{
if
(
modified
)
public
void
set_local_status
(
boolean
local
)
{
if
(
local
)
try
{
this
.
attributes
.
put
(
JSON_ATTTRS
.
PCB_STATUS_MODIFICATION
,
true
);
PCBcontext
.
getPcbdb
().
modifyPicto
(
this
.
get_id
(),
this
.
get_json_attrs
());
...
...
@@ -383,4 +383,4 @@ public class Picto extends Img {
PCBcontext
.
getPcbdb
().
modifyPicto
(
this
.
get_id
(),
this
.
get_json_attrs
());
}
}
}
\ No newline at end of file
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
e5859603
...
...
@@ -120,6 +120,8 @@ public class Vocabulary implements Iterable<Picto> {
}
if
(
picto
.
get_id
()
<
0
)
//id<0 iif it is a local id
try
{
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Picto added while offline. Picto translation: '"
+
picto
.
get_translation
()
+
"', id:"
+
picto
.
get_id
()
+
" Local status?"
+
picto
.
local_status
());
new
PictoUploader
(
picto
).
upload
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
e5859603
...
...
@@ -130,15 +130,16 @@ public class NetService implements Runnable {
if
(!
updated
)
{
updated
=
true
;
// Comprobar si hay usuario offline, para hacer login transparente
if
(
PCBcontext
.
is_user_offline
()){
login
();
}
else
if
(
PCBcontext
.
is_user_online
()){
Log
.
i
(
this
.
getClass
().
getName
(),
"PCB reconnect"
);
PCBcontext
.
getRoom
().
reconnect
();
PCBcontext
.
getVocabulary
().
synchronize
();
PCBcontext
.
getActionLog
().
batch
();
}
if
(
PCBcontext
.
is_user_logged
())
//si el usuario aun no hizo login, en realidad no es necesario hacer nada
// Comprobar si hay usuario offline, para hacer login transparente
if
(
PCBcontext
.
is_user_offline
()){
login
();
}
else
if
(
PCBcontext
.
is_user_online
()){
Log
.
i
(
this
.
getClass
().
getName
(),
"PCB reconnect"
);
PCBcontext
.
getRoom
().
reconnect
();
PCBcontext
.
getVocabulary
().
synchronize
();
PCBcontext
.
getActionLog
().
batch
();
}
}
Log
.
i
(
this
.
getClass
().
getName
(),
"PCB status checked. Updated? "
+
updated
);
notifyStatus
();
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/PictoUploader.java
View file @
e5859603
...
...
@@ -169,8 +169,10 @@ public class PictoUploader {
*
**/
public
void
upload
()
throws
IOException
{
int
local_img_id
=
this
.
picto
.
get_id
();
int
img_id
=
uploadImg
(
this
.
picto
);
if
(
img_id
>
0
)
{
PCBcontext
.
getPcbdb
().
deletePicto
(
local_img_id
);
uploadAttributes
(
img_id
);
uploadTranslation
(
img_id
);
PCBcontext
.
getRoom
().
emit
(
new
VocabularyAction
(
VocabularyAction
.
ADD
,
PictoUploader
.
this
.
picto
));
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
View file @
e5859603
...
...
@@ -28,23 +28,7 @@ public final class PCBcontext {
private
static
ActionLog
actionLog
;
private
static
boolean
init
=
false
;
protected
PCBcontext
()
{
// Initialize internal objects. This initialization is run only the first time
// when it's called PCBcontext.getInstance(); even between activities.
}
private
static
class
Holder
{
static
final
PCBcontext
INSTANCE
=
new
PCBcontext
();
}
// Method to call outside when using this class --> PCBcontext pcb = PCBcontext.getInstance();
public
static
PCBcontext
getInstance
()
{
return
Holder
.
INSTANCE
;
}
// ---------------------------------------------------------------------------------------------
// Rest of class methods
//
/**
* Init method for passing params to the singleton
...
...
@@ -88,6 +72,14 @@ public final class PCBcontext {
/**
*
* @return true if a given user has been logged into the system (the login window was successfully filled)
*/
public
static
boolean
is_user_logged
()
{
return
(
init
&&
pcbdb
!=
null
);
}
/**
*
*/
public
static
void
unset_user
()
{
pcbdb
=
null
;
...
...
android/Pictogram/app/src/main/res/raw/pcbdb_create.sql
View file @
e5859603
...
...
@@ -196,7 +196,7 @@ END
CREATE
TRIGGER
trg_insert_users_detail
INSTEAD
OF
INSERT
ON
users_detail
FOR
EACH
ROW
WHEN
NEW
.
pwd_stu
IS
NOT
NULL
WHEN
NEW
.
pwd_stu
IS
NOT
NULL
BEGIN
INSERT
OR
REPLACE
INTO
student
VALUES
(
NEW
.
id_stu
,
NEW
.
nickname_stu
,
NEW
.
pwd_stu
,
NEW
.
name_stu
,
NEW
.
surname_stu
,
NEW
.
url_img_stu
,
NEW
.
gender_stu
,
NEW
.
lang_stu
,
NEW
.
attributes_stu
);
INSERT
OR
REPLACE
INTO
supervisor
VALUES
(
NEW
.
id_sup
,
NEW
.
email_sup
,
NEW
.
pwd_sup
,
NEW
.
name_sup
,
NEW
.
surname_sup
,
NEW
.
url_img_sup
,
NEW
.
gender_sup
,
NEW
.
lang_sup
,
NEW
.
tts_engine_sup
);
...
...
@@ -204,7 +204,7 @@ BEGIN
END
;
--
CREATE
TRIGGER
trg_insert_users_detail_
knonwstudent
CREATE
TRIGGER
trg_insert_users_detail_
as_sup
INSTEAD
OF
INSERT
ON
users_detail
FOR
EACH
ROW
WHEN
NEW
.
pwd_stu
IS
NULL
...
...
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