diff --git a/README.md b/README.md
index 0274c31..0658599 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,9 @@ or ```cordova plugin add https://github.com/Paldom/SpinnerDialog.git```
Add following to config.xml: ``````
or ``````
+## Update 07/04/2015
+Only one spinner dialog can be shown, if there is one yet, text and title will be changed.
+
## Methods
- `window.plugins.spinnerDialog.show`
diff --git a/plugin.xml b/plugin.xml
index dc1137d..692d2e9 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,8 +1,8 @@
+ id="hu.dpal.phonegap.plugins.SpinnerDialog3"
+ version="1.3.21">
SpinnerDialog
diff --git a/src/android/SpinnerDialog.java b/src/android/SpinnerDialog.java
index 41e6352..069663e 100644
--- a/src/android/SpinnerDialog.java
+++ b/src/android/SpinnerDialog.java
@@ -43,16 +43,41 @@ public void onCancel(DialogInterface dialog) {
ProgressDialog dialog;
if (isFixed) {
- dialog = CallbackProgressDialog.show(cordova.getActivity(), title, message, true, false, null, callbackContext);
+ //If there is a progressDialog yet change the text
+ if (!SpinnerDialog.this.spinnerDialogStack.empty()) {
+ dialog = SpinnerDialog.this.spinnerDialogStack.peek();
+ if (title != null) {
+ dialog.setTitle(title);
+ }
+ if (message!=null) {
+ dialog.setMessage(message);
+ }
+ }
+ else{
+ dialog = CallbackProgressDialog.show(cordova.getActivity(), title, message, true, false, null, callbackContext);
+ SpinnerDialog.this.spinnerDialogStack.push(dialog);
+ }
} else {
- dialog = ProgressDialog.show(cordova.getActivity(), title, message, true, true, onCancelListener);
+ //If there is a progressDialog yet change the text
+ if (!SpinnerDialog.this.spinnerDialogStack.empty()) {
+ dialog = SpinnerDialog.this.spinnerDialogStack.peek();
+ if (title != null) {
+ dialog.setTitle(title);
+ }
+ if (message!=null) {
+ dialog.setMessage(message);
+ }
+ }
+ else{
+ dialog = ProgressDialog.show(cordova.getActivity(), title, message, true, true, onCancelListener);
+ SpinnerDialog.this.spinnerDialogStack.push(dialog);
+ }
}
if (title == null && message == null) {
dialog.setContentView(new ProgressBar(cordova.getActivity()));
}
- SpinnerDialog.this.spinnerDialogStack.push(dialog);
}
};
@@ -72,6 +97,7 @@ public void run() {
this.cordova.getActivity().runOnUiThread(runnable);
}
+
return true;
}
diff --git a/src/ios/CDVSpinnerDialog.m b/src/ios/CDVSpinnerDialog.m
index a30dfd0..b549925 100644
--- a/src/ios/CDVSpinnerDialog.m
+++ b/src/ios/CDVSpinnerDialog.m
@@ -29,9 +29,12 @@ @implementation CDVSpinnerDialog
@synthesize messageView = _messageView;
-(CGRect)rectForView {
- if ((NSFoundationVersionNumber <= 1047.25 /* 7.1 */) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
- return CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.height, [UIScreen mainScreen].bounds.size.width);
+ /*UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
+ BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight);
+ if(landscape){
+ return CGRectMake( 0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, [[UIScreen mainScreen]bounds].size.width);
}
+ return CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.width, [UIScreen mainScreen].bounds.size.height);*/
return CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.width, [UIScreen mainScreen].bounds.size.height);
}
@@ -73,15 +76,27 @@ - (UIView *)overlay {
- (void) show:(CDVInvokedUrlCommand*)command {
callbackId = command.callbackId;
-
+
+ //If there is a loading mask yet we hide it
+ //[self hide];
+
title = [command argumentAtIndex:0];
message = [command argumentAtIndex:1];
isFixed = [command argumentAtIndex:2];
-
- UIViewController *rootViewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
-
- [rootViewController.view addSubview:self.overlay];
-
+
+ //Si hay ya un loading cambiamos el texto
+ if (_overlay) {
+ [_messageView setText: message == nil ? title : message];
+ }
+ else{//Si no lo mostramos con un fadding
+ UIViewController *rootViewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
+
+ [self.overlay setAlpha:0.0];
+ [rootViewController.view addSubview:self.overlay];
+ [UIView beginAnimations:nil context:nil];
+ [self.overlay setAlpha:1.0];
+ [UIView commitAnimations];
+ }
}
- (void) hide:(CDVInvokedUrlCommand*)command {