rhodes 3.3.3.beta.3 → 3.3.3.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Manifest.txt +16 -1
  2. data/Rakefile +77 -28
  3. data/doc/build.txt +5 -3
  4. data/doc/configuration.txt +13 -0
  5. data/doc/device-caps.txt +46 -27
  6. data/doc/rhom.txt +2 -2
  7. data/doc/test-log-debug.txt +6 -0
  8. data/doc/ui.txt +13 -0
  9. data/lib/build/jake.rb +11 -11
  10. data/lib/extensions/crypt/crypt/cbc.rb +5 -2
  11. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
  12. data/lib/framework/rho/render.rb +17 -4
  13. data/lib/framework/rho/rho.rb +1 -1
  14. data/lib/framework/rho/rhocontroller.rb +11 -1
  15. data/lib/framework/rhomotoapi.rb +110 -0
  16. data/platform/android/Rhodes/jni/Android.mk +2 -5
  17. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  18. data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
  19. data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
  21. data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
  22. data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
  23. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
  24. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
  25. data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
  26. data/platform/android/Rhodes/rhobundle.xml +1 -1
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
  44. data/platform/android/build/RhodesSRC_build.files +2 -1
  45. data/platform/android/build/android.rake +48 -17
  46. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
  47. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
  48. data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
  49. data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
  50. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  51. data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
  52. data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
  53. data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
  54. data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
  55. data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
  56. data/platform/iphone/Classes/RhoMainView.h +2 -0
  57. data/platform/iphone/Classes/Rhodes.m +11 -5
  58. data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
  59. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
  60. data/platform/iphone/Classes/SimpleMainView.m +3 -0
  61. data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
  62. data/platform/iphone/Classes/TabbedMainView.m +30 -11
  63. data/platform/iphone/rbuild/iphone.rake +7 -1
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
  65. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  66. data/platform/shared/common/BundleManager.cpp +42 -2
  67. data/platform/shared/common/ExtManager.h +7 -0
  68. data/platform/shared/common/RhoFile.cpp +170 -2
  69. data/platform/shared/common/RhoFile.h +4 -0
  70. data/platform/shared/common/RhodesApp.cpp +30 -0
  71. data/platform/shared/common/RhodesApp.h +1 -0
  72. data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
  73. data/platform/shared/common/map/OSMMapEngine.h +3 -0
  74. data/platform/shared/logging/RhoLogConf.cpp +8 -9
  75. data/platform/shared/logging/RhoLogConf.h +5 -7
  76. data/platform/shared/logging/RhoLogSink.cpp +3 -3
  77. data/platform/shared/logging/RhoLogSink.h +1 -1
  78. data/platform/shared/net/HttpServer.cpp +17 -9
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  81. data/platform/shared/ruby/ext/webview/webview.i +9 -4
  82. data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
  83. data/platform/shared/test/Tests.cpp +2 -2
  84. data/platform/wm/build/build_inf.js +75 -47
  85. data/platform/wm/build/wm.rake +50 -53
  86. data/platform/wm/rhodes/Rhodes.cpp +40 -97
  87. data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
  88. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
  89. data/platform/wm/tools/detool/detool.cpp +103 -52
  90. data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
  91. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  92. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
  93. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
  94. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
  95. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
  96. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
  97. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
  98. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
  99. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
  100. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
  101. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
  102. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
  103. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  104. data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
  105. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
  106. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
  107. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
  108. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
  109. data/platform/wp7/rhodes/App.xaml.cs +1 -0
  110. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
  111. data/platform/wp7/rhodes/Rhodes.csproj +5 -1
  112. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
  113. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
  114. data/rakefile.rb +77 -28
  115. data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
  116. data/res/build-tools/YUICompressorLicense.txt +54 -0
  117. data/res/build-tools/detool.exe +0 -0
  118. data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
  119. data/res/generators/templates/application/app/layout.erb +1 -0
  120. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
  121. data/res/generators/templates/application/public/js/syncengine.js +147 -0
  122. data/spec/phone_spec/app/Data/septest.json +1 -1
  123. data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
  124. data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
  125. data/spec/phone_spec/app/spec/date_spec.rb +6 -6
  126. data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
  127. data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
  128. data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
  129. data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
  130. data/spec/phone_spec/app/spec_runner.rb +9 -10
  131. data/version +1 -1
  132. metadata +20 -5
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -1,6 +1,8 @@
1
1
  package com.rhomobile.rhodes.extmanager;
2
2
 
3
+ import android.view.View;
4
+
3
5
  public interface IRhoExtData {
4
-
6
+ View getWebView();
5
7
  int getTabIndex();
6
8
  }
@@ -5,23 +5,37 @@ import android.view.View;
5
5
  public interface IRhoExtManager {
6
6
 
7
7
  void registerExtension(String strName, IRhoExtension ext);
8
-
9
8
  IRhoExtension getExtByName(String strName);
10
9
 
10
+ /**
11
+ * Web view getter. In case of Motorola WebKit is used it returns object which may be directly casted to NeonEkihView
12
+ * @return Current web view instance from MainView
13
+ */
11
14
  View getWebView();
15
+
16
+ /**
17
+ * RhodesActivity top level View getter
18
+ * @return RhodesActivity top level View
19
+ */
12
20
  View getTopView();
13
-
14
- void onBeforeNavigate(String url);
15
-
16
- void onUnhandledProperty(String pModuleName,String pName,String pValue, IRhoExtData ext);
17
- void executeRubyCallback(String szCallback,String szCallbackBody,String szCallbackData, boolean waitForResponse);
21
+
22
+ /**
23
+ *
24
+ * @param name - build configuration item name
25
+ * @return build configuration item value
26
+ */
27
+ String getBuildConfigItem(String name);
28
+
29
+ void onUnhandledProperty(String moduleName,String name,String value, IRhoExtData ext);
30
+ void executeRubyCallback(String callback,String callbackBody,String callbackData, boolean waitForResponse);
31
+ void executeRubyCallbackWithJsonBody(String szCallback, String callbackBody, String callbackData, boolean waitForResponse);
18
32
  void requireRubyFile(String szFilePath);
19
33
 
20
34
  void navigate(String url);
21
35
  //boolean existsJavascript(String jsFunction);
22
36
  void executeJavascript(String jsFunction);
23
37
 
24
- void rhoLog(int nSeverity,String szModule,String szMsg,String szFile, int nLine);
38
+ //void rhoLog(int nSeverity,String szModule,String szMsg,String szFile, int nLine);
25
39
  String getCurrentUrl();
26
40
  void stopNavigate();
27
41
  void historyForward();
@@ -2,17 +2,26 @@ package com.rhomobile.rhodes.extmanager;
2
2
 
3
3
  public interface IRhoExtension {
4
4
 
5
- void onSetPropertiesData(String propId, String data, IRhoExtData ext);
6
- void onSetProperty(String name, String value, IRhoExtData ext);
7
- void onBeforeNavigate(String urlBeingNavigatedTo, IRhoExtData ext);
8
- void onNavigateComplete(String urlBeingNavigatedTo, IRhoExtData ext);
9
- void onDocumentComplete(String urlOfDocument, IRhoExtData ext);
5
+ void onSetPropertiesData(IRhoExtManager extManager, String propId, String data, int pos, int total, IRhoExtData ext);
6
+ void onSetPropertiesDataEnd(IRhoExtManager extManager, IRhoExtData ext);
7
+ void onSetProperty(IRhoExtManager extManager, String name, String value, IRhoExtData ext);
8
+ void onBeforeNavigate(IRhoExtManager extManager, String url, IRhoExtData ext);
9
+ void onNavigateProgress(IRhoExtManager extManager, String url, int pos, int total, IRhoExtData ext);
10
+ void onNavigateComplete(IRhoExtManager extManager, String url, IRhoExtData ext);
11
+ void onDocumentComplete(IRhoExtManager extManager, String urlOfDocument, IRhoExtData ext);
10
12
  //bool onWndMsg(MSG& oMsg){return false;}
11
- long onNavigateTimeout(String urlBeingNavigatedTo, IRhoExtData ext);
12
- long onSIPState(boolean bSIPState, IRhoExtData ext);
13
- //long onAlertPopup(int nEnum, void pData, IRhoExtData ext);
14
- long onNavigateError(String urlBeingNavigatedTo, IRhoExtData ext);
15
- void onAppActivate(boolean bActivate, IRhoExtData ext);
13
+ //long onNavigateTimeout(IRhoExtManager extManager, String urlBeingNavigatedTo, IRhoExtData ext);
14
+ //long onSIPState(IRhoExtManager extManager, boolean bSIPState, IRhoExtData ext);
15
+ void onAlert(IRhoExtManager extManager, String message, IRhoExtData ext);
16
+ void onConfirm(IRhoExtManager extManager, String message, IRhoExtData ext);
17
+ void onSelect(IRhoExtManager extManager, String[] items, int selected, IRhoExtData ext);
18
+ void onStatus(IRhoExtManager extManager, String status, IRhoExtData ext);
19
+ void onTitle(IRhoExtManager extManager, String title, IRhoExtData ext);
20
+ void onConsole(IRhoExtManager extManager, String message, IRhoExtData ext);
21
+ void onInputMethod(IRhoExtManager extManager, boolean enabled, IRhoExtData ext);
22
+ void onNavigateError(IRhoExtManager extManager, String url, IRhoExtData ext);
23
+
24
+ void onAppActivate(IRhoExtManager extManager, boolean bActivate);
16
25
 
17
26
  }
18
27
 
@@ -1,18 +1,21 @@
1
1
  package com.rhomobile.rhodes.extmanager;
2
2
 
3
+ import android.view.View;
4
+
3
5
  class RhoExtDataImpl implements IRhoExtData {
4
6
 
5
- private int mTabIndex;
7
+ View mWebView;
8
+ private int mTabIndex;
6
9
 
7
- public RhoExtDataImpl(int tabIndex) {
10
+ public RhoExtDataImpl(View view, int tabIndex) {
11
+ mWebView = view;
8
12
  mTabIndex = tabIndex;
9
13
  }
10
14
 
11
15
  public int getTabIndex() {
12
16
  return mTabIndex;
13
17
  }
14
-
15
- public void setTabIndex(int tab_index) {
16
- mTabIndex = tab_index;
18
+ public View getWebView() {
19
+ return mWebView;
17
20
  }
18
21
  }
@@ -0,0 +1,18 @@
1
+ package com.rhomobile.rhodes.extmanager;
2
+
3
+ public class RhoExtManager extends Object {
4
+
5
+ private static RhoExtManagerImpl ourRhoExtManager = null;
6
+
7
+ public static RhoExtManagerImpl getImplementationInstance() {
8
+ if (ourRhoExtManager == null) {
9
+ ourRhoExtManager = new RhoExtManagerImpl();
10
+ }
11
+ return ourRhoExtManager;
12
+ }
13
+
14
+ public static IRhoExtManager getInstance() {
15
+ return getImplementationInstance();
16
+ }
17
+
18
+ }
@@ -4,16 +4,18 @@ import java.util.Hashtable;
4
4
 
5
5
  import android.view.View;
6
6
 
7
+ import com.rhomobile.rhodes.Logger;
7
8
  import com.rhomobile.rhodes.RhodesActivity;
8
9
  import com.rhomobile.rhodes.RhodesService;
9
10
  import com.rhomobile.rhodes.WebView;
10
11
 
11
- class RhoExtManagerImpl extends Object implements IRhoExtManager {
12
+ public class RhoExtManagerImpl implements IRhoExtManager {
13
+ private static final String TAG = RhoExtManagerImpl.class.getSimpleName();
12
14
 
13
15
  private Hashtable<String, IRhoExtension> mExtensions;
14
16
 
15
- private IRhoExtData makeDefExtData() {
16
- return new RhoExtDataImpl(RhodesActivity.safeGetInstance().getMainView().activeTab());
17
+ private IRhoExtData makeDefExtData(View view) {
18
+ return new RhoExtDataImpl(view, RhodesActivity.safeGetInstance().getMainView().activeTab());
17
19
  }
18
20
 
19
21
  private static native void nativeRequireRubyFile(String path);
@@ -22,16 +24,23 @@ class RhoExtManagerImpl extends Object implements IRhoExtManager {
22
24
  mExtensions = new Hashtable<String, IRhoExtension>();
23
25
  }
24
26
 
27
+ @Override
25
28
  public IRhoExtension getExtByName(String strName) {
26
- return mExtensions.get(strName);
29
+ synchronized (mExtensions) {
30
+ return mExtensions.get(strName);
31
+ }
27
32
  }
28
33
 
29
- public void registerExtension(String strName, IRhoExtension ext) {
30
- if (mExtensions.containsKey(strName)) {
31
- mExtensions.remove(strName);
32
- }
33
- mExtensions.put(strName, ext);
34
- }
34
+ public void registerExtension(String strName, IRhoExtension ext) {
35
+ Logger.T(TAG, "Registering extension: " + strName);
36
+ synchronized (mExtensions) {
37
+ if (mExtensions.containsKey(strName)) {
38
+ mExtensions.remove(strName);
39
+ }
40
+
41
+ mExtensions.put(strName, ext);
42
+ }
43
+ }
35
44
 
36
45
  @Override
37
46
  public View getWebView() {
@@ -42,26 +51,15 @@ class RhoExtManagerImpl extends Object implements IRhoExtManager {
42
51
  public View getTopView() {
43
52
  return RhodesActivity.safeGetInstance().getMainView().getView();
44
53
  }
45
-
46
- public void onSetPropertiesData(String propId, String data) {
47
- for (IRhoExtension ext : mExtensions.values()) {
48
- ext.onSetPropertiesData(propId, data, makeDefExtData());
49
- }
50
- }
51
54
 
52
55
  @Override
53
56
  public void onUnhandledProperty(String extName, String name, String value, IRhoExtData extData) {
54
- IRhoExtension ext = mExtensions.get(extName);
55
- if (ext != null) {
56
- ext.onSetProperty(name, value, extData);
57
+ IRhoExtension ext = null;
58
+ synchronized (mExtensions) {
59
+ ext = mExtensions.get(extName);
57
60
  }
58
- }
59
-
60
- public void onBeforeNavigate(String url) {
61
- int tabIndex = WebView.activeTab();
62
- for (IRhoExtension ext : mExtensions.values()) {
63
- RhoExtDataImpl data = new RhoExtDataImpl(tabIndex);
64
- ext.onBeforeNavigate(url, data);
61
+ if (ext != null) {
62
+ ext.onSetProperty(this, name, value, extData);
65
63
  }
66
64
  }
67
65
 
@@ -70,8 +68,14 @@ class RhoExtManagerImpl extends Object implements IRhoExtManager {
70
68
  RhodesService.doRequestEx(url, body, data, waitForResponse);
71
69
  }
72
70
 
71
+ @Override
72
+ public void executeRubyCallbackWithJsonBody(String url, String json, String data, boolean waitForResponse) {
73
+ RhodesService.doRequestJson(url, json, data, waitForResponse);
74
+ }
75
+
73
76
  @Override
74
77
  public void requireRubyFile(String filePath) {
78
+ Logger.I(TAG, "Require ruby file: " + filePath);
75
79
  nativeRequireRubyFile(filePath);
76
80
  }
77
81
 
@@ -85,10 +89,6 @@ class RhoExtManagerImpl extends Object implements IRhoExtManager {
85
89
  WebView.executeJs(jsFunction, WebView.activeTab());
86
90
  }
87
91
 
88
- @Override
89
- public void rhoLog(int nSeverity, String szModule, String szMsg, String szFile, int nLine) {
90
- }
91
-
92
92
  @Override
93
93
  public String getCurrentUrl() {
94
94
  return RhodesActivity.safeGetInstance().getMainView().currentLocation(RhodesActivity.safeGetInstance().getMainView().activeTab());
@@ -139,4 +139,141 @@ class RhoExtManagerImpl extends Object implements IRhoExtManager {
139
139
  // TODO Auto-generated method stub
140
140
  }
141
141
 
142
- }
142
+ @Override
143
+ public String getBuildConfigItem(String name) {
144
+ return RhodesService.getBuildConfig(name);
145
+ }
146
+
147
+
148
+ //-----------------------------------------------------------------------------------------------------------------
149
+ // Rhodes implementation related methods are below
150
+
151
+ public void onSetPropertiesData(View view,String propId, String data, int position, int total) {
152
+ synchronized (mExtensions) {
153
+ for (IRhoExtension ext : mExtensions.values()) {
154
+ ext.onSetPropertiesData(this, propId, data, position, total, makeDefExtData(view));
155
+ }
156
+ }
157
+ }
158
+
159
+ public void onBeforeNavigate(View view, String url) {
160
+ synchronized (mExtensions) {
161
+ for (IRhoExtension ext : mExtensions.values()) {
162
+ ext.onBeforeNavigate(this, url, makeDefExtData(view));
163
+ }
164
+ }
165
+ }
166
+
167
+ public void onNavigateComplete(View view, String url) {
168
+ synchronized (mExtensions) {
169
+ for (IRhoExtension ext : mExtensions.values()) {
170
+ ext.onNavigateComplete(this, url, makeDefExtData(view));
171
+ }
172
+ }
173
+ }
174
+
175
+ public void onAppActivate(boolean isActivate) {
176
+ synchronized (mExtensions) {
177
+ for (IRhoExtension ext : mExtensions.values()) {
178
+ ext.onAppActivate(this, isActivate);
179
+ }
180
+ }
181
+ }
182
+
183
+ public void onAlert(View view, String msg) {
184
+ synchronized (mExtensions) {
185
+ for (IRhoExtension ext : mExtensions.values()) {
186
+ ext.onAlert(this, msg, makeDefExtData(view));
187
+ }
188
+ }
189
+ }
190
+
191
+ public void onConfirm(View view, String msg) {
192
+ synchronized (mExtensions) {
193
+ for (IRhoExtension ext : mExtensions.values()) {
194
+ ext.onConfirm(this, msg, makeDefExtData(view));
195
+ }
196
+ }
197
+ }
198
+
199
+ public void onConsole(View view, String msg) {
200
+ synchronized (mExtensions) {
201
+ for (IRhoExtension ext : mExtensions.values()) {
202
+ ext.onConsole(this, msg, makeDefExtData(view));
203
+ }
204
+ }
205
+ }
206
+
207
+ public void onInputMethod(View view, boolean enabled) {
208
+ synchronized (mExtensions) {
209
+ for (IRhoExtension ext : mExtensions.values()) {
210
+ ext.onInputMethod(this, enabled, makeDefExtData(view));
211
+ }
212
+ }
213
+ }
214
+
215
+ public void onLoadEnd(View view, String url, long arg2, long arg3) {
216
+ synchronized (mExtensions) {
217
+ for (IRhoExtension ext : mExtensions.values()) {
218
+ ext.onNavigateComplete(this, url, makeDefExtData(view));
219
+ }
220
+ }
221
+ }
222
+
223
+ public void onLoadError(View view) {
224
+ synchronized (mExtensions) {
225
+ for (IRhoExtension ext : mExtensions.values()) {
226
+ ext.onNavigateError(this, "", makeDefExtData(view));
227
+ }
228
+ }
229
+ }
230
+
231
+ public void onLoadProgress(View view, int val, int total) {
232
+ synchronized (mExtensions) {
233
+ for (IRhoExtension ext : mExtensions.values()) {
234
+ ext.onNavigateProgress(this, "", val, total, makeDefExtData(view));
235
+ }
236
+ }
237
+ }
238
+
239
+ public void onMetaEnd(View view) {
240
+ synchronized (mExtensions) {
241
+ for (IRhoExtension ext : mExtensions.values()) {
242
+ ext.onSetPropertiesDataEnd(this, makeDefExtData(view));
243
+ }
244
+ }
245
+ }
246
+
247
+ public void onPrompt(View view, String prompt, String arg2) {
248
+ synchronized (mExtensions) {
249
+ for (IRhoExtension ext : mExtensions.values()) {
250
+ ext.onConfirm(this, prompt, makeDefExtData(view));
251
+ }
252
+ }
253
+ }
254
+
255
+ public void onSelect(View view, String[] lines, int pos) {
256
+ synchronized (mExtensions) {
257
+ for (IRhoExtension ext : mExtensions.values()) {
258
+ ext.onSelect(this, lines, pos, makeDefExtData(view));
259
+ }
260
+ }
261
+ }
262
+
263
+ public void onStatus(View view, String msg) {
264
+ synchronized (mExtensions) {
265
+ for (IRhoExtension ext : mExtensions.values()) {
266
+ ext.onStatus(this, msg, makeDefExtData(view));
267
+ }
268
+ }
269
+ }
270
+
271
+ public void onTitle(View view, String title) {
272
+ synchronized (mExtensions) {
273
+ for (IRhoExtension ext : mExtensions.values()) {
274
+ ext.onStatus(this, title, makeDefExtData(view));
275
+ }
276
+ }
277
+ }
278
+ }
279
+
@@ -40,6 +40,7 @@ import java.util.ArrayList;
40
40
  import java.util.List;
41
41
 
42
42
  import com.rhomobile.rhodes.Logger;
43
+ import com.rhomobile.rhodes.util.Utils;
43
44
 
44
45
  import android.content.Context;
45
46
  import android.content.res.AssetManager;
@@ -52,6 +53,8 @@ public class RhoFileApi {
52
53
 
53
54
  private static final int MAX_SIZE = 2*1024*1024;
54
55
 
56
+ private static final String STAT_TABLE_FILENAME = "rho.dat";
57
+
55
58
  private static AssetManager am;
56
59
  private static String root;
57
60
  private static final String DB_FILES_FOLDER = "db/db-files";
@@ -66,13 +69,21 @@ public class RhoFileApi {
66
69
 
67
70
  private static native boolean needEmulate(String path);
68
71
  private static native String makeRelativePath(String path);
69
-
70
- private static void fillStatTable() throws IOException
71
- {
72
- InputStream is = null;
73
- try {
74
- is = am.open("rho.dat");
75
- BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
72
+
73
+ private static void fillStatTable() throws IOException {
74
+ InputStream is = null;
75
+ try {
76
+
77
+ File statFile = new File(getRootPath(), STAT_TABLE_FILENAME);
78
+ if (statFile.exists() && statFile.isFile()) {
79
+ Log.i(TAG, "Opening stat table from FS: " + statFile.getCanonicalPath());
80
+ is = new FileInputStream(statFile);
81
+ } else {
82
+ Log.i(TAG, "Opening stat table from package assets");
83
+ is = am.open("rho.dat");
84
+ }
85
+
86
+ BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
76
87
  for (;;) {
77
88
  String line = in.readLine();
78
89
  if (line == null)
@@ -102,7 +113,11 @@ public class RhoFileApi {
102
113
  is.close();
103
114
  }
104
115
  }
105
-
116
+
117
+ static void patchStatTable(String path) {
118
+ //TODO: Implement rho.dat patching from bundle filelist.txt
119
+ }
120
+
106
121
  private static void copyAssets(String assets[])
107
122
  {
108
123
  for(String asset: assets)
@@ -325,5 +340,27 @@ public class RhoFileApi {
325
340
  return null;
326
341
  }
327
342
  }
328
-
343
+
344
+ public static int copyRecursively(String srcPath, String trgPath) {
345
+ try {
346
+ File source = new File(srcPath);
347
+ File target = new File(trgPath);
348
+ Utils.copyRecursively(new Utils.FileSource(), source, target, true);
349
+ return 0;
350
+ } catch (Throwable ex) {
351
+ Logger.E(TAG, ex.getMessage());
352
+ return -1;
353
+ }
354
+ }
355
+
356
+ public static int deleteRecursively(String path) {
357
+ try {
358
+ Utils.deleteRecursively(new File(path));
359
+ return 0;
360
+ } catch (Throwable ex) {
361
+ Logger.E(TAG, ex.getMessage());
362
+ return -1;
363
+ }
364
+ }
365
+
329
366
  }