Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #399 from MoSync/ThreeTwoOne

Three two one
  • Loading branch information...
commit f4a9b180645e9da562faa067fc3c8080ab98daae 2 parents 23b1563 + 7befd7b
Ali Sarrafi authored
Showing with 195 additions and 102 deletions.
  1. +13 −0 examples/cpp/NativeUIMap/Readme.txt
  2. +1 −1  examples/cpp/SensorTest/consts.h
  3. +14 −0 examples/cpp/WikiSearchNativeUI/Util.h
  4. +11 −6 examples/cpp/WikiSearchNativeUI/WikiEngine.cpp
  5. +2 −1  examples/html5/PhotoGallery/LocalFiles/index.html
  6. +10 −2 examples/html5/PhotoGallery/LocalFiles/page-about.html
  7. +5 −2 examples/html5/PhotoGallery/LocalFiles/page-camera.html
  8. +2 −3 examples/html5/PhotoGallery/LocalFiles/page-gallery.html
  9. +18 −14 examples/html5/PhotoGallery/Server/upload.php
  10. +9 −0 examples/html5/PhotoGallery/readme.txt
  11. +1 −1  examples/html5/WebViewLoveSMS/LocalFiles/index.html
  12. +6 −6 examples/html5/WebViewTwitter/LocalFiles/index.html
  13. +2 −2 examples/html5/WormholeNativeUI/LocalFiles/index.html
  14. +2 −0  libs/Notification/LocalNotification.cpp
  15. +2 −0  libs/Notification/LocalNotification.h
  16. +15 −8 libs/Wormhole/Libs/Notification/PushNotificationManager.cpp
  17. +6 −0 libs/Wormhole/Libs/PhoneGap/PhoneGapFile.cpp
  18. +18 −4 runtimes/cpp/platforms/iphone/Classes/MoSyncView.mm
  19. +12 −8 runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm
  20. +3 −0  runtimes/cpp/platforms/iphone/Classes/NativeUI/WidgetUtils/WidgetUtils.h
  21. +2 −0  runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/ButtonWidget.mm
  22. +6 −1 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/ListViewItemWidget.mm
  23. +3 −1 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/VideoViewWidget.mm
  24. +4 −3 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm
  25. +0 −3  runtimes/cpp/platforms/iphone/Classes/notifications/NotificationManager.mm
  26. +4 −1 runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs
  27. +1 −29 ...orms/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java
  28. +2 −0  runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java
  29. +1 −1  testPrograms/native_ui_lib/MapTest/MainScreen.cpp
  30. +13 −0 testPrograms/native_ui_lib/MapTest/Readme.txt
  31. +4 −5 testPrograms/notification/LocalNotificationSender/ReadMe.txt
  32. +3 −0  tools/idl2/maapi.idl
View
13 examples/cpp/NativeUIMap/Readme.txt
@@ -0,0 +1,13 @@
+Purpose:
+The test program shows the native ui map functionality and provides UI elements for doing
+the following:
+ - add/remove multiple random map pins
+ - set/get visible area
+ - set zoom level
+ - center the map
+ - a map control is visible and available for interraction to the user
+
+IMPORTANT:
+ ADD YOU OWN MAP CREDENTIALS INSIDE THE MAP CONSTRUCTOR:
+ MainScreen.cpp:
+ mMap = new Map("google maps test credentials", "bing maps test credentials");
View
2  examples/cpp/SensorTest/consts.h
@@ -37,7 +37,7 @@ MA 02110-1301, USA.
#define SCALE_FACTOR (gScreenWidth / BASE_SCREEN_WIDTH)
#define TEXT_SIZE (10 * SCALE_FACTOR)
#define OFFSET_X (10 * SCALE_FACTOR)
-#define OFFSET_Y 20
+#define OFFSET_Y TEXT_SIZE
// useful texts
#define TXT_NONE ""
View
14 examples/cpp/WikiSearchNativeUI/Util.h
@@ -122,6 +122,20 @@ const MAUtil::String ERROR_NO_RESULTS = "There are no results.";
/** The results cannot be parsed. **/
const MAUtil::String ERROR_INVALID_DATA = "Invalid results.Error:";
+// Some Http request and response field names.
+/**
+* Field name that can be used for #maHttpSetRequestHeader.
+*/
+const String HTTP_REQUEST_HEADER_USER_AGENT = "User-Agent";
+/**
+* Field name that can be used for #maHttpSetRequestHeader.
+*/
+const String HTTP_REQUEST_HEADER_ACCEPT_ENCODING = "Accept-Encoding";
+/**
+* Field name that can be used for @maHttpGetResponseHeader.
+*/
+const String HTTP_RESPONSE_HEADER_CONTENT_LENGTH = "Content-Length";
+
/**
* Utility functions for creating NativeUI widgets.
*/
View
17 examples/cpp/WikiSearchNativeUI/WikiEngine.cpp
@@ -224,12 +224,18 @@ void MediaWiki::search(MAUtil::String searchTerm, int resultsLimit)
constructApiUrl();
int res = mHttp.create(mWiki->apiUrl.c_str(), HTTP_GET);
+
+ // Enforce compress disabling, so we can count on a real content length value.
+ mHttp.setRequestHeader(HTTP_REQUEST_HEADER_ACCEPT_ENCODING.c_str(),"identity");
+ mHttp.setRequestHeader(HTTP_REQUEST_HEADER_USER_AGENT.c_str(),"WikipediaSearchNativeUI");
+
if(res < 0) {
// It have failed for some reason.
- mHomeScreen->engineError(ERROR_NO_CONNECTION);
+ mHomeScreen->engineError("The error is " + MAUtil::integerToString(res));//ERROR_NO_CONNECTION);
+ mHttp.close();
+ mIsConnected = false;
}
else {
- mHttp.setRequestHeader("User-Agent","WikipediaSearchNativeUI");
mHttp.finish();
mIsConnected = true;
}
@@ -248,14 +254,13 @@ void MediaWiki::httpFinished(MAUtil::HttpConnection *conn, int result)
if ( result >= 0)
{
MAUtil::String contentLengthStr;
- // todo: check return value.
- mHttp.getResponseHeader("Content-Length",
+ mHttp.getResponseHeader(HTTP_RESPONSE_HEADER_CONTENT_LENGTH.c_str(),
&contentLengthStr);
int contentLength = 0;
contentLength = atoi(contentLengthStr.c_str());
- if (contentLength >= CONNECTION_BUFFER_SIZE || contentLength == 0) {
+ if (contentLength >= CONNECTION_BUFFER_SIZE || contentLength != 0) {
// Receive in chunks.
// Calculate how many chunks we receive, so that we can increment
// a progress bar for this action.
@@ -282,7 +287,7 @@ void MediaWiki::httpFinished(MAUtil::HttpConnection *conn, int result)
else
{
// Notify UI on the error.
- mHomeScreen->engineError( ERROR_NO_CONNECTION );
+ mHomeScreen->engineError( MAUtil::integerToString(result));//ERROR_NO_CONNECTION );
mHttp.close();
mIsConnected = false;
View
3  examples/html5/PhotoGallery/LocalFiles/index.html
@@ -19,7 +19,8 @@
<html>
<head>
<title>Photo Gallery</title>
- <script src="js/wormhole.js"></script>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <script src="js/wormhole.js" charset="utf-8"></script>
<script type="text/javascript">
var app = (function()
{
View
12 examples/html5/PhotoGallery/LocalFiles/page-about.html
@@ -8,6 +8,7 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>About</title>
<link rel="stylesheet" href="style.css">
<style type="text/css">
@@ -21,9 +22,16 @@
<div id="screen">
<div id="heading">About</div>
<div class="pane button">
- <p>PhotoGallery is a demo app created with the MoSync Mobile SDK (mosync.com)</p>
- <p>Author: Mikael Kindborg, MoSync AB</p>
+ <p>PhotoGallery is an example application created
+ with the MoSync Mobile SDK (mosync.com)</p>
<p>Tab icons by Glyphish (glyphish.com)</p>
+ <p>DISCLAIMER</p>
+ <p>This application can be used to upload photos
+ to the Internet, which will make them publicly
+ available.</p>
+ <p>MoSync AB takes no responsibility for uploaded
+ photos or any damage the use of this application
+ may cause.</p>
</div>
</div>
</body>
View
7 examples/html5/PhotoGallery/LocalFiles/page-camera.html
@@ -12,9 +12,10 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Camera</title>
<link rel="stylesheet" href="style.css">
- <script src="js/wormhole.js"></script>
+ <script src="js/wormhole.js" charset="utf-8"></script>
<script type="text/javascript">
var camera = (function()
{
@@ -66,7 +67,9 @@
<div class="pane view">
<img id="photo" src="img/MoSyncLogo.png" style="width:100%"/>
</div>
- <div class="pane button" onclick="camera.uploadPhoto()">Upload Photo</div>
+ <div class="pane button" onclick="camera.uploadPhoto()">
+ Upload Photo<br/>(makes your photo publicly available)
+ </div>
</div>
</body>
</html>
View
5 examples/html5/PhotoGallery/LocalFiles/page-gallery.html
@@ -11,10 +11,10 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Gallery</title>
<link rel="stylesheet" href="style.css">
- <script src="js/wormhole.js"></script>
- <script src="mosync-extensions.js"></script>
+ <script src="js/wormhole.js" charset="utf-8"></script>
<script>
var gallery = (function()
{
@@ -64,7 +64,6 @@
// Build new list (populate DOM).
var urls = JSON.parse(json);
- var limit = Math.min(20, urls.length);
for (var i = 0; i < urls.length; ++i)
{
var image = document.createElement('img');
View
32 examples/html5/PhotoGallery/Server/upload.php
@@ -3,18 +3,21 @@
ini_set("log_errors", "1");
error_reporting(-1);
+function mylog($message)
+{
+ $file = 'mylog.txt';
+ // Open the file to get existing content
+ $current = file_get_contents($file);
+ // Append a line to the file
+ $current .= "$message\n";
+ // Write the contents back to the file
+ file_put_contents($file, $current);
+}
+
function uploadPhoto()
{
$targetPath = "photos/" . basename($_FILES["file"]["name"]);
- echo "Target file: " . $targetPath;
- echo "<br/>";
-
- print_r($_FILES);
- echo "<br/>";
-
- echo fileIsImage($_FILES["file"]["name"]);
-
if (fileIsOK($_FILES["file"]))
{
$success = move_uploaded_file($_FILES["file"]["tmp_name"], $targetPath);
@@ -55,9 +58,8 @@ function endsWith($haystack, $needle)
function getPhotoURLs()
{
- $urls = getLast100PhotoURLs();
-
/*// For debugging.
+ $urls = getLastTenPhotoURLs();
foreach ($urls as $url)
{
echo "<a href='$url'>$url</a><br/>\n";
@@ -68,12 +70,13 @@ function getPhotoURLs()
function getPhotoURLsAsJSON()
{
- $urls = getLast100PhotoURLs();
+ $urls = getLastTenPhotoURLs();
return json_encode($urls);
}
-function getLast100PhotoURLs()
+// Gets last TEN photo urls.
+function getLastTenPhotoURLs()
{
$baseURL = "http://dev.mosync.com/mobilelua/PhotoGallery/photos/";
$baseDir = "photos/";
@@ -103,12 +106,13 @@ function getLast100PhotoURLs()
// List if URLs.
$urls = array();
- // Create a list of URLs to the most recent 100 files.
+ // Create a list of URLs to the most recent files.
$fileCounter = 0;
foreach ($files as $file)
{
++$fileCounter;
- if ($fileCounter > 100)
+ // We only get TEN recent files (100 is too many!).
+ if ($fileCounter > 10)
{
// TODO: Move excessive files to an archive directory?
break;
View
9 examples/html5/PhotoGallery/readme.txt
@@ -0,0 +1,9 @@
+DISCLAIMER
+
+This application can be used to upload photos
+to the Internet, which will make them publicly
+available.
+
+MoSync AB takes no responsibility for uploaded
+photos or any damage the use of this application
+may cause.
View
2  examples/html5/WebViewLoveSMS/LocalFiles/index.html
@@ -96,7 +96,7 @@
</style>
<!-- Import the Wormhole JavaScript Library. -->
-<script src="js/wormhole.js"></script>
+<script src="js/wormhole.js" charset="utf-8"></script>
<script>
// Global variables that hold message content.
View
12 examples/html5/WebViewTwitter/LocalFiles/index.html
@@ -8,7 +8,8 @@
-->
<html>
<head>
- <meta name="viewport" content="width=devicewidth; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+ <meta name="viewport" content="width=devicewidth, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Twitter Reader</title>
@@ -16,12 +17,11 @@
<script src="jquery.mobile/jquery-1.8.2.min.js"></script>
<script src="jquery.mobile/jquery.mobile-1.2.0.min.js"></script>
- <script src="js/wormhole.js"></script>
- <script src="js/mosync.file.js"></script>
+ <script src="js/wormhole.js" charset="utf-8"></script>
+ <script src="js/mosync.file.js" charset="utf-8"></script>
- <script src="js/mosync.mock.js"></script>
- <script src="js/app.js"></script>
- <script src="js/app.ui.js"></script>
+ <script src="js/app.js" charset="utf-8"></script>
+ <script src="js/app.ui.js" charset="utf-8"></script>
<script>
/**
View
4 examples/html5/WormholeNativeUI/LocalFiles/index.html
@@ -9,8 +9,8 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <script src="js/wormhole.js"></script>
- <script src="main.js"></script>
+ <script src="js/wormhole.js" charset="utf-8"></script>
+ <script src="main.js" charset="utf-8"></script>
<script>
/**
* Called by the NativeUI library when the UI is ready to
View
2  libs/Notification/LocalNotification.cpp
@@ -540,6 +540,8 @@ namespace Notification
/**
* Set the date and time when the system should deliver the notification.
+ * The notification will be fired when the system time is equal to the
+ * given param time value.
* @param tm A date and time struct that specifies when the system
* should deliver the notification.
* @return Any of the following result codes:
View
2  libs/Notification/LocalNotification.h
@@ -491,6 +491,8 @@ namespace Notification
/**
* Set the date and time when the system should deliver the notification.
+ * The notification will be fired when the system time is equal to the
+ * given param time value.
* @param time A date and time struct that specifies when the system
* should deliver the notification.
* @return Any of the following result codes:
View
23 libs/Wormhole/Libs/Notification/PushNotificationManager.cpp
@@ -144,18 +144,25 @@ namespace Wormhole
sprintf(
data,
- "\\'{\"message\": \"%s\","
+ "{\"message\": %s,"
"\"sound\": \"%s\","
- "\"iconBadge\":\"%d\"}\\'",
- message.c_str(),
+ "\"iconBadge\":\"%d\"}",
+ Encoder::JSONStringify(message.c_str()).c_str(),
sound.c_str(),
iconBadge);
- mMessageHandler->callSuccess(
- mListenerCallBack,
- PHONEGAP_CALLBACK_STATUS_OK,
- data,
- true);
+ String args = "";
+ args += "{";
+ args += "\"status\":" + ((MAUtil::String) PHONEGAP_CALLBACK_STATUS_OK);
+ args += ",\"message\":" + Encoder::JSONStringify(data);
+ args += ",\"keepCallback\":true";
+ args += "}";
+
+ String script = "PhoneGap.CallbackSuccess(";
+ script += "'" + mListenerCallBack + "',";
+ script += Encoder::JSONStringify(args.c_str()) + ")";
+
+ mMessageHandler->callJS(script);
}
/**
View
6 libs/Wormhole/Libs/PhoneGap/PhoneGapFile.cpp
@@ -1689,6 +1689,12 @@ namespace Wormhole
);
}
+ // Deallocate the data object.
+ if (NULL != data)
+ {
+ maDestroyPlaceholder(data);
+ }
+
// Delete the body of the request.
delete mRequestBody;
View
22 runtimes/cpp/platforms/iphone/Classes/MoSyncView.mm
@@ -199,13 +199,27 @@ - (void)deviceOrientationChanged:(NSNotification *)notification {
}
-(void) messageBox:(id) obj {
MessageBoxHandler *mbh = (MessageBoxHandler*) obj;
- UIAlertView *alert = [[UIAlertView alloc]
+ UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:mbh.title
message:mbh.msg
delegate:mbh
cancelButtonTitle:mbh.cancelTitle
- otherButtonTitles:mbh.button1Title, mbh.button2Title, mbh.button3Title, nil];
-
+ otherButtonTitles:nil];
+
+ // Add only valid strings as buttons.
+ if (mbh.button1Title)
+ {
+ [alert addButtonWithTitle:mbh.button1Title];
+ }
+ if (mbh.button2Title)
+ {
+ [alert addButtonWithTitle:mbh.button2Title];
+ }
+ if (mbh.button3Title)
+ {
+ [alert addButtonWithTitle:mbh.button3Title];
+ }
+
[touchHelper clearTouches];
if (mbh.cancelTitle == nil) {
alert.cancelButtonIndex = -1;
@@ -215,7 +229,7 @@ -(void) messageBox:(id) obj {
}
-(void) showMessageBox: (NSString*)msg withTitle: (NSString*)title shouldKill: (bool)kill {
- MessageBoxHandler *mbh = [[MessageBoxHandler alloc] retain];
+ MessageBoxHandler *mbh = [[[MessageBoxHandler alloc] init] autorelease];
mbh.kill = kill;
mbh.title = title;
mbh.msg = msg;
View
20 runtimes/cpp/platforms/iphone/Classes/NativeUI/Syscalls/MoSyncUISyscalls.mm
@@ -382,25 +382,29 @@ int maWidgetSetProperty(MAWidgetHandle handle, const char *property, const char*
IWidget* widget = [mosyncUI getWidget:handle];
if(widget == NULL) return MAW_RES_INVALID_HANDLE;
+ if(property == NULL)
+ return MAW_RES_INVALID_PROPERTY_NAME;
+
+ if(value == NULL)
+ return MAW_RES_INVALID_PROPERTY_VALUE;
+
NSString* propertyString = stringFromChar(property);
if([widget class] == [GLViewWidget class] || [widget class] == [GL2ViewWidget class] ) {
// do this from the MoSync thread. Maybe do a generic system for this later.
- if([propertyString isEqualToString:@"bind"]) {
+ if([propertyString isEqualToString:@"bind"])
+ {
+ [propertyString release];
return [widget setPropertyWithKey:@"bind" toValue:@""];
}
- if([propertyString isEqualToString:@"invalidate"]) {
+ if([propertyString isEqualToString:@"invalidate"])
+ {
+ [propertyString release];
return [widget setPropertyWithKey:@"invalidate" toValue:@""];
}
}
- if(property == NULL)
- return MAW_RES_INVALID_PROPERTY_NAME;
-
- if(value == NULL)
- return MAW_RES_INVALID_PROPERTY_VALUE;
-
int returnValue;
NSString *valueString = stringFromChar(value);
View
3  runtimes/cpp/platforms/iphone/Classes/NativeUI/WidgetUtils/WidgetUtils.h
@@ -34,6 +34,9 @@
return MAW_RES_INVALID_PROPERTY_VALUE; \
}
+// Used for converting milliseconds in seconds.
+#define SECOND 1000.0
+
/**
* Enums for widget size. Since iOS views are using only fixed sizes, the wrap and fill properties
* are custom.
View
2  runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/ButtonWidget.mm
@@ -113,6 +113,7 @@ - (int)setPropertyWithKey:(NSString*)key toValue:(NSString*)value
Surface* imageResource = Base::gSyscall->resources.get_RT_IMAGE(imageHandle);
image = [UIImage imageWithCGImage:imageResource->image];
[button setBackgroundImage:image forState:UIControlStateNormal];
+ [self layout];
}
else
if([key isEqualToString:@MAW_IMAGE_BUTTON_IMAGE]) {
@@ -122,6 +123,7 @@ - (int)setPropertyWithKey:(NSString*)key toValue:(NSString*)value
Surface* imageResource = Base::gSyscall->resources.get_RT_IMAGE(imageHandle);
image = [UIImage imageWithCGImage:imageResource->image];
[button setImage:image forState:UIControlStateNormal];
+ [self layout];
}
else if([key isEqualToString:@"leftCapWidth"]) {
int newLeftCapWidth = [value intValue];
View
7 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/ListViewItemWidget.mm
@@ -248,7 +248,7 @@ -(UITableViewCell*)cell
*/
- (int)addChild:(IWidget*)child
{
- if (_children.count ==0 )
+ if (_children.count == 0 )
{
[super addChild:child toSubview:YES];
}
@@ -437,6 +437,11 @@ -(CGSize)sizeThatFitsForWidget
{
IWidget* child = [_children objectAtIndex:0];
size = child.size;
+ if (child.autoSizeWidth == WidgetAutoSizeFillParent)
+ {
+ size.width = self.width;
+ child.width = self.width;
+ }
}
else if (self.autoSizeHeight != WidgetAutoSizeFixed)
{
View
4 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/VideoViewWidget.mm
@@ -104,7 +104,9 @@ - (int)setPropertyWithKey:(NSString*)key toValue:(NSString*)value
else if ([key isEqualToString:@MAW_VIDEO_VIEW_SEEK_TO])
{
TEST_FOR_NEGATIVE_VALUE([value floatValue]);
- [_moviePlayerController setCurrentPlaybackTime:[value floatValue]];
+ // Value is in milliseconds we we have to convert it to seconds.
+ CGFloat timeInSeconds = [value floatValue] / SECOND;
+ [_moviePlayerController setCurrentPlaybackTime: timeInSeconds];
}
else if ([key isEqualToString:@MAW_VIDEO_VIEW_CONTROL])
{
View
7 runtimes/cpp/platforms/iphone/Classes/NativeUI/Widgets/WebViewWidget.mm
@@ -76,14 +76,15 @@ - (int)setPropertyWithKey: (NSString*)key toValue: (NSString*)value {
{
NSURL *url;
//Process a normal URL
+ //URLs can only be sent over the Internet using the ASCII character-set.
if (schemaLocation.location == NSNotFound) {
NSString *urlString = [NSString stringWithFormat:@"%@%@", baseUrl, value];
- NSString* webURLString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+ NSString* webURLString = [urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
url = [[NSURL URLWithString: webURLString] filePathURL];
} else {
// Convert the string URL into ascii encoding.
- NSData* data = [value dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
- NSString* formattedURL = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ NSData* data = [value dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
+ NSString* formattedURL = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
url = [NSURL URLWithString:formattedURL];
[formattedURL release];
}
View
3  runtimes/cpp/platforms/iphone/Classes/notifications/NotificationManager.mm
@@ -198,10 +198,7 @@ -(int) localNotificationSetProperty:(MAHandle) notificationHandle
}
// Notification fire date must be in GMT + 0:00 format(system time).
- // Received date is using local time.
double seconds = [value doubleValue];
- NSTimeZone* localTimeZone = [NSTimeZone localTimeZone];
- seconds -= [localTimeZone secondsFromGMT];
NSDate* date = [NSDate dateWithTimeIntervalSince1970:seconds];
notification.fireDate = date;
}
View
5 runtimes/csharp/windowsphone/mosync/mosyncRuntime/Source/Modules/NativeUI/MoSyncLabel.cs
@@ -16,6 +16,7 @@
using System.Text.RegularExpressions;
using System.Reflection;
using System.Windows.Media;
+using System.Globalization;
namespace MoSync
{
@@ -207,7 +208,9 @@ public String fontSize
set
{
double size = 0;
- if (double.TryParse(value, out size))
+ NumberStyles style = NumberStyles.AllowDecimalPoint;
+ IFormatProvider provider = CultureInfo.InvariantCulture;
+ if (Double.TryParse(value, style, provider, out size))
{
// for some values better use the default size of the platform
mLabel.FontSize = size <= 0 ? 11 : size;
View
30 ...s/androidJNI/AndroidProject/src/com/mosync/internal/android/notifications/LocalNotificationsManager.java
@@ -100,35 +100,6 @@ public int destroy(int handle)
LocalNotificationObject notification = m_NotificationTable.get(handle);
if ( null != notification )
{
- // Remove the service notification if it is pending.
- if ( notification.isActive() )
- {
- LocalNotificationsService.removeServiceNotification(
- m_NotificationTable.get(handle).getId(),
- mMoSyncThread.getActivity());
-
- // Stop the service, even when the application is in background.
- LocalNotificationsService.stopService();
- }
- // Cancel the intent assigned to the notification if scheduled.
- if ( null != m_Intents.get(handle) )
- {
- AlarmManager alarmManager =
- (AlarmManager) mMoSyncThread.getActivity().getSystemService(Context.ALARM_SERVICE);
-
- // Set the unique request code as the handle.
- PendingIntent pendingIntent = PendingIntent.getBroadcast(
- mMoSyncThread.getActivity(),
- notification.getRequestCode(),
- m_Intents.get(handle),
- PendingIntent.FLAG_NO_CREATE);
- if ( pendingIntent != null )
- {
- alarmManager.cancel(pendingIntent);
- }
- m_Intents.remove(handle);
- }
-
// Remove the internal notification object.
m_NotificationTable.remove(handle);
@@ -296,6 +267,7 @@ public int schedule(final int handle, final Context appContext)
alarmManager.set(AlarmManager.RTC_WAKEUP, notification.getFireDate(), pendingIntent);
m_Intents.put(handle, intent);
+
return MA_NOTIFICATION_RES_OK;
}
}
View
2  runtimes/java/platforms/androidJNI/AndroidProject/src/com/mosync/nativeui/ui/widgets/ListViewSection.java
@@ -185,6 +185,7 @@ public boolean setProperty(String property, String value)
createSegmentedSectionDefaultUI();
break;
case IX_WIDGET.MAW_LIST_VIEW_SECTION_TYPE_ALPHABETICAL:
+ mHasFooter = false;
break;
default:
Log.e("@@MoSync","maWidgetSetProperty invalid List View Section type");
@@ -516,6 +517,7 @@ public void setAlphaSectionFooter(String text)
{
// Create and add the footer after the last item - if that exists.
addSectionFooter();
+ mHasFooter = true;
setFooterText(text);
if (mAdapterListener != null)
mAdapterListener.itemAdded(mItems.get(mItems.size()), this, mItems.size());
View
2  testPrograms/native_ui_lib/MapTest/MainScreen.cpp
@@ -97,7 +97,7 @@ void MainScreen::createMainLayout() {
mMainLayout->addChild(mSetCenterButton);
// create the main map and add it to the main layout
- mMap = new Map("google test credentials", "AsIe6nHOHjIuf9MQS4fW7up92BO6HuCwspKJqYwffZiqUJsgXuLIXeBdCf9EM4yz");
+ mMap = new Map("google test credentials", "AuQ7GMB3AJPFp5GPHbuQ2WVyhQUd9DjYJ6u5aR6a_uXZZdX5KuHJ7XMU4GNvO6mh");
mMap->fillSpaceHorizontally();
mMap->fillSpaceVertically();
View
13 testPrograms/native_ui_lib/MapTest/Readme.txt
@@ -0,0 +1,13 @@
+Purpose:
+The test program shows the native ui map functionality and provides UI elements for doing
+the following:
+ - add/remove multiple random map pins
+ - set/get visible area
+ - set zoom level
+ - center the map
+ - a map control is visible and available for interraction to the user
+
+IMPORTANT:
+ ADD YOU OWN MAP CREDENTIALS INSIDE THE MAP CONSTRUCTOR:
+ MainScreen.cpp:
+ mMap = new Map("google maps test credentials", "bing maps test credentials");
View
9 testPrograms/notification/LocalNotificationSender/ReadMe.txt
@@ -4,10 +4,12 @@ On Android only there are two more texts to set:
- content body title and
- the ticker text.
(Ticker text: the text that flows by in the status bar when the notification first activates.)
+
Next, you can set for iOS only:
- the badge number,
-the alert action (the title of the action button or slider).
- Next the Default Sound can be enabled/disabled.
+
+Next the Default Sound can be enabled/disabled.
Below, settings available only on Android:
- the Vibration settings ( that are available only on Android): By checking the Vibration check box, the default
vibration pattern is applied. If the vibration duration is set, it will be used instead.
@@ -15,14 +17,11 @@ vibration pattern is applied. If the vibration duration is set, it will be used
pattern is applied to the notification. If the pattern is set(by filling the next 3 edit boxes), it will be used instead.
If the flashing is not supported on the device you will get the message "Not available" inside the edit boxes for this settings.
Note that you need to enable the Notification LED lights from device's Settings.
+
The Flashing pattern is consisted of:
- a color, in the format 0xRRGGBB, for instance red: 0xFF0000.
- led on = length of time, in seconds, to keep the light on.
- led off = length of time, in seconds, to keep the light off.
-- The "Show only when in background" setting. This is available only on Android. On iOS the user sees the notification only
-if the application is running in background. On Android this can be configured: by checking this setting the notification
-will be displayed only if the app is running in background. By un-checking it you will get the notification regardless of the
-focus state.
The last setting is the fire date: number of seconds for scheduling.
View
3  tools/idl2/maapi.idl
@@ -5958,9 +5958,12 @@ group NotificationAPI "Notification API" {
/**
* @brief Set the date and time when the system should deliver the notification.
+ * The notification will be fired when the system time is equal to the
+ * given param time value.
*
* @validvalue an int.
* The date is in seconds(UNIX time - seconds elapsed since January 1, 1970).
+ * The value should be given according to device system time.
*
* @setandget
*
Please sign in to comment.
Something went wrong with that request. Please try again.