Skip to content

Commit

Permalink
Merge branch 'master' into 230729_android_window_close
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored Aug 21, 2024
2 parents 6276eee + dfb1b5c commit 1f59911
Show file tree
Hide file tree
Showing 50 changed files with 627 additions and 509 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ today and benefit from 1:1 sessions with the core team, exclusive modules, merch

Learn more about sponsoring TiDev, the organization behind the Titanium SDK, [here](https://github.com/sponsors/tidev) 🚀.

<!-- sponsors --><a href="https://github.com/Topener"><img src="https://github.com/Topener.png" width="60px" alt="Rene Pot" /></a><a href="https://github.com/phobeous"><img src="https://github.com/phobeous.png" width="60px" alt="Rodrigo Farfán" /></a><a href="https://github.com/jasonkneen"><img src="https://github.com/jasonkneen.png" width="60px" alt="Jason Kneen" /></a><a href="https://github.com/de1mat"><img src="https://github.com/de1mat.png" width="60px" alt="Matt Delmarter" /></a><a href="https://github.com/dlewis23"><img src="https://github.com/dlewis23.png" width="60px" alt="dlewis23" /></a><a href="https://github.com/dethier1958"><img src="https://github.com/dethier1958.png" width="60px" alt="Daniel Ethier" /></a><a href="https://github.com/zenjoe"><img src="https://github.com/zenjoe.png" width="60px" alt="Joe Kniesek" /></a><a href="https://github.com/desarrollogotit"><img src="https://github.com/desarrollogotit.png" width="60px" alt="" /></a><a href="https://github.com/Astrovic"><img src="https://github.com/Astrovic.png" width="60px" alt="Vittorio Sorbera" /></a><a href="https://github.com/Arood"><img src="https://github.com/Arood.png" width="60px" alt="Marcus Olovsson" /></a><a href="https://github.com/Rearmachine"><img src="https://github.com/Rearmachine.png" width="60px" alt="" /></a><a href="https://github.com/alexlarocca"><img src="https://github.com/alexlarocca.png" width="60px" alt="Alessandro La Rocca" /></a><a href="https://github.com/reshopper"><img src="https://github.com/reshopper.png" width="60px" alt="Reshopper" /></a><a href="https://github.com/safadig"><img src="https://github.com/safadig.png" width="60px" alt="Gus" /></a><a href="https://github.com/designbymind"><img src="https://github.com/designbymind.png" width="60px" alt="Jason David Miller" /></a><a href="https://github.com/greatschism"><img src="https://github.com/greatschism.png" width="60px" alt="Michael Zaladonis" /></a><a href="https://github.com/enzoq"><img src="https://github.com/enzoq.png" width="60px" alt="Vincenzo Quacquarelli" /></a><a href="https://github.com/mighty-office"><img src="https://github.com/mighty-office.png" width="60px" alt="Mighty GmbH" /></a><a href="https://github.com/Fruugul"><img src="https://github.com/Fruugul.png" width="60px" alt="Fruugul" /></a><a href="https://github.com/korelogic"><img src="https://github.com/korelogic.png" width="60px" alt="Korelogic Limited" /></a><a href="https://github.com/eddyinet"><img src="https://github.com/eddyinet.png" width="60px" alt="" /></a><a href="https://github.com/gouldjw"><img src="https://github.com/gouldjw.png" width="60px" alt="John Gould" /></a><a href="https://github.com/williekwok"><img src="https://github.com/williekwok.png" width="60px" alt="Willie Kwok" /></a><!-- sponsors -->
<!-- sponsors --><a href="https://github.com/Topener"><img src="https://github.com/Topener.png" width="60px" alt="Rene Pot" /></a><a href="https://github.com/phobeous"><img src="https://github.com/phobeous.png" width="60px" alt="Rodrigo Farfán" /></a><a href="https://github.com/jasonkneen"><img src="https://github.com/jasonkneen.png" width="60px" alt="Jason Kneen" /></a><a href="https://github.com/de1mat"><img src="https://github.com/de1mat.png" width="60px" alt="Matt Delmarter" /></a><a href="https://github.com/dlewis23"><img src="https://github.com/dlewis23.png" width="60px" alt="dlewis23" /></a><a href="https://github.com/dethier1958"><img src="https://github.com/dethier1958.png" width="60px" alt="Daniel Ethier" /></a><a href="https://github.com/zenjoe"><img src="https://github.com/zenjoe.png" width="60px" alt="Joe Kniesek" /></a><a href="https://github.com/desarrollogotit"><img src="https://github.com/desarrollogotit.png" width="60px" alt="" /></a><a href="https://github.com/Astrovic"><img src="https://github.com/Astrovic.png" width="60px" alt="Vittorio Sorbera" /></a><a href="https://github.com/Arood"><img src="https://github.com/Arood.png" width="60px" alt="Marcus Olovsson" /></a><a href="https://github.com/Rearmachine"><img src="https://github.com/Rearmachine.png" width="60px" alt="" /></a><a href="https://github.com/alexlarocca"><img src="https://github.com/alexlarocca.png" width="60px" alt="Alessandro La Rocca" /></a><a href="https://github.com/reshopper"><img src="https://github.com/reshopper.png" width="60px" alt="Reshopper" /></a><a href="https://github.com/safadig"><img src="https://github.com/safadig.png" width="60px" alt="Gus" /></a><a href="https://github.com/designbymind"><img src="https://github.com/designbymind.png" width="60px" alt="Jason David Miller" /></a><a href="https://github.com/greatschism"><img src="https://github.com/greatschism.png" width="60px" alt="Michael Zaladonis" /></a><a href="https://github.com/enzoq"><img src="https://github.com/enzoq.png" width="60px" alt="Vincenzo Quacquarelli" /></a><a href="https://github.com/mighty-office"><img src="https://github.com/mighty-office.png" width="60px" alt="Mighty GmbH" /></a><a href="https://github.com/Fruugul"><img src="https://github.com/Fruugul.png" width="60px" alt="Fruugul" /></a><a href="https://github.com/korelogic"><img src="https://github.com/korelogic.png" width="60px" alt="Korelogic Limited" /></a><a href="https://github.com/eddyinet"><img src="https://github.com/eddyinet.png" width="60px" alt="" /></a><a href="https://github.com/gouldjw"><img src="https://github.com/gouldjw.png" width="60px" alt="John Gould" /></a><a href="https://github.com/Yackens"><img src="https://github.com/Yackens.png" width="60px" alt="Joaquin Maroto" /></a><!-- sponsors -->

## Features

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
defaultConfig {
applicationId 'com.titanium.test'
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName '1.0'
manifestPlaceholders = project.ext.tiManifestPlaceholders
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ allprojects {
// Load plugin used to enforce our Java coding style guidelines.
project.apply plugin: 'checkstyle'
checkstyle {
toolVersion = '8.38'
toolVersion = '10.11.0'
configFile file("${rootDir}/checkstyle.xml");
ignoreFailures false
showViolations true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

package ti.modules.titanium.contacts;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import android.graphics.Bitmap;
import android.util.Log;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.TiC;

import android.graphics.Bitmap;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

@Kroll.proxy(parentModule = ContactsModule.class,
propertyAccessors = {
Expand All @@ -44,18 +44,17 @@
TiC.PROPERTY_LASTPHONETIC,
TiC.PROPERTY_JOBTITLE,
TiC.PROPERTY_DEPARTMENT
})
})
public class PersonProxy extends KrollProxy
{
private static final String TAG = "Person";
// Contact Modifications
private final HashMap<String, Boolean> modified = new HashMap<>();
protected boolean hasImage = false;
private TiBlob image = null;
private boolean imageFetched; // lazy load these bitmap images
protected boolean hasImage = false;
private String fullName = "";

// Contact Modifications
private final HashMap<String, Boolean> modified = new HashMap<>();

public PersonProxy()
{
super();
Expand Down Expand Up @@ -189,15 +188,15 @@ public void onPropertyChanged(String name, Object value)
|| name.equals(TiC.PROPERTY_LASTNAME)) {
modified.put(TiC.PROPERTY_NAME, true);
} else if (name.equals(TiC.PROPERTY_BIRTHDAY) || name.equals(TiC.PROPERTY_ORGANIZATION)
|| name.equals(TiC.PROPERTY_NOTE) || name.equals(TiC.PROPERTY_NICKNAME)
|| name.equals(TiC.PROPERTY_PHONE) || name.equals(TiC.PROPERTY_ADDRESS)
|| name.equals(TiC.PROPERTY_INSTANTMSG) || name.equals(TiC.PROPERTY_URL)
|| name.equals(TiC.PROPERTY_EMAIL) || name.equals(TiC.PROPERTY_RELATED_NAMES)
|| name.equals(TiC.PROPERTY_DATE) || name.equals(TiC.PROPERTY_KIND)
|| name.equals(TiC.PROPERTY_PREFIX) || name.equals(TiC.PROPERTY_SUFFIX)
|| name.equals(TiC.PROPERTY_FIRSTPHONETIC) || name.equals(TiC.PROPERTY_MIDDLEPHONETIC)
|| name.equals(TiC.PROPERTY_LASTPHONETIC) || name.equals(TiC.PROPERTY_JOBTITLE)
|| name.equals(TiC.PROPERTY_DEPARTMENT)) {
|| name.equals(TiC.PROPERTY_NOTE) || name.equals(TiC.PROPERTY_NICKNAME)
|| name.equals(TiC.PROPERTY_PHONE) || name.equals(TiC.PROPERTY_ADDRESS)
|| name.equals(TiC.PROPERTY_INSTANTMSG) || name.equals(TiC.PROPERTY_URL)
|| name.equals(TiC.PROPERTY_EMAIL) || name.equals(TiC.PROPERTY_RELATED_NAMES)
|| name.equals(TiC.PROPERTY_DATE) || name.equals(TiC.PROPERTY_KIND)
|| name.equals(TiC.PROPERTY_PREFIX) || name.equals(TiC.PROPERTY_SUFFIX)
|| name.equals(TiC.PROPERTY_FIRSTPHONETIC) || name.equals(TiC.PROPERTY_MIDDLEPHONETIC)
|| name.equals(TiC.PROPERTY_LASTPHONETIC) || name.equals(TiC.PROPERTY_JOBTITLE)
|| name.equals(TiC.PROPERTY_DEPARTMENT)) {

modified.put(name, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
*/
package ti.modules.titanium.media;

import java.lang.ref.WeakReference;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.webkit.URLUtil;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollFunction;
Expand All @@ -23,15 +30,9 @@
import org.appcelerator.titanium.view.TiCompositeLayout;
import org.appcelerator.titanium.view.TiUIView;

import java.lang.ref.WeakReference;

import ti.modules.titanium.media.TiThumbnailRetriever.ThumbnailResponseHandler;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.webkit.URLUtil;

@Kroll.proxy(creatableInModule = MediaModule.class,
propertyAccessors = {
Expand All @@ -43,14 +44,15 @@
TiC.PROPERTY_PLAYABLE_DURATION,
TiC.PROPERTY_VOLUME,
TiC.PROPERTY_SHOWS_CONTROLS,
})
})
public class VideoPlayerProxy extends TiViewProxy implements TiLifecycle.OnLifecycleEvent
{
private static final String TAG = "VideoPlayerProxy";

// The player doesn't automatically preserve its current location and seek back to
// there when being resumed. This internal property lets us track that.
public static final String PROPERTY_SEEK_TO_ON_RESUME = "__seek_to_on_resume__";
protected static final int CONTROL_MSG_ACTIVITY_AVAILABLE = 101;
protected static final int CONTROL_MSG_CONFIG_CHANGED = 102;

private static final String TAG = "VideoPlayerProxy";
private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1;
private static final int MSG_PLAY = MSG_FIRST_ID + 101;
private static final int MSG_STOP = MSG_FIRST_ID + 102;
Expand All @@ -64,16 +66,10 @@ public class VideoPlayerProxy extends TiViewProxy implements TiLifecycle.OnLifec
private static final int MSG_HIDE_MEDIA_CONTROLLER = MSG_FIRST_ID + 110;
private static final int MSG_SET_VIEW_FROM_ACTIVITY = MSG_FIRST_ID + 111;
private static final int MSG_REPEAT_CHANGE = MSG_FIRST_ID + 112;

// Keeping these out of TiC because I believe we'll stop supporting them
// in favor of the documented property, which is "mediaControlStyle".
private static final String PROPERTY_MOVIE_CONTROL_MODE = "movieControlMode";
private static final String PROPERTY_MOVIE_CONTROL_STYLE = "movieControlStyle";

// The player doesn't automatically preserve its current location and seek back to
// there when being resumed. This internal property lets us track that.
public static final String PROPERTY_SEEK_TO_ON_RESUME = "__seek_to_on_resume__";

protected int mediaControlStyle = MediaModule.VIDEO_CONTROL_DEFAULT;
protected int scalingMode = MediaModule.VIDEO_SCALING_RESIZE_ASPECT;
private int loadState = MediaModule.VIDEO_LOAD_STATE_UNKNOWN;
Expand Down Expand Up @@ -127,6 +123,7 @@ public void setActivity(Activity activity)
* a TiUIVideoView so we have on common interface to the VideoView
* and so we can handle child views in our standard way without any
* extra code beyond this here.
*
* @param layout The content view of the TiVideoActivity. It already contains a VideoView.
*/
//
Expand Down Expand Up @@ -192,11 +189,13 @@ private void launchVideoActivity(KrollDict options)

/**
* Create handler used for communication from TiVideoActivity to this proxy.
*
* @return Returns the handler used to send commands to the video view.
*/
private Handler createControlHandler()
{
return new Handler(new Handler.Callback() {
return new Handler(new Handler.Callback()
{
@Override
public boolean handleMessage(Message msg)
{
Expand Down Expand Up @@ -613,7 +612,7 @@ public void onPlaybackReady(int duration)
setProperty(TiC.PROPERTY_DURATION, duration);
setProperty(TiC.PROPERTY_PLAYABLE_DURATION, duration);
setProperty(TiC.PROPERTY_END_PLAYBACK_TIME,
duration); // Currently we're not doing anything else with this property in Android.
duration); // Currently we're not doing anything else with this property in Android.
if (!hasProperty(TiC.PROPERTY_INITIAL_PLAYBACK_TIME)) {
setProperty(TiC.PROPERTY_INITIAL_PLAYBACK_TIME, 0);
}
Expand Down Expand Up @@ -778,7 +777,7 @@ public void requestThumbnailImagesAtTimes(Object[] times, Object option, KrollFu
Uri uri = Uri.parse(url);
mTiThumbnailRetriever.setUri(uri);
mTiThumbnailRetriever.getBitmap(TiConvert.toIntArray(times), TiConvert.toInt(option),
createThumbnailResponseHandler(callback));
createThumbnailResponseHandler(callback));
}
}

Expand All @@ -795,14 +794,15 @@ public void cancelAllThumbnailImageRequests()
* Convenience method for creating a response handler that is used when getting a
* bitmap.
*
* @param callback Javascript function that the response handler will invoke
* once the bitmap response is ready
* @return the bitmap response handler
* @param callback Javascript function that the response handler will invoke
* once the bitmap response is ready
* @return the bitmap response handler
*/
private ThumbnailResponseHandler createThumbnailResponseHandler(final KrollFunction callback)
{
final VideoPlayerProxy videoPlayerProxy = this;
return new ThumbnailResponseHandler() {
return new ThumbnailResponseHandler()
{
@Override
public void handleThumbnailResponse(KrollDict bitmapResponse)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

package ti.modules.titanium.network;

import java.net.HttpCookie;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.util.TiConvert;

import java.net.HttpCookie;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

@Kroll.proxy(creatableInModule = NetworkModule.class,
propertyAccessors = {
TiC.PROPERTY_VALUE,
Expand All @@ -28,14 +28,15 @@
TiC.PROPERTY_SECURE,
TiC.PROPERTY_HTTP_ONLY,
TiC.PROPERTY_VERSION
})
})
public class CookieProxy extends KrollProxy
{
public static final SimpleDateFormat systemExpiryDateFormatter =
new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss 'GMT'");
private static final String TAG = "CookieProxy";
private static final TimeZone timezone = TimeZone.getTimeZone("GMT");
private static final SimpleDateFormat httpExpiryDateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
public static final SimpleDateFormat systemExpiryDateFormatter =
new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss 'GMT'");

static
{
httpExpiryDateFormatter.setTimeZone(timezone);
Expand All @@ -53,7 +54,7 @@ public CookieProxy(HttpCookie cookie)
{
super();
if (cookie instanceof HttpCookie) {
httpCookie = (HttpCookie) cookie;
httpCookie = cookie;
setProperty(TiC.PROPERTY_NAME, httpCookie.getName());
setProperty(TiC.PROPERTY_VALUE, httpCookie.getValue());
setProperty(TiC.PROPERTY_DOMAIN, httpCookie.getDomain());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package ti.modules.titanium.network;

import java.io.UnsupportedEncodingException;
import android.os.Build;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
Expand All @@ -15,8 +15,9 @@
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.util.TiConvert;

import java.io.UnsupportedEncodingException;

import ti.modules.titanium.xml.DocumentProxy;
import android.os.Build;

@Kroll.proxy(creatableInModule = NetworkModule.class,
propertyAccessors = {
Expand All @@ -26,7 +27,7 @@
TiC.PROPERTY_ONERROR,
TiC.PROPERTY_ONREADYSTATECHANGE,
TiC.PROPERTY_ONDATASTREAM
})
})
public class HTTPClientProxy extends KrollProxy
{
@Kroll.constant
Expand All @@ -39,9 +40,8 @@ public class HTTPClientProxy extends KrollProxy
public static final int LOADING = TiHTTPClient.READY_STATE_LOADING;
@Kroll.constant
public static final int DONE = TiHTTPClient.READY_STATE_DONE;

private static final String TAG = "TiHTTPClientProxy";
public static final String PROPERTY_SECURITY_MANAGER = "securityManager";
private static final String TAG = "TiHTTPClientProxy";
private TiHTTPClient client;

public HTTPClientProxy()
Expand Down Expand Up @@ -82,7 +82,7 @@ public void handleCreationDict(KrollDict dict)
} else {
throw new IllegalArgumentException(
"Invalid argument passed to securityManager property."
+ " Does not conform to SecurityManagerProtocol");
+ " Does not conform to SecurityManagerProtocol");
}
}
}
Expand Down Expand Up @@ -241,12 +241,6 @@ public void setValidatesSecureCertificate(boolean value)
this.setProperty("validatesSecureCertificate", value);
}

@Kroll.setProperty
public void setUsername(String value)
{
this.setProperty(TiC.PROPERTY_USERNAME, value);
}

@Kroll.getProperty
public String getUsername()
{
Expand All @@ -257,9 +251,9 @@ public String getUsername()
}

@Kroll.setProperty
public void setPassword(String value)
public void setUsername(String value)
{
this.setProperty(TiC.PROPERTY_PASSWORD, value);
this.setProperty(TiC.PROPERTY_USERNAME, value);
}

@Kroll.getProperty
Expand All @@ -272,9 +266,9 @@ public String getPassword()
}

@Kroll.setProperty
public void setDomain(String value)
public void setPassword(String value)
{
this.setProperty(TiC.PROPERTY_DOMAIN, value);
this.setProperty(TiC.PROPERTY_PASSWORD, value);
}

@Kroll.getProperty
Expand All @@ -287,9 +281,9 @@ public String getDomain()
}

@Kroll.setProperty
public void setTlsVersion(int tlsVersion)
public void setDomain(String value)
{
client.setTlsVersion(tlsVersion);
this.setProperty(TiC.PROPERTY_DOMAIN, value);
}

@Kroll.getProperty
Expand All @@ -309,6 +303,12 @@ public int getTlsVersion()
return tlsVersion;
}

@Kroll.setProperty
public void setTlsVersion(int tlsVersion)
{
client.setTlsVersion(tlsVersion);
}

@Override
public String getApiName()
{
Expand Down
Loading

0 comments on commit 1f59911

Please sign in to comment.