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
7ac44499
authored
Mar 25, 2016
by
Miguel Ángel García Cumbreras
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Modificaciones para el modo OFFLINE
parent
afbb66b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
View file @
7ac44499
...
...
@@ -114,8 +114,8 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
if
(!
RestapiWrapper
.
ping
(
getResources
().
getString
(
R
.
string
.
server
),
"server/ping"
,
this
))
{
// MODO OFFLINE
try
{
Log
.
d
(
LOG_TAG
,
"username
guard
ado:"
+
username
);
Log
.
d
(
LOG_TAG
,
"password
guard
ado:"
+
password
);
Log
.
d
(
LOG_TAG
,
"username
utiliz
ado:"
+
username
);
Log
.
d
(
LOG_TAG
,
"password
utiliz
ado:"
+
password
);
Vector
<
User
>
localUsers
=
PCBcontext
.
getDevice
().
findUser
(
username
,
password
);
// Si sólo hay 1 estudiante, cargo el st_id
...
...
@@ -155,6 +155,10 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
.
setCancelable
(
false
)
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
// Vuelvo al serial para que se identifique
Intent
serialActivity
=
new
Intent
(
LoginActivity
.
this
,
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"activity_name"
,
"SerialActivity"
);
startActivity
(
serialActivity
);
}
});
}
else
if
(
e
.
no_students
()){
...
...
@@ -163,6 +167,10 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
.
setCancelable
(
false
)
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
// Vuelvo al serial para que se identifique
Intent
serialActivity
=
new
Intent
(
LoginActivity
.
this
,
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"activity_name"
,
"SerialActivity"
);
startActivity
(
serialActivity
);
}
});
}
else
{
...
...
@@ -171,9 +179,15 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
.
setCancelable
(
false
)
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
// Vuelvo al serial para que se identifique
Intent
serialActivity
=
new
Intent
(
LoginActivity
.
this
,
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"activity_name"
,
"SerialActivity"
);
startActivity
(
serialActivity
);
}
});
}
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
e
.
printStackTrace
();
}
}
else
{
...
...
@@ -247,6 +261,7 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
// Añado un par <student-supervisor>
int
st_id_int
=
st_id
.
intValue
();
int
st_supervision_int
=
st_supervision
.
intValue
();
// Si es terapeuta lo añado directamente
if
(
st_supervision_int
==
2
){
student
=
new
User
(
st_id_int
,
"nickname_stu"
,
"pwd_stu"
,
st_name
,
st_surname
,
st_pic
,
st_gender
,
st_lang
,
st_attributes
,
sup_id
,
username
,
password
,
""
,
""
,
""
,
"M"
,
"es-es"
,
""
);
...
...
@@ -260,7 +275,6 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
if
(
users
.
size
()
==
1
){
//User student = PCBcontext.getDevice().findUser(st_id_int, sup_id);
PCBcontext
.
set_user
(
student
,
token
,
null
);
// no hay que hacer nada cuando termine
}
else
{
student
=
new
User
(-
1
,
"nickname_stu"
,
"pwd_stu"
,
""
,
""
,
""
,
"M"
,
"es-es"
,
""
,
sup_id
,
username
,
password
,
""
,
""
,
""
,
"M"
,
"es-es"
,
""
);
...
...
@@ -285,13 +299,13 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
if
(
users
.
size
()
>
0
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
String
currentDateandTime
=
sdf
.
format
(
new
Date
());
Log
.
d
(
LOG_TAG
,
"Entro en synchronizeUsers en "
+
currentDateandTime
);
//
Log.d(LOG_TAG, "Entro en synchronizeUsers en " + currentDateandTime);
PCBcontext
.
getDevice
().
synchronizeUsers
(
users
,
new
iImgDownloaderListener
()
{
@Override
public
void
loadComplete
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
String
currentDateandTime
=
sdf
.
format
(
new
Date
());
Log
.
d
(
LOG_TAG
,
"LoadComplete en "
+
currentDateandTime
);
//
Log.d(LOG_TAG, "LoadComplete en " + currentDateandTime);
Vector
<
User
>
users
=
null
;
try
{
users
=
PCBcontext
.
getDevice
().
getUsers
();
...
...
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