rhodes 2.1.0 → 2.2.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/README.textile +4 -5
- data/Rakefile +8 -1
- data/lib/build/jake.rb +22 -16
- data/lib/extensions/rhoxml/rexml/cdata.rb +67 -0
- data/lib/extensions/rhoxml/rexml/document.rb +2 -116
- data/lib/extensions/rhoxml/rexml/element.rb +1 -1
- data/lib/extensions/rhoxml/rexml/text.rb +117 -0
- data/lib/framework/rho/render.rb +19 -11
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhobluetooth.rb +103 -0
- data/lib/framework/rho/rhocontroller.rb +2 -0
- data/lib/framework/rho/rhoevent.rb +43 -0
- data/lib/framework/rho/rhoevent_bb.rb +80 -0
- data/lib/framework/rho/rhoevent_c.rb +47 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -1
- data/lib/framework/rhom/rhom_model.rb +9 -3
- data/lib/framework/rhom/rhom_object_factory.rb +46 -22
- data/lib/framework/rhom/rhom_source.rb +12 -10
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +23 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +54 -38
- data/platform/android/Rhodes/jni/include/rhodes.h +3 -0
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +4 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +16 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +21 -0
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +169 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +10 -0
- data/platform/android/Rhodes/jni/src/event.cpp +429 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +51 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +16 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -0
- data/platform/android/Rhodes/res/layout/bt_device_list.xml +42 -0
- data/platform/android/Rhodes/res/layout/bt_device_name.xml +7 -0
- data/platform/android/Rhodes/res/values/strings.xml +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Push.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +144 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +66 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothDeviceListActivity.java +201 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +139 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +401 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +136 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +457 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/UUIDHelper.java +71 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +12 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +19 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +261 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +10 -2
- data/platform/android/build/RhodesSRC_build.files +33 -22
- data/platform/android/build/android.rake +198 -27
- data/platform/android/build/librhodes_build.files +3 -1
- data/platform/android/build/libruby_build.files +4 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +2 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +7 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Like.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +108 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +7 -4
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +21 -23
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +19 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +8 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +3 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +14 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java +7 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +2 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +10 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +7 -6
- data/platform/bb/build/RubyVM_build.files +412 -412
- data/platform/bb/build/bb.rake +42 -18
- data/platform/bb/build/hsqldb_build.files +151 -151
- data/platform/bb/build/rhodes_build.files +44 -40
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +237 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/rhodes.jdp +6 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +7 -1
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +62 -76
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +660 -0
- data/platform/bb/rhodes/src/{rhomobile → com/rho/rubyext}/RhoPhonebook.java +95 -38
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +22 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +26 -6
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -7
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothManager.java +528 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothPort.java +281 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothScreen.java +119 -0
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +70 -7
- data/platform/iphone/Classes/Bluetooth/Bluetooth.h +72 -0
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +414 -0
- data/platform/iphone/Classes/Event/Event.h +12 -0
- data/platform/iphone/Classes/Event/Event.m +300 -0
- data/platform/iphone/Classes/LogOptionsController.h +2 -1
- data/platform/iphone/Classes/LogOptionsController.m +1 -1
- data/platform/iphone/Classes/LogViewController.h +2 -1
- data/platform/iphone/Classes/MapView/MapViewController.h +2 -1
- data/platform/iphone/Classes/RhoViewController.h +16 -0
- data/platform/iphone/Classes/RhoViewController.m +20 -0
- data/platform/iphone/Classes/Rhodes.h +12 -0
- data/platform/iphone/Classes/Rhodes.m +34 -6
- data/platform/iphone/Classes/Signature/SignatureViewController.h +2 -2
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -10
- data/platform/iphone/Classes/SimpleMainView.h +2 -2
- data/platform/iphone/Classes/SimpleMainView.m +5 -14
- data/platform/iphone/Classes/SplashViewController.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.m +5 -10
- data/platform/iphone/Info.plist +5 -5
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +39 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +47 -4
- data/platform/osx/Rhodes Debugger/NoodleLineNumberView.m +3 -2
- data/platform/shared/common/AutoPointer.h +3 -0
- data/platform/shared/common/RhoConf.cpp +2 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhoTime.h +3 -3
- data/platform/shared/common/RhodesApp.cpp +75 -23
- data/platform/shared/common/RhodesApp.h +4 -0
- data/platform/shared/common/RhodesAppBase.h +2 -0
- data/platform/shared/common/ThreadQueue.cpp +23 -18
- data/platform/shared/common/ThreadQueue.h +2 -0
- data/platform/shared/db/res/db/syncdb.schema +39 -39
- data/platform/shared/logging/RhoLogConf.cpp +58 -3
- data/platform/shared/logging/RhoLogConf.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +17 -6
- data/platform/shared/net/HttpServer.cpp +125 -25
- data/platform/shared/net/HttpServer.h +4 -3
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +56 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +2563 -0
- data/platform/shared/ruby/ext/calendar/calendar.i +28 -0
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +2251 -0
- data/platform/shared/ruby/ext/calendar/event.h +41 -0
- data/platform/shared/ruby/ext/calendar/event.i +28 -0
- data/platform/shared/ruby/ext/calendar/event_wrap.c +2151 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +103 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +16 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +12 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +101 -0
- data/platform/shared/ruby/ext/system/system.i +14 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +2568 -2208
- data/platform/shared/ruby/main.c +8 -0
- data/platform/shared/rubyext/GeoLocation.cpp +6 -3
- data/platform/shared/rubyext/System.cpp +14 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -1
- data/platform/shared/sync/SyncNotify.cpp +16 -8
- data/platform/shared/sync/SyncNotify.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +7 -12
- data/platform/shared/sync/SyncThread.h +5 -3
- data/platform/wm/build/wm.rake +7 -1
- data/platform/wm/rhodes/Alert.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -0
- data/platform/wm/rhodes/MainWindow.h +9 -0
- data/platform/wm/rhodes/OutlookApp.cpp +72 -0
- data/platform/wm/rhodes/OutlookApp.h +22 -0
- data/platform/wm/rhodes/Rhodes.cpp +8 -0
- data/platform/wm/rhodes/Rhodes.rc +31 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1274 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +321 -0
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +37 -70
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +0 -4
- data/platform/wm/rhodes/resource.h +8 -1
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +4 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -4
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +487 -0
- data/platform/wm/rhodes/rhodes.vcproj +28 -11
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +32 -0
- data/rakefile.rb +8 -1
- data/res/generators/templates/application/Rakefile +1 -1
- data/res/generators/templates/application/app/layout.erb +4 -1
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/iphone.css +2 -2
- data/res/generators/templates/application/public/jqtouch/jqtouch-iphone.css +9 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.css +1 -5
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +3 -2
- data/rhodes.gemspec +1 -1
- data/spec/perfomance_spec/app/Benchmark/benchmark.rb +4 -0
- data/spec/perfomance_spec/app/Benchmark/bulk_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/controller.rb +178 -0
- data/spec/perfomance_spec/app/Benchmark/create_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/customers.erb +35 -0
- data/spec/perfomance_spec/app/Benchmark/index.erb +9 -0
- data/spec/perfomance_spec/app/Benchmark/products.erb +25 -0
- data/spec/perfomance_spec/app/Benchmark/search_results.erb +13 -0
- data/spec/perfomance_spec/app/Customer/customer.rb +6 -0
- data/spec/perfomance_spec/app/Perftest/index.erb +5 -0
- data/spec/perfomance_spec/app/Product/index.erb +25 -0
- data/spec/perfomance_spec/app/Product/product.rb +6 -0
- data/spec/perfomance_spec/app/helpers/application_helper.rb +126 -0
- data/spec/perfomance_spec/app/helpers/browser_helper.rb +18 -0
- data/spec/perfomance_spec/rhoconfig.txt +1 -1
- data/spec/phone_spec/app/Account_s/account_s.rb +5 -2
- data/spec/phone_spec/app/Case/case.rb +1 -0
- data/spec/phone_spec/app/Case_s/case_s.rb +2 -0
- data/spec/phone_spec/app/Data/perftest.json +35 -0
- data/spec/phone_spec/app/Data/testCDATA.xml +11 -0
- data/spec/phone_spec/app/Product/product.rb +1 -1
- data/spec/phone_spec/app/{Spec → spec}/asynchttp_spec.rb +66 -17
- data/spec/phone_spec/app/{Spec → spec}/barcode_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/blobsync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bsearch_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bulksync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/contacts_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/crypt_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/date_spec.rb +0 -0
- data/spec/phone_spec/app/spec/events_spec.rb +199 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/client_info.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/json_spec.rb +11 -2
- data/spec/phone_spec/app/{Spec → spec}/mapview_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/nativebar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/navbar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/pagination/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_controller_spec.rb +5 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_spec.rb +48 -0
- data/spec/phone_spec/app/{Spec → spec}/rhofile_spec.rb +9 -6
- data/spec/phone_spec/app/{Spec → spec}/rhom_object_spec.rb +188 -9
- data/spec/phone_spec/app/{Spec → spec}/syncengine_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/xml_spec.rb +15 -0
- data/spec/phone_spec/app/{Spec → spec}/xruby_spec.rb +0 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -1
- data/spec/phone_spec/build.yml +2 -1
- metadata +95 -31
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +0 -36
- data/platform/bb/rhodes/platform/6.0/com/rho/BrowserAdapter5.java +0 -155
- data/platform/bb/rhodes/platform/6.0/com/rho/RhoMainScreen.java +0 -36
@@ -6,11 +6,13 @@
|
|
6
6
|
#include <logging/RhoLogConf.h>
|
7
7
|
#include <common/RhodesApp.h>
|
8
8
|
#include <sync/SyncThread.h>
|
9
|
+
#include <sync/ClientRegister.h>
|
9
10
|
|
10
11
|
#include <sys/stat.h>
|
11
12
|
#include <sys/resource.h>
|
12
13
|
|
13
14
|
#include "rhodes/JNIRhodes.h"
|
15
|
+
#include "rhodes/RhoClassFactory.h"
|
14
16
|
|
15
17
|
#undef DEFAULT_LOGCATEGORY
|
16
18
|
#define DEFAULT_LOGCATEGORY "Rhodes"
|
@@ -493,6 +495,20 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_callActivationCa
|
|
493
495
|
rho_rhodesapp_callAppActiveCallback(active);
|
494
496
|
}
|
495
497
|
|
498
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrationId
|
499
|
+
(JNIEnv *env, jobject, jstring jId)
|
500
|
+
{
|
501
|
+
std::string id = rho_cast<std::string>(env, jId);
|
502
|
+
rho::sync::CClientRegister::Create(new rho::common::CRhoClassFactory, id.c_str());
|
503
|
+
}
|
504
|
+
|
505
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_callPushCallback
|
506
|
+
(JNIEnv *env, jobject, jstring jData)
|
507
|
+
{
|
508
|
+
std::string data = rho_cast<std::string>(env, jData);
|
509
|
+
rho_rhodesapp_callPushCallback(data.c_str());
|
510
|
+
}
|
511
|
+
|
496
512
|
RHO_GLOBAL char *rho_timezone()
|
497
513
|
{
|
498
514
|
static char *tz = NULL;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
+
android:orientation="vertical"
|
4
|
+
android:layout_width="match_parent"
|
5
|
+
android:layout_height="match_parent"
|
6
|
+
>
|
7
|
+
<TextView android:id="@+id/title_paired_devices"
|
8
|
+
android:layout_width="match_parent"
|
9
|
+
android:layout_height="wrap_content"
|
10
|
+
android:text="@string/title_paired_devices"
|
11
|
+
android:visibility="gone"
|
12
|
+
android:background="#666"
|
13
|
+
android:textColor="#fff"
|
14
|
+
android:paddingLeft="5dp"
|
15
|
+
/>
|
16
|
+
<ListView android:id="@+id/paired_devices"
|
17
|
+
android:layout_width="match_parent"
|
18
|
+
android:layout_height="wrap_content"
|
19
|
+
android:stackFromBottom="true"
|
20
|
+
android:layout_weight="1"
|
21
|
+
/>
|
22
|
+
<TextView android:id="@+id/title_new_devices"
|
23
|
+
android:layout_width="match_parent"
|
24
|
+
android:layout_height="wrap_content"
|
25
|
+
android:text="@string/title_other_devices"
|
26
|
+
android:visibility="gone"
|
27
|
+
android:background="#666"
|
28
|
+
android:textColor="#fff"
|
29
|
+
android:paddingLeft="5dp"
|
30
|
+
/>
|
31
|
+
<ListView android:id="@+id/new_devices"
|
32
|
+
android:layout_width="match_parent"
|
33
|
+
android:layout_height="wrap_content"
|
34
|
+
android:stackFromBottom="true"
|
35
|
+
android:layout_weight="2"
|
36
|
+
/>
|
37
|
+
<Button android:id="@+id/button_scan"
|
38
|
+
android:layout_width="match_parent"
|
39
|
+
android:layout_height="wrap_content"
|
40
|
+
android:text="@string/button_scan"
|
41
|
+
/>
|
42
|
+
</LinearLayout>
|
@@ -19,4 +19,12 @@
|
|
19
19
|
<string name="cancel">Cancel</string>
|
20
20
|
<color name="sig_bkgColor">#FFFFFF</color>
|
21
21
|
<color name="sig_penColor">#66009A</color>
|
22
|
+
<!-- RhoBluetoothDeviceListActivity -->
|
23
|
+
<string name="scanning">scanning for devices...</string>
|
24
|
+
<string name="select_device">select a device to connect</string>
|
25
|
+
<string name="none_paired">No devices have been paired</string>
|
26
|
+
<string name="none_found">No devices found</string>
|
27
|
+
<string name="title_paired_devices">Paired Devices</string>
|
28
|
+
<string name="title_other_devices">Other Available Devices</string>
|
29
|
+
<string name="button_scan">Scan for devices</string>
|
22
30
|
</resources>
|
@@ -73,6 +73,11 @@ public final class AndroidR {
|
|
73
73
|
public static final int sig_clearButton=R.id.sig_clearButton;
|
74
74
|
public static final int sig_okButton=R.id.sig_okButton;
|
75
75
|
public static final int signature_view=R.id.signature_view;
|
76
|
+
public static final int title_paired_devices=R.id.title_paired_devices;
|
77
|
+
public static final int paired_devices=R.id.paired_devices;
|
78
|
+
public static final int title_new_devices=R.id.title_new_devices;
|
79
|
+
public static final int new_devices=R.id.new_devices;
|
80
|
+
public static final int button_scan=R.id.button_scan;
|
76
81
|
}
|
77
82
|
public static final class layout {
|
78
83
|
public static final int camera=R.layout.camera;
|
@@ -83,6 +88,8 @@ public final class AndroidR {
|
|
83
88
|
public static final int logoptions=R.layout.logoptions;
|
84
89
|
public static final int logview=R.layout.logview;
|
85
90
|
public static final int datetime=R.layout.datetime;
|
91
|
+
public static final int bt_device_list=R.layout.bt_device_list;
|
92
|
+
public static final int bt_device_name=R.layout.bt_device_name;
|
86
93
|
}
|
87
94
|
public static final class menu {
|
88
95
|
public static final int options=R.menu.options;
|
@@ -103,5 +110,12 @@ public final class AndroidR {
|
|
103
110
|
public static final int refresh=R.string.refresh;
|
104
111
|
public static final int sync=R.string.sync;
|
105
112
|
public static final int to_top=R.string.to_top;
|
113
|
+
public static final int scanning=R.string.scanning;
|
114
|
+
public static final int select_device=R.string.select_device;
|
115
|
+
public static final int none_paired=R.string.none_paired;
|
116
|
+
public static final int none_found=R.string.none_found;
|
117
|
+
public static final int title_paired_devices=R.string.title_paired_devices;
|
118
|
+
public static final int title_other_devices=R.string.title_other_devices;
|
119
|
+
public static final int button_scan=R.string.button_scan;
|
106
120
|
}
|
107
121
|
}
|
@@ -3,11 +3,13 @@ package com.rhomobile.rhodes;
|
|
3
3
|
public class Capabilities {
|
4
4
|
|
5
5
|
public static boolean AUDIO_ENABLED = true;
|
6
|
+
public static boolean CALENDAR_ENABLED = true;
|
6
7
|
public static boolean CAMERA_ENABLED = true;
|
7
8
|
public static boolean GPS_ENABLED = true;
|
8
9
|
public static boolean NETWORK_STATE_ENABLED = true;
|
9
10
|
public static boolean PHONE_ENABLED = true;
|
10
11
|
public static boolean PIM_ENABLED = true;
|
12
|
+
public static boolean PUSH_ENABLED = true;
|
11
13
|
public static boolean RECORD_AUDIO_ENABLED = true;
|
12
14
|
public static boolean VIBRATE_ENABLED = true;
|
13
15
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
package com.rhomobile.rhodes;
|
2
|
+
|
3
|
+
import android.content.BroadcastReceiver;
|
4
|
+
import android.content.Context;
|
5
|
+
import android.content.Intent;
|
6
|
+
import android.util.Log;
|
7
|
+
|
8
|
+
public class PushReceiver extends BroadcastReceiver {
|
9
|
+
|
10
|
+
private static final String TAG = "PushReceiver";
|
11
|
+
|
12
|
+
private static final String REG_ID = "registration_id";
|
13
|
+
|
14
|
+
private void handleRegistration(Context context, Intent intent) {
|
15
|
+
String id = intent.getStringExtra(REG_ID);
|
16
|
+
String error = intent.getStringExtra("error");
|
17
|
+
String unregistered = intent.getStringExtra("unregistered");
|
18
|
+
if (error != null) {
|
19
|
+
Log.d(TAG, "Received error: " + error);
|
20
|
+
}
|
21
|
+
else if (unregistered != null) {
|
22
|
+
Log.d(TAG, "Unregistered: " + unregistered);
|
23
|
+
}
|
24
|
+
else if (id != null) {
|
25
|
+
// TODO: store it in reg_id variable
|
26
|
+
Log.d(TAG, "Registered: id: " + id);
|
27
|
+
RhodesService r = RhodesService.getInstance();
|
28
|
+
if (r == null) {
|
29
|
+
Log.e(TAG, "Rhodes instance is null");
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
r.setPushRegistrationId(id);
|
33
|
+
}
|
34
|
+
else
|
35
|
+
Log.w(TAG, "Unknown registration event");
|
36
|
+
}
|
37
|
+
|
38
|
+
private void handleMessage(Context context, Intent intent) {
|
39
|
+
RhodesService r = RhodesService.getInstance();
|
40
|
+
if (r == null) {
|
41
|
+
Log.e(TAG, "Rhodes instance is null");
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
r.handlePushMessage(intent);
|
45
|
+
}
|
46
|
+
|
47
|
+
@Override
|
48
|
+
public void onReceive(Context context, Intent intent) {
|
49
|
+
String action = intent.getAction();
|
50
|
+
if (action.equals(PushService.C2DM_INTENT_PREFIX + "REGISTRATION"))
|
51
|
+
handleRegistration(context, intent);
|
52
|
+
else if (action.equals(PushService.C2DM_INTENT_PREFIX + "RECEIVE"))
|
53
|
+
handleMessage(context, intent);
|
54
|
+
else
|
55
|
+
Log.w(TAG, "Unknown action received (PUSH): " + action);
|
56
|
+
}
|
57
|
+
|
58
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
package com.rhomobile.rhodes;
|
2
|
+
|
3
|
+
import android.app.PendingIntent;
|
4
|
+
import android.content.Context;
|
5
|
+
import android.content.Intent;
|
6
|
+
import android.os.Build;
|
7
|
+
|
8
|
+
public class PushService {
|
9
|
+
|
10
|
+
private static final String TAG = "PushService";
|
11
|
+
|
12
|
+
public static final String C2DM_INTENT_PREFIX = "com.google.android.c2dm.intent.";
|
13
|
+
|
14
|
+
private static void checkCapabilities() throws IllegalAccessException {
|
15
|
+
if (!Capabilities.PUSH_ENABLED)
|
16
|
+
throw new IllegalAccessException("Capability PUSH disabled");
|
17
|
+
}
|
18
|
+
|
19
|
+
private static boolean isOsVersionEnough() {
|
20
|
+
int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
|
21
|
+
return sdkVersion >= Build.VERSION_CODES.FROYO;
|
22
|
+
}
|
23
|
+
|
24
|
+
public static void register() throws IllegalAccessException {
|
25
|
+
if (!isOsVersionEnough())
|
26
|
+
return;
|
27
|
+
|
28
|
+
checkCapabilities();
|
29
|
+
|
30
|
+
Logger.D(TAG, "Register for PUSH messages");
|
31
|
+
|
32
|
+
Context ctx = RhodesService.getInstance().getContext();
|
33
|
+
Intent registrationIntent = new Intent(C2DM_INTENT_PREFIX + "REGISTER");
|
34
|
+
registrationIntent.putExtra("app", PendingIntent.getBroadcast(ctx, 0, new Intent(), 0));
|
35
|
+
registrationIntent.putExtra("sender", Push.SENDER);
|
36
|
+
ctx.startService(registrationIntent);
|
37
|
+
}
|
38
|
+
|
39
|
+
public static void unregister() throws IllegalAccessException {
|
40
|
+
if (!isOsVersionEnough())
|
41
|
+
return;
|
42
|
+
|
43
|
+
checkCapabilities();
|
44
|
+
|
45
|
+
Logger.D(TAG, "Unregister from PUSH messages");
|
46
|
+
|
47
|
+
Context ctx = RhodesService.getInstance().getContext();
|
48
|
+
Intent unregIntent = new Intent(C2DM_INTENT_PREFIX + "UNREGISTER");
|
49
|
+
unregIntent.putExtra("app", PendingIntent.getBroadcast(ctx, 0, new Intent(), 0));
|
50
|
+
ctx.startService(unregIntent);
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
@@ -22,6 +22,7 @@ package com.rhomobile.rhodes;
|
|
22
22
|
|
23
23
|
import com.rhomobile.rhodes.mainview.MainView;
|
24
24
|
|
25
|
+
import android.content.Intent;
|
25
26
|
import android.content.pm.ActivityInfo;
|
26
27
|
import android.content.res.Configuration;
|
27
28
|
import android.os.Bundle;
|
@@ -33,6 +34,7 @@ import android.view.MenuItem;
|
|
33
34
|
import android.view.Window;
|
34
35
|
import android.view.ViewGroup.LayoutParams;
|
35
36
|
import android.widget.FrameLayout;
|
37
|
+
import com.rhomobile.rhodes.bluetooth.RhoBluetoothManager;
|
36
38
|
|
37
39
|
public class Rhodes extends RhoActivity {
|
38
40
|
|
@@ -120,4 +122,10 @@ public class Rhodes extends RhoActivity {
|
|
120
122
|
static {
|
121
123
|
NativeLibraries.load();
|
122
124
|
}
|
125
|
+
|
126
|
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
127
|
+
RhoBluetoothManager.onActivityResult(requestCode, resultCode, data);
|
128
|
+
}
|
129
|
+
|
130
|
+
|
123
131
|
}
|
@@ -5,9 +5,11 @@ import java.io.IOException;
|
|
5
5
|
import java.util.Calendar;
|
6
6
|
import java.util.Enumeration;
|
7
7
|
import java.util.Locale;
|
8
|
+
import java.util.Set;
|
8
9
|
import java.util.TimeZone;
|
9
10
|
import java.util.Vector;
|
10
11
|
|
12
|
+
import com.rhomobile.rhodes.bluetooth.RhoBluetoothManager;
|
11
13
|
import com.rhomobile.rhodes.file.RhoFileApi;
|
12
14
|
import com.rhomobile.rhodes.geolocation.GeoLocation;
|
13
15
|
import com.rhomobile.rhodes.mainview.MainView;
|
@@ -23,6 +25,7 @@ import com.rhomobile.rhodes.util.PerformOnUiThread;
|
|
23
25
|
import com.rhomobile.rhodes.webview.ChromeClientOld;
|
24
26
|
import com.rhomobile.rhodes.webview.RhoWebSettings;
|
25
27
|
|
28
|
+
import android.app.Activity;
|
26
29
|
import android.content.Context;
|
27
30
|
import android.content.Intent;
|
28
31
|
import android.content.pm.ApplicationInfo;
|
@@ -31,7 +34,9 @@ import android.graphics.Bitmap;
|
|
31
34
|
import android.net.ConnectivityManager;
|
32
35
|
import android.net.NetworkInfo;
|
33
36
|
import android.os.Build;
|
37
|
+
import android.os.Bundle;
|
34
38
|
import android.os.Handler;
|
39
|
+
import android.os.PowerManager;
|
35
40
|
import android.os.Process;
|
36
41
|
import android.telephony.TelephonyManager;
|
37
42
|
import android.util.DisplayMetrics;
|
@@ -62,12 +67,16 @@ public class RhodesService {
|
|
62
67
|
return instance;
|
63
68
|
}
|
64
69
|
|
65
|
-
private
|
70
|
+
private Activity ctx;
|
66
71
|
|
67
72
|
public Context getContext() {
|
68
73
|
return ctx;
|
69
74
|
}
|
70
75
|
|
76
|
+
public Activity getMainActivity() {
|
77
|
+
return ctx;
|
78
|
+
}
|
79
|
+
|
71
80
|
private RhoLogConf m_rhoLogConf = new RhoLogConf();
|
72
81
|
public RhoLogConf getLogConf() {
|
73
82
|
return m_rhoLogConf;
|
@@ -90,10 +99,11 @@ public class RhodesService {
|
|
90
99
|
return uiThreadId;
|
91
100
|
}
|
92
101
|
|
93
|
-
public void setInfo(
|
102
|
+
public void setInfo(Activity c, long id, Handler handler) {
|
94
103
|
ctx = c;
|
95
104
|
uiThreadId = id;
|
96
105
|
uiHandler = handler;
|
106
|
+
RhoBluetoothManager.sharedInstance();
|
97
107
|
}
|
98
108
|
|
99
109
|
private Handler uiHandler;
|
@@ -150,6 +160,48 @@ public class RhodesService {
|
|
150
160
|
private String rootPath = null;
|
151
161
|
private native void nativeInitPath(String rootPath, String sqliteJournalsPath, String apkPath);
|
152
162
|
|
163
|
+
static PowerManager.WakeLock wakeLockObject = null;
|
164
|
+
static boolean wakeLockEnabled = false;
|
165
|
+
|
166
|
+
public static int rho_sys_set_sleeping(int enable) {
|
167
|
+
Logger.I(TAG, "rho_sys_set_sleeping("+enable+")");
|
168
|
+
int wasEnabled = 1;
|
169
|
+
if (wakeLockObject != null) {
|
170
|
+
wasEnabled = 0;
|
171
|
+
}
|
172
|
+
if (enable != 0) {
|
173
|
+
// disable lock device
|
174
|
+
PerformOnUiThread.exec( new Runnable() {
|
175
|
+
public void run() {
|
176
|
+
if (wakeLockObject != null) {
|
177
|
+
wakeLockObject.release();
|
178
|
+
wakeLockObject = null;
|
179
|
+
wakeLockEnabled = false;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}, false);
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
// lock device from sleep
|
186
|
+
PerformOnUiThread.exec( new Runnable() {
|
187
|
+
public void run() {
|
188
|
+
if (wakeLockObject == null) {
|
189
|
+
PowerManager pm = (PowerManager)getInstance().getContext().getSystemService(Context.POWER_SERVICE);
|
190
|
+
if (pm != null) {
|
191
|
+
wakeLockObject = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG);
|
192
|
+
wakeLockObject.acquire();
|
193
|
+
wakeLockEnabled = true;
|
194
|
+
}
|
195
|
+
else {
|
196
|
+
Logger.E(TAG, "rho_sys_set_sleeping() - Can not get PowerManager !!!");
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}, false);
|
201
|
+
}
|
202
|
+
return wasEnabled;
|
203
|
+
}
|
204
|
+
|
153
205
|
private void initRootPath() {
|
154
206
|
ApplicationInfo appInfo = getAppInfo();
|
155
207
|
String dataDir = appInfo.dataDir;
|
@@ -197,6 +249,7 @@ public class RhodesService {
|
|
197
249
|
return true;
|
198
250
|
}
|
199
251
|
catch (Exception ex) {
|
252
|
+
Logger.E(TAG, ex.getMessage());
|
200
253
|
continue;
|
201
254
|
}
|
202
255
|
}
|
@@ -210,6 +263,8 @@ public class RhodesService {
|
|
210
263
|
}
|
211
264
|
|
212
265
|
public void hideSplashScreen() {
|
266
|
+
PerformOnUiThread.exec(new Runnable() {
|
267
|
+
public void run() {
|
213
268
|
if (splashScreen != null) {
|
214
269
|
splashScreen.hide(outerFrame);
|
215
270
|
splashScreen = null;
|
@@ -217,6 +272,8 @@ public class RhodesService {
|
|
217
272
|
View view = mainView.getView();
|
218
273
|
view.setVisibility(View.VISIBLE);
|
219
274
|
view.requestFocus();
|
275
|
+
}
|
276
|
+
}, false);
|
220
277
|
}
|
221
278
|
|
222
279
|
public WebView createWebView() {
|
@@ -325,7 +382,7 @@ public class RhodesService {
|
|
325
382
|
return instance != null;
|
326
383
|
}
|
327
384
|
|
328
|
-
public RhodesService(
|
385
|
+
public RhodesService(Activity c, ViewGroup rootWindow) {
|
329
386
|
ctx = c;
|
330
387
|
instance = this;
|
331
388
|
|
@@ -399,6 +456,15 @@ public class RhodesService {
|
|
399
456
|
uriHandlers.addElement(new SmsUriHandler(ctx));
|
400
457
|
uriHandlers.addElement(new VideoUriHandler(ctx));
|
401
458
|
|
459
|
+
try {
|
460
|
+
if (Capabilities.PUSH_ENABLED)
|
461
|
+
PushService.register();
|
462
|
+
} catch (IllegalAccessException e) {
|
463
|
+
Log.e(TAG, e.getMessage());
|
464
|
+
exitApp();
|
465
|
+
return;
|
466
|
+
}
|
467
|
+
|
402
468
|
Thread init = new Thread(new Runnable() {
|
403
469
|
|
404
470
|
public void run() {
|
@@ -414,6 +480,22 @@ public class RhodesService {
|
|
414
480
|
}
|
415
481
|
|
416
482
|
public void exitApp() {
|
483
|
+
try {
|
484
|
+
if (Capabilities.PUSH_ENABLED)
|
485
|
+
PushService.unregister();
|
486
|
+
} catch (IllegalAccessException e) {
|
487
|
+
Log.e(TAG, e.getMessage());
|
488
|
+
}
|
489
|
+
|
490
|
+
PerformOnUiThread.exec( new Runnable() {
|
491
|
+
public void run() {
|
492
|
+
if (wakeLockObject != null) {
|
493
|
+
wakeLockObject.release();
|
494
|
+
wakeLockObject = null;
|
495
|
+
wakeLockEnabled = false;
|
496
|
+
}
|
497
|
+
}
|
498
|
+
}, false);
|
417
499
|
Process.killProcess(Process.myPid());
|
418
500
|
}
|
419
501
|
|
@@ -423,12 +505,38 @@ public class RhodesService {
|
|
423
505
|
GeoLocation.isKnownPosition();
|
424
506
|
needGeoLocationRestart = false;
|
425
507
|
}
|
508
|
+
PerformOnUiThread.exec( new Runnable() {
|
509
|
+
public void run() {
|
510
|
+
if (wakeLockEnabled) {
|
511
|
+
if (wakeLockObject == null) {
|
512
|
+
PowerManager pm = (PowerManager)getInstance().getContext().getSystemService(Context.POWER_SERVICE);
|
513
|
+
if (pm != null) {
|
514
|
+
Logger.I(TAG, "activityStarted() restore wakeLock object");
|
515
|
+
wakeLockObject = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG);
|
516
|
+
wakeLockObject.acquire();
|
517
|
+
}
|
518
|
+
else {
|
519
|
+
Logger.E(TAG, "activityStarted() - Can not get PowerManager !!!");
|
520
|
+
}
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
}, false);
|
426
525
|
callActivationCallback(true);
|
427
526
|
}
|
428
527
|
++activitiesActive;
|
429
528
|
}
|
430
529
|
|
431
530
|
public void activityStopped() {
|
531
|
+
PerformOnUiThread.exec( new Runnable() {
|
532
|
+
public void run() {
|
533
|
+
if (wakeLockObject != null) {
|
534
|
+
Logger.I(TAG, "activityStopped() temporary destroy wakeLock object");
|
535
|
+
wakeLockObject.release();
|
536
|
+
wakeLockObject = null;
|
537
|
+
}
|
538
|
+
}
|
539
|
+
}, false);
|
432
540
|
--activitiesActive;
|
433
541
|
if (activitiesActive == 0) {
|
434
542
|
needGeoLocationRestart = GeoLocation.isAvailable();
|
@@ -594,6 +702,39 @@ public class RhodesService {
|
|
594
702
|
TimeZone tz = cal.getTimeZone();
|
595
703
|
return tz.getDisplayName();
|
596
704
|
}
|
705
|
+
|
706
|
+
public native void setPushRegistrationId(String id);
|
707
|
+
|
708
|
+
private native void callPushCallback(String data);
|
597
709
|
|
710
|
+
public void handlePushMessage(Intent intent) {
|
711
|
+
Logger.D(TAG, "Receive PUSH message");
|
712
|
+
|
713
|
+
Bundle extras = intent.getExtras();
|
714
|
+
if (extras == null) {
|
715
|
+
Logger.W(TAG, "Empty PUSH message received");
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
|
719
|
+
StringBuilder builder = new StringBuilder();
|
720
|
+
|
721
|
+
Set<String> keys = extras.keySet();
|
722
|
+
for (String key : keys) {
|
723
|
+
Logger.D(TAG, "PUSH item: " + key);
|
724
|
+
Object value = extras.get(key);
|
725
|
+
if (builder.length() > 0)
|
726
|
+
builder.append("&");
|
727
|
+
builder.append(key);
|
728
|
+
builder.append("=");
|
729
|
+
if (value != null)
|
730
|
+
builder.append(value.toString());
|
731
|
+
}
|
732
|
+
|
733
|
+
String data = builder.toString();
|
734
|
+
Logger.D(TAG, "Received PUSH message: " + data);
|
735
|
+
callPushCallback(data);
|
736
|
+
|
737
|
+
// TODO: handle alers/sounds/vibrate events
|
738
|
+
}
|
598
739
|
|
599
740
|
}
|