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
abb55e80
authored
May 03, 2017
by
Germán Callejas Alcántara
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Error en Vocabulary en la función synchronize cuando descargo la escena activa
parent
153e6af3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/VocabularyIterator.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
abb55e80
...
...
@@ -172,8 +172,10 @@ public class Vocabulary implements Iterable<Picto> {
// and (ii) downloading
if
(!
upload_pending
)
{
final
String
picto_str
=
"/pictos"
;
//final String picto_str = "/pictos";
final
String
picto_str
=
"/activeScene"
;
String
operation
=
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_restapi_operation_stu
()
+
picto_str
;
Log
.
i
(
"TAG_PRUEBAS"
,
"Ruta: "
+
operation
);
PCBcontext
.
getRestapiWrapper
().
ask
(
operation
,
new
RestapiWrapper
.
iRestapiListener
()
{
@Override
public
void
preExecute
()
{
...
...
@@ -182,24 +184,32 @@ public class Vocabulary implements Iterable<Picto> {
@Override
public
void
result
(
JSONArray
result
)
{
}
@Override
public
void
result
(
JSONObject
result
)
{
if
(
result
!=
null
)
{
final
String
jpicto
=
"picto"
;
Log
.
i
(
"TAG_PRUEBAS"
,
result
.
toString
());
/* final String jpicto = "picto";
final String jid = "id";
final String juri = "uri";
final
String
jattributes
=
"attributes"
;
final String jattributes = "attributes";
*/
Picto
[]
pictos
=
new
Picto
[
result
.
length
()];
JSONObject
picto
,
attributes
;
JSONObject
stupicto
=
null
;
try
{
for
(
int
i
=
0
;
i
<
result
.
length
();
i
++)
{
stupicto
=
result
.
getJSONObject
(
i
);
picto
=
stupicto
.
getJSONObject
(
jpicto
);
attributes
=
stupicto
.
getJSONObject
(
jattributes
);
attributes
.
put
(
Picto
.
JSON_ATTTRS
.
STUPICTO_ID
,
stupicto
.
get
(
jid
));
pictos
[
i
]
=
new
Picto
(
picto
.
getInt
(
jid
),
picto
.
getString
(
juri
),
JSONArray
stu_pictos
=
result
.
getJSONArray
(
"pictos"
);
//Obtengo el JSONArray de los pictos
Log
.
i
(
"TAG_PRUEBAS"
,
stu_pictos
.
toString
());
Picto
[]
pictos
=
new
Picto
[
stu_pictos
.
length
()];
for
(
int
i
=
0
;
i
<
stu_pictos
.
length
();
i
++)
{
stupicto
=
stu_pictos
.
getJSONObject
(
i
);
picto
=
stupicto
.
getJSONObject
(
"picto"
);
attributes
=
stupicto
.
getJSONObject
(
"attributes"
);
attributes
.
put
(
Picto
.
JSON_ATTTRS
.
STUPICTO_ID
,
stupicto
.
getInt
(
"id"
));
pictos
[
i
]
=
new
Picto
(
stupicto
.
getInt
(
"id"
),
picto
.
getString
(
"uri"
),
attributes
);
}
synchronizeImgs
(
pictos
);
...
...
@@ -215,12 +225,14 @@ public class Vocabulary implements Iterable<Picto> {
Log
.
e
(
this
.
getClass
().
getName
(),
" Picto JSON error from server: "
+
stupicto
.
toString
());
this
.
error
(
new
RestapiWrapper
.
HTTPException
(
"JSON Error:"
+
e
.
getMessage
(),
-
1
));
}
}
else
{
Log
.
i
(
"TAG_PRUEBAS"
,
"result null"
);
}
}
@Override
/*
@Override
public void result(JSONObject result) {
}
}
*/
@Override
public
void
error
(
RestapiWrapper
.
HTTPException
e
)
{
...
...
@@ -245,13 +257,15 @@ public class Vocabulary implements Iterable<Picto> {
this
.
pictos
.
clear
();
for
(
Picto
updated_picto:
updated_collection
)
{
LinkedList
<
Picto
>
pictos_cat
;
Log
.
i
(
"TAG_PRUEBAS"
,
"ID: "
+
updated_picto
.
get_id
());
Picto
picto
=
new
Picto
(
updated_picto
.
get_id
(),
updated_picto
.
get_url
(),
updated_picto
.
get_translation
(),
updated_picto
.
get_json_attrs
());
if
(
pictos
.
containsKey
(
picto
.
get_category
()))
if
(
pictos
.
containsKey
(
picto
.
get_category
()))
{
pictos_cat
=
pictos
.
get
(
picto
.
get_category
());
else
{
Log
.
i
(
"TAG_PRUEBAS"
,
"Tiene categoria: "
+
pictos_cat
);
}
else
{
pictos_cat
=
new
LinkedList
<>();
pictos
.
put
(
new
Integer
(
picto
.
get_category
()),
pictos_cat
);
}
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/VocabularyIterator.java
View file @
abb55e80
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