Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(android): update cmake, checkstyle #13966

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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