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
9239a071
authored
Feb 18, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Solucionado problema de primera carga de pictogramas
parent
122e5b31
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
41 deletions
android/Pictogram/app/build.gradle
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/Device.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SerialActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/StudentFragmentGrid.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/ImgDownloader.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/iImgDownloaderListener.java
android/Pictogram/app/src/main/res/layout/activity_pictogram.xml
android/Pictogram/app/build.gradle
View file @
9239a071
apply
plugin:
'com.android.application'
apply
plugin:
'com.android.application'
android
{
android
{
signingConfigs
{
release_config
{
storeFile
file
(
'F:/Users/Fernando/GoogleDrive/tmp/keystore.jks'
)
keyAlias
'default_key'
keyPassword
'danoia'
storePassword
'danoia'
}
}
compileSdkVersion
21
compileSdkVersion
21
buildToolsVersion
"21.1.2"
buildToolsVersion
"21.1.2"
defaultConfig
{
defaultConfig
{
...
@@ -9,6 +17,7 @@ android {
...
@@ -9,6 +17,7 @@ android {
targetSdkVersion
21
targetSdkVersion
21
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
signingConfig
signingConfigs
.
release_config
}
}
buildTypes
{
buildTypes
{
release
{
release
{
...
@@ -44,6 +53,7 @@ android {
...
@@ -44,6 +53,7 @@ android {
}
}
DefaultFlavor
{
DefaultFlavor
{
resValue
"string"
,
"server"
,
"https://pre.yottacode.com:1337"
resValue
"string"
,
"server"
,
"https://pre.yottacode.com:1337"
signingConfig
signingConfigs
.
release_config
}
}
ArturoFlavorNoSSL
{
ArturoFlavorNoSSL
{
resValue
"string"
,
"server"
,
"http://192.168.1.37:1337"
resValue
"string"
,
"server"
,
"http://192.168.1.37:1337"
...
@@ -58,5 +68,5 @@ dependencies {
...
@@ -58,5 +68,5 @@ dependencies {
compile
'com.github.nkzawa:socket.io-client:0.5.0'
compile
'com.github.nkzawa:socket.io-client:0.5.0'
compile
'com.koushikdutta.async:androidasync:2.+'
compile
'com.koushikdutta.async:androidasync:2.+'
compile
'com.android.support:support-v4:21.0.+'
compile
'com.android.support:support-v4:21.0.+'
compile
'com.koushikdutta.ion:ion:2.1.6'
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/Device.java
View file @
9239a071
...
@@ -302,7 +302,7 @@ public class Device extends SQLiteOpenHelper {
...
@@ -302,7 +302,7 @@ public class Device extends SQLiteOpenHelper {
for
(
User
user
:
prev_users
)
for
(
User
user
:
prev_users
)
db
.
execSQL
(
"DELETE FROM users_detail WHERE id_stu="
+
user
.
get_id_stu
()
+
" AND id_sup="
+
user
.
get_id_sup
());
db
.
execSQL
(
"DELETE FROM users_detail WHERE id_stu="
+
user
.
get_id_stu
()
+
" AND id_sup="
+
user
.
get_id_sup
());
ImgDownloader
downloader
=
new
ImgDownloader
(
this
.
context
,
imgListener
);
ImgDownloader
downloader
=
new
ImgDownloader
(
this
.
context
,
imgListener
,
this
.
getClass
().
getSimpleName
()
);
downloader
.
execute
(
imgs
);
downloader
.
execute
(
imgs
);
db
.
close
();
db
.
close
();
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/PCBDBHelper.java
View file @
9239a071
...
@@ -210,7 +210,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
...
@@ -210,7 +210,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
db
.
insert
(
"collection_detail"
,
null
,
values
);
db
.
insert
(
"collection_detail"
,
null
,
values
);
}
}
int
seconds2
=
Calendar
.
getInstance
().
get
(
Calendar
.
SECOND
);
int
seconds2
=
Calendar
.
getInstance
().
get
(
Calendar
.
SECOND
);
Log
.
i
(
this
.
getClass
().
getName
(),
" Local student vocabulary updated, id:"
+
id_stu
+
",
picto
s: "
+
vocabulary
.
size
()
+
" time:"
+(
seconds2
-
seconds1
));
Log
.
i
(
this
.
getClass
().
getName
(),
" Local student vocabulary updated, id:"
+
id_stu
+
",
cat
s: "
+
vocabulary
.
size
()
+
" time:"
+(
seconds2
-
seconds1
));
db
.
close
();
db
.
close
();
}
}
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
9239a071
...
@@ -54,7 +54,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
...
@@ -54,7 +54,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
try
{
try
{
Log
.
i
(
this
.
getClass
().
getName
(),
"local vocabulary"
);
Log
.
i
(
this
.
getClass
().
getName
(),
"local vocabulary"
);
PCBcontext
.
getPcbdb
().
getStudentVocabulary
(
this
);
PCBcontext
.
getPcbdb
().
getStudentVocabulary
(
this
);
listener
.
loadComplete
();
listener
.
loadComplete
(
this
.
getClass
().
getSimpleName
()
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
Log
.
e
(
this
.
getClass
().
getName
(),
"Local vocabulary recover failed: "
+
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getName
(),
"Local vocabulary recover failed: "
+
e
.
getMessage
());
}
}
...
@@ -102,7 +102,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
...
@@ -102,7 +102,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
imgs
.
add
(
new
Img
(
picto
.
get_id
(),
picto
.
get_url
(),
Img
.
VOCABULARY
));
imgs
.
add
(
new
Img
(
picto
.
get_id
(),
picto
.
get_url
(),
Img
.
VOCABULARY
));
}
}
ImgDownloader
downloader
=
new
ImgDownloader
(
PCBcontext
.
getContext
(),
imgListener
);
ImgDownloader
downloader
=
new
ImgDownloader
(
PCBcontext
.
getContext
(),
imgListener
,
this
.
getClass
().
getSimpleName
()
);
downloader
.
execute
(
imgs
);
downloader
.
execute
(
imgs
);
PCBcontext
.
getPcbdb
().
setStudentVocabulary
(
this
);
PCBcontext
.
getPcbdb
().
setStudentVocabulary
(
this
);
}
}
...
@@ -116,7 +116,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
...
@@ -116,7 +116,7 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
Vector
<
Img
>
imgs
=
new
Vector
<
Img
>(
1
);
Vector
<
Img
>
imgs
=
new
Vector
<
Img
>(
1
);
imgs
.
add
(
new
Img
(
pic
.
get_id
(),
pic
.
get_url
(),
Img
.
VOCABULARY
));
imgs
.
add
(
new
Img
(
pic
.
get_id
(),
pic
.
get_url
(),
Img
.
VOCABULARY
));
ImgDownloader
downloader
=
new
ImgDownloader
(
PCBcontext
.
getContext
(),
imgListener
);
ImgDownloader
downloader
=
new
ImgDownloader
(
PCBcontext
.
getContext
(),
imgListener
,
this
.
getClass
().
getSimpleName
()
);
downloader
.
execute
(
imgs
);
downloader
.
execute
(
imgs
);
loadPicto
(
pic
);
loadPicto
(
pic
);
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
View file @
9239a071
...
@@ -255,8 +255,8 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
...
@@ -255,8 +255,8 @@ public class LoginActivity extends FragmentActivity implements iRestapiListener,
}
}
@Override
@Override
public
void
loadComplete
()
{
public
void
loadComplete
(
String
name
)
{
Log
.
d
(
LOG_TAG
,
"
Load images
complete"
);
Log
.
d
(
LOG_TAG
,
"
Images: Load images "
+
name
+
"
complete"
);
try
{
try
{
// Aquí filtro si sólo tiene un único usuario o varios
// Aquí filtro si sólo tiene un único usuario o varios
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
View file @
9239a071
...
@@ -183,7 +183,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
...
@@ -183,7 +183,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
*/
*/
final
GridView
panelGridView
=
(
GridView
)
findViewById
(
R
.
id
.
panel_grid_view
);
final
GridView
panelGridView
=
(
GridView
)
findViewById
(
R
.
id
.
panel_grid_view
);
final
ImageButton
deleteButton
=
(
ImageButton
)
findViewById
(
R
.
id
.
button_delete
);
//final ImageButton deleteButton = (ImageButton) findViewById(R.id
.button_delete);
//final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all);
//final Button deleteAllButton = (Button) findViewById(R.id.button_delete_all);
final
ImageButton
ttsButton
=
(
ImageButton
)
findViewById
(
R
.
id
.
button_tts
);
final
ImageButton
ttsButton
=
(
ImageButton
)
findViewById
(
R
.
id
.
button_tts
);
...
@@ -363,7 +363,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
...
@@ -363,7 +363,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
}
}
});
});
/
/
onClick deleteButton (eliminar del tape el último picto)
/
*
onClick deleteButton (eliminar del tape el último picto)
deleteButton.setOnClickListener(new View.OnClickListener() {
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
@Override
public void onClick(View arg0) {
public void onClick(View arg0) {
...
@@ -398,7 +398,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
...
@@ -398,7 +398,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
return false;
return false;
}
}
});
});
*/
}
}
@Override
@Override
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SerialActivity.java
View file @
9239a071
...
@@ -278,7 +278,7 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
...
@@ -278,7 +278,7 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
//User student = PCBcontext.getDevice().findUser(st_id_int, -1);
//User student = PCBcontext.getDevice().findUser(st_id_int, -1);
//Log.d(LOG_TAG, "student id:" + student.get_id_stu());
//Log.d(LOG_TAG, "student id:" + student.get_id_stu());
PCBcontext
.
set_user
(
student
,
jsonToken
,
null
);
PCBcontext
.
set_user
(
student
,
jsonToken
,
this
);
PCBcontext
.
getDevice
().
synchronizeUsers
(
users
,
this
);
PCBcontext
.
getDevice
().
synchronizeUsers
(
users
,
this
);
PCBcontext
.
getDevice
().
deleteDeprecatedImgs
();
PCBcontext
.
getDevice
().
deleteDeprecatedImgs
();
...
@@ -329,20 +329,21 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
...
@@ -329,20 +329,21 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
}
}
@Override
@Override
public
void
loadComplete
()
{
public
void
loadComplete
(
String
collection
)
{
Log
.
d
(
LOG_TAG
,
"Load images complete"
);
Log
.
d
(
LOG_TAG
,
"Images: load "
+
collection
+
" images collection complete."
+
" Waiting for "
+
com
.
yottacode
.
pictogram
.
grammar
.
Vocabulary
.
class
.
getSimpleName
()+
" collection"
);
if
(
collection
.
equalsIgnoreCase
(
com
.
yottacode
.
pictogram
.
grammar
.
Vocabulary
.
class
.
getSimpleName
()))
{
/*
/*
User student = PCBcontext.getDevice().findUser(st_id, -1);
User student = PCBcontext.getDevice().findUser(st_id, -1);
Log.d(LOG_TAG, "student:" + student.get_name_stu());
Log.d(LOG_TAG, "student:" + student.get_name_stu());
PCBcontext.set_user(student, jsonToken, null);
PCBcontext.set_user(student, jsonToken, null);
*/
*/
//close the progress dialog
//close the progress dialog
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
// Entro directamente a Pictogram con ese alumno
// Entro directamente a Pictogram con ese alumno
Intent
pictogramActivity
=
new
Intent
(
this
,
PictogramActivity
.
class
);
Intent
pictogramActivity
=
new
Intent
(
this
,
PictogramActivity
.
class
);
startActivity
(
pictogramActivity
);
startActivity
(
pictogramActivity
);
}
}
}
@Override
@Override
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/StudentFragmentGrid.java
View file @
9239a071
...
@@ -141,7 +141,7 @@ public class StudentFragmentGrid extends Fragment{
...
@@ -141,7 +141,7 @@ public class StudentFragmentGrid extends Fragment{
PCBcontext
.
set_user
(
student
,
jsonToken
,
new
iImgDownloaderListener
()
{
PCBcontext
.
set_user
(
student
,
jsonToken
,
new
iImgDownloaderListener
()
{
@Override
@Override
public
void
loadComplete
()
{
public
void
loadComplete
(
String
collection
)
{
//Vocabulary vocabulary = PCBcontext.getVocabulary();
//Vocabulary vocabulary = PCBcontext.getVocabulary();
//Log.d(LOG_TAG, "Vocabulario de tam:" + vocabulary.size());
//Log.d(LOG_TAG, "Vocabulario de tam:" + vocabulary.size());
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/ImgDownloader.java
View file @
9239a071
...
@@ -32,9 +32,10 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
...
@@ -32,9 +32,10 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
Context
context
;
Context
context
;
ActivityManager
.
MemoryInfo
mi
;
ActivityManager
.
MemoryInfo
mi
;
ActivityManager
activityManager
;
ActivityManager
activityManager
;
String
collection
;
public
ImgDownloader
(
Context
context
,
iImgDownloaderListener
listener
,
String
collection
)
{
public
ImgDownloader
(
Context
context
,
iImgDownloaderListener
listener
)
{
this
.
collection
=
collection
;
this
.
imgListener
=
listener
;
this
.
imgListener
=
listener
;
this
.
context
=
context
;
this
.
context
=
context
;
this
.
mi
=
new
ActivityManager
.
MemoryInfo
();
this
.
mi
=
new
ActivityManager
.
MemoryInfo
();
...
@@ -99,9 +100,9 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
...
@@ -99,9 +100,9 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
@Override
@Override
protected
void
onPostExecute
(
Img
img
)
{
protected
void
onPostExecute
(
Img
img
)
{
Log
.
d
(
this
.
getClass
().
getCanonicalName
(),
"I
nside OnPostExecute()"
);
Log
.
d
(
this
.
getClass
().
getCanonicalName
(),
"I
mages: Inside OnPostExecute() Collection: "
+
this
.
collection
);
if
(
imgListener
!=
null
)
if
(
imgListener
!=
null
)
if
(
img
==
null
)
imgListener
.
loadComplete
();
if
(
img
==
null
)
imgListener
.
loadComplete
(
this
.
collection
);
else
imgListener
.
loadImg
(
img
);
else
imgListener
.
loadImg
(
img
);
}
}
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/iImgDownloaderListener.java
View file @
9239a071
...
@@ -9,6 +9,6 @@ import java.util.LinkedList;
...
@@ -9,6 +9,6 @@ import java.util.LinkedList;
* Created by emblanco on 24/09/15.
* Created by emblanco on 24/09/15.
*/
*/
public
interface
iImgDownloaderListener
{
public
interface
iImgDownloaderListener
{
public
void
loadComplete
();
// for loading the vocabulary
public
void
loadComplete
(
String
collection
);
// for loading the vocabulary
public
void
loadImg
(
Img
image
);
// for loading one image
public
void
loadImg
(
Img
image
);
// for loading one image
}
}
android/Pictogram/app/src/main/res/layout/activity_pictogram.xml
View file @
9239a071
...
@@ -25,15 +25,6 @@
...
@@ -25,15 +25,6 @@
android:layout_alignParentTop=
"true"
>
android:layout_alignParentTop=
"true"
>
</GridView>
</GridView>
<ImageButton
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingLeft=
"850dp"
android:paddingTop=
"20dp"
android:src=
"@drawable/back64"
android:background=
"@null"
android:id=
"@+id/button_delete"
android:layout_alignParentTop=
"true"
/>
<ImageButton
<ImageButton
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
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