rhodes 3.3.3.beta.1 → 3.3.3.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Manifest.txt +23 -9
- data/Rakefile +13 -2
- data/doc/build.txt +18 -11
- data/doc/device-caps.txt +4 -68
- data/doc/rhom.txt +33 -0
- data/doc/test-log-debug.txt +18 -42
- data/lib/framework/rho/render.rb +1 -1
- data/lib/framework/rho/rho.rb +31 -1
- data/lib/framework/rho/rhocontroller.rb +2 -2
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +4 -0
- data/lib/framework/rholang/localization_simplified.rb +1 -1
- data/lib/framework/rhom/rhom_object_factory.rb +22 -1
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +25 -9
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_extmanager_RhoExtManagerImpl.h +21 -0
- data/platform/android/Rhodes/jni/src/extmanager.cpp +36 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +14 -5
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +5 -0
- data/platform/android/Rhodes/jni/src/signature.cpp +29 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +42 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +61 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +39 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +142 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +15 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +6 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +25 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +15 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +14 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +218 -51
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureProperties.java +94 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +122 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/{WebView.java → IRhoWebView.java} +2 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +4 -0
- data/platform/android/build/RhodesSRC_build.files +8 -1
- data/platform/android/build/android.rake +5 -1
- data/platform/android/build/librhodes_build.files +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +22 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +15 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +4 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +4 -2
- data/platform/bb/build/rhodes_build.files +2 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/PNGEncoder.java +613 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/SignatureCapture.java +314 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +1 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +11 -0
- data/platform/iphone/Classes/Rhodes.m +1 -1
- data/platform/iphone/Classes/Signature/SignatureDelegate.h +5 -1
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +186 -5
- data/platform/iphone/Classes/Signature/SignatureView.h +12 -0
- data/platform/iphone/Classes/Signature/SignatureView.m +11 -3
- data/platform/iphone/Classes/SimpleMainView.m +4 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +98 -3
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/rbuild/iphone.rake +18 -5
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
- data/platform/shared/common/ExtManager.h +64 -9
- data/platform/shared/common/RhoSimConf.h +1 -0
- data/platform/shared/common/RhodesApp.cpp +77 -28
- data/platform/shared/common/RhodesApp.h +9 -4
- data/platform/shared/common/RhodesAppBase.cpp +4 -3
- data/platform/shared/common/RhodesAppBase.h +5 -3
- data/platform/shared/net/HttpServer.cpp +4 -4
- data/platform/shared/net/HttpServer.h +2 -2
- data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +1 -1
- data/platform/shared/qt/rhodes/main.cpp +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +12 -2
- data/platform/shared/ruby/ext/rho/rhosupport.c +11 -1
- data/platform/shared/ruby/thread_win32.c +2 -1
- data/platform/shared/rubyext/System.cpp +6 -0
- data/platform/shared/sync/SyncSource.cpp +15 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +0 -4
- data/platform/wm/build/build_inf.js +34 -4
- data/platform/wm/build/wm.rake +75 -25
- data/platform/wm/rhodes/AppManager.cpp +14 -3
- data/platform/wm/rhodes/IBrowserEngine.h +7 -0
- data/platform/wm/rhodes/IEBrowserEngine.cpp +43 -0
- data/platform/wm/rhodes/IEBrowserEngine.h +7 -0
- data/platform/wm/rhodes/LogOptionsDlg.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +92 -7
- data/platform/wm/rhodes/MainWindow.h +28 -1
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -4
- data/platform/wm/rhodes/Rhodes.cpp +149 -10
- data/platform/wm/rhodes/resource.h +5 -1
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +307 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +14 -2
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +6 -3
- data/platform/wm/rhodes/rhodes.vcproj +5 -1
- data/platform/wm/rhodes/simulator/MainWindowQt.cpp +22 -1
- data/platform/wm/rhodes/simulator/MainWindowQt.h +4 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +1 -1
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +1 -1
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +33 -38
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +134 -29
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +12 -2
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +17 -1
- data/platform/wp7/RhoRubyLib/views/RhoTabHeader.xaml +3 -3
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +48 -8
- data/rakefile.rb +13 -2
- data/res/build-tools/iphonesim/build/Release/iphonesim_43 +0 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +158 -0
- data/res/generators/rhogen.rb +33 -28
- data/res/generators/templates/application/app/layout.erb +6 -5
- data/res/generators/templates/application/public/css/android.css +21 -315
- data/res/generators/templates/application/public/css/iphone.css +1 -499
- data/res/generators/templates/application/public/css/jqmobile-patch.css +18 -5
- data/res/generators/templates/application/public/css/windows_phone7.css +378 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.css → jquery.mobile-1.0.1.css} +33 -11
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.js → jquery.mobile-1.0.1.js} +249 -125
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.css +2 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.js +177 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile.structure-1.0.css → jquery.mobile.structure-1.0.1.css} +33 -11
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.1.min.css +2 -0
- data/res/generators/templates/application/public/jquery/jquery.json-2.3.js +193 -0
- data/res/generators/templates/application/public/jquery/jquery.json-2.3.min.js +23 -0
- data/res/generators/templates/application/public/js/jquery-wp7-patch.js +68 -20
- data/spec/phone_spec/app/Case/case.rb +22 -0
- data/spec/phone_spec/app/Customer/customer.rb +16 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +108 -11
- data/spec/phone_spec/app/spec/syncengine_spec.rb +43 -1
- data/spec/phone_spec/build.yml +2 -1
- data/version +1 -1
- metadata +27 -13
- data/platform/shared/common/ExtManager.cpp +0 -103
- data/res/generators/templates/application/public/jqmobile/jquery-mobile-iphone.css +0 -9
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +0 -2
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +0 -172
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +0 -2
@@ -37,7 +37,7 @@ import com.rhomobile.rhodes.RhodesActivity;
|
|
37
37
|
import com.rhomobile.rhodes.RhodesApplication;
|
38
38
|
import com.rhomobile.rhodes.util.PerformOnUiThread;
|
39
39
|
import com.rhomobile.rhodes.webview.GoogleWebView;
|
40
|
-
import com.rhomobile.rhodes.webview.
|
40
|
+
import com.rhomobile.rhodes.webview.IRhoWebView;
|
41
41
|
|
42
42
|
import android.content.Context;
|
43
43
|
import android.content.res.AssetManager;
|
@@ -57,7 +57,7 @@ public class SplashScreen implements MainView {
|
|
57
57
|
|
58
58
|
private FrameLayout mView;
|
59
59
|
|
60
|
-
private
|
60
|
+
private IRhoWebView mWebView;
|
61
61
|
|
62
62
|
private native void nativeStart();
|
63
63
|
private native void nativeHide();
|
@@ -74,7 +74,7 @@ public class SplashScreen implements MainView {
|
|
74
74
|
mFirstNavigate = true;
|
75
75
|
}
|
76
76
|
|
77
|
-
private
|
77
|
+
private IRhoWebView createHtmlView(RhodesActivity context, AssetManager am) {
|
78
78
|
|
79
79
|
int type = 0;
|
80
80
|
final String[][] urls = {{LOADING_ANDROID_PNG, LOADING_PNG}, {LOADING_PAGE}};
|
@@ -103,12 +103,12 @@ public class SplashScreen implements MainView {
|
|
103
103
|
}
|
104
104
|
|
105
105
|
// Now create WebView and load appropriate content there
|
106
|
-
|
106
|
+
IRhoWebView view = null;//new GoogleWebView(context);
|
107
107
|
if (Capabilities.WEBKIT_BROWSER_ENABLED) {
|
108
108
|
Logger.D(TAG, "Creating Motorola WebKIT view");
|
109
109
|
try {
|
110
|
-
Class<? extends
|
111
|
-
Constructor<? extends
|
110
|
+
Class<? extends IRhoWebView> viewClass = (Class<? extends IRhoWebView>)Class.forName("com.rhomobile.rhodes.webview.EkiohWebView");
|
111
|
+
Constructor<? extends IRhoWebView> viewCtor = viewClass.getConstructor(Context.class, Runnable.class);
|
112
112
|
view = viewCtor.newInstance(context, RhodesApplication.AppState.AppStarted.addObserver("MotorolaStartEngineObserver", true));
|
113
113
|
} catch (Throwable e) {
|
114
114
|
Logger.E(TAG, e);
|
@@ -151,7 +151,7 @@ public class SplashScreen implements MainView {
|
|
151
151
|
}
|
152
152
|
|
153
153
|
@Override
|
154
|
-
public
|
154
|
+
public IRhoWebView getWebView(int index) {
|
155
155
|
return mWebView;
|
156
156
|
}
|
157
157
|
|
@@ -195,8 +195,8 @@ public class SplashScreen implements MainView {
|
|
195
195
|
}
|
196
196
|
|
197
197
|
@Override
|
198
|
-
public
|
199
|
-
|
198
|
+
public IRhoWebView detachWebView() {
|
199
|
+
IRhoWebView v = null;
|
200
200
|
if (mWebView != null) {
|
201
201
|
mView.removeView(mWebView.getView());
|
202
202
|
v = mWebView;
|
@@ -244,4 +244,10 @@ public class SplashScreen implements MainView {
|
|
244
244
|
@Override
|
245
245
|
public void removeNavBar() {
|
246
246
|
}
|
247
|
+
@Override
|
248
|
+
public void executeJS(String js, int index) {
|
249
|
+
}
|
250
|
+
@Override
|
251
|
+
public void stopNavigate(int index) {
|
252
|
+
}
|
247
253
|
}
|
@@ -34,7 +34,7 @@ import com.rhomobile.rhodes.RhodesActivity;
|
|
34
34
|
import com.rhomobile.rhodes.RhodesService;
|
35
35
|
import com.rhomobile.rhodes.file.RhoFileApi;
|
36
36
|
import com.rhomobile.rhodes.util.ContextFactory;
|
37
|
-
import com.rhomobile.rhodes.webview.
|
37
|
+
import com.rhomobile.rhodes.webview.IRhoWebView;
|
38
38
|
|
39
39
|
import android.content.Context;
|
40
40
|
import android.graphics.Bitmap;
|
@@ -613,7 +613,7 @@ public class TabbedMainView implements MainView {
|
|
613
613
|
RhodesService r = RhodesService.getInstance();
|
614
614
|
MainView mainView = r.getMainView();
|
615
615
|
action = mainView.currentLocation(-1);
|
616
|
-
|
616
|
+
IRhoWebView webView = mainView.detachWebView();
|
617
617
|
view = new SimpleMainView(webView);
|
618
618
|
}
|
619
619
|
if (view == null) {
|
@@ -829,7 +829,7 @@ public class TabbedMainView implements MainView {
|
|
829
829
|
data.loaded = false;
|
830
830
|
}
|
831
831
|
if (i != tabIndex) {
|
832
|
-
|
832
|
+
IRhoWebView wv = getWebView(i);
|
833
833
|
wv.clear();
|
834
834
|
}
|
835
835
|
}
|
@@ -851,12 +851,12 @@ public class TabbedMainView implements MainView {
|
|
851
851
|
}
|
852
852
|
|
853
853
|
@Override
|
854
|
-
public
|
854
|
+
public IRhoWebView getWebView(int tab_index) {
|
855
855
|
return getTabMainView(tab_index).getWebView(-1);
|
856
856
|
}
|
857
857
|
|
858
858
|
@Override
|
859
|
-
public
|
859
|
+
public IRhoWebView detachWebView() {
|
860
860
|
return getTabMainView(activeTab()).detachWebView();
|
861
861
|
}
|
862
862
|
|
@@ -913,4 +913,14 @@ public class TabbedMainView implements MainView {
|
|
913
913
|
return tabData.size();
|
914
914
|
}
|
915
915
|
|
916
|
+
@Override
|
917
|
+
public void executeJS(String js, int index) {
|
918
|
+
getTabMainView(index).executeJS(js, 0);
|
919
|
+
}
|
920
|
+
|
921
|
+
@Override
|
922
|
+
public void stopNavigate(int index) {
|
923
|
+
getTabMainView(index).stopNavigate(0);
|
924
|
+
}
|
925
|
+
|
916
926
|
}
|
@@ -28,7 +28,7 @@ package com.rhomobile.rhodes.nativeview;
|
|
28
28
|
|
29
29
|
import android.view.View;
|
30
30
|
import com.rhomobile.rhodes.RhodesService;
|
31
|
-
import com.rhomobile.rhodes.webview.
|
31
|
+
import com.rhomobile.rhodes.webview.IRhoWebView;
|
32
32
|
|
33
33
|
public class RhoNativeViewManager {
|
34
34
|
|
@@ -65,8 +65,8 @@ public class RhoNativeViewManager {
|
|
65
65
|
private long mViewHandle;
|
66
66
|
}
|
67
67
|
|
68
|
-
public static WebView getWebViewObject(int tab_index) {
|
69
|
-
return RhodesService.getInstance().getMainView().getWebView(tab_index);
|
68
|
+
public static android.webkit.WebView getWebViewObject(int tab_index) {
|
69
|
+
return (android.webkit.WebView)RhodesService.getInstance().getMainView().getWebView(tab_index).getView();
|
70
70
|
}
|
71
71
|
|
72
72
|
public static RhoNativeView getNativeViewByteType(String typename) {
|
@@ -56,7 +56,7 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
56
56
|
private String callbackUrl;
|
57
57
|
private String imageFormat;
|
58
58
|
|
59
|
-
private SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS");
|
59
|
+
private static SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS");
|
60
60
|
|
61
61
|
private SignatureView surfaceView;
|
62
62
|
private SurfaceHolder surfaceHolder;
|
@@ -70,7 +70,7 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
70
70
|
//Logger.D(TAG, "$$$$$$$$$$$$$$$$$$$$$$$$ onCreate");
|
71
71
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
72
72
|
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
73
|
-
getWindow().setFormat(PixelFormat.TRANSLUCENT);
|
73
|
+
//getWindow().setFormat(PixelFormat.TRANSLUCENT);
|
74
74
|
setContentView(AndroidR.layout.signature);
|
75
75
|
|
76
76
|
Bundle extras = getIntent().getExtras();
|
@@ -91,7 +91,9 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
91
91
|
int penColor = extras.getInt(com.rhomobile.rhodes.signature.Signature.INTENT_EXTRA_PREFIX + "penColor");
|
92
92
|
float penWidth = extras.getFloat(com.rhomobile.rhodes.signature.Signature.INTENT_EXTRA_PREFIX + "penWidth");
|
93
93
|
int bgColor = extras.getInt(com.rhomobile.rhodes.signature.Signature.INTENT_EXTRA_PREFIX + "bgColor");
|
94
|
-
surfaceView.
|
94
|
+
surfaceView.isTransparency = false;
|
95
|
+
surfaceView.setupView(penColor | 0xFF000000, penWidth, bgColor | 0xFF000000);
|
96
|
+
surfaceView.invalidate();
|
95
97
|
}
|
96
98
|
|
97
99
|
@Override
|
@@ -141,13 +143,12 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
141
143
|
}
|
142
144
|
|
143
145
|
|
144
|
-
|
145
|
-
private void takeSignature() {
|
146
|
+
public static void takeSignature(String callback, String imgFormat, Bitmap bitmap) {
|
146
147
|
try {
|
147
148
|
String file_ext = "jpg";
|
148
149
|
String file_type = "image/jpeg";
|
149
150
|
Bitmap.CompressFormat compress_format = Bitmap.CompressFormat.JPEG;
|
150
|
-
if (
|
151
|
+
if (imgFormat.equals("png")) {
|
151
152
|
file_ext = "png";
|
152
153
|
file_type = "image/png";
|
153
154
|
compress_format = Bitmap.CompressFormat.PNG;
|
@@ -168,7 +169,7 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
168
169
|
String filePath = dir + "/" + filename + "." + file_ext;
|
169
170
|
OutputStream osOwn = new FileOutputStream(filePath);
|
170
171
|
|
171
|
-
Bitmap bitmap = surfaceView.makeBitmap();
|
172
|
+
//Bitmap bitmap = surfaceView.makeBitmap();
|
172
173
|
|
173
174
|
//bitmap.compress(compress_format, 100, osCommon);
|
174
175
|
//osCommon.flush();
|
@@ -178,11 +179,16 @@ public class ImageCapture extends BaseActivity implements OnClickListener
|
|
178
179
|
osOwn.flush();
|
179
180
|
osOwn.close();
|
180
181
|
|
181
|
-
Signature.doCallback(
|
182
|
+
Signature.doCallback(callback, filePath);
|
182
183
|
} catch (Exception ex) {
|
183
184
|
Logger.E(TAG, ex.getMessage());
|
184
185
|
}
|
185
186
|
|
187
|
+
|
188
|
+
}
|
189
|
+
|
190
|
+
private void takeSignature() {
|
191
|
+
takeSignature(callbackUrl, imageFormat, surfaceView.makeBitmap());
|
186
192
|
}
|
187
193
|
|
188
194
|
|
@@ -27,25 +27,51 @@
|
|
27
27
|
package com.rhomobile.rhodes.signature;
|
28
28
|
|
29
29
|
import java.io.File;
|
30
|
+
import java.util.Enumeration;
|
30
31
|
import java.util.Map;
|
31
32
|
import java.util.Vector;
|
32
33
|
|
33
34
|
import android.content.Intent;
|
35
|
+
import android.text.method.HideReturnsTransformationMethod;
|
36
|
+
import android.view.View;
|
37
|
+
import android.view.ViewGroup;
|
38
|
+
import android.webkit.WebView;
|
39
|
+
import android.widget.AbsoluteLayout;
|
34
40
|
|
35
41
|
import com.rhomobile.rhodes.Logger;
|
36
42
|
import com.rhomobile.rhodes.RhodesActivity;
|
37
43
|
import com.rhomobile.rhodes.RhodesAppOptions;
|
38
44
|
import com.rhomobile.rhodes.RhodesService;
|
45
|
+
import com.rhomobile.rhodes.extmanager.IRhoExtension;
|
46
|
+
import com.rhomobile.rhodes.util.ContextFactory;
|
39
47
|
import com.rhomobile.rhodes.util.PerformOnUiThread;
|
48
|
+
import com.rhomobile.rhodes.util.Utils;
|
40
49
|
|
41
|
-
|
50
|
+
import com.rhomobile.rhodes.extmanager.IRhoExtData;
|
51
|
+
import com.rhomobile.rhodes.extmanager.IRhoExtension;
|
52
|
+
import com.rhomobile.rhodes.extmanager.IRhoExtManager;
|
53
|
+
import com.rhomobile.rhodes.extmanager.RhoExtManagerSingleton;
|
42
54
|
|
43
|
-
|
55
|
+
public class Signature implements IRhoExtension {
|
56
|
+
|
57
|
+
static final String TAG = "Signature";
|
44
58
|
|
45
59
|
public static final String INTENT_EXTRA_PREFIX = RhodesService.INTENT_EXTRA_PREFIX + "signature.";
|
46
60
|
|
47
|
-
private static
|
48
|
-
|
61
|
+
private static final String SIGNATURE_EXT = "signature_ext";
|
62
|
+
|
63
|
+
private static SignatureView ourInlineSignatureView = null;
|
64
|
+
|
65
|
+
private static Signature ourInstance = null;
|
66
|
+
|
67
|
+
public SignatureProperties mProperties = null;
|
68
|
+
|
69
|
+
private static final boolean ENABLE_LOGGING = true;
|
70
|
+
|
71
|
+
public static void reportMsg(String msg) {
|
72
|
+
if (ENABLE_LOGGING) {
|
73
|
+
Utils.platformLog("SignatureCapture", msg);
|
74
|
+
}
|
49
75
|
}
|
50
76
|
|
51
77
|
private static void init() {
|
@@ -55,71 +81,56 @@ public class Signature {
|
|
55
81
|
}
|
56
82
|
|
57
83
|
private static class Picture implements Runnable {
|
58
|
-
private String url;
|
59
84
|
private Class<?> klass;
|
60
|
-
private String imageFormat;
|
61
|
-
private int penColor;
|
62
|
-
private float penWidth;
|
63
|
-
private int bgColor;
|
64
85
|
|
65
|
-
public Picture(
|
66
|
-
url = u;
|
86
|
+
public Picture(Class<?> c) {
|
67
87
|
klass = c;
|
68
|
-
imageFormat = _imageFormat;
|
69
|
-
penColor = _penColor;
|
70
|
-
penWidth = _penWidth;
|
71
|
-
bgColor = _bgColor;
|
72
88
|
}
|
73
89
|
|
74
90
|
public void run() {
|
75
91
|
init();
|
76
92
|
RhodesActivity ra = RhodesActivity.getInstance();
|
77
93
|
Intent intent = new Intent(ra, klass);
|
78
|
-
intent.putExtra(INTENT_EXTRA_PREFIX + "callback",
|
79
|
-
intent.putExtra(INTENT_EXTRA_PREFIX + "imageFormat", imageFormat);
|
80
|
-
intent.putExtra(INTENT_EXTRA_PREFIX + "penColor", penColor);
|
81
|
-
intent.putExtra(INTENT_EXTRA_PREFIX + "penWidth", penWidth);
|
82
|
-
intent.putExtra(INTENT_EXTRA_PREFIX + "bgColor", bgColor);
|
94
|
+
intent.putExtra(INTENT_EXTRA_PREFIX + "callback", getSharedInstance().mProperties.callbackUrl);
|
95
|
+
intent.putExtra(INTENT_EXTRA_PREFIX + "imageFormat", getSharedInstance().mProperties.imageFormat);
|
96
|
+
intent.putExtra(INTENT_EXTRA_PREFIX + "penColor", getSharedInstance().mProperties.penColor);
|
97
|
+
intent.putExtra(INTENT_EXTRA_PREFIX + "penWidth", getSharedInstance().mProperties.penWidth);
|
98
|
+
intent.putExtra(INTENT_EXTRA_PREFIX + "bgColor", getSharedInstance().mProperties.bgColor);
|
83
99
|
ra.startActivity(intent);
|
84
100
|
}
|
85
101
|
};
|
86
102
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
if (params instanceof Map<?,?>) {
|
95
|
-
Map<Object,Object> settings = (Map<Object,Object>)params;
|
96
|
-
|
97
|
-
Object imgFrmtObj = settings.get("imageFormat");
|
98
|
-
if ((imgFrmtObj != null) && (imgFrmtObj instanceof String)) {
|
99
|
-
imageFormat = new String(((String)imgFrmtObj));
|
100
|
-
}
|
101
|
-
|
102
|
-
Object penColorObj = settings.get("penColor");
|
103
|
-
if ((penColorObj != null) && (penColorObj instanceof String)) {
|
104
|
-
penColor = Integer.parseInt((String)penColorObj) | 0xFF000000;
|
105
|
-
}
|
106
|
-
|
107
|
-
Object penWidthObj = settings.get("penWidth");
|
108
|
-
if ((penWidthObj != null) && (penWidthObj instanceof String)) {
|
109
|
-
penWidth = Float.parseFloat((String)penWidthObj);
|
110
|
-
}
|
103
|
+
private static void processParams(Object params) {
|
104
|
+
if (params == null) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
if (params instanceof Map<?,?>) {
|
108
|
+
Map<Object,Object> settings = (Map<Object,Object>)params;
|
111
109
|
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
int prop_count = SignatureProperties.PROPERTIES_LIST.length;
|
111
|
+
int i;
|
112
|
+
for (i = 0; i < prop_count; i++) {
|
113
|
+
String prop_name = SignatureProperties.PROPERTIES_LIST[i];
|
114
|
+
Object valueObj = settings.get(prop_name);
|
115
|
+
if (valueObj != null) {
|
116
|
+
getSharedInstance().mProperties.setPropertyByName(prop_name, new String(((String)valueObj)));
|
115
117
|
}
|
116
118
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
public static void takeSignature(String url, Object params) {
|
124
|
+
try {
|
125
|
+
processParams(params);
|
126
|
+
getSharedInstance().mProperties.penColor = getSharedInstance().mProperties.penColor | 0xFF000000;
|
127
|
+
getSharedInstance().mProperties.bgColor = getSharedInstance().mProperties.bgColor | 0xFF000000;
|
128
|
+
getSharedInstance().mProperties.setPropertyByName(SignatureProperties.CALLBACK, url);
|
129
|
+
Runnable runnable = new Picture(ImageCapture.class);
|
130
|
+
PerformOnUiThread.exec(runnable);
|
120
131
|
}
|
121
132
|
catch (Exception e) {
|
122
|
-
|
133
|
+
Logger.E(TAG, e);
|
123
134
|
}
|
124
135
|
}
|
125
136
|
|
@@ -132,6 +143,162 @@ public class Signature {
|
|
132
143
|
callback(callbackUrl, fp, "", fp.length() == 0);
|
133
144
|
}
|
134
145
|
|
146
|
+
public static void inline_signature_visible(int visible, Object params) {
|
147
|
+
if (visible == 0) {
|
148
|
+
inline_signature_hide();
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
|
152
|
+
processParams(params);
|
153
|
+
|
154
|
+
PerformOnUiThread.exec( new Runnable () {
|
155
|
+
public void run() {
|
156
|
+
reportMsg(" $$$ Start make of Signature View");
|
157
|
+
|
158
|
+
ViewGroup wv = (WebView)RhodesService.getInstance().getMainView().getWebView(-1).getView();
|
159
|
+
if ((wv != null) && (ourInlineSignatureView != null)) {
|
160
|
+
wv.removeView(ourInlineSignatureView);
|
161
|
+
ourInlineSignatureView = null;
|
162
|
+
}
|
163
|
+
|
164
|
+
ourInlineSignatureView = new SignatureView(ContextFactory.getUiContext(), null);
|
165
|
+
|
166
|
+
{
|
167
|
+
if ((getSharedInstance().mProperties.bgColor & 0xFF000000) != 0xFF000000) {
|
168
|
+
//ourInlineSignatureView.setVisibility(View.INVISIBLE);
|
169
|
+
ourInlineSignatureView.isTransparency = true;
|
170
|
+
}
|
171
|
+
ourInlineSignatureView.setupView( getSharedInstance().mProperties.penColor,
|
172
|
+
getSharedInstance().mProperties.penWidth,
|
173
|
+
getSharedInstance().mProperties.bgColor);
|
174
|
+
ourInlineSignatureView.setLayoutParams(
|
175
|
+
new AbsoluteLayout.LayoutParams( getSharedInstance().mProperties.width,
|
176
|
+
getSharedInstance().mProperties.height,
|
177
|
+
getSharedInstance().mProperties.left,
|
178
|
+
getSharedInstance().mProperties.top));
|
179
|
+
|
180
|
+
}
|
181
|
+
|
182
|
+
wv.addView(ourInlineSignatureView);
|
183
|
+
wv.bringChildToFront(ourInlineSignatureView);
|
184
|
+
ourInlineSignatureView.requestFocus();
|
185
|
+
ourInlineSignatureView.bringToFront();
|
186
|
+
ourInlineSignatureView.invalidate();
|
187
|
+
|
188
|
+
//wv.invalidate();
|
189
|
+
|
190
|
+
reportMsg(" $$$ Finish make of Signature View");
|
191
|
+
}
|
192
|
+
});
|
193
|
+
}
|
194
|
+
|
195
|
+
public static void inline_signature_capture(String callback_url) {
|
196
|
+
if (ourInlineSignatureView != null) {
|
197
|
+
ImageCapture.takeSignature(callback_url, getSharedInstance().mProperties.imageFormat, ourInlineSignatureView.makeBitmap());
|
198
|
+
}
|
199
|
+
inline_signature_hide();
|
200
|
+
}
|
201
|
+
|
202
|
+
public static void inline_signature_clear() {
|
203
|
+
PerformOnUiThread.exec( new Runnable () {
|
204
|
+
public void run() {
|
205
|
+
if (ourInlineSignatureView != null) {
|
206
|
+
ourInlineSignatureView.doClear();
|
207
|
+
//RhodesService.getInstance().getMainView().getWebView(-1).getView().invalidate();
|
208
|
+
//ViewGroup wv = (WebView)RhodesService.getInstance().getMainView().getWebView(-1).getView();
|
209
|
+
//if (wv != null) {
|
210
|
+
// wv.invalidate();
|
211
|
+
//}
|
212
|
+
|
213
|
+
}
|
214
|
+
}
|
215
|
+
});
|
216
|
+
}
|
217
|
+
|
218
|
+
public static void inline_signature_hide() {
|
219
|
+
PerformOnUiThread.exec( new Runnable () {
|
220
|
+
public void run() {
|
221
|
+
ViewGroup wv = (WebView)RhodesService.getInstance().getMainView().getWebView(-1).getView();
|
222
|
+
if ((wv != null) && (ourInlineSignatureView != null)) {
|
223
|
+
wv.removeView(ourInlineSignatureView);
|
224
|
+
ourInlineSignatureView = null;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
});
|
228
|
+
}
|
229
|
+
|
230
|
+
@Override
|
231
|
+
public void onBeforeNavigate(String url, IRhoExtData data) {
|
232
|
+
inline_signature_hide();
|
233
|
+
}
|
234
|
+
|
235
|
+
public void onSetProperty(String name, String value, IRhoExtData data) {
|
236
|
+
if ((name == null) || (value == null)) {
|
237
|
+
return;
|
238
|
+
}
|
239
|
+
mProperties.setPropertyByName(name, value);
|
240
|
+
if ("Visibility".equalsIgnoreCase(name)) {
|
241
|
+
if ("Visible".equalsIgnoreCase(value)) {
|
242
|
+
// show
|
243
|
+
inline_signature_visible(1, null);
|
244
|
+
}
|
245
|
+
else {
|
246
|
+
// hide;
|
247
|
+
inline_signature_hide();
|
248
|
+
}
|
249
|
+
}
|
250
|
+
else if ("Clear".equalsIgnoreCase(name)) {
|
251
|
+
// clear
|
252
|
+
inline_signature_clear();
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
public static Signature getSharedInstance() {
|
257
|
+
if (ourInstance == null) {
|
258
|
+
ourInstance = new Signature();
|
259
|
+
ourInstance.mProperties = new SignatureProperties();
|
260
|
+
}
|
261
|
+
return ourInstance;
|
262
|
+
}
|
263
|
+
|
264
|
+
public static void registerSignatureCaptureExtension() {
|
265
|
+
RhoExtManagerSingleton.getRhoExtManagerInstance().registerExtension(SIGNATURE_EXT, getSharedInstance());
|
266
|
+
}
|
267
|
+
|
135
268
|
public static native void callback(String callbackUrl, String filePath, String error, boolean cancelled);
|
136
269
|
|
270
|
+
@Override
|
271
|
+
public void onSetPropertiesData(String propId, String data, IRhoExtData ext) {
|
272
|
+
// Nothing
|
273
|
+
}
|
274
|
+
|
275
|
+
@Override
|
276
|
+
public void onNavigateComplete(String urlBeingNavigatedTo, IRhoExtData ext) {
|
277
|
+
}
|
278
|
+
|
279
|
+
@Override
|
280
|
+
public void onDocumentComplete(String urlOfDocument, IRhoExtData ext) {
|
281
|
+
}
|
282
|
+
|
283
|
+
@Override
|
284
|
+
public long onNavigateTimeout(String urlBeingNavigatedTo, IRhoExtData ext) {
|
285
|
+
// TODO Auto-generated method stub
|
286
|
+
return 0;
|
287
|
+
}
|
288
|
+
|
289
|
+
@Override
|
290
|
+
public long onSIPState(boolean bSIPState, IRhoExtData ext) {
|
291
|
+
return 0;
|
292
|
+
}
|
293
|
+
|
294
|
+
@Override
|
295
|
+
public long onNavigateError(String urlBeingNavigatedTo, IRhoExtData ext) {
|
296
|
+
return 0;
|
297
|
+
}
|
298
|
+
|
299
|
+
@Override
|
300
|
+
public void onAppActivate(boolean bActivate, IRhoExtData ext) {
|
301
|
+
}
|
137
302
|
}
|
303
|
+
|
304
|
+
|