From 7b82317907a492b57c52059d8a648ad0e07fb834 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Thu, 20 Jun 2024 17:01:08 +0200 Subject: [PATCH 01/88] chore: ioslib update (#14069) --- package-lock.json | 87 +++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3a2244ab9d..4b577831625 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "ejs": "3.1.9", "fields": "0.1.24", "fs-extra": "11.2.0", - "ioslib": "1.7.35", + "ioslib": "1.7.36", "liveview": "1.5.6", "lodash.merge": "4.6.2", "markdown": "0.5.0", @@ -2282,9 +2282,9 @@ } }, "node_modules/@mapbox/node-pre-gyp": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz", - "integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", "dependencies": { "detect-libc": "^2.0.0", "https-proxy-agent": "^5.0.0", @@ -2304,6 +2304,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -2316,6 +2317,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -2349,6 +2351,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", "dependencies": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -6487,9 +6490,9 @@ } }, "node_modules/detect-libc": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", - "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", "engines": { "node": ">=8" } @@ -8810,9 +8813,9 @@ } }, "node_modules/ioslib": { - "version": "1.7.35", - "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.35.tgz", - "integrity": "sha512-vay0+j92jZy1GSgiDiPVN5eIiYtCf+cIHaXxDuRmsPHa0jS4U99whhpISuQ0WQIpmkFPjsg7KRAiCK4kGSN6NQ==", + "version": "1.7.36", + "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.36.tgz", + "integrity": "sha512-LxmVa7TrKPXOE2IWxlNyNASTonSLjizxfG1dO8wZwGWowng+9/YBeIbPcQxaFgT8GMGeSMkkK1Npi2XUl7iiVQ==", "dependencies": { "always-tail": "0.2.0", "async": "^3.2.4", @@ -8820,7 +8823,7 @@ "debug": "^4.3.4", "mkdirp": "0.5.1", "node-appc": "1.1.6", - "node-ios-device": "1.11.0" + "node-ios-device": "1.12.0" }, "engines": { "node": ">=10.13" @@ -11424,9 +11427,9 @@ "dev": true }, "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", + "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==" }, "node_modules/nanoid": { "version": "3.3.1", @@ -11691,14 +11694,14 @@ } }, "node_modules/node-ios-device": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.11.0.tgz", - "integrity": "sha512-MUctq/+qq67v8Bd08XnHzOoK/YFJAVj8e35i9tLxqCh8C8MwcSIR27f0wQlYrUQ4UfnGdb8Dtx2DuNnMrpGSMw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.0.tgz", + "integrity": "sha512-ewGLYmcW1LbsTqs5UYmlLcm/52GCmGcuFTysWBqWnHPp88PfOh7uVm4zonb9r4MR/Nublt0vt0mNDIum0R71pw==", "hasInstallScript": true, "dependencies": { "@mapbox/node-pre-gyp": "^1.0.10", "debug": "^4.3.4", - "nan": "^2.17.0", + "nan": "^2.20.0", "node-pre-gyp-init": "^1.2.1", "patch-package": "^6.5.1" }, @@ -12963,6 +12966,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -12998,6 +13002,7 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dependencies": { "glob": "^7.1.3" }, @@ -13006,9 +13011,9 @@ } }, "node_modules/patch-package/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "bin": { "semver": "bin/semver" } @@ -17784,9 +17789,9 @@ } }, "@mapbox/node-pre-gyp": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz", - "integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", "requires": { "detect-libc": "^2.0.0", "https-proxy-agent": "^5.0.0", @@ -20951,9 +20956,9 @@ "dev": true }, "detect-libc": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", - "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==" }, "diff": { "version": "5.0.0", @@ -22685,9 +22690,9 @@ } }, "ioslib": { - "version": "1.7.35", - "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.35.tgz", - "integrity": "sha512-vay0+j92jZy1GSgiDiPVN5eIiYtCf+cIHaXxDuRmsPHa0jS4U99whhpISuQ0WQIpmkFPjsg7KRAiCK4kGSN6NQ==", + "version": "1.7.36", + "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.36.tgz", + "integrity": "sha512-LxmVa7TrKPXOE2IWxlNyNASTonSLjizxfG1dO8wZwGWowng+9/YBeIbPcQxaFgT8GMGeSMkkK1Npi2XUl7iiVQ==", "requires": { "always-tail": "0.2.0", "async": "^3.2.4", @@ -22695,7 +22700,7 @@ "debug": "^4.3.4", "mkdirp": "0.5.1", "node-appc": "1.1.6", - "node-ios-device": "1.11.0" + "node-ios-device": "1.12.0" }, "dependencies": { "@xmldom/xmldom": { @@ -24665,9 +24670,9 @@ "dev": true }, "nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", + "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==" }, "nanoid": { "version": "3.3.1", @@ -24847,13 +24852,13 @@ } }, "node-ios-device": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.11.0.tgz", - "integrity": "sha512-MUctq/+qq67v8Bd08XnHzOoK/YFJAVj8e35i9tLxqCh8C8MwcSIR27f0wQlYrUQ4UfnGdb8Dtx2DuNnMrpGSMw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.0.tgz", + "integrity": "sha512-ewGLYmcW1LbsTqs5UYmlLcm/52GCmGcuFTysWBqWnHPp88PfOh7uVm4zonb9r4MR/Nublt0vt0mNDIum0R71pw==", "requires": { "@mapbox/node-pre-gyp": "^1.0.10", "debug": "^4.3.4", - "nan": "^2.17.0", + "nan": "^2.20.0", "node-pre-gyp-init": "^1.2.1", "patch-package": "^6.5.1" } @@ -25832,9 +25837,9 @@ } }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==" }, "shebang-command": { "version": "1.2.0", diff --git a/package.json b/package.json index 0585e53a6a8..87fb7f8cfd5 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "ejs": "3.1.9", "fields": "0.1.24", "fs-extra": "11.2.0", - "ioslib": "1.7.35", + "ioslib": "1.7.36", "liveview": "1.5.6", "lodash.merge": "4.6.2", "markdown": "0.5.0", From 40808cd5ffed82abaeb7e7523100f901f336298f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Tue, 25 Jun 2024 04:58:01 +0200 Subject: [PATCH 02/88] feat: add swipe actions support for Ti.UI.TableView (#14065) * feat: add swipe actions support for Ti.UI.TableView * fix: fix linting issue * feat: support both leading and trailing state * feat: support leading edit actions in list view as well --- apidoc/Titanium/UI/ListItem.yml | 29 +++++++++- apidoc/Titanium/UI/TableView.yml | 34 ++++++++++++ apidoc/Titanium/UI/TableViewRow.yml | 8 +++ iphone/Classes/TiUIListView.m | 86 +++++++++++++++-------------- iphone/Classes/TiUITableView.m | 67 ++++++++++++++++++++++ iphone/Classes/TiUIiOSProxy.h | 2 +- iphone/Classes/TiUIiOSProxy.m | 17 ++---- 7 files changed, 186 insertions(+), 57 deletions(-) diff --git a/apidoc/Titanium/UI/ListItem.yml b/apidoc/Titanium/UI/ListItem.yml index 30065848130..d29225625cb 100644 --- a/apidoc/Titanium/UI/ListItem.yml +++ b/apidoc/Titanium/UI/ListItem.yml @@ -674,12 +674,27 @@ properties: --- name: RowActionType -summary: Represents the custom edit action for a ListItem. +summary: Represents the custom edit action for a ListItem or TableViewRow. description: | - By default when a listItem has [canEdit](Titanium.UI.ListItem.canEdit) set to true, a left swipe on the the row presens the 'Delete' button. + Edit actions can be used to add contextual buttons to your list items / table view rows. The configuration of + this API is the same for list items (if you use ) and table view rows (if you use . + description: | + Do not rely on the `source` property to determine which item fired the event. Use the + `row` and `section`, or the `index` to determine the table row that generated + the event. + + Note that the `index` property of this event correspond to the list view state + before the user action. + platforms: [iphone, ipad, macos] + since: 12.4.0 + properties: + - name: action + summary: The [title](RowActionType.title) as defined in the row action object. + type: String + + - name: identifier + summary: | + The [identifier](RowActionType. identifier) of the row action. Only included in the event + if previously defined. + type: String + + - name: row + summary: The row that fired this event. + type: [Titanium.UI.TableViewRow, Dictionary] + + - name: section + summary: The section that fired this event. + type: Titanium.UI.TableViewSection + + - name: index + summary: The index of the row that fired this event. + type: Number + methods: - name: appendRow summary: Appends a single row or an array of rows to the end of the table. diff --git a/apidoc/Titanium/UI/TableViewRow.yml b/apidoc/Titanium/UI/TableViewRow.yml index a5fb76598bc..a5e511827b9 100644 --- a/apidoc/Titanium/UI/TableViewRow.yml +++ b/apidoc/Titanium/UI/TableViewRow.yml @@ -226,6 +226,14 @@ properties: platforms: [android, iphone, ipad, macos] since: {android: "9.3.0", iphone: "3.2.0", ipad: "3.2.0", macos: "9.2.0"} + - name: editActions + summary: Specifies custom action items to be shown when when a list item is edited. + description: | + For more information see the "Editing Support" section of . + type: Array + since: 12.4.0 + platforms: [iphone, ipad, macos] + - name: filterAlwaysInclude summary: | This row will always be visible when you filter your content. diff --git a/iphone/Classes/TiUIListView.m b/iphone/Classes/TiUIListView.m index f1ca5250794..ae821bb0393 100644 --- a/iphone/Classes/TiUIListView.m +++ b/iphone/Classes/TiUIListView.m @@ -1146,23 +1146,49 @@ - (BOOL)tableView:(UITableView *)tableView canHandleDropSession:(id *editActions = [editActionProxies filteredArrayUsingPredicate:predicate]; + NSMutableArray *nativeEditActions = [NSMutableArray arrayWithCapacity:editActions.count]; + + if (IS_NULL_OR_NIL(editActions) || editActions.count == 0) { + return nil; + } - for (id prop in propArray) { - ENSURE_DICT(prop); + for (id prop in editActions) { NSString *title = [TiUtils stringValue:@"title" properties:prop]; NSString *identifier = [TiUtils stringValue:@"identifier" properties:prop]; - int actionStyle = [TiUtils intValue:@"style" properties:prop def:UITableViewRowActionStyleDefault]; + UIContextualActionStyle style = [TiUtils intValue:@"style" properties:prop def:UIContextualActionStyleNormal]; TiColor *color = [TiUtils colorValue:@"color" properties:prop]; id image = [prop objectForKey:@"image"]; - UITableViewRowAction *theAction = [UITableViewRowAction rowActionWithStyle:actionStyle + UIContextualAction *action = [UIContextualAction contextualActionWithStyle:style title:title - handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) { + handler:^(UIContextualAction *_Nonnull action, __kindof UIView *_Nonnull sourceView, void (^_Nonnull completionHandler)(BOOL)) { + completionHandler(YES); NSString *eventName = @"editaction"; NSIndexPath *realIndexPath = [self pathForSearchPath:indexPath]; @@ -1192,27 +1218,22 @@ - (NSArray *)editActionsFromValue:(id)value } // Hide editActions after selection - [[self tableView] setEditing:NO]; + // [[self tableView] setEditing:NO]; }]; - if (color) { - theAction.backgroundColor = [color color]; + + if (color != nil) { + action.backgroundColor = color.color; } - if (image) { + + if (image != nil) { NSURL *url = [TiUtils toURL:image proxy:(TiProxy *)self.proxy]; - UIImage *nativeImage = [[ImageLoader sharedLoader] loadImmediateImage:url]; - if (color) { - nativeImage = [self generateImage:nativeImage withBackgroundColor:[color color]]; - } - theAction.backgroundColor = [UIColor colorWithPatternImage:nativeImage]; - } - if (!returnArray) { - returnArray = [NSMutableArray arrayWithObject:theAction]; - } else { - [returnArray addObject:theAction]; + action.image = [[ImageLoader sharedLoader] loadImmediateImage:url]; } + + [nativeEditActions addObject:action]; } - return returnArray; + return [UISwipeActionsConfiguration configurationWithActions:nativeEditActions]; } - (UIImage *)generateImage:(UIImage *)image withBackgroundColor:(UIColor *)bgColor @@ -1388,23 +1409,6 @@ - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleFo return UITableViewCellEditingStyleNone; } -- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath -{ - NSIndexPath *realIndexPath = [self pathForSearchPath:indexPath]; - - if (![self canEditRowAtIndexPath:realIndexPath]) { - return nil; - } - - id editValue = [self valueWithKey:@"editActions" atIndexPath:realIndexPath]; - - if (IS_NULL_OR_NIL(editValue)) { - return nil; - } - - return [self editActionsFromValue:editValue]; -} - - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { NSIndexPath *realIndexPath = [self pathForSearchPath:indexPath]; diff --git a/iphone/Classes/TiUITableView.m b/iphone/Classes/TiUITableView.m index 31fba206cbb..bb417a072b6 100644 --- a/iphone/Classes/TiUITableView.m +++ b/iphone/Classes/TiUITableView.m @@ -2338,6 +2338,73 @@ - (void)tableViewDidEndMultipleSelectionInteraction:(UITableView *)tableView [self fireRowsSelectedEvent]; } +- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return [self swipeConfigurationForState:@"leading" withIndexPath:indexPath isDefault:NO]; +} + +- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return [self swipeConfigurationForState:@"trailing" withIndexPath:indexPath isDefault:YES]; +} + +- (UISwipeActionsConfiguration *)swipeConfigurationForState:(NSString *)state withIndexPath:(NSIndexPath *)indexPath isDefault:(BOOL)isDefault +{ + TiUITableViewRowProxy *row = [self rowForIndexPath:indexPath]; + TiUITableViewSectionProxy *section = [self sectionForIndex:indexPath.section]; + + BOOL canEdit = [TiUtils boolValue:[row valueForKey:@"editable"] def:NO]; + + if (!canEdit) { + return nil; + } + + NSArray *editActionProxies = (NSArray *)[row valueForKey:@"editActions"]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:isDefault ? @"state == nil OR state == %@" : @"state == %@", state]; + NSArray *editActions = [editActionProxies filteredArrayUsingPredicate:predicate]; + NSMutableArray *nativeEditActions = [NSMutableArray arrayWithCapacity:editActions.count]; + + if (IS_NULL_OR_NIL(editActions) || editActions.count == 0) { + return nil; + } + + for (id prop in editActions) { + NSString *title = [TiUtils stringValue:@"title" properties:prop]; + NSString *identifier = [TiUtils stringValue:@"identifier" properties:prop]; + UIContextualActionStyle style = [TiUtils intValue:@"style" properties:prop def:UIContextualActionStyleNormal]; + TiColor *color = [TiUtils colorValue:@"color" properties:prop]; + id image = [prop objectForKey:@"image"]; + + UIContextualAction *action = [UIContextualAction contextualActionWithStyle:style + title:title + handler:^(UIContextualAction *_Nonnull action, __kindof UIView *_Nonnull sourceView, void (^_Nonnull completionHandler)(BOOL)) { + completionHandler(YES); + + [[self proxy] fireEvent:@"editaction" + withObject:@{ + @"index" : @(indexPath.row), + @"row" : row, + @"section" : section, + @"action" : NULL_IF_NIL(action.title), + @"identifier" : NULL_IF_NIL(identifier) + }]; + }]; + + if (color != nil) { + action.backgroundColor = color.color; + } + + if (image != nil) { + NSURL *url = [TiUtils toURL:image proxy:(TiProxy *)self.proxy]; + action.image = [[ImageLoader sharedLoader] loadImmediateImage:url]; + } + + [nativeEditActions addObject:action]; + } + + return [UISwipeActionsConfiguration configurationWithActions:nativeEditActions]; +} + #pragma mark Collation - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)ourTableView diff --git a/iphone/Classes/TiUIiOSProxy.h b/iphone/Classes/TiUIiOSProxy.h index 0350a3dea11..ef246632734 100644 --- a/iphone/Classes/TiUIiOSProxy.h +++ b/iphone/Classes/TiUIiOSProxy.h @@ -67,7 +67,7 @@ @property (nonatomic, readonly) NSNumber *CLIP_MODE_ENABLED; @property (nonatomic, readonly) NSNumber *CLIP_MODE_DISABLED; -#ifdef USE_TI_UILISTVIEW +#if defined(USE_TI_UILISTVIEW) || defined(USE_TI_UITABLEVIEW) @property (nonatomic, readonly) NSNumber *ROW_ACTION_STYLE_DEFAULT; @property (nonatomic, readonly) NSNumber *ROW_ACTION_STYLE_DESTRUCTIVE; @property (nonatomic, readonly) NSNumber *ROW_ACTION_STYLE_NORMAL; diff --git a/iphone/Classes/TiUIiOSProxy.m b/iphone/Classes/TiUIiOSProxy.m index ceb94efd132..e06f49302e4 100644 --- a/iphone/Classes/TiUIiOSProxy.m +++ b/iphone/Classes/TiUIiOSProxy.m @@ -154,19 +154,10 @@ - (NSNumber *)CLIP_MODE_DISABLED return NUMINT(-1); } -#ifdef USE_TI_UILISTVIEW -- (NSNumber *)ROW_ACTION_STYLE_DEFAULT -{ - return @(UIContextualActionStyleNormal); -} -- (NSNumber *)ROW_ACTION_STYLE_DESTRUCTIVE -{ - return @(UIContextualActionStyleDestructive); -} -- (NSNumber *)ROW_ACTION_STYLE_NORMAL -{ - return @(UIContextualActionStyleNormal); -} +#if defined(USE_TI_UILISTVIEW) || defined(USE_TI_UITABLEVIEW) +MAKE_SYSTEM_PROP(ROW_ACTION_STYLE_DEFAULT, UIContextualActionStyleNormal); +MAKE_SYSTEM_PROP(ROW_ACTION_STYLE_DESTRUCTIVE, UIContextualActionStyleDestructive); +MAKE_SYSTEM_PROP(ROW_ACTION_STYLE_NORMAL, UIContextualActionStyleNormal); #endif #ifdef USE_TI_UIPICKER From 9f85623fa45dda478124a9b52794c77eb60bd5ac Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 25 Jun 2024 04:58:37 +0200 Subject: [PATCH 03/88] docs: add iOS WebViewConfiguration link (#14072) --- .../Titanium/UI/iOS/WebViewConfiguration.yml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apidoc/Titanium/UI/iOS/WebViewConfiguration.yml b/apidoc/Titanium/UI/iOS/WebViewConfiguration.yml index e7c2d29788f..7bf7efc2eb2 100644 --- a/apidoc/Titanium/UI/iOS/WebViewConfiguration.yml +++ b/apidoc/Titanium/UI/iOS/WebViewConfiguration.yml @@ -3,10 +3,12 @@ name: Titanium.UI.iOS.WebViewConfiguration summary: A collection of properties used to initialize a web view. description: | Use the method to create and use as a parameter of . - Using this you can determine how soon a webpage is rendered, how media playback is handled, the granularity of items that the + Using this you can determine how soon a webpage is rendered, how media playback is handled, the granularity of items that the user can select, and many other options. This property can only be set when creating the webview and will be ignored when set afterwards. See the example section "Usage of WebViewConfiguration with WebView in iOS". + Information on additional available preferences can be derived from the original WebKit sources: + [WKPreferences.mm](https://github.com/WebKit/webkit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm) extends: Titanium.Proxy platforms: [iphone, ipad, macos] since: {iphone: "8.0.0", ipad: "8.0.0", macos: "9.2.0"} @@ -30,7 +32,7 @@ properties: - name: suppressesIncrementalRendering summary: | - A Boolean value indicating whether the web view suppresses content rendering until it is fully + A Boolean value indicating whether the web view suppresses content rendering until it is fully loaded into memory. type: Boolean default: false @@ -39,8 +41,8 @@ properties: summary: | A Boolean value indicating whether HTML5 videos play inline or use the native full-screen controller. description: | - You must set this property to play inline video. Set this property to true to play videos inline. - Set this property to false to use the native full-screen controller. When adding a video element + You must set this property to play inline video. Set this property to true to play videos inline. + Set this property to false to use the native full-screen controller. When adding a video element to a HTML document on the iPhone, you must also include the playsinline attribute. The default value for iPhone is false and the default value for iPad is true. type: Boolean @@ -59,7 +61,7 @@ properties: - name: processPool summary: The process pool from which to obtain the Web Content process of view. description: | - When a web view is initialized, either a new web content process is created for it from the + When a web view is initialized, either a new web content process is created for it from the specified pool or an existing process in that pool is used. type: Titanium.UI.iOS.WebViewProcessPool platforms: [iphone, ipad, macos] @@ -77,7 +79,7 @@ properties: - name: javaScriptEnabled summary: A Boolean value indicating whether JavaScript is enabled. description: | - Setting this property to false disables JavaScripts that are loaded or executed by the web page. + Setting this property to false disables JavaScripts that are loaded or executed by the web page. This setting does not affect user scripts. type: Boolean default: true @@ -93,11 +95,11 @@ examples: Creates a configuration object and use it as property of webview. ``` js - var config = Ti.UI.iOS.createWebViewConfiguration({ + var config = Ti.UI.iOS.createWebViewConfiguration({ allowsPictureInPictureMediaPlayback: true, - preferences: { + preferences: { minimumFontSize : 20, - }, + }, }); var webView = Ti.UI.createWebView({ From ada10bb065851d4b8c55e1342b2a888a776ad381 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 25 Jun 2024 05:00:32 +0200 Subject: [PATCH 04/88] chore(android): prepare SDK for Android 34 (#13940) * chore(android): target API 34 * stay on target 33 --- android/gradle.properties | 2 +- .../ti/modules/titanium/android/AndroidModule.java | 9 ++++++++- .../ti/modules/titanium/network/TiNetworkListener.java | 10 +++++++++- .../java/org/appcelerator/titanium/TiApplication.java | 9 ++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index e5e7569a7a5..a5678e41a60 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -14,4 +14,4 @@ android.useAndroidX=true android.enableJetifier=false # remove if com.android.tools.build:gradle can be raised in /android/build.gradle -android.suppressUnsupportedCompileSdk=33 +android.suppressUnsupportedCompileSdk=33,34 diff --git a/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java b/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java index 947cc59cde4..fdc5c89431a 100644 --- a/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java +++ b/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java @@ -756,7 +756,14 @@ public void registerBroadcastReceiver(BroadcastReceiverProxy receiverProxy, Obje filter.addAction(TiConvert.toString(action)); } - TiApplication.getInstance().registerReceiver(receiverProxy.getBroadcastReceiver(), filter); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU + && TiApplication.getInstance().getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.TIRAMISU) { + int receiverFlags = Context.RECEIVER_EXPORTED; + TiApplication.getInstance().registerReceiver( + receiverProxy.getBroadcastReceiver(), filter, receiverFlags); + } else { + TiApplication.getInstance().registerReceiver(receiverProxy.getBroadcastReceiver(), filter); + } if (this.registeredBroadcastReceiverProxyList.contains(receiverProxy) == false) { this.registeredBroadcastReceiverProxyList.add(receiverProxy); } diff --git a/android/modules/network/src/java/ti/modules/titanium/network/TiNetworkListener.java b/android/modules/network/src/java/ti/modules/titanium/network/TiNetworkListener.java index 9474800138d..88eec58c041 100644 --- a/android/modules/network/src/java/ti/modules/titanium/network/TiNetworkListener.java +++ b/android/modules/network/src/java/ti/modules/titanium/network/TiNetworkListener.java @@ -7,6 +7,7 @@ package ti.modules.titanium.network; import org.appcelerator.kroll.common.Log; +import org.appcelerator.titanium.TiApplication; import android.content.BroadcastReceiver; import android.content.Context; @@ -14,6 +15,7 @@ import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -110,7 +112,13 @@ public void attach(Context context) } else { throw new IllegalStateException("Context was not cleaned up from last release."); } - context.registerReceiver(receiver, connectivityIntentFilter); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU + && TiApplication.getInstance().getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.TIRAMISU) { + int receiverFlags = Context.RECEIVER_EXPORTED; + context.registerReceiver(receiver, connectivityIntentFilter, receiverFlags); + } else { + context.registerReceiver(receiver, connectivityIntentFilter); + } listening = true; } else { Log.w(TAG, "Connectivity listener is already attached"); diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java b/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java index eff4749d181..cbaef3950dd 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java @@ -14,6 +14,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; +import android.os.Build; import android.os.Looper; import android.os.SystemClock; import android.util.DisplayMetrics; @@ -961,7 +962,13 @@ public void onReceive(Context context, Intent intent) } }; - registerReceiver(localeReceiver, new IntentFilter(Intent.ACTION_LOCALE_CHANGED)); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU + && TiApplication.getInstance().getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.TIRAMISU) { + int receiverFlags = Context.RECEIVER_EXPORTED; + registerReceiver(localeReceiver, new IntentFilter(Intent.ACTION_LOCALE_CHANGED), receiverFlags); + } else { + registerReceiver(localeReceiver, new IntentFilter(Intent.ACTION_LOCALE_CHANGED)); + } } private void stopLocaleMonitor() From 07df6890e2a363f40e44757147287bf307e86808 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 25 Jun 2024 05:06:12 +0200 Subject: [PATCH 05/88] feat(android): track color of the Ti.UI.Switch (#14054) * feat(android): track color of the Ti.UI.Switch * docs * thumb colors * update * docs * doc update --- .../ti/modules/titanium/ui/SwitchProxy.java | 6 +- .../titanium/ui/widget/TiUISwitch.java | 68 ++++++++++++++++++- .../java/org/appcelerator/titanium/TiC.java | 3 + apidoc/Titanium/UI/Switch.yml | 32 +++++++-- 4 files changed, 101 insertions(+), 8 deletions(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java index a4389620c6a..3bdcac73f38 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java @@ -23,7 +23,11 @@ TiC.PROPERTY_COLOR, TiC.PROPERTY_FONT, TiC.PROPERTY_TEXT_ALIGN, - TiC.PROPERTY_VERTICAL_ALIGN + TiC.PROPERTY_TINT_COLOR, + TiC.PROPERTY_ON_TINT_COLOR, + TiC.PROPERTY_VERTICAL_ALIGN, + TiC.PROPERTY_ON_THUMB_COLOR, + TiC.PROPERTY_THUMB_COLOR }) public class SwitchProxy extends TiViewProxy { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUISwitch.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUISwitch.java index cd4f66f0482..da3bb4a1112 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUISwitch.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUISwitch.java @@ -7,13 +7,17 @@ package ti.modules.titanium.ui.widget; import android.app.Activity; +import android.content.res.ColorStateList; import android.view.View; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; + import androidx.appcompat.widget.AppCompatToggleButton; + import com.google.android.material.checkbox.MaterialCheckBox; import com.google.android.material.chip.Chip; import com.google.android.material.switchmaterial.SwitchMaterial; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.common.Log; @@ -23,13 +27,14 @@ import org.appcelerator.titanium.util.TiConvert; import org.appcelerator.titanium.util.TiUIHelper; import org.appcelerator.titanium.view.TiUIView; + import ti.modules.titanium.ui.UIModule; public class TiUISwitch extends TiUIView implements OnCheckedChangeListener { private static final String TAG = "TiUISwitch"; - private View.OnLayoutChangeListener layoutListener; + private final View.OnLayoutChangeListener layoutListener; private boolean oldValue = false; public TiUISwitch(TiViewProxy proxy) @@ -37,7 +42,8 @@ public TiUISwitch(TiViewProxy proxy) super(proxy); Log.d(TAG, "Creating a switch", Log.DEBUG_MODE); - this.layoutListener = new View.OnLayoutChangeListener() { + this.layoutListener = new View.OnLayoutChangeListener() + { @Override public void onLayoutChange( View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) @@ -58,6 +64,62 @@ public void processProperties(KrollDict d) setStyle(TiConvert.toInt(d.get(TiC.PROPERTY_STYLE), UIModule.SWITCH_STYLE_SLIDER)); } + if (d.containsKeyAndNotNull(TiC.PROPERTY_THUMB_COLOR) + || d.containsKeyAndNotNull(TiC.PROPERTY_ON_THUMB_COLOR)) { + CompoundButton currentButton = (CompoundButton) getNativeView(); + if (currentButton instanceof SwitchMaterial) { + + int colActive = d.containsKeyAndNotNull(TiC.PROPERTY_ON_THUMB_COLOR) + ? TiConvert.toColor(d, TiC.PROPERTY_ON_THUMB_COLOR) + : TiConvert.toColor(d, TiC.PROPERTY_THUMB_COLOR); + int colNormal = d.containsKeyAndNotNull(TiC.PROPERTY_THUMB_COLOR) + ? TiConvert.toColor(d, TiC.PROPERTY_THUMB_COLOR) + : TiConvert.toColor(d, TiC.PROPERTY_ON_THUMB_COLOR); + + ColorStateList trackStates = new ColorStateList( + new int[][] { + new int[] { -android.R.attr.state_enabled }, + new int[] { android.R.attr.state_checked }, + new int[] {} + }, + new int[] { + colNormal, + colActive, + colNormal + } + ); + ((SwitchMaterial) currentButton).setThumbTintList(trackStates); + } + } + + if (d.containsKeyAndNotNull(TiC.PROPERTY_TINT_COLOR) + || d.containsKeyAndNotNull(TiC.PROPERTY_ON_TINT_COLOR)) { + CompoundButton currentButton = (CompoundButton) getNativeView(); + if (currentButton instanceof SwitchMaterial) { + + int colActive = d.containsKeyAndNotNull(TiC.PROPERTY_ON_TINT_COLOR) + ? TiConvert.toColor(d, TiC.PROPERTY_ON_TINT_COLOR) + : TiConvert.toColor(d, TiC.PROPERTY_TINT_COLOR); + int colNormal = d.containsKeyAndNotNull(TiC.PROPERTY_TINT_COLOR) + ? TiConvert.toColor(d, TiC.PROPERTY_TINT_COLOR) + : TiConvert.toColor(d, TiC.PROPERTY_ON_TINT_COLOR); + + ColorStateList trackStates = new ColorStateList( + new int[][] { + new int[] { -android.R.attr.state_enabled }, + new int[] { android.R.attr.state_checked }, + new int[] {} + }, + new int[] { + colNormal, + colActive, + colNormal + } + ); + ((SwitchMaterial) currentButton).setTrackTintList(trackStates); + } + } + if (d.containsKey(TiC.PROPERTY_VALUE)) { oldValue = TiConvert.toBoolean(d, TiC.PROPERTY_VALUE); } @@ -151,7 +213,7 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP } else { super.propertyChanged(key, oldValue, newValue, proxy); } - } + } @Override public void onCheckedChanged(CompoundButton btn, boolean value) diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiC.java b/android/titanium/src/java/org/appcelerator/titanium/TiC.java index 58beebdde16..4f219b4c308 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiC.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiC.java @@ -142,6 +142,8 @@ public class TiC public static final String EVENT_PROPERTY_TAB = "tab"; public static final String EVENT_PROPERTY_THUMB_OFFSET = "thumbOffset"; public static final String EVENT_PROPERTY_THUMB_SIZE = "thumbSize"; + public static final String PROPERTY_THUMB_COLOR = "thumbColor"; + public static final String PROPERTY_ON_THUMB_COLOR = "onThumbColor"; public static final String EVENT_PROPERTY_TYPE = "type"; public static final String EVENT_PROPERTY_VELOCITY = "velocity"; public static final String EVENT_PROPERTY_X = "x"; @@ -608,6 +610,7 @@ public class TiC public static final String PROPERTY_ON_RESTART = "onRestart"; public static final String PROPERTY_ON_PAUSE = "onPause"; public static final String PROPERTY_ON_STOP = "onStop"; + public static final String PROPERTY_ON_TINT_COLOR = "onTintColor"; public static final String PROPERTY_TLS_VERSION = "tlsVersion"; public static final String PROPERTY_ON_DESTROY = "onDestroy"; public static final String PROPERTY_ON_CREATE_WINDOW = "onCreateWindow"; diff --git a/apidoc/Titanium/UI/Switch.yml b/apidoc/Titanium/UI/Switch.yml index 326e54165f7..4ff5536acd5 100644 --- a/apidoc/Titanium/UI/Switch.yml +++ b/apidoc/Titanium/UI/Switch.yml @@ -118,17 +118,41 @@ properties: - name: tintColor summary: The color used to tint the outline of the switch when it is turned off. + description: | + The color used to tint the outline of the switch when it is turned off. + + Android: Track color of the Material Switch. type: [String, Titanium.UI.Color] default: undefined - platforms: [iphone, ipad, macos] - since: "3.3.0" + platforms: [android, iphone, ipad] + since: {android: 12.4.0, iphone: 3.3.0, ipad: 3.3.0} + + - name: onThumbColor + description: | + The color used to tint the thumb icon of the switch when it is turned on. + + Android: Active thumb color of the Material Switch. + type: [String, Titanium.UI.Color] + default: undefined + platforms: [android] + since: {android: 12.4.0} + + - name: thumbColor + description: | + The color used to tint the thumb icon of the switch when it is turned off. + + Android: Inactive thumb color of the Material Switch. + type: [String, Titanium.UI.Color] + default: undefined + platforms: [android] + since: {android: 12.4.0} - name: onTintColor summary: The color used to tint the appearance of the switch when it is turned on. type: [String, Titanium.UI.Color] default: undefined - platforms: [iphone, ipad, macos] - since: "3.3.0" + platforms: [android, iphone, ipad, macos] + since: {android: 12.4.0, iphone: 3.3.0, ipad: 3.3.0} - name: thumbTintColor summary: The color used to tint the appearance of the thumb. From ceda65eb73492c671b6dc74639dee072fa512439 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 25 Jun 2024 05:23:27 +0200 Subject: [PATCH 06/88] chore(android): new Android Studio settings xml (#14043) Co-authored-by: Chris Barber --- .../inspectionProfiles/Project_Default.xml | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/android/.idea/inspectionProfiles/Project_Default.xml b/android/.idea/inspectionProfiles/Project_Default.xml index 1eb788b1487..23c812cbcc9 100644 --- a/android/.idea/inspectionProfiles/Project_Default.xml +++ b/android/.idea/inspectionProfiles/Project_Default.xml @@ -10,7 +10,11 @@ - + + @@ -155,11 +159,21 @@ - - + + \ No newline at end of file From 420ccdceadff8658803e02bb6144e853c8767a20 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 25 Jun 2024 05:23:34 +0200 Subject: [PATCH 07/88] chore: fix webpack command name issue (#14067) --- cli/hooks/webpack.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/hooks/webpack.js b/cli/hooks/webpack.js index cd9c06a36a8..943e87c29d6 100644 --- a/cli/hooks/webpack.js +++ b/cli/hooks/webpack.js @@ -35,6 +35,9 @@ exports.init = (logger, config, cli) => { cli.on('cli:command-loaded', (hookData) => { const command = hookData.command; commandName = command.name; + if (typeof command.name === 'function') { + commandName = command.name(); + } }); cli.on('cli:post-validate', () => { From d1bbe8ac2d5fc8530858bcaa48b56d94b9c407e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Wed, 10 Jul 2024 10:33:14 +0200 Subject: [PATCH 08/88] =?UTF-8?q?fix(android):=20add=20missing=20=E2=80=9C?= =?UTF-8?q?Calendar.Event.remove=E2=80=9D=20method=20(#14076)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(android): add missing “Calendar.Event.remove” method * fix: remove eventId parameter, use inner ID --- .../ti/modules/titanium/calendar/EventProxy.java | 15 +++++++++++++++ apidoc/Titanium/Calendar/Event.yml | 11 ++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java index 7a8c8c9846c..9ad71100316 100644 --- a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java +++ b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java @@ -559,6 +559,21 @@ public void setExtendedProperty(String name, String value) contentResolver.insert(extPropsUri, values); } + @Kroll.method + public boolean remove() + { + ContentResolver contentResolver = TiApplication.getInstance().getContentResolver(); + + try { + Uri deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, TiConvert.toInt(id)); + contentResolver.delete(deleteUri, null, null); + } catch (IllegalArgumentException e) { + return false; + } + + return true; + } + @Override public String getApiName() { diff --git a/apidoc/Titanium/Calendar/Event.yml b/apidoc/Titanium/Calendar/Event.yml index 51d4831c44a..da4d8cbe140 100644 --- a/apidoc/Titanium/Calendar/Event.yml +++ b/apidoc/Titanium/Calendar/Event.yml @@ -72,7 +72,7 @@ methods: - name: save summary: Saves changes to an event permanently. description: | - This method raises an exception if it is passed an event from another event store. + This method raises an exception if it is passed an event from another calendar. When an event is saved, it is updated in the Calendar database. Any fields you did not modify are updated to reflect the most recent value in the database. If the @@ -94,20 +94,21 @@ methods: since: {android: "7.1.0", iphone: "3.1.0", ipad: "3.1.0"} - name: remove - summary: Removes an event from the event store. + summary: Removes an event from the calendar. description: | - This method raises an exception if it is passed an event from another event store. + This method raises an exception on iOS if an event from another calendar is used. returns: type: Boolean parameters: - name: span summary: | - The span to use. Indicates whether to remove future instances of the event in + iOS-only: The span to use. Indicates whether to remove future instances of the event in the case of a recurring event. type: Number constants: Titanium.Calendar.SPAN_* default: - platforms: [iphone, ipad, macos] + since: {android: "12.4.0", iphone: "3.1.0", ipad: "3.1.0", macos: "9.2.0"} + platforms: [android, iphone, ipad, macos] - name: refresh summary: Updates the event's data with the current information in the Calendar database. From d5cff3c32d33b2df2469af949c54c4bab1734676 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Wed, 10 Jul 2024 10:35:28 +0200 Subject: [PATCH 09/88] feat(android): optionBar color properties (#14066) * feat(android): optionBar color properties * remove unused states * docs --- .../titanium/ui/widget/TiUIOptionBar.java | 53 +++++++++++++++++++ apidoc/Titanium/UI/OptionBar.yml | 24 +++++++++ 2 files changed, 77 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIOptionBar.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIOptionBar.java index 729549b64ad..cc18e9b3e95 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIOptionBar.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIOptionBar.java @@ -7,6 +7,7 @@ package ti.modules.titanium.ui.widget; import android.content.Context; +import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.view.View; import android.view.ViewGroup; @@ -207,6 +208,58 @@ private void addButton(String title, String accessibilityLabel, Drawable imageDr MaterialButton button = new MaterialButton(context, null, attributeId); button.setEnabled(isEnabled); button.setText(title); + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_SELECTED_BACKGROUND_COLOR)) { + ColorStateList oldColors = button.getBackgroundTintList(); + int col = TiConvert.toColor((String) proxy.getProperty(TiC.PROPERTY_SELECTED_BACKGROUND_COLOR), context); + ColorStateList trackStates = new ColorStateList( + new int[][] { + new int[] { -android.R.attr.state_checked }, + new int[] { android.R.attr.state_checked }, + }, + new int[] { + oldColors.getColorForState(new int[] { -android.R.attr.state_checked }, R.attr.colorOnSurface), + col + } + ); + button.setBackgroundTintList(trackStates); + } + if (proxy.hasPropertyAndNotNull("selectedBorderColor")) { + ColorStateList oldColors = button.getStrokeColor(); + int col = TiConvert.toColor((String) proxy.getProperty("selectedBorderColor"), context); + ColorStateList trackStates = new ColorStateList( + new int[][] { + new int[] { -android.R.attr.state_checked }, + new int[] { android.R.attr.state_checked }, + }, + new int[] { + oldColors.getColorForState(new int[] { -android.R.attr.state_checked }, R.attr.colorOnSurface), + col + } + ); + button.setStrokeColor(trackStates); + } + if (proxy.hasPropertyAndNotNull("selectedTextColor") || proxy.hasPropertyAndNotNull(TiC.PROPERTY_COLOR)) { + int textCol = button.getCurrentHintTextColor(); + int selCol = button.getCurrentTextColor(); + + if (proxy.hasPropertyAndNotNull("selectedTextColor")) { + selCol = TiConvert.toColor((String) proxy.getProperty("selectedTextColor"), context); + } + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_COLOR)) { + textCol = TiConvert.toColor((String) proxy.getProperty(TiC.PROPERTY_COLOR), context); + } + ColorStateList trackStates = new ColorStateList( + new int[][] { + new int[] { -android.R.attr.state_checked }, + new int[] { android.R.attr.state_checked }, + }, + new int[] { + textCol, + selCol, + } + ); + button.setTextColor(trackStates); + } if ((accessibilityLabel != null) && !accessibilityLabel.isEmpty()) { button.setContentDescription(accessibilityLabel); } diff --git a/apidoc/Titanium/UI/OptionBar.yml b/apidoc/Titanium/UI/OptionBar.yml index 9c6fc680bf1..f96bbe19130 100644 --- a/apidoc/Titanium/UI/OptionBar.yml +++ b/apidoc/Titanium/UI/OptionBar.yml @@ -60,6 +60,30 @@ properties: default: horizontal availability: creation + - name: selectedBackgroundColor + summary: Background color of the selected button + type: [String, Titanium.UI.Color] + platforms: [android] + since: { android: "12.4.0"} + + - name: selectedTextColor + summary: Text color of the selected button + type: [String, Titanium.UI.Color] + platforms: [android] + since: { android: "12.4.0"} + + - name: selectedBorderColor + summary: Border color of the selected button + type: [String, Titanium.UI.Color] + platforms: [android] + since: { android: "12.4.0"} + + - name: color + summary: Text color of the unselected button + type: [String, Titanium.UI.Color] + platforms: [android] + since: { android: "12.4.0"} + examples: - title: Text-Only Buttons example: | From 52cab4293d6c9a0472428f4ed0d0fb7566ebb530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Wed, 10 Jul 2024 18:27:53 +0200 Subject: [PATCH 10/88] chore: bump master to 12.5.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b577831625..8e1c2c4b90d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "titanium-mobile", - "version": "12.4.0", + "version": "12.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "titanium-mobile", - "version": "12.4.0", + "version": "12.5.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 87fb7f8cfd5..7afa00d6aed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "titanium-mobile", "description": "Titanium SDK", - "version": "12.4.0", + "version": "12.5.0", "moduleApiVersion": { "iphone": "2", "android": "4" From 7e370bb6e787a722840f2afed5962731d64c3eab Mon Sep 17 00:00:00 2001 From: hansemannn Date: Sat, 13 Jul 2024 00:06:32 +0000 Subject: [PATCH 11/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a509f65fbb..020044ccfa2 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierAvinash DalviJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn Gould +Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierAvinash DalviJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldWillie Kwok ## Features From d999024678db60117762377bd6fec256acb46eb8 Mon Sep 17 00:00:00 2001 From: hansemannn Date: Mon, 15 Jul 2024 00:06:24 +0000 Subject: [PATCH 12/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 020044ccfa2..1aeaff191fa 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierAvinash DalviJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldWillie Kwok +Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldWillie Kwok ## Features From 7593940da3bd2772d09c9e4210cbede9dcf3bdf3 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 16 Jul 2024 16:29:31 +0200 Subject: [PATCH 13/88] fix(android): focus event in TabGroup (#14083) --- .../ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java index c1849cdc9de..ce97a31f23c 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java @@ -569,7 +569,7 @@ public void onTabSelected(TabProxy tabProxy) tabProxy.onSelectionChanged(true); tabProxy.onFocusChanged(true, focusEventData); - tabProxy.fireEvent(TiC.EVENT_SELECTED, focusEventData, false); + tabProxy.fireEvent(TiC.EVENT_SELECTED, focusEventData.clone(), false); } @Override From 595e698450737792db4b1570a2bf2938f261edcc Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Mon, 15 Jul 2024 21:57:44 +0100 Subject: [PATCH 14/88] chore: update ioslib to fix node-ios-device x64 issue --- package-lock.json | 74 +++++++++++++++++++++++++++++++++++------------ package.json | 2 +- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8e1c2c4b90d..fd968703387 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "ejs": "3.1.9", "fields": "0.1.24", "fs-extra": "11.2.0", - "ioslib": "1.7.36", + "ioslib": "1.7.37", "liveview": "1.5.6", "lodash.merge": "4.6.2", "markdown": "0.5.0", @@ -2285,6 +2285,7 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "license": "BSD-3-Clause", "dependencies": { "detect-libc": "^2.0.0", "https-proxy-agent": "^5.0.0", @@ -2305,6 +2306,7 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", "deprecated": "This package is no longer supported.", + "license": "ISC", "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -2318,6 +2320,7 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", "deprecated": "This package is no longer supported.", + "license": "ISC", "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -2337,6 +2340,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "license": "ISC", "dependencies": { "abbrev": "1" }, @@ -2352,6 +2356,7 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", "deprecated": "This package is no longer supported.", + "license": "ISC", "dependencies": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -3744,7 +3749,8 @@ "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==" + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "license": "BSD-2-Clause" }, "node_modules/@yarnpkg/parsers": { "version": "3.0.0-rc.41", @@ -5192,7 +5198,8 @@ "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "license": "MIT" }, "node_modules/clang-format": { "version": "1.6.0", @@ -6493,6 +6500,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "license": "Apache-2.0", "engines": { "node": ">=8" } @@ -7590,6 +7598,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "license": "Apache-2.0", "dependencies": { "micromatch": "^4.0.2" } @@ -8813,9 +8822,10 @@ } }, "node_modules/ioslib": { - "version": "1.7.36", - "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.36.tgz", - "integrity": "sha512-LxmVa7TrKPXOE2IWxlNyNASTonSLjizxfG1dO8wZwGWowng+9/YBeIbPcQxaFgT8GMGeSMkkK1Npi2XUl7iiVQ==", + "version": "1.7.37", + "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.37.tgz", + "integrity": "sha512-D4SrH3QocN2GBlzSBcv9V1WKpmcOVUk3F6rjHafWXtrAFs7ZrsPtyR0nA4t1ubqjOYwkTZLgMliEUrs5bpfqXQ==", + "license": "Apache-2.0", "dependencies": { "always-tail": "0.2.0", "async": "^3.2.4", @@ -8823,7 +8833,7 @@ "debug": "^4.3.4", "mkdirp": "0.5.1", "node-appc": "1.1.6", - "node-ios-device": "1.12.0" + "node-ios-device": "^1.12.1" }, "engines": { "node": ">=10.13" @@ -8982,6 +8992,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "license": "MIT", "dependencies": { "ci-info": "^2.0.0" }, @@ -9019,6 +9030,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -9302,6 +9314,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "license": "MIT", "dependencies": { "is-docker": "^2.0.0" }, @@ -9799,6 +9812,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "license": "MIT", "dependencies": { "graceful-fs": "^4.1.11" } @@ -11429,7 +11443,8 @@ "node_modules/nan": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", - "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==" + "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.1", @@ -11694,10 +11709,11 @@ } }, "node_modules/node-ios-device": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.0.tgz", - "integrity": "sha512-ewGLYmcW1LbsTqs5UYmlLcm/52GCmGcuFTysWBqWnHPp88PfOh7uVm4zonb9r4MR/Nublt0vt0mNDIum0R71pw==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.1.tgz", + "integrity": "sha512-qcCfQw5qXek1l4NDuKt19w4gCZK4Sra4AM2PXQrpW5NhhCCl0pGfDKknBNzB0UmVd+lRm5CF5Wvy8c2Nor2jEQ==", "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { "@mapbox/node-pre-gyp": "^1.0.10", "debug": "^4.3.4", @@ -11713,6 +11729,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/node-pre-gyp-init/-/node-pre-gyp-init-1.2.1.tgz", "integrity": "sha512-gbC2fERRmWbJFvj54f4yyiY/O6J1kkLrN7jkwRvzNmgMgPCufZLv76l2luzWjj+Ge0xQF6zDalZ6iIgzCHJ95Q==", + "license": "MIT", "dependencies": { "@mapbox/node-pre-gyp": "^1.0.1" } @@ -12383,6 +12400,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -12476,6 +12494,7 @@ "version": "7.4.2", "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "license": "MIT", "dependencies": { "is-docker": "^2.0.0", "is-wsl": "^2.1.1" @@ -12864,6 +12883,7 @@ "version": "6.5.1", "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.5.1.tgz", "integrity": "sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA==", + "license": "MIT", "dependencies": { "@yarnpkg/lockfile": "^1.1.0", "chalk": "^4.1.2", @@ -12892,6 +12912,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -12906,6 +12927,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -12921,6 +12943,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -12931,12 +12954,14 @@ "node_modules/patch-package/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/patch-package/node_modules/cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -12952,6 +12977,7 @@ "version": "9.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "license": "MIT", "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -12967,6 +12993,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -12986,6 +13013,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -12994,6 +13022,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "license": "MIT", "engines": { "node": ">=4" } @@ -13003,6 +13032,7 @@ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -13014,6 +13044,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", "bin": { "semver": "bin/semver" } @@ -13022,6 +13053,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "license": "MIT", "dependencies": { "shebang-regex": "^1.0.0" }, @@ -13033,6 +13065,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -13041,6 +13074,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -13052,6 +13086,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -14543,6 +14578,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "license": "MIT", "engines": { "node": ">=6" } @@ -22690,9 +22726,9 @@ } }, "ioslib": { - "version": "1.7.36", - "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.36.tgz", - "integrity": "sha512-LxmVa7TrKPXOE2IWxlNyNASTonSLjizxfG1dO8wZwGWowng+9/YBeIbPcQxaFgT8GMGeSMkkK1Npi2XUl7iiVQ==", + "version": "1.7.37", + "resolved": "https://registry.npmjs.org/ioslib/-/ioslib-1.7.37.tgz", + "integrity": "sha512-D4SrH3QocN2GBlzSBcv9V1WKpmcOVUk3F6rjHafWXtrAFs7ZrsPtyR0nA4t1ubqjOYwkTZLgMliEUrs5bpfqXQ==", "requires": { "always-tail": "0.2.0", "async": "^3.2.4", @@ -22700,7 +22736,7 @@ "debug": "^4.3.4", "mkdirp": "0.5.1", "node-appc": "1.1.6", - "node-ios-device": "1.12.0" + "node-ios-device": "^1.12.1" }, "dependencies": { "@xmldom/xmldom": { @@ -24852,9 +24888,9 @@ } }, "node-ios-device": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.0.tgz", - "integrity": "sha512-ewGLYmcW1LbsTqs5UYmlLcm/52GCmGcuFTysWBqWnHPp88PfOh7uVm4zonb9r4MR/Nublt0vt0mNDIum0R71pw==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/node-ios-device/-/node-ios-device-1.12.1.tgz", + "integrity": "sha512-qcCfQw5qXek1l4NDuKt19w4gCZK4Sra4AM2PXQrpW5NhhCCl0pGfDKknBNzB0UmVd+lRm5CF5Wvy8c2Nor2jEQ==", "requires": { "@mapbox/node-pre-gyp": "^1.0.10", "debug": "^4.3.4", diff --git a/package.json b/package.json index 7afa00d6aed..543a66416e7 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "ejs": "3.1.9", "fields": "0.1.24", "fs-extra": "11.2.0", - "ioslib": "1.7.36", + "ioslib": "1.7.37", "liveview": "1.5.6", "lodash.merge": "4.6.2", "markdown": "0.5.0", From 9388600a951db750e188eaca6c14b6e1683ffd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Wed, 17 Jul 2024 20:20:41 +0200 Subject: [PATCH 15/88] feat: add 12.4.0.GA changelog # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8acc98e268b..ca98a09d798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,132 @@ +# [12.4.0](https://github.com/tidev/titanium_mobile/compare/12_3_X...12.4.0) (2024-07-17) + +## About this release + +Titanium SDK 12.4.0 is a minor release of the SDK, adding new features and platform updates. + +## Community Credits + +* Hans Knöchel + * add 12.4.0 changelog ([874e5f2](https://github.com/tidev/titanium_mobile/commit/874e5f2a86a1a58f99f4de50378c824e5b67029f)) + * add missing “Calendar.Event.remove” method ([d1bbe8a](https://github.com/tidev/titanium_mobile/commit/d1bbe8ac2d5fc8530858bcaa48b56d94b9c407e4)) + * add swipe actions support for Ti.UI.TableView ([40808cd](https://github.com/tidev/titanium_mobile/commit/40808cd5ffed82abaeb7e7523100f901f336298f)) + * add iOS 17+ symbol effects ([84ccadb](https://github.com/tidev/titanium_mobile/commit/84ccadbdcbe9b800ebc08dbac8ae5eaeac36a7f8)) + * update changelog ([9f144c1](https://github.com/tidev/titanium_mobile/commit/9f144c12c28fe6ead59237759c53c40509f3d4cc)) + * bump master to 12.4.0 ([2f1212f](https://github.com/tidev/titanium_mobile/commit/2f1212fd9e46a4a8aeae0af7a850aaa7bff34e52)) + * address all whitespace-related linting issues part 2 ([8c92dc7](https://github.com/tidev/titanium_mobile/commit/8c92dc7521219efebad8943a5305348014bd32e4)) + * address all whitespace-related linting issues ([e2bf653](https://github.com/tidev/titanium_mobile/commit/e2bf653d406b772deeafb504a0b9f68e363cf3e5)) + * fix linting issues ([bf24bf2](https://github.com/tidev/titanium_mobile/commit/bf24bf26ae07ebda2e2d70c23de198bac6b2ba8e)) + * Revert "feat(ios): support multi-scene applications (#13941)" ([82203d7](https://github.com/tidev/titanium_mobile/commit/82203d782fd499a33723bf86b41e1019e50bc99d)) + * fix some open issues related to scenes ([a0a3aea](https://github.com/tidev/titanium_mobile/commit/a0a3aeaf666b864fbcb75e57f011a142dbae715c)) + * fix debug issues with scenes ([8bcd5c3](https://github.com/tidev/titanium_mobile/commit/8bcd5c31a8dc86415c231a6086c1d83bbb183565)) + * Revert "feat(ios): support multi-scene applications (#13941)" ([4a1d20f](https://github.com/tidev/titanium_mobile/commit/4a1d20f43c82296dd21bfd760fa63b65927e98fd)) + +* Michael Gangolf + * optionBar color properties ([d5cff3c](https://github.com/tidev/titanium_mobile/commit/d5cff3c32d33b2df2469af949c54c4bab1734676)) + * fix webpack command name issue ([420ccdc](https://github.com/tidev/titanium_mobile/commit/420ccdceadff8658803e02bb6144e853c8767a20)) + * new Android Studio settings xml ([ceda65e](https://github.com/tidev/titanium_mobile/commit/ceda65eb73492c671b6dc74639dee072fa512439)) + * track color of the Ti.UI.Switch ([07df689](https://github.com/tidev/titanium_mobile/commit/07df6890e2a363f40e44757147287bf307e86808)) + * prepare SDK for Android 34 ([ada10bb](https://github.com/tidev/titanium_mobile/commit/ada10bb065851d4b8c55e1342b2a888a776ad381)) + * add iOS WebViewConfiguration link ([9f85623](https://github.com/tidev/titanium_mobile/commit/9f85623fa45dda478124a9b52794c77eb60bd5ac)) + * ioslib update ([7b82317](https://github.com/tidev/titanium_mobile/commit/7b82317907a492b57c52059d8a648ad0e07fb834)) + * new event for empty TextFields ([29964cf](https://github.com/tidev/titanium_mobile/commit/29964cf5a6830948b802810a41e42230c3b1e820)) + * textAlignment for DatePicker ([afb253e](https://github.com/tidev/titanium_mobile/commit/afb253e697442cb6bafdb430a9d8d3539235d58e)) + * add source to webView fireEvent ([960d40c](https://github.com/tidev/titanium_mobile/commit/960d40cd153fc3ee9e0cad09e5171a7a65c62253)) + * remove some dead analytics code ([6926f0d](https://github.com/tidev/titanium_mobile/commit/6926f0d9bfc177fe74e43fa1242adc8f30972cae)) + * update ti.playservice to 18.3.0 ([dc180b9](https://github.com/tidev/titanium_mobile/commit/dc180b94f05aa810aa1f302958ee3f6b36ae69c4)) + * expose contentOffset getter in TableView/ListView ([1f75084](https://github.com/tidev/titanium_mobile/commit/1f7508484839ec20626f6c189e94068fca042f08)) + * ndk update ([a852835](https://github.com/tidev/titanium_mobile/commit/a852835f7612d9c0ab034872a0439461dddde488)) + * add moveToBackground method ([229ef10](https://github.com/tidev/titanium_mobile/commit/229ef10fcfba15ad3050af9266aca8f2c2012448)) + * videoPlayer speed property ([7b9a4e9](https://github.com/tidev/titanium_mobile/commit/7b9a4e92b2e26cc6d8816c1f7fbfda06316997b6)) + * bundle webp res files ([6552a2c](https://github.com/tidev/titanium_mobile/commit/6552a2ccb0c11d01a6bcf185f228dcac709b0453)) + * adaptive icons in default template ([2e0e2e5](https://github.com/tidev/titanium_mobile/commit/2e0e2e5dfa8a726561d2f15daad65a9fec7afa3a)) + * attributedString link example ([cb69378](https://github.com/tidev/titanium_mobile/commit/cb6937849970ac8417ea87f950b03467668672cd)) + * update TabbedBar Android properties ([f5dfa92](https://github.com/tidev/titanium_mobile/commit/f5dfa923fcf649a10e861251d87a073526af2896)) + * node-appc update ([644831f](https://github.com/tidev/titanium_mobile/commit/644831f18e6f35e987992da3f72e294e0d9649be)) + * create alloy project with spaces with --alloy ([c601e7e](https://github.com/tidev/titanium_mobile/commit/c601e7e7579b7b527cc2321b63c82232b169faf4)) + * improve accessibility text ([3171e14](https://github.com/tidev/titanium_mobile/commit/3171e140fd106afb3b42f09076b1cc0a0b86f895)) + * remove some deprecated classes ([e1f2dc1](https://github.com/tidev/titanium_mobile/commit/e1f2dc1e4b246c7156e31fd68a287ca04cc4b752)) + * raise android max sdk support ([eb87849](https://github.com/tidev/titanium_mobile/commit/eb87849b67b68205567247e20e30c7d43e8ea990)) + * add overrideUserInterfaceStyle to Picker ([0c93fa7](https://github.com/tidev/titanium_mobile/commit/0c93fa77aa911e92d3dfbae312e2884706414753)) + * fixing typos ([a298387](https://github.com/tidev/titanium_mobile/commit/a2983877b5a7d6c14bdfdc5426a82e2aca590074)) + * improve the ScrollableView clipView description ([940ca9e](https://github.com/tidev/titanium_mobile/commit/940ca9e959aad1010cc42c6196d9a21a92febc0b)) + * npm packages ([48afddf](https://github.com/tidev/titanium_mobile/commit/48afddf5652602ae2f8cc376d9a37156c828d9c1)) + * hide scrollbars in WebView ([6642ed1](https://github.com/tidev/titanium_mobile/commit/6642ed16ec984331cafa62658a887b33c6a9cd2f)) + * indent log correctly ([a7b145d](https://github.com/tidev/titanium_mobile/commit/a7b145d5668b661f903fdfe53b380bd35a82265a)) + * backgroundColor for RefreshControl ([4f78a79](https://github.com/tidev/titanium_mobile/commit/4f78a79cc51b9a90fa7eb2226e98fad471a6db8d)) + * defaultLang option in tiapp.xml ([07e9a6a](https://github.com/tidev/titanium_mobile/commit/07e9a6ac58a72178c35bda6fdf298860d7786885)) + * pass platform to tiappxml ([760ca45](https://github.com/tidev/titanium_mobile/commit/760ca45c9b63c0aa06940a36010d051b7bb2cbed)) + * try/catch around unlink snapshots ([115bbb2](https://github.com/tidev/titanium_mobile/commit/115bbb24214374228d06a299ce720e72661785cb)) + * update gradle ([e41650c](https://github.com/tidev/titanium_mobile/commit/e41650cd9d088435e8e9641ceae5a2802223a3d2)) + * add info about iOS foreground notifications ([4e5ca53](https://github.com/tidev/titanium_mobile/commit/4e5ca53bf58db474d968bbe1616fcca6d18b2b90)) + * link idleTimerDisabled and keepScreenOn ([bd5c5e7](https://github.com/tidev/titanium_mobile/commit/bd5c5e71d24b04691b510f96b1567da16a5b8283)) + * fix some doc errors ([cf14a9b](https://github.com/tidev/titanium_mobile/commit/cf14a9b4ed83cef111e80d87189cc3e89a906d11)) + * update ti.map ([5eb950c](https://github.com/tidev/titanium_mobile/commit/5eb950ce1c3392f26496a6c6317b5dea24eee9e4)) + +## Bug Fixes + +### Multiple platforms + +* address all whitespace-related linting issues ([e2bf653](https://github.com/tidev/titanium_mobile/commit/e2bf653d406b772deeafb504a0b9f68e363cf3e5)) +* address all whitespace-related linting issues part 2 ([8c92dc7](https://github.com/tidev/titanium_mobile/commit/8c92dc7521219efebad8943a5305348014bd32e4)) +* create alloy project with spaces with --alloy ([c601e7e](https://github.com/tidev/titanium_mobile/commit/c601e7e7579b7b527cc2321b63c82232b169faf4)) +* fix linting issues ([bf24bf2](https://github.com/tidev/titanium_mobile/commit/bf24bf26ae07ebda2e2d70c23de198bac6b2ba8e)) + +### Android platform + +* add missing “Calendar.Event.remove” method ([d1bbe8a](https://github.com/tidev/titanium_mobile/commit/d1bbe8ac2d5fc8530858bcaa48b56d94b9c407e4)) +* bundle webp res files ([6552a2c](https://github.com/tidev/titanium_mobile/commit/6552a2ccb0c11d01a6bcf185f228dcac709b0453)) +* remove some deprecated classes ([e1f2dc1](https://github.com/tidev/titanium_mobile/commit/e1f2dc1e4b246c7156e31fd68a287ca04cc4b752)) + +### iOS platform + +* fix debug issues with scenes ([8bcd5c3](https://github.com/tidev/titanium_mobile/commit/8bcd5c31a8dc86415c231a6086c1d83bbb183565)) +* fix some open issues related to scenes ([a0a3aea](https://github.com/tidev/titanium_mobile/commit/a0a3aeaf666b864fbcb75e57f011a142dbae715c)) + +## Features + +### Multiple platforms + +* add swipe actions support for Ti.UI.TableView ([40808cd](https://github.com/tidev/titanium_mobile/commit/40808cd5ffed82abaeb7e7523100f901f336298f)) + +### Android platform + +* adaptive icons in default template ([2e0e2e5](https://github.com/tidev/titanium_mobile/commit/2e0e2e5dfa8a726561d2f15daad65a9fec7afa3a)) +* add moveToBackground method ([229ef10](https://github.com/tidev/titanium_mobile/commit/229ef10fcfba15ad3050af9266aca8f2c2012448)) +* add source to webView fireEvent ([960d40c](https://github.com/tidev/titanium_mobile/commit/960d40cd153fc3ee9e0cad09e5171a7a65c62253)) +* defaultLang option in tiapp.xml ([07e9a6a](https://github.com/tidev/titanium_mobile/commit/07e9a6ac58a72178c35bda6fdf298860d7786885)) +* expose contentOffset getter in TableView/ListView ([1f75084](https://github.com/tidev/titanium_mobile/commit/1f7508484839ec20626f6c189e94068fca042f08)) +* hide scrollbars in WebView ([6642ed1](https://github.com/tidev/titanium_mobile/commit/6642ed16ec984331cafa62658a887b33c6a9cd2f)) +* improve accessibility text ([3171e14](https://github.com/tidev/titanium_mobile/commit/3171e140fd106afb3b42f09076b1cc0a0b86f895)) +* indent log correctly ([a7b145d](https://github.com/tidev/titanium_mobile/commit/a7b145d5668b661f903fdfe53b380bd35a82265a)) +* new event for empty TextFields ([29964cf](https://github.com/tidev/titanium_mobile/commit/29964cf5a6830948b802810a41e42230c3b1e820)) +* optionBar color properties ([d5cff3c](https://github.com/tidev/titanium_mobile/commit/d5cff3c32d33b2df2469af949c54c4bab1734676)) +* textAlignment for DatePicker ([afb253e](https://github.com/tidev/titanium_mobile/commit/afb253e697442cb6bafdb430a9d8d3539235d58e)) +* track color of the Ti.UI.Switch ([07df689](https://github.com/tidev/titanium_mobile/commit/07df6890e2a363f40e44757147287bf307e86808)) +* update gradle ([e41650c](https://github.com/tidev/titanium_mobile/commit/e41650cd9d088435e8e9641ceae5a2802223a3d2)) +* update ti.playservice to 18.3.0 ([dc180b9](https://github.com/tidev/titanium_mobile/commit/dc180b94f05aa810aa1f302958ee3f6b36ae69c4)) +* videoPlayer speed property ([7b9a4e9](https://github.com/tidev/titanium_mobile/commit/7b9a4e92b2e26cc6d8816c1f7fbfda06316997b6)) + +### iOS platform + +* add iOS 17+ symbol effects ([84ccadb](https://github.com/tidev/titanium_mobile/commit/84ccadbdcbe9b800ebc08dbac8ae5eaeac36a7f8)) +* add overrideUserInterfaceStyle to Picker ([0c93fa7](https://github.com/tidev/titanium_mobile/commit/0c93fa77aa911e92d3dfbae312e2884706414753)) +* backgroundColor for RefreshControl ([4f78a79](https://github.com/tidev/titanium_mobile/commit/4f78a79cc51b9a90fa7eb2226e98fad471a6db8d)) + +## SDK Module Versions + +| Module | Android version | iOS Version | +| ----------- | --------------- | ----------- | +| facebook | 12.1.0 | 14.0.0 | +| ti.map | 5.6.1 | 7.3.1 | +| ti.webdialog | 2.3.0 | 3.0.2 | +| ti.playservices | 18.3.0 | n/a | +| ti.identity | 3.1.0 | 5.0.0 | +| urlSession | n/a | 4.0.1 | +| ti.coremotion | n/a | 4.0.1 | +| ti.applesignin | n/a | 3.1.2 | +| hyperloop | 7.0.6 | 7.0.6 | + ## [12.3.1](https://github.com/tidev/titanium_mobile/compare/12_3_0_GA...12.3.1) (2024-06-12) ## About this release From 9eed7f9de52949510e27e8056eeec96c3a863677 Mon Sep 17 00:00:00 2001 From: hansemannn Date: Mon, 12 Aug 2024 00:06:43 +0000 Subject: [PATCH 16/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1aeaff191fa..8a8daa39497 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldWillie Kwok +Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn Gould ## Features From f3e5a0bd90eb75dfa7ec0c5e6a4b4cc39ac4b95a Mon Sep 17 00:00:00 2001 From: Chris Barber Date: Thu, 15 Aug 2024 09:01:01 -0500 Subject: [PATCH 17/88] fix: sdk build on windows needs shell: true to run batch files (#14095) --- build/lib/android/index.js | 6 +++++- build/lib/docs.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build/lib/android/index.js b/build/lib/android/index.js index 5e6a731b2ba..7da8a8faa16 100644 --- a/build/lib/android/index.js +++ b/build/lib/android/index.js @@ -173,7 +173,11 @@ class Android { async function gradlew(args) { await new Promise((resolve, reject) => { - const childProcess = spawn(GRADLEW_FILE_PATH, args, { cwd: TITANIUM_ANDROID_PATH, stdio: 'inherit' }); + const childProcess = spawn(GRADLEW_FILE_PATH, args, { + cwd: TITANIUM_ANDROID_PATH, + shell: process.platform === 'win32', + stdio: 'inherit' + }); childProcess.on('error', reject); childProcess.on('exit', (exitCode) => { if (exitCode === 0) { diff --git a/build/lib/docs.js b/build/lib/docs.js index 6b10a836e11..67e054a4533 100644 --- a/build/lib/docs.js +++ b/build/lib/docs.js @@ -23,7 +23,10 @@ class Documentation { const outputFile = path.join(this.outputDir, filename); return new Promise((resolve, reject) => { - const prc = spawn(cmdPath, args, { cwd: DOC_DIR }); + const prc = spawn(cmdPath, args, { + cwd: DOC_DIR, + shell: process.platform === 'win32' + }); prc.stdout.on('data', data => console.log(data.toString().trim())); prc.stderr.on('data', data => console.error(data.toString().trim())); prc.on('close', code => { From b0e14c65fbd7447615fc92722014bf7bfa212584 Mon Sep 17 00:00:00 2001 From: hansemannn Date: Fri, 16 Aug 2024 00:06:10 +0000 Subject: [PATCH 18/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a8daa39497..8f761235fa5 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn Gould +Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto ## Features From 017c0524dc1a76527a8ba342964ea881633492d5 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 15:08:15 +0200 Subject: [PATCH 19/88] fix(android): fix titleAttribute when it's not a creation parameter (#14090) --- .../src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java b/android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java index a7546b6ab63..237924bbb95 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java +++ b/android/titanium/src/java/org/appcelerator/titanium/proxy/TiWindowProxy.java @@ -51,6 +51,7 @@ TiC.PROPERTY_ON_BACK, TiC.PROPERTY_TITLE, TiC.PROPERTY_TITLEID, + TiC.PROPERTY_TITLE_ATTRIBUTES, TiC.PROPERTY_WINDOW_SOFT_INPUT_MODE }) public abstract class TiWindowProxy extends TiViewProxy From 51be36662445ad4755438a7f1b511a837196df69 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 15:08:42 +0200 Subject: [PATCH 20/88] fix(android): keep Tab tintColor when changing icons (#14080) * fix(android): keep Tab tintColor when changing icons * Update TiUIBottomNavigationTabGroup.java --- .../ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java | 1 + .../titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java | 1 + 2 files changed, 2 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java index f63c4790757..1ead9f66615 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUIBottomNavigationTabGroup.java @@ -501,6 +501,7 @@ public void updateTabIcon(int index) final Drawable drawable = TiUIHelper.getResourceDrawable(tabProxy.getProperty(TiC.PROPERTY_ICON)); this.mBottomNavigationView.getMenu().getItem(index).setIcon(drawable); + updateIconTint(); } @Override diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java index 4023d321162..a4d35f234a3 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java @@ -361,6 +361,7 @@ public void updateTabIcon(int index) TabLayout.Tab tab = this.mTabLayout.getTabAt(index); tab.setIcon(TiUIHelper.getResourceDrawable(tabProxy.getProperty(TiC.PROPERTY_ICON))); scaleIconToFit(tab); + updateIconTint(); } @Override From 803bd04350df89f2197842d110ad3c0384a97c7f Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 15:09:19 +0200 Subject: [PATCH 21/88] fix(android): fix Actionbar backgroundImage doc and improve setter (#14044) --- .../appcelerator/titanium/proxy/ActionBarProxy.java | 12 ++++++++++++ apidoc/Titanium/Android/ActionBar.yml | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java b/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java index 988e87c6746..3d29ce309e2 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java +++ b/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java @@ -15,6 +15,7 @@ import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.util.TiConvert; import org.appcelerator.titanium.util.TiUIHelper; +import org.appcelerator.titanium.view.TiDrawableReference; @SuppressWarnings("deprecation") @Kroll.proxy(propertyAccessors = { TiC.PROPERTY_ON_HOME_ICON_ITEM_SELECTED, TiC.PROPERTY_CUSTOM_VIEW }) @@ -102,6 +103,17 @@ public void setBackgroundImage(String url) actionBar.setDisplayShowTitleEnabled(showTitleEnabled); actionBar.setBackgroundDrawable(backgroundImage); + } else { + // fallback check with TiDrawableReference + TiDrawableReference source = TiDrawableReference.fromUrl(this, url); + if (source.getDrawable() != null) { + actionBar.setDisplayShowTitleEnabled(!showTitleEnabled); + actionBar.setDisplayShowTitleEnabled(showTitleEnabled); + actionBar.setBackgroundDrawable(source.getDrawable()); + } else { + // fail - show error + Log.e(TAG, "Image " + url + " not found"); + } } } diff --git a/apidoc/Titanium/Android/ActionBar.yml b/apidoc/Titanium/Android/ActionBar.yml index 2450257cbde..db9f36e9bb5 100644 --- a/apidoc/Titanium/Android/ActionBar.yml +++ b/apidoc/Titanium/Android/ActionBar.yml @@ -55,6 +55,15 @@ examples: ``` + + `app/controllers/index.js`: + ``` + function doMenuClick() {} + function openSettings() {} + function doSearch() {} + $.index.open(); + ``` + `app/styles/index.tss`: ``` "MenuItem": { @@ -85,7 +94,7 @@ examples: win.activity.onCreate = () => { const actionBar = win.activity.actionBar; if (actionBar) { - actionBar.backgroundImage = "/bg.png"; + actionBar.backgroundImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'bg.png').nativePath; actionBar.title = "New Title"; actionBar.onHomeIconItemSelected = () => { Ti.API.info("Home icon clicked!"); From 5fc81f08bdb3f9ba64d9cb4972848c8523f2d190 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 16:03:11 +0200 Subject: [PATCH 22/88] feat(android): set targetSDK to Android 34 (#14068) --- android/app/build.gradle | 2 +- android/titanium/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 22de0c84364..f9ee6f9cdb1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index d92e05cf820..4288d2e211b 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -44,7 +44,7 @@ android { compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionName tiBuildVersionString versionCode tiBuildVersionCode buildConfigField('int', 'VERSION_CODE', tiBuildVersionCode.toString()) From 2e92f1ddd00b9610ff9a6fc14775545b7cdf089e Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 17:32:38 +0200 Subject: [PATCH 23/88] fix(android): fix tintColor and activeTintColor in a TabbedBar (#14088) * fix(android): fix tintColor and activeTintColor in a TabbedBar * apidocs * use method and add guards * more functions --------- Co-authored-by: Chris Barber --- .../titanium/ui/widget/TiUITabbedBar.java | 26 +++++++++++++++++-- apidoc/Titanium/UI/TabbedBar.yml | 8 +++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java index 0486e21cd6e..8ca71d59e4b 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java @@ -10,6 +10,7 @@ import android.content.Context; import android.content.res.Configuration; import android.graphics.Color; +import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.view.MenuItem; import androidx.annotation.ColorInt; @@ -133,9 +134,11 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) // no selected color specified but a text color -> use that selectedTextColor = textColor; } - this.tabLayout.setTabTextColors(textColor, selectedTextColor); } + if (getProxy().hasPropertyAndNotNull(TiC.PROPERTY_ACTIVE_TINT_COLOR)) { + setTintColor(this.tabLayout.getTabAt(0), TiC.PROPERTY_ACTIVE_TINT_COLOR); + } setNativeView(this.tabLayout); } @@ -261,6 +264,10 @@ private void addItem(Object value) if (value instanceof Drawable) { tab.setIcon(((Drawable) value)); TiUITabLayoutTabGroup.scaleIconToFit(tab); + + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_TINT_COLOR)) { + setTintColor(tab, TiC.PROPERTY_TINT_COLOR); + } } else { tab.setText(value.toString()); } @@ -282,6 +289,14 @@ private void addItem(Object value) } } + private void setTintColor(TabLayout.Tab tab, String color) + { + if (tab != null && tab.getIcon() != null) { + tab.getIcon().setColorFilter(TiConvert.toColor(proxy.getProperty(color), + TiApplication.getAppCurrentActivity()), PorterDuff.Mode.SRC_IN); + } + } + // Handle switching styles after creation public void setNewStyle(int newStyle) { @@ -394,6 +409,10 @@ private void onTabIndexChangedTo(int index) // First, update the proxy's "index" property. proxy.setProperty(TiC.PROPERTY_INDEX, index); + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_ACTIVE_TINT_COLOR)) { + setTintColor(this.tabLayout.getTabAt(index), TiC.PROPERTY_ACTIVE_TINT_COLOR); + } + // Last, fire a "click" event. if (!skipClickEvent) { KrollDict data = new KrollDict(); @@ -406,7 +425,10 @@ private void onTabIndexChangedTo(int index) @Override public void onTabUnselected(TabLayout.Tab tab) { - // No override + // set old tint color again + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_TINT_COLOR)) { + setTintColor(tab, TiC.PROPERTY_TINT_COLOR); + } } @Override diff --git a/apidoc/Titanium/UI/TabbedBar.yml b/apidoc/Titanium/UI/TabbedBar.yml index 0e846c3b578..6857a5eda60 100644 --- a/apidoc/Titanium/UI/TabbedBar.yml +++ b/apidoc/Titanium/UI/TabbedBar.yml @@ -56,6 +56,12 @@ properties: availability: creation platforms: [iphone, ipad, android, macos] since: {iphone: "9.0.0", ipad: "9.0.0", android: "12.0.0"} + - name: activeTintColor + summary: Icon tint color of the selected tab + type: [ String, Titanium.UI.Color ] + availability: creation + platforms: [android] + since: {android: "12.5.0"} - name: style summary: Style of the tabbed bar. description: | @@ -66,7 +72,7 @@ properties: The `BAR` style specifies a more compact style and allows the bar's background color or gradient to show through. - + For Android use [Titanium.UI.TABS_STYLE_DEFAULT](Titanium.UI.TABS_STYLE_DEFAULT) or [Titanium.UI.TABS_STYLE_BOTTOM_NAVIGATION](Titanium.UI.TABS_STYLE_BOTTOM_NAVIGATION) and it is only supported in the creation dictionary of the proxy. From 8846f07955e0157ff134c122bd544f66c2fdb501 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 18:10:56 +0200 Subject: [PATCH 24/88] chore(android): update cmake, checkstyle (#13966) Co-authored-by: Chris Barber --- android/build.gradle | 2 +- .../titanium/contacts/PersonProxy.java | 37 ++-- .../titanium/media/VideoPlayerProxy.java | 52 ++--- .../modules/titanium/network/CookieProxy.java | 17 +- .../titanium/network/HTTPClientProxy.java | 36 ++-- .../titanium/ui/ActivityIndicatorProxy.java | 7 +- .../modules/titanium/ui/AlertDialogProxy.java | 8 +- .../modules/titanium/ui/AnimationProxy.java | 2 +- .../ti/modules/titanium/ui/ButtonProxy.java | 5 +- .../modules/titanium/ui/EmailDialogProxy.java | 38 ++-- .../modules/titanium/ui/ImageViewProxy.java | 16 +- .../ti/modules/titanium/ui/LabelProxy.java | 5 +- .../modules/titanium/ui/MaskedImageProxy.java | 4 +- .../titanium/ui/OptionDialogProxy.java | 6 +- .../titanium/ui/PickerColumnProxy.java | 14 +- .../ti/modules/titanium/ui/PickerProxy.java | 98 +++++----- .../modules/titanium/ui/ProgressBarProxy.java | 5 +- .../titanium/ui/RefreshControlProxy.java | 129 +++++++------ .../modules/titanium/ui/ScrollViewProxy.java | 22 ++- .../titanium/ui/ScrollableViewProxy.java | 41 ++-- .../modules/titanium/ui/SearchBarProxy.java | 11 +- .../ti/modules/titanium/ui/SliderProxy.java | 5 +- .../ti/modules/titanium/ui/SwitchProxy.java | 6 +- .../ti/modules/titanium/ui/TabGroupProxy.java | 50 +++-- .../ti/modules/titanium/ui/TextAreaProxy.java | 5 +- .../modules/titanium/ui/TextFieldProxy.java | 5 +- .../ti/modules/titanium/ui/TiDialogProxy.java | 9 +- .../ti/modules/titanium/ui/ToolbarProxy.java | 8 +- .../ti/modules/titanium/ui/WebViewProxy.java | 178 +++++++++--------- .../ti/modules/titanium/ui/WindowProxy.java | 100 +++++----- .../titanium/ui/android/CardViewProxy.java | 5 +- .../ui/android/ProgressIndicatorProxy.java | 5 +- .../titanium/ui/android/SearchViewProxy.java | 5 +- android/package.json | 4 +- android/runtime/v8/src/native/CMakeLists.txt | 2 +- android/titanium/build.gradle | 2 +- .../titanium/proxy/ActionBarProxy.java | 70 +++---- .../titanium/util/TiNinePatchHelper.java | 20 +- .../java/ti/modules/titanium/BufferProxy.java | 14 +- 39 files changed, 547 insertions(+), 501 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 580edafef28..319eec9c71a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 diff --git a/android/modules/contacts/src/java/ti/modules/titanium/contacts/PersonProxy.java b/android/modules/contacts/src/java/ti/modules/titanium/contacts/PersonProxy.java index 5b21d6648f4..b681ce02485 100644 --- a/android/modules/contacts/src/java/ti/modules/titanium/contacts/PersonProxy.java +++ b/android/modules/contacts/src/java/ti/modules/titanium/contacts/PersonProxy.java @@ -7,9 +7,8 @@ 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; @@ -17,8 +16,9 @@ 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 = { @@ -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 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 modified = new HashMap<>(); - public PersonProxy() { super(); @@ -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); } diff --git a/android/modules/media/src/java/ti/modules/titanium/media/VideoPlayerProxy.java b/android/modules/media/src/java/ti/modules/titanium/media/VideoPlayerProxy.java index f7fd67028c4..34185dcf79c 100644 --- a/android/modules/media/src/java/ti/modules/titanium/media/VideoPlayerProxy.java +++ b/android/modules/media/src/java/ti/modules/titanium/media/VideoPlayerProxy.java @@ -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; @@ -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 = { @@ -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; @@ -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; @@ -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. */ // @@ -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) { @@ -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); } @@ -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)); } } @@ -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) { diff --git a/android/modules/network/src/java/ti/modules/titanium/network/CookieProxy.java b/android/modules/network/src/java/ti/modules/titanium/network/CookieProxy.java index 1862fdc3d15..d7f8b4084b2 100644 --- a/android/modules/network/src/java/ti/modules/titanium/network/CookieProxy.java +++ b/android/modules/network/src/java/ti/modules/titanium/network/CookieProxy.java @@ -7,10 +7,6 @@ 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; @@ -18,6 +14,10 @@ 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, @@ -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); @@ -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()); diff --git a/android/modules/network/src/java/ti/modules/titanium/network/HTTPClientProxy.java b/android/modules/network/src/java/ti/modules/titanium/network/HTTPClientProxy.java index cceab6df10d..397ccf9d2e6 100644 --- a/android/modules/network/src/java/ti/modules/titanium/network/HTTPClientProxy.java +++ b/android/modules/network/src/java/ti/modules/titanium/network/HTTPClientProxy.java @@ -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; @@ -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 = { @@ -26,7 +27,7 @@ TiC.PROPERTY_ONERROR, TiC.PROPERTY_ONREADYSTATECHANGE, TiC.PROPERTY_ONDATASTREAM -}) + }) public class HTTPClientProxy extends KrollProxy { @Kroll.constant @@ -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() @@ -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"); } } } @@ -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() { @@ -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 @@ -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 @@ -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 @@ -309,6 +303,12 @@ public int getTlsVersion() return tlsVersion; } + @Kroll.setProperty + public void setTlsVersion(int tlsVersion) + { + client.setTlsVersion(tlsVersion); + } + @Override public String getApiName() { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ActivityIndicatorProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ActivityIndicatorProxy.java index 44f8400ae49..379119eff3c 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ActivityIndicatorProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ActivityIndicatorProxy.java @@ -6,6 +6,9 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; +import android.os.Message; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -13,8 +16,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIActivityIndicator; -import android.app.Activity; -import android.os.Message; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -24,7 +25,7 @@ TiC.PROPERTY_FONT, TiC.PROPERTY_STYLE, TiC.PROPERTY_INDICATOR_COLOR -}) + }) @Kroll.dynamicApis(methods = { "hide", "show" }) public class ActivityIndicatorProxy extends TiViewProxy { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/AlertDialogProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/AlertDialogProxy.java index 8727e95e3b2..84c38669b9e 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/AlertDialogProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/AlertDialogProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -14,7 +16,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIDialog; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -29,7 +30,7 @@ TiC.PROPERTY_OK, TiC.PROPERTY_OKID, TiC.PROPERTY_PERSISTENT -}) + }) public class AlertDialogProxy extends TiViewProxy { public AlertDialogProxy() @@ -63,7 +64,8 @@ protected void handleShow(KrollDict options) // dialog should occur above the "topmost" activity, so if activity // stack transitions are occurring, try to give them a chance to "settle" // before determining which Activity should be the context for the AlertDialog. - TiUIHelper.runUiDelayedIfBlock(new Runnable() { + TiUIHelper.runUiDelayedIfBlock(new Runnable() + { @Override public void run() { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/AnimationProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/AnimationProxy.java index cc80f1d48b0..73e03fe0c84 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/AnimationProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/AnimationProxy.java @@ -27,7 +27,7 @@ TiC.PROPERTY_WIDTH, TiC.PROPERTY_HEIGHT, TiC.PROPERTY_BACKGROUND_COLOR -}) + }) public class AnimationProxy extends TiAnimation { @Override diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ButtonProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ButtonProxy.java index 5b64456d758..7be131fa2c6 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ButtonProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ButtonProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -13,7 +15,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIButton; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -30,7 +31,7 @@ TiC.PROPERTY_SHADOW_COLOR, TiC.PROPERTY_SHADOW_RADIUS, TiC.PROPERTY_TINT_COLOR -}) + }) public class ButtonProxy extends TiViewProxy { public ButtonProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/EmailDialogProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/EmailDialogProxy.java index 34e53a758af..4dab5f3abb2 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/EmailDialogProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/EmailDialogProxy.java @@ -6,17 +6,21 @@ */ package ti.modules.titanium.ui; -import java.io.File; -import java.util.ArrayList; -import java.util.List; +import android.app.Activity; +import android.content.ClipData; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.text.Html; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.kroll.common.Log; -import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.TiApplication.ActivityTransitionListener; import org.appcelerator.titanium.TiBlob; +import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.io.TiBaseFile; import org.appcelerator.titanium.io.TiFile; import org.appcelerator.titanium.io.TiFileFactory; @@ -29,14 +33,11 @@ import org.appcelerator.titanium.util.TiMimeTypeHelper; import org.appcelerator.titanium.view.TiUIView; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + import ti.modules.titanium.filesystem.FileProxy; -import android.app.Activity; -import android.content.ClipData; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.text.Html; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -46,12 +47,10 @@ "messageBody", "subject", "toRecipients" -}) + }) public class EmailDialogProxy extends TiViewProxy implements ActivityTransitionListener { - private static final String TAG = "EmailDialogProxy"; - @Kroll.constant public static final int CANCELLED = 0; @Kroll.constant @@ -60,7 +59,7 @@ public class EmailDialogProxy extends TiViewProxy implements ActivityTransitionL public static final int SENT = 2; @Kroll.constant public static final int FAILED = 3; - + private static final String TAG = "EmailDialogProxy"; private ArrayList attachments; private String privateDataDirectoryPath = null; @@ -103,9 +102,9 @@ public void addAttachment(Object attachment) } else { // silently ignore? Log.d(TAG, - "addAttachment for type " + attachment.getClass().getName() - + " ignored. Only files and blobs may be attached.", - Log.DEBUG_MODE); + "addAttachment for type " + attachment.getClass().getName() + + " ignored. Only files and blobs may be attached.", + Log.DEBUG_MODE); } } @@ -149,7 +148,8 @@ public void doOpen() TiActivitySupport activitySupport = (TiActivitySupport) activity; final int code = activitySupport.getUniqueResultCode(); - activitySupport.launchActivityForResult(choosingIntent, code, new TiActivityResultHandler() { + activitySupport.launchActivityForResult(choosingIntent, code, new TiActivityResultHandler() + { @Override public void onResult(Activity activity, int requestCode, int resultCode, Intent data) { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ImageViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ImageViewProxy.java index b1546041d2d..41419f4a825 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ImageViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ImageViewProxy.java @@ -7,10 +7,12 @@ package ti.modules.titanium.ui; import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiBlob; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.view.TiUIView; + import ti.modules.titanium.media.MediaModule; import ti.modules.titanium.ui.widget.TiUIImageView; @@ -27,7 +29,7 @@ TiC.PROPERTY_IMAGES, TiC.PROPERTY_REPEAT_COUNT, TiC.PROPERTY_SCALING_MODE -}) + }) public class ImageViewProxy extends ViewProxy { public ImageViewProxy() @@ -108,18 +110,18 @@ public TiBlob toBlob() return getImageView().toBlob(); } - @Kroll.setProperty(runOnUiThread = true) - public void setTintColor(String color) - { - getImageView().setTintColor(color); - } - @Kroll.getProperty public int getTintColor() { return getImageView().getTintColor(); } + @Kroll.setProperty(runOnUiThread = true) + public void setTintColor(String color) + { + getImageView().setTintColor(color); + } + @Override public String getApiName() { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/LabelProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/LabelProxy.java index 61e2ab2d739..a2cb6669b01 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/LabelProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/LabelProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -13,7 +15,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUILabel; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -38,7 +39,7 @@ TiC.PROPERTY_MINIMUM_FONT_SIZE, TiC.PROPERTY_BREAK_STRATEGY, TiC.PROPERTY_HYPHENATION_FREQUENCY -}) + }) public class LabelProxy extends TiViewProxy { private static final String TAG = "LabelProxy"; diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/MaskedImageProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/MaskedImageProxy.java index 1194e53aef8..40600c13a93 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/MaskedImageProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/MaskedImageProxy.java @@ -7,9 +7,11 @@ package ti.modules.titanium.ui; import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.view.TiUIView; + import ti.modules.titanium.ui.widget.TiUIMaskedImage; @Kroll.proxy(creatableInModule = UIModule.class, @@ -19,7 +21,7 @@ TiC.PROPERTY_MODE, TiC.PROPERTY_TINT, TiC.PROPERTY_TINT_COLOR -}) + }) public class MaskedImageProxy extends ViewProxy { public MaskedImageProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/OptionDialogProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/OptionDialogProxy.java index 02dba5586cb..da9391fd199 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/OptionDialogProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/OptionDialogProxy.java @@ -6,13 +6,15 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIDialog; -import android.app.Activity; + @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_ANDROID_VIEW, @@ -22,7 +24,7 @@ TiC.PROPERTY_TITLE, TiC.PROPERTY_TITLEID, TiC.PROPERTY_PERSISTENT -}) + }) public class OptionDialogProxy extends TiDialogProxy { public OptionDialogProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/PickerColumnProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/PickerColumnProxy.java index a0333188283..df6f2bd18f0 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/PickerColumnProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/PickerColumnProxy.java @@ -7,22 +7,20 @@ package ti.modules.titanium.ui; import android.util.Log; -import java.util.ArrayList; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; +import java.util.ArrayList; + @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_WIDTH, -}) + }) public class PickerColumnProxy extends KrollProxy implements PickerRowProxy.OnChangedListener { - public interface OnChangedListener { - void onChanged(PickerColumnProxy proxy); - } - private static final String TAG = "PickerColumnProxy"; private final ArrayList rowList = new ArrayList<>(); private final ArrayList listeners = new ArrayList<>(); @@ -222,4 +220,8 @@ public String getApiName() { return "Ti.UI.PickerColumn"; } + + public interface OnChangedListener { + void onChanged(PickerColumnProxy proxy); + } } diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/PickerProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/PickerProxy.java index 7bbaaca3649..d2536898cfc 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/PickerProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/PickerProxy.java @@ -6,31 +6,6 @@ */ package ti.modules.titanium.ui; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.TimeZone; -import java.util.concurrent.atomic.AtomicInteger; - -import org.appcelerator.kroll.KrollDict; -import org.appcelerator.kroll.KrollFunction; -import org.appcelerator.kroll.annotations.Kroll; -import org.appcelerator.titanium.R; -import org.appcelerator.titanium.TiApplication; -import org.appcelerator.titanium.TiC; -import org.appcelerator.titanium.TiDimension; -import org.appcelerator.titanium.proxy.TiViewProxy; -import org.appcelerator.titanium.util.TiConvert; -import org.appcelerator.titanium.util.TiUIHelper; -import org.appcelerator.titanium.view.TiUIView; - -import ti.modules.titanium.ui.widget.picker.TiUIDatePicker; -import ti.modules.titanium.ui.widget.picker.TiUIPlainDropDownPicker; -import ti.modules.titanium.ui.widget.picker.TiUIPlainPicker; -import ti.modules.titanium.ui.widget.picker.TiUIPlainSpinnerPicker; -import ti.modules.titanium.ui.widget.picker.TiUITimePicker; - import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Color; @@ -56,6 +31,31 @@ import com.google.android.material.timepicker.MaterialTimePicker; import com.google.android.material.timepicker.TimeFormat; +import org.appcelerator.kroll.KrollDict; +import org.appcelerator.kroll.KrollFunction; +import org.appcelerator.kroll.annotations.Kroll; +import org.appcelerator.titanium.R; +import org.appcelerator.titanium.TiApplication; +import org.appcelerator.titanium.TiC; +import org.appcelerator.titanium.TiDimension; +import org.appcelerator.titanium.proxy.TiViewProxy; +import org.appcelerator.titanium.util.TiConvert; +import org.appcelerator.titanium.util.TiUIHelper; +import org.appcelerator.titanium.view.TiUIView; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.TimeZone; +import java.util.concurrent.atomic.AtomicInteger; + +import ti.modules.titanium.ui.widget.picker.TiUIDatePicker; +import ti.modules.titanium.ui.widget.picker.TiUIPlainDropDownPicker; +import ti.modules.titanium.ui.widget.picker.TiUIPlainPicker; +import ti.modules.titanium.ui.widget.picker.TiUIPlainSpinnerPicker; +import ti.modules.titanium.ui.widget.picker.TiUITimePicker; + @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_CALENDAR_VIEW_SHOWN, @@ -66,13 +66,13 @@ TiC.PROPERTY_MAX_DATE, TiC.PROPERTY_SELECTION_OPENS, TiC.PROPERTY_VALUE -}) + }) public class PickerProxy extends TiViewProxy implements PickerColumnProxy.OnChangedListener { private static final String TAG = "PickerProxy"; - private int type = UIModule.PICKER_TYPE_PLAIN; private final ArrayList columnList = new ArrayList<>(); private final ArrayList selectedRows = new ArrayList<>(); + private int type = UIModule.PICKER_TYPE_PLAIN; private boolean useSpinner = false; private boolean canFireColumnEvents = true; @@ -83,6 +83,26 @@ public PickerProxy() defaultValues.put(TiC.PROPERTY_DATE_PICKER_STYLE, UIModule.DATE_PICKER_STYLE_AUTOMATIC); } + /** + * Trim hour, minute, second and millisecond from the date + * + * @param inDate input date + * @return return the trimmed date + */ + private static Date createDateWithoutTime(Date inDate) + { + if (inDate == null) { + return null; + } + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); + cal.setTime(inDate); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + return cal.getTime(); + } + @Override public void handleCreationDict(KrollDict dict) { @@ -187,17 +207,20 @@ public TextInputLayout createTextInputLayout() editText.setSingleLine(); editText.setMaxLines(1); editText.setGravity(Gravity.CENTER_VERTICAL | Gravity.START); - editText.setKeyListener(new BaseKeyListener() { + editText.setKeyListener(new BaseKeyListener() + { @Override public int getInputType() { return InputType.TYPE_NULL; } + @Override public boolean backspace(View view, Editable content, int keyCode, KeyEvent event) { return false; } + @Override public boolean forwardDelete(View view, Editable content, int keyCode, KeyEvent event) { @@ -635,25 +658,6 @@ public void showDatePickerDialog(Object[] args) picker.show(appCompatActivity.getSupportFragmentManager(), picker.toString()); } - /** - * Trim hour, minute, second and millisecond from the date - * @param inDate input date - * @return return the trimmed date - */ - private static Date createDateWithoutTime(Date inDate) - { - if (inDate == null) { - return null; - } - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - cal.setTime(inDate); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - return cal.getTime(); - } - // This is meant to be a kind of "static" method, in the sense that // it doesn't use any state except for context. It's a quick hit way // of getting a date dialog up, in other words. diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ProgressBarProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ProgressBarProxy.java index aeaaed67488..b6b0a5f4346 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ProgressBarProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ProgressBarProxy.java @@ -6,13 +6,14 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIProgressBar; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -24,7 +25,7 @@ TiC.PROPERTY_COLOR, TiC.PROPERTY_TINT_COLOR, TiC.PROPERTY_TRACK_TINT_COLOR, -}) + }) public class ProgressBarProxy extends TiViewProxy { public ProgressBarProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/RefreshControlProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/RefreshControlProxy.java index 67a5141eb77..f4a8fd62783 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/RefreshControlProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/RefreshControlProxy.java @@ -7,23 +7,28 @@ package ti.modules.titanium.ui; import android.graphics.Color; -import java.util.HashSet; -import org.appcelerator.kroll.annotations.Kroll; -import org.appcelerator.kroll.common.Log; + 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.TiColorHelper; + +import java.util.HashSet; + import ti.modules.titanium.ui.widget.TiSwipeRefreshLayout; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_TINT_COLOR, TiC.PROPERTY_TITLE, -}) + }) public class RefreshControlProxy extends KrollProxy { - /** The default Android log tag name to be used by this class. */ + /** + * The default Android log tag name to be used by this class. + */ private static final String TAG = "RefreshControlProxy"; /** @@ -39,7 +44,9 @@ public class RefreshControlProxy extends KrollProxy */ private static final HashSet assignedControls = new HashSet<>(); - /** Color integer value to be applied to the refresh layout's progress indicator. */ + /** + * Color integer value to be applied to the refresh layout's progress indicator. + */ private int tintColor = DEFAULT_TINT_COLOR; /** @@ -48,14 +55,55 @@ public class RefreshControlProxy extends KrollProxy */ private TiSwipeRefreshLayout swipeRefreshLayout; - /** Creates a new Titanium "RefreshControl" proxy binding. */ + /** + * Creates a new Titanium "RefreshControl" proxy binding. + */ public RefreshControlProxy() { super(); } + /** + * Unassigns the given view from a RefreshControlProxy instance that was once assigned to + * it via the assignTo() method. A view is expected to call this method when removed from the + * window or to disable pull-down refresh support. + * + * @param view The view to be unassigned from a refresh control, if currently assigned. Can be null. + */ + public static void unassignFrom(TiSwipeRefreshLayout view) + { + // Validate argument. + if (view == null) { + return; + } + + // Attempt to find a refresh control that is currently assigned to the given view. + RefreshControlProxy proxy = null; + for (RefreshControlProxy nextProxy : RefreshControlProxy.assignedControls) { + if ((nextProxy != null) && (nextProxy.swipeRefreshLayout == view)) { + proxy = nextProxy; + break; + } + } + if (proxy == null) { + return; + } + + // Remove the refresh event listener. + proxy.swipeRefreshLayout.setOnRefreshListener(null); + + // Disable pull-down refresh support. + proxy.endRefreshing(); + proxy.swipeRefreshLayout.setSwipeRefreshEnabled(false); + + // Unassign the view from the refresh control. + RefreshControlProxy.assignedControls.remove(proxy); + proxy.swipeRefreshLayout = null; + } + /** * Fetches the JavaScript type name of this proxy object. + * * @return Returns the unique type name of this proxy object. */ @Override @@ -69,6 +117,7 @@ public String getApiName() *

* Expected to be called on the runtime thread when the * JavaScript Ti.UI.createRefreshControl() function has been invoked. + * * @param properties Dictionary of property settings. */ @Override @@ -94,7 +143,8 @@ public void handleCreationDict(KrollDict properties) /** * Called when a single property setting has been changed. * Expected to be called on the JavaScript runtime thread. - * @param name The unique name of the property that was changed. + * + * @param name The unique name of the property that was changed. * @param value The property new value. Can be null. */ @Override @@ -116,9 +166,9 @@ public void onPropertyChanged(String name, Object value) /** * Stores the given tint color value to be applied to the refresh progress indicator. - * @param colorName - * The color value to be applied. Expected to be a string such as "red", "blue", "#00FF00", etc. - * Can be null, in which case, the progress indicator will revert back to its default color. + * + * @param colorName The color value to be applied. Expected to be a string such as "red", "blue", "#00FF00", etc. + * Can be null, in which case, the progress indicator will revert back to its default color. */ private void onTintColorChanged(Object colorName) { @@ -141,7 +191,9 @@ private void onTintColorChanged(Object colorName) this.swipeRefreshLayout.setColorSchemeColors(tintColor); } - /** Displays the refresh progress indicator if a SwipeRefreshLayout is currently assigned. */ + /** + * Displays the refresh progress indicator if a SwipeRefreshLayout is currently assigned. + */ @Kroll.method public void beginRefreshing() { @@ -162,7 +214,9 @@ public void beginRefreshing() fireEvent(TiC.EVENT_REFRESH_START, null); } - /** Hides the refresh progress indicator if a SwipeRefreshLayout is currently assigned. */ + /** + * Hides the refresh progress indicator if a SwipeRefreshLayout is currently assigned. + */ @Kroll.method public void endRefreshing() { @@ -195,10 +249,10 @@ public void endRefreshing() *

* If this refresh control is currently assigned to another view, then it will be automatically * unassigned from the previous view before being assigned the given view. - * @param view - * The view to be assigned to this refresh control. - *

- * Can be null, in which case, this method will do nothing. + * + * @param view The view to be assigned to this refresh control. + *

+ * Can be null, in which case, this method will do nothing. */ public void assignTo(TiSwipeRefreshLayout view) { @@ -222,7 +276,8 @@ public void assignTo(TiSwipeRefreshLayout view) // Set up the given view for pull-down refresh support. view.setColorSchemeColors(this.tintColor); view.setSwipeRefreshEnabled(true); - view.setOnRefreshListener(new TiSwipeRefreshLayout.OnRefreshListener() { + view.setOnRefreshListener(new TiSwipeRefreshLayout.OnRefreshListener() + { @Override public void onRefresh() { @@ -232,42 +287,4 @@ public void onRefresh() } }); } - - /** - * Unassigns the given view from a RefreshControlProxy instance that was once assigned to - * it via the assignTo() method. A view is expected to call this method when removed from the - * window or to disable pull-down refresh support. - * @param view - * The view to be unassigned from a refresh control, if currently assigned. Can be null. - */ - public static void unassignFrom(TiSwipeRefreshLayout view) - { - // Validate argument. - if (view == null) { - return; - } - - // Attempt to find a refresh control that is currently assigned to the given view. - RefreshControlProxy proxy = null; - for (RefreshControlProxy nextProxy : RefreshControlProxy.assignedControls) { - if ((nextProxy != null) && (nextProxy.swipeRefreshLayout == view)) { - proxy = nextProxy; - break; - } - } - if (proxy == null) { - return; - } - - // Remove the refresh event listener. - proxy.swipeRefreshLayout.setOnRefreshListener(null); - - // Disable pull-down refresh support. - proxy.endRefreshing(); - proxy.swipeRefreshLayout.setSwipeRefreshEnabled(false); - - // Unassign the view from the refresh control. - RefreshControlProxy.assignedControls.remove(proxy); - proxy.swipeRefreshLayout = null; - } } diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollViewProxy.java index d8a48cd4f0b..81ee8644f2d 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollViewProxy.java @@ -6,17 +6,19 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; -import org.appcelerator.titanium.view.TiUIView; import org.appcelerator.titanium.util.TiConvert; +import org.appcelerator.titanium.view.TiUIView; -import ti.modules.titanium.ui.widget.TiUIScrollView; -import android.app.Activity; import java.util.HashMap; +import ti.modules.titanium.ui.widget.TiUIScrollView; + @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_CONTENT_HEIGHT, @@ -28,7 +30,7 @@ TiC.PROPERTY_CAN_CANCEL_EVENTS, TiC.PROPERTY_OVER_SCROLL_MODE, TiC.PROPERTY_REFRESH_CONTROL -}) + }) public class ScrollViewProxy extends TiViewProxy { private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1; @@ -65,18 +67,18 @@ public void scrollTo(int x, int y, @Kroll.argument(optional = true) HashMap args handleScrollTo(x, y, animated); } - @Kroll.setProperty - public void setScrollingEnabled(Object enabled) - { - getScrollView().setScrollingEnabled(enabled); - } - @Kroll.getProperty public boolean getScrollingEnabled() { return getScrollView().getScrollingEnabled(); } + @Kroll.setProperty + public void setScrollingEnabled(Object enabled) + { + getScrollView().setScrollingEnabled(enabled); + } + @Kroll.method public void scrollToBottom() { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollableViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollableViewProxy.java index 0f0ab6a1925..b3ab5c08940 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollableViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ScrollableViewProxy.java @@ -6,9 +6,8 @@ */ package ti.modules.titanium.ui; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; +import android.app.Activity; +import android.os.Message; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; @@ -17,9 +16,11 @@ import org.appcelerator.titanium.util.TiConvert; import org.appcelerator.titanium.view.TiUIView; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + import ti.modules.titanium.ui.widget.TiUIScrollableView; -import android.app.Activity; -import android.os.Message; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -28,11 +29,11 @@ TiC.PROPERTY_PADDING, TiC.PROPERTY_SHOW_PAGING_CONTROL, TiC.PROPERTY_OVER_SCROLL_MODE -}) + }) public class ScrollableViewProxy extends TiViewProxy { + public static final int MIN_CACHE_SIZE = 3; private static final String TAG = "TiScrollableView"; - private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1; public static final int MSG_HIDE_PAGER = MSG_FIRST_ID + 101; public static final int MSG_MOVE_PREV = MSG_FIRST_ID + 102; @@ -41,12 +42,9 @@ public class ScrollableViewProxy extends TiViewProxy public static final int MSG_SET_CURRENT = MSG_FIRST_ID + 107; public static final int MSG_SET_ENABLED = MSG_FIRST_ID + 109; public static final int MSG_LAST_ID = MSG_FIRST_ID + 999; - private static final int DEFAULT_PAGING_CONTROL_TIMEOUT = 3000; - public static final int MIN_CACHE_SIZE = 3; - protected AtomicBoolean inScroll; - private List views = new ArrayList<>(); + private final List views = new ArrayList<>(); private TiUIScrollableView scrollableView; public ScrollableViewProxy() @@ -351,6 +349,13 @@ public void fireScroll(int currentPage, float currentPageAsFloat, TiViewProxy cu } } + @Kroll.getProperty + public boolean getScrollingEnabled() + { + return (scrollableView != null) ? scrollableView.getEnabled() + : getProperties().optBoolean(TiC.PROPERTY_SCROLLING_ENABLED, true); + } + @Kroll.setProperty public void setScrollingEnabled(boolean value) { @@ -358,11 +363,12 @@ public void setScrollingEnabled(boolean value) scrollableView.setEnabled(value); } } + @Kroll.getProperty - public boolean getScrollingEnabled() + public int getCurrentPage() { - return (scrollableView != null) ? scrollableView.getEnabled() - : getProperties().optBoolean(TiC.PROPERTY_SCROLLING_ENABLED, true); + return (scrollableView != null) ? scrollableView.getCurrentPage() + : getProperties().optInt(TiC.PROPERTY_CURRENT_PAGE, 0); } @Kroll.setProperty @@ -375,13 +381,6 @@ public void setCurrentPage(int currentPage) } } - @Kroll.getProperty - public int getCurrentPage() - { - return (scrollableView != null) ? scrollableView.getCurrentPage() - : getProperties().optInt(TiC.PROPERTY_CURRENT_PAGE, 0); - } - @Override public void releaseViews() { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/SearchBarProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/SearchBarProxy.java index 59b8002414c..0bfadaae48c 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/SearchBarProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/SearchBarProxy.java @@ -1,11 +1,7 @@ -/** - * Titanium SDK - * Copyright TiDev, Inc. 04/07/2022-Present. All Rights Reserved. - * Licensed under the terms of the Apache Public License - * Please see the LICENSE included with this distribution for details. - */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -14,7 +10,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.searchbar.TiUISearchBar; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -30,7 +25,7 @@ TiC.PROPERTY_PROMPT, TiC.PROPERTY_PROMPT_ID, TiC.PROPERTY_VALUE -}) + }) public class SearchBarProxy extends TiViewProxy { public SearchBarProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/SliderProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/SliderProxy.java index d6349387c34..eff016c99ed 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/SliderProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/SliderProxy.java @@ -6,13 +6,14 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUISlider; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -27,7 +28,7 @@ TiC.PROPERTY_TINT_COLOR, TiC.PROPERTY_TRACK_TINT_COLOR, TiC.PROPERTY_VALUE -}) + }) public class SliderProxy extends TiViewProxy { public SliderProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java index 3bdcac73f38..f3758a97fa9 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/SwitchProxy.java @@ -6,12 +6,14 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; + import ti.modules.titanium.ui.widget.TiUISwitch; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -28,7 +30,7 @@ TiC.PROPERTY_VERTICAL_ALIGN, TiC.PROPERTY_ON_THUMB_COLOR, TiC.PROPERTY_THUMB_COLOR -}) + }) public class SwitchProxy extends TiViewProxy { public SwitchProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java index ce97a31f23c..0c76925eb2e 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TabGroupProxy.java @@ -6,9 +6,15 @@ */ package ti.modules.titanium.ui; -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.HashMap; +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; @@ -27,20 +33,15 @@ import org.appcelerator.titanium.util.TiRHelper; import org.appcelerator.titanium.util.TiUIHelper; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.HashMap; + import ti.modules.titanium.ui.android.AndroidModule; import ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTabGroup; import ti.modules.titanium.ui.widget.tabgroup.TiUIBottomNavigationTabGroup; import ti.modules.titanium.ui.widget.tabgroup.TiUITabLayoutTabGroup; -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; -import android.view.LayoutInflater; - @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_TABS_BACKGROUND_COLOR, @@ -49,27 +50,24 @@ TiC.PROPERTY_AUTO_TAB_TITLE, TiC.PROPERTY_EXIT_ON_CLOSE, TiC.PROPERTY_SMOOTH_SCROLL_ON_TAB_CLICK -}) + }) public class TabGroupProxy extends TiWindowProxy implements TiActivityWindow { private static final String TAG = "TabGroupProxy"; private static final String PROPERTY_POST_TAB_GROUP_CREATED = "postTabGroupCreated"; private static final int MSG_FIRST_ID = TiWindowProxy.MSG_LAST_ID + 1; - + protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; private static final int MSG_ADD_TAB = MSG_FIRST_ID + 100; private static final int MSG_REMOVE_TAB = MSG_FIRST_ID + 101; private static final int MSG_SET_ACTIVE_TAB = MSG_FIRST_ID + 102; private static final int MSG_GET_ACTIVE_TAB = MSG_FIRST_ID + 103; private static final int MSG_SET_TABS = MSG_FIRST_ID + 104; private static final int MSG_DISABLE_TAB_NAVIGATION = MSG_FIRST_ID + 105; - - protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; - - private ArrayList tabs = new ArrayList<>(); + private static int id_toolbar; + private final ArrayList tabs = new ArrayList<>(); private WeakReference tabGroupActivity = new WeakReference<>(null); private Object selectedTab; // NOTE: Can be TabProxy or Number private String tabGroupTitle = null; - private static int id_toolbar; private boolean autoTabTitle = false; public TabGroupProxy() @@ -167,12 +165,6 @@ public Object getActiveTab() } } - private TabProxy getActiveTabProxy() - { - Object activeTab = getActiveTab(); - return (activeTab != null) ? parseTab(activeTab) : null; - } - @Kroll.setProperty public void setActiveTab(Object tabOrIndex) { @@ -197,6 +189,12 @@ public void setActiveTab(Object tabOrIndex) } } + private TabProxy getActiveTabProxy() + { + Object activeTab = getActiveTab(); + return (activeTab != null) ? parseTab(activeTab) : null; + } + @Kroll.getProperty(name = "activity") public ActivityProxy _getActivity() { @@ -337,7 +335,7 @@ protected void handleOpen(KrollDict options) topActivity.startActivity(intent); topActivity.overridePendingTransition(0, 0); } else if (options.containsKey(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION) - || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { + || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { topActivity.startActivity(intent); int enterAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION), 0); int exitAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION), 0); diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java index 1661afb3a4d..d88956f5f91 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TextAreaProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; @@ -15,7 +17,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIText; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -46,7 +47,7 @@ TiC.PROPERTY_VERTICAL_ALIGN, TiC.PROPERTY_PADDING, TiC.PROPERTY_RETURN_KEY_TYPE -}) + }) public class TextAreaProxy extends TiViewProxy { public TextAreaProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java index 65b1f153690..b594c7fadbb 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TextFieldProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; @@ -15,7 +17,6 @@ import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUIText; -import android.app.Activity; @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { @@ -46,7 +47,7 @@ TiC.PROPERTY_VERTICAL_ALIGN, TiC.PROPERTY_RETURN_KEY_TYPE, TiC.PROPERTY_PADDING -}) + }) public class TextFieldProxy extends TiViewProxy { public TextFieldProxy() diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TiDialogProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TiDialogProxy.java index 0f4b3bf5f88..2fe493d11a0 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TiDialogProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TiDialogProxy.java @@ -6,14 +6,14 @@ */ package ti.modules.titanium.ui; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.kroll.common.CurrentActivityListener; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.util.TiUIHelper; -import android.app.Activity; - @Kroll.proxy(parentModule = UIModule.class, propertyAccessors = { "title", @@ -24,7 +24,7 @@ "options", "selectedIndex", "cancel" -}) + }) public abstract class TiDialogProxy extends TiViewProxy { protected boolean showing = false; @@ -38,7 +38,8 @@ public TiDialogProxy() public void show(final KrollDict options) { showing = true; - TiUIHelper.waitForCurrentActivity(new CurrentActivityListener() { + TiUIHelper.waitForCurrentActivity(new CurrentActivityListener() + { @Override public void onCurrentActivityReady(Activity activity) { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/ToolbarProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/ToolbarProxy.java index ec1cd8a6912..0599bdf2f09 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/ToolbarProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/ToolbarProxy.java @@ -1,13 +1,16 @@ package ti.modules.titanium.ui; import android.app.Activity; -import androidx.appcompat.widget.Toolbar; import android.view.View; + +import androidx.appcompat.widget.Toolbar; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiToolbarProxy; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; + import ti.modules.titanium.ui.widget.TiToolbar; @Kroll.proxy(creatableInModule = UIModule.class, @@ -26,7 +29,7 @@ TiC.PROPERTY_SUBTITLE_TEXT_COLOR, TiC.PROPERTY_CONTENT_INSET_END_WITH_ACTIONS, TiC.PROPERTY_CONTENT_INSET_START_WITH_NAVIGATION -}) + }) public class ToolbarProxy extends TiToolbarProxy { private static final java.lang.String TAG = "Toolbar"; @@ -53,6 +56,7 @@ public TiUIView createView(Activity activity) /** * Sets the activity this proxy's view should be attached to. + * * @param activity The activity this proxy's view should be attached to. */ @Override diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/WebViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/WebViewProxy.java index 8be6063b52b..d0506b36a19 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/WebViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/WebViewProxy.java @@ -56,28 +56,25 @@ TiC.PROPERTY_LIGHT_TOUCH_ENABLED, TiC.PROPERTY_ON_LINK, TiC.PROPERTY_SCROLLBARS -}) + }) + public class WebViewProxy extends ViewProxy implements Handler.Callback, OnLifecycleEvent, interceptOnBackPressedEvent { + public static final String OPTIONS_IN_SETHTML = "optionsInSetHtml"; private static final String TAG = "WebViewProxy"; private static final int MSG_FIRST_ID = ViewProxy.MSG_LAST_ID + 1; - + protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; private static final int MSG_GO_BACK = MSG_FIRST_ID + 101; private static final int MSG_GO_FORWARD = MSG_FIRST_ID + 102; private static final int MSG_RELOAD = MSG_FIRST_ID + 103; private static final int MSG_STOP_LOADING = MSG_FIRST_ID + 104; private static final int MSG_RELEASE = MSG_FIRST_ID + 110; - - protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; + private static final Map fevalJSRequests = new HashMap<>(); + private static final int frequestID = 0; private static String fusername; private static String fpassword; - private static int frequestID = 0; - private static final Map fevalJSRequests = new HashMap<>(); - - private Message postCreateMessage; PrintManager printManager; - - public static final String OPTIONS_IN_SETHTML = "optionsInSetHtml"; + private Message postCreateMessage; public WebViewProxy() { @@ -89,6 +86,15 @@ public WebViewProxy() defaultValues.put(TiC.PROPERTY_ZOOM_LEVEL, 1.0); } + private static void sendPostCreateMessage(WebView view, Message postCreateMessage) + { + WebView.WebViewTransport transport = (WebView.WebViewTransport) postCreateMessage.obj; + if (transport != null) { + transport.setWebView(view); + } + postCreateMessage.sendToTarget(); + } + @Override public TiUIView createView(Activity activity) { @@ -131,40 +137,6 @@ public Object evalJS(String code, @Kroll.argument(optional = true) KrollFunction return view.getJSValue(code); } - private static class EvalJSRunnable implements Runnable - { - private final TiUIWebView view; - private final KrollObject krollObject; - private final String code; - private final KrollFunction callback; - - public EvalJSRunnable(TiUIWebView view, KrollObject krollObject, String code, KrollFunction callback) - { - this.view = view; - this.krollObject = krollObject; - this.code = code; - this.callback = callback; - } - - public void run() - { - // Runs the "old" API we built - String result = view.getJSValue(code); - callback.callAsync(krollObject, new Object[] { result }); - } - - public void runAsync() - { - // Runs the newer API provided by Android - view.getWebView().evaluateJavascript(code, new ValueCallback() { - public void onReceiveValue(String value) - { - callback.callAsync(krollObject, new Object[] { value }); - } - }); - } - } - @Kroll.getProperty public String getHtml() { @@ -243,6 +215,16 @@ public void setBasicAuthentication(String username, String password) getWebView().setBasicAuthentication(username, password); } + @Kroll.getProperty + public String getUserAgent() + { + TiUIWebView currWebView = getWebView(); + if (currWebView != null) { + return currWebView.getUserAgentString(); + } + return ""; + } + @Kroll.setProperty public void setUserAgent(String userAgent) { @@ -253,13 +235,13 @@ public void setUserAgent(String userAgent) } @Kroll.getProperty - public String getUserAgent() + public HashMap getRequestHeaders() { TiUIWebView currWebView = getWebView(); if (currWebView != null) { - return currWebView.getUserAgentString(); + return currWebView.getRequestHeaders(); } - return ""; + return new HashMap(); } @Kroll.setProperty @@ -273,16 +255,6 @@ public void setRequestHeaders(HashMap params) } } - @Kroll.getProperty - public HashMap getRequestHeaders() - { - TiUIWebView currWebView = getWebView(); - if (currWebView != null) { - return currWebView.getRequestHeaders(); - } - return new HashMap(); - } - @Kroll.method public boolean canGoBack() { @@ -432,9 +404,17 @@ public int getPluginState() } @Kroll.setProperty - public void setDisableContextMenu(boolean disableContextMenu) + public void setPluginState(int pluginState) { - setPropertyAndFire(TiC.PROPERTY_DISABLE_CONTEXT_MENU, disableContextMenu); + switch (pluginState) { + case TiUIWebView.PLUGIN_STATE_OFF: + case TiUIWebView.PLUGIN_STATE_ON: + case TiUIWebView.PLUGIN_STATE_ON_DEMAND: + setPropertyAndFire(TiC.PROPERTY_PLUGIN_STATE, pluginState); + break; + default: + setPropertyAndFire(TiC.PROPERTY_PLUGIN_STATE, TiUIWebView.PLUGIN_STATE_OFF); + } } @Kroll.getProperty @@ -447,17 +427,9 @@ public boolean getDisableContextMenu() } @Kroll.setProperty - public void setPluginState(int pluginState) + public void setDisableContextMenu(boolean disableContextMenu) { - switch (pluginState) { - case TiUIWebView.PLUGIN_STATE_OFF: - case TiUIWebView.PLUGIN_STATE_ON: - case TiUIWebView.PLUGIN_STATE_ON_DEMAND: - setPropertyAndFire(TiC.PROPERTY_PLUGIN_STATE, pluginState); - break; - default: - setPropertyAndFire(TiC.PROPERTY_PLUGIN_STATE, TiUIWebView.PLUGIN_STATE_OFF); - } + setPropertyAndFire(TiC.PROPERTY_DISABLE_CONTEXT_MENU, disableContextMenu); } @Kroll.method @@ -476,12 +448,6 @@ public void resume() } } - @Kroll.setProperty(runOnUiThread = true) - public void setEnableZoomControls(boolean enabled) - { - setPropertyAndFire(TiC.PROPERTY_ENABLE_ZOOM_CONTROLS, enabled); - } - @Kroll.getProperty public boolean getEnableZoomControls() { @@ -493,6 +459,12 @@ public boolean getEnableZoomControls() return enabled; } + @Kroll.setProperty(runOnUiThread = true) + public void setEnableZoomControls(boolean enabled) + { + setPropertyAndFire(TiC.PROPERTY_ENABLE_ZOOM_CONTROLS, enabled); + } + @Kroll.getProperty public float getZoomLevel() { @@ -517,12 +489,6 @@ public void setZoomLevel(float value) } } - @Kroll.setProperty - public void setAllowFileAccess(boolean enabled) - { - setPropertyAndFire(TiC.PROPERTY_ALLOW_FILE_ACCESS, enabled); - } - @Kroll.getProperty public boolean getAllowFileAccess() { @@ -534,6 +500,12 @@ public boolean getAllowFileAccess() return enabled; } + @Kroll.setProperty + public void setAllowFileAccess(boolean enabled) + { + setPropertyAndFire(TiC.PROPERTY_ALLOW_FILE_ACCESS, enabled); + } + @Kroll.getProperty public double getProgress() { @@ -570,15 +542,6 @@ public void setPostCreateMessage(Message postCreateMessage) } } - private static void sendPostCreateMessage(WebView view, Message postCreateMessage) - { - WebView.WebViewTransport transport = (WebView.WebViewTransport) postCreateMessage.obj; - if (transport != null) { - transport.setWebView(view); - } - postCreateMessage.sendToTarget(); - } - /** * Don't release the web view when it's removed. TIMOB-7808 */ @@ -656,4 +619,39 @@ public String getApiName() { return "Ti.UI.WebView"; } + + private static class EvalJSRunnable implements Runnable + { + private final TiUIWebView view; + private final KrollObject krollObject; + private final String code; + private final KrollFunction callback; + + public EvalJSRunnable(TiUIWebView view, KrollObject krollObject, String code, KrollFunction callback) + { + this.view = view; + this.krollObject = krollObject; + this.code = code; + this.callback = callback; + } + + public void run() + { + // Runs the "old" API we built + String result = view.getJSValue(code); + callback.callAsync(krollObject, new Object[] { result }); + } + + public void runAsync() + { + // Runs the newer API provided by Android + view.getWebView().evaluateJavascript(code, new ValueCallback() + { + public void onReceiveValue(String value) + { + callback.callAsync(krollObject, new Object[] { value }); + } + }); + } + } } diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java index 02d2eaafcaa..73dbe8f5f67 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java @@ -7,30 +7,6 @@ package ti.modules.titanium.ui; -import java.lang.ref.WeakReference; -import java.util.HashMap; - -import org.appcelerator.kroll.KrollDict; -import org.appcelerator.kroll.KrollPromise; -import org.appcelerator.kroll.annotations.Kroll; -import org.appcelerator.kroll.common.Log; -import org.appcelerator.titanium.TiActivity; -import org.appcelerator.titanium.TiActivityWindow; -import org.appcelerator.titanium.TiActivityWindows; -import org.appcelerator.titanium.TiApplication; -import org.appcelerator.titanium.TiBaseActivity; -import org.appcelerator.titanium.TiC; -import org.appcelerator.titanium.TiDimension; -import org.appcelerator.titanium.TiRootActivity; -import org.appcelerator.titanium.TiTranslucentActivity; -import org.appcelerator.titanium.proxy.ActivityProxy; -import org.appcelerator.titanium.proxy.TiWindowProxy; -import org.appcelerator.titanium.util.TiColorHelper; -import org.appcelerator.titanium.util.TiConvert; -import org.appcelerator.titanium.util.TiRHelper; -import org.appcelerator.titanium.view.TiUIView; -import ti.modules.titanium.ui.widget.TiView; - import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; @@ -40,12 +16,6 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Message; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; @@ -63,23 +33,53 @@ import android.view.ViewGroup.LayoutParams; import android.view.Window; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import org.appcelerator.kroll.KrollDict; +import org.appcelerator.kroll.KrollPromise; +import org.appcelerator.kroll.annotations.Kroll; +import org.appcelerator.kroll.common.Log; +import org.appcelerator.titanium.TiActivity; +import org.appcelerator.titanium.TiActivityWindow; +import org.appcelerator.titanium.TiActivityWindows; +import org.appcelerator.titanium.TiApplication; +import org.appcelerator.titanium.TiBaseActivity; +import org.appcelerator.titanium.TiC; +import org.appcelerator.titanium.TiDimension; +import org.appcelerator.titanium.TiRootActivity; +import org.appcelerator.titanium.TiTranslucentActivity; +import org.appcelerator.titanium.proxy.ActivityProxy; +import org.appcelerator.titanium.proxy.TiWindowProxy; +import org.appcelerator.titanium.util.TiColorHelper; +import org.appcelerator.titanium.util.TiConvert; +import org.appcelerator.titanium.util.TiRHelper; +import org.appcelerator.titanium.view.TiUIView; + +import java.lang.ref.WeakReference; +import java.util.HashMap; + +import ti.modules.titanium.ui.widget.TiView; + @Kroll.proxy(creatableInModule = UIModule.class, propertyAccessors = { TiC.PROPERTY_MODAL, TiC.PROPERTY_WINDOW_PIXEL_FORMAT, TiC.PROPERTY_FLAG_SECURE, TiC.PROPERTY_BAR_COLOR -}) + }) public class WindowProxy extends TiWindowProxy implements TiActivityWindow { private static final String TAG = "WindowProxy"; private static final String PROPERTY_POST_WINDOW_CREATED = "postWindowCreated"; private static final int MSG_FIRST_ID = TiWindowProxy.MSG_LAST_ID + 1; + protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; private static final int MSG_SET_PIXEL_FORMAT = MSG_FIRST_ID + 100; private static final int MSG_SET_TITLE = MSG_FIRST_ID + 101; - protected static final int MSG_LAST_ID = MSG_FIRST_ID + 999; - private static int id_toolbar; private int barColor = -1; @@ -156,7 +156,7 @@ protected void handleOpen(KrollDict options) topActivity.startActivity(intent); topActivity.overridePendingTransition(0, 0); } else if (options.containsKey(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION) - || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { + || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { topActivity.startActivity(intent); int enterAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION), 0); int exitAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION), 0); @@ -211,7 +211,7 @@ protected void handleClose(@NonNull KrollDict options) if (!animated) { activity.overridePendingTransition(0, 0); } else if (options.containsKey(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION) - || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { + || options.containsKey(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION)) { int enterAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_ENTER_ANIMATION), 0); int exitAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION), 0); activity.overridePendingTransition(enterAnimation, exitAnimation); @@ -397,7 +397,7 @@ protected void fillIntent(Activity activity, Intent intent) } if (hasProperty(TiC.PROPERTY_WINDOW_PIXEL_FORMAT)) { intent.putExtra(TiC.PROPERTY_WINDOW_PIXEL_FORMAT, - TiConvert.toInt(getProperty(TiC.PROPERTY_WINDOW_PIXEL_FORMAT), PixelFormat.UNKNOWN)); + TiConvert.toInt(getProperty(TiC.PROPERTY_WINDOW_PIXEL_FORMAT), PixelFormat.UNKNOWN)); } // Set the splitActionBar property @@ -418,7 +418,7 @@ public void onPropertyChanged(String name, Object value) } else if (TiC.PROPERTY_TITLE.equals(name)) { getMainHandler().obtainMessage(MSG_SET_TITLE, value).sendToTarget(); } else if (TiC.PROPERTY_TOP.equals(name) || TiC.PROPERTY_BOTTOM.equals(name) - || TiC.PROPERTY_LEFT.equals(name) || TiC.PROPERTY_RIGHT.equals(name)) { + || TiC.PROPERTY_LEFT.equals(name) || TiC.PROPERTY_RIGHT.equals(name)) { // The "top", "bottom", "left" and "right" properties do not work for heavyweight windows. return; } else if (TiC.PROPERTY_HIDES_BACK_BUTTON.equals(name)) { @@ -465,6 +465,12 @@ public void onPropertyChanged(String name, Object value) super.onPropertyChanged(name, value); } + @Kroll.getProperty + public boolean getSustainedPerformanceMode() + { + return TiConvert.toBoolean(getProperty(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE), false); + } + @Kroll.setProperty public void setSustainedPerformanceMode(boolean mode) { @@ -475,12 +481,6 @@ public void setSustainedPerformanceMode(boolean mode) } } - @Kroll.getProperty - public boolean getSustainedPerformanceMode() - { - return TiConvert.toBoolean(getProperty(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE), false); - } - @Override @Kroll.setProperty(retain = false) public void setWidth(Object width) @@ -518,7 +518,7 @@ public boolean handleMessage(Message msg) if (activity != null) { Window win = activity.getWindow(); if (win != null) { - win.setFormat(TiConvert.toInt((Object) (msg.obj), PixelFormat.UNKNOWN)); + win.setFormat(TiConvert.toInt(msg.obj, PixelFormat.UNKNOWN)); win.getDecorView().invalidate(); } } @@ -527,21 +527,21 @@ public boolean handleMessage(Message msg) case MSG_SET_TITLE: { Activity activity = getWindowActivity(); if (activity != null) { - activity.setTitle(TiConvert.toString((Object) (msg.obj), "")); + activity.setTitle(TiConvert.toString(msg.obj, "")); if (windowActivity != null && windowActivity.get() != null && windowActivity.get().getSupportActionBar() != null) { ActionBar actionBar = windowActivity.get().getSupportActionBar(); if (actionBar.getTitle() instanceof SpannableStringBuilder) { SpannableStringBuilder stringBuilder = - new SpannableStringBuilder(TiConvert.toString((Object) (msg.obj), "")); + new SpannableStringBuilder(TiConvert.toString(msg.obj, "")); if (barColor != -1) { stringBuilder.setSpan(new ForegroundColorSpan(barColor), 0, stringBuilder.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); } actionBar.setTitle(stringBuilder); } else { - actionBar.setTitle(TiConvert.toString((Object) (msg.obj), "")); + actionBar.setTitle(TiConvert.toString(msg.obj, "")); } } } @@ -581,7 +581,8 @@ private void setWindowWidthHeight(Object width, Object height) /** * Helper method to apply activity transitions. - * @param win The window holding the activity. + * + * @param win The window holding the activity. * @param props The property dictionary. */ private void applyActivityTransitions(Window win, KrollDict props) @@ -627,8 +628,9 @@ private void applyActivityTransitions(Window win, KrollDict props) /** * Creates a transition for the supplied transition type. + * * @param props The property dictionary. - * @param key The transition type + * @param key The transition type * @return A Transition or null if UIModule.TRANSITION_NONE or unknown transition is specified. */ @SuppressLint({ "InlinedApi", "RtlHardcoded" }) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/android/CardViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/android/CardViewProxy.java index caf6767d816..e1c2db91a01 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/android/CardViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/android/CardViewProxy.java @@ -6,13 +6,14 @@ */ package ti.modules.titanium.ui.android; +import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.TiUICardView; -import android.app.Activity; @Kroll.proxy(creatableInModule = AndroidModule.class, propertyAccessors = { @@ -26,7 +27,7 @@ TiC.PROPERTY_PADDING_LEFT, TiC.PROPERTY_PADDING_RIGHT, TiC.PROPERTY_PADDING_TOP -}) + }) public class CardViewProxy extends TiViewProxy { private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1; diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/android/ProgressIndicatorProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/android/ProgressIndicatorProxy.java index d5f26372070..f596f29d3c3 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/android/ProgressIndicatorProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/android/ProgressIndicatorProxy.java @@ -6,6 +6,8 @@ */ package ti.modules.titanium.ui.android; +import android.app.Activity; + import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; @@ -13,7 +15,6 @@ import ti.modules.titanium.ui.TiDialogProxy; import ti.modules.titanium.ui.widget.TiUIProgressIndicator; -import android.app.Activity; @Kroll.proxy(creatableInModule = AndroidModule.class, propertyAccessors = { @@ -26,7 +27,7 @@ TiC.PROPERTY_MAX, TiC.PROPERTY_CANCELABLE, TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE -}) + }) @Kroll.dynamicApis(methods = { "hide", "show" }) public class ProgressIndicatorProxy extends TiDialogProxy { diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/android/SearchViewProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/android/SearchViewProxy.java index b8fbd13c8d6..d120d62e76d 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/android/SearchViewProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/android/SearchViewProxy.java @@ -6,13 +6,14 @@ */ package ti.modules.titanium.ui.android; +import android.app.Activity; + import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiUIView; import ti.modules.titanium.ui.widget.searchview.TiUISearchView; -import android.app.Activity; @Kroll.proxy(creatableInModule = AndroidModule.class, propertyAccessors = { @@ -22,7 +23,7 @@ TiC.PROPERTY_HINT_TEXT, TiC.PROPERTY_HINT_TEXT_COLOR, TiC.PROPERTY_VALUE -}) + }) public class SearchViewProxy extends TiViewProxy { private static final String TAG = "SearchProxy"; diff --git a/android/package.json b/android/package.json index ad6f5134f67..cb890f2d580 100644 --- a/android/package.json +++ b/android/package.json @@ -20,9 +20,9 @@ "compileSDKVersion": "33", "vendorDependencies": { "android sdk": ">=23.x <=34.x", - "android build tools": ">=30.0.2 <=33.x", + "android build tools": ">=30.0.2 <=34.x", "android platform tools": "33.x", - "android tools": "<=26.x", + "android tools": "<=34.x", "android ndk": ">=r21 <=r22b", "java": ">=11.x" }, diff --git a/android/runtime/v8/src/native/CMakeLists.txt b/android/runtime/v8/src/native/CMakeLists.txt index fb6fdb9953a..4c363604f1b 100644 --- a/android/runtime/v8/src/native/CMakeLists.txt +++ b/android/runtime/v8/src/native/CMakeLists.txt @@ -5,7 +5,7 @@ # Please see the LICENSE included with this distribution for details. ################################################################################ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.22.1) # Set project/library name and have it use the C++ compiler. # Note: Built library will be named "lib${PROJECT_NAME}.so". diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index 4288d2e211b..97fac679e34 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -74,7 +74,7 @@ android { } externalNativeBuild { cmake { - version '3.10.2' + version '3.22.1' path "${projectDir}/../runtime/v8/src/native/CMakeLists.txt" } } diff --git a/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java b/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java index 3d29ce309e2..e49244cc65c 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java +++ b/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java @@ -7,8 +7,10 @@ package org.appcelerator.titanium.proxy; import android.graphics.drawable.Drawable; + import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; + import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.kroll.common.Log; @@ -24,7 +26,7 @@ public class ActionBarProxy extends KrollProxy private static final String TAG = "ActionBarProxy"; private static final String ACTION_BAR_NOT_AVAILABLE_MESSAGE = "ActionBar is not enabled"; - private ActionBar actionBar; + private final ActionBar actionBar; private boolean showTitleEnabled = true; public ActionBarProxy(AppCompatActivity activity) @@ -34,7 +36,7 @@ public ActionBarProxy(AppCompatActivity activity) // Guard against calls to ActionBar made before inflating the ActionBarView if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME - | ActionBar.DISPLAY_SHOW_TITLE); + | ActionBar.DISPLAY_SHOW_TITLE); } else { Log.w(TAG, "Trying to get a reference to ActionBar before its container was inflated."); } @@ -77,16 +79,6 @@ public void setHomeButtonEnabled(boolean homeButtonEnabled) } } - @Kroll.setProperty - public void setNavigationMode(int navigationMode) - { - if (actionBar != null) { - actionBar.setNavigationMode(navigationMode); - } else { - Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); - } - } - @Kroll.setProperty public void setBackgroundImage(String url) { @@ -117,27 +109,6 @@ public void setBackgroundImage(String url) } } - @Kroll.setProperty - public void setTitle(String title) - { - if (actionBar != null) { - actionBar.setTitle(title); - } else { - Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); - } - } - - @Kroll.setProperty - public void setSubtitle(String subTitle) - { - if (actionBar != null) { - actionBar.setDisplayShowTitleEnabled(true); - actionBar.setSubtitle(subTitle); - } else { - Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); - } - } - @Kroll.method public void setDisplayShowHomeEnabled(boolean show) { @@ -164,6 +135,17 @@ public String getSubtitle() return (String) actionBar.getSubtitle(); } + @Kroll.setProperty + public void setSubtitle(String subTitle) + { + if (actionBar != null) { + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setSubtitle(subTitle); + } else { + Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); + } + } + @Kroll.getProperty public String getTitle() { @@ -173,13 +155,33 @@ public String getTitle() return (String) actionBar.getTitle(); } + @Kroll.setProperty + public void setTitle(String title) + { + if (actionBar != null) { + actionBar.setTitle(title); + } else { + Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); + } + } + @Kroll.getProperty public int getNavigationMode() { if (actionBar == null) { return 0; } - return (int) actionBar.getNavigationMode(); + return actionBar.getNavigationMode(); + } + + @Kroll.setProperty + public void setNavigationMode(int navigationMode) + { + if (actionBar != null) { + actionBar.setNavigationMode(navigationMode); + } else { + Log.w(TAG, ACTION_BAR_NOT_AVAILABLE_MESSAGE); + } } @Kroll.method diff --git a/android/titanium/src/java/org/appcelerator/titanium/util/TiNinePatchHelper.java b/android/titanium/src/java/org/appcelerator/titanium/util/TiNinePatchHelper.java index 652820f4b8c..0509e6ef62c 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/util/TiNinePatchHelper.java +++ b/android/titanium/src/java/org/appcelerator/titanium/util/TiNinePatchHelper.java @@ -6,8 +6,6 @@ */ package org.appcelerator.titanium.util; -import java.util.ArrayList; - import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Rect; @@ -15,15 +13,11 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; +import java.util.ArrayList; + @SuppressWarnings("deprecation") public class TiNinePatchHelper { - private static class SegmentColor - { - int index; - int color; - } - public Drawable process(Drawable d) { Drawable nd = d; @@ -199,8 +193,8 @@ byte[] createChunk(Bitmap b) numColors = colors.size(); // Figure out the size / looks like padded to 32bits. - int size = 32 + // wasDeserialized, numXDivs, numYDivs, numColors, padLeft, padRight, padTop, padBottom - numXDivs * 32 + numYDivs * 32 + numColors * 32; + int size = 32 // wasDeserialized, numXDivs, numYDivs, numColors, padLeft, padRight, padTop, padBottom + + numXDivs * 32 + numYDivs * 32 + numColors * 32; chunk = new byte[size]; chunk[0] = 0; @@ -245,4 +239,10 @@ private void toBytes(byte[] a, int offset, int v) a[offset + 2] = (byte) ((0x00FF0000 & v) >> 16); a[offset + 3] = (byte) ((0xFF000000 & v) >> 24); } + + private static class SegmentColor + { + int index; + int color; + } } diff --git a/android/titanium/src/java/ti/modules/titanium/BufferProxy.java b/android/titanium/src/java/ti/modules/titanium/BufferProxy.java index a0422f7dcbb..1825b2082df 100644 --- a/android/titanium/src/java/ti/modules/titanium/BufferProxy.java +++ b/android/titanium/src/java/ti/modules/titanium/BufferProxy.java @@ -6,9 +6,6 @@ */ package ti.modules.titanium; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; - import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.KrollProxy; @@ -18,6 +15,9 @@ import org.appcelerator.titanium.TiC; import org.appcelerator.titanium.util.TiConvert; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; + import ti.modules.titanium.codec.CodecModule; /** @@ -28,7 +28,7 @@ TiC.PROPERTY_BYTE_ORDER, TiC.PROPERTY_TYPE, TiC.PROPERTY_VALUE -}) + }) public class BufferProxy extends KrollProxy { private static final String TAG = "BufferProxy"; @@ -170,13 +170,14 @@ protected void validateOffsetAndLength(int offset, int length, int bufferLength) { if (length > offset + bufferLength) { throw new IllegalArgumentException("offset of " + offset + " and length of " + length - + " is larger than the buffer length: " + bufferLength); + + " is larger than the buffer length: " + bufferLength); } } /** * Writes data from sourceBuffer into this. - * @param position the offset position of this buffer. + * + * @param position the offset position of this buffer. * @param sourceBuffer the source buffer to write from. * @param sourceOffset the offset position of the sourceBuffer. * @param sourceLength the length of the sourceBuffer. @@ -372,6 +373,7 @@ public int getLength() /** * Sets the length of this buffer proxy by either growing or shrinking * the allocated buffer space + * * @param length The new length of this buffer proxy in bytes */ @Kroll.setProperty From c719bcd5cd061cccaefe888b8edaf7f25143f412 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Tue, 20 Aug 2024 19:14:37 +0200 Subject: [PATCH 25/88] feat(android): enable Signature Scheme v3 (#13938) Co-authored-by: Chris Barber --- android/templates/build/app.build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/templates/build/app.build.gradle b/android/templates/build/app.build.gradle index 4a1607f99fc..44f859dfa54 100644 --- a/android/templates/build/app.build.gradle +++ b/android/templates/build/app.build.gradle @@ -62,6 +62,7 @@ android { storePassword tiKeystorePassword keyAlias tiKeystoreAliasName keyPassword tiKeystoreAliasPassword + enableV3Signing true } } buildTypes { From dfb1b5c312cbfac159fbae4d7277330dad71d6e0 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Wed, 21 Aug 2024 10:57:43 +0200 Subject: [PATCH 26/88] feat(android): fire `selected` event again when clicking the same Tab again (#14094) * feat(android): new 'reselected' event on a Tab * check for listener * reselected -> selected * docs --- .../ui/widget/tabgroup/TiUITabLayoutTabGroup.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java index a4d35f234a3..97d81da263e 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/tabgroup/TiUITabLayoutTabGroup.java @@ -6,6 +6,7 @@ */ package ti.modules.titanium.ui.widget.tabgroup; +import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.common.Log; import org.appcelerator.titanium.TiBaseActivity; import org.appcelerator.titanium.TiC; @@ -412,6 +413,17 @@ public void onTabUnselected(TabLayout.Tab tab) @Override public void onTabReselected(TabLayout.Tab tab) { + if (tab != null) { + int index = tab.getPosition(); + if ((index >= 0) && (index < this.tabs.size())) { + TiViewProxy tabProxy = this.tabs.get(index).getProxy(); + if (tabProxy != null && tabProxy.hasListeners(TiC.EVENT_SELECTED)) { + KrollDict data = new KrollDict(); + data.put("index", index); + tabProxy.fireEvent(TiC.EVENT_SELECTED, data, false); + } + } + } } public void setTabMode(int value) From 3eda594e2721651a412a9557f6a05830c19efb29 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Wed, 21 Aug 2024 23:17:32 +0200 Subject: [PATCH 27/88] feat(android): add maxImages and pathOnly to openPhotoGallery (#14086) * feat(android): add maxImages to openPhotoGallery * pathOnly --- .../modules/titanium/media/MediaModule.java | 23 ++++++++++++++++--- .../java/org/appcelerator/titanium/TiC.java | 2 ++ apidoc/Titanium/Media/Media.yml | 20 ++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java b/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java index 306c99ed35a..87ec0194fcf 100644 --- a/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java +++ b/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java @@ -241,6 +241,7 @@ public class MediaModule extends KrollModule implements Handler.Callback private static String mediaType = MEDIA_TYPE_PHOTO; private static ContentResolver contentResolver; private boolean useCameraX = false; + private static boolean pathOnly = false; public MediaModule() { @@ -1116,6 +1117,15 @@ public void openPhotoGallery(KrollDict options) TiIntentWrapper galleryIntent = new TiIntentWrapper(new Intent()); galleryIntent.getIntent().setAction(Intent.ACTION_GET_CONTENT); + if (options.containsKeyAndNotNull(TiC.PROPERTY_MAX_IMAGES) + && options.containsKey(TiC.PROPERTY_ALLOW_MULTIPLE) + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + // set max image count + galleryIntent = new TiIntentWrapper(new Intent(MediaStore.ACTION_PICK_IMAGES)); + galleryIntent.getIntent() + .putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, options.getInt(TiC.PROPERTY_MAX_IMAGES)); + } + boolean isSelectingPhoto = false; boolean isSelectingVideo = false; if (options.containsKey(TiC.PROPERTY_MEDIA_TYPES)) { @@ -1163,6 +1173,11 @@ public void openPhotoGallery(KrollDict options) galleryIntent.getIntent().putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple); } + pathOnly = false; + if (options.containsKeyAndNotNull(TiC.PROPERTY_PATH_ONLY)) { + pathOnly = options.getBoolean(TiC.PROPERTY_PATH_ONLY); + } + final int code = allowMultiple ? PICK_IMAGE_MULTIPLE : PICK_IMAGE_SINGLE; activitySupport.launchActivityForResult(galleryIntent.getIntent(), code, new TiActivityResultHandler() { @@ -1401,16 +1416,18 @@ protected static KrollDict createDictForImage(TiBlob imageData, String mimeType) d.put("width", width); d.put("height", height); - // Add the image/video's crop dimensiosn to the dictionary. + // Add the image/video's crop dimension to the dictionary. KrollDict cropRect = new KrollDict(); cropRect.put("x", 0); cropRect.put("y", 0); cropRect.put("width", width); cropRect.put("height", height); d.put("cropRect", cropRect); - + d.put("path", imageData.getNativePath()); // Add the blob to the dictionary. - d.put("media", imageData); + if (!pathOnly) { + d.put("media", imageData); + } return d; } diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiC.java b/android/titanium/src/java/org/appcelerator/titanium/TiC.java index 4f219b4c308..c7da4f79aa8 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiC.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiC.java @@ -560,6 +560,7 @@ public class TiC public static final String PROPERTY_MAX_AGE = "maxAge"; public static final String PROPERTY_MAX_CLASSNAME = "maxClassname"; public static final String PROPERTY_MAX_ELEVATION = "maxElevation"; + public static final String PROPERTY_MAX_IMAGES = "maxImages"; public static final String PROPERTY_MAX_LENGTH = "maxLength"; public static final String PROPERTY_MAX_LINES = "maxLines"; public static final String PROPERTY_MAX_ROW_HEIGHT = "maxRowHeight"; @@ -640,6 +641,7 @@ public class TiC public static final String PROPERTY_PASSWORD = "password"; public static final String PROPERTY_PASSWORD_MASK = "passwordMask"; public static final String PROPERTY_PATH = "path"; + public static final String PROPERTY_PATH_ONLY = "pathOnly"; public static final String PROPERTY_PERSISTENT = "persistent"; public static final String PROPERTY_PHONE = "phone"; public static final String PROPERTY_PIN_IMAGE = "pinImage"; diff --git a/apidoc/Titanium/Media/Media.yml b/apidoc/Titanium/Media/Media.yml index 8f093d29dac..8e6a97e518e 100644 --- a/apidoc/Titanium/Media/Media.yml +++ b/apidoc/Titanium/Media/Media.yml @@ -2235,6 +2235,20 @@ properties: osver: {ios: {min: "14.0"}} since: { android: "6.0.0", iphone: "9.2.0", ipad: "9.2.0" } + - name: maxImages + summary: Specifies the number of images a user can select at maximum. + description: | + Only available on Android API 21 and above and with `allowMultiple:true` + type: Boolean + platforms: [android] + since: { android: "12.5.0" } + + - name: pathOnly + summary: Do not include the blob in the result + type: Boolean + platforms: [android] + since: { android: "12.5.0" } + - name: selectionLimit summary: Specifies number of media item that can be selected. description: | @@ -2284,6 +2298,12 @@ properties: summary: The media object, as a [Blob](Titanium.Blob). type: Titanium.Blob + - name: path + summary: The path of the image when returning data from the gallery. + type: String + platforms: [android] + since: "12.5.0" + - name: mediaType summary: The type of media, either `MEDIA_TYPE_PHOTO`, `MEDIA_TYPE_LIVEPHOTO` or `MEDIA_TYPE_VIDEO` defined in . type: String From b9fd68326f1dca7f7dc4eeb20e9fffa881dbce6d Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Mon, 26 Aug 2024 19:32:08 +0200 Subject: [PATCH 28/88] feat(android): flatten ListView layout (#14037) * feat(android): flatten ListView layout * change layout order * adjust right padding * fix footer/headerView * update library, move to async updates --- .../layout/titanium_ui_listview_holder.xml | 167 +++++++++--------- .../ui/widget/listview/ListViewAdapter.java | 4 +- .../ui/widget/listview/ListViewHolder.java | 29 ++- .../listview/TiRecyclerViewAdapter.java | 6 +- android/titanium/build.gradle | 2 +- 5 files changed, 113 insertions(+), 95 deletions(-) diff --git a/android/modules/ui/res/layout/titanium_ui_listview_holder.xml b/android/modules/ui/res/layout/titanium_ui_listview_holder.xml index 88cab51e45a..de8cfbe1581 100644 --- a/android/modules/ui/res/layout/titanium_ui_listview_holder.xml +++ b/android/modules/ui/res/layout/titanium_ui_listview_holder.xml @@ -1,96 +1,91 @@ - + - - + - - - + - - + - + - + - - + - - + - - - - + diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewAdapter.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewAdapter.java index 5b641c8ed3d..dc59801541c 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewAdapter.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewAdapter.java @@ -16,9 +16,9 @@ import android.content.Context; import android.view.ViewGroup; -import android.widget.RelativeLayout; import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; public class ListViewAdapter extends TiRecyclerViewAdapter { @@ -112,7 +112,7 @@ public void onBindViewHolder(@NonNull ListViewHolder holder, int position) public ListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { // Create new TableViewHolder instance. - final RelativeLayout layout = (RelativeLayout) inflater.inflate(id_holder, null); + final ConstraintLayout layout = (ConstraintLayout) inflater.inflate(id_holder, null); return new ListViewHolder(parent.getContext(), layout); } diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java index 6b7defa8ae1..0a400cd4705 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java @@ -18,6 +18,7 @@ import org.appcelerator.titanium.view.TiCompositeLayout; import org.appcelerator.titanium.view.TiUIView; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.res.Resources; @@ -33,6 +34,8 @@ import android.widget.ImageView; import android.widget.TextView; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.constraintlayout.widget.ConstraintSet; import androidx.recyclerview.widget.RecyclerView; import java.lang.ref.WeakReference; @@ -70,7 +73,7 @@ public ListViewHolder(final Context context, final ViewGroup viewGroup) // Header attributes. setTitleAttributes("header", context, this.headerTitle); - this.container = viewGroup.findViewById(R.id.titanium_ui_listview_holder_outer_content_container); + this.container = viewGroup.findViewById(R.id.titanium_ui_listview_holder); this.leftImage = viewGroup.findViewById(R.id.titanium_ui_listview_holder_left_image); @@ -92,6 +95,7 @@ public ListViewHolder(final Context context, final ViewGroup viewGroup) * @param proxy ListItemProxy to bind. * @param selected Is row selected. */ + @SuppressLint("ClickableViewAccessibility") public void bind(final ListItemProxy proxy, final boolean selected) { reset(); @@ -165,7 +169,6 @@ public void bind(final ListItemProxy proxy, final boolean selected) this.rightImage.setVisibility(View.VISIBLE); RecyclerView.ViewHolder mViewHolder = this; - this.rightImage.setOnTouchListener(new View.OnTouchListener() { @Override @@ -252,7 +255,7 @@ public boolean onTouch(View view, MotionEvent motionEvent) borderView.setAddStatesFromChildren(true); // Amend maximum size for content to parent ListView measured height. - this.content.setChildFillHeight(nativeListView.getMeasuredHeight()); + this.container.setMinimumHeight(nativeListView.getMeasuredHeight()); // Add ListViewItem to content. this.content.addView(borderView, view.getLayoutParams()); @@ -362,6 +365,16 @@ private void setHeaderFooter(TiViewProxy listViewProxy, this.header.addView(headerView, view.getLayoutParams()); this.header.setVisibility(View.VISIBLE); + + ConstraintSet constraintSet = new ConstraintSet(); + constraintSet.clone((ConstraintLayout) this.container); + constraintSet.connect(R.id.titanium_ui_listview_holder_content, ConstraintSet.TOP, + R.id.titanium_ui_listview_holder_header, ConstraintSet.BOTTOM, 0); + constraintSet.connect(R.id.titanium_ui_listview_holder_left_image, ConstraintSet.TOP, + R.id.titanium_ui_listview_holder_header, ConstraintSet.BOTTOM, 0); + constraintSet.connect(R.id.titanium_ui_listview_holder_right_image, ConstraintSet.TOP, + R.id.titanium_ui_listview_holder_header, ConstraintSet.BOTTOM, 0); + constraintSet.applyTo((ConstraintLayout) this.container); } } } @@ -396,6 +409,16 @@ private void setHeaderFooter(TiViewProxy listViewProxy, this.footer.addView(footerView, view.getLayoutParams()); this.footer.setVisibility(View.VISIBLE); + + ConstraintSet constraintSet = new ConstraintSet(); + constraintSet.clone((ConstraintLayout) this.container); + constraintSet.connect(R.id.titanium_ui_listview_holder_content, ConstraintSet.BOTTOM, + R.id.titanium_ui_listview_holder_footer, ConstraintSet.TOP, 0); + constraintSet.connect(R.id.titanium_ui_listview_holder_left_image, ConstraintSet.BOTTOM, + R.id.titanium_ui_listview_holder_footer, ConstraintSet.TOP, 0); + constraintSet.connect(R.id.titanium_ui_listview_holder_right_image, ConstraintSet.BOTTOM, + R.id.titanium_ui_listview_holder_footer, ConstraintSet.TOP, 0); + constraintSet.applyTo((ConstraintLayout) this.container); } } } diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiRecyclerViewAdapter.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiRecyclerViewAdapter.java index 56eab7ada66..cca19084f9b 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiRecyclerViewAdapter.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiRecyclerViewAdapter.java @@ -117,7 +117,7 @@ public void update(List newModels, boolean force) return; } - final var diffResult = DiffUtil.calculateDiff(new DiffCallback(newModelsClone, this.models)); + final var diffResult = DiffUtil.calculateDiff(new AsyncListDiffer(newModelsClone, this.models)); // Update models. this.models = newModelsClone; @@ -129,13 +129,13 @@ public void update(List newModels, boolean force) /** * Define DiffUtil.Callback to optimize updating the adapter. */ - private class DiffCallback extends DiffUtil.Callback + private class AsyncListDiffer extends DiffUtil.Callback { List newViews; List oldViews; - public DiffCallback(List newViews, List oldViews) + public AsyncListDiffer(List newViews, List oldViews) { this.newViews = newViews; this.oldViews = oldViews; diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index 97fac679e34..160a9417a4d 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -254,7 +254,7 @@ dependencies { implementation 'androidx.exifinterface:exifinterface:1.3.6' implementation "androidx.fragment:fragment:${project.ext.tiAndroidXFragmentLibVersion}" implementation 'androidx.media:media:1.6.0' - implementation 'androidx.recyclerview:recyclerview:1.3.1' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.recyclerview:recyclerview-selection:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.transition:transition:1.4.1' From 5b274a769b10fc3f25d2c746d6ec24aec6b5e014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Tue, 27 Aug 2024 15:01:40 +0200 Subject: [PATCH 29/88] chore: bump master to 12.6.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index fd968703387..97000a2d7b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "titanium-mobile", - "version": "12.5.0", + "version": "12.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "titanium-mobile", - "version": "12.5.0", + "version": "12.6.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 543a66416e7..57779acbd5f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "titanium-mobile", "description": "Titanium SDK", - "version": "12.5.0", + "version": "12.6.0", "moduleApiVersion": { "iphone": "2", "android": "4" From 266b6d5ed1d2b9ac77d5de999d5ab2a352f2fa1f Mon Sep 17 00:00:00 2001 From: hansemannn Date: Wed, 28 Aug 2024 00:06:24 +0000 Subject: [PATCH 30/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f761235fa5..1d5222cd372 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánJason KneenMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto +Rene PotRodrigo FarfánMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto ## Features From 1bbcc5bc02591facf3543d5e01315b3d1f8c7e0d Mon Sep 17 00:00:00 2001 From: hansemannn Date: Mon, 2 Sep 2024 00:06:44 +0000 Subject: [PATCH 31/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d5222cd372..f2ce0db7e75 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto +Rene PotRodrigo FarfánMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto ## Features From d98f6a6fbf5d6406ceb20492ba89410400b6a95c Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Thu, 5 Sep 2024 17:02:24 +0200 Subject: [PATCH 32/88] docs: add responseDictionary to HTTPClient documentation (#14101) Co-authored-by: Chris Barber --- apidoc/Titanium/Network/HTTPClient.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apidoc/Titanium/Network/HTTPClient.yml b/apidoc/Titanium/Network/HTTPClient.yml index 21f72dc2e05..d758baa8a6c 100644 --- a/apidoc/Titanium/Network/HTTPClient.yml +++ b/apidoc/Titanium/Network/HTTPClient.yml @@ -493,6 +493,13 @@ properties: type: String permission: read-only + - name: responseDictionary + summary: Response as JSON object. + description: Set to `null` if the content type returned by the server was not a JSON or if the content could + not be parsed. + type: String + permission: read-only + - name: responseXML summary: Response object as an XML DOM Document object. description: From 3db8223a9052dc607ca9c435b8532370207056d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Tue, 10 Sep 2024 15:52:13 +0200 Subject: [PATCH 33/88] Revert "fix(ios): fix unbalanced view controller transitions causing issues on iOS 16+ (#13586)" This reverts commit 50814d717910f5b42b6f61972b30f8d10f85a268. --- iphone/Classes/TiUINavigationWindowProxy.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iphone/Classes/TiUINavigationWindowProxy.m b/iphone/Classes/TiUINavigationWindowProxy.m index d6f2f9ac4c2..1c47611fb7b 100644 --- a/iphone/Classes/TiUINavigationWindowProxy.m +++ b/iphone/Classes/TiUINavigationWindowProxy.m @@ -393,14 +393,14 @@ - (void)viewWillAppear:(BOOL)animated UIViewController *parentController = [self windowHoldingController]; [parentController addChildViewController:navController]; [navController didMoveToParentViewController:parentController]; - [navController beginAppearanceTransition:YES animated:animated]; + [navController viewWillAppear:animated]; } [super viewWillAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { if ([self viewAttached]) { - [navController endAppearanceTransition]; + [navController viewWillDisappear:animated]; } [super viewWillDisappear:animated]; } @@ -408,14 +408,14 @@ - (void)viewWillDisappear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated { if ([self viewAttached]) { - [navController beginAppearanceTransition:YES animated:animated]; + [navController viewDidAppear:animated]; } [super viewDidAppear:animated]; } - (void)viewDidDisappear:(BOOL)animated { if ([self viewAttached]) { - [navController endAppearanceTransition]; + [navController viewDidDisappear:animated]; } [super viewDidDisappear:animated]; } From f3676e19e1eacadba532010f511f6123efc0f244 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Thu, 12 Sep 2024 17:29:09 +0200 Subject: [PATCH 34/88] chore: update gradle files (#13888) --- android/app/build.gradle | 8 +-- android/build.gradle | 2 +- android/kroll-apt/build.gradle | 8 +-- android/templates/build/root.build.gradle | 2 +- .../templates/module/generated/build.gradle | 2 +- android/titanium/build.gradle | 18 ++--- android/untar.gradle | 72 +++++++++---------- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f9ee6f9cdb1..d2ac439bee8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -39,17 +39,17 @@ android { // Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml". // Will trigger a build failure if any violations have been detected. // Customize all the Checkstyle tasks -tasks.withType(Checkstyle) { +tasks.withType(Checkstyle).configureEach { // Specify all files that should be checked classpath = files() source android.sourceSets.main.java.srcDirs } // Execute Checkstyle on all files -task checkJavaStyle(type: Checkstyle) { +tasks.register('checkJavaStyle', Checkstyle) { // include '**/*.java' } // Execute Checkstyle on all modified files -task checkstyleChanged(type: Checkstyle) { +tasks.register('checkstyleChanged', Checkstyle) { include getChangedFiles() } @@ -73,7 +73,7 @@ def getChangedFiles() { files } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { dependsOn checkJavaStyle } diff --git a/android/build.gradle b/android/build.gradle index 319eec9c71a..325c0af0c32 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -39,6 +39,6 @@ allprojects { project.apply from: "${rootDir}/templates/build/ti.constants.gradle" } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/android/kroll-apt/build.gradle b/android/kroll-apt/build.gradle index 8f5d9d6ddc6..addda9dcd4f 100644 --- a/android/kroll-apt/build.gradle +++ b/android/kroll-apt/build.gradle @@ -13,16 +13,16 @@ targetCompatibility = JavaVersion.VERSION_11 // Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml". // Will trigger a build failure if any violations have been detected. // Customize all the Checkstyle tasks -tasks.withType(Checkstyle) { +tasks.withType(Checkstyle).configureEach { // Specify all files that should be checked classpath = files() source 'src/main/java' } // Execute Checkstyle on all files -task checkJavaStyle(type: Checkstyle) { +tasks.register('checkJavaStyle', Checkstyle) { // include '**/*.java' } -task checkstyleChanged(type: Checkstyle) { +tasks.register('checkstyleChanged', Checkstyle) { include getChangedFiles() } @@ -47,7 +47,7 @@ def getChangedFiles() { } // Hook into Java compile task. -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { // Check Java code for mistakes before compiling. dependsOn checkJavaStyle diff --git a/android/templates/build/root.build.gradle b/android/templates/build/root.build.gradle index 8df90e3f35f..c8b563a07cc 100644 --- a/android/templates/build/root.build.gradle +++ b/android/templates/build/root.build.gradle @@ -21,6 +21,6 @@ allprojects { project.apply from: "${rootDir}/ti.constants.gradle" } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/android/templates/module/generated/build.gradle b/android/templates/module/generated/build.gradle index 83bb889a7ba..35106af223b 100644 --- a/android/templates/module/generated/build.gradle +++ b/android/templates/module/generated/build.gradle @@ -164,7 +164,7 @@ project.afterEvaluate { } // Hook into Java compile task. -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { // Log all Java linting errors/warnings. options.compilerArgs << "-Xlint:all" diff --git a/android/titanium/build.gradle b/android/titanium/build.gradle index 160a9417a4d..2e78280442e 100644 --- a/android/titanium/build.gradle +++ b/android/titanium/build.gradle @@ -125,7 +125,7 @@ android { } // Downloads/extracts V8 library and creates a cmake file for it. To be executed before C/C++ "build" or "clean". -task updateV8Library() { +tasks.register('updateV8Library') { def packageJson = new JsonSlurper().parse(file("${projectDir}/../package.json")) def v8MakeFilePath = "${projectDir}/../runtime/v8/src/ndk-modules/libv8/V8Settings.cmake" inputs.property 'v8.version', packageJson.v8.version @@ -139,8 +139,8 @@ task updateV8Library() { def v8MakeFile = file(v8MakeFilePath) v8MakeFile.getParentFile().mkdirs() v8MakeFile.text = [ - "set(LIBV8_VERSION \"${packageJson.v8.version}\")", - "set(LIBV8_MODE \"${packageJson.v8.mode}\")" + "set(LIBV8_VERSION \"${packageJson.v8.version}\")", + "set(LIBV8_MODE \"${packageJson.v8.mode}\")" ].join('\n') + '\n' // Download/install the V8 library referenced in our "package.json", if not already done. @@ -152,24 +152,24 @@ task updateV8Library() { } } preBuild.dependsOn updateV8Library -tasks.withType(ExternalNativeCleanTask) { +tasks.withType(ExternalNativeCleanTask).configureEach { dependsOn updateV8Library } // Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml". // Will trigger a build failure if any violations have been detected. // Customize all the Checkstyle tasks -tasks.withType(Checkstyle) { +tasks.withType(Checkstyle).configureEach { // Specify all files that should be checked classpath = files() source android.sourceSets.main.java.srcDirs } // Execute Checkstyle on all files -task checkJavaStyle(type: Checkstyle) { +tasks.register('checkJavaStyle', Checkstyle) { // include '**/*.java' } // Execute Checkstyle on all modified files -task checkstyleChanged(type: Checkstyle) { +tasks.register('checkstyleChanged', Checkstyle) { include getChangedFiles() } @@ -196,7 +196,7 @@ def getChangedFiles() { // Performs a transpile/polyfill/rollup of our "titanium_mobile/common/Resources" directory tree's JS files, // takes a V8 snapshot of rolled-up files, and then generates a C++ header file of that snapshot to be compiled-in. // Note: This supports incremental builds. Only executes when JS files change or snapshot output file is missing. -task snapshotTiCommonFiles() { +tasks.register('snapshotTiCommonFiles') { inputs.dir "${projectDir}/../../common/Resources" inputs.file "${projectDir}/../../build/lib/builder.js" inputs.file "${projectDir}/../../build/lib/android/index.js" @@ -221,7 +221,7 @@ project.afterEvaluate { // Runs our "prebuild.js" script before the C/C++ compile, but after Java compile. (Mid-build script?) // Generates C/C++ files providing our Android-only JS files via byte arrays. -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { dependsOn checkJavaStyle dependsOn snapshotTiCommonFiles doLast { diff --git a/android/untar.gradle b/android/untar.gradle index c8073c36141..145bb23b4eb 100644 --- a/android/untar.gradle +++ b/android/untar.gradle @@ -1,36 +1,36 @@ -/** - * Titanium SDK - * Copyright TiDev, Inc. 04/07/2022-Present - * Licensed under the terms of the Apache Public License. - * Please see the LICENSE included with this distribution for details. - */ - -// Extracts a "*.tar" file using the same parameters as the ant task. -// Used by our prebuild step to extract our "libv8-*.tar.bz2" file. -task untar() { - // Throw an error if required gradle property has not been set. - if (!project.hasProperty('src')) { - throw new InvalidUserDataException('You must set a "src" property.') - } - - // Assign a default value to any unassigned properties. - if (!project.hasProperty('compression')) { - project.ext.compression = 'none' - } - if (!project.hasProperty('overwrite')) { - project.ext.overwrite = 'true' - } - if (!project.hasProperty('dest')) { - def sourceFile = new File(src) - project.ext.dest = sourceFile.getParentFile().getPath() - } - - // Use "ant" to extract the given tarball. - ant.untar( - compression: project.properties.compression, - overwrite: project.properties.overwrite, - src: project.properties.src, - dest: project.properties.dest) -} - -defaultTasks 'untar' +/** + * Titanium SDK + * Copyright TiDev, Inc. 04/07/2022-Present + * Licensed under the terms of the Apache Public License. + * Please see the LICENSE included with this distribution for details. + */ + +// Extracts a "*.tar" file using the same parameters as the ant task. +// Used by our prebuild step to extract our "libv8-*.tar.bz2" file. +tasks.register('untar') { + // Throw an error if required gradle property has not been set. + if (!project.hasProperty('src')) { + throw new InvalidUserDataException('You must set a "src" property.') + } + + // Assign a default value to any unassigned properties. + if (!project.hasProperty('compression')) { + project.ext.compression = 'none' + } + if (!project.hasProperty('overwrite')) { + project.ext.overwrite = 'true' + } + if (!project.hasProperty('dest')) { + def sourceFile = new File(src) + project.ext.dest = sourceFile.getParentFile().getPath() + } + + // Use "ant" to extract the given tarball. + ant.untar( + compression: project.properties.compression, + overwrite: project.properties.overwrite, + src: project.properties.src, + dest: project.properties.dest) +} + +defaultTasks 'untar' \ No newline at end of file From 78bf085340df90c3b10196cbef8bbec2cd8cbfa4 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Sat, 14 Sep 2024 00:33:02 +0200 Subject: [PATCH 35/88] feat(android): statusBarColor for Window (#14089) Co-authored-by: Chris Barber --- .../ti/modules/titanium/ui/WindowProxy.java | 18 +++++++++++++++++- .../java/org/appcelerator/titanium/TiC.java | 1 + apidoc/Titanium/UI/Window.yml | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java index 73dbe8f5f67..43d68e76c01 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java @@ -69,8 +69,10 @@ TiC.PROPERTY_MODAL, TiC.PROPERTY_WINDOW_PIXEL_FORMAT, TiC.PROPERTY_FLAG_SECURE, - TiC.PROPERTY_BAR_COLOR + TiC.PROPERTY_BAR_COLOR, + TiC.PROPERTY_STATUS_BAR_COLOR }) + public class WindowProxy extends TiWindowProxy implements TiActivityWindow { private static final String TAG = "WindowProxy"; @@ -320,6 +322,12 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState) } } + if (hasProperty(TiC.PROPERTY_STATUS_BAR_COLOR)) { + int colorInt = TiColorHelper.parseColor( + TiConvert.toString(getProperty(TiC.PROPERTY_STATUS_BAR_COLOR)), activity); + win.setStatusBarColor(colorInt); + } + // Handle titleAttributes property. if (hasProperty(TiC.PROPERTY_TITLE_ATTRIBUTES)) { KrollDict innerAttributes = getProperties().getKrollDict(TiC.PROPERTY_TITLE_ATTRIBUTES); @@ -446,6 +454,14 @@ public void onPropertyChanged(String name, Object value) } } + if (name.equals(TiC.PROPERTY_STATUS_BAR_COLOR)) { + if (windowActivity != null && windowActivity.get() != null) { + AppCompatActivity activity = windowActivity.get(); + int colorInt = TiColorHelper.parseColor(TiConvert.toString(value), activity); + activity.getWindow().setStatusBarColor(colorInt); + } + } + if (name.equals(TiC.PROPERTY_TITLE_ATTRIBUTES)) { if (windowActivity != null && windowActivity.get() != null) { // Get a reference to the ActionBar. diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiC.java b/android/titanium/src/java/org/appcelerator/titanium/TiC.java index c7da4f79aa8..040d9a003fd 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiC.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiC.java @@ -305,6 +305,7 @@ public class TiC public static final String PROPERTY_TOUCH_FEEDBACK_COLOR = "touchFeedbackColor"; public static final String PROPERTY_TRANSITION_NAME = "transitionName"; public static final String PROPERTY_BAR_COLOR = "barColor"; + public static final String PROPERTY_STATUS_BAR_COLOR = "statusBarColor"; public static final String PROPERTY_BASE_URL = "baseUrl"; public static final String PROPERTY_BASE_URL_WEBVIEW = "baseURL"; public static final String PROPERTY_BIG_TEXT = "bigText"; diff --git a/apidoc/Titanium/UI/Window.yml b/apidoc/Titanium/UI/Window.yml index bbc3aef2a6f..9ebae2d4a9a 100644 --- a/apidoc/Titanium/UI/Window.yml +++ b/apidoc/Titanium/UI/Window.yml @@ -1353,6 +1353,12 @@ properties: platforms: [iphone, ipad, macos] since: {iphone: "3.1.3", ipad: "3.1.3", macos: "9.2.0"} + - name: statusBarColor + summary: The color of the status bar (top bar) for this window. + type: [Number] + platforms: [android] + since: {android: "12.5.0"} + - name: sustainedPerformanceMode summary: Maintain a sustainable level of performance. description: | From 4c1c067206f56d0c5862a2e9faf099dd417dbd3e Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Sat, 14 Sep 2024 18:01:14 +0200 Subject: [PATCH 36/88] chore(android): forward --sdk in module build process (#14112) * chore(android): forward --sdk in module build process * optimize code --- android/cli/commands/_buildModule.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/cli/commands/_buildModule.js b/android/cli/commands/_buildModule.js index 30e6f003cf5..1fdf5c78767 100644 --- a/android/cli/commands/_buildModule.js +++ b/android/cli/commands/_buildModule.js @@ -58,6 +58,7 @@ AndroidModuleBuilder.prototype.migrate = async function migrate() { const manifestModuleAPIVersion = this.manifest.apiversion; const manifestTemplateFile = path.join(this.platformPath, 'templates', 'module', 'default', 'template', 'android', 'manifest.ejs'); let newVersion = semver.inc(this.manifest.version, 'major'); + this.tiSdkVersion = cliSDKVersion; // Determine if the "manifest" file's "apiversion" needs updating. let isApiVersionUpdateRequired = false; @@ -873,6 +874,7 @@ AndroidModuleBuilder.prototype.runModule = async function (cli) { '-u', 'localhost', '-d', tmpDir, '-p', 'android', + '--sdk', this.tiSdkVersion, '--force' ], this.logger @@ -917,7 +919,7 @@ AndroidModuleBuilder.prototype.runModule = async function (cli) { // Run the temp app. this.logger.debug(__('Running example project...', tmpDir.cyan)); - let buildArgs = [ process.argv[1], 'build', '-p', 'android', '-d', tmpProjectDir ]; + let buildArgs = [ process.argv[1], 'build', '-p', 'android', '-d', tmpProjectDir, '--sdk', this.tiSdkVersion ]; if (this.target) { buildArgs.push('-T'); buildArgs.push(this.target); From fac2c4b82f39b0d12ee2c42ace4bf6567f52b3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Sat, 14 Sep 2024 18:06:13 +0200 Subject: [PATCH 37/88] fix(android): textfield padding (#13513) * Revert "Revert "fix(android): textfield padding (#13279)" (#13512)" This reverts commit 918388a75a98c3f5458d27f6ed035f11883b303e. * fix(android): fix input value * reset padding --------- Co-authored-by: m1ga Co-authored-by: Michael Gangolf --- .../modules/titanium/ui/widget/TiUIText.java | 56 ++++++++++++------ .../snapshots/textfieldPadding@2.75x.png | Bin 0 -> 3469 bytes tests/Resources/ti.ui.textfield.test.js | 37 ++++++++++++ 3 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 tests/Resources/android/snapshots/textfieldPadding@2.75x.png diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java index 0af9c82ac5d..da19265a5b2 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java @@ -67,6 +67,7 @@ public class TiUIText extends TiUIView implements TextWatcher, OnEditorActionLis private int viewHeightInLines; private int maxLines = Integer.MAX_VALUE; private int hintTextPadding; + private HashMap defaultPadding = new HashMap(); private InputFilterHandler inputFilterHandler; protected TiUIEditText tv; @@ -159,6 +160,11 @@ public boolean onKey(View v, int keyCode, KeyEvent event) textInputLayout.addView(this.tv, new TextInputLayout.LayoutParams( TextInputLayout.LayoutParams.MATCH_PARENT, TextInputLayout.LayoutParams.MATCH_PARENT)); + // store default padding + this.defaultPadding.put(TiC.PROPERTY_TOP, this.tv.getPaddingTop()); + this.defaultPadding.put(TiC.PROPERTY_RIGHT, this.tv.getPaddingRight()); + this.defaultPadding.put(TiC.PROPERTY_BOTTOM, this.tv.getPaddingBottom()); + this.defaultPadding.put(TiC.PROPERTY_LEFT, this.tv.getPaddingLeft()); setNativeView(textInputLayout); } @@ -326,28 +332,39 @@ private void updateTextField() private void setTextPadding(HashMap d) { - int paddingLeft = textInputLayout.getPaddingLeft(); - int paddingRight = textInputLayout.getPaddingRight(); - int paddingTop = textInputLayout.getPaddingTop(); - int paddingBottom = textInputLayout.getPaddingBottom(); - - if (d.containsKey(TiC.PROPERTY_LEFT)) { - paddingLeft = TiConvert.toInt(d.get(TiC.PROPERTY_LEFT), 0); - } + int paddingLeft = tv.getPaddingLeft(); + int paddingRight = tv.getPaddingRight(); + int paddingTop = tv.getPaddingTop(); + int paddingBottom = tv.getPaddingBottom(); + + if (d == null) { + // reset to default padding + paddingLeft = (int) this.defaultPadding.get(TiC.PROPERTY_LEFT); + paddingRight = (int) this.defaultPadding.get(TiC.PROPERTY_RIGHT); + paddingTop = (int) this.defaultPadding.get(TiC.PROPERTY_TOP); + paddingBottom = (int) this.defaultPadding.get(TiC.PROPERTY_BOTTOM); + } else { + if (d.containsKey(TiC.PROPERTY_LEFT)) { + paddingLeft = (int) TiConvert.toTiDimension(TiConvert.toInt(d.get(TiC.PROPERTY_LEFT), 0), + TiDimension.TYPE_LEFT).getAsPixels(textInputLayout); + } - if (d.containsKey(TiC.PROPERTY_RIGHT)) { - paddingRight = TiConvert.toInt(d.get(TiC.PROPERTY_RIGHT), 0); - } + if (d.containsKey(TiC.PROPERTY_RIGHT)) { + paddingRight = (int) TiConvert.toTiDimension(TiConvert.toInt(d.get(TiC.PROPERTY_RIGHT), 0), + TiDimension.TYPE_RIGHT).getAsPixels(textInputLayout); + } - if (d.containsKey(TiC.PROPERTY_TOP)) { - paddingTop = TiConvert.toInt(d.get(TiC.PROPERTY_TOP), 0); - } + if (d.containsKey(TiC.PROPERTY_TOP)) { + paddingTop = (int) TiConvert.toTiDimension(TiConvert.toInt(d.get(TiC.PROPERTY_TOP), 0), + TiDimension.TYPE_TOP).getAsPixels(textInputLayout); + } - if (d.containsKey(TiC.PROPERTY_BOTTOM)) { - paddingBottom = TiConvert.toInt(d.get(TiC.PROPERTY_BOTTOM), 0); + if (d.containsKey(TiC.PROPERTY_BOTTOM)) { + paddingBottom = (int) TiConvert.toTiDimension(TiConvert.toInt(d.get(TiC.PROPERTY_BOTTOM), 0), + TiDimension.TYPE_BOTTOM).getAsPixels(textInputLayout); + } } - - textInputLayout.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); + tv.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); } @Override @@ -984,6 +1001,9 @@ public void setHintText(int type, CharSequence hintText) this.textInputLayout.setHintEnabled(true); } + this.defaultPadding.put(TiC.PROPERTY_TOP, (type == UIModule.HINT_TYPE_ANIMATED) + ? this.hintTextPadding : this.defaultPadding.get(TiC.PROPERTY_BOTTOM)); + this.tv.setPadding( this.tv.getPaddingLeft(), (type == UIModule.HINT_TYPE_ANIMATED) ? this.hintTextPadding : this.tv.getPaddingBottom(), diff --git a/tests/Resources/android/snapshots/textfieldPadding@2.75x.png b/tests/Resources/android/snapshots/textfieldPadding@2.75x.png new file mode 100644 index 0000000000000000000000000000000000000000..86e7eb32cc3a95839e6b3f63f17939893bc7deaa GIT binary patch literal 3469 zcmd6q`9D9LfQed%%g1-==X(v^9+x$Em8c}%sln}EjJLSK^|B-7k|+|@ zZb?31Ap=1uLYSxRy~Fv-hj`4LXXA_gPfmRcf)wogkA<%6Xs(2BeBGPcqx-INCe}43 z7pF;Ekllir*UJjiQg2BWeR*?RGJWDv~B=8j)vNBfm<_)ixpI`a6Z}&bx zqP4Eu)h5_fJ-UaosV?R@E^JEh>lCT0t^GMq%&Ej+(%!szV~C;*z|u7JWo2bE^YcwF zUE*@hsS^`st=xU}O*VUAY3Zt-zJ9t{dC6j7bb+Ll6gPxhV2=-o6XWL-6pV|Dv((mp zz21z)-W*_V4pFK4^?s9OVe1Q)R#vA=%gP?u*?s8ZjIx5ge0_tnb+omw%E}s%8< zQc_dZh$h+KqIhw*2X%2OmF6Q8^X=|1#;KeT^82q{&9!c+(`U~b$l0Plm73(F8<&2t znY{OkN2JcKKf#b)I>;EQd{~~_KE3*1b3}h9DgRD;dV2a8Ta(O96uOez;gUxkfkL4) zqI~Nzj{Ebc1)FRjf!*Javaz-8YPPkoP^b>-O-xAeXA{EK-8)5Kv$M0yZ{=H_ycND4 zpx!bxWEH%>%aPp?KX-1L4u;}P|1<;y2I6rkDJfccF>)C_-`T$>e+b{OzdgSNTVLp} zLZeBjmKdY2aXnTN3*S){6^740=95TU(zN5}JM9r=p^gnUSFb1YvA#ZqC)%$f#&_ z)&JMh(nmVo?!1IVd1t3S9UoZU6{WYtU=-!&i*0ij3lkFzOUOSvQ$zs=Qdhixe#vr-PjSYXIQ^X%V;P;p6?C#h5ju#h3Z6`Jo z2*}^j|4he!dQe#b1a1m^=p|;b52~Z1V^5p*SBUxcbzpE1?-XBKtL$DwD_i#7S{b)T zNSkDT4qPM|(eH@y+d!dmv=emPGtnBmYVj_D4^0v6U~GI0g+jrC2}o4<4*OZ~>eM}& z6CsbTn76AIx_VJ5&(z+5FiyHACnrtd*VEJc61n3-)ZGvhf%UmyKW{RJ12>)E3~4Hr zDpTpLilAX(U6)~=9v&7NTTf24y;Wv!U~Vp8 zVrV!;zW|Af=v9pukjUO${KaG-o<3DE)z;CWN7EiGp}bIUq6 zA^#98IdX4v*nT{SNi~Y9-2FB7NSmpvoUC{iNo4egH=_ty@x3j z>B>cvg5VuK6s7l+kPseji*ei>X>Ff=f@xYiHoUUE$rK;udHb=EpDG+_NO=`@B3OXuWSxc8b0f5)$o*^VQKg6cik+M)V#=m)=LH%G&+N zz79Q25pw=fpefFbjg7T{!`146ititK*CZ3b4-}*w6pEa`pdNfxO$*5XReAX|=mK0r zK9^_gz(}P>ogG?3Ljw%O6cxRaTb!RK9}>{`7^;cKx-@d&oq9zD`=$@bmB0g zUk3U^#gvM6U{c^V7{~ssDG%@(b98X9gV0aVEb*y9%Cy~fa%Ebe%FHoQ)J6<{7e zx@v9%(nnTc{Q4EJuMP(Hv7|>=Dy*(0rKAL9SKG+#t^a_e!vT~}_X zNfJJjcqN~Uv#VCVeS66|93U&}S|!D+C;ONnc{U9~%9;<3`^wcdFbJIQ2~ms*4^%X@ z#~3`vBo`Rxoq{Jxn@U}-&n&m1%A*{VfmECdY_U#ZSy6#8ZjzFMx72*rFTLb2kW^nE8?N$yB ztcY_d`sDU?C}37mQL$m|)?|c^d(C4@D578gidp_t_Op@C_i$)t&X=mHWU%nt;?1ko zi+0R-k ze@XyAp?9|?qr-h*3L+IvO%Y{p=CT029RwJOod5O9tA|=4)+v&endwg~h-5#Wo?W*E z){>BL?D%n6W#vpc?ix}4A?~Kge>Nt3i;&%dc*+ZPzg#~v2M#H88L^(j5?ZXyH$gxNpvQWVWT9Cfu&l(;)lZ<5*75l|s|Utql#20#MvnhxkT- z%;MqWWY z^U@uK&Jn0za|eaOcv02Vlz&1%K%F_l3Z?>Dx3;!+xez;6V=e-#0&l+xHNkI_^qpWo|idWrojh=%`x&HT9V>C+ZQMu{`TDwvDQQoKaeJ28`s zjjhmGIMT$?Q5>liNq?L7PvIdx{-3EA)GrhJ-IYS(7_pd^?WEw}6Pltr55ba>uX~9^ z>5vo9Y8x*fpHJJ{@E)lP85tRsWo4bLdts94V=YA#ub7$4?RH9E2H&k9}oyx z2&AyMxY(5m1QWi)ss}3BA15MU%sT96=)b) zT3V*RJbwAOF!*D7`YAvUOU}sIbW_P5%C+9ZH@rMOi$W&C;@jHV+`}>p0HL(h)8mQc z?rmivku02}i;H9=XFkWu$w_{vYhNUw6(X(0(Gi!BhbwKZBSmlI-rQ?|3vX(0CjsAfG~yH(cOI{C@9GC#f#cG r+}pcxfBXN1U0;4s!oUA0@Q=Vi)757U%!X#*NCh&|Gt)(DKY9H>D*3T> literal 0 HcmV?d00001 diff --git a/tests/Resources/ti.ui.textfield.test.js b/tests/Resources/ti.ui.textfield.test.js index 30bee55770d..7d33e739b92 100644 --- a/tests/Resources/ti.ui.textfield.test.js +++ b/tests/Resources/ti.ui.textfield.test.js @@ -144,6 +144,43 @@ describe('Titanium.UI.TextField', () => { win.open(); }); + it.android('android padding (visual check)', function (finish) { + this.timeout(5000); + const textField = Ti.UI.createTextField({ + value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec ullamcorper massa, eget tempor sapien. Phasellus nisi metus, tempus a magna nec, ultricies rutrum lacus. Aliquam sit amet augue suscipit, dignissim tellus eu, consectetur elit. Praesent ligula velit, blandit vel urna sit amet, suscipit euismod nunc.', + width: 100, + height: 40, + backgroundColor: 'white', + color: 'black', + padding: { + top: 10, + bottom: 10 + } + }); + const bgView = Ti.UI.createView({ + width: 200, + height: 100, + backgroundColor: 'red' + }); + win = Ti.UI.createWindow({ + backgroundColor: '#eee' + }); + bgView.add(textField); + win.add(bgView); + + win.addEventListener('postlayout', function postlayout() { // FIXME: Support once! + win.removeEventListener('postlayout', postlayout); // only run once + try { + should(textField).matchImage('snapshots/textfieldPadding.png'); + } catch (err) { + return finish(err); + } + finish(); + }); + + win.open(); + }); + describe('.hintText', () => { let textField; beforeEach(() => { From d1c05edf9efa759e5f0186dcca2f12b3a5979f71 Mon Sep 17 00:00:00 2001 From: hansemannn Date: Mon, 16 Sep 2024 00:07:09 +0000 Subject: [PATCH 38/88] Apply automatic changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2ce0db7e75..91ae530b24d 100644 --- a/README.md +++ b/README.md @@ -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) 🚀. -Rene PotRodrigo FarfánMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn GouldJoaquin Maroto +Rene PotRodrigo FarfánMatt Delmarterdlewis23Daniel EthierJoe KniesekVittorio SorberaMarcus OlovssonAlessandro La RoccaReshopperGusJason David MillerMichael ZaladonisVincenzo QuacquarelliMighty GmbHFruugulKorelogic LimitedJohn Gould ## Features From 7e5f1ade3bd9cdd1cd8159f069b9cce76dcc6592 Mon Sep 17 00:00:00 2001 From: Abdullah Al-Faqeir Date: Mon, 16 Sep 2024 12:00:23 +0300 Subject: [PATCH 39/88] fix(ios): pause returns false (#14114) --- iphone/Classes/TiMediaAudioPlayerProxy.m | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/iphone/Classes/TiMediaAudioPlayerProxy.m b/iphone/Classes/TiMediaAudioPlayerProxy.m index 59e47ad36a9..12941a0c393 100644 --- a/iphone/Classes/TiMediaAudioPlayerProxy.m +++ b/iphone/Classes/TiMediaAudioPlayerProxy.m @@ -472,11 +472,7 @@ - (void)handleTimeControlStatusNotification:(NSNotification *)note if (_player.timeControlStatus == AVPlayerTimeControlStatusPlaying) { _state = TiAudioPlayerStatePlaying; } else if (_player.timeControlStatus == AVPlayerTimeControlStatusPaused) { - if (_player.currentItem.currentTime.value == 0.0 || oldState == TiAudioPlayerStateStopping) { - _state = TiAudioPlayerStateStopped; - } else { - _state = TiAudioPlayerStatePaused; - } + _state = TiAudioPlayerStatePaused; } else if (_player.timeControlStatus == AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate) { _state = TiAudioPlayerStateWaitingForQueueToStart; } From cd0b55fd4a7263b96f31918f229cf3f1b6de0aa0 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Mon, 16 Sep 2024 11:02:01 +0200 Subject: [PATCH 40/88] docs: update NotificationChannel example (#14107) --- apidoc/Titanium/Android/NotificationChannel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apidoc/Titanium/Android/NotificationChannel.yml b/apidoc/Titanium/Android/NotificationChannel.yml index aeda2e4bfde..d108242eda1 100644 --- a/apidoc/Titanium/Android/NotificationChannel.yml +++ b/apidoc/Titanium/Android/NotificationChannel.yml @@ -25,7 +25,7 @@ examples: icon: Ti.Android.R.drawable.ic_dialog_info, contentTitle: 'TITLE', contentText : 'This is a test', - channelId: channel.getId() + channelId: channel.id }); Ti.Android.NotificationManager.notify(100, notification); From 5baf6a1840c134c785f28bd224c1466757059cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Mon, 16 Sep 2024 11:02:20 +0200 Subject: [PATCH 41/88] =?UTF-8?q?feat(ios):=20add=20=E2=80=9CinteractiveDi?= =?UTF-8?q?smissModeEnabled=E2=80=9D=20API=20(#14103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ios): add “interactiveDismissModeEnabled” API * chore: add docs --- apidoc/Titanium/UI/NavigationWindow.yml | 10 ++++++ apidoc/Titanium/UI/TabGroup.yml | 10 ++++++ iphone/Classes/TiUINavigationWindowProxy.h | 2 ++ iphone/Classes/TiUINavigationWindowProxy.m | 38 ++++++++++++++++++++++ iphone/Classes/TiUITabProxy.h | 2 ++ iphone/Classes/TiUITabProxy.m | 38 ++++++++++++++++++++++ 6 files changed, 100 insertions(+) diff --git a/apidoc/Titanium/UI/NavigationWindow.yml b/apidoc/Titanium/UI/NavigationWindow.yml index b173599898e..83e9098e85d 100644 --- a/apidoc/Titanium/UI/NavigationWindow.yml +++ b/apidoc/Titanium/UI/NavigationWindow.yml @@ -31,6 +31,16 @@ properties: availability: creation optional: false + - name: interactiveDismissModeEnabled + summary: | + A boolean indicating whether or not child windows of this navigation window + should have the ability to be swipe-to-closed over the full width of it's window or not. + type: Boolean + default: false + platforms: [iphone, ipad, macos] + since: "12.5.0" + availability: creation + methods: - name: closeWindow summary: Closes a window and removes it from the navigation window. diff --git a/apidoc/Titanium/UI/TabGroup.yml b/apidoc/Titanium/UI/TabGroup.yml index c789b8a7624..66cbf4c1d4b 100644 --- a/apidoc/Titanium/UI/TabGroup.yml +++ b/apidoc/Titanium/UI/TabGroup.yml @@ -609,6 +609,16 @@ properties: platforms: [android, iphone, ipad, macos] since: "12.1.0" + - name: interactiveDismissModeEnabled + summary: | + A boolean indicating whether or not child windows of this tab group + should have the ability to be swipe-to-closed over the full width of it's window or not. + type: Boolean + default: false + platforms: [iphone, ipad, macos] + since: "12.5.0" + availability: creation + examples: - title: Alloy XML Markup example: | diff --git a/iphone/Classes/TiUINavigationWindowProxy.h b/iphone/Classes/TiUINavigationWindowProxy.h index f5777d15981..f7324480351 100644 --- a/iphone/Classes/TiUINavigationWindowProxy.h +++ b/iphone/Classes/TiUINavigationWindowProxy.h @@ -16,6 +16,8 @@ TiWindowProxy *current; BOOL transitionIsAnimating; BOOL transitionWithGesture; + + UIPanGestureRecognizer *fullWidthBackGestureRecognizer; } // Private API diff --git a/iphone/Classes/TiUINavigationWindowProxy.m b/iphone/Classes/TiUINavigationWindowProxy.m index 1c47611fb7b..ac13e26b1c8 100644 --- a/iphone/Classes/TiUINavigationWindowProxy.m +++ b/iphone/Classes/TiUINavigationWindowProxy.m @@ -16,9 +16,16 @@ @implementation TiUINavigationWindowProxy - (void)_destroy { + if (fullWidthBackGestureRecognizer != nil) { + [fullWidthBackGestureRecognizer setDelegate:nil]; + [navController.view removeGestureRecognizer:fullWidthBackGestureRecognizer]; + } + RELEASE_TO_NIL(rootWindow); RELEASE_TO_NIL(navController); RELEASE_TO_NIL(current); + RELEASE_TO_NIL(fullWidthBackGestureRecognizer); + [super _destroy]; } @@ -88,14 +95,45 @@ - (UINavigationController *)controller [TiUtils configureController:navController withObject:self]; [navController.interactivePopGestureRecognizer addTarget:self action:@selector(popGestureStateHandler:)]; [[navController interactivePopGestureRecognizer] setDelegate:self]; + + BOOL interactiveDismissModeEnabled = [TiUtils boolValue:[self valueForKey:@"interactiveDismissModeEnabled"] def:NO]; + if (interactiveDismissModeEnabled) { + [self configureFullWidthSwipeToClose]; + } } return navController; } +- (void)configureFullWidthSwipeToClose +{ + fullWidthBackGestureRecognizer = [[UIPanGestureRecognizer alloc] init]; + + if (navController.interactivePopGestureRecognizer == nil) { + return; + } + + id targets = [navController.interactivePopGestureRecognizer valueForKey:@"targets"]; + if (targets == nil) { + return; + } + + [fullWidthBackGestureRecognizer setValue:targets forKey:@"targets"]; + [fullWidthBackGestureRecognizer setDelegate:self]; + [navController.view addGestureRecognizer:fullWidthBackGestureRecognizer]; +} + - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { BOOL isRootWindow = (current == rootWindow); + BOOL interactiveDismissModeEnabled = [TiUtils boolValue:[self valueForKey:@"interactiveDismissModeEnabled"] def:NO]; + if (interactiveDismissModeEnabled && [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { + BOOL isSystemSwipeToCloseEnabled = navController.interactivePopGestureRecognizer.isEnabled == YES; + BOOL areThereStackedViewControllers = navController.viewControllers.count > 1; + + return isSystemSwipeToCloseEnabled || areThereStackedViewControllers; + } + if (current != nil && !isRootWindow) { return [TiUtils boolValue:[current valueForKey:@"swipeToClose"] def:YES]; } diff --git a/iphone/Classes/TiUITabProxy.h b/iphone/Classes/TiUITabProxy.h index f44e5dadb20..f4ef08abe18 100644 --- a/iphone/Classes/TiUITabProxy.h +++ b/iphone/Classes/TiUITabProxy.h @@ -30,6 +30,8 @@ BOOL activeIconOriginal; id parentOrientationController; + + UIPanGestureRecognizer *fullWidthBackGestureRecognizer; } - (void)setTabGroup:(TiUITabGroupProxy *)proxy; diff --git a/iphone/Classes/TiUITabProxy.m b/iphone/Classes/TiUITabProxy.m index c14e0ff3ce0..4f33b856b89 100644 --- a/iphone/Classes/TiUITabProxy.m +++ b/iphone/Classes/TiUITabProxy.m @@ -32,6 +32,11 @@ - (void)_destroy { [[NSNotificationCenter defaultCenter] removeObserver:self name:kTiTraitCollectionChanged object:nil]; + if (fullWidthBackGestureRecognizer != nil) { + [fullWidthBackGestureRecognizer setDelegate:nil]; + [controller.view removeGestureRecognizer:fullWidthBackGestureRecognizer]; + } + if (rootWindow != nil) { [self cleanNavStack:YES]; } @@ -39,6 +44,8 @@ - (void)_destroy RELEASE_TO_NIL(rootWindow); RELEASE_TO_NIL(controller); RELEASE_TO_NIL(current); + RELEASE_TO_NIL(fullWidthBackGestureRecognizer); + [super _destroy]; } @@ -260,12 +267,43 @@ - (UINavigationController *)controller [controllerStack addObject:[self rootController]]; [controller.interactivePopGestureRecognizer addTarget:self action:@selector(popGestureStateHandler:)]; [[controller interactivePopGestureRecognizer] setDelegate:self]; + + BOOL interactiveDismissModeEnabled = [TiUtils boolValue:[tabGroup valueForKey:@"interactiveDismissModeEnabled"] def:NO]; + if (interactiveDismissModeEnabled) { + [self configureFullWidthSwipeToClose]; + } } return controller; } +- (void)configureFullWidthSwipeToClose +{ + fullWidthBackGestureRecognizer = [[UIPanGestureRecognizer alloc] init]; + + if (controller.interactivePopGestureRecognizer == nil) { + return; + } + + id targets = [controller.interactivePopGestureRecognizer valueForKey:@"targets"]; + if (targets == nil) { + return; + } + + [fullWidthBackGestureRecognizer setValue:targets forKey:@"targets"]; + [fullWidthBackGestureRecognizer setDelegate:self]; + [controller.view addGestureRecognizer:fullWidthBackGestureRecognizer]; +} + - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { + BOOL interactiveDismissModeEnabled = [TiUtils boolValue:[self valueForKey:@"interactiveDismissModeEnabled"] def:NO]; + if (interactiveDismissModeEnabled && [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { + BOOL isSystemSwipeToCloseEnabled = controller.interactivePopGestureRecognizer.isEnabled == YES; + BOOL areThereStackedViewControllers = controller.viewControllers.count > 1; + + return isSystemSwipeToCloseEnabled || areThereStackedViewControllers; + } + if (current != nil) { return [TiUtils boolValue:[current valueForKey:@"swipeToClose"] def:YES]; } From 322b09bc09153c3e5adcd6570199b4d82c41f994 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Mon, 16 Sep 2024 11:02:50 +0200 Subject: [PATCH 42/88] feat(android): more log output (#13999) * feat(android): more log output * remove if * change for loop * Update android/runtime/v8/src/native/modules/APIModule.cpp Co-authored-by: Chris Barber --------- Co-authored-by: Chris Barber --- android/runtime/v8/src/native/modules/APIModule.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/runtime/v8/src/native/modules/APIModule.cpp b/android/runtime/v8/src/native/modules/APIModule.cpp index a2628327880..c460ac87dc2 100644 --- a/android/runtime/v8/src/native/modules/APIModule.cpp +++ b/android/runtime/v8/src/native/modules/APIModule.cpp @@ -115,7 +115,13 @@ void APIModule::logInfo(const FunctionCallbackInfo& args) Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); v8::String::Utf8Value message(isolate, APIModule::combineLogMessages(args)); - APIModule::logInternal(LOG_LEVEL_INFO, LCAT, *message); + + std::string cppStr(*message); + + int maxChunk = 4050; + for (size_t i = 0, len = cppStr.length(); i < len; i+=maxChunk) { + APIModule::logInternal(LOG_LEVEL_INFO, LCAT, cppStr.substr(i , maxChunk).c_str()); + } } void APIModule::logWarn(const FunctionCallbackInfo& args) From abbd387dedeec56ce1841196bf04e92a7622e410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Mon, 16 Sep 2024 11:17:49 +0200 Subject: [PATCH 43/88] feat: add 12.5.0.GA changelog # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca98a09d798..584645fff44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,93 @@ +# [12.5.0](https://github.com/tidev/titanium_mobile/compare/12_4_X...12.5.0) (2024-09-16) + +## About this release + +Titanium SDK 12.5.0 is a minor release of the SDK, adding new features and platform updates. It also adds stable support for +iOS 18 and Xcode 16, the latest software in the Apple ecosystem. + +## Community Credits + +* Michael Gangolf + * forward --sdk in module build process ([07f435d](https://github.com/tidev/titanium_mobile/commit/07f435d836f644ec469f9f7485682b74d25e0699)) + * more log output ([694766b](https://github.com/tidev/titanium_mobile/commit/694766b63323e3fee70e64abee07841b267fdce7)) + * statusBarColor for Window ([91499ef](https://github.com/tidev/titanium_mobile/commit/91499efadc6cc1c9a8fd2c82cdddf4ddd340f213)) + * flatten ListView layout ([b9fd683](https://github.com/tidev/titanium_mobile/commit/b9fd68326f1dca7f7dc4eeb20e9fffa881dbce6d)) + * add maxImages and pathOnly to openPhotoGallery ([3eda594](https://github.com/tidev/titanium_mobile/commit/3eda594e2721651a412a9557f6a05830c19efb29)) + * fire `selected` event again when clicking the same Tab again ([dfb1b5c](https://github.com/tidev/titanium_mobile/commit/dfb1b5c312cbfac159fbae4d7277330dad71d6e0)) + * enable Signature Scheme v3 ([c719bcd](https://github.com/tidev/titanium_mobile/commit/c719bcd5cd061cccaefe888b8edaf7f25143f412)) + * update cmake, checkstyle ([8846f07](https://github.com/tidev/titanium_mobile/commit/8846f07955e0157ff134c122bd544f66c2fdb501)) + * fix tintColor and activeTintColor in a TabbedBar ([2e92f1d](https://github.com/tidev/titanium_mobile/commit/2e92f1ddd00b9610ff9a6fc14775545b7cdf089e)) + * set targetSDK to Android 34 ([5fc81f0](https://github.com/tidev/titanium_mobile/commit/5fc81f08bdb3f9ba64d9cb4972848c8523f2d190)) + * fix Actionbar backgroundImage doc and improve setter ([803bd04](https://github.com/tidev/titanium_mobile/commit/803bd04350df89f2197842d110ad3c0384a97c7f)) + * keep Tab tintColor when changing icons ([51be366](https://github.com/tidev/titanium_mobile/commit/51be36662445ad4755438a7f1b511a837196df69)) + * fix titleAttribute when it's not a creation parameter ([017c052](https://github.com/tidev/titanium_mobile/commit/017c0524dc1a76527a8ba342964ea881633492d5)) + +* Hans Knöchel + * add “interactiveDismissModeEnabled” API ([1d2cdd5](https://github.com/tidev/titanium_mobile/commit/1d2cdd5ff802fcc628ab67cd1a882117b1e74c00)) + * textfield padding ([d75fc9e](https://github.com/tidev/titanium_mobile/commit/d75fc9efb225aa798101388d6ba50d9751a2847a)) + * Revert "fix(ios): fix unbalanced view controller transitions causing issues on iOS 16+ (#13586)" ([b9932b2](https://github.com/tidev/titanium_mobile/commit/b9932b2f3929a19523a29a453710afecb84ea7f7)) + * bump master to 12.5.0 ([52cab42](https://github.com/tidev/titanium_mobile/commit/52cab4293d6c9a0472428f4ed0d0fb7566ebb530)) + * add 12.5.0 changelog ([e5e3f33](https://github.com/tidev/titanium_mobile/commit/e5e3f33323e65593f69eda2fc56f750e7611ec7a)) + +* Abdullah Al-Faqeir + * pause returns false ([e577bce](https://github.com/tidev/titanium_mobile/commit/e577bce9b640974ce92a9ad209846fa2f5b7915b)) + +## Bug Fixes + +### Android platform + +* fix Actionbar backgroundImage doc and improve setter ([803bd04](https://github.com/tidev/titanium_mobile/commit/803bd04350df89f2197842d110ad3c0384a97c7f)) +* fix tintColor and activeTintColor in a TabbedBar ([2e92f1d](https://github.com/tidev/titanium_mobile/commit/2e92f1ddd00b9610ff9a6fc14775545b7cdf089e)) +* fix titleAttribute when it's not a creation parameter ([017c052](https://github.com/tidev/titanium_mobile/commit/017c0524dc1a76527a8ba342964ea881633492d5)) +* keep Tab tintColor when changing icons ([51be366](https://github.com/tidev/titanium_mobile/commit/51be36662445ad4755438a7f1b511a837196df69)) +* textfield padding ([d75fc9e](https://github.com/tidev/titanium_mobile/commit/d75fc9efb225aa798101388d6ba50d9751a2847a)) + +### iOS platform + +* pause returns false ([e577bce](https://github.com/tidev/titanium_mobile/commit/e577bce9b640974ce92a9ad209846fa2f5b7915b)) + +### Multiple platforms + +* sdk build on windows needs shell: true to run batch files ([f3e5a0b](https://github.com/tidev/titanium_mobile/commit/f3e5a0bd90eb75dfa7ec0c5e6a4b4cc39ac4b95a)) + +## Features + +### Multiple platforms + +* add 12.4.0.GA changelog ([9388600](https://github.com/tidev/titanium_mobile/commit/9388600a951db750e188eaca6c14b6e1683ffd7c)) +* add 12.5.0 changelog ([e5e3f33](https://github.com/tidev/titanium_mobile/commit/e5e3f33323e65593f69eda2fc56f750e7611ec7a)) + +### Android platform + +* add maxImages and pathOnly to openPhotoGallery ([3eda594](https://github.com/tidev/titanium_mobile/commit/3eda594e2721651a412a9557f6a05830c19efb29)) +* enable Signature Scheme v3 ([c719bcd](https://github.com/tidev/titanium_mobile/commit/c719bcd5cd061cccaefe888b8edaf7f25143f412)) +* fire `selected` event again when clicking the same Tab again ([dfb1b5c](https://github.com/tidev/titanium_mobile/commit/dfb1b5c312cbfac159fbae4d7277330dad71d6e0)) +* flatten ListView layout ([b9fd683](https://github.com/tidev/titanium_mobile/commit/b9fd68326f1dca7f7dc4eeb20e9fffa881dbce6d)) +* more log output ([694766b](https://github.com/tidev/titanium_mobile/commit/694766b63323e3fee70e64abee07841b267fdce7)) +* set targetSDK to Android 34 ([5fc81f0](https://github.com/tidev/titanium_mobile/commit/5fc81f08bdb3f9ba64d9cb4972848c8523f2d190)) +* statusBarColor for Window ([91499ef](https://github.com/tidev/titanium_mobile/commit/91499efadc6cc1c9a8fd2c82cdddf4ddd340f213)) + +### iOS platform + +* add “interactiveDismissModeEnabled” API ([1d2cdd5](https://github.com/tidev/titanium_mobile/commit/1d2cdd5ff802fcc628ab67cd1a882117b1e74c00)) + +## BREAKING CHANGES + + +## SDK Module Versions + +| Module | Android version | iOS Version | +| ----------- | --------------- | ----------- | +| facebook | 12.1.0 | 14.0.0 | +| ti.map | 5.6.1 | 7.3.1 | +| ti.webdialog | 2.3.0 | 3.0.2 | +| ti.playservices | 18.3.0 | n/a | +| ti.identity | 3.1.0 | 5.0.0 | +| urlSession | n/a | 4.0.1 | +| ti.coremotion | n/a | 4.0.1 | +| ti.applesignin | n/a | 3.1.2 | +| hyperloop | 7.0.6 | 7.0.6 | + # [12.4.0](https://github.com/tidev/titanium_mobile/compare/12_3_X...12.4.0) (2024-07-17) ## About this release From 6cc8830f874474a176cc181390e4d3c18f7b8b38 Mon Sep 17 00:00:00 2001 From: Abdullah Al-Faqeir Date: Mon, 16 Sep 2024 13:17:11 +0300 Subject: [PATCH 44/88] fix(android): ios click speed (#14115) * fix(android): ios click speed * fix(android): remove listener from touch end event --- iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m index f433f0bd01f..3f0331e6921 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m @@ -1312,6 +1312,7 @@ - (UITapGestureRecognizer *)singleTapRecognizer { if (singleTapRecognizer == nil) { singleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recognizedTap:)]; + [singleTapRecognizer setNumberOfTapsRequired:1]; [self configureGestureRecognizer:singleTapRecognizer]; [self addGestureRecognizer:singleTapRecognizer]; if (doubleTapRecognizer != nil) { @@ -1434,6 +1435,8 @@ - (void)recognizedTap:(UITapGestureRecognizer *)recognizer [proxy fireEvent:@"dblclick" withObject:event propagate:YES]; } [proxy fireEvent:@"doubletap" withObject:event]; + } else if ([recognizer numberOfTapsRequired] == 1 && [proxy _hasListeners:@"click"]) { + [proxy fireEvent:@"click" withObject:event propagate:YES]; } else { [proxy fireEvent:@"singletap" withObject:event]; } @@ -1609,12 +1612,7 @@ - (void)processTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event // Click handling is special; don't propagate if we have a delegate, // but DO invoke the touch delegate. // clicks should also be handled by any control the view is embedded in. - if ([touch tapCount] == 1 && [proxy _hasListeners:@"click"]) { - if (touchDelegate == nil) { - [proxy fireEvent:@"click" withObject:evt propagate:YES]; - return; - } - } else if ([touch tapCount] == 2 && [proxy _hasListeners:@"dblclick"]) { + if ([touch tapCount] == 2 && [proxy _hasListeners:@"dblclick"]) { [proxy fireEvent:@"dblclick" withObject:evt propagate:YES]; return; } From d084485ed0bd0c0bfcc84154ad543be4ccdd59cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Mon, 16 Sep 2024 13:38:39 +0200 Subject: [PATCH 45/88] feat: update hyperloop to 7.0.7 --- support/module/packaged/modules.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/module/packaged/modules.json b/support/module/packaged/modules.json index 2d69caef138..9c7bb9c9a84 100644 --- a/support/module/packaged/modules.json +++ b/support/module/packaged/modules.json @@ -54,8 +54,8 @@ "commonjs": {}, "hyperloop": { "hyperloop": { - "url": "https://github.com/tidev/hyperloop.next/releases/download/v7.0.6/hyperloop-7.0.6.zip", - "integrity": "sha512-ZHmm7GINiCyrjvNMn232G1Tkby6PhwsmSxPZlPNDWH4jRn6iCpjIqX1Ha12MBedma01a4hlvARLaiUQ9j3SPow==" + "url": "https://github.com/tidev/hyperloop.next/releases/download/v7.0.7/hyperloop-7.0.7.zip", + "integrity": "sha512-+CF+1G1ClJZrY4VzrZMUCX37JT/tSGvnWWUXouiAtd6WLlPPvUI+Q7ytNoTm/q/g/hPwiiV6qzV9Rgm61qsXOg==" } } } From 50d8604ea40b4c2aacb55ee1128a2706f421715c Mon Sep 17 00:00:00 2001 From: Abdullah Al-Faqeir Date: Tue, 17 Sep 2024 10:26:35 +0300 Subject: [PATCH 46/88] chore(android): gradle 8 (#14014) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(android): let there be gradle 8 chore(android): fixed deprecations in kroll-apt project chore(android): made kroll-apt incremental to enhance build time * fix(android): revert change to java files fix(android): gradle 8 compatibility update to template build.gradle fix(android): revert dependency updates fix(android): revert minSdk and targetSdk * fix(android): kitchensink-app not running after gradle 8 fix(android): update _build.js & _buildModule.js for new gradle * Update android/app/build.gradle Co-authored-by: Chris Barber * Update android/templates/build/ti.constants.gradle Co-authored-by: Chris Barber * Update android/titanium/build.gradle Co-authored-by: Chris Barber * Update android/titanium/build.gradle Co-authored-by: Chris Barber * Update android/untar.gradle Co-authored-by: Chris Barber * Update android/titanium/build.gradle Co-authored-by: Chris Barber * fix material.r * github action * optimize material imports * optimize material imports * fix(android): fix module building * fix(android): bump ndk version for generated modules --------- Co-authored-by: Hans Knöchel Co-authored-by: Chris Barber Co-authored-by: Michael Gangolf Co-authored-by: Michael Gangolf --- .github/workflows/build.yml | 12 +- .github/workflows/release.yml | 10 +- android/.gitignore | 1 + android/.idea/codeStyles/Project.xml | 3 + android/app/build.gradle | 14 +- android/build.gradle | 8 +- android/cli/commands/_build.js | 6 +- android/cli/commands/_buildModule.js | 6 - android/gradle.properties | 3 - .../gradle/wrapper/gradle-wrapper.properties | 3 +- android/kroll-apt/build.gradle | 7 +- .../generator/KrollJSONGenerator.java | 2 +- .../gradle/incremental.annotation.processors | 1 + .../ti/modules/titanium/ui/PickerProxy.java | 2 +- .../titanium/ui/widget/TiImageView.java | 2 +- .../ui/widget/TiUIActivityIndicator.java | 2 +- .../titanium/ui/widget/TiUIButton.java | 2 +- .../titanium/ui/widget/TiUIButtonBar.java | 4 +- .../titanium/ui/widget/TiUIOptionBar.java | 12 +- .../titanium/ui/widget/TiUITabbedBar.java | 2 +- .../modules/titanium/ui/widget/TiUIText.java | 2 +- .../widget/listview/TiRecyclerViewHolder.java | 5 +- .../ui/widget/searchbar/TiUISearchBar.java | 2 +- .../widget/tabgroup/TiUIAbstractTabGroup.java | 2 +- android/settings.gradle | 4 +- android/templates/build/AndroidManifest.xml | 1 - android/templates/build/app.build.gradle | 8 +- android/templates/build/root.build.gradle | 7 +- android/templates/build/ti.constants.gradle | 3 +- .../templates/module/generated/build.gradle | 33 ++-- android/titanium/AndroidManifest.xml | 27 +-- android/titanium/build.gradle | 162 +++++++++++------- android/untar.gradle | 72 ++++---- 33 files changed, 238 insertions(+), 192 deletions(-) create mode 100644 android/kroll-apt/src/main/resources/META-INF/gradle/incremental.annotation.processors diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0c0afcb02d..7ee41f0c410 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,8 @@ jobs: - name: Android build uses: ./.github/actions/build-android with: - node-version: '16.x' - java-version: '11' + node-version: '18.x' + java-version: '17' ios: runs-on: macos-13 @@ -39,7 +39,7 @@ jobs: - name: iOS build uses: ./.github/actions/build-ios with: - node-version: '16.x' + node-version: '18.x' js: runs-on: ubuntu-latest @@ -50,10 +50,10 @@ jobs: with: fetch-depth: 0 - - name: Use Node.js 16.x + - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' cache: 'npm' - name: Install dependencies @@ -84,5 +84,5 @@ jobs: uses: ./.github/actions/package with: node-version: '16.x' - java-version: '11' + java-version: '17' vtag: ${{ env.vtag }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ab7e263666..120c547b08c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,8 +77,8 @@ jobs: - name: Android build uses: ./.github/actions/build-android with: - node-version: '16.x' - java-version: '11' + node-version: '18.x' + java-version: '17' ios: runs-on: macos-13 @@ -97,7 +97,7 @@ jobs: - name: iOS build uses: ./.github/actions/build-ios with: - node-version: '16.x' + node-version: '18.x' package: runs-on: macos-12 @@ -116,8 +116,8 @@ jobs: - name: Package uses: ./.github/actions/package with: - node-version: '16.x' - java-version: '11' + node-version: '18.x' + java-version: '17' vtag: ${{ env.vtag }} release: diff --git a/android/.gitignore b/android/.gitignore index 56cacb3ced2..b6bd8f6c33d 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -14,3 +14,4 @@ build/ /kroll-apt/bin/ /local.properties /titanium/assets/Resources/ti.internal/build.properties +/.idea/ diff --git a/android/.idea/codeStyles/Project.xml b/android/.idea/codeStyles/Project.xml index 8d13c04b12c..36d210ea229 100644 --- a/android/.idea/codeStyles/Project.xml +++ b/android/.idea/codeStyles/Project.xml @@ -9,6 +9,9 @@ + +