[TIMOB-18040] Android: Expose "gravity" constants in Ti.UI.Notification
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-04-25T09:07:43.000+0000 |
Affected Version/s | Release 3.4.0 |
Fix Version/s | Release 5.4.0 |
Components | Android |
Labels | TCSupport, gravity, notification, toast |
Reporter | Fokke Zandbergen |
Assignee | Hans Knöchel |
Created | 2014-11-10T16:42:57.000+0000 |
Updated | 2016-07-01T00:35:51.000+0000 |
Description
I'd like to position an Android Toast (
Ti.UI.Notification
on the top half of the screen. I thought this wasn't possible, but then found that the first [gravity](http://developer.android.com/guide/topics/ui/notifiers/toasts.html#Positioning) argument for setGravity
that I needed is actually [exposed](https://github.com/appcelerator/titanium_mobile/blob/58198c641d77e17d156431666e80bae732b5c130/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUINotification.java#L65-L69), just not documented.
Using the integer value of the Android documentation for [Gravity.TOP](http://developer.android.com/reference/android/view/Gravity.html#TOP) I was able to position the Toast on the top half of the screen:
Ti.UI.createNotification({
message: "Please Stand By",
duration: Ti.UI.NOTIFICATION_DURATION_LONG,
gravity: 48 // Gravity.TOP
}).show();
My request is:
* Document the gravity
property
* Expose the gravity constants (Ti.UI.Android.GRAVITY_TOP
etc..)
Community PR: https://github.com/appcelerator/titanium_mobile/pull/6435 Demo:
Verified the implementation. Closing. Environment: Appc Studio : 4.7.0.201606220541 Ti SDK : 5.4.0.v20160630074247 Ti CLI : 5.0.9 Alloy : 1.9.0 MAC El Capitan : 10.11.5 Appc NPM : 4.2.7-2 Appc CLI : 5.4.0-23 Node: 4.4.4 Nexus 6 - Android 6.0.1