Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
559d938a
Commit
559d938a
authored
Jan 09, 2018
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dont reset chronometer when updating progressbar [fixes #1459]
parent
c4fa11b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
ClearReceiver.java
src/android/ClearReceiver.java
+0
-1
LocalNotification.java
src/android/LocalNotification.java
+1
-0
Builder.java
src/android/notification/Builder.java
+38
-1
No files found.
src/android/ClearReceiver.java
View file @
559d938a
...
...
@@ -28,7 +28,6 @@ import de.appplant.cordova.plugin.notification.receiver.AbstractClearReceiver;
import
static
de
.
appplant
.
cordova
.
plugin
.
notification
.
Request
.
EXTRA_LAST
;
/**
* The clear intent receiver is triggered when the user clears a
* notification manually. It un-persists the cleared notification from the
...
...
src/android/LocalNotification.java
View file @
559d938a
...
...
@@ -56,6 +56,7 @@ import static de.appplant.cordova.plugin.notification.Notification.Type.TRIGGERE
* care of firing the event. When the event is processed, a notification is put
* in the Android notification center and status bar.
*/
@SuppressWarnings
({
"Convert2Diamond"
,
"Convert2Lambda"
})
public
class
LocalNotification
extends
CordovaPlugin
{
// Reference to the web view for static access
...
...
src/android/notification/Builder.java
View file @
559d938a
...
...
@@ -31,6 +31,7 @@ import android.support.v4.app.NotificationCompat;
import
android.support.v4.app.NotificationCompat.MessagingStyle.Message
;
import
android.support.v4.media.app.NotificationCompat.MediaStyle
;
import
android.support.v4.media.session.MediaSessionCompat
;
import
android.util.SparseArray
;
import
java.util.List
;
import
java.util.Random
;
...
...
@@ -45,8 +46,12 @@ import static de.appplant.cordova.plugin.notification.Notification.EXTRA_UPDATE;
* Builder class for local notifications. Build fully configured local
* notification specified by JSON object passed from JS side.
*/
@SuppressWarnings
(
"Convert2Diamond"
)
public
final
class
Builder
{
// Cache for the builder instances
private
static
SparseArray
<
NotificationCompat
.
Builder
>
cache
=
null
;
// Application context passed by constructor
private
final
Context
context
;
...
...
@@ -123,7 +128,7 @@ public final class Builder {
extras
.
putInt
(
Notification
.
EXTRA_ID
,
options
.
getId
());
extras
.
putString
(
Options
.
EXTRA_SOUND
,
sound
.
toString
());
builder
=
new
NotificationCompat
.
Builder
(
context
,
Manager
.
CHANNEL_ID
)
builder
=
findOrCreateBuilder
(
)
.
setDefaults
(
options
.
getDefaults
())
.
setExtras
(
extras
)
.
setOnlyAlertOnce
(
false
)
...
...
@@ -148,6 +153,7 @@ public final class Builder {
}
if
(
options
.
isWithProgressBar
())
{
cacheBuilder
(
builder
);
builder
.
setProgress
(
options
.
getProgressMaxValue
(),
options
.
getProgressValue
(),
...
...
@@ -406,4 +412,35 @@ public final class Builder {
return
extras
!=
null
&&
extras
.
getBoolean
(
EXTRA_UPDATE
,
false
);
}
/**
* Returns a cached builder instance or creates a new one.
*/
private
NotificationCompat
.
Builder
findOrCreateBuilder
()
{
NotificationCompat
.
Builder
builder
=
null
;
int
key
=
options
.
getId
();
if
(
cache
!=
null
)
{
builder
=
cache
.
get
(
key
);
}
if
(
builder
==
null
)
{
builder
=
new
NotificationCompat
.
Builder
(
context
,
Manager
.
CHANNEL_ID
);
}
return
builder
;
}
/**
* Caches the builder instance so it can be used later.
*
* @param builder The instance to cache.
*/
private
void
cacheBuilder
(
NotificationCompat
.
Builder
builder
)
{
if
(
cache
==
null
)
{
cache
=
new
SparseArray
<
NotificationCompat
.
Builder
>();
}
cache
.
put
(
options
.
getId
(),
builder
);
}
}
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