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.
- data/Manifest.txt +16 -1
- data/Rakefile +77 -28
- data/doc/build.txt +5 -3
- data/doc/configuration.txt +13 -0
- data/doc/device-caps.txt +46 -27
- data/doc/rhom.txt +2 -2
- data/doc/test-log-debug.txt +6 -0
- data/doc/ui.txt +13 -0
- data/lib/build/jake.rb +11 -11
- data/lib/extensions/crypt/crypt/cbc.rb +5 -2
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
- data/lib/framework/rho/render.rb +17 -4
- data/lib/framework/rho/rho.rb +1 -1
- data/lib/framework/rho/rhocontroller.rb +11 -1
- data/lib/framework/rhomotoapi.rb +110 -0
- data/platform/android/Rhodes/jni/Android.mk +2 -5
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
- data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
- data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
- data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
- data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
- data/platform/android/Rhodes/rhobundle.xml +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
- data/platform/android/build/RhodesSRC_build.files +2 -1
- data/platform/android/build/android.rake +48 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
- data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
- data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
- data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
- data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
- data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
- data/platform/iphone/Classes/RhoMainView.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +11 -5
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
- data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
- data/platform/iphone/Classes/SimpleMainView.m +3 -0
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
- data/platform/iphone/Classes/TabbedMainView.m +30 -11
- data/platform/iphone/rbuild/iphone.rake +7 -1
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
- data/platform/shared/common/BundleManager.cpp +42 -2
- data/platform/shared/common/ExtManager.h +7 -0
- data/platform/shared/common/RhoFile.cpp +170 -2
- data/platform/shared/common/RhoFile.h +4 -0
- data/platform/shared/common/RhodesApp.cpp +30 -0
- data/platform/shared/common/RhodesApp.h +1 -0
- data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
- data/platform/shared/common/map/OSMMapEngine.h +3 -0
- data/platform/shared/logging/RhoLogConf.cpp +8 -9
- data/platform/shared/logging/RhoLogConf.h +5 -7
- data/platform/shared/logging/RhoLogSink.cpp +3 -3
- data/platform/shared/logging/RhoLogSink.h +1 -1
- data/platform/shared/net/HttpServer.cpp +17 -9
- data/platform/shared/qt/rhodes/main.cpp +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
- data/platform/shared/ruby/ext/webview/webview.i +9 -4
- data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
- data/platform/shared/test/Tests.cpp +2 -2
- data/platform/wm/build/build_inf.js +75 -47
- data/platform/wm/build/wm.rake +50 -53
- data/platform/wm/rhodes/Rhodes.cpp +40 -97
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
- data/platform/wm/tools/detool/detool.cpp +103 -52
- data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
- data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
- data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
- data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
- data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
- data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
- data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
- data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
- data/platform/wp7/rhodes/App.xaml.cs +1 -0
- data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
- data/platform/wp7/rhodes/Rhodes.csproj +5 -1
- data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
- data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
- data/rakefile.rb +77 -28
- data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
- data/res/build-tools/YUICompressorLicense.txt +54 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
- data/res/generators/templates/application/app/layout.erb +1 -0
- data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
- data/res/generators/templates/application/public/js/syncengine.js +147 -0
- data/spec/phone_spec/app/Data/septest.json +1 -1
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
- data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
- data/spec/phone_spec/app/spec/date_spec.rb +6 -6
- data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
- data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
- data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
- data/spec/phone_spec/app/spec_runner.rb +9 -10
- data/version +1 -1
- metadata +20 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -29,8 +29,11 @@
|
|
29
29
|
|
30
30
|
#include <ruby/ext/rho/rhoruby.h>
|
31
31
|
|
32
|
+
#include <string>
|
33
|
+
|
32
34
|
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_extmanager_RhoExtManagerImpl_nativeRequireRubyFile
|
33
35
|
(JNIEnv * env, jclass, jstring jPath)
|
34
36
|
{
|
35
|
-
|
37
|
+
std::string path = rho_cast<std::string>(env, jPath);
|
38
|
+
rb_require(path.c_str());
|
36
39
|
}
|
@@ -33,6 +33,7 @@
|
|
33
33
|
|
34
34
|
#include <hash_map>
|
35
35
|
|
36
|
+
#include "rhodes/fileapi.h"
|
36
37
|
#include "rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h"
|
37
38
|
|
38
39
|
#ifdef RHO_NOT_IMPLEMENTED
|
@@ -106,6 +107,8 @@ rho_dir_map_t rho_dir_map;
|
|
106
107
|
static std::vector<DIR*> rho_dir_free;
|
107
108
|
static int rho_dir_counter = -1;
|
108
109
|
|
110
|
+
static volatile RhoFsMode rho_fs_mode = RHO_FS_DISK_ONLY;
|
111
|
+
|
109
112
|
static jclass clsFileApi;
|
110
113
|
static jmethodID midCopy;
|
111
114
|
static jmethodID midOpen;
|
@@ -202,6 +205,8 @@ struct stat librhodes_st;
|
|
202
205
|
|
203
206
|
static std::string g_apk_path;
|
204
207
|
|
208
|
+
RHO_GLOBAL void rho_file_set_fs_mode(int mode);
|
209
|
+
|
205
210
|
std::string const &rho_apk_path()
|
206
211
|
{
|
207
212
|
return g_apk_path;
|
@@ -334,6 +339,8 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_file_RhoFileApi_nativeInit
|
|
334
339
|
librhodes_st.st_uid = getuid();
|
335
340
|
librhodes_st.st_gid = getgid();
|
336
341
|
|
342
|
+
rho_file_set_fs_mode(RHO_FS_TRANSPARRENT);
|
343
|
+
|
337
344
|
RHO_LOG("Library stat (mode: %d, uid: %d, gid: %d)", librhodes_st.st_mode, librhodes_st.st_uid, librhodes_st.st_gid);
|
338
345
|
}
|
339
346
|
|
@@ -481,8 +488,10 @@ static void dump_stat(struct stat const &st)
|
|
481
488
|
}
|
482
489
|
#endif
|
483
490
|
|
484
|
-
|
491
|
+
inline bool need_emulate_dir(std::string const &path)
|
485
492
|
{
|
493
|
+
if (rho_fs_mode != RHO_FS_TRANSPARRENT) return false;
|
494
|
+
|
486
495
|
std::string fpath = make_full_path(path);
|
487
496
|
std::string const &root_path = rho_root_path();
|
488
497
|
if (fpath.size() < root_path.size())
|
@@ -490,27 +499,24 @@ static bool need_emulate_dir(std::string const &path)
|
|
490
499
|
return ::strncmp(fpath.c_str(), root_path.c_str(), root_path.size()) == 0;
|
491
500
|
}
|
492
501
|
|
493
|
-
|
502
|
+
inline bool need_emulate_dir(const char *path)
|
494
503
|
{
|
495
504
|
return path ? need_emulate_dir(std::string(path)) : false;
|
496
505
|
}
|
497
506
|
|
498
507
|
static bool need_emulate(std::string const &path)
|
499
508
|
{
|
500
|
-
|
509
|
+
if (rho_fs_mode != RHO_FS_TRANSPARRENT) return false;
|
510
|
+
|
501
511
|
std::string fpath = make_full_path(path);
|
502
|
-
//RHO_LOG("need_emulate: (1): %s", fpath.c_str());
|
503
512
|
std::string const &root_path = rho_root_path();
|
504
513
|
if (::strncmp(fpath.c_str(), root_path.c_str(), root_path.size()) == 0)
|
505
514
|
{
|
506
|
-
//RHO_LOG("need_emulate: (2)");
|
507
515
|
struct stat st;
|
508
516
|
if (real_stat(fpath.c_str(), &st) == -1)
|
509
517
|
{
|
510
|
-
//RHO_LOG("need_emulate: (3)");
|
511
518
|
if (errno == ENOENT)
|
512
519
|
{
|
513
|
-
//RHO_LOG("No such file or directory: %s, need to read it from Android package", fpath.substr(root_path.size()).c_str());
|
514
520
|
rho_stat_t *rst = rho_stat(fpath);
|
515
521
|
return rst != NULL;
|
516
522
|
}
|
@@ -518,25 +524,19 @@ static bool need_emulate(std::string const &path)
|
|
518
524
|
}
|
519
525
|
else if (S_ISREG(st.st_mode))
|
520
526
|
{
|
521
|
-
//RHO_LOG("need_emulate: (4)");
|
522
527
|
rho_stat_t *rst = rho_stat(fpath);
|
523
|
-
//RHO_LOG("need_emulate: (5)");
|
524
528
|
if (rst && rst->mtime > st.st_mtime)
|
525
529
|
{
|
526
|
-
//RHO_LOG("need_emulate: %s, st.st_mtime: %lu", fpath.c_str(), st.st_mtime);
|
527
|
-
//RHO_LOG("need_emulate: %s, rst->mtime: %lu", fpath.c_str(), rst ? rst->mtime : -1);
|
528
|
-
//RHO_LOG("need_emulate: file %s in Android package is newer than one located on FS, unlink FS one", fpath.c_str());
|
529
530
|
real_unlink(fpath.c_str());
|
530
531
|
return true;
|
531
532
|
}
|
532
533
|
}
|
533
534
|
}
|
534
535
|
|
535
|
-
//RHO_LOG("need_emulate: return false");
|
536
536
|
return false;
|
537
537
|
}
|
538
538
|
|
539
|
-
|
539
|
+
inline bool need_emulate(const char *path)
|
540
540
|
{
|
541
541
|
return path ? need_emulate(std::string(path)) : false;
|
542
542
|
}
|
@@ -1673,3 +1673,27 @@ RHO_GLOBAL int scandir(const char *dir, struct dirent ***namelist, int (*filter)
|
|
1673
1673
|
|
1674
1674
|
RHO_NOT_IMPLEMENTED;
|
1675
1675
|
}
|
1676
|
+
|
1677
|
+
RHO_GLOBAL void rho_file_set_fs_mode(int mode)
|
1678
|
+
{
|
1679
|
+
switch (mode)
|
1680
|
+
{
|
1681
|
+
case RHO_FS_TRANSPARRENT:
|
1682
|
+
case RHO_FS_DISK_ONLY:
|
1683
|
+
rho_fs_mode = static_cast<RhoFsMode>(mode);
|
1684
|
+
LOG(TRACE) + "New FS mode: " + mode;
|
1685
|
+
break;
|
1686
|
+
default:
|
1687
|
+
LOG(ERROR) + "Wrong FS mode: " + mode;
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
|
1691
|
+
RHO_GLOBAL void rho_file_patch_stat_table(const rho::String& path)
|
1692
|
+
{
|
1693
|
+
JNIEnv* env = jnienv();
|
1694
|
+
static jmethodID mid = getJNIClassStaticMethod(env, clsFileApi, "patchStatTable", "(Ljava/lang/String;)Z");
|
1695
|
+
|
1696
|
+
jhstring jhPath = rho_cast<jhstring>(env, path);
|
1697
|
+
|
1698
|
+
env->CallStaticVoidMethod(clsFileApi, mid, jhPath.get());
|
1699
|
+
}
|
@@ -24,6 +24,7 @@
|
|
24
24
|
* http://rhomobile.com
|
25
25
|
*------------------------------------------------------------------------*/
|
26
26
|
|
27
|
+
#include <genconfig.h>
|
27
28
|
#include "rhodes/JNIRhodes.h"
|
28
29
|
|
29
30
|
#include "rhodes/JNIRhoRuby.h"
|
@@ -31,8 +32,6 @@
|
|
31
32
|
#include <common/rhoparams.h>
|
32
33
|
#include <common/map/MapEngine.h>
|
33
34
|
|
34
|
-
#include <genconfig.h>
|
35
|
-
|
36
35
|
#undef DEFAULT_LOGCATEGORY
|
37
36
|
#define DEFAULT_LOGCATEGORY "AndroidMapEngine"
|
38
37
|
|
@@ -200,6 +200,16 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestEx
|
|
200
200
|
RHODESAPP().callCallbackWithData(url, body, data, waitForResponse);
|
201
201
|
}
|
202
202
|
|
203
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestJson
|
204
|
+
(JNIEnv *env, jclass, jstring jUrl, jstring jBody, jstring jData, jboolean waitForResponse)
|
205
|
+
{
|
206
|
+
std::string url = rho_cast<std::string>(jUrl);
|
207
|
+
std::string body = rho_cast<std::string>(jBody);
|
208
|
+
std::string data = rho_cast<std::string>(jData);
|
209
|
+
|
210
|
+
RHODESAPP().callCallbackWithJsonBody(url.c_str(), body.c_str(), data.c_str(), waitForResponse);
|
211
|
+
}
|
212
|
+
|
203
213
|
RHO_GLOBAL jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_normalizeUrl
|
204
214
|
(JNIEnv *env, jobject, jstring strUrl)
|
205
215
|
{
|
@@ -166,7 +166,7 @@ RHO_GLOBAL void android_setup(JNIEnv *env)
|
|
166
166
|
sqlite3_temp_directory = (char*)s_sqlite_path.c_str();
|
167
167
|
|
168
168
|
// Init logconf
|
169
|
-
rho_logconf_Init(rho_native_rhopath(), "");
|
169
|
+
rho_logconf_Init(rho_native_rhopath(), rho_native_rhopath(), "");
|
170
170
|
|
171
171
|
// Disable log to stdout as on android all stdout redirects to /dev/null
|
172
172
|
RHOCONF().setBool("LogToOutput", false, true);
|
@@ -77,7 +77,7 @@ RHO_GLOBAL void rho_signature_take(char* callback_url, rho_param* p)
|
|
77
77
|
|
78
78
|
}
|
79
79
|
|
80
|
-
RHO_GLOBAL void rho_signature_visible(bool
|
80
|
+
RHO_GLOBAL void rho_signature_visible(bool visible, rho_param* p)
|
81
81
|
{
|
82
82
|
JNIEnv *env = jnienv();
|
83
83
|
jclass cls = getJNIClass(RHODES_JAVA_CLASS_SIGNATURE);
|
@@ -85,9 +85,6 @@ RHO_GLOBAL void rho_signature_visible(bool b, rho_param* p)
|
|
85
85
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "inline_signature_visible", "(ILjava/lang/Object;)V");
|
86
86
|
if (!mid) return;
|
87
87
|
|
88
|
-
int visible = 0;
|
89
|
-
if (b) visible = 1;
|
90
|
-
|
91
88
|
jobject paramsObj = RhoValueConverter(env).createObject(p);
|
92
89
|
env->CallStaticVoidMethod(cls, mid, visible, paramsObj);
|
93
90
|
env->DeleteLocalRef(paramsObj);
|
@@ -246,6 +246,10 @@ public class RhodesActivity extends BaseActivity {
|
|
246
246
|
mIsInsideStartStop = true;
|
247
247
|
|
248
248
|
RhodesApplication.stateChanged(RhodesApplication.UiState.MainActivityStarted);
|
249
|
+
|
250
|
+
for(RhodesActivityListener listener: mListeners) {
|
251
|
+
listener.onStart(this);
|
252
|
+
}
|
249
253
|
}
|
250
254
|
|
251
255
|
@Override
|
@@ -283,14 +287,20 @@ public class RhodesActivity extends BaseActivity {
|
|
283
287
|
{
|
284
288
|
super.onStop();
|
285
289
|
Logger.D(TAG, "onStop");
|
290
|
+
for(RhodesActivityListener listener: mListeners) {
|
291
|
+
listener.onStop(this);
|
292
|
+
}
|
286
293
|
mIsInsideStartStop = false;
|
287
294
|
}
|
288
295
|
|
289
296
|
@Override
|
290
297
|
public void onDestroy() {
|
291
298
|
Logger.D(TAG, "onDestroy");
|
299
|
+
|
300
|
+
for(RhodesActivityListener listener: mListeners) {
|
301
|
+
listener.onDestroy(this);
|
302
|
+
}
|
292
303
|
|
293
|
-
//TODO: Check is it really correct in case activity killed immediately after onPause()
|
294
304
|
sInstance = null;
|
295
305
|
super.onDestroy();
|
296
306
|
}
|
@@ -28,14 +28,15 @@ package com.rhomobile.rhodes;
|
|
28
28
|
|
29
29
|
import android.content.Intent;
|
30
30
|
|
31
|
-
|
32
31
|
public interface RhodesActivityListener {
|
33
32
|
|
34
33
|
void onCreate(RhodesActivity activity, Intent intent);
|
35
|
-
void
|
34
|
+
void onStart(RhodesActivity activity);
|
36
35
|
void onResume(RhodesActivity activity);
|
36
|
+
void onPause(RhodesActivity activity);
|
37
|
+
void onStop(RhodesActivity activity);
|
38
|
+
void onDestroy(RhodesActivity activity);
|
37
39
|
void onNewIntent(RhodesActivity activity, Intent intent);
|
38
40
|
|
39
41
|
void onRhodesActivityStartup(RhodesActivity activity);
|
40
|
-
|
41
42
|
}
|
@@ -31,6 +31,7 @@ import java.io.IOException;
|
|
31
31
|
import java.util.Collection;
|
32
32
|
import java.util.Vector;
|
33
33
|
|
34
|
+
import com.rhomobile.rhodes.extmanager.RhoExtManager;
|
34
35
|
import com.rhomobile.rhodes.file.RhoFileApi;
|
35
36
|
import com.rhomobile.rhodes.util.Utils;
|
36
37
|
import com.rhomobile.rhodes.util.Utils.AssetsSource;
|
@@ -111,6 +112,22 @@ public class RhodesApplication extends Application{
|
|
111
112
|
}
|
112
113
|
}
|
113
114
|
});
|
115
|
+
RhodesApplication.runWhen(
|
116
|
+
AppState.AppActivated,
|
117
|
+
new StateHandler(false) {
|
118
|
+
@Override
|
119
|
+
public void run() {
|
120
|
+
RhoExtManager.getImplementationInstance().onAppActivate(true);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
RhodesApplication.runWhen(
|
124
|
+
AppState.AppDeactivated,
|
125
|
+
new StateHandler(false) {
|
126
|
+
@Override
|
127
|
+
public void run() {
|
128
|
+
RhoExtManager.getImplementationInstance().onAppActivate(false);
|
129
|
+
}
|
130
|
+
});
|
114
131
|
|
115
132
|
initClassLoader(getClassLoader());
|
116
133
|
|
@@ -154,7 +171,7 @@ public class RhodesApplication extends Application{
|
|
154
171
|
}
|
155
172
|
|
156
173
|
setupRhodesApp();
|
157
|
-
|
174
|
+
Logger.I(TAG, "Initialized");
|
158
175
|
}
|
159
176
|
private static boolean sRhodesActivityStarted = false;
|
160
177
|
|
@@ -337,14 +354,17 @@ public class RhodesApplication extends Application{
|
|
337
354
|
doneHandlers.add(handler);
|
338
355
|
}
|
339
356
|
}
|
357
|
+
Logger.T(TAG, "Handlers gone: " + doneHandlers.size());
|
340
358
|
mHandlers.removeAll(doneHandlers);
|
341
359
|
return handlers;
|
342
360
|
}
|
343
361
|
|
344
362
|
public void commitObservers() {
|
363
|
+
Logger.T(TAG, "Commit observers");
|
345
364
|
Vector<EventObserver> observers = new Vector<EventObserver>();
|
346
365
|
for (EventObserver o: mObservers) {
|
347
366
|
if (o.isCheckOnce()) {
|
367
|
+
Logger.T(TAG, o.mTag + " is gone");
|
348
368
|
observers.add(o);
|
349
369
|
}
|
350
370
|
}
|
@@ -374,7 +394,6 @@ public class RhodesApplication extends Application{
|
|
374
394
|
|
375
395
|
private static boolean appActivatedFlag = false;
|
376
396
|
|
377
|
-
private Vector<StateHandler> mHandlers = new Vector<StateHandler>();
|
378
397
|
private String TAG;
|
379
398
|
private StateImpl<AppEventObserver> mImpl;
|
380
399
|
|
@@ -405,7 +424,7 @@ public class RhodesApplication extends Application{
|
|
405
424
|
return handlers;
|
406
425
|
}
|
407
426
|
|
408
|
-
public synchronized void addHandler(StateHandler handler) {
|
427
|
+
public synchronized void addHandler(StateHandler handler) { mImpl.addHandler(handler); }
|
409
428
|
public synchronized AppEventObserver addObserver(String tag, boolean once) {
|
410
429
|
AppEventObserver observer = new AppEventObserver(tag, this, once);
|
411
430
|
mImpl.addObserver(observer);
|
@@ -415,10 +434,10 @@ public class RhodesApplication extends Application{
|
|
415
434
|
|
416
435
|
static public void handleState(AppState state) {
|
417
436
|
int cnt = runHandlers(state.commit());
|
418
|
-
Logger.
|
437
|
+
Logger.T(sAppState.TAG, "Handlers have completed: " + cnt);
|
419
438
|
if((state == AppStarted) && appActivatedFlag) {
|
420
439
|
cnt = runHandlers(AppActivated.commit());
|
421
|
-
Logger.
|
440
|
+
Logger.T(sAppState.TAG, "Handlers have completed: " + cnt);
|
422
441
|
}
|
423
442
|
return;
|
424
443
|
}
|
@@ -478,7 +497,7 @@ public class RhodesApplication extends Application{
|
|
478
497
|
|
479
498
|
static public void handleState(UiState state) {
|
480
499
|
int cnt = runHandlers(state.commit());
|
481
|
-
Logger.
|
500
|
+
Logger.T(sAppState.TAG, "Handlers have completed: " + cnt);
|
482
501
|
}
|
483
502
|
}
|
484
503
|
|
@@ -498,6 +517,7 @@ public class RhodesApplication extends Application{
|
|
498
517
|
}
|
499
518
|
state.addHandler(handler);
|
500
519
|
Logger.T(TAG, "AppState handler added: " + state.TAG);
|
520
|
+
Logger.T(TAG, "Overall handlers: " + state.mImpl.mHandlers.size());
|
501
521
|
}
|
502
522
|
|
503
523
|
public static void runWhen(UiState state, StateHandler handler) {
|
@@ -230,6 +230,7 @@ public class RhodesService extends Service {
|
|
230
230
|
public static native void doRequest(String url);
|
231
231
|
public static native void doRequestAsync(String url);
|
232
232
|
public static native void doRequestEx(String url, String body, String data, boolean waitForResponse);
|
233
|
+
public static native void doRequestJson(String url, String body, String data, boolean waitForResponse);
|
233
234
|
|
234
235
|
public static native void loadUrl(String url);
|
235
236
|
|
@@ -802,7 +803,8 @@ public class RhodesService extends Service {
|
|
802
803
|
}
|
803
804
|
}
|
804
805
|
else if (name.equalsIgnoreCase("webview_framework")) {
|
805
|
-
return "WEBKIT/" + Build.VERSION.RELEASE;
|
806
|
+
//return "WEBKIT/" + Build.VERSION.RELEASE;
|
807
|
+
return RhodesActivity.safeGetInstance().getMainView().getWebView(-1).getView().getClass().getCanonicalName();
|
806
808
|
}
|
807
809
|
}
|
808
810
|
catch (Exception e) {
|
@@ -0,0 +1,70 @@
|
|
1
|
+
package com.rhomobile.rhodes.extmanager;
|
2
|
+
|
3
|
+
public abstract class AbstractRhoExtension implements IRhoExtension {
|
4
|
+
|
5
|
+
@Override
|
6
|
+
public void onSetPropertiesData(IRhoExtManager extManager, String propId,
|
7
|
+
String data, int pos, int total, IRhoExtData ext) {
|
8
|
+
}
|
9
|
+
|
10
|
+
@Override
|
11
|
+
public void onSetPropertiesDataEnd(IRhoExtManager extManager, IRhoExtData ext) {
|
12
|
+
}
|
13
|
+
|
14
|
+
@Override
|
15
|
+
public void onSetProperty(IRhoExtManager extManager, String name, String value, IRhoExtData ext) {
|
16
|
+
}
|
17
|
+
|
18
|
+
@Override
|
19
|
+
public void onBeforeNavigate(IRhoExtManager extManager, String url, IRhoExtData ext) {
|
20
|
+
}
|
21
|
+
|
22
|
+
@Override
|
23
|
+
public void onNavigateProgress(IRhoExtManager extManager, String url, int pos, int total, IRhoExtData ext) {
|
24
|
+
}
|
25
|
+
|
26
|
+
@Override
|
27
|
+
public void onNavigateComplete(IRhoExtManager extManager, String url, IRhoExtData ext) {
|
28
|
+
}
|
29
|
+
|
30
|
+
@Override
|
31
|
+
public void onDocumentComplete(IRhoExtManager extManager, String urlOfDocument, IRhoExtData ext) {
|
32
|
+
}
|
33
|
+
|
34
|
+
@Override
|
35
|
+
public void onAlert(IRhoExtManager extManager, String message, IRhoExtData ext) {
|
36
|
+
}
|
37
|
+
|
38
|
+
@Override
|
39
|
+
public void onConfirm(IRhoExtManager extManager, String message, IRhoExtData ext) {
|
40
|
+
}
|
41
|
+
|
42
|
+
@Override
|
43
|
+
public void onSelect(IRhoExtManager extManager, String[] items, int selected, IRhoExtData ext) {
|
44
|
+
}
|
45
|
+
|
46
|
+
@Override
|
47
|
+
public void onStatus(IRhoExtManager extManager, String status, IRhoExtData ext) {
|
48
|
+
}
|
49
|
+
|
50
|
+
@Override
|
51
|
+
public void onTitle(IRhoExtManager extManager, String title, IRhoExtData ext) {
|
52
|
+
}
|
53
|
+
|
54
|
+
@Override
|
55
|
+
public void onConsole(IRhoExtManager extManager, String message, IRhoExtData ext) {
|
56
|
+
}
|
57
|
+
|
58
|
+
@Override
|
59
|
+
public void onInputMethod(IRhoExtManager extManager, boolean enabled, IRhoExtData ext) {
|
60
|
+
}
|
61
|
+
|
62
|
+
@Override
|
63
|
+
public void onNavigateError(IRhoExtManager extManager, String url, IRhoExtData ext) {
|
64
|
+
}
|
65
|
+
|
66
|
+
@Override
|
67
|
+
public void onAppActivate(IRhoExtManager extManager, boolean bActivate) {
|
68
|
+
}
|
69
|
+
|
70
|
+
}
|