[TIMOB-20066] Android: Add support for style in Titanium.Android.Notification
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-01-07T07:16:12.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.4.0 |
| Components | Android |
| Labels | android, notification, style |
| Reporter | Andrey Tkachenko |
| Assignee | Ashraf Abu |
| Created | 2015-11-21T14:45:30.000+0000 |
| Updated | 2017-08-22T12:55:20.000+0000 |
Description
Currently [Titanium.Android.Notification](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.Notification) has not support for Big View Styles.
Add support for [BigTextStyle](http://developer.android.com/intl/ru/reference/android/app/Notification.BigTextStyle.html), [BigPictureStyle](http://developer.android.com/intl/ru/reference/android/app/Notification.BigPictureStyle.html).
This ticket created for future PR.
PR: https://github.com/appcelerator/titanium_mobile/pull/7489
var win = Ti.UI.createWindow({layout:'vertical'}); var btn1 = Ti.UI.createButton({ title : '1) Add Big Text Notification' }); btn1.addEventListener('click', function(e) { var style = Titanium.Android.createBigTextStyle({ bigText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", bigContentTitle: "Title for big text", summaryText: "Summary for big text" }); // Create big text style the notification var notification = Titanium.Android.createNotification({ contentTitle: 'Something Happened', contentText : 'Click to return to the application.', style: style, time: Date.now() }); // Send the notification. Titanium.Android.NotificationManager.notify(1, notification); }); win.add(btn1); //************************ var btn2 = Ti.UI.createButton({ title : '2) Add Big Text Notification' }); btn2.addEventListener('click', function(e) { var style = Ti.Android.createBigTextStyle(); style.setBigText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."); style.setBigContentTitle('big title'); style.setSummaryText('big summmary'); // Create big text style the notification var notification = Ti.Android.createNotification({ contentTitle: 'Something Happened', contentText : 'Click to return to the application.', time: Date.now() }); notification.setStyle(style); // Send the notification. Titanium.Android.NotificationManager.notify(2, notification); }); win.add(btn2); //*************************** var btn3 = Ti.UI.createButton({ title : '3) Add Big Image Notification' }); btn3.addEventListener('click', function(e) { // For test: // * Place the image http://codeversed.com/androidifysteve.png to corresponding folder. // * For example: Resources/android/images/res-xhdpi/ // Create big picture style the notification var notification = Ti.Android.createNotification({ contentTitle: 'Something Happened', contentText : 'Click to return to the application.', style: Ti.Android.createBigPictureStyle({ //bigPicture: "/images/androidifysteve.png", //bigPicture: 'http://www.notetab.com/images/More-free-time-thanks-to-NoteTab.jpg', bigPicture: Ti.App.Android.R.drawable.androidifysteve, bigContentTitle: "Title for big picture", summaryText: "Summary for big picture" }), time: Date.now() }); // Send the notification. Titanium.Android.NotificationManager.notify(3, notification); }); win.add(btn3); win.open();[~falko] Thanks for the PR! I'll look into this.
Document updates: https://github.com/appcelerator/titanium_mobile/pull/7619
The PR: https://github.com/appcelerator/titanium_mobile/pull/7489 Document updates: https://github.com/appcelerator/titanium_mobile/pull/7619 Both merged.
Verified the implementation.
styleworks as expected. Closing. Environment: Appc Studio : 4.7.0.201606150733 Ti SDK : 5.4.0.v20160617074028 Ti CLI : 5.0.9 Alloy : 1.9.0 MAC El Capitan : 10.11.4 Appc NPM : 4.2.7-2 Appc CLI : 5.4.0-18 Node: 4.4.4 Nexus 6 - Android 6.0.1Is it somehow possible to use this feature in ti.cloudpush module for push notifications???
Is it somehow possible to use this feature in ti.cloudpush module for push notifications??? [2]