Skip to content

Commit

Permalink
Merge branch '9_0_X' into TIMOB-27798-rev1-9_0_X
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Apr 29, 2020
2 parents 51aeb05 + cf4cc22 commit 9df9ada
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 107 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Expand Up @@ -13,8 +13,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:3.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions android/gradlew.bat
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down
Expand Up @@ -493,7 +493,7 @@ public void setTintColor(String color)
if (this.tintColor == 0) {
imageView.clearColorFilter();
} else {
imageView.setColorFilter(this.tintColor, Mode.MULTIPLY);
imageView.setColorFilter(this.tintColor, Mode.SRC_ATOP);
}
}

Expand Down
Expand Up @@ -29,7 +29,8 @@ public class TiUIDatePicker extends TiUIView implements OnDateChangedListener
private boolean suppressChangeEvent = false;
private static final String TAG = "TiUIDatePicker";

protected Date minDate, maxDate;
protected Date minDate;
protected Date maxDate;
protected int minuteInterval;

public TiUIDatePicker(TiViewProxy proxy)
Expand Down Expand Up @@ -81,29 +82,15 @@ public void processProperties(KrollDict d)
valueExistsInProxy = true;
}
if (d.containsKey(TiC.PROPERTY_MIN_DATE)) {
Calendar minDateCalendar = Calendar.getInstance();
minDateCalendar.setTime((Date) d.get(TiC.PROPERTY_MIN_DATE));
minDateCalendar.set(Calendar.HOUR_OF_DAY, 0);
minDateCalendar.set(Calendar.MINUTE, 0);
minDateCalendar.set(Calendar.SECOND, 0);
minDateCalendar.set(Calendar.MILLISECOND, 0);

this.minDate = minDateCalendar.getTime();
picker.setMinDate(minDateCalendar.getTimeInMillis());
this.minDate = createDateWithoutTimeFrom((Date) d.get(TiC.PROPERTY_MIN_DATE));
picker.setMinDate(this.minDate.getTime());
}
if (d.containsKey(TiC.PROPERTY_CALENDAR_VIEW_SHOWN)) {
setCalendarView(TiConvert.toBoolean(d, TiC.PROPERTY_CALENDAR_VIEW_SHOWN));
}
if (d.containsKey(TiC.PROPERTY_MAX_DATE)) {
Calendar maxDateCalendar = Calendar.getInstance();
maxDateCalendar.setTime((Date) d.get(TiC.PROPERTY_MAX_DATE));
maxDateCalendar.set(Calendar.HOUR_OF_DAY, 0);
maxDateCalendar.set(Calendar.MINUTE, 0);
maxDateCalendar.set(Calendar.SECOND, 0);
maxDateCalendar.set(Calendar.MILLISECOND, 0);

this.maxDate = maxDateCalendar.getTime();
picker.setMaxDate(maxDateCalendar.getTimeInMillis());
this.maxDate = createDateWithoutTimeFrom((Date) d.get(TiC.PROPERTY_MAX_DATE));
picker.setMaxDate(this.maxDate.getTime());
}
if (d.containsKey(TiC.PROPERTY_MINUTE_INTERVAL)) {
int mi = d.getInt(TiC.PROPERTY_MINUTE_INTERVAL);
Expand Down Expand Up @@ -136,13 +123,14 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
if (key.equals(TiC.PROPERTY_VALUE)) {
Date date = (Date) newValue;
setValue(date.getTime());
}
if (key.equals(TiC.PROPERTY_CALENDAR_VIEW_SHOWN)) {
} else if (key.equals(TiC.PROPERTY_CALENDAR_VIEW_SHOWN)) {
setCalendarView(TiConvert.toBoolean(newValue));
} else if (TiC.PROPERTY_MIN_DATE.equals(key)) {
((DatePicker) getNativeView()).setMinDate(TiConvert.toDate(newValue).getTime());
this.minDate = createDateWithoutTimeFrom((Date) newValue);
((DatePicker) getNativeView()).setMinDate(this.minDate.getTime());
} else if (TiC.PROPERTY_MAX_DATE.equals(key)) {
((DatePicker) getNativeView()).setMaxDate(TiConvert.toDate(newValue).getTime());
this.maxDate = createDateWithoutTimeFrom((Date) newValue);
((DatePicker) getNativeView()).setMaxDate(this.maxDate.getTime());
}
super.propertyChanged(key, oldValue, newValue, proxy);
}
Expand All @@ -158,13 +146,13 @@ public void onDateChanged(DatePicker picker, int year, int monthOfYear, int dayO
targetCalendar.set(Calendar.SECOND, 0);
targetCalendar.set(Calendar.MILLISECOND, 0);

if ((null != minDate) && (targetCalendar.getTime().before(minDate))) {
targetCalendar.setTime(minDate);
setValue(minDate.getTime(), true);
if ((null != this.minDate) && (targetCalendar.getTime().before(this.minDate))) {
targetCalendar.setTime(this.minDate);
setValue(this.minDate.getTime(), true);
}
if ((null != maxDate) && (targetCalendar.getTime().after(maxDate))) {
targetCalendar.setTime(maxDate);
setValue(maxDate.getTime(), true);
if ((null != this.maxDate) && (targetCalendar.getTime().after(this.maxDate))) {
targetCalendar.setTime(this.maxDate);
setValue(this.maxDate.getTime(), true);
}

Date newTime = targetCalendar.getTime();
Expand Down Expand Up @@ -208,9 +196,22 @@ public void setValue(long value, boolean suppressEvent)

public void setCalendarView(boolean value)
{
if (Build.VERSION.SDK_INT >= 11) {
DatePicker picker = (DatePicker) getNativeView();
picker.setCalendarViewShown(value);
DatePicker picker = (DatePicker) getNativeView();
picker.setCalendarViewShown(value);
}

private Date createDateWithoutTimeFrom(Date value)
{
if (value == null) {
return null;
}

Calendar calendar = Calendar.getInstance();
calendar.setTime(value);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
}
2 changes: 1 addition & 1 deletion android/templates/build/root.build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down
17 changes: 9 additions & 8 deletions android/titanium/src/java/org/appcelerator/titanium/TiBlob.java
Expand Up @@ -6,6 +6,12 @@
*/
package org.appcelerator.titanium;

import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ThumbnailUtils;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
Expand All @@ -14,7 +20,6 @@
import java.io.UnsupportedEncodingException;
import java.net.URLConnection;
import java.util.HashMap;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.KrollRuntime;
Expand All @@ -27,13 +32,6 @@
import org.appcelerator.titanium.util.TiImageHelper;
import org.appcelerator.titanium.util.TiMimeTypeHelper;

import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ThumbnailUtils;
import android.util.Base64;

/**
* A Titanium Blob object. A Blob can represent any opaque data or input stream.
*/
Expand Down Expand Up @@ -768,7 +766,10 @@ public TiBlob imageAsResized(Number width, Number height)
imgWidth = img.getWidth();
imgHeight = img.getHeight();
if (rotation != 0) {
float scaleWidth = (float) dstWidth / imgWidth;
float scaleHeight = (float) dstHeight / imgHeight;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
matrix.postRotate(rotation);
imageResized = Bitmap.createBitmap(img, 0, 0, imgWidth, imgHeight, matrix, true);
} else {
Expand Down
26 changes: 4 additions & 22 deletions cli/lib/tasks/process-js-task.js
Expand Up @@ -55,9 +55,10 @@ class ProcessJsTask extends IncrementalFileTask {
deploytype: this.builder.deployType,
target: this.builder.target,
Ti: {
version: this.builder.cli.tiapp['sdk-version'],
// TODO: add buildHash
// TODO: add buildDate
version: this.builder.titaniumSdkVersion, // use the shortened version number, i.e. 9.1.0
// TODO: Do these work?
// buildHash: ti.manifest.githash,
// buildDate: ti.manifest.timestamp,
App: {
copyright: this.builder.cli.tiapp.copyright,
deployType: this.builder.deployType,
Expand All @@ -73,7 +74,6 @@ class ProcessJsTask extends IncrementalFileTask {
runtime: 'javascriptcore', // overridden below for android
},
Filesystem: {
// overridden below for windows
lineEnding: '\n',
separator: '/',
}
Expand All @@ -92,24 +92,6 @@ class ProcessJsTask extends IncrementalFileTask {
}
transform.Ti.Platform.manufacturer = 'apple';
break;
case 'windows':
// override Ti.Filesystem property values
transform.Ti.Filesystem.separator = '\\';
transform.Ti.Filesystem.lineEnding = '\r\n';
switch (this.builder.target) {
// windows store targets
case 'ws-simulator':
case 'ws-local':
case 'ws-remote':
case 'dist-winstore':
transform.Ti.Platform.osname = 'windowsstore';
break;
default:
transform.Ti.Platform.osname = 'windowsphone'; // TODO: no longer support windows phones on SDK 9+!
break;
}
transform.Ti.Platform.name = 'windows';
break;
}

this.defaultAnalyzeOptions = Object.assign({}, options.defaultAnalyzeOptions, { transform });
Expand Down
16 changes: 16 additions & 0 deletions common/Resources/ti.internal/extensions/node/os.js
Expand Up @@ -205,6 +205,8 @@ if (isIOS) {
// Now a giant hack for looking up CPU info for OS.cpus() on iOS
// https://www.theiphonewiki.com/wiki/List_of_iPhones
const AppleMap = {
// iPhone SE (2nd gen)
'iPhone12,8': [ 'Apple A13 Bionic @ 2.66 GHz', 2660 ],
// iPhone 11 Pro Max
'iPhone12,5': [ 'Apple A13 Bionic @ 2.66 GHz', 2660 ],
// iPhone 11 Pro
Expand Down Expand Up @@ -268,6 +270,15 @@ if (isIOS) {
// ////// iPads
// https://www.theiphonewiki.com/wiki/List_of_iPads
// https://en.wikipedia.org/wiki/IPad
// iPad Pro (4th gen)
'iPad8,12': [ 'Apple A12Z @ 2.49 GHz', 2490 ],
'iPad8,11': [ 'Apple A12Z @ 2.49 GHz', 2490 ],
// iPad mini (5th gen)
'iPad11,1': [ 'Apple A12 Bionic @ 2.49 GHz', 2490 ],
'iPad11,2': [ 'Apple A12 Bionic @ 2.49 GHz', 2490 ],
// iPad Air (3rd gen)
'iPad11,3': [ 'Apple A12 Bionic @ 2.49 GHz', 2490 ],
'iPad11,4': [ 'Apple A12 Bionic @ 2.49 GHz', 2490 ],
// iPad Pro (12.9" 3rd gen)
'iPad8,8': [ 'Apple A12X @ 2.49 GHz', 2490 ],
'iPad8,7': [ 'Apple A12X @ 2.49 GHz', 2490 ],
Expand All @@ -278,6 +289,9 @@ if (isIOS) {
'iPad8,3': [ 'Apple A12X @ 2.49 GHz', 2490 ],
'iPad8,2': [ 'Apple A12X @ 2.49 GHz', 2490 ],
'iPad8,1': [ 'Apple A12X @ 2.49 GHz', 2490 ],
// iPad (7th gen)
'iPad7,11': [ 'Apple A10 @ 2.31 GHz', 2310 ],
'iPad7,12': [ 'Apple A10 @ 2.31 GHz', 2310 ],
// iPad (6th gen)
'iPad7,6': [ 'Apple A10 @ 2.31 GHz', 2310 ], // FIXME: Wikipedia says 2.34 GHz
'iPad7,5': [ 'Apple A10 @ 2.31 GHz', 2310 ],
Expand Down Expand Up @@ -331,6 +345,8 @@ if (isIOS) {
'iPad2,3': [ 'Apple A5 @ 1 GHz', 1000 ],
'iPad2,2': [ 'Apple A5 @ 1 GHz', 1000 ],
'iPad2,1': [ 'Apple A5 @ 1 GHz', 1000 ],
// iPad 3G
'iPad1,2': [ 'Apple A4 @ 1 GHz', 1000 ],
// iPad
'iPad1,1': [ 'Apple A4 @ 1 GHz', 1000 ],
};
Expand Down

0 comments on commit 9df9ada

Please sign in to comment.