Skip to content

Commit 4b20bf6

Browse files
committed
Fix native interface snippets and doc includes
1 parent 81823a6 commit 4b20bf6

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

docs/demos/android/src/main/java/com/codename1/sms/intercept/NativeSMSInterceptorImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
public class NativeSMSInterceptorImpl {
99
private SMSListener smsListener;
1010
public void bindSMSListener() {
11-
if (AndroidNativeUtil.checkForPermission(Manifest.permission.RECEIVE_SMS, "We can automatically enter the SMS code for you")) {
11+
if (AndroidNativeUtil.checkForPermission(Manifest.permission.RECEIVE_SMS, "We can automatically enter the SMS code for you")) { // <1>
1212
smsListener = new SMSListener();
1313
IntentFilter filter = new IntentFilter();
1414
filter.addAction("android.provider.Telephony.SMS_RECEIVED");
15-
AndroidNativeUtil.getActivity().registerReceiver(smsListener, filter);
15+
AndroidNativeUtil.getActivity().registerReceiver(smsListener, filter); // <2>
1616
}
1717
}
1818

docs/demos/android/src/main/java/com/mycompany/myapp/MyNativeImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import android.util.Log;
44

55
// tag::myNativeAndroidImpl[]
6-
public class MyNativeImpl {
6+
public class MyNativeImpl { // <2>
77
public String helloWorld(String param) {
8-
Log.d("MyApp", param);
8+
Log.d("MyApp", param); // <1>
99
return "Tada";
1010
}
1111

1212
public boolean isSupported() {
13-
return true;
13+
return true; // <4>
1414
}
1515
}
16+
// <3> No explicit constructor is declared so the default one is used.
1617
// end::myNativeAndroidImpl[]

docs/demos/common/src/main/java/com/codename1/sms/intercept/SMSCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.codename1.sms.intercept;
1+
package com.codename1.sms.intercept; // <1>
22

33
import com.codename1.util.FailureCallback;
44
import com.codename1.util.SuccessCallback;
@@ -15,7 +15,7 @@ public static void smsReceived(String sms) {
1515
onSuccess = null;
1616
onFail = null;
1717
SMSInterceptor.unbindListener();
18-
callSerially(() -> s.onSucess(sms));
18+
callSerially(() -> s.onSucess(sms)); // <2>
1919
}
2020
}
2121

docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ The native sample in stack overflow bound the listener in the activity but here
12541254

12551255
[source,java]
12561256
----
1257-
include::../demos/common/src/main/java/com/codenameone/sms/intercept/NativeSMSInterceptor.java[tag=nativeSmsInterceptor,indent=0]
1257+
include::../demos/common/src/main/java/com/codename1/sms/intercept/NativeSMSInterceptor.java[tag=nativeSmsInterceptor,indent=0]
12581258
----
12591259

12601260
That's easy!
@@ -1394,7 +1394,7 @@ For example, the Google Maps project includes the static callback method:
13941394

13951395
[source,java]
13961396
----
1397-
include::../demos/common/src/main/java/com/codenameone/googlemaps/MapContainerCallbacks.java[tag=fireMapChangeEvent,indent=0]
1397+
include::../demos/common/src/main/java/com/codename1/googlemaps/MapContainerCallbacks.java[tag=fireMapChangeEvent,indent=0]
13981398
----
13991399

14001400
defined in the `com.codename1.googlemaps.MapContainer` class.
@@ -1419,7 +1419,7 @@ The SMS Broadcast Receiver code from before also used callbacks such as this:
14191419

14201420
[source,java]
14211421
----
1422-
include::../demos/common/src/main/java/com/codenameone/sms/intercept/SMSCallback.java[tag=smsCallback,indent=0]
1422+
include::../demos/common/src/main/java/com/codename1/sms/intercept/SMSCallback.java[tag=smsCallback,indent=0]
14231423
----
14241424

14251425

0 commit comments

Comments
 (0)