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
1d766745
authored
Sep 03, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bug #559 fixed
parent
34865a02
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
19 deletions
android/Pictogram/.gitignore
android/Pictogram/commonlibrary/.gitignore
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/UserLogin.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
android/Pictogram/tablet/.gitignore
android/Pictogram/tablet/build.gradle
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/LoginActivity.java
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/MainActivity.java
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/PictogramActivity.java
android/Pictogram/.gitignore
View file @
1d766745
...
...
@@ -58,3 +58,5 @@ src/main/resources/
gen/
/Pictogram.iml
/.gitignore
android/Pictogram/commonlibrary/.gitignore
View file @
1d766745
/build
/commonlibrary.iml
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/UserLogin.java
View file @
1d766745
...
...
@@ -43,14 +43,12 @@ public class UserLogin {
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
public
static
final
String
PREFS_NAME
=
"MyPrefsFile"
;
private
void
manageSupervisorLogin
(
final
String
email
,
final
String
password
,
boolean
online
,
final
Activity
activity
,
final
Class
PictogramActivity
,
final
Class
LoginActivity
)
{
if
(
online
)
{
Log
.
i
(
this
.
getClass
().
getCanonicalName
()
,
"Online login request for supervisor "
+
email
);
Log
.
i
(
LOG_TAG
,
"Online login request for supervisor "
+
email
);
final
ProgressDialog
progressDialog
=
ProgressDialog
.
show
(
activity
,
activity
.
getBaseContext
().
getString
(
R
.
string
.
userLoadingTxt
),
activity
.
getBaseContext
().
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
ServerLogin
.
login_supervisor
(
email
,
password
,
new
iRestapiListener
()
{
...
...
@@ -66,7 +64,7 @@ public class UserLogin {
@Override
public
void
result
(
JSONObject
result
)
{
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
String
jsonToken
;
JSONObject
user
;
try
{
...
...
@@ -103,7 +101,7 @@ public class UserLogin {
@Override
public
void
error
(
Exception
e
)
{
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Login fail:"
+
e
.
getMessage
()+
" ("
+
e
.
getClass
().
getCanonicalName
()+
")"
);
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
if
(
e
instanceof
LoginException
)
if
(((
LoginException
)
e
).
login_failed
())
GUITools
.
show_alert
(
activity
,
R
.
string
.
loginErrorMsg
);
...
...
@@ -169,7 +167,7 @@ public class UserLogin {
@Override
public
void
result
(
JSONObject
result
)
{
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
try
{
JSONObject
user
=
result
.
getJSONObject
(
TAG_USER
);
...
...
@@ -196,13 +194,13 @@ public class UserLogin {
}
catch
(
JSONException
e
)
{
GUITools
.
show_alert
(
activity
,
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"JSON:"
+
e
.
getLocalizedMessage
());
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
}
}
@Override
public
void
error
(
Exception
e
)
{
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
if
(
e
instanceof
LoginException
)
if
(((
LoginException
)
e
).
login_failed
())
GUITools
.
show_alert
(
activity
,
R
.
string
.
loginErrorMsg
);
...
...
@@ -235,7 +233,7 @@ public class UserLogin {
@Override
public
void
loadComplete
()
{
PCBcontext
.
getDevice
().
insertUser
(
student
);
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
activity
.
startActivity
(
pictogramActivity
);
}
...
...
@@ -245,7 +243,7 @@ public class UserLogin {
@Override
public
void
error
(
Exception
e
)
{
progressDialog
.
dismiss
();
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
activity
,
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
...
...
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/tools/PCBcontext.java
View file @
1d766745
...
...
@@ -174,7 +174,7 @@ public final class PCBcontext {
public
static
Vocabulary
getVocabulary
(){
if
(
vocabulary
==
null
)
{
throw
new
java
.
lang
.
NullPointerException
(
"Vocabulary is null. PCBcontext.set_user"
+
"must be invoked previously"
);
"
must be invoked previously"
);
}
return
vocabulary
;
}
...
...
@@ -186,7 +186,7 @@ public final class PCBcontext {
public
static
ActionLog
getActionLog
(){
if
(
actionLog
==
null
)
{
throw
new
java
.
lang
.
NullPointerException
(
"ActionLog is null. PCBcontext.set_user"
+
"must be invoked previously"
);
"
must be invoked previously"
);
}
return
actionLog
;
}
...
...
android/Pictogram/tablet/.gitignore
View file @
1d766745
/build
/tablet.iml
android/Pictogram/tablet/build.gradle
View file @
1d766745
...
...
@@ -28,7 +28,7 @@ android {
resValue
"string"
,
"server"
,
"https://dev.yottacode.com"
}
DefaultFlavor
{
resValue
"string"
,
"server"
,
"https://
dev
.yottacode.com"
resValue
"string"
,
"server"
,
"https://
ci
.yottacode.com"
}
}
}
...
...
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/LoginActivity.java
View file @
1d766745
...
...
@@ -97,9 +97,10 @@ public class LoginActivity extends FragmentActivity {
downloader
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
imgs
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
Log
.
i
(
LOG_TAG
,
"Closing app"
);
PCBcontext
.
getNetService
().
closeNotifyStatus
();
}
}
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/MainActivity.java
View file @
1d766745
...
...
@@ -36,6 +36,7 @@ public class MainActivity extends Activity {
@Override
protected
void
onStop
()
{
super
.
onStop
();
Log
.
i
(
LOG_TAG
,
"Closing app"
);
PCBcontext
.
getNetService
().
closeNotifyStatus
();
}
...
...
android/Pictogram/tablet/src/main/java/com/yottacode/pictogram/tablet/gui/PictogramActivity.java
View file @
1d766745
...
...
@@ -100,6 +100,11 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
this
.
mainLayout
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
pictogramLayout
);
this
.
currentCategory
=
null
;
this
.
count_deletelong
=
0
;
if
(!
PCBcontext
.
is_user_logged
())
{
Log
.
i
(
LOG_TAG
,
"No user logged. Restarting app"
);
PCBcontext
.
getNetService
().
restart_app
();
return
;
}
this
.
vocabulary
=
PCBcontext
.
getVocabulary
();
this
.
vocabulary
.
listen
(
PCBcontext
.
getRoom
(),
this
);
...
...
@@ -183,7 +188,12 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tts
.
setLanguage
(
Locale
.
getDefault
());
}
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
Log
.
i
(
LOG_TAG
,
"Closing app"
);
PCBcontext
.
getNetService
().
closeNotifyStatus
();
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
...
...
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