rhodes 3.0.1.beta.4 → 3.0.1.beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG +2 -0
  2. data/Manifest.txt +13 -12
  3. data/Rakefile +1 -1
  4. data/bin/get-rhodes-info +61 -0
  5. data/bin/get-rhodes-info.bat +1 -0
  6. data/doc/connect-to-web-services.txt +5 -1
  7. data/doc/device-caps.txt +12 -0
  8. data/doc/nfc.txt +1 -1
  9. data/doc/rhom.txt +13 -11
  10. data/doc/ui.txt +5 -0
  11. data/lib/build/jake.rb +10 -7
  12. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +11 -8
  13. data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +17 -17
  14. data/lib/extensions/nfc/ext/nfc/platform/android/{res → additional_files/res}/xml/filter_nfc.xml +1 -2
  15. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +26 -5
  16. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java +68 -53
  17. data/lib/extensions/nfc/ext.yml +4 -0
  18. data/lib/framework/res/{back_btn.wp7.png → back_btn.wp.png} +0 -0
  19. data/lib/framework/res/{blue_pushpin_small.wp7.png → blue_pushpin_small.wp.png} +0 -0
  20. data/lib/framework/res/{callout.wp7.png → callout.wp.png} +0 -0
  21. data/lib/framework/res/{callout_link.wp7.png → callout_link.wp.png} +0 -0
  22. data/lib/framework/res/{esri.wp7.png → esri.wp.png} +0 -0
  23. data/lib/framework/res/{forward_btn.wp7.png → forward_btn.wp.png} +0 -0
  24. data/lib/framework/res/{home_btn.wp7.png → home_btn.wp.png} +0 -0
  25. data/lib/framework/res/{options_btn.wp7.png → options_btn.wp.png} +0 -0
  26. data/lib/framework/res/{refresh_btn.wp7.png → refresh_btn.wp.png} +0 -0
  27. data/lib/framework/rho/rho.rb +28 -15
  28. data/lib/framework/rho/rhoapplication.rb +9 -7
  29. data/lib/framework/rhom/rhom_object_factory.rb +34 -12
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +48 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +2 -1
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityStartupListeners.java +11 -0
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +5 -5
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +31 -0
  35. data/platform/android/build/RhodesSRC_build.files +1 -0
  36. data/platform/android/build/android.rake +192 -79
  37. data/platform/bb/build/bb.rake +1 -1
  38. data/platform/shared/db/DBAdapter.cpp +3 -0
  39. data/platform/shared/net/HttpServer.cpp +24 -8
  40. data/platform/shared/ruby/ext/rho/rhoruby.c +8 -0
  41. data/platform/wp7/RhoAppRunner/Program.cs +2 -2
  42. data/platform/wp7/build/wp.rake +7 -7
  43. data/rakefile.rb +1 -1
  44. data/res/build-tools/RhoAppRunner.exe +0 -0
  45. data/res/generators/templates/application/app/helpers/application_helper.rb +4 -1
  46. data/res/generators/templates/application/public/jqtouch/jqtouch.js +21 -9
  47. data/rhodes.gemspec +1 -1
  48. data/spec/phone_spec/app/spec/rhom_object_spec.rb +35 -1
  49. metadata +17 -16
  50. data/lib/framework/res/blue_pushpin.wp7.png +0 -0
  51. data/platform/android/Rhodes/res/xml/filter_nfc.xml +0 -9
data/CHANGELOG CHANGED
@@ -1,6 +1,8 @@
1
1
  ## 3.0.1
2
2
  * Fix customer issues
3
3
  * Android: fix push issues
4
+ * Support Android 3.1
5
+ * Support Windows Phone 7.1(Mango)
4
6
 
5
7
  ## 3.0
6
8
  * RhoSimulator: simulator for fast Rhodes application development, support debugging using Rhodes Eclipse plug-in.(Windows only)
data/Manifest.txt CHANGED
@@ -1,4 +1,6 @@
1
1
  bin/c2dm.rb
2
+ bin/get-rhodes-info
3
+ bin/get-rhodes-info.bat
2
4
  bin/rhodes
3
5
  bin/rhodes-setup
4
6
  bin/rhodes-setup.bat
@@ -721,11 +723,11 @@ lib/extensions/net-http/uri/mailto.rb
721
723
  lib/extensions/net-http/uri.rb
722
724
  lib/extensions/nfc/ext/build
723
725
  lib/extensions/nfc/ext/build.bat
726
+ lib/extensions/nfc/ext/nfc/platform/android/additional_files/res/xml/filter_nfc.xml
724
727
  lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml
725
728
  lib/extensions/nfc/ext/nfc/platform/android/ext_build.files
726
729
  lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp
727
730
  lib/extensions/nfc/ext/nfc/platform/android/Rakefile
728
- lib/extensions/nfc/ext/nfc/platform/android/res/xml/filter_nfc.xml
729
731
  lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java
730
732
  lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java
731
733
  lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcMessage.java
@@ -870,25 +872,24 @@ lib/framework/rational.rb
870
872
  lib/framework/rational18.rb
871
873
  lib/framework/rationalME.rb
872
874
  lib/framework/res/back_btn.wm.png
873
- lib/framework/res/back_btn.wp7.png
875
+ lib/framework/res/back_btn.wp.png
874
876
  lib/framework/res/blue_pushpin.wm.png
875
- lib/framework/res/blue_pushpin.wp7.png
876
877
  lib/framework/res/blue_pushpin_small.wm.png
877
- lib/framework/res/blue_pushpin_small.wp7.png
878
+ lib/framework/res/blue_pushpin_small.wp.png
878
879
  lib/framework/res/callout.wm.png
879
- lib/framework/res/callout.wp7.png
880
+ lib/framework/res/callout.wp.png
880
881
  lib/framework/res/callout_link.wm.png
881
- lib/framework/res/callout_link.wp7.png
882
+ lib/framework/res/callout_link.wp.png
882
883
  lib/framework/res/esri.wm.png
883
- lib/framework/res/esri.wp7.png
884
+ lib/framework/res/esri.wp.png
884
885
  lib/framework/res/forward_btn.wm.png
885
- lib/framework/res/forward_btn.wp7.png
886
+ lib/framework/res/forward_btn.wp.png
886
887
  lib/framework/res/home_btn.wm.png
887
- lib/framework/res/home_btn.wp7.png
888
+ lib/framework/res/home_btn.wp.png
888
889
  lib/framework/res/options_btn.wm.png
889
- lib/framework/res/options_btn.wp7.png
890
+ lib/framework/res/options_btn.wp.png
890
891
  lib/framework/res/refresh_btn.wm.png
891
- lib/framework/res/refresh_btn.wp7.png
892
+ lib/framework/res/refresh_btn.wp.png
892
893
  lib/framework/rho/mapview.rb
893
894
  lib/framework/rho/render.rb
894
895
  lib/framework/rho/rho.rb
@@ -1048,7 +1049,6 @@ platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml
1048
1049
  platform/android/Rhodes/res/menu/options.xml
1049
1050
  platform/android/Rhodes/res/values/strings.xml
1050
1051
  platform/android/Rhodes/res/values/styles.xml
1051
- platform/android/Rhodes/res/xml/filter_nfc.xml
1052
1052
  platform/android/Rhodes/rhobundle.xml
1053
1053
  platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java
1054
1054
  platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java
@@ -1108,6 +1108,7 @@ platform/android/Rhodes/src/com/rhomobile/rhodes/RhoConf.java
1108
1108
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java
1109
1109
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java
1110
1110
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java
1111
+ platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityStartupListeners.java
1111
1112
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java
1112
1113
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java
1113
1114
  platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java
data/Rakefile CHANGED
@@ -207,7 +207,7 @@ namespace "config" do
207
207
  extpaths << $app_config["paths"]["extensions"] if $app_config["paths"] and $app_config["paths"]["extensions"]
208
208
  extpaths << $config["env"]["paths"]["extensions"] if $config["env"]["paths"]["extensions"]
209
209
  extpaths << File.join($app_path, "extensions")
210
- extpaths << "lib/extensions"
210
+ extpaths << File.join($startdir, "lib","extensions")
211
211
  $app_config["extpaths"] = extpaths
212
212
 
213
213
  if $app_config["build"] and $app_config["build"] == "release"
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'templater'
5
+ require File.join(File.dirname(__FILE__), '..', 'res', 'generators', 'rhogen')
6
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'rhodes')
7
+
8
+ # Stub this method to force 1.8 compatibility (come on templater!)
9
+ class Encoding
10
+ def find
11
+ "utf-8"
12
+ end
13
+
14
+ def dummy?
15
+ false
16
+ end
17
+ end
18
+
19
+ class String
20
+ def force_encoding(enc)
21
+ return self
22
+ end
23
+
24
+ def encoding
25
+ if RUBY_VERSION =~ /1\.8/ and Encoding.responds_to?('new')
26
+ Encoding.new
27
+ else
28
+ Encoding.default_external
29
+ end
30
+ end
31
+ end
32
+
33
+ params = ["--rhodes-ver"]
34
+
35
+ def findParam(paramArray, paramId)
36
+ i=0
37
+ until i == paramArray.size do
38
+
39
+ param = paramArray[i]
40
+ paramPair = param.split('=')
41
+
42
+ if paramPair.size > 1
43
+ if paramId == paramPair[0] then
44
+ return paramPair[1].to_s
45
+ end
46
+ end
47
+
48
+ i += 1
49
+ end
50
+
51
+ return nil
52
+ end
53
+
54
+ requestVer = findParam(ARGV, params[0])
55
+
56
+ if requestVer >= Rhodes::VERSION
57
+ puts 1
58
+ else
59
+ puts 0
60
+ end
61
+
@@ -0,0 +1 @@
1
+ @ruby %~dp0get-rhodes-info %*
@@ -9,7 +9,11 @@ Below is the list of available `AsyncHttp` methods you can use to asyncrhonously
9
9
  * `:url` - URL of the request.
10
10
  * `:headers` - Hash of headers to send with the request.
11
11
  * `:callback` - Callback action to execute when the request is done.
12
- * `:callback_param` - (optional) Parameters to send to the callback.
12
+ * `:callback_param` - (optional) Parameters to send to the callback. Parameters values should be url encoded:
13
+
14
+ :callback_param => "action=text&title=#{Rho::RhoSupport.url_encode(@params['page_title'])}"
15
+ #values will be decoded automatically in callback
16
+
13
17
  * `:authentication` - (optional) Send Basic Auth header with request. This takes the form:
14
18
 
15
19
  :authentication => {
data/doc/device-caps.txt CHANGED
@@ -1117,6 +1117,18 @@ Open link in external application (browser for http:// links):
1117
1117
 
1118
1118
  Open appstore on iphone: [http://wiki.akosma.com/IPhone_URL_Schemes#App_Store](http://wiki.akosma.com/IPhone_URL_Schemes#App_Store)
1119
1119
 
1120
+ ### jQuery/JQtouch
1121
+ When using jQuery/JQtouch in application code, you cannot use usual html links for hyperlinks. You need to call controller action and call WebView.navigate from there:
1122
+
1123
+ #Ajax call of controller method:
1124
+ $.get("/app/TestController/send_mail",function(data) {});
1125
+
1126
+ #TestController method:
1127
+ def send_mail
1128
+ WebView.navigate( 'mailto:test@host.com' )
1129
+ #to open url inexternal application you can use System.open_url
1130
+ end
1131
+
1120
1132
  ### Blackberry
1121
1133
  On Blackberry 5.0 and later you can use JavaScript [blackberry.launch object](http://docs.blackberry.com/en/developers/deliverables/18446/blackberry_launch_971534_11.jsp#blackberry_launch_newMap_971532_11)
1122
1134
  to create SMS, make Phone call etc.
data/doc/nfc.txt CHANGED
@@ -10,7 +10,7 @@ There are two different NFC callback can be received (you should setup callbacks
10
10
  * NFC callback : it executed when Android ACTION_NDEF_DISCOVERED or ACTION_TAG_DISCOVERED events processed.
11
11
  * NFC Tech callback : it executed when Android ACTION_TECH_DISCOVERED event processed.
12
12
  In case of current state of NFC support in Android you can receive NFC callback only if your application in foreground. If your application is not run or in background - only ACTION_TECH_DISCOVERED is processed.
13
- For process ACTION_TECH_DISCOVERED event you should setup list of techs in special resource file : [Rhodes ROOT]/platform/android/Rhodes/res/xml/filter_nfc.xml. See according Android documentation - [Android ACTION_TECH_DISCOVERED description](http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_TECH_DISCOVERED)
13
+ For process ACTION_TECH_DISCOVERED event you should setup list of techs in special resource file : [Rhodes ROOT]/lib/extensions/nfc/ext/nfc/platform/android/additional_files/res/xml/filter_nfc.xml. See according Android documentation - [Android ACTION_TECH_DISCOVERED description](http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_TECH_DISCOVERED)
14
14
  For processing events received when application not run or in background, after start/activate use special method of NfcManager :
15
15
 
16
16
  :::ruby
data/doc/rhom.txt CHANGED
@@ -226,10 +226,12 @@ Below is a full list of options available to fixed schema models:
226
226
 
227
227
  ## Data Migrations
228
228
  To clean all client data at startup - change `app_db_version` in `rhoconfig.txt`.
229
- This scenario will work for Property Bag and Fixed Schema models
229
+ This scenario will work for Property Bag and Fixed Schema models.
230
+
231
+ **NOTE: All local client changes will be lost **
230
232
 
231
233
  ### Fixed Schema Data Migrations
232
- Rhom provides an application hook to migrate the data manually, overriding the default behavior which deletes the data. You can also use this hook to run business logic related to updating the database. For example, your application may want to display a customized alert notifying the user that a migration is in progress and it may take a few moments.
234
+ Rhom provides an application hook to migrate the data manually. You can also use this hook to run business logic related to updating the database. For example, your application may want to display a customized alert notifying the user that a migration is in progress and it may take a few moments.
233
235
 
234
236
  To use this hook, first we need to track the `:schema_version` in our model:
235
237
 
@@ -254,26 +256,26 @@ This is called on application start when `:schema_version` has changed.
254
256
  # new_src['schema']['sql'] contains new schema sql
255
257
  def on_migrate_source(old_version, new_src)
256
258
  # ... do something like alert user ...
257
- super
259
+
260
+ db = Rho::RHO.get_src_db(new_src['name'])
261
+ db.execute_sql("ALTER TABLE #{new_src['name']} ADD COLUMN mytest VARCHAR DEFAULT null")
262
+
263
+ true # does not create table
258
264
  end
259
265
  end
260
-
261
- To let Rhom automatically delete the table and replace the schema:
262
266
 
263
- :::ruby
264
- def on_migrate_source(old_version, new_src)
265
- # ... do something like alert user ...
266
- super
267
- end
267
+ **NOTE: To modify schema without recreate table, you can use only ADD COLUMN command, you cannot remove column or change type(This is sqlite limitation) **
268
268
 
269
269
  Return `false` to run the custom sql specified by the new_src['schema']['sql'] string:
270
270
 
271
271
  :::ruby
272
272
  def on_migrate_source(old_version, new_src)
273
273
  # ... do something like alert user ...
274
- false
274
+ false # create table by source schema - useful only for non-synced models
275
275
  end
276
276
 
277
+ **NOTE: For sync sources, you cannot just recreate table without data copy. Because server will not send this data at sync time. **
278
+
277
279
 
278
280
  ## Rhom API
279
281
  Below is the full list of methods available to Rhom models:
data/doc/ui.txt CHANGED
@@ -603,6 +603,11 @@ Get current tab index
603
603
  :::ruby
604
604
  Rho::NativeTabbar.get_current_tab
605
605
 
606
+ Set iPhone badge to Tab (worked only on iOS devices!)
607
+ :::ruby
608
+ # set badge '12' to tab 1
609
+ Rho::NativeTabbar.set_tab_badge( 1, '12')
610
+
606
611
 
607
612
  Rho::NativeTabbar.create() create native tab bar UI element and activate its first tab. If you want to see another tab, call Rho::NativeTabbar.switch_tab explicitly just after NativeBar.create:
608
613
 
data/lib/build/jake.rb CHANGED
@@ -37,8 +37,11 @@ class Jake
37
37
  end
38
38
 
39
39
  def self.get_absolute(path)
40
+ get_absolute_ex(path, Dir.pwd())
41
+ end
42
+
43
+ def self.get_absolute_ex(path, currentdir)
40
44
  return File.expand_path(path) if File.exists?(path)
41
- currentdir = Dir.pwd()
42
45
 
43
46
  path = currentdir + "/" + path
44
47
 
@@ -211,7 +214,7 @@ class Jake
211
214
  wd = options[:directory]
212
215
  if not wd.nil?
213
216
  currentdir = Dir.pwd()
214
- chdir wd
217
+ Dir.chdir wd
215
218
  end
216
219
 
217
220
  cmdstr = argv.map { |x| x =~ / |\|/ ? '"' + x + '"' : x }.join(' ')
@@ -256,7 +259,7 @@ class Jake
256
259
  end
257
260
 
258
261
  if not wd.nil?
259
- chdir currentdir
262
+ Dir.chdir currentdir
260
263
  end
261
264
 
262
265
  retval
@@ -286,9 +289,9 @@ class Jake
286
289
  args << "xf"
287
290
  args << src.to_s
288
291
 
289
- chdir targetdir
292
+ Dir.chdir targetdir
290
293
  puts run(cmd,args)
291
- chdir currentdir
294
+ Dir.chdir currentdir
292
295
  end
293
296
 
294
297
  def self.jarfilelist(target)
@@ -347,7 +350,7 @@ class Jake
347
350
  currentdir = Dir.pwd()
348
351
 
349
352
 
350
- chdir destdir
353
+ Dir.chdir destdir
351
354
 
352
355
  if output and title and version and vendor
353
356
  f = File.new(output + ".rapc", "w")
@@ -403,7 +406,7 @@ class Jake
403
406
  cmd.gsub!(/\//,"\\")
404
407
  outputstring = run(cmd, args)
405
408
  puts outputstring unless $? == 0
406
- chdir currentdir
409
+ Dir.chdir currentdir
407
410
 
408
411
  end
409
412
 
@@ -3,15 +3,13 @@
3
3
  package="com.rhomobile.rhodes"
4
4
  android:installLocation="auto"
5
5
  android:versionCode="29"
6
- android:versionName="2.3.1">
7
-
8
- <uses-sdk android:minSdkVersion="10" />
9
-
10
- <uses-feature android:name="android.hardware.nfc" android:required="false" />
6
+ android:versionName="2.3.3">
7
+
8
+ <application >
11
9
 
12
- <application>
10
+ <activity
11
+ android:name="com.rhomobile.rhodes.RhodesActivity">
13
12
 
14
- <activity android:name="com.rhomobile.nfc.NfcActivity">
15
13
  <intent-filter>
16
14
  <category android:name="android.intent.category.DEFAULT"/>
17
15
  <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
@@ -30,10 +28,15 @@
30
28
  <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
31
29
  android:resource="@xml/filter_nfc"
32
30
  />
31
+
33
32
  </activity>
33
+
34
+ </application >
34
35
 
35
- </application>
36
+ <uses-sdk android:minSdkVersion="10" />
36
37
 
38
+ <uses-feature android:name="android.hardware.nfc" android:required="false" />
39
+
37
40
  <uses-permission android:name="android.permission.NFC" />
38
41
 
39
42
  </manifest>
@@ -71,28 +71,28 @@ namespace "build" do
71
71
  build_extension('Nfc', $arch, src_files)
72
72
 
73
73
  #build java part
74
- javafiles = []
75
- File.open('ext_build.files', "r") do |f|
76
- while line = f.gets
77
- javafiles << line
78
- end
79
- end
74
+ #javafiles = []
75
+ #File.open('ext_build.files', "r") do |f|
76
+ # while line = f.gets
77
+ # javafiles << line
78
+ # end
79
+ #end
80
80
 
81
- flname = $targetdir + '/ext_build.files'
82
- File.open(flname, "a") do |f|
83
- javafiles.each do |j|
84
- f.puts $nfcdir + '/' + j
85
- end
86
- end
81
+ #flname = $targetdir + '/ext_build.files'
82
+ #File.open(flname, "a") do |f|
83
+ # javafiles.each do |j|
84
+ # f.puts $nfcdir + '/' + j
85
+ # end
86
+ #end
87
87
 
88
- mymaniname = $nfcdir + '/ext/nfc/platform/android/AndroidManifest.xml'
89
- maniname = $targetdir + '/AndroidManifest.xml'
88
+ #mymaniname = $nfcdir + '/ext/nfc/platform/android/AndroidManifest.xml'
89
+ #maniname = $targetdir + '/AndroidManifest.xml'
90
90
 
91
- cp_r mymaniname, maniname
91
+ #cp_r mymaniname, maniname
92
92
 
93
93
  # copy xml NFC filter
94
- myres = $nfcdir + '/ext/nfc/platform/android/res'
95
- cp_r myres, $rho_build_dir
94
+ #myres = $nfcdir + '/ext/nfc/platform/android/res'
95
+ #cp_r myres, $rho_build_dir
96
96
 
97
97
  end
98
98
  end
@@ -1,9 +1,8 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
3
+ <!-- capture all MIFARE Classics with NDEF payloads -->
3
4
  <tech-list>
4
5
  <tech>android.nfc.tech.MifareClassic</tech>
5
- </tech-list>
6
- <tech-list>
7
6
  <tech>android.nfc.tech.Ndef</tech>
8
7
  </tech-list>
9
8
  </resources>
@@ -78,6 +78,7 @@ public class Nfc implements RhodesActivityListener {
78
78
  private static NdefMessage[] ourApplicationStartupMessages = null;
79
79
  private static Tag ourApplicationStartupTag = null;
80
80
 
81
+
81
82
  public static void setApplicationStartupIntent(Intent intent) {
82
83
  getInstance().onNewIntent(null, intent, true);
83
84
  }
@@ -89,10 +90,16 @@ public class Nfc implements RhodesActivityListener {
89
90
  getInstance().onReceiveMessages(ourApplicationStartupMessages);
90
91
  ourApplicationStartupMessages = null;
91
92
  }
93
+ else {
94
+ log("ourApplicationStartupMessages is NULL !");
95
+ }
92
96
  if (ourApplicationStartupTag != null) {
93
97
  getInstance().onReceiveTag(ourApplicationStartupTag);
94
98
  ourApplicationStartupTag = null;
95
99
  }
100
+ else {
101
+ log("ourApplicationStartupTag is NULL !");
102
+ }
96
103
  }
97
104
  }, 100);
98
105
  }
@@ -154,7 +161,7 @@ public class Nfc implements RhodesActivityListener {
154
161
  boolean oldEnable = ourIsEnable;
155
162
  ourIsEnable = (enable != 0);
156
163
  if ((oldEnable == false) && (ourIsEnable == true)) {
157
- RhodesActivity.safeGetInstance().addRhodesActivityListener(getInstance());
164
+ //RhodesActivity.safeGetInstance().addRhodesActivityListener(getInstance());
158
165
  PerformOnUiThread.exec( new Runnable() {
159
166
  public void run() {
160
167
  if (RhodesActivity.safeGetInstance().isForegroundNow()) {
@@ -164,7 +171,7 @@ public class Nfc implements RhodesActivityListener {
164
171
  });
165
172
  }
166
173
  if ((oldEnable == true) && (ourIsEnable == false)) {
167
- RhodesActivity.safeGetInstance().removeRhodesActivityListener(getInstance());
174
+ //RhodesActivity.safeGetInstance().removeRhodesActivityListener(getInstance());
168
175
  PerformOnUiThread.exec( new Runnable() {
169
176
  public void run() {
170
177
  if (RhodesActivity.safeGetInstance().isForegroundNow()) {
@@ -176,6 +183,15 @@ public class Nfc implements RhodesActivityListener {
176
183
  log(" $$$$$$$$$ setEnable() FINISH() ");
177
184
  }
178
185
 
186
+ public void onCreate(RhodesActivity activity, Intent intent) {
187
+ getInstance().onNewIntent(activity, intent, true);
188
+ }
189
+
190
+ public void onRhodesActivityStartup(RhodesActivity activity) {
191
+ activity.addRhodesActivityListener(getInstance());
192
+ }
193
+
194
+
179
195
  public void onPause(RhodesActivity activity) {
180
196
  log(" $$$$$$$$$ onPause() ");
181
197
  NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(RhodesActivity.getContext());
@@ -188,7 +204,7 @@ public class Nfc implements RhodesActivityListener {
188
204
  public void onResume(RhodesActivity activity) {
189
205
  log(" $$$$$$$$$ onResume() ");
190
206
  NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(RhodesActivity.getContext());
191
- if (nfcAdapter != null) {
207
+ if ((nfcAdapter != null) && (ourIsEnable)) {
192
208
  IntentFilter[] filters = new IntentFilter[1];
193
209
  filters[0] = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
194
210
 
@@ -207,7 +223,7 @@ public class Nfc implements RhodesActivityListener {
207
223
  public void onNewIntent(RhodesActivity activity, Intent intent, boolean postpone) {
208
224
  String action = intent.getAction();
209
225
 
210
- log(" $$$$$$$$$ onNewIntent !!! Action = "+action);
226
+ Utils.platformLog("Nfc", "onNewIntent !!! Action = "+action+" postpone="+String.valueOf(postpone));
211
227
 
212
228
  if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
213
229
  log("ACTION_TAG_DISCOVERED !");
@@ -320,7 +336,12 @@ public class Nfc implements RhodesActivityListener {
320
336
  }
321
337
 
322
338
  public void onNewIntent(RhodesActivity activity, Intent intent) {
323
- onNewIntent(activity, intent, false);
339
+ if (activity.isInsideStartStop()) {
340
+ onNewIntent(activity, intent, false);
341
+ }
342
+ else {
343
+ onNewIntent(activity, intent, true);
344
+ }
324
345
  }
325
346
 
326
347
 
@@ -1,5 +1,7 @@
1
1
  package com.rhomobile.nfc;
2
2
 
3
+ import java.util.Iterator;
4
+
3
5
  import android.app.Activity;
4
6
  import android.content.BroadcastReceiver;
5
7
  import android.content.Context;
@@ -16,6 +18,8 @@ import android.util.Log;
16
18
 
17
19
  import com.rhomobile.rhodes.PushService;
18
20
  import com.rhomobile.rhodes.RhodesActivity;
21
+ import com.rhomobile.rhodes.RhodesActivityListener;
22
+ import com.rhomobile.rhodes.RhodesApplication;
19
23
  import com.rhomobile.rhodes.RhodesService;
20
24
  import com.rhomobile.rhodes.Utils;
21
25
 
@@ -28,74 +32,85 @@ public class NfcActivity extends Activity {
28
32
 
29
33
  @Override
30
34
  protected void onCreate(Bundle savedInstanceState) {
35
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onCreate !!! START ");
31
36
  super.onCreate(savedInstanceState);
32
37
  Intent intent = getIntent();
33
38
  String action = intent.getAction();
39
+ Utils.platformLog(TAG, " NfcActivity onCreate !!! Action = "+action);
40
+ processNewIntent(intent);
41
+ finish();
42
+ }
43
+
44
+
45
+ @Override
46
+ public void onStart() {
47
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onStart !!! START ");
48
+ super.onStart();
49
+ }
50
+
51
+ @Override
52
+ public void onResume() {
53
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onResume !!! START ");
54
+ super.onResume();
55
+ //finish();
56
+ }
57
+
58
+ @Override
59
+ public void onPause()
60
+ {
61
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onPause !!! START ");
62
+ super.onPause();
63
+ }
64
+
65
+ @Override
66
+ public void onStop()
67
+ {
68
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onStop !!! START ");
69
+ super.onStop();
70
+ }
71
+
72
+ @Override
73
+ public void onDestroy() {
74
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onDestroy !!! START ");
75
+ super.onDestroy();
76
+ }
77
+
78
+
79
+
80
+
81
+
82
+ @Override
83
+ protected void onNewIntent(Intent intent) {
84
+ Utils.platformLog(TAG, " $$$$$$$ NfcActivity onNewIntent !!! START ");
85
+ super.onNewIntent(intent);
86
+ String action = intent.getAction();
87
+ Utils.platformLog(TAG, " NfcActivity onNewIntent !!! Action = "+action);
88
+ processNewIntent(intent);
89
+ }
90
+
91
+ private void processNewIntent(Intent intent) {
92
+ super.onNewIntent(intent);
93
+ String action = intent.getAction();
34
94
 
35
- Utils.platformLog(TAG, " $$$$$$$$$ NfcActivity STARTED !!! Action = "+action);
95
+ Utils.platformLog(TAG, " NfcActivity processNewIntent !!! Action = "+action);
36
96
 
37
97
 
38
98
  if ( (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) ||
39
99
  (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) ||
40
100
  (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) ) {
41
101
 
42
- RhodesActivity rhodes_activity = null;
43
- // check RhodesActivity state
44
- try {
45
- rhodes_activity = RhodesActivity.safeGetInstance();
46
- }
47
- catch(NullPointerException e) {
48
-
49
- }
50
- boolean isForeground = false;
51
- if (rhodes_activity != null) {
52
- isForeground = rhodes_activity.isForegroundNow();
53
- }
54
- if (isForeground) {
55
- Nfc.getInstance().onNewIntent(rhodes_activity, intent);
56
- finish();
57
- }
58
- else {
59
- /*
60
- ourIntent = intent;
61
- Thread thread = new Thread() {
62
- public void run() {
63
-
64
- while (!isRhodesActivityOnForeground()) {
65
- try {
66
- sleep(100);
67
- } catch (InterruptedException e) {
68
- // TODO Auto-generated catch block
69
- e.printStackTrace();
70
- }
71
- }
72
-
73
- Nfc.getInstance().onNewIntent(RhodesActivity.safeGetInstance(), ourIntent);
74
- //finish();
75
- //this.stop();
76
- }
77
- };
78
- thread.start();
79
- */
80
- Nfc.setApplicationStartupIntent(intent);
81
-
82
- Intent run_intent = new Intent();
83
- run_intent.setClass(this, RhodesActivity.class);
84
- startActivity(run_intent);
85
-
86
- finish();
102
+ Nfc.log("NfcActivity: RhodesActivity is not Foreground - save messages and start Activity");
87
103
 
88
- }
89
-
90
-
104
+ Nfc.setApplicationStartupIntent(intent);
91
105
 
106
+ Intent run_intent = new Intent();
107
+ run_intent.setClass(this, RhodesActivity.class);
108
+ startActivity(run_intent);
109
+
92
110
  }
93
-
94
-
95
-
96
- //finish();
97
111
  }
98
112
 
113
+
99
114
  public static boolean isRhodesActivityOnForeground() {
100
115
  RhodesActivity rhodes_activity = null;
101
116
  // check RhodesActivity state
@@ -1,2 +1,6 @@
1
1
  entry: Init_Nfc
2
+ android_rhodes_activity_listener: com.rhomobile.nfc.Nfc
3
+ android_manifest_changes: ext/nfc/platform/android/AndroidManifest.xml
4
+ android_resources_addons: ext/nfc/platform/android/additional_files
5
+ android_additional_sources_list: ext/nfc/platform/android/ext_build.files
2
6
  libraries: ["Nfc"]