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
e197815f
authored
Apr 11, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.ujaen.es/yotta/pictogram
into develop
parents
119473be
8687704f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
12 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/PictoUploader.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/StudentFragmentGrid.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Device.java
View file @
e197815f
...
...
@@ -178,6 +178,19 @@ public class Device extends SQLiteOpenHelper {
return
user
;
}
public
Vector
<
User
>
recoverSupervisors
(
Integer
id_stu
)
throws
JSONException
{
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
Vector
<
User
>
users
=
new
Vector
<>();
Cursor
cursor
=
db
.
query
(
"users_detail"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
while
(
cursor
.
moveToNext
())
if
(
cursor
.
getInt
(
0
)
==
id_stu
)
users
.
add
(
new
User
(
cursor
.
getInt
(
0
),
cursor
.
getString
(
1
),
cursor
.
getString
(
2
),
cursor
.
getString
(
3
),
cursor
.
getString
(
4
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
cursor
.
getString
(
7
),
cursor
.
getString
(
8
),
cursor
.
getInt
(
9
),
cursor
.
getString
(
10
),
cursor
.
getString
(
11
),
cursor
.
getString
(
12
),
cursor
.
getString
(
13
),
cursor
.
getString
(
14
),
cursor
.
getString
(
15
),
cursor
.
getString
(
16
),
cursor
.
getString
(
17
),
cursor
.
getString
(
18
)));
cursor
.
close
();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
return
users
;
}
public
Vector
<
User
>
recoverStudents
(
Integer
id_sup
)
throws
JSONException
{
SQLiteDatabase
db
=
this
.
getReadableDatabase
();
Vector
<
User
>
users
=
new
Vector
<>();
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/PictoUploader.java
View file @
e197815f
...
...
@@ -9,6 +9,7 @@ import com.koushikdutta.ion.Response;
import
com.yottacode.net.RestapiWrapper
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.action.VocabularyAction
;
import
com.yottacode.pictogram.dao.Device
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.tools.Img
;
import
com.yottacode.pictogram.tools.PCBcontext
;
...
...
@@ -103,7 +104,7 @@ public class PictoUploader {
boolean
success
;
Response
<
JsonObject
>
response
=
null
;
String
[]
path
=
audioFile
.
getPath
().
split
(
"."
);
String
[]
path
=
audioFile
.
getPath
().
split
(
"
\\
."
);
String
extension
=
path
[
1
];
if
(
extension
!=
"mp3"
)
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
View file @
e197815f
...
...
@@ -57,7 +57,9 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.Vector
;
import
pl.droidsonroids.gif.GifTextView
;
import
static
java
.
lang
.
Thread
.
sleep
;
...
...
@@ -233,27 +235,39 @@ public class EditPictoActivity extends Activity {
ActivityCompat
.
requestPermissions
(
this
,
permissions
,
REQUEST_RECORD_AUDIO_PERMISSION
);
//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
<>();
ArrayList
<
String
>
supervisoresAdapter
=
new
ArrayList
<>();
Vector
<
User
>
supervisores
=
null
;
try
{
supervisores
=
PCBcontext
.
getDevice
().
recoverSupervisors
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
get_id_stu
());
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
if
(
supervisores
!=
null
){
for
(
User
supervisor:
supervisores
){
supervisoresAdapter
.
add
(
supervisor
.
get_name_sup
()+
", "
+
supervisor
.
get_surname_sup
()+
"\n"
+
supervisor
.
get_email_sup
()
);
}
}
//String supervisors = PCBcontext.getPcbdb().getCurrentUser().get_Supervisors();
//Log.i(DEBUG_MESSAGE,"Supervisores: "+ supervisors);
//ArrayList<String> supervisores = new ArrayList<>();
if
(
supervisors
!=
null
)
{
/*
if(supervisors != null) {
String[] separated = supervisors.split(";");
for (String supervisor : separated) {
String[] detalles = supervisor.split(",");
supervisores.add(detalles[0] + "\n" + detalles[1]);
}
}else
Log
.
i
(
DEBUG_MESSAGE
,
"No tiene supervisores..."
);
Log.i(DEBUG_MESSAGE,"No tiene supervisores...");
*/
mAdapter
=
new
ArrayAdapter
<>(
this
,
android
.
R
.
layout
.
simple_list_item_1
,
supervisores
);
mAdapter
=
new
ArrayAdapter
<>(
this
,
android
.
R
.
layout
.
simple_list_item_1
,
supervisores
Adapter
);
mDrawerList
.
setAdapter
(
mAdapter
);
mDrawerLayout
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/StudentFragmentGrid.java
View file @
e197815f
...
...
@@ -203,7 +203,7 @@ public class StudentFragmentGrid extends Fragment{
downloader
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
imgs
);
}
private
void
download_supervisors
(
int
stu_id
)
{
private
void
download_supervisors
(
final
int
stu_id
)
{
String
token
=
getActivity
().
getIntent
().
getExtras
().
getString
(
"token"
);
RestapiWrapper
wrapper
=
PCBcontext
.
getRestapiWrapper
();
...
...
@@ -225,17 +225,20 @@ public class StudentFragmentGrid extends Fragment{
}
@Override
public
void
result
(
JSONArray
supervisors
)
{
String
supervisorsFormat
=
""
;
//String supervisorsFormat = "";
for
(
int
i
=
0
;
i
<
supervisors
.
length
();
i
++)
{
JSONObject
supervisor
;
try
{
supervisor
=
supervisors
.
getJSONObject
(
i
);
supervisorsFormat
+=
supervisor
.
get
(
"name"
)
+
" "
+
supervisor
.
get
(
"surname"
)
+
","
+
supervisor
.
get
(
"email"
)
+
";"
;
//PCBcontext.getDevice().insertUser(new User(stu_id,null,null,null,null,null,null,null,null,(int) supervisor.get("id"),supervisor.get("email").toString(),null,supervisor.get("name").toString(),
// supervisor.get("surname").toString(), supervisor.get("pic").toString(),supervisor.get("gender").toString(),supervisor.get("lang").toString(),supervisor.get("ttsEngine").toString(),supervisor.get("office").toString()));
//supervisorsFormat += supervisor.get("name") +" " + supervisor.get("surname") + "," + supervisor.get("email") + ";";
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
PCBcontext
.
getPcbdb
().
getCurrentUser
().
set_Supervisors
(
supervisorsFormat
);
//
PCBcontext.getPcbdb().getCurrentUser().set_Supervisors(supervisorsFormat);
}
@Override
...
...
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