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
98b90672
authored
Mar 24, 2017
by
Germán Callejas Alcántara
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Issue
#97
cerrado
parent
104367a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
7 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
View file @
98b90672
...
@@ -50,6 +50,8 @@ public class Picto extends Img {
...
@@ -50,6 +50,8 @@ public class Picto extends Img {
public
static
String
EXPRESSION
=
"expression"
;
public
static
String
EXPRESSION
=
"expression"
;
public
static
String
MIRROR
=
"mirror"
;
public
static
String
MIRROR
=
"mirror"
;
public
static
String
LEGEND
=
"legend"
;
public
static
String
LEGEND
=
"legend"
;
public
static
String
URI_SOUND
=
"uri_sound"
;
public
static
String
USER_AVATAR
=
"user_avatar"
;
}
}
...
@@ -88,7 +90,7 @@ public class Picto extends Img {
...
@@ -88,7 +90,7 @@ public class Picto extends Img {
Log
.
e
(
LOG_TAG
,
e
.
getMessage
());
Log
.
e
(
LOG_TAG
,
e
.
getMessage
());
}
}
}
}
public
Picto
(
int
id
,
String
url
,
String
translation
,
int
cat
,
int
row
,
int
column
,
int
freeRow
,
int
freeColumn
,
int
stupicto_id
)
throws
JSONException
{
public
Picto
(
int
id
,
String
url
,
String
translation
,
int
cat
,
int
row
,
int
column
,
int
freeRow
,
int
freeColumn
,
int
stupicto_id
,
String
uri_sound
,
String
user_avatar
)
throws
JSONException
{
this
(
id
,
url
,
new
JSONObject
()
this
(
id
,
url
,
new
JSONObject
()
.
put
(
JSON_ATTTRS
.
CATEGORY
,
cat
)
.
put
(
JSON_ATTTRS
.
CATEGORY
,
cat
)
.
put
(
JSON_ATTTRS
.
COLUMN
,
column
)
.
put
(
JSON_ATTTRS
.
COLUMN
,
column
)
...
@@ -98,7 +100,10 @@ public class Picto extends Img {
...
@@ -98,7 +100,10 @@ public class Picto extends Img {
.
put
(
JSON_ATTTRS
.
STATUS
,
JSON_ATTTR_STATUS_VALUES
.
ENABLED
)
.
put
(
JSON_ATTTRS
.
STATUS
,
JSON_ATTTR_STATUS_VALUES
.
ENABLED
)
.
put
(
JSON_ATTTRS
.
LEGEND
,
JSON_ATTTR_LEGEND_VALUES
.
NONE
)
.
put
(
JSON_ATTTRS
.
LEGEND
,
JSON_ATTTR_LEGEND_VALUES
.
NONE
)
.
put
(
JSON_ATTTRS
.
STUPICTO_ID
,
stupicto_id
)
.
put
(
JSON_ATTTRS
.
STUPICTO_ID
,
stupicto_id
)
.
put
(
JSON_ATTTRS
.
EXPRESSION
,
translation
));
.
put
(
JSON_ATTTRS
.
EXPRESSION
,
translation
)
.
put
(
JSON_ATTTRS
.
URI_SOUND
,
uri_sound
)
.
put
(
JSON_ATTTRS
.
USER_AVATAR
,
user_avatar
)
);
}
}
public
Picto
(
int
id
,
String
url
,
String
translation
,
String
attributes
)
throws
JSONException
{
public
Picto
(
int
id
,
String
url
,
String
translation
,
String
attributes
)
throws
JSONException
{
this
(
id
,
url
,
new
JSONObject
(
attributes
).
put
(
JSON_ATTTRS
.
EXPRESSION
,
translation
));
this
(
id
,
url
,
new
JSONObject
(
attributes
).
put
(
JSON_ATTTRS
.
EXPRESSION
,
translation
));
...
@@ -341,7 +346,21 @@ public class Picto extends Img {
...
@@ -341,7 +346,21 @@ public class Picto extends Img {
}
}
}
}
/**
*
* @return the uri of associated sound of the picto
*/
public
String
getUriSound
(){
return
this
.
attributes
.
optString
(
JSON_ATTTRS
.
URI_SOUND
,
null
);
}
/**
*
* @return the associated user avatar of the picto
*/
public
String
getUserAvatar
(){
return
this
.
attributes
.
optString
(
JSON_ATTTRS
.
USER_AVATAR
,
null
);
}
/**
/**
* A picto is a category iif:
* A picto is a category iif:
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
98b90672
...
@@ -399,7 +399,7 @@ public class Vocabulary implements Iterable<Picto> {
...
@@ -399,7 +399,7 @@ public class Vocabulary implements Iterable<Picto> {
/*
/*
* It saves locally a new picto obtained from the PCB
* It saves locally a new picto obtained from the PCB
*/
*/
public
void
saveLocalPicto
(
String
url
,
String
exp
,
int
cat
,
int
coord_x
,
int
coord_y
,
int
free_category_coord_x
,
int
free_category_coord_y
,
final
iLocalPicto
listener
)
{
public
void
saveLocalPicto
(
String
url
,
String
exp
,
int
cat
,
int
coord_x
,
int
coord_y
,
int
free_category_coord_x
,
int
free_category_coord_y
,
String
uri_sound
,
String
user_avatar
,
final
iLocalPicto
listener
)
{
Picto
prev_picto
=
find_picto
(
cat
,
coord_x
,
coord_y
);
//¿estamos reemplazanddo un picto que ya existe?
Picto
prev_picto
=
find_picto
(
cat
,
coord_x
,
coord_y
);
//¿estamos reemplazanddo un picto que ya existe?
...
@@ -411,7 +411,7 @@ public class Vocabulary implements Iterable<Picto> {
...
@@ -411,7 +411,7 @@ public class Vocabulary implements Iterable<Picto> {
int
id
=
PCBcontext
.
getDevice
().
getNextLocalPictoID
();
int
id
=
PCBcontext
.
getDevice
().
getNextLocalPictoID
();
try
{
try
{
final
Picto
picto
=
new
Picto
(
id
,
url
,
exp
,
cat
,
coord_x
,
coord_y
,
free_category_coord_x
,
free_category_coord_y
,
prev_picto
!=
null
?
prev_picto
.
get_stupicto_id
()
:
Picto
.
STUPICTO_NULL
);
final
Picto
picto
=
new
Picto
(
id
,
url
,
exp
,
cat
,
coord_x
,
coord_y
,
free_category_coord_x
,
free_category_coord_y
,
prev_picto
!=
null
?
prev_picto
.
get_stupicto_id
()
:
Picto
.
STUPICTO_NULL
,
uri_sound
,
user_avatar
);
addPicto
(
picto
,
ImgDownloader
.
tsource
.
local
,
new
ImgDownloader
.
iImgDownloaderListener
()
{
addPicto
(
picto
,
ImgDownloader
.
tsource
.
local
,
new
ImgDownloader
.
iImgDownloaderListener
()
{
@Override
@Override
public
void
loadComplete
()
{
public
void
loadComplete
()
{
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
View file @
98b90672
...
@@ -1155,12 +1155,14 @@ protected void showOnlyTape(boolean onlyTape) {
...
@@ -1155,12 +1155,14 @@ protected void showOnlyTape(boolean onlyTape) {
int
freeRow
=
edit
?
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeRow
=
edit
?
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeColumn
=
edit
?
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
int
freeColumn
=
edit
?
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
//String uri_sound = edit ? data.getExtras().getString(Picto.JSON_ATTTRS.URI_SOUND) : getIntent().getStringExtra(Picto.JSON_ATTTRS.URI_SOUND);
int
cat
=
edit
?
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
);
int
cat
=
edit
?
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
);
String
path
=
data
.
getExtras
().
getString
(
EditPictoActivity
.
PATH
);
String
path
=
data
.
getExtras
().
getString
(
EditPictoActivity
.
PATH
);
String
legend
=
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
);
String
legend
=
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
);
chooseTextAndSavePicto
(
path
,
row
,
col
,
freeRow
,
freeColumn
,
cat
,
legend
);
//TODO: COGER URI DEL SONIDO Y EL USER AVATAR
chooseTextAndSavePicto
(
path
,
row
,
col
,
freeRow
,
freeColumn
,
cat
,
legend
,
null
/*uri_sound*/
,
null
);
refresh
();
refresh
();
}
}
break
;
break
;
...
@@ -1168,12 +1170,11 @@ protected void showOnlyTape(boolean onlyTape) {
...
@@ -1168,12 +1170,11 @@ protected void showOnlyTape(boolean onlyTape) {
}
}
//TODO: Añadir ruta de audio
/**
/**
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/
*/
public
void
chooseTextAndSavePicto
(
final
String
selectedImagePath
,
final
int
row
,
final
int
col
,
final
int
freeRow
,
final
int
freeColumn
,
public
void
chooseTextAndSavePicto
(
final
String
selectedImagePath
,
final
int
row
,
final
int
col
,
final
int
freeRow
,
final
int
freeColumn
,
final
int
category
,
final
String
legend
)
{
final
int
category
,
final
String
legend
,
final
String
uri_sound
,
final
String
user_avatar
)
{
// Set up the buttons
// Set up the buttons
int
cat
=
category
!=
-
1
?
category
:
Picto
.
NO_CATEGORY
;
int
cat
=
category
!=
-
1
?
category
:
Picto
.
NO_CATEGORY
;
...
@@ -1187,6 +1188,8 @@ protected void showOnlyTape(boolean onlyTape) {
...
@@ -1187,6 +1188,8 @@ protected void showOnlyTape(boolean onlyTape) {
col
,
col
,
freeRow
,
freeRow
,
freeColumn
,
freeColumn
,
uri_sound
,
user_avatar
,
new
iLocalPicto
()
{
new
iLocalPicto
()
{
@Override
@Override
public
void
saved
(
Picto
localPicto
)
{
public
void
saved
(
Picto
localPicto
)
{
...
...
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