rhodes 2.2.3 → 2.2.4.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/CHANGELOG +13 -0
  2. data/Rakefile +1 -1
  3. data/bin/c2dm.rb +59 -0
  4. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +4 -0
  5. data/lib/framework/rho/rho.rb +2 -0
  6. data/lib/framework/rho/rhoapplication.rb +1 -0
  7. data/lib/framework/rhodes.rb +1 -1
  8. data/lib/framework/version.rb +1 -1
  9. data/lib/rhodes.rb +1 -1
  10. data/platform/android/Rhodes/AndroidManifest.xml +1 -1
  11. data/platform/android/Rhodes/jni/src/callbacks.cpp +21 -0
  12. data/platform/android/Rhodes/jni/src/nativebar.cpp +4 -0
  13. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +3 -1
  14. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +68 -7
  15. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -10
  16. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +34 -3
  17. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +21 -17
  18. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +29 -5
  19. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +7 -0
  20. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +37 -0
  21. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +0 -1
  22. data/platform/android/build/RhodesSRC_build.files +24 -23
  23. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -0
  24. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +42 -20
  25. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +111 -19
  26. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +2 -0
  27. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +2 -1
  28. data/platform/bb/RubyVM/src/com/rho/net/URI.java +80 -0
  29. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +21 -1
  30. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +6 -1
  31. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +139 -46
  32. data/platform/bb/build/bb.rake +8 -3
  33. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +32 -21
  34. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +31 -14
  35. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +3 -2
  36. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +3 -2
  37. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +28 -0
  38. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +111 -26
  39. data/platform/iphone/Classes/AppManager/AppManager.m +22 -0
  40. data/platform/iphone/Classes/DateTimePickerDelegate.m +3 -0
  41. data/platform/iphone/Classes/MapView/MapViewController.h +8 -3
  42. data/platform/iphone/Classes/MapView/MapViewController.m +63 -12
  43. data/platform/iphone/Classes/NativeBar.h +4 -3
  44. data/platform/iphone/Classes/NativeBar.m +28 -1
  45. data/platform/iphone/Classes/Rhodes.m +87 -20
  46. data/platform/iphone/Classes/Signature/SignatureView.m +16 -10
  47. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -0
  48. data/platform/iphone/Classes/SimpleMainView.h +2 -0
  49. data/platform/iphone/Classes/SimpleMainView.m +120 -35
  50. data/platform/iphone/Classes/SplashViewController.h +8 -1
  51. data/platform/iphone/Classes/SplashViewController.m +233 -11
  52. data/platform/iphone/Classes/SplitView/LeftViewController.h +30 -0
  53. data/platform/iphone/Classes/SplitView/LeftViewController.m +189 -0
  54. data/platform/iphone/Classes/SplitView/RightViewController.h +54 -0
  55. data/platform/iphone/Classes/SplitView/RightViewController.m +268 -0
  56. data/platform/iphone/Classes/SplitView/SplitViewDelegate.h +22 -0
  57. data/platform/iphone/Classes/SplitView/SplitViewDelegate.m +92 -0
  58. data/platform/iphone/Classes/SplitView/SplittedMainView.h +65 -0
  59. data/platform/iphone/Classes/SplitView/SplittedMainView.m +304 -0
  60. data/platform/iphone/Classes/TabbedMainView.m +23 -6
  61. data/platform/iphone/Classes/WebView.m +1 -1
  62. data/platform/iphone/Info.plist +11 -2
  63. data/platform/iphone/rbuild/iphone.rake +80 -3
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +50 -3
  65. data/platform/shared/common/RhoConf.cpp +5 -5
  66. data/platform/shared/db/DBAdapter.cpp +81 -3
  67. data/platform/shared/db/DBAdapter.h +1 -0
  68. data/platform/shared/json/JSONIterator.cpp +5 -0
  69. data/platform/shared/json/JSONIterator.h +1 -0
  70. data/platform/shared/net/CURLNetRequest.cpp +2 -2
  71. data/platform/shared/net/URI.cpp +53 -0
  72. data/platform/shared/net/URI.h +5 -1
  73. data/platform/shared/ruby/ext/system/system.i +9 -1
  74. data/platform/shared/ruby/ext/system/system_wrap.c +2632 -2574
  75. data/platform/shared/ruby/win32/win32.c +2 -0
  76. data/platform/shared/ruby/wince/direct.c +4 -0
  77. data/platform/shared/sync/SyncEngine.cpp +20 -1
  78. data/platform/shared/sync/SyncEngine.h +6 -1
  79. data/platform/shared/sync/SyncNotify.cpp +6 -1
  80. data/platform/shared/sync/SyncSource.cpp +130 -74
  81. data/platform/shared/sync/SyncSource.h +3 -1
  82. data/platform/wm/rhodes.sln +30 -22
  83. data/platform/wm/rhodes/Alert.cpp +4 -3
  84. data/platform/wm/rhodes/MainWindow.cpp +73 -20
  85. data/platform/wm/rhodes/RingtoneManager.cpp +4 -4
  86. data/platform/wm/rhodes/RingtoneManager.h +2 -1
  87. data/platform/wm/rhodes/Vibrate.cpp +1 -2
  88. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +37 -0
  89. data/platform/wm/rhodes/rhodes.vcproj +219 -5
  90. data/platform/wm/rhodes/stdafx.h +1 -0
  91. data/platform/wm/rubylib/rubylib.vcproj +10 -8
  92. data/platform/wm/sqlite3/sqlite3.vcproj +6 -4
  93. data/platform/wm/syncengine/syncengine.vcproj +7 -5
  94. data/platform/wm/tcmalloc/tcmalloc.vcproj +11 -8
  95. data/rakefile.rb +1 -1
  96. data/res/generators/templates/application/public/jqtouch/jqtouch.js +9 -1
  97. data/rhodes.gemspec +1 -1
  98. data/spec/phone_spec/app/spec/bulksync_spec.rb +71 -1
  99. metadata +17 -5
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ ## 2.2.4
2
+ * Launch external browser
3
+ * Open any url (http, file etc), and run external application associated with it
4
+ * Keep RhoSync session while rhodes schema changed
5
+ * Keep local changes while make bulk sync with RhoSync server
6
+ * Remove blank screen before loading.png and before showing index page and support loading.png for different screen sizes
7
+ * Fix issues with mailto:, tel: and sms: url while using jqtouch
8
+ * Support rotation of map on iPhone
9
+ * Support color icons for iPhone toolbar
10
+ * Implement tabbar for iPad at left side
11
+ * Support Windows Mobile 5.0
12
+ * Remove 3 sec delay at application start on Blackberry
13
+
1
14
  ## 2.2.3
2
15
  * #5817512 - Fix issue with migration Schema model in case if old model does not have schema_version
3
16
  * #5866549 - Fix NativeBar.switch on iPhone when 'callback:' uri used
data/Rakefile CHANGED
@@ -673,7 +673,7 @@ task :set_version, [:version] do |t,args|
673
673
 
674
674
  File.open(versionfile,"r") { |f| origfile = f.read }
675
675
  File.open(versionfile,"w") do |f|
676
- origfile.gsub!(/^(\s*VERSION) = '(\d+\.\d+\.*\d*)'/, '\1 = \''+ verstring + "'")
676
+ origfile.gsub!(/^(\s*VERSION) = '(\d+\.\d+\.*\d*)'/, '\1 = \''+ verstring + "'")
677
677
  f.write origfile
678
678
  end
679
679
  end
data/bin/c2dm.rb ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'net/http'
4
+ require 'net/https'
5
+ require 'uri'
6
+
7
+ module Google
8
+ def self.client_login(login, password, source)
9
+ url = URI.parse('https://www.google.com/accounts/ClientLogin')
10
+
11
+ data = {}
12
+ data['accountType'] = 'HOSTED_OR_GOOGLE'
13
+ data['Email'] = login
14
+ data['Passwd'] = password
15
+ data['service'] = 'ac2dm'
16
+ data['source'] = source
17
+
18
+ req = Net::HTTP::Post.new(url.path)
19
+ req.set_form_data data
20
+ http = Net::HTTP.new(url.host, url.port)
21
+ http.use_ssl = true
22
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
23
+ res = http.request(req)
24
+ res.error! unless res.is_a? Net::HTTPSuccess
25
+
26
+ res.body.split("\n").each do |line|
27
+ line.chomp!
28
+ next unless line =~ /^Auth=/
29
+ return line.gsub(/^Auth=/, '')
30
+ end
31
+
32
+ return nil
33
+ end
34
+
35
+ def self.send_c2d_message(regid, authtoken, params)
36
+ url = URI.parse('https://android.apis.google.com/c2dm/send')
37
+
38
+ data = {}
39
+ data['registration_id'] = regid
40
+ data['collapse_key'] = `uuidgen`.strip.gsub('-', '')
41
+
42
+ params.each do |k,v|
43
+ v = v.join(',') if v.is_a? Array
44
+ data["data.#{k.to_s}"] = v
45
+ end
46
+
47
+ req = Net::HTTP::Post.new url.path, 'Authorization' => "GoogleLogin auth=#{authtoken}"
48
+ req.set_form_data data
49
+
50
+ http = Net::HTTP.new(url.host, url.port)
51
+ http.use_ssl = true
52
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE;
53
+ http.request(req)
54
+ end
55
+ end
56
+
57
+ # Example:
58
+ #authtoken = Google.client_login('push-app@gmail.com', 'PASSWORD', 'push-app-1')
59
+ #puts authtoken
@@ -43,6 +43,10 @@ namespace "build" do
43
43
 
44
44
  simulator = $sdk =~ /iphonesimulator/
45
45
 
46
+ if $configuration == 'Distribution'
47
+ $configuration = 'Release'
48
+ end
49
+
46
50
  chdir iphone_path
47
51
  args = ['build', '-target', 'Barcode', '-configuration', $configuration, '-sdk', $sdk]
48
52
 
@@ -197,6 +197,8 @@ module Rho
197
197
  arSrcs = db.select_from_table('sources','source_id, name, sync_priority, partition, sync_type, schema, schema_version, associations, blob_attribs',
198
198
  {'partition'=>str_partition} )
199
199
  arSrcs.each do |src|
200
+ src['schema'] = '<empty_schema>' if src && !src['schema'] && db.table_exist?(src['name'])
201
+
200
202
  Rho::RhoConfig::sources()[ src['name'] ] = src
201
203
  end
202
204
 
@@ -10,6 +10,7 @@ module Rho
10
10
  TOOLBAR_TYPE = 0
11
11
  TABBAR_TYPE = 1
12
12
  NOBAR_TYPE = 2
13
+ VTABBAR_TYPE = 3
13
14
 
14
15
  @@toolbar = [{:action => :back}, {:action => :forward}, {:action => :separator},
15
16
  {:action => :home}, {:action => :refresh}, {:action => :options} ]
@@ -1,6 +1,6 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '2.2.3'
3
+ VERSION = '2.2.4'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
6
  DBVERSION = '2.2.0'
@@ -1,6 +1,6 @@
1
1
  module RhodesFramework
2
2
  unless defined? RhodesFramework::VERSION
3
- VERSION = '2.2.3'
3
+ VERSION = '2.2.4'
4
4
  end
5
5
  unless defined? RhodesFramework::DBVERSION
6
6
  DBVERSION = '2.2.2'
data/lib/rhodes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '2.2.3'
3
+ VERSION = '2.2.4'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
6
  DBVERSION = '2.2.0'
@@ -2,7 +2,7 @@
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.rhomobile.rhodes"
4
4
  android:versionCode="25"
5
- android:versionName="2.2.3">
5
+ android:versionName="2.2.4">
6
6
  <uses-sdk android:minSdkVersion="3" />
7
7
  <application android:icon="@drawable/icon"
8
8
  android:multiprocess="true"
@@ -182,3 +182,24 @@ RHO_GLOBAL void rho_sys_app_exit()
182
182
  env->CallStaticVoidMethod(cls, mid);
183
183
  }
184
184
 
185
+ RHO_GLOBAL void rho_sys_run_app(const char *appname, VALUE params)
186
+ {
187
+ JNIEnv *env = jnienv();
188
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
189
+ if (!cls) return;
190
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "runApplication", "(Ljava/lang/String;Ljava/util/Map;)V");
191
+ if (!mid) return;
192
+ // TODO: convert ruby hash (params) to java map (jParams)
193
+ jobject jParams = NULL;
194
+ env->CallStaticVoidMethod(cls, mid, env->NewStringUTF(appname), jParams);
195
+ }
196
+
197
+ RHO_GLOBAL void rho_sys_open_url(const char *url)
198
+ {
199
+ JNIEnv *env = jnienv();
200
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
201
+ if (!cls) return;
202
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "openExternalUrl", "(Ljava/lang/String;)V");
203
+ if (!mid) return;
204
+ env->CallStaticVoidMethod(cls, mid, env->NewStringUTF(url));
205
+ }
@@ -17,6 +17,10 @@ RHO_GLOBAL void create_nativebar(int bar_type, rho_param *p)
17
17
  RAWLOG_ERROR("Unexpected parameter type, should be Array or Hash");
18
18
  return;
19
19
  }
20
+ // check for iPad SplitTabBar type -> redirect to TabBar
21
+ if (bar_type == 3) {
22
+ bar_type = 1;
23
+ }
20
24
 
21
25
  jobject paramsObj = RhoValueConverter(env).createObject(p);
22
26
  env->CallStaticVoidMethod(clsNativeBar, midCreate, bar_type, paramsObj);
@@ -7,7 +7,9 @@ public class RhoActivity extends Activity {
7
7
  @Override
8
8
  protected void onStart() {
9
9
  super.onStart();
10
- RhodesService.getInstance().activityStarted();
10
+ if (RhodesService.getInstance() != null) {
11
+ RhodesService.getInstance().activityStarted();
12
+ }
11
13
  }
12
14
 
13
15
  @Override
@@ -20,7 +20,11 @@
20
20
  */
21
21
  package com.rhomobile.rhodes;
22
22
 
23
+ import java.util.Timer;
24
+ import java.util.TimerTask;
25
+
23
26
  import com.rhomobile.rhodes.mainview.MainView;
27
+ import com.rhomobile.rhodes.util.PerformOnUiThread;
24
28
 
25
29
  import android.content.Intent;
26
30
  import android.content.pm.ActivityInfo;
@@ -31,6 +35,7 @@ import android.util.Log;
31
35
  import android.view.KeyEvent;
32
36
  import android.view.Menu;
33
37
  import android.view.MenuItem;
38
+ import android.view.ViewGroup;
34
39
  import android.view.Window;
35
40
  import android.view.ViewGroup.LayoutParams;
36
41
  import android.widget.FrameLayout;
@@ -47,11 +52,19 @@ public class Rhodes extends RhoActivity {
47
52
  }
48
53
 
49
54
  private RhoMenu appMenu = null;
55
+
56
+ private ViewGroup mOuterFrame = null;
57
+ private Bundle mSavedBundle = null;
58
+ private SplashScreen mSplashScreen = null;
59
+ private Handler mHandler = null;
50
60
 
51
61
  /** Called when the activity is first created. */
52
62
  @Override
53
63
  public void onCreate(Bundle savedInstanceState) {
64
+ RhodesService.platformLog("Rhodes", "onStart()");
65
+
54
66
  super.onCreate(savedInstanceState);
67
+ mHandler = new Handler();
55
68
 
56
69
  // Here Log should be used, not Logger. It is because Logger is not initialized yet.
57
70
  Log.v(TAG, "+++ onCreate");
@@ -59,30 +72,78 @@ public class Rhodes extends RhoActivity {
59
72
  instance = this;
60
73
 
61
74
  FrameLayout v = new FrameLayout(this);
75
+ mOuterFrame = v;
76
+
77
+ mSplashScreen = RhodesService.showSplashScreen(this, mOuterFrame);
78
+ mSavedBundle = savedInstanceState;
79
+
80
+ getWindow().setFlags(RhodesService.WINDOW_FLAGS, RhodesService.WINDOW_MASK);
81
+
82
+
83
+ this.requestWindowFeature(Window.FEATURE_PROGRESS);
84
+
85
+ getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 10000);
86
+
87
+ setContentView(mOuterFrame, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
88
+
89
+
90
+ }
91
+
92
+ public void onStart() {
93
+ super.onStart();
94
+ RhodesService.platformLog("Rhodes", "onStart()");
95
+ }
96
+
97
+ public void onCreatePosponed() {
98
+ RhodesService.platformLog("Rhodes", "onCreatePosponed()");
62
99
 
63
100
  RhodesService service = RhodesService.getInstance();
64
101
  if (service == null) {
65
102
  Log.v(TAG, "Starting rhodes service...");
66
- service = new RhodesService(this, v);
103
+ service = new RhodesService(this, mOuterFrame, mSplashScreen);
67
104
  }
68
105
  else
69
106
  Log.v(TAG, "Rhodes service already started...");
70
107
 
71
108
  Thread ct = Thread.currentThread();
72
109
  ct.setPriority(Thread.MAX_PRIORITY);
73
- service.setInfo(this, ct.getId(), new Handler());
110
+ service.setInfo(this, ct.getId(), mHandler);
74
111
 
75
- getWindow().setFlags(RhodesService.WINDOW_FLAGS, RhodesService.WINDOW_MASK);
76
112
 
77
113
  boolean disableScreenRotation = RhoConf.getBool("disable_screen_rotation");
78
114
  this.setRequestedOrientation(disableScreenRotation ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT :
79
115
  ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
80
116
 
81
- if (RhodesService.ENABLE_LOADING_INDICATION)
82
- this.requestWindowFeature(Window.FEATURE_PROGRESS);
117
+ //if (RhodesService.ENABLE_LOADING_INDICATION)
118
+ // this.requestWindowFeature(Window.FEATURE_PROGRESS);
83
119
 
84
- service.setRootWindow(v);
85
- setContentView(v, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
120
+ service.setRootWindow(mOuterFrame);
121
+
122
+ RhodesService.getInstance().activityStarted();
123
+
124
+ if (mTimerPostponeCreate != null) {
125
+ mTimerPostponeCreate.cancel();
126
+ mTimerPostponeCreate = null;
127
+ }
128
+ }
129
+
130
+ private Timer mTimerPostponeCreate = null;
131
+
132
+ public void onResume() {
133
+ RhodesService.platformLog("Rhodes", "onResume()");
134
+
135
+ super.onResume();
136
+
137
+ }
138
+
139
+ public static void runPosponedSetup() {
140
+ final Rhodes r = Rhodes.getInstance();
141
+ r.mHandler.post( new Runnable() {
142
+ public void run() {
143
+ RhodesService.platformLog("Rhodes", "postponed Create UIThread.run()");
144
+ r.onCreatePosponed();
145
+ }
146
+ });
86
147
  }
87
148
 
88
149
  @Override
@@ -5,6 +5,7 @@ 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.Map;
8
9
  import java.util.Set;
9
10
  import java.util.TimeZone;
10
11
  import java.util.Vector;
@@ -17,6 +18,7 @@ import com.rhomobile.rhodes.mainview.MainView;
17
18
  import com.rhomobile.rhodes.ui.AboutDialog;
18
19
  import com.rhomobile.rhodes.ui.LogOptionsDialog;
19
20
  import com.rhomobile.rhodes.ui.LogViewDialog;
21
+ import com.rhomobile.rhodes.uri.ExternalHttpHandler;
20
22
  import com.rhomobile.rhodes.uri.MailUriHandler;
21
23
  import com.rhomobile.rhodes.uri.SmsUriHandler;
22
24
  import com.rhomobile.rhodes.uri.TelUriHandler;
@@ -29,11 +31,15 @@ import com.rhomobile.rhodes.webview.RhoWebSettings;
29
31
  import android.app.Activity;
30
32
  import android.content.Context;
31
33
  import android.content.Intent;
34
+ import android.content.pm.ActivityInfo;
32
35
  import android.content.pm.ApplicationInfo;
36
+ import android.content.pm.PackageInfo;
37
+ import android.content.pm.PackageManager;
33
38
  import android.content.pm.PackageManager.NameNotFoundException;
34
39
  import android.graphics.Bitmap;
35
40
  import android.net.ConnectivityManager;
36
41
  import android.net.NetworkInfo;
42
+ import android.net.Uri;
37
43
  import android.os.Build;
38
44
  import android.os.Bundle;
39
45
  import android.os.Handler;
@@ -78,6 +84,15 @@ public class RhodesService {
78
84
  return ctx;
79
85
  }
80
86
 
87
+ public static void platformLog(String _tag, String _message) {
88
+ StringBuilder s = new StringBuilder();
89
+ s.append("ms[");
90
+ s.append(System.currentTimeMillis());
91
+ s.append("] ");
92
+ s.append(_message);
93
+ android.util.Log.v(_tag, s.toString());
94
+ }
95
+
81
96
  private RhoLogConf m_rhoLogConf = new RhoLogConf();
82
97
  public RhoLogConf getLogConf() {
83
98
  return m_rhoLogConf;
@@ -104,7 +119,7 @@ public class RhodesService {
104
119
  ctx = c;
105
120
  uiThreadId = id;
106
121
  uiHandler = handler;
107
- RhoBluetoothManager.sharedInstance();
122
+ //RhoBluetoothManager.sharedInstance();
108
123
  }
109
124
 
110
125
  private Handler uiHandler;
@@ -259,9 +274,10 @@ public class RhodesService {
259
274
  return false;
260
275
  }
261
276
 
262
- private void showSplashScreen() {
263
- splashScreen = new SplashScreen(ctx);
264
- splashScreen.start(outerFrame);
277
+ public static SplashScreen showSplashScreen(Context ctx, ViewGroup myOuterFrame) {
278
+ SplashScreen splashScreen = new SplashScreen(ctx);
279
+ splashScreen.start(myOuterFrame);
280
+ return splashScreen;
265
281
  }
266
282
 
267
283
  public void hideSplashScreen() {
@@ -278,6 +294,50 @@ public class RhodesService {
278
294
  }, false);
279
295
  }
280
296
 
297
+ public static WebView createLoadingWebView(Context ctx) {
298
+ WebView w = new WebView(ctx);
299
+
300
+ //webSettings.setWebSettings(w);
301
+
302
+ w.clearCache(true);
303
+
304
+ w.setWebViewClient(new WebViewClient() {
305
+
306
+ private boolean splashHidden = false;
307
+ private boolean setupExecuted = false;
308
+
309
+ @Override
310
+ public void onPageStarted(WebView view, String url, Bitmap favicon) {
311
+ super.onPageStarted(view, url, favicon);
312
+ }
313
+
314
+ @Override
315
+ public void onPageFinished(WebView view, String url) {
316
+ RhodesService rs = RhodesService.getInstance();
317
+ if (rs != null) {
318
+ if (!splashHidden && url.startsWith("http://")) {
319
+ rs.hideSplashScreen();
320
+ splashHidden = true;
321
+ }
322
+ }
323
+ //if (ENABLE_LOADING_INDICATION)
324
+ Rhodes.getInstance().getWindow().setFeatureInt(Window.FEATURE_PROGRESS, MAX_PROGRESS);
325
+ super.onPageFinished(view, url);
326
+ if (!setupExecuted) {
327
+ Rhodes.runPosponedSetup();
328
+ setupExecuted = true;
329
+ }
330
+
331
+ }
332
+
333
+ });
334
+
335
+ //w.setWebChromeClient(chromeClient);
336
+
337
+ return w;
338
+
339
+ }
340
+
281
341
  public WebView createWebView() {
282
342
  WebView w = new WebView(ctx);
283
343
 
@@ -313,7 +373,7 @@ public class RhodesService {
313
373
  hideSplashScreen();
314
374
  splashHidden = true;
315
375
  }
316
- if (ENABLE_LOADING_INDICATION)
376
+ //if (ENABLE_LOADING_INDICATION)
317
377
  r.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, MAX_PROGRESS);
318
378
  super.onPageFinished(view, url);
319
379
  }
@@ -384,9 +444,14 @@ public class RhodesService {
384
444
  return instance != null;
385
445
  }
386
446
 
387
- public RhodesService(Activity c, ViewGroup rootWindow) {
447
+ public RhodesService(Activity c, ViewGroup rootWindow, SplashScreen splash_s) {
448
+
388
449
  ctx = c;
389
450
  instance = this;
451
+ outerFrame = rootWindow;
452
+
453
+ //showSplashScreen();
454
+ splashScreen = splash_s;
390
455
 
391
456
  initClassLoader(ctx.getClassLoader());
392
457
 
@@ -426,11 +491,10 @@ public class RhodesService {
426
491
  ENABLE_LOADING_INDICATION = !RhoConf.getBool("disable_loading_indication");
427
492
 
428
493
  initWebStuff();
429
-
430
- outerFrame = rootWindow;
431
-
494
+
432
495
  Logger.I("Rhodes", "Loading...");
433
- showSplashScreen();
496
+ //showSplashScreen();
497
+ splashScreen.rho_start();
434
498
 
435
499
  // Increase WebView rendering priority
436
500
  WebView w = new WebView(ctx);
@@ -453,6 +517,7 @@ public class RhodesService {
453
517
  isCameraAvailable = true;
454
518
 
455
519
  // Register custom uri handlers here
520
+ uriHandlers.addElement(new ExternalHttpHandler(ctx));
456
521
  uriHandlers.addElement(new MailUriHandler(ctx));
457
522
  uriHandlers.addElement(new TelUriHandler(ctx));
458
523
  uriHandlers.addElement(new SmsUriHandler(ctx));
@@ -709,6 +774,44 @@ public class RhodesService {
709
774
  TimeZone tz = cal.getTimeZone();
710
775
  return tz.getDisplayName();
711
776
  }
777
+
778
+ public static void runApplication(String appName, Map<Object, Object> params) {
779
+ try {
780
+ Context ctx = RhodesService.getInstance().getContext();
781
+ PackageManager mgr = ctx.getPackageManager();
782
+ PackageInfo info = mgr.getPackageInfo(appName, PackageManager.GET_ACTIVITIES);
783
+ if (info.activities.length == 0) {
784
+ Logger.E(TAG, "No activities found for application " + appName);
785
+ return;
786
+ }
787
+ ActivityInfo ainfo = info.activities[0];
788
+ String className = ainfo.name;
789
+ if (className.startsWith("."))
790
+ className = ainfo.packageName + className;
791
+
792
+ Intent intent = new Intent();
793
+ intent.setClassName(appName, className);
794
+ ctx.startActivity(intent);
795
+ }
796
+ catch (Exception e) {
797
+ Logger.E(TAG, "Can't run application " + appName + ": " + e.getMessage());
798
+ }
799
+ }
800
+
801
+ public static void openExternalUrl(String url) {
802
+ try {
803
+ Context ctx = RhodesService.getInstance().getContext();
804
+ Uri uri = Uri.parse(url);
805
+
806
+ Intent intent = new Intent(Intent.ACTION_VIEW);
807
+ intent.setData(uri);
808
+
809
+ ctx.startActivity(Intent.createChooser(intent, "Open in..."));
810
+ }
811
+ catch (Exception e) {
812
+ Logger.E(TAG, "Can't open url :" + url + ": " + e.getMessage());
813
+ }
814
+ }
712
815
 
713
816
  public native void setPushRegistrationId(String id);
714
817