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
ebde1051
authored
Mar 30, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on serial/login/pictogram activity refactorization (v)
parent
3f51c451
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
79 deletions
android/Pictogram/app/build.gradle
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SerialActivity.java
android/Pictogram/app/src/main/res/values-en/strings.xml
android/Pictogram/app/src/main/res/values-es/strings.xml
android/Pictogram/app/src/main/res/values/strings.xml
android/Pictogram/app/build.gradle
View file @
ebde1051
...
...
@@ -31,7 +31,7 @@ android {
debug
{
resValue
"string"
,
"db_name"
,
"PCB.db"
resValue
"bool"
,
"force_db_create"
,
"
tru
e"
resValue
"bool"
,
"force_db_create"
,
"
fals
e"
resValue
"bool"
,
"ssl_connect"
,
"false"
resValue
"bool"
,
"force_img_download"
,
"false"
resValue
"integer"
,
"netservice_timing"
,
"20"
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
View file @
ebde1051
...
...
@@ -62,6 +62,22 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
private
String
username
=
null
;
private
String
password
=
null
;
private
void
show_login_failed
(
int
msg
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
LoginActivity
.
this
);
builder
.
setMessage
(
getString
(
msg
))
.
setCancelable
(
false
)
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
private
void
load_offline_supervisor
(
String
username
,
String
password
)
{
}
/**
* If there is Internet connection it calls the WS to recover the pairs student-supervisor
* @param savedInstanceState
...
...
@@ -78,40 +94,6 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
if
(
offline
){
username
=
intent
.
getStringExtra
(
"username"
);
password
=
intent
.
getStringExtra
(
"password"
);
}
// Activo el modo KIOSKO
//startLockTask();
//DevicePolicyManager myDevicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
//ComponentName mDeviceAdminSample = new ComponentName(this, LoginActivity.class);
/*
if (myDevicePolicyManager.isDeviceOwnerApp(this.getPackageName())) {
// Device owner
String[] packages = {this.getPackageName()};
myDevicePolicyManager.setLockTaskPackages(mDeviceAdminSample, packages);
} else {
// Not a device owner - prompt user or show error
}
*/
//String[] packages = {this.getPackageName()};
//myDevicePolicyManager.setLockTaskPackages(mDeviceAdminSample, packages);
/*
if (myDevicePolicyManager.isLockTaskPermitted(this.getPackageName())) {
// Lock allowed
startLockTask();
} else {
// Lock not allowed - show error or something useful here
}
*/
//startLockTask();
// FIN del modo Kiosko
// Compruebo si tengo acceso a internet y al servicio web
if
(!
RestapiWrapper
.
ping
(
getResources
().
getString
(
R
.
string
.
server
),
"server/ping"
))
{
// MODO OFFLINE
try
{
Log
.
d
(
LOG_TAG
,
"username utilizado:"
+
username
);
Log
.
d
(
LOG_TAG
,
"password utilizado:"
+
password
);
...
...
@@ -147,47 +129,9 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener{
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
LoginException
e
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
LoginActivity
.
this
);
if
(
e
.
known_supervisor
()){
// El password del supervisor no es correcto
builder
.
setMessage
(
"La contraseña indicada no es correcta. Inténtelo de nuevo."
)
.
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
()){
// Este supervisor existe pero no tiene estudiantes
builder
.
setMessage
(
"El usuario indicado no tiene alumnos asignados. Asigne estudiantes desde el panel de control."
)
.
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
{
// El supervisor indicado no existe
builder
.
setMessage
(
"El usuario indicado no es correcto. Inténtelo de nuevo."
)
.
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
();
show_login_failed
(
e
.
known_supervisor
()
?
R
.
string
.
passErrorMsg
:
e
.
no_students
()
?
R
.
string
.
noStudentsError
:
R
.
string
.
userErrorMsg
);
}
}
else
{
// Modo ONLINE
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SerialActivity.java
View file @
ebde1051
This diff is collapsed.
Click to expand it.
android/Pictogram/app/src/main/res/values-en/strings.xml
View file @
ebde1051
...
...
@@ -22,7 +22,7 @@
<string
name=
"userErrorMsg"
>
The user is not correct. Try again.
</string>
<string
name=
"userLoadingTxt"
>
Loading
</string>
<string
name=
"userLoadingMsg"
>
Loading students. Please wait.
</string>
<string
name=
"noStudentsError"
>
El usuario indicado no tiene alumnos asignados. Asigne estudiantes desde el panel de control
</string>
<!-- Alert dialogs -->
<string
name=
"exitPictogram"
>
Exit Pictogram
</string>
<string
name=
"enterEscapeCode"
>
Type escape code
</string>
...
...
android/Pictogram/app/src/main/res/values-es/strings.xml
View file @
ebde1051
...
...
@@ -23,7 +23,7 @@
<string
name=
"userErrorMsg"
>
El usuario indicado no es correcto. Inténtelo de nuevo.
</string>
<string
name=
"userLoadingTxt"
>
Cargando
</string>
<string
name=
"userLoadingMsg"
>
Cargando alumnos. Por favor espere.
</string>
<string
name=
"noStudentsError"
>
El usuario indicado no tiene alumnos asignados. Asigne estudiantes desde el panel de control
</string>
<!-- Alert dialogs -->
<string
name=
"exitPictogram"
>
Salir de Pictogram
</string>
...
...
android/Pictogram/app/src/main/res/values/strings.xml
View file @
ebde1051
...
...
@@ -11,7 +11,7 @@
<string
name=
"title_activity_splash_screen"
>
SplashScreenActivity
</string>
<!-- Strings de serial -->
<!-- Strings de serial
y login activity
-->
<string
name=
"title_activity_serial"
>
Indique los datos de acceso
</string>
<string
name=
"prompt_serial_mail"
>
Usuario
</string>
<string
name=
"prompt_serial_pass"
>
Contraseña
</string>
...
...
@@ -23,6 +23,7 @@
<string
name=
"userErrorMsg"
>
El usuario indicado no es correcto. Inténtelo de nuevo.
</string>
<string
name=
"userLoadingTxt"
>
Cargando
</string>
<string
name=
"userLoadingMsg"
>
Cargando alumnos. Por favor espere.
</string>
<string
name=
"noStudentsError"
>
El usuario indicado no tiene alumnos asignados. Asigne estudiantes desde el panel de control
</string>
<!-- Alert dialogs -->
<string
name=
"exitPictogram"
>
Salir de Pictogram
</string>
...
...
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