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
416a0b98
authored
Mar 30, 2017
by
Germán Callejas Alcántara
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Asignar supervisor a picto funcionando
parent
f82b517c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
32 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
View file @
416a0b98
...
...
@@ -113,7 +113,7 @@ public class Picto extends Img {
public
Picto
(
int
id
,
String
url
,
JSONObject
attributes
)
{
super
(
id
,
url
,
Img
.
VOCABULARY
);
;
super
(
id
,
url
,
Img
.
VOCABULARY
);
this
.
attributes
=
attributes
;
try
{
if
(
this
.
attributes
.
get
(
JSON_ATTTRS
.
CATEGORY
)==
null
)
...
...
@@ -306,25 +306,15 @@ public class Picto extends Img {
* @return the associated person of a picto
*/
public
String
get_associated_person
()
{
return
JSON_ATTTRS
.
ASSOCIATED_PERSON
!=
"associated_person"
?
JSON_ATTTRS
.
ASSOCIATED_PERSON
:
null
;
}
/**
*
* Change the associated person of a picto
*/
public
void
alter_associated_person
(
String
associated_person
)
{
String
ass_person
=
null
;
try
{
this
.
attributes
.
put
(
JSON_ATTTRS
.
ASSOCIATED_PERSON
,
associated_person
);
set_local_status
(
true
);
if
(!
is_local
())
{
new
PictoUploader
(
this
).
uploadState
();
PCBcontext
.
getActionLog
().
log
(
new
VocabularyAction
(
VocabularyAction
.
ALTERATTRS
,
this
));
}
ass_person
=
this
.
attributes
.
getString
(
JSON_ATTTRS
.
ASSOCIATED_PERSON
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
return
ass_person
;
}
/**
*
* @return the row of the picto
...
...
@@ -377,7 +367,12 @@ 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
?
null
:
this
.
attributes
.
optString
(
JSON_ATTTRS
.
URI_SOUND
);
try
{
return
this
.
attributes
.
getString
(
JSON_ATTTRS
.
URI_SOUND
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/User.java
View file @
416a0b98
...
...
@@ -269,9 +269,8 @@ public class User {
public
String
get_Supervisors
(){
String
supervisors
=
null
;
try
{
if
(
this
.
attributes_stu
.
getString
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
)
!=
"supervisors"
)
supervisors
=
this
.
attributes_stu
.
getString
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
);
try
{
supervisors
=
this
.
attributes_stu
.
getString
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -280,7 +279,8 @@ public class User {
public
void
set_Supervisors
(
String
newSup
){
try
{
this
.
attributes_stu
.
put
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
,
newSup
);
this
.
attributes_stu
.
remove
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
);
this
.
attributes_stu
.
put
(
JSON_STUDENT_ATTTRS
.
SUPERVISORS
,
newSup
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
View file @
416a0b98
...
...
@@ -1127,7 +1127,7 @@ protected void showOnlyTape(boolean onlyTape) {
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
Bitmap
imagen
=
null
;
Bitmap
imagen
;
switch
(
requestCode
)
{
case
CAMERA_PIC_REQUEST:
//Captura de foto
if
(
data
!=
null
&&
resultCode
==
RESULT_OK
)
{
...
...
@@ -1157,12 +1157,14 @@ protected void showOnlyTape(boolean onlyTape) {
String
uri_sound
=
edit
?
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
URI_SOUND
)
:
getIntent
().
getStringExtra
(
Picto
.
JSON_ATTTRS
.
URI_SOUND
);
String
associated_person
=
edit
?
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
ASSOCIATED_PERSON
)
:
getIntent
().
getStringExtra
(
Picto
.
JSON_ATTTRS
.
ASSOCIATED_PERSON
);
Log
.
i
(
EditPictoActivity
.
DEBUG_MESSAGE
,
"Antes de chooseText..."
+
associated_person
);
int
cat
=
edit
?
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
)
:
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
CATEGORY
,
-
1
);
String
path
=
data
.
getExtras
().
getString
(
PictoMenu
.
PATH
);
String
legend
=
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
);
Log
.
i
(
EditPictoActivity
.
DEBUG_MESSAGE
,
"Antes de chooseText...DATOS--> ASS_PERSON: "
+
associated_person
+
"..URI_SOUND: "
+
uri_sound
+
"..PATH_IMAGE: "
+
path
+
"..EXPRESION: "
+
legend
);
//TODO: COGER URI DEL SONIDO,EL USER AVATAR Y LA PERSONA ASOCIADA AL PICTO
chooseTextAndSavePicto
(
path
,
row
,
col
,
freeRow
,
freeColumn
,
cat
,
legend
,
uri_sound
,
null
,
associated_person
);
refresh
();
...
...
@@ -1218,7 +1220,7 @@ protected void showOnlyTape(boolean onlyTape) {
image
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
stream
);
byte
[]
byteArray
=
stream
.
toByteArray
();
intent
.
putExtra
(
PictoMenu
.
IMAGE_PICTO
,
byteArray
);
startActivityForResult
(
intent
,
EditPictoActivity
.
EDIT_PICTO_REQUEST
);
}
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
View file @
416a0b98
...
...
@@ -227,24 +227,19 @@ public class EditPictoActivity extends Activity {
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
edit_picto_layout
);
Log
.
i
(
DEBUG_MESSAGE
,
"EDITAR ABIERTO"
);
//Persmisos para grabar audio
ActivityCompat
.
requestPermissions
(
this
,
permissions
,
REQUEST_RECORD_AUDIO_PERMISSION
);
//Aplicar medidas a los elementos de la vista
DisplayMetrics
metrics
=
new
DisplayMetrics
();
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
metrics
);
LinearLayout
ll
=
(
LinearLayout
)
findViewById
(
R
.
id
.
image_layout
);
ll
.
getLayoutParams
().
width
=
(
int
)
(
metrics
.
widthPixels
*
0.65
)
-
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
activity_vertical_margin
)
*
2
;
ll
.
requestLayout
();
FrameLayout
fl
=
(
FrameLayout
)
findViewById
(
R
.
id
.
legend_menu
);
fl
.
getLayoutParams
().
width
=
(
int
)
(
metrics
.
widthPixels
*
0.25
)
-
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
activity_vertical_margin
);
fl
.
requestLayout
();
//Editar la lista desplegable de supervisores asociados
mDrawerList
=
(
ListView
)
findViewById
(
R
.
id
.
navList
);
/**Obtener la lista de supervisores y aplicarle formato*/
Log
.
i
(
DEBUG_MESSAGE
,
"Usuario: "
+
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_name_stu
());
String
supervisors
=
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_Supervisors
();
Log
.
i
(
DEBUG_MESSAGE
,
"Supervisores: "
+
supervisors
);
ArrayList
<
String
>
supervisores
=
new
ArrayList
<>();
...
...
@@ -283,6 +278,18 @@ public class EditPictoActivity extends Activity {
mDrawerToggle
.
setDrawerIndicatorEnabled
(
true
);
mDrawerLayout
.
setDrawerListener
(
mDrawerToggle
);
//Aplicar medidas a los elementos de la vista
DisplayMetrics
metrics
=
new
DisplayMetrics
();
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
metrics
);
LinearLayout
ll
=
(
LinearLayout
)
findViewById
(
R
.
id
.
image_layout
);
ll
.
getLayoutParams
().
width
=
(
int
)
(
metrics
.
widthPixels
*
0.65
)
-
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
activity_vertical_margin
)
*
2
;
ll
.
requestLayout
();
FrameLayout
fl
=
(
FrameLayout
)
findViewById
(
R
.
id
.
legend_menu
);
fl
.
getLayoutParams
().
width
=
(
int
)
(
metrics
.
widthPixels
*
0.25
)
-
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
activity_vertical_margin
);
fl
.
requestLayout
();
//Definir rutas de almacenado de imagen y audio
dirImagePath
=
Environment
.
getExternalStorageDirectory
()
+
File
.
separator
+
Environment
.
DIRECTORY_DCIM
;
dirImagePath
+=
"/PictoImages"
;
...
...
@@ -661,6 +668,8 @@ public class EditPictoActivity extends Activity {
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
if
(
mDrawerLayout
.
isDrawerOpen
(
Gravity
.
RIGHT
))
mDrawerLayout
.
closeDrawer
(
Gravity
.
RIGHT
);
finish
();
setResult
(
RESULT_CANCELED
,
getIntent
());
return
true
;
...
...
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