Skip to content

Commit 2a51696

Browse files
committed
B4A 13.3
1 parent fa67415 commit 2a51696

3 files changed

Lines changed: 71 additions & 4 deletions

File tree

B4AObjects/src/anywheresoftware/b4a/keywords/Common.java

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
* These are the internal keywords.
7171
*/
7272
@ActivityObject
73-
@Version(12.8f)
73+
@Version(13.20f)
7474
public class Common {
7575
static {
7676
System.out.println("common created.");
@@ -745,6 +745,59 @@ public static void ProgressDialogShow2(BA ba, CharSequence Text, boolean Cancela
745745
public static void ProgressDialogHide() {
746746
Msgbox.dismissProgressDialog();
747747
}
748+
749+
/**
750+
* Tests whether the given object is not null and initialized (if it has such method or field).
751+
*If there is no such method or field then only null is tested.
752+
*/
753+
public static boolean Initialized (Object Object) {
754+
return !NotInitialized(Object);
755+
}
756+
private static final java.util.Map<Class<?>, Integer> testedClassesForIsInitialized = new HashMap<Class<?>, Integer>();
757+
/**
758+
* Tests whether the given object is null or is not initialized (if it has such method or field).
759+
*If there is no such method or field then only null is tested.
760+
*/
761+
public static boolean NotInitialized (Object Object) {
762+
if (Object == null)
763+
return true;
764+
if (Object instanceof ObjectWrapper) {
765+
return ((ObjectWrapper<?>)Object).getObjectOrNull() == null;
766+
} else if (Object instanceof B4AClass) {
767+
return !((B4AClass)Object).IsInitialized();
768+
} else {
769+
Class<?> cls = Object.getClass();
770+
Integer b = testedClassesForIsInitialized.get(cls);
771+
if (b == null || b.intValue() > 0) {
772+
Object o = null;
773+
if (b == null || b.intValue() == 1) {
774+
try {
775+
o = cls.getMethod("IsInitialized").invoke(Object);
776+
if (b == null && o instanceof Boolean)
777+
testedClassesForIsInitialized.put(cls, 1);
778+
} catch (Exception e) {
779+
//ignore
780+
}
781+
}
782+
if (o == null && (b == null || b.intValue() == 2)) {
783+
try {
784+
o = cls.getField("IsInitialized").get(Object);
785+
if (b == null && o instanceof Boolean)
786+
testedClassesForIsInitialized.put(cls, 2);
787+
}catch (Exception e) {
788+
//ignore
789+
}
790+
}
791+
if (b == null && (o == null || (o instanceof Boolean) == false))
792+
testedClassesForIsInitialized.put(cls, 0);
793+
else
794+
return !((Boolean)o).booleanValue();
795+
}
796+
}
797+
return false;
798+
}
799+
800+
748801
/**
749802
* Returns a string representing the object's java type.
750803
*/
@@ -1714,7 +1767,7 @@ public static void Sleep(int Milliseconds) {
17141767

17151768
}
17161769
/**
1717-
* Inline If - returns TrueValue if Condition is True and False otherwise. Only the relevant expression is evaluated.
1770+
* Inline If - returns TrueValue if Condition is True and FalseValue otherwise. Only the relevant expression is evaluated.
17181771
*/
17191772
public static Object IIf (boolean Condition, Object TrueValue, Object FalseValue) {
17201773
return null;

B4AObjects/src/anywheresoftware/b4a/objects/WebViewWrapper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ public void setZoomEnabled(boolean v) {
162162
public boolean getZoomEnabled() {
163163
return getObject().getSettings().getBuiltInZoomControls();
164164
}
165+
/**
166+
* Gets or sets whether WebView can access the file system. This option was enabled by default in the past and is now disabled due to security concerns.
167+
*Do not enable if your app accepts arbitrary URLs from external sources.
168+
*/
169+
public boolean getAllowFileAccess() {
170+
return getObject().getSettings().getAllowFileAccess();
171+
}
172+
public void setAllowFileAccess(boolean b) {
173+
getObject().getSettings().setAllowFileAccess(b);
174+
}
165175
/**
166176
* Zooms in or out according to the value of In.
167177
*Returns true if zoom has changed.

Libs_SIP/src/anywheresoftware/b4a/objects/SIP.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import android.net.sip.SipProfile;
3232
import android.net.sip.SipRegistrationListener;
3333
import android.net.sip.SipAudioCall.Listener;
34+
import android.os.Build;
3435
import anywheresoftware.b4a.AbsObjectWrapper;
3536
import anywheresoftware.b4a.BA;
3637
import anywheresoftware.b4a.BA.ActivityObject;
@@ -59,7 +60,7 @@
5960
"CallError (ErrorCode As Int, ErrorMessage As String)",
6061
"CallRinging (IncomingCall As SipAudioCall)"
6162
})
62-
@Version(1.0f)
63+
@Version(1.02f)
6364
public class SIP {
6465

6566

@@ -182,7 +183,10 @@ public void Register(final BA ba) throws SipException {
182183
me = builder.build();
183184
Intent in = new Intent();
184185
in.setAction("android.SipDemo.INCOMING_CALL");
185-
PendingIntent pi = PendingIntent.getBroadcast(BA.applicationContext, 0, in, Intent.FILL_IN_DATA);
186+
int flags = Intent.FILL_IN_DATA;
187+
if (Build.VERSION.SDK_INT >= 31)
188+
flags |= 0x2000000; //FLAG_MUTABLE
189+
PendingIntent pi = PendingIntent.getBroadcast(BA.applicationContext, 0, in, flags);
186190
manager.open(me, pi, null);
187191
manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
188192
public void onRegistering(String localProfileUri) {

0 commit comments

Comments
 (0)