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
e96e2819
authored
Mar 15, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
rescaling local images only (images from server are no longer rescaled)
some bugs fixed
parent
cde7a3cb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
9 deletions
android/Pictogram/app/build.gradle
android/Pictogram/app/src/main/java/com/yottacode/pictogram/dao/Picto.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/ImgDownloader.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/Img.java
android/Pictogram/app/build.gradle
View file @
e96e2819
...
...
@@ -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/dao/Picto.java
View file @
e96e2819
...
...
@@ -71,7 +71,11 @@ public class Picto extends Img {
}
/**
*
* @return true if it's a local pictogram
*/
public
boolean
is_local
()
{
return
this
.
get_id
()<
0
;}
/**
*
* @return de id of the picto
...
...
@@ -253,7 +257,7 @@ public class Picto extends Img {
int
color
=
this
.
get_color
();
int
red
=
Color
.
red
(
color
)+
LIGHT
,
blue
=
Color
.
blue
(
color
)+
LIGHT
,
green
=
Color
.
green
(
color
)+
LIGHT
;
return
Color
.
rgb
(
red
,
green
,
blue
);
return
Color
.
rgb
(
red
,
green
,
blue
);
}
/**
...
...
@@ -325,12 +329,14 @@ public class Picto extends Img {
try
{
this
.
attributes
.
put
(
JSON_ATTTRS
.
STATUS
,
status
);
set_local_status
(
true
);
new
PictoUploader
(
this
).
uploadState
();
if
(!
is_local
())
{
new
PictoUploader
(
this
).
uploadState
();
PCBcontext
.
getActionLog
().
log
(
new
VocabularyAction
(
VocabularyAction
.
ALTERATTRS
,
this
));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
PCBcontext
.
getActionLog
().
log
(
new
VocabularyAction
(
VocabularyAction
.
ALTERATTRS
,
this
));
return
is_enabled
();
}
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/grammar/Vocabulary.java
View file @
e96e2819
...
...
@@ -321,6 +321,7 @@ public class Vocabulary implements Iterable<Picto> {
public
boolean
isVisibleCategory
(
int
id
)
{
if
(
empty_category
(
id
))
return
false
;
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
is_supervisor
())
return
true
;
boolean
visible
=
false
;
for
(
Picto
picto
:
this
.
pictos
.
get
(
id
))
{
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/ImgDownloader.java
View file @
e96e2819
...
...
@@ -69,7 +69,6 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
if
(!
img
.
exists_bitmap
(
this
.
context
)
||
this
.
force_download
)
try
{
this
.
activityManager
.
getMemoryInfo
(
mi
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Picto Img "
+
img
.
get_url
()
+
" to be downloaded"
);
if
(
this
.
source
==
source
.
remote
)
{
String
surl
=
context
.
getResources
().
getString
(
R
.
string
.
server
)
+
"/"
+
img
.
get_url
();
URL
url
=
new
URL
(
surl
);
...
...
@@ -79,7 +78,7 @@ public class ImgDownloader extends AsyncTask<Vector<Img>, Void, Img> {
File
file
=
new
File
(
img
.
get_url
());
is
=
new
FileInputStream
(
file
);
}
int
size
=
img
.
save_bitmap
(
this
.
context
,
is
);
int
size
=
img
.
save_bitmap
(
this
.
context
,
is
,
this
.
source
==
source
.
local
);
allsize
+=
size
;
i
++;
}
catch
(
IOException
e
)
{
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/Img.java
View file @
e96e2819
...
...
@@ -124,12 +124,13 @@ public class Img {
* @param is the stream where the image is available
* @throws IOException
*/
public
int
save_bitmap
(
Context
context
,
InputStream
is
)
throws
IOException
{
public
int
save_bitmap
(
Context
context
,
InputStream
is
,
boolean
resize
)
throws
IOException
{
File
file
=
file
(
context
);
FileOutputStream
os
=
new
FileOutputStream
(
file
);
try
{
this
.
bitmap
=
new
ImgTools
(
BitmapFactory
.
decodeStream
(
is
)).
resize
(
78
,
66
);
this
.
bitmap
=
BitmapFactory
.
decodeStream
(
is
);
if
(
resize
)
this
.
bitmap
=
new
ImgTools
(
this
.
bitmap
).
resize
(
78
,
66
);
}
catch
(
java
.
lang
.
OutOfMemoryError
err
)
{
Log
.
e
(
Img
.
class
.
getCanonicalName
(),
"Out of memory when decoding "
+
this
.
get_url
());
}
...
...
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