-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-23645] Android: Added Color to Android notification color behind icon #9444
Changes from 6 commits
a59b5cb
25ae61f
6256523
43d3406
e1fddf4
28782db
4705435
f7b9df5
fb126f9
462d7ef
7164f0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import org.appcelerator.titanium.TiC; | ||
import org.appcelerator.titanium.util.TiConvert; | ||
import org.appcelerator.titanium.util.TiUIHelper; | ||
import org.appcelerator.titanium.util.TiColorHelper; | ||
|
||
import ti.modules.titanium.android.AndroidModule; | ||
import ti.modules.titanium.android.PendingIntentProxy; | ||
|
@@ -71,6 +72,9 @@ public void handleCreationDict(KrollDict d) | |
if (d.containsKey(TiC.PROPERTY_LARGE_ICON)) { | ||
setLargeIcon(d.get(TiC.PROPERTY_LARGE_ICON)); | ||
} | ||
if (d.containsKey(TiC.PROPERTY_COLOR)) { | ||
setColor(TiConvert.toString(d, TiC.PROPERTY_COLOR)); | ||
} | ||
if (d.containsKey(TiC.PROPERTY_TICKER_TEXT)) { | ||
setTickerText(TiConvert.toString(d, TiC.PROPERTY_TICKER_TEXT)); | ||
} | ||
|
@@ -183,7 +187,16 @@ public void setLargeIcon(Object icon) | |
} | ||
setProperty(TiC.PROPERTY_LARGE_ICON, icon); | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove spaces from empty lines - here and on line 199. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
@Kroll.method @Kroll.setProperty | ||
public void setColor(String color) | ||
{ | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)) { | ||
notificationBuilder.setColor(TiColorHelper.parseColor(color)); | ||
} | ||
setProperty(TiC.PROPERTY_COLOR, color); | ||
} | ||
|
||
@Kroll.method @Kroll.setProperty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check the indentation. I fixed it previously but you want to check this as well - maybe for future PR's 😙. |
||
public void setVisibility(int visibility) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,8 +308,18 @@ properties: | |
|
||
See <Titanium.App.Android.R> for more information on accessing | ||
Android resources by ID. | ||
type: [Number,String] | ||
type: [Number, String] | ||
since: "4.2.0" | ||
|
||
- name: color | ||
summary: Accent color used behind icon. | ||
description: | | ||
Accent color of the circle used behind icon. The Icon will be stenciled in white on top of a | ||
cicle of the color set. For information about color values, see the "Colors" section of <Titanium.UI>. | ||
|
||
See Android Reference for the [color](https://developer.android.com/reference/android/app/Notification.html#color) property. | ||
type: String | ||
since: "7.0.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @garymathews - I see this has not been approved yet? |
||
|
||
- name: ledARGB | ||
summary: The color for the LED to blink. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done