rhodes 2.2.4.beta.1 → 2.2.5.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Rakefile +119 -3
- data/lib/build/jake.rb +15 -1
- data/lib/framework/dateME.rb +6 -1
- data/lib/framework/rho/render.rb +18 -15
- data/lib/framework/rho/rho.rb +105 -43
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontact.rb +41 -13
- data/lib/framework/rho/rhocontroller.rb +10 -1
- data/lib/framework/rho/rhoevent_c.rb +6 -1
- data/lib/framework/rho/rhosupport.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +1 -1
- data/lib/framework/rholang/rhomsg_es.rb +1 -1
- data/lib/framework/rholang/rhomsg_it.rb +28 -0
- data/lib/framework/rhom/rhom.rb +6 -0
- data/lib/framework/rhom/rhom_model.rb +14 -7
- data/lib/framework/rhom/rhom_object_factory.rb +121 -56
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
- data/platform/android/Rhodes/AndroidManifest.xml +3 -34
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
- data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
- data/platform/android/build/android.rake +50 -9
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
- data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
- data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +21 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
- data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
- data/platform/iphone/Classes/Event/Event.h +2 -0
- data/platform/iphone/Classes/Event/Event.m +12 -1
- data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
- data/platform/iphone/Classes/NativeBar.m +27 -0
- data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
- data/platform/iphone/Classes/RhoAlert.m +61 -1
- data/platform/iphone/Classes/RhoMainView.h +1 -0
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +108 -1
- data/platform/iphone/Classes/SimpleMainView.h +4 -0
- data/platform/iphone/Classes/SimpleMainView.m +30 -3
- data/platform/iphone/Classes/SplashViewController.m +3 -1
- data/platform/iphone/Classes/TabbedMainView.h +2 -0
- data/platform/iphone/Classes/TabbedMainView.m +63 -11
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
- data/platform/iphone/Info.plist +12 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/iphone/rbuild/iphone.rake +181 -25
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +5 -3
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoFilePath.h +11 -0
- data/platform/shared/common/RhoNativeViewManager.h +17 -0
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +29 -8
- data/platform/shared/common/ThreadQueue.cpp +5 -3
- data/platform/shared/common/ThreadQueue.h +2 -1
- data/platform/shared/common/app_build_configs.c +25 -0
- data/platform/shared/common/app_build_configs.h +11 -0
- data/platform/shared/net/AsyncHttp.cpp +5 -5
- data/platform/shared/net/CURLNetRequest.cpp +25 -7
- data/platform/shared/net/CURLNetRequest.h +2 -1
- data/platform/shared/net/HttpServer.cpp +28 -0
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
- data/platform/shared/ruby/ext/system/system.i +13 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
- data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
- data/platform/shared/sync/SyncEngine.cpp +43 -3
- data/platform/shared/sync/SyncEngine.h +13 -0
- data/platform/shared/sync/SyncNotify.cpp +41 -23
- data/platform/shared/sync/SyncNotify.h +18 -4
- data/platform/shared/sync/SyncSource.cpp +52 -14
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +29 -9
- data/platform/shared/sync/SyncThread.h +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/build/build_inf.js +15 -9
- data/platform/wm/build/wm.rake +10 -5
- data/platform/wm/rhodes/Alert.cpp +10 -0
- data/platform/wm/rhodes/Alert.h +3 -3
- data/platform/wm/rhodes/MainWindow.cpp +171 -26
- data/platform/wm/rhodes/MainWindow.h +23 -1
- data/platform/wm/rhodes/MetaHandler.cpp +192 -0
- data/platform/wm/rhodes/MetaHandler.h +31 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
- data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
- data/platform/wm/rhodes/Rhodes.cpp +91 -2
- data/platform/wm/rhodes/Rhodes.rc +15 -6
- data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
- data/platform/wm/rhodes/resource.h +5 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
- data/platform/wm/rhodes/rhodes.vcproj +28 -0
- data/rakefile.rb +119 -3
- data/res/build-tools/iphonesim/README +58 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
- data/res/build-tools/iphonesim/Source/main.m +52 -0
- data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
- data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
- data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/layout.erb +7 -13
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/build.yml +3 -0
- data/res/generators/templates/application/icon/icon114.png +0 -0
- data/res/generators/templates/application/icon/icon57.png +0 -0
- data/res/generators/templates/application/icon/icon72.png +0 -0
- data/res/generators/templates/application/public/css/iphone.css +96 -0
- data/res/generators/templates/application/public/images/backButton.png +0 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
- data/res/generators/templates/application/rhoconfig.txt +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/date_spec.rb +27 -0
- data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
- data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
- data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
- data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
- data/spec/phone_spec/app/spec_runner.rb +6 -0
- metadata +34 -4
@@ -26,6 +26,7 @@ import java.util.Vector;
|
|
26
26
|
import com.rhomobile.rhodes.AndroidR;
|
27
27
|
import com.rhomobile.rhodes.RhodesService;
|
28
28
|
import com.rhomobile.rhodes.file.RhoFileApi;
|
29
|
+
import com.rhomobile.rhodes.nativeview.RhoNativeViewManager;
|
29
30
|
import com.rhomobile.rhodes.util.PerformOnUiThread;
|
30
31
|
|
31
32
|
import android.content.Context;
|
@@ -41,12 +42,15 @@ import android.view.ViewGroup;
|
|
41
42
|
import android.view.WindowManager;
|
42
43
|
import android.webkit.WebView;
|
43
44
|
import android.widget.Button;
|
45
|
+
import android.widget.FrameLayout;
|
44
46
|
import android.widget.ImageButton;
|
45
47
|
import android.widget.LinearLayout;
|
46
48
|
import android.widget.TextView;
|
47
49
|
|
48
50
|
public class SimpleMainView implements MainView {
|
49
51
|
|
52
|
+
private final static String TAG = "SimpleMainView";
|
53
|
+
|
50
54
|
private static final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;
|
51
55
|
private static final int FILL_PARENT = ViewGroup.LayoutParams.FILL_PARENT;
|
52
56
|
|
@@ -56,6 +60,27 @@ public class SimpleMainView implements MainView {
|
|
56
60
|
}
|
57
61
|
};
|
58
62
|
|
63
|
+
public class MyView extends LinearLayout {
|
64
|
+
public MyView(Context ctx) {
|
65
|
+
super(ctx);
|
66
|
+
}
|
67
|
+
|
68
|
+
protected void onSizeChanged (int w, int h, int oldw, int oldh) {
|
69
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
70
|
+
StringBuilder msg = new StringBuilder();
|
71
|
+
msg.append(" Main Window :: onSizeChanged() old [ ");
|
72
|
+
msg.append(w);
|
73
|
+
msg.append(" x ");
|
74
|
+
msg.append(h);
|
75
|
+
msg.append(" ] new [ ");
|
76
|
+
msg.append(oldw);
|
77
|
+
msg.append(" x ");
|
78
|
+
msg.append(oldh);
|
79
|
+
msg.append(" ]");
|
80
|
+
RhodesService.platformLog("SimpleMainView.View", msg.toString());
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
59
84
|
private class ActionForward implements View.OnClickListener {
|
60
85
|
public void onClick(View v) {
|
61
86
|
forward(0);
|
@@ -82,6 +107,7 @@ public class SimpleMainView implements MainView {
|
|
82
107
|
|
83
108
|
private class ActionExit implements View.OnClickListener {
|
84
109
|
public void onClick(View v) {
|
110
|
+
restoreWebView();
|
85
111
|
RhodesService.exit();
|
86
112
|
}
|
87
113
|
};
|
@@ -104,7 +130,10 @@ public class SimpleMainView implements MainView {
|
|
104
130
|
|
105
131
|
private LinearLayout view;
|
106
132
|
private WebView webView;
|
133
|
+
private RhoNativeViewManager.RhoNativeView mNativeView = null;
|
134
|
+
private View mNativeViewView = null;
|
107
135
|
private LinearLayout navBar = null;
|
136
|
+
private LinearLayout toolBar = null;
|
108
137
|
|
109
138
|
public View getView() {
|
110
139
|
return view;
|
@@ -114,8 +143,148 @@ public class SimpleMainView implements MainView {
|
|
114
143
|
return webView;
|
115
144
|
}
|
116
145
|
|
146
|
+
public void setNativeView(RhoNativeViewManager.RhoNativeView nview) {
|
147
|
+
restoreWebView();
|
148
|
+
mNativeView = nview;
|
149
|
+
mNativeViewView = mNativeView.getView();
|
150
|
+
if (mNativeViewView != null) {
|
151
|
+
view.removeView(webView);
|
152
|
+
//int view_index = 0;
|
153
|
+
//if (navBar != null) {
|
154
|
+
//view_index = 1;
|
155
|
+
//}
|
156
|
+
if (navBar != null) {
|
157
|
+
view.removeView(navBar);
|
158
|
+
}
|
159
|
+
if (toolBar != null) {
|
160
|
+
view.removeView(toolBar);
|
161
|
+
}
|
162
|
+
int index = 0;
|
163
|
+
if (navBar != null) {
|
164
|
+
view.addView(navBar, index);
|
165
|
+
index++;
|
166
|
+
}
|
167
|
+
view.addView( mNativeViewView, index, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));
|
168
|
+
index++;
|
169
|
+
if (toolBar != null) {
|
170
|
+
view.addView(toolBar, index);
|
171
|
+
}
|
172
|
+
|
173
|
+
//view.bringChildToFront(mNativeViewView);
|
174
|
+
//view.requestLayout();
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
mNativeView = null;
|
178
|
+
mNativeViewView = null;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
public void restoreWebView() {
|
183
|
+
if (mNativeView != null) {
|
184
|
+
view.removeView(mNativeViewView);
|
185
|
+
mNativeViewView = null;
|
186
|
+
//int view_index = 0;
|
187
|
+
//if (navBar != null) {
|
188
|
+
//view_index = 1;
|
189
|
+
//}
|
190
|
+
|
191
|
+
if (navBar != null) {
|
192
|
+
view.removeView(navBar);
|
193
|
+
}
|
194
|
+
if (toolBar != null) {
|
195
|
+
view.removeView(toolBar);
|
196
|
+
}
|
197
|
+
|
198
|
+
int index = 0;
|
199
|
+
if (navBar != null) {
|
200
|
+
view.addView(navBar, index);
|
201
|
+
index++;
|
202
|
+
}
|
203
|
+
view.addView( webView, index, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));
|
204
|
+
index++;
|
205
|
+
if (toolBar != null) {
|
206
|
+
view.addView(toolBar, index);
|
207
|
+
}
|
208
|
+
|
209
|
+
//view.bringChildToFront(webView);
|
210
|
+
|
211
|
+
mNativeView.destroyView();
|
212
|
+
mNativeView = null;
|
213
|
+
//view.requestLayout();
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
private String processForNativeView(String _url) {
|
219
|
+
StringBuilder s = new StringBuilder("processForNativeView : [");
|
220
|
+
s.append(_url);
|
221
|
+
s.append("]");
|
222
|
+
RhodesService.platformLog(TAG, s.toString());
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
String url = _url;
|
228
|
+
String callback_prefix = "call_stay_native";
|
229
|
+
|
230
|
+
// find protocol:navto pairs
|
231
|
+
|
232
|
+
int last = -1;
|
233
|
+
int cur = url.indexOf(":", last+1);
|
234
|
+
while (cur > 0) {
|
235
|
+
String protocol = url.substring(last+1, cur);
|
236
|
+
String navto = url.substring(cur+1, url.length());
|
237
|
+
|
238
|
+
if (callback_prefix.equals(protocol)) {
|
239
|
+
// navigate but still in native view
|
240
|
+
String cleared_url = url.substring(callback_prefix.length()+1, url.length());
|
241
|
+
return cleared_url;
|
242
|
+
}
|
243
|
+
// check protocol for nativeView
|
244
|
+
RhoNativeViewManager.RhoNativeView nvf = RhoNativeViewManager.getNativeViewByteType(protocol);
|
245
|
+
if (nvf != null) {
|
246
|
+
// we should switch to NativeView
|
247
|
+
//restoreWebView();
|
248
|
+
if (mNativeView != null) {
|
249
|
+
if ( !protocol.equals(mNativeView.getViewType()) ) {
|
250
|
+
setNativeView(nvf);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
else {
|
254
|
+
setNativeView(nvf);
|
255
|
+
}
|
256
|
+
if (mNativeView != null) {
|
257
|
+
mNativeView.navigate(navto);
|
258
|
+
return "";
|
259
|
+
}
|
260
|
+
}
|
261
|
+
last = cur;
|
262
|
+
int c1 = url.indexOf(":", last+1);
|
263
|
+
int c2 = url.indexOf("/", last+1);
|
264
|
+
if ((c1 < c2)) {
|
265
|
+
if (c1 <= 0) {
|
266
|
+
cur = c2;
|
267
|
+
}
|
268
|
+
else {
|
269
|
+
cur = c1;
|
270
|
+
}
|
271
|
+
}
|
272
|
+
else {
|
273
|
+
if (c2 <= 0) {
|
274
|
+
cur = c1;
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
cur = c2;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
restoreWebView();
|
282
|
+
return url;
|
283
|
+
}
|
284
|
+
|
117
285
|
|
118
286
|
public WebView detachWebView() {
|
287
|
+
restoreWebView();
|
119
288
|
WebView v = null;
|
120
289
|
if (webView != null) {
|
121
290
|
view.removeView(webView);
|
@@ -219,7 +388,7 @@ public class SimpleMainView implements MainView {
|
|
219
388
|
RhodesService r = RhodesService.getInstance();
|
220
389
|
Context ctx = r.getContext();
|
221
390
|
|
222
|
-
view = new
|
391
|
+
view = new MyView(ctx);
|
223
392
|
view.setOrientation(LinearLayout.VERTICAL);
|
224
393
|
view.setGravity(Gravity.BOTTOM);
|
225
394
|
view.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, FILL_PARENT));
|
@@ -238,6 +407,8 @@ public class SimpleMainView implements MainView {
|
|
238
407
|
bottom.setLayoutParams(new LinearLayout.LayoutParams(FILL_PARENT, WRAP_CONTENT, 0));
|
239
408
|
view.addView(bottom);
|
240
409
|
|
410
|
+
toolBar = bottom;
|
411
|
+
|
241
412
|
Vector<Object> buttons = null;
|
242
413
|
if (params != null) {
|
243
414
|
if (params instanceof Vector<?>) {
|
@@ -331,19 +502,29 @@ public class SimpleMainView implements MainView {
|
|
331
502
|
}
|
332
503
|
|
333
504
|
public void goBack() {
|
505
|
+
restoreWebView();
|
334
506
|
webView.goBack();
|
335
507
|
}
|
336
508
|
|
337
509
|
public void forward(int index) {
|
510
|
+
restoreWebView();
|
338
511
|
webView.goForward();
|
339
512
|
}
|
340
513
|
|
341
514
|
public void navigate(String url, int index) {
|
342
|
-
|
515
|
+
String cleared_url = processForNativeView(url);
|
516
|
+
if (cleared_url.length() > 0) {
|
517
|
+
webView.loadUrl(url);
|
518
|
+
}
|
343
519
|
}
|
344
520
|
|
345
521
|
public void reload(int index) {
|
346
|
-
|
522
|
+
if (mNativeViewView != null) {
|
523
|
+
mNativeViewView.invalidate();
|
524
|
+
}
|
525
|
+
else {
|
526
|
+
webView.reload();
|
527
|
+
}
|
347
528
|
}
|
348
529
|
|
349
530
|
public String currentLocation(int index) {
|
@@ -359,6 +540,7 @@ public class SimpleMainView implements MainView {
|
|
359
540
|
}
|
360
541
|
|
361
542
|
public void loadData(String data, int index) {
|
543
|
+
restoreWebView();
|
362
544
|
webView.loadData(data, "text/html", "utf-8");
|
363
545
|
}
|
364
546
|
|
@@ -5,10 +5,63 @@ import android.view.View;
|
|
5
5
|
import android.webkit.WebView;
|
6
6
|
import com.rhomobile.rhodes.RhodesService;
|
7
7
|
|
8
|
-
class RhoNativeViewManager {
|
8
|
+
public class RhoNativeViewManager {
|
9
9
|
|
10
|
+
public interface RhoNativeView {
|
11
|
+
View getView();
|
12
|
+
void navigate(String url);
|
13
|
+
void destroyView();
|
14
|
+
String getViewType();
|
15
|
+
}
|
16
|
+
|
17
|
+
private static class RhoNativeViewImpl implements RhoNativeView {
|
18
|
+
|
19
|
+
RhoNativeViewImpl(String viewType, long factory_h, long view_h) {
|
20
|
+
mViewType = viewType;
|
21
|
+
mFactoryHandle = factory_h;
|
22
|
+
mViewHandle = view_h;
|
23
|
+
}
|
24
|
+
|
25
|
+
public View getView() {
|
26
|
+
return getViewByHandle(mViewHandle);
|
27
|
+
}
|
28
|
+
|
29
|
+
public void navigate(String url) {
|
30
|
+
navigateByHandle(mViewHandle, url);
|
31
|
+
}
|
32
|
+
public void destroyView() {
|
33
|
+
destroyByHandle(mFactoryHandle, mViewHandle);
|
34
|
+
}
|
35
|
+
public String getViewType() {
|
36
|
+
return mViewType;
|
37
|
+
}
|
38
|
+
private String mViewType;
|
39
|
+
private long mFactoryHandle;
|
40
|
+
private long mViewHandle;
|
41
|
+
}
|
42
|
+
|
10
43
|
public static WebView getWebViewObject(int tab_index) {
|
11
44
|
return RhodesService.getInstance().getMainView().getWebView(tab_index);
|
12
45
|
}
|
13
46
|
|
47
|
+
public static RhoNativeView getNativeViewByteType(String typename) {
|
48
|
+
long factory_h = getFactoryHandleByViewType(typename);
|
49
|
+
if (factory_h == 0) {
|
50
|
+
return null;
|
51
|
+
}
|
52
|
+
long view_h = getViewHandleByFactoryHandle(factory_h);
|
53
|
+
if (view_h == 0) {
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
RhoNativeViewImpl nv = new RhoNativeViewImpl(typename, factory_h, view_h);
|
57
|
+
return nv;
|
58
|
+
}
|
59
|
+
|
60
|
+
private native static View getViewByHandle(long handle);
|
61
|
+
private native static void navigateByHandle(long handle, String url);
|
62
|
+
private native static long getFactoryHandleByViewType(String viewtype);
|
63
|
+
private native static long getViewHandleByFactoryHandle(long factory_h);
|
64
|
+
private native static void destroyByHandle(long factory_h, long view_h);
|
65
|
+
|
66
|
+
|
14
67
|
}
|
@@ -20,43 +20,136 @@
|
|
20
20
|
*/
|
21
21
|
package com.rhomobile.rhodes.phonebook;
|
22
22
|
|
23
|
-
|
24
|
-
import
|
25
|
-
import java.util.Map;
|
23
|
+
|
24
|
+
import com.rhomobile.rhodes.Logger;
|
26
25
|
|
27
26
|
public class Contact {
|
28
27
|
|
28
|
+
private static final String TAG = "Contact";
|
29
|
+
private static final boolean logging_enable = false;
|
30
|
+
|
29
31
|
private String id = null;
|
30
|
-
|
31
|
-
private
|
32
|
+
|
33
|
+
//private Map<String, ContactField> fields = new HashMap<String, ContactField>();
|
34
|
+
//private Iterator<ContactField> iter = null;
|
35
|
+
private ContactAccessor mAccessor = null;
|
36
|
+
|
37
|
+
private boolean mIsNameFilled = false;
|
38
|
+
private boolean mIsPhoneFilled = false;
|
39
|
+
private boolean mIsEmailsFilled = false;
|
40
|
+
private boolean mIsCompanyFilled = false;
|
41
|
+
|
42
|
+
private String mFields[] = new String[Phonebook.PB_FIELDS_COUNT];
|
43
|
+
|
32
44
|
|
33
45
|
public Contact() {
|
34
|
-
moveToBegin();
|
46
|
+
//moveToBegin();
|
47
|
+
}
|
48
|
+
|
49
|
+
public void setAccessor(ContactAccessor accessor) {
|
50
|
+
mAccessor = accessor;
|
51
|
+
}
|
52
|
+
|
53
|
+
public void makeAllFilled() {
|
54
|
+
mIsNameFilled = true;
|
55
|
+
mIsPhoneFilled = true;
|
56
|
+
mIsEmailsFilled = true;
|
57
|
+
mIsCompanyFilled = true;
|
58
|
+
}
|
59
|
+
|
60
|
+
private boolean isFullFilled() {
|
61
|
+
return (mIsNameFilled && mIsPhoneFilled && mIsEmailsFilled && mIsCompanyFilled);
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
public void setFieldInner(int key, String value) {
|
66
|
+
if ((key >= 0) && (key < Phonebook.PB_FIELDS_COUNT)) {
|
67
|
+
mFields[key] = value;
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
Logger.E(TAG, "Invalid field index !");
|
71
|
+
}
|
35
72
|
}
|
36
73
|
|
37
|
-
|
74
|
+
|
75
|
+
private void prepareField(int key) {
|
76
|
+
if ((mAccessor != null) && (mAccessor instanceof ContactAccessorNew)) {
|
77
|
+
|
78
|
+
if ((!mIsNameFilled) && ((key == Phonebook.PB_I_FIRST_NAME) || (key == Phonebook.PB_I_LAST_NAME))) {
|
79
|
+
((ContactAccessorNew)mAccessor).fillName(id, this);
|
80
|
+
mIsNameFilled = true;
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
if ((!mIsPhoneFilled) && ((key == Phonebook.PB_I_MOBILE_NUMBER) || (key == Phonebook.PB_I_HOME_NUMBER) || (key == Phonebook.PB_I_BUSINESS_NUMBER))) {
|
84
|
+
((ContactAccessorNew)mAccessor).fillPhones(id, this);
|
85
|
+
mIsPhoneFilled = true;
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
if ((!mIsEmailsFilled) && (key == Phonebook.PB_I_EMAIL_ADDRESS)) {
|
89
|
+
((ContactAccessorNew)mAccessor).fillEmails(id, this);
|
90
|
+
mIsEmailsFilled = true;
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
if ((mIsCompanyFilled) && (key == Phonebook.PB_I_COMPANY_NAME)) {
|
94
|
+
((ContactAccessorNew)mAccessor).fillCompany(id, this);
|
95
|
+
mIsCompanyFilled = true;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
public void setField(int key, String value)
|
38
104
|
{
|
39
|
-
|
105
|
+
if ((key >= 0) && (key < Phonebook.PB_FIELDS_COUNT)) {
|
106
|
+
prepareField(key);
|
107
|
+
setFieldInner(key, value);
|
108
|
+
}
|
109
|
+
else {
|
110
|
+
Logger.E(TAG, "Invalid field index !");
|
111
|
+
}
|
40
112
|
}
|
41
113
|
|
42
|
-
public String getField(
|
114
|
+
public String getField(int key)
|
43
115
|
{
|
44
|
-
if (
|
45
|
-
|
46
|
-
|
116
|
+
if ((key >= 0) && (key < Phonebook.PB_FIELDS_COUNT)) {
|
117
|
+
prepareField(key);
|
118
|
+
return mFields[key];
|
119
|
+
}
|
47
120
|
return null;
|
48
121
|
}
|
49
122
|
|
50
123
|
public void setId(String v) {
|
51
124
|
id = v;
|
52
|
-
|
125
|
+
setFieldInner(Phonebook.PB_I_ID, convertPlatformIDtoRhodeID(v));
|
126
|
+
}
|
127
|
+
|
128
|
+
public static String convertPlatformIDtoRhodeID(String id) {
|
129
|
+
return "{" + id + "}";
|
130
|
+
}
|
131
|
+
|
132
|
+
public static String convertRhodeIDtoPlatformID(String id) {
|
133
|
+
return id.substring(1, id.length()-1);
|
53
134
|
}
|
54
135
|
|
55
136
|
public String id() {
|
56
137
|
return id;
|
57
138
|
}
|
139
|
+
|
140
|
+
private void fillAll() {
|
141
|
+
if (!isFullFilled()) {
|
142
|
+
int i;
|
143
|
+
for (i = 0; i < Phonebook.PB_FIELDS_COUNT; i++) {
|
144
|
+
prepareField(i);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
58
148
|
|
149
|
+
|
150
|
+
/*
|
59
151
|
public void moveToBegin() {
|
152
|
+
fillAll();
|
60
153
|
iter = fields.values().iterator();
|
61
154
|
}
|
62
155
|
|
@@ -67,5 +160,5 @@ public class Contact {
|
|
67
160
|
public Object next() {
|
68
161
|
return iter.next();
|
69
162
|
}
|
70
|
-
|
163
|
+
*/
|
71
164
|
}
|