Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
76366bc3
Commit
76366bc3
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not create async task in background process
parent
57049bc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
35 deletions
+26
-35
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
...main/java/app/insti/InstiAppFirebaseMessagingService.java
+26
-35
No files found.
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
View file @
76366bc3
...
@@ -130,46 +130,37 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
...
@@ -130,46 +130,37 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
final
Context
context
,
final
String
imageUrl
,
final
String
largeIconUrl
,
final
Context
context
,
final
String
imageUrl
,
final
String
largeIconUrl
,
final
int
notification_id
,
final
NotificationCompat
.
Builder
builder
,
final
String
content
){
final
int
notification_id
,
final
NotificationCompat
.
Builder
builder
,
final
String
content
){
new
AsyncTask
<
Void
,
Void
,
Bitmap
[]>()
{
Bitmap
[]
bitmaps
=
null
;
@Override
try
{
protected
Bitmap
[]
doInBackground
(
Void
...
params
)
{
Bitmap
image
=
null
;
try
{
if
(
imageUrl
!=
null
)
{
Bitmap
image
=
null
;
image
=
Picasso
.
get
().
load
(
imageUrl
).
get
();
if
(
imageUrl
!=
null
)
{
image
=
Picasso
.
get
().
load
(
imageUrl
).
get
();
}
Bitmap
largeIcon
=
null
;
if
(
largeIconUrl
!=
null
)
{
largeIcon
=
getCroppedBitmap
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
largeIconUrl
,
200
)).
get
(),
200
);
}
return
new
Bitmap
[]{
image
,
largeIcon
};
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
Bitmap
largeIcon
=
null
;
}
if
(
largeIconUrl
!=
null
)
{
largeIcon
=
getCroppedBitmap
(
@Override
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
largeIconUrl
,
200
)).
get
(),
200
);
protected
void
onPostExecute
(
Bitmap
[]
bitmaps
)
{
// Check if we loaded big image
if
(
bitmaps
!=
null
&&
bitmaps
[
0
]
!=
null
)
{
builder
.
setStyle
(
new
NotificationCompat
.
BigPictureStyle
()
.
bigPicture
(
bitmaps
[
0
])
.
setSummaryText
(
content
)
);
}
}
bitmaps
=
new
Bitmap
[]{
image
,
largeIcon
};
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// Check if we loaded large icon
// Check if we loaded big image
if
(
bitmaps
!=
null
&&
bitmaps
[
1
]
!=
null
)
{
if
(
bitmaps
!=
null
&&
bitmaps
[
0
]
!=
null
)
{
builder
.
setLargeIcon
(
bitmaps
[
1
]);
builder
.
setStyle
(
}
new
NotificationCompat
.
BigPictureStyle
()
.
bigPicture
(
bitmaps
[
0
])
.
setSummaryText
(
content
)
);
}
showNotification
(
context
,
notification_id
,
builder
.
build
());
// Check if we loaded large icon
super
.
onPostExecute
(
bitmaps
);
if
(
bitmaps
!=
null
&&
bitmaps
[
1
]
!=
null
)
{
builder
.
setLargeIcon
(
bitmaps
[
1
]);
}
}
}.
execute
();
showNotification
(
context
,
notification_id
,
builder
.
build
());
}
}
/** Get circular center cropped bitmap */
/** Get circular center cropped bitmap */
...
...
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