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
558087b7
authored
Aug 23, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
tablet licenses on supervisor's student list
parent
e15898d1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
99 deletions
android/Pictogram/commonlibrary/src/main/res/values/colors.xml
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/StudentFragmentGrid.java
android/Pictogram/tabletlibrary/src/main/res/layout/list_single.xml
android/Pictogram/tabletlibrary/tabletlibrary.iml
android/Pictogram/commonlibrary/src/main/res/values/colors.xml
View file @
558087b7
...
...
@@ -15,6 +15,11 @@
<item
name=
"darkorange"
type=
"color"
>
#FFFF8800
</item>
<item
name=
"darkred"
type=
"color"
>
#cc0000
</item>
<!-- Main Pictogram Web Colors -->
<item
name=
"text_primary"
type=
"color"
>
#428bca
</item>
<item
name=
"text_warning"
type=
"color"
>
#8a6d3b
</item>
<item
name=
"text_danger"
type=
"color"
>
#a94442
</item>
<integer-array
name=
"androidcolors"
>
<item>
@color/blue
</item>
<item>
@color/purple
</item>
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
View file @
558087b7
...
...
@@ -7,6 +7,7 @@ import android.graphics.Color;
import
android.graphics.Typeface
;
import
android.provider.ContactsContract
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -64,22 +65,24 @@ public class CustomList extends ArrayAdapter<String>{
// Name
TextView
txtTitle
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentName
);
// License
// License
, except add student view
TextView
licenseView
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentLicense
);
switch
(
licenses
[
position
])
{
case
"pro"
:
if
(!
name_surname
[
position
].
equals
(
getContext
().
getString
(
R
.
string
.
addStudent
))){
if
(
licenses
[
position
].
equals
(
"pro"
))
{
licenseView
.
setText
(
fa_certificate
);
break
;
case
"b"
:
licenseView
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
text_primary
))
;
}
else
if
(
licenses
[
position
].
equals
(
"trial"
))
{
licenseView
.
setText
(
fa_flask
);
break
;
default
:
licenseView
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
text_warning
))
;
}
else
{
licenseView
.
setText
(
fa_exclamation_triangle
);
licenseView
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
text_danger
));
}
Typeface
font
=
Typeface
.
createFromAsset
(
getContext
().
getAssets
(),
"fonts/fontawesome-webfont.ttf"
);
licenseView
.
setTypeface
(
font
);
}
// Image
ImageView
imageView
=
(
ImageView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentPhoto
);
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/StudentFragmentGrid.java
View file @
558087b7
...
...
@@ -36,11 +36,12 @@ import java.util.Vector;
/**
* StudentFragmentGrid implements the gridview with the students
*
* @author Miguel Ángel García Cumbreras
* @author Fernando
* @version 1.1
*/
public
class
StudentFragmentGrid
extends
Fragment
{
public
class
StudentFragmentGrid
extends
Fragment
{
final
String
TAG_ID
=
"id"
;
final
String
TAG_USERNAME
=
"username"
;
...
...
@@ -51,18 +52,23 @@ public class StudentFragmentGrid extends Fragment{
final
String
TAG_PIC
=
"pic"
;
final
String
TAG_LANG
=
"lang"
;
final
String
TAG_ATTRIBUTES
=
"attributes"
;
ProgressDialog
progressDialog
;
Vector
<
Integer
>
idStudents
;
String
nameStudents
[];
Vector
<
Bitmap
>
imageStudents
;
String
licenseStudents
[];
private
Vector
<
JSONObject
>
downloaded_students
;
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
GridView
gridView
;
boolean
onlineStudentsOK
=
false
;
boolean
onlineStudentsOK
=
false
;
private
void
showStudentsGrid
(){
CustomList
adapter
=
new
CustomList
(
getActivity
(),
nameStudents
,
imageStudents
);
/**
* Show students grid
*/
private
void
showStudentsGrid
()
{
CustomList
adapter
=
new
CustomList
(
getActivity
(),
nameStudents
,
imageStudents
,
licenseStudents
);
gridView
.
setAdapter
(
adapter
);
gridView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
...
...
@@ -71,12 +77,17 @@ public class StudentFragmentGrid extends Fragment{
}
});
}
/**
* Set current user
* @param i Position of student in students name array (nameStudents)
*/
private
void
set_user
(
int
i
)
{
Boolean
offline
=
getActivity
().
getIntent
().
getBooleanExtra
(
"offline"
,
false
);
if
(
offline
)
{
User
currentUser
=
null
;
User
currentUser
=
null
;
try
{
currentUser
=
PCBcontext
.
getDevice
().
findUser
(
idStudents
.
get
(
i
),
getActivity
().
getIntent
().
getIntExtra
(
"sup_id"
,
0
));
currentUser
=
PCBcontext
.
getDevice
().
findUser
(
idStudents
.
get
(
i
),
getActivity
().
getIntent
().
getIntExtra
(
"sup_id"
,
0
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
...
...
@@ -93,7 +104,12 @@ public class StudentFragmentGrid extends Fragment{
}
}
}
private
void
register_student
(
final
int
sup_id
)
{
/**
* Register a new student using his license
* @param sup_id Supervisor id
*/
private
void
register_student
(
final
int
sup_id
)
{
AlertDialog
.
Builder
alert
=
new
AlertDialog
.
Builder
(
this
.
getActivity
());
final
EditText
edittext
=
new
EditText
(
this
.
getActivity
());
alert
.
setMessage
(
getString
(
R
.
string
.
getLicenseStudent
));
...
...
@@ -104,25 +120,28 @@ private void register_student(final int sup_id) {
alert
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
whichButton
)
{
//What ever you want to do with the value
String
license
=
edittext
.
getText
().
toString
().
replaceAll
(
"[^a-zA-Z0-9]"
,
""
).
toUpperCase
();
String
license
=
edittext
.
getText
().
toString
().
replaceAll
(
"[^a-zA-Z0-9]"
,
""
).
toUpperCase
();
RestapiWrapper
wrapper
=
PCBcontext
.
getRestapiWrapper
();
String
operation
=
"stu/license/sup/"
+
sup_id
;
Hashtable
<
String
,
String
>
params
=
new
Hashtable
<
String
,
String
>(
1
);
params
.
put
(
"license"
,
license
);
String
operation
=
"stu/license/sup/"
+
sup_id
;
Hashtable
<
String
,
String
>
params
=
new
Hashtable
<
String
,
String
>(
1
);
params
.
put
(
"license"
,
license
);
wrapper
.
ask
(
operation
,
params
,
"post"
,
new
RestapiWrapper
.
iRestapiListener
()
{
@Override
public
void
error
(
RestapiWrapper
.
HTTPException
e
)
{
Log
.
e
(
this
.
getClass
().
getName
(),
" Server restapi error: "
+
e
.
getLocalizedMessage
());
String
err
=
e
.
getLocalizedMessage
();
if
(
err
.
indexOf
(
"nvalid license"
)
>
0
)
GUITools
.
show_alert
(
getActivity
(),
R
.
string
.
loginNoLicenseMsg
);
if
(
err
.
indexOf
(
"nvalid license"
)
>
0
)
GUITools
.
show_alert
(
getActivity
(),
R
.
string
.
loginNoLicenseMsg
);
}
@Override
public
void
preExecute
()
{
}
@Override
public
void
result
(
JSONArray
result
)
{
}
@Override
public
void
result
(
JSONObject
result
)
{
PCBcontext
.
getNetService
().
restart_app
(
false
);
...
...
@@ -138,13 +157,19 @@ private void register_student(final int sup_id) {
});
alert
.
show
();
}
}
/**
* Change user data, load vocabulary and goes to VOCA Activity
* @param i Position on students downloaded collection
*/
private
void
new_user
(
int
i
)
{
JSONObject
st
=
this
.
downloaded_students
.
get
(
i
);
Intent
intent
=
getActivity
().
getIntent
();
try
{
Log
.
i
(
LOG_TAG
,
st
.
toString
());
Log
.
i
(
LOG_TAG
,
st
.
toString
());
PCBcontext
.
getPcbdb
();
User
new_user
=
new
User
(
st
.
getInt
(
TAG_ID
),
...
...
@@ -166,15 +191,18 @@ private void register_student(final int sup_id) {
intent
.
getStringExtra
(
"gender"
),
intent
.
getStringExtra
(
"lang"
),
""
,
intent
.
getStringExtra
(
"office"
));
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Loading vocabulary for "
+
new_user
.
get_name_stu
()+
" office:"
+
intent
.
getStringExtra
(
"office"
));
intent
.
getStringExtra
(
"office"
)
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Loading vocabulary for "
+
new_user
.
get_name_stu
()
+
" office:"
+
intent
.
getStringExtra
(
"office"
));
PCBcontext
.
getDevice
().
insertUser
(
new_user
);
progressDialog
=
ProgressDialog
.
show
(
getActivity
(),
getString
(
R
.
string
.
loadingGrammar
),
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
progressDialog
=
ProgressDialog
.
show
(
getActivity
(),
getString
(
R
.
string
.
loadingGrammar
),
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
PCBcontext
.
set_user
(
new_user
,
intent
.
getStringExtra
(
"token"
),
new
ImgDownloader
.
iImgDownloaderListener
()
{
@Override
public
void
loadComplete
()
{
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
Intent
pictogramActivity
=
new
Intent
(
getActivity
(),
VOCA
.
class
);
startActivity
(
pictogramActivity
);
}
...
...
@@ -183,10 +211,11 @@ private void register_student(final int sup_id) {
public
void
loadImg
(
Img
image
)
{
}
public
void
error
(
Exception
e
)
{
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
StudentFragmentGrid
.
this
.
getActivity
(),
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
});
...
...
@@ -195,12 +224,18 @@ private void register_student(final int sup_id) {
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
}
/**
* Process JSON into collections
*/
private
void
show_student_list_online
()
{
final
int
listsize
=
downloaded_students
.
size
()+
1
;
final
int
listsize
=
downloaded_students
.
size
()
+
1
;
final
Vector
<
Img
>
imgs
=
new
Vector
<>(
listsize
);
this
.
nameStudents
=
new
String
[
listsize
];
this
.
idStudents
=
new
Vector
<>(
listsize
);
this
.
imageStudents
=
new
Vector
<>(
listsize
);
this
.
nameStudents
=
new
String
[
listsize
];
this
.
idStudents
=
new
Vector
<>(
listsize
);
this
.
imageStudents
=
new
Vector
<>(
listsize
);
this
.
licenseStudents
=
new
String
[
listsize
];
for
(
int
i
=
0
;
i
<
downloaded_students
.
size
();
i
++)
{
JSONObject
st
;
...
...
@@ -210,35 +245,46 @@ private void register_student(final int sup_id) {
String
st_name
=
st
.
getString
(
TAG_NAME
);
String
st_pic
=
st
.
getString
(
TAG_PIC
);
nameStudents
[
i
]
=
st_name
;
nameStudents
[
i
]
=
st_name
;
idStudents
.
add
(
st_id
);
imgs
.
add
(
new
Img
(
st_id
,
st_pic
,
Img
.
STUDENT
));
//it's required to download student's images
imgs
.
add
(
new
Img
(
st_id
,
st_pic
,
Img
.
STUDENT
));
//it's required to download student's images
// Checks if license is trial or pro (not expired)
if
(!
st
.
getJSONObject
(
"license"
).
getBoolean
(
"isValid"
))
licenseStudents
[
i
]
=
"expired"
;
else
if
(
st
.
getJSONObject
(
"license"
).
getBoolean
(
"isTrial"
))
licenseStudents
[
i
]
=
"trial"
;
else
if
(
st
.
getJSONObject
(
"license"
).
getBoolean
(
"isOfficial"
))
licenseStudents
[
i
]
=
"pro"
;
Log
.
i
(
"Test"
,
licenseStudents
[
i
]);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
}
//for
nameStudents
[
listsize
-
1
]=
getString
(
R
.
string
.
addStudent
);
nameStudents
[
listsize
-
1
]
=
getString
(
R
.
string
.
addStudent
);
idStudents
.
add
(-
1
);
imgs
.
add
(
new
Img
(-
1
,
null
,
Img
.
STUDENT
));
//it's required to download student's images
licenseStudents
[
listsize
-
1
]
=
"pro"
;
imgs
.
add
(
new
Img
(-
1
,
null
,
Img
.
STUDENT
));
//it's required to download student's images
ImgDownloader
downloader
=
new
ImgDownloader
(
getActivity
(),
new
ImgDownloader
.
iImgDownloaderListener
()
{
private
void
loaded
()
{
try
{
if
(
downloaded_students
.
size
()
>=
1
)
for
(
int
i
=
0
;
i
<
imgs
.
size
();
i
++)
imageStudents
.
add
(
imgs
.
get
(
i
).
get_bitmap
(
getActivity
().
getBaseContext
()));
imageStudents
.
add
(
imgs
.
get
(
listsize
-
1
).
get_bitmap
(
getActivity
().
getBaseContext
()));
imageStudents
.
add
(
imgs
.
get
(
listsize
-
1
).
get_bitmap
(
getActivity
().
getBaseContext
()));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
if
(
StudentFragmentGrid
.
super
.
getView
()
!=
null
)
if
(
StudentFragmentGrid
.
super
.
getView
()
!=
null
)
showStudentsGrid
();
else
onlineStudentsOK
=
true
;
onlineStudentsOK
=
true
;
}
@Override
public
void
loadComplete
()
{
loaded
();
...
...
@@ -248,10 +294,11 @@ private void register_student(final int sup_id) {
public
void
loadImg
(
Img
image
)
{
loaded
();
}
public
void
error
(
Exception
e
)
{
if
(
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
PCBcontext
.
getContext
(),
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
},
ImgDownloader
.
tsource
.
remote
);
downloader
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
imgs
);
...
...
@@ -259,8 +306,9 @@ private void register_student(final int sup_id) {
/**
* Recupera los supervisores de un alumno
*
@author Germán Callejas
*
* @param stu_id
* @author Germán Callejas
*/
private
void
download_supervisors
(
final
int
stu_id
)
{
String
token
=
getActivity
().
getIntent
().
getExtras
().
getString
(
"token"
);
...
...
@@ -279,22 +327,24 @@ private void register_student(final int sup_id) {
}
});
}
@Override
public
void
preExecute
()
{
}
@Override
public
void
result
(
JSONArray
supervisors
)
{
Vector
<
String
>
idSupervisoresJSON
=
new
Vector
<>();
for
(
int
i
=
0
;
i
<
supervisors
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
supervisors
.
length
();
i
++)
{
JSONObject
supervisor
=
null
;
try
{
supervisor
=
supervisors
.
getJSONObject
(
i
);
idSupervisoresJSON
.
add
(
supervisor
.
getString
(
"email"
));
if
(!
PCBcontext
.
getDevice
().
isSupervisorOnLocal
((
int
)
supervisor
.
get
(
"id"
),
stu_id
))
{
//Para comprobar si ya existe en local
if
(!
PCBcontext
.
getDevice
().
isSupervisorOnLocal
((
int
)
supervisor
.
get
(
"id"
),
stu_id
))
{
//Para comprobar si ya existe en local
User
currentUser
=
PCBcontext
.
getPcbdb
().
getCurrentUser
();
PCBcontext
.
getDevice
().
insertUser
(
new
User
(
stu_id
,
currentUser
.
get_nickname_stu
(),
currentUser
.
get_pwd_stu
()
,
currentUser
.
get_name_stu
(),
currentUser
.
get_surname_stu
(),
currentUser
.
get_active_scene
(),
currentUser
.
get_url_img_stu
()
,
currentUser
.
get_name_stu
(),
currentUser
.
get_surname_stu
(),
currentUser
.
get_active_scene
(),
currentUser
.
get_url_img_stu
()
,
currentUser
.
get_gender_stu
(),
currentUser
.
get_lang_stu
(),
currentUser
.
get_json_attrs
(),
(
int
)
supervisor
.
get
(
"id"
),
supervisor
.
get
(
"email"
).
toString
(),
"_"
,
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
()));
...
...
@@ -306,12 +356,12 @@ private void register_student(final int sup_id) {
/**Eliminar los que habia y que ya no vienen en el JSON */
try
{
Hashtable
<
String
,
String
>
supervisorsLocal
=
PCBcontext
.
getDevice
().
recoverSupervisors
(
stu_id
);
if
(
supervisorsLocal
!=
null
&&
!
supervisorsLocal
.
isEmpty
())
{
for
(
String
email_sup:
supervisorsLocal
.
keySet
())
{
if
(!
idSupervisoresJSON
.
contains
(
email_sup
))
{
Hashtable
<
String
,
String
>
supervisorsLocal
=
PCBcontext
.
getDevice
().
recoverSupervisors
(
stu_id
);
if
(
supervisorsLocal
!=
null
&&
!
supervisorsLocal
.
isEmpty
())
{
for
(
String
email_sup
:
supervisorsLocal
.
keySet
())
{
if
(!
idSupervisoresJSON
.
contains
(
email_sup
))
{
//Coge la segunda parte ya que el formato del dato es Nombre, Apellidos;id_sup
PCBcontext
.
getDevice
().
deleteSupervisor
(
stu_id
,
Integer
.
parseInt
(
supervisorsLocal
.
get
(
email_sup
).
split
(
";"
)[
1
]));
PCBcontext
.
getDevice
().
deleteSupervisor
(
stu_id
,
Integer
.
parseInt
(
supervisorsLocal
.
get
(
email_sup
).
split
(
";"
)[
1
]));
}
}
}
...
...
@@ -328,12 +378,18 @@ private void register_student(final int sup_id) {
});
}
private
void
download_students
(
final
int
sup_id
)
{
/**
* Download students from supervisor into downloaded_students
* @param sup_id Supervisor id
*/
private
void
download_students
(
final
int
sup_id
)
{
String
token
=
getActivity
().
getIntent
().
getExtras
().
getString
(
"token"
);
RestapiWrapper
wrapper
=
PCBcontext
.
getRestapiWrapper
();
wrapper
.
setToken
(
token
);
String
operation
=
"sup/"
+
sup_id
+
"/students"
;
wrapper
.
ask
(
operation
,
new
RestapiWrapper
.
iRestapiListener
()
{
@Override
public
void
error
(
RestapiWrapper
.
HTTPException
e
)
{
Log
.
e
(
this
.
getClass
().
getName
(),
" Server restapi error: "
+
e
.
getLocalizedMessage
());
...
...
@@ -344,14 +400,16 @@ private void register_student(final int sup_id) {
}
});
}
@Override
public
void
preExecute
()
{
}
@Override
public
void
result
(
JSONArray
students
)
{
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
StudentFragmentGrid
.
this
.
downloaded_students
=
new
Vector
();
for
(
int
i
=
0
;
i
<
students
.
length
();
i
++)
{
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
StudentFragmentGrid
.
this
.
downloaded_students
=
new
Vector
();
for
(
int
i
=
0
;
i
<
students
.
length
();
i
++)
{
JSONObject
student
;
try
{
student
=
students
.
getJSONObject
(
i
);
...
...
@@ -362,14 +420,15 @@ private void register_student(final int sup_id) {
}
show_student_list_online
();
}
@Override
public
void
result
(
JSONObject
result
)
{
}
});
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -379,26 +438,26 @@ private void register_student(final int sup_id) {
@Override
public
void
onStart
()
{
super
.
onStart
();
Intent
intent
=
getActivity
().
getIntent
();
Intent
intent
=
getActivity
().
getIntent
();
Boolean
offline
=
intent
.
getBooleanExtra
(
"offline"
,
false
);
int
sup_id
=
intent
.
getIntExtra
(
"sup_id"
,
0
);
int
sup_id
=
intent
.
getIntExtra
(
"sup_id"
,
0
);
if
(
offline
)
{
Vector
<
User
>
users
;
try
{
users
=
PCBcontext
.
getDevice
().
recoverStudents
(
sup_id
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Recovering "
+
users
.
size
()+
" students list for "
+
sup_id
+
" from local DB"
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Recovering "
+
users
.
size
()
+
" students list for "
+
sup_id
+
" from local DB"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
users
=
null
;
users
=
null
;
}
int
i
=
0
;
this
.
nameStudents
=
new
String
[
users
.
size
()];
this
.
idStudents
=
new
Vector
<>(
users
.
size
());
this
.
imageStudents
=
new
Vector
<>(
users
.
size
());
for
(
User
user:
users
)
{
int
i
=
0
;
this
.
nameStudents
=
new
String
[
users
.
size
()];
this
.
idStudents
=
new
Vector
<>(
users
.
size
());
this
.
imageStudents
=
new
Vector
<>(
users
.
size
());
for
(
User
user
:
users
)
{
this
.
idStudents
.
add
(
user
.
get_id_stu
());
this
.
nameStudents
[
i
++]
=
user
.
get_name_stu
();
this
.
nameStudents
[
i
++]
=
user
.
get_name_stu
();
try
{
this
.
imageStudents
.
add
(
user
.
get_bitmap_stu
(
getActivity
().
getBaseContext
()));
}
catch
(
IOException
e
)
{
...
...
@@ -406,8 +465,7 @@ private void register_student(final int sup_id) {
Log
.
e
(
this
.
getClass
().
getName
(),
" Getting images error: "
+
e
.
getLocalizedMessage
());
}
}
}
else
}
else
download_students
(
sup_id
);
if
(
offline
||
onlineStudentsOK
)
showStudentsGrid
();
...
...
@@ -415,8 +473,7 @@ private void register_student(final int sup_id) {
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_new_student
,
container
,
false
);
gridView
=
(
GridView
)
view
.
findViewById
(
R
.
id
.
loginStudentGridView
);
return
view
;
...
...
@@ -426,7 +483,7 @@ private void register_student(final int sup_id) {
public
void
onPause
()
{
super
.
onPause
();
if
((
progressDialog
!=
null
)
&&
progressDialog
.
isShowing
())
if
((
progressDialog
!=
null
)
&&
progressDialog
.
isShowing
())
progressDialog
.
dismiss
();
progressDialog
=
null
;
}
...
...
android/Pictogram/tabletlibrary/src/main/res/layout/list_single.xml
View file @
558087b7
...
...
@@ -8,8 +8,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginBottom=
"
5
0dp"
android:layout_marginTop=
"
5
0dp"
android:layout_marginBottom=
"
1
0dp"
android:layout_marginTop=
"
1
0dp"
android:orientation=
"vertical"
>
<FrameLayout
...
...
@@ -34,6 +34,7 @@
android:layout_centerHorizontal=
"false"
android:layout_centerVertical=
"true"
android:layout_gravity=
"center"
/>
</FrameLayout>
<LinearLayout
...
...
@@ -45,16 +46,16 @@
android:id=
"@+id/loginStudentLicense"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"1dp"
/>
android:layout_marginRight=
"2dp"
android:layout_marginTop=
"4dp"
android:textAppearance=
"@android:style/TextAppearance.Medium"
/>
<TextView
android:id=
"@+id/loginStudentName"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
match_par
ent"
android:layout_height=
"
50dp
"
android:layout_below=
"@+id/loginStudentPhoto"
android:layout_centerHorizontal=
"false"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
</LinearLayout>
...
...
android/Pictogram/tabletlibrary/tabletlibrary.iml
View file @
558087b7
...
...
@@ -62,13 +62,6 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/rs"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/shaders"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/aidl"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/java"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/assets"
type=
"java-test-resource"
/>
...
...
@@ -76,6 +69,13 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/java"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/aidl"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/java"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/shaders"
isTestSource=
"true"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/annotations"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/blame"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/bundles"
/>
...
...
@@ -121,17 +121,5 @@
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-lite-9.2.1"
level=
"project"
/>
<orderEntry
type=
"module"
module-name=
"commonlibrary"
exported=
""
/>
<orderEntry
type=
"library"
exported=
""
name=
"android-android-24"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"okhttp-ws-2.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"socket.io-client-0.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"okhttp-2.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"support-annotations-23.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"okio-1.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"gson-2.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"engine.io-client-0.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"appcompat-v7-21.0.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"hamcrest-core-1.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"junit-4.12"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"json-20090211"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
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