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
3b145ca2
Commit
3b145ca2
authored
Oct 11, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented progressBar option for Android
parent
acf59a84
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
3 deletions
+67
-3
Builder.java
src/android/notification/Builder.java
+8
-0
Options.java
src/android/notification/Options.java
+42
-0
local-notification-util.js
www/local-notification-util.js
+17
-3
No files found.
src/android/notification/Builder.java
View file @
3b145ca2
...
...
@@ -100,8 +100,16 @@ public class Builder {
.
setVisibility
(
options
.
getVisibility
())
.
setPriority
(
options
.
getPriority
())
.
setShowWhen
(
options
.
getShowWhen
())
.
setUsesChronometer
(
options
.
isWithProgressBar
())
.
setLights
(
options
.
getLedColor
(),
options
.
getLedOn
(),
options
.
getLedOff
());
if
(
options
.
isWithProgressBar
())
{
builder
.
setProgress
(
options
.
getProgressMaxValue
(),
options
.
getProgressValue
(),
options
.
isIndeterminateProgress
());
}
if
(
smallIcon
!=
0
)
{
builder
.
setSmallIcon
(
smallIcon
);
builder
.
setLargeIcon
(
options
.
getLargeIcon
());
...
...
src/android/notification/Options.java
View file @
3b145ca2
...
...
@@ -403,6 +403,48 @@ public class Options {
}
/**
* If the notification shall display a progress bar.
*/
boolean
isWithProgressBar
()
{
return
options
.
optJSONObject
(
"progressBar"
)
.
optBoolean
(
"enabled"
,
false
);
}
/**
* Gets the progress value.
*
* @return 0 by default.
*/
int
getProgressValue
()
{
return
options
.
optJSONObject
(
"progressBar"
)
.
optInt
(
"value"
,
0
);
}
/**
* Gets the progress value.
*
* @return 100 by default.
*/
int
getProgressMaxValue
()
{
return
options
.
optJSONObject
(
"progressBar"
)
.
optInt
(
"maxValue"
,
100
);
}
/**
* Gets the progress indeterminate value.
*
* @return false by default.
*/
boolean
isIndeterminateProgress
()
{
return
options
.
optJSONObject
(
"progressBar"
)
.
optBoolean
(
"indeterminate"
,
false
);
}
/**
* Gets the raw trigger spec as provided by the user.
*/
public
JSONObject
getTrigger
()
{
...
...
www/local-notification-util.js
View file @
3b145ca2
...
...
@@ -60,8 +60,8 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
vibrate
=
false
;
defaults
.
lockscreen
=
true
;
defaults
.
showWhen
=
true
;
defaults
.
priority
=
0
;
defaults
.
defaults
=
0
;
defaults
.
priority
=
0
;
break
;
}
};
...
...
@@ -265,12 +265,26 @@ exports.convertTrigger = function (options) {
* @return [ Map ] Interaction object with trigger spec.
*/
exports
.
convertProgressBar
=
function
(
options
)
{
var
cfg
=
options
.
progressBar
;
var
isAndroid
=
device
.
platform
==
'Android'
,
cfg
=
options
.
progressBar
;
if
(
typeof
cfg
===
'boolean'
)
{
options
.
progressBar
=
{
enabled
:
cfg
};
cfg
=
options
.
progressBar
=
{
enabled
:
cfg
};
}
if
(
typeof
cfg
.
enabled
!==
'boolean'
)
{
cfg
.
enabled
=
!!
(
cfg
.
value
||
cfg
.
maxValue
||
cfg
.
indeterminate
!==
undefined
);
}
cfg
.
value
=
cfg
.
value
||
0
;
if
(
isAndroid
)
{
cfg
.
maxValue
=
cfg
.
maxValue
||
100
;
cfg
.
indeterminate
=
cfg
.
indeterminate
!==
undefined
?
cfg
.
indeterminate
:
false
;
}
cfg
.
enabled
=
!!
cfg
.
enabled
;
return
options
;
};
...
...
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