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
b6f8b247
authored
Mar 16, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
online/offline notification tray implemented (issue
#353
)
parent
b80d53d5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
17 deletions
android/Pictogram/app/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/Img.java
android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
android/Pictogram/app/src/main/res/drawable-xhdpi/yottalogo72p.png
android/Pictogram/app/src/main/res/layout/activity_splash_screen.xml
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/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
b6f8b247
...
@@ -41,14 +41,6 @@ public class NetService implements Runnable {
...
@@ -41,14 +41,6 @@ public class NetService implements Runnable {
private
NotificationCompat
.
Builder
builder
;
private
NotificationCompat
.
Builder
builder
;
public
NetService
(
int
delay
)
{
public
NetService
(
int
delay
)
{
this
.
builder
=
new
NotificationCompat
.
Builder
(
PCBcontext
.
getContext
());
Intent
resultIntent
=
new
Intent
(
PCBcontext
.
getContext
(),
PictogramActivity
.
class
);
TaskStackBuilder
stackBuilder
=
TaskStackBuilder
.
create
(
PCBcontext
.
getContext
());
stackBuilder
.
addParentStack
(
PictogramActivity
.
class
);
stackBuilder
.
addNextIntent
(
resultIntent
);
PendingIntent
resultPendingIntent
=
stackBuilder
.
getPendingIntent
(
0
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
this
.
builder
.
setContentIntent
(
resultPendingIntent
);
this
.
updated
=
RestapiWrapper
.
ping
(
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
server
),
ping_session
,
new
iRestapiListener
()
{
this
.
updated
=
RestapiWrapper
.
ping
(
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
server
),
ping_session
,
new
iRestapiListener
()
{
...
@@ -118,6 +110,7 @@ public class NetService implements Runnable {
...
@@ -118,6 +110,7 @@ public class NetService implements Runnable {
public
void
error
(
Exception
e
)
{
public
void
error
(
Exception
e
)
{
updated
=
false
;
updated
=
false
;
Log
.
i
(
this
.
getClass
().
getName
(),
"PCB offline because exception happens: "
+
e
.
getMessage
());
Log
.
i
(
this
.
getClass
().
getName
(),
"PCB offline because exception happens: "
+
e
.
getMessage
());
notifyStatus
();
}
}
});
});
}
}
...
@@ -125,11 +118,23 @@ public class NetService implements Runnable {
...
@@ -125,11 +118,23 @@ public class NetService implements Runnable {
private
void
notifyStatus
()
{
private
void
notifyStatus
()
{
int
notifyID
=
1
;
int
notifyID
=
1
;
this
.
builder
=
new
NotificationCompat
.
Builder
(
PCBcontext
.
getContext
());
Intent
resultIntent
=
new
Intent
(
PCBcontext
.
getContext
(),
PictogramActivity
.
class
);
TaskStackBuilder
stackBuilder
=
TaskStackBuilder
.
create
(
PCBcontext
.
getContext
());
stackBuilder
.
addParentStack
(
PictogramActivity
.
class
);
stackBuilder
.
addNextIntent
(
resultIntent
);
PendingIntent
resultPendingIntent
=
stackBuilder
.
getPendingIntent
(
0
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
this
.
builder
.
setContentIntent
(
resultPendingIntent
);
if
(
updated
)
this
.
builder
.
setSmallIcon
(
R
.
drawable
.
picton
)
.
setContentTitle
(
"Pictogram online"
)
.
setContentText
(
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
pictogram_online
));
else
this
.
builder
.
setSmallIcon
(
R
.
drawable
.
pictoff
)
.
setContentTitle
(
"Pictogram offline"
)
.
setContentText
(
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
pictogram_offline
));
this
.
builder
.
setSmallIcon
(
R
.
drawable
.
logo_pictogram
)
.
setContentTitle
(
"Pictogram "
+
(
updated
?
"online"
:
"offline"
))
.
setContentText
(
updated
?
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
pictogram_online
)
:
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
pictogram_offline
));
NotificationManager
mNotificationManager
=
NotificationManager
mNotificationManager
=
(
NotificationManager
)
PCBcontext
.
getContext
().
getSystemService
(
PCBcontext
.
getContext
().
NOTIFICATION_SERVICE
);
(
NotificationManager
)
PCBcontext
.
getContext
().
getSystemService
(
PCBcontext
.
getContext
().
NOTIFICATION_SERVICE
);
// mId allows you to update the notification later on.
// mId allows you to update the notification later on.
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/tools/Img.java
View file @
b6f8b247
...
@@ -136,7 +136,6 @@ public class Img {
...
@@ -136,7 +136,6 @@ public class Img {
}
}
ByteArrayOutputStream
outstream
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
outstream
=
new
ByteArrayOutputStream
();
this
.
bitmap
.
setHasAlpha
(
true
);
this
.
bitmap
.
setHasAlpha
(
true
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Img Uploading Picto img"
+
file_name
()
+
" from "
+
get_type
()
+
"size:"
+
get_bitmap
(
PCBcontext
.
getContext
()).
getWidth
()
+
" "
+
get_bitmap
(
PCBcontext
.
getContext
()).
getHeight
());
this
.
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
outstream
);
this
.
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
outstream
);
byte
[]
byteArray
=
outstream
.
toByteArray
();
byte
[]
byteArray
=
outstream
.
toByteArray
();
os
.
write
(
byteArray
);
os
.
write
(
byteArray
);
...
...
android/Pictogram/app/src/main/res/drawable-hdpi/ic_launcher.png
View file @
b6f8b247
3.29 KB
|
W:
|
H:
10.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
android/Pictogram/app/src/main/res/drawable-xhdpi/ic_launcher.png
View file @
b6f8b247
4.5 KB
|
W:
|
H:
10.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
android/Pictogram/app/src/main/res/drawable-xhdpi/logo_pictogram.png
View file @
b6f8b247
4.5 KB
|
W:
|
H:
10.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
android/Pictogram/app/src/main/res/drawable-xhdpi/yottalogo72p.png
deleted
100644 → 0
View file @
b80d53d5
7.23 KB
android/Pictogram/app/src/main/res/layout/activity_splash_screen.xml
View file @
b6f8b247
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
android:layout_height=
"120px"
android:layout_height=
"120px"
android:contentDescription=
"@string/app_name"
android:contentDescription=
"@string/app_name"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:src=
"@drawable/
yottalogo72p
"
android:src=
"@drawable/
logo
"
android:scaleX=
"0.5"
android:scaleX=
"0.5"
android:scaleY=
"0.5"
android:scaleY=
"0.5"
android:id=
"@+id/imageView2"
android:id=
"@+id/imageView2"
...
...
android/Pictogram/app/src/main/res/values-en/strings.xml
View file @
b6f8b247
...
@@ -53,5 +53,5 @@
...
@@ -53,5 +53,5 @@
<string
name=
"notNewCats"
>
Including new categories is not allowed
</string>
<string
name=
"notNewCats"
>
Including new categories is not allowed
</string>
<!--online/offline status-->
<!--online/offline status-->
<string
name=
"pictogram_offline"
>
Please check your internet connection.
</string>
<string
name=
"pictogram_offline"
>
Please check your internet connection.
</string>
<string
name=
"pictogram_online"
>
Pictogram s
erver connection established.
</string>
<string
name=
"pictogram_online"
>
S
erver connection established.
</string>
</resources>
</resources>
android/Pictogram/app/src/main/res/values-es/strings.xml
View file @
b6f8b247
...
@@ -57,5 +57,5 @@
...
@@ -57,5 +57,5 @@
<string
name=
"notNewCats"
>
No puede añadir nuevas categorias
</string>
<string
name=
"notNewCats"
>
No puede añadir nuevas categorias
</string>
<!--online/offline status-->
<!--online/offline status-->
<string
name=
"pictogram_offline"
>
Compruebe si tiene conexión a Internet.
</string>
<string
name=
"pictogram_offline"
>
Compruebe si tiene conexión a Internet.
</string>
<string
name=
"pictogram_online"
>
Conexón con el servidor
Pictogram
establecida.
</string>
<string
name=
"pictogram_online"
>
Conexón con el servidor establecida.
</string>
</resources>
</resources>
android/Pictogram/app/src/main/res/values/strings.xml
View file @
b6f8b247
...
@@ -70,6 +70,6 @@
...
@@ -70,6 +70,6 @@
completions."
completions."
<!--online/offline status-->
<!--online/offline status-->
<string
name=
"pictogram_offline"
>
Compruebe si tiene conexión a Internet.
</string>
<string
name=
"pictogram_offline"
>
Compruebe si tiene conexión a Internet.
</string>
<string
name=
"pictogram_online"
>
Conexón con el servidor
Pictogram
establecida.
</string>
<string
name=
"pictogram_online"
>
Conexón con el servidor establecida.
</string>
</string>
</string>
</resources>
</resources>
\ 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