mirror of
https://github.com/lampaa/com.lampa.startapp.git
synced 2026-05-01 00:00:05 +08:00
Match Double type in string extras
This commit is contained in:
@@ -35,6 +35,7 @@ var sApp = startApp.set({} params [, {} extras]);
|
|||||||
| Param | Description | Default | Values |
|
| Param | Description | Default | Values |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| noParse | Disable find action and category in Intent package | false | Boolean |
|
| noParse | Disable find action and category in Intent package | false | Boolean |
|
||||||
|
| matchDoubleInSting | Match Double type in string extras (usefull for coordinates, prices etc.) | false | Boolean |
|
||||||
| intent | [Intent(String action)](https://developer.android.com/reference/android/content/Intent.html#Intent%28java.lang.String%29) | null | String |
|
| intent | [Intent(String action)](https://developer.android.com/reference/android/content/Intent.html#Intent%28java.lang.String%29) | null | String |
|
||||||
| application | [Intent (Context packageContext)](https://developer.android.com/reference/android/content/Intent.html#Intent%28android.content.Context,%20java.lang.Class%3C?%3E%29) | null | String |
|
| application | [Intent (Context packageContext)](https://developer.android.com/reference/android/content/Intent.html#Intent%28android.content.Context,%20java.lang.Class%3C?%3E%29) | null | String |
|
||||||
| action | [Intent setAction](http://developer.android.com/reference/android/content/Intent.html#setAction(java.lang.String)) | null | String ||
|
| action | [Intent setAction](http://developer.android.com/reference/android/content/Intent.html#setAction(java.lang.String)) | null | String ||
|
||||||
|
|||||||
@@ -61,4 +61,8 @@ public class Assets extends CordovaPlugin {
|
|||||||
|
|
||||||
return field.getInt(null);
|
return field.getInt(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean matchDoubleInSting(String str) {
|
||||||
|
return (Pattern.matches("([0-9]*)\\.([0-9]*)", str));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,9 @@ public class startApp extends Assets {
|
|||||||
LaunchIntent.putExtra(parseExtraName(key), extra.getInt(key));
|
LaunchIntent.putExtra(parseExtraName(key), extra.getInt(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value instanceof String) {
|
if(params.has("matchDoubleInSting") && matchDoubleInSting(extra.getString(key))) {
|
||||||
|
LaunchIntent.putExtra(parseExtraName(key), extra.getDouble(key));
|
||||||
|
} else if(value instanceof String) {
|
||||||
LaunchIntent.putExtra(parseExtraName(key), extra.getString(key));
|
LaunchIntent.putExtra(parseExtraName(key), extra.getString(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user