Skip to content

Commit ff6d9d5

Browse files
authored
Merge branch 'master' into bottomNavigationXML
2 parents 62a6168 + 5dd0259 commit ff6d9d5

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

android/cli/commands/_buildModule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ AndroidModuleBuilder.prototype.migrate = async function migrate() {
5858
const manifestModuleAPIVersion = this.manifest.apiversion;
5959
const manifestTemplateFile = path.join(this.platformPath, 'templates', 'module', 'default', 'template', 'android', 'manifest.ejs');
6060
let newVersion = semver.inc(this.manifest.version, 'major');
61-
this.tiSdkVersion = cliSDKVersion;
61+
this.tiSdkVersion = this.cli.sdk.name;
6262

6363
// Determine if the "manifest" file's "apiversion" needs updating.
6464
let isApiVersionUpdateRequired = false;

android/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ org.gradle.jvmargs=-Xmx1536m
1212
# Note: Jetifier is not needed for test app since it doesn't use Google's deprecated support libraries.
1313
android.useAndroidX=true
1414
android.enableJetifier=false
15+
android.nonTransitiveRClass=false

android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java

+2
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
153153
payload.put(TiC.PROPERTY_DIRECTION, "up");
154154
} else if (dy < 0) {
155155
payload.put(TiC.PROPERTY_DIRECTION, "down");
156+
} else {
157+
payload.put(TiC.PROPERTY_DIRECTION, "unknown");
156158
}
157159
payload.put(TiC.EVENT_PROPERTY_VELOCITY, 0);
158160
if (continuousUpdate) {

apidoc/Titanium/UI/ListView.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ events:
648648
ipad: 5.4.0
649649
properties:
650650
- name: direction
651-
summary: Direction of the scroll either 'up', or 'down'.
651+
summary: Direction of the scroll either 'up', 'down' or 'unknown'.
652652
type: String
653653

654654
- name: velocity

apidoc/Titanium/UI/TableView.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ events:
453453
since: { android: "2.1.0", iphone: "2.1.0", ipad: "2.1.0" }
454454
properties:
455455
- name: direction
456-
summary: Direction of the swipe, either `left` or `right`.
456+
summary: Direction of the swipe, either `left`, `right` or `unknown`.
457457
type: String
458458

459459
- name: index

iphone/Classes/TiUIListView.m

+15-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ @interface TiUIListView ()
2424
@property (nonatomic, readonly) TiUIListViewProxy *listViewProxy;
2525
@property (nonatomic, copy, readwrite) NSString *searchString;
2626
@property (nonatomic, copy, readwrite) NSString *searchedString;
27+
@property (nonatomic, assign) CGFloat lastContentOffset;
2728
@end
2829

2930
static TiViewProxy *FindViewProxyWithBindIdContainingPoint(UIView *view, CGPoint point);
@@ -79,8 +80,8 @@ @implementation TiUIListView {
7980
BOOL isSearched;
8081
UIView *dimmingView;
8182
BOOL isSearchBarInNavigation;
82-
int lastVisibleItem;
83-
int lastVisibleSection;
83+
NSInteger lastVisibleItem;
84+
NSInteger lastVisibleSection;
8485
BOOL forceUpdates;
8586
}
8687

@@ -2011,6 +2012,15 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
20112012
TiUIListSectionProxy *section;
20122013
CGFloat topSpacing = scrollView.contentOffset.y + scrollView.adjustedContentInset.top;
20132014

2015+
NSString *direction = @"unknown";
2016+
2017+
if (self.lastContentOffset > scrollView.contentOffset.y) {
2018+
direction = @"down";
2019+
} else if (self.lastContentOffset < scrollView.contentOffset.y) {
2020+
direction = @"up";
2021+
}
2022+
self.lastContentOffset = scrollView.contentOffset.y;
2023+
20142024
if ([indexPaths count] > 0) {
20152025
NSIndexPath *indexPath = [self pathForSearchPath:[indexPaths objectAtIndex:0]];
20162026
NSUInteger visibleItemCount = [indexPaths count];
@@ -2022,6 +2032,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
20222032
[eventArgs setValue:section forKey:@"firstVisibleSection"];
20232033
[eventArgs setValue:[section itemAtIndex:[indexPath row]] forKey:@"firstVisibleItem"];
20242034
[eventArgs setValue:NUMINTEGER(topSpacing) forKey:@"top"];
2035+
[eventArgs setValue:direction forKey:@"direction"];
20252036

20262037
if (lastVisibleItem != [indexPath row] || lastVisibleSection != [indexPath section] || forceUpdates) {
20272038
// only log if the item changes or forced
@@ -2038,6 +2049,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
20382049
[eventArgs setValue:section forKey:@"firstVisibleSection"];
20392050
[eventArgs setValue:NUMINTEGER(-1) forKey:@"firstVisibleItem"];
20402051
[eventArgs setValue:NUMINTEGER(topSpacing) forKey:@"top"];
2052+
[eventArgs setValue:direction forKey:@"direction"];
20412053
}
20422054
});
20432055
}
@@ -2110,7 +2122,7 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
21102122
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
21112123
{
21122124
if ([[self proxy] _hasListeners:@"scrolling"]) {
2113-
NSString *direction = nil;
2125+
NSString *direction = @"unknown";
21142126

21152127
if (velocity.y > 0) {
21162128
direction = @"up";

0 commit comments

Comments
 (0)