Add touch ability scroll ability models, views and view controllers
This commit is contained in:
@@ -156,12 +156,24 @@
|
||||
6500FCA621CA472B00AC1CA3 /* ORKTouchAbilityArrowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6500FCA421CA472B00AC1CA3 /* ORKTouchAbilityArrowView.m */; };
|
||||
6506EB25218057FC002DF5DB /* ORKTouchAbilityTapContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6506EB23218057FC002DF5DB /* ORKTouchAbilityTapContentView.h */; };
|
||||
6506EB26218057FC002DF5DB /* ORKTouchAbilityTapContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6506EB24218057FC002DF5DB /* ORKTouchAbilityTapContentView.m */; };
|
||||
651C32C721CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 651C32C521CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
651C32C821CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.m in Sources */ = {isa = PBXBuildFile; fileRef = 651C32C621CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.m */; };
|
||||
653BB630219AB51400138F18 /* ORKTouchAbilityTouchTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 653BB62E219AB51400138F18 /* ORKTouchAbilityTouchTracker.h */; };
|
||||
653BB631219AB51400138F18 /* ORKTouchAbilityTouchTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 653BB62F219AB51400138F18 /* ORKTouchAbilityTouchTracker.m */; };
|
||||
653BB634219AC4D700138F18 /* ORKTouchAbilityCustomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 653BB632219AC4D700138F18 /* ORKTouchAbilityCustomView.h */; };
|
||||
653BB635219AC4D700138F18 /* ORKTouchAbilityCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 653BB633219AC4D700138F18 /* ORKTouchAbilityCustomView.m */; };
|
||||
653BB634219AC4D700138F18 /* ORKTouchAbilityContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 653BB632219AC4D700138F18 /* ORKTouchAbilityContentView.h */; };
|
||||
653BB635219AC4D700138F18 /* ORKTouchAbilityContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 653BB633219AC4D700138F18 /* ORKTouchAbilityContentView.m */; };
|
||||
653BB63A219AF25800138F18 /* ORKTouchAbilityTapResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 653BB638219AF25800138F18 /* ORKTouchAbilityTapResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
653BB63B219AF25800138F18 /* ORKTouchAbilityTapResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 653BB639219AF25800138F18 /* ORKTouchAbilityTapResult.m */; };
|
||||
6553165221CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553165021CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
6553165321CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.m in Sources */ = {isa = PBXBuildFile; fileRef = 6553165121CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.m */; };
|
||||
6553165621CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553165421CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.h */; };
|
||||
6553165721CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6553165521CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.m */; };
|
||||
6553165A21CCE90C00D889BB /* ORKTouchAbilityScrollContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553165821CCE90C00D889BB /* ORKTouchAbilityScrollContentView.h */; };
|
||||
6553165B21CCE90C00D889BB /* ORKTouchAbilityScrollContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6553165921CCE90C00D889BB /* ORKTouchAbilityScrollContentView.m */; };
|
||||
6553165E21CCE97400D889BB /* ORKTouchAbilityScrollTrial.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553165C21CCE97400D889BB /* ORKTouchAbilityScrollTrial.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6553165F21CCE97400D889BB /* ORKTouchAbilityScrollTrial.m in Sources */ = {isa = PBXBuildFile; fileRef = 6553165D21CCE97400D889BB /* ORKTouchAbilityScrollTrial.m */; };
|
||||
6553166221CCE99200D889BB /* ORKTouchAbilityScrollResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553166021CCE99200D889BB /* ORKTouchAbilityScrollResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6553166321CCE99200D889BB /* ORKTouchAbilityScrollResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 6553166121CCE99200D889BB /* ORKTouchAbilityScrollResult.m */; };
|
||||
65991DBC21C7638C0064301A /* ORKTouchAbilityPinchGuideView.h in Headers */ = {isa = PBXBuildFile; fileRef = 65991DBA21C7638C0064301A /* ORKTouchAbilityPinchGuideView.h */; };
|
||||
65991DBD21C7638C0064301A /* ORKTouchAbilityPinchGuideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 65991DBB21C7638C0064301A /* ORKTouchAbilityPinchGuideView.m */; };
|
||||
65991DC021C771960064301A /* ORKTouchAbilityPinchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 65991DBE21C771960064301A /* ORKTouchAbilityPinchResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -942,12 +954,24 @@
|
||||
6500FCA421CA472B00AC1CA3 /* ORKTouchAbilityArrowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityArrowView.m; sourceTree = "<group>"; };
|
||||
6506EB23218057FC002DF5DB /* ORKTouchAbilityTapContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityTapContentView.h; sourceTree = "<group>"; };
|
||||
6506EB24218057FC002DF5DB /* ORKTouchAbilityTapContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityTapContentView.m; sourceTree = "<group>"; };
|
||||
651C32C521CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityHorizontalScrollStep.h; sourceTree = "<group>"; };
|
||||
651C32C621CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityHorizontalScrollStep.m; sourceTree = "<group>"; };
|
||||
653BB62E219AB51400138F18 /* ORKTouchAbilityTouchTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityTouchTracker.h; sourceTree = "<group>"; };
|
||||
653BB62F219AB51400138F18 /* ORKTouchAbilityTouchTracker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityTouchTracker.m; sourceTree = "<group>"; };
|
||||
653BB632219AC4D700138F18 /* ORKTouchAbilityCustomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityCustomView.h; sourceTree = "<group>"; };
|
||||
653BB633219AC4D700138F18 /* ORKTouchAbilityCustomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityCustomView.m; sourceTree = "<group>"; };
|
||||
653BB632219AC4D700138F18 /* ORKTouchAbilityContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityContentView.h; sourceTree = "<group>"; };
|
||||
653BB633219AC4D700138F18 /* ORKTouchAbilityContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityContentView.m; sourceTree = "<group>"; };
|
||||
653BB638219AF25800138F18 /* ORKTouchAbilityTapResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityTapResult.h; sourceTree = "<group>"; };
|
||||
653BB639219AF25800138F18 /* ORKTouchAbilityTapResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityTapResult.m; sourceTree = "<group>"; };
|
||||
6553165021CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityVerticalScrollStep.h; sourceTree = "<group>"; };
|
||||
6553165121CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityVerticalScrollStep.m; sourceTree = "<group>"; };
|
||||
6553165421CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityScrollStepViewController.h; sourceTree = "<group>"; };
|
||||
6553165521CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityScrollStepViewController.m; sourceTree = "<group>"; };
|
||||
6553165821CCE90C00D889BB /* ORKTouchAbilityScrollContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityScrollContentView.h; sourceTree = "<group>"; };
|
||||
6553165921CCE90C00D889BB /* ORKTouchAbilityScrollContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityScrollContentView.m; sourceTree = "<group>"; };
|
||||
6553165C21CCE97400D889BB /* ORKTouchAbilityScrollTrial.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityScrollTrial.h; sourceTree = "<group>"; };
|
||||
6553165D21CCE97400D889BB /* ORKTouchAbilityScrollTrial.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityScrollTrial.m; sourceTree = "<group>"; };
|
||||
6553166021CCE99200D889BB /* ORKTouchAbilityScrollResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityScrollResult.h; sourceTree = "<group>"; };
|
||||
6553166121CCE99200D889BB /* ORKTouchAbilityScrollResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityScrollResult.m; sourceTree = "<group>"; };
|
||||
65991DBA21C7638C0064301A /* ORKTouchAbilityPinchGuideView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityPinchGuideView.h; sourceTree = "<group>"; };
|
||||
65991DBB21C7638C0064301A /* ORKTouchAbilityPinchGuideView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKTouchAbilityPinchGuideView.m; sourceTree = "<group>"; };
|
||||
65991DBE21C771960064301A /* ORKTouchAbilityPinchResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKTouchAbilityPinchResult.h; sourceTree = "<group>"; };
|
||||
@@ -1999,14 +2023,33 @@
|
||||
653BB62D219AB4A600138F18 /* Shared Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
653BB632219AC4D700138F18 /* ORKTouchAbilityCustomView.h */,
|
||||
653BB633219AC4D700138F18 /* ORKTouchAbilityCustomView.m */,
|
||||
653BB632219AC4D700138F18 /* ORKTouchAbilityContentView.h */,
|
||||
653BB633219AC4D700138F18 /* ORKTouchAbilityContentView.m */,
|
||||
6500FCA321CA472B00AC1CA3 /* ORKTouchAbilityArrowView.h */,
|
||||
6500FCA421CA472B00AC1CA3 /* ORKTouchAbilityArrowView.m */,
|
||||
);
|
||||
name = "Shared Views";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6553164F21CCE7F300D889BB /* Scroll Step */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6553165021CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.h */,
|
||||
6553165121CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.m */,
|
||||
651C32C521CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.h */,
|
||||
651C32C621CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.m */,
|
||||
6553165421CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.h */,
|
||||
6553165521CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.m */,
|
||||
6553165821CCE90C00D889BB /* ORKTouchAbilityScrollContentView.h */,
|
||||
6553165921CCE90C00D889BB /* ORKTouchAbilityScrollContentView.m */,
|
||||
6553165C21CCE97400D889BB /* ORKTouchAbilityScrollTrial.h */,
|
||||
6553165D21CCE97400D889BB /* ORKTouchAbilityScrollTrial.m */,
|
||||
6553166021CCE99200D889BB /* ORKTouchAbilityScrollResult.h */,
|
||||
6553166121CCE99200D889BB /* ORKTouchAbilityScrollResult.m */,
|
||||
);
|
||||
name = "Scroll Step";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
659AAA42218C41EA00622C68 /* Shared Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -2053,6 +2096,7 @@
|
||||
65E36368217726CD00AEE2F6 /* Tap Step */,
|
||||
65EEE15321B12C52007858E8 /* Long Press Step */,
|
||||
65EF3BF721B7A161007BE0D6 /* Swipe Step */,
|
||||
6553164F21CCE7F300D889BB /* Scroll Step */,
|
||||
65DA22ED21BA4361007750B9 /* Pinch Step */,
|
||||
6500FC8E21CA3AF300AC1CA3 /* Rotation Step */,
|
||||
);
|
||||
@@ -3360,7 +3404,7 @@
|
||||
BABBB1B62097E58300CB29E5 /* ORKPDFViewerStepView.h in Headers */,
|
||||
959A2C001D68B9DA00841B04 /* ORKRangeOfMotionStepViewController.h in Headers */,
|
||||
65E3636B2177271000AEE2F6 /* ORKTouchAbilityTapStepViewController.h in Headers */,
|
||||
653BB634219AC4D700138F18 /* ORKTouchAbilityCustomView.h in Headers */,
|
||||
653BB634219AC4D700138F18 /* ORKTouchAbilityContentView.h in Headers */,
|
||||
86C40D6A1A8D7C5C00081FAC /* ORKResult.h in Headers */,
|
||||
FF919A3F1E81AFEF005C2A1E /* ORKReactionTimeResult.h in Headers */,
|
||||
86C40DD61A8D7C5C00081FAC /* ORKUnitLabel.h in Headers */,
|
||||
@@ -3437,6 +3481,7 @@
|
||||
86C40C761A8D7C5C00081FAC /* HKSample+ORKJSONDictionary.h in Headers */,
|
||||
BA0AA6961EAEC0B600671ACE /* ORKStroopStep.h in Headers */,
|
||||
65DA22F421BA43DD007750B9 /* ORKTouchAbilityPinchStepViewController.h in Headers */,
|
||||
6553165E21CCE97400D889BB /* ORKTouchAbilityScrollTrial.h in Headers */,
|
||||
71769E2920880C4500A19914 /* ORKdBHLToneAudiometryResult.h in Headers */,
|
||||
BABBB19D2093299A00CB29E5 /* ORKSurveyCardHeaderView.h in Headers */,
|
||||
86C40CEA1A8D7C5C00081FAC /* ORKAnswerTextField.h in Headers */,
|
||||
@@ -3465,6 +3510,7 @@
|
||||
D42FEFB81AF7557000A124F8 /* ORKImageCaptureView.h in Headers */,
|
||||
10FF9ADB1B7BA78400ECB5B4 /* ORKOrderedTask_Private.h in Headers */,
|
||||
65991DC021C771960064301A /* ORKTouchAbilityPinchResult.h in Headers */,
|
||||
6553166221CCE99200D889BB /* ORKTouchAbilityScrollResult.h in Headers */,
|
||||
86C40D1A1A8D7C5C00081FAC /* ORKFormItem_Internal.h in Headers */,
|
||||
BC5FAF841C6901A200057CF1 /* ORKChartTypes.h in Headers */,
|
||||
65A899282177283200E265FC /* ORKTouchAbilityTapStep.h in Headers */,
|
||||
@@ -3533,6 +3579,7 @@
|
||||
24A4DA141B8D1115009C797A /* ORKPasscodeStep.h in Headers */,
|
||||
BCB6E6521B7D533B000D5B34 /* ORKPieChartLegendCell.h in Headers */,
|
||||
FA7A9D331B0843A9005A2BEA /* ORKConsentSignatureFormatter.h in Headers */,
|
||||
6553165A21CCE90C00D889BB /* ORKTouchAbilityScrollContentView.h in Headers */,
|
||||
86C40C5A1A8D7C5C00081FAC /* ORKWalkingTaskStep.h in Headers */,
|
||||
BC1C032C1CA301E300869355 /* ORKHeightPicker.h in Headers */,
|
||||
866DA5231D63D04700C9AF3F /* ORKDataCollectionManager.h in Headers */,
|
||||
@@ -3575,6 +3622,7 @@
|
||||
86C40C161A8D7C5C00081FAC /* ORKAudioContentView.h in Headers */,
|
||||
86C40CB41A8D7C5C00081FAC /* ORKTouchRecorder.h in Headers */,
|
||||
86C40DEA1A8D7C5C00081FAC /* UIBarButtonItem+ORKBarButtonItem.h in Headers */,
|
||||
651C32C721CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.h in Headers */,
|
||||
BA2FE3EE20B109C600AAC231 /* ORKAmslerGridResult.h in Headers */,
|
||||
9550E6731D58DBCF00C691B8 /* ORKTouchAnywhereStep.h in Headers */,
|
||||
6506EB25218057FC002DF5DB /* ORKTouchAbilityTapContentView.h in Headers */,
|
||||
@@ -3611,6 +3659,7 @@
|
||||
86C40C261A8D7C5C00081FAC /* ORKCountdownStepViewController.h in Headers */,
|
||||
FF919A2A1E81A94B005C2A1E /* ORKRangeOfMotionResult.h in Headers */,
|
||||
861D2AF01B8409D9008C4CD0 /* ORKTimedWalkContentView.h in Headers */,
|
||||
6553165621CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.h in Headers */,
|
||||
2489F7B31D65214D008DEF20 /* ORKVideoCaptureStepViewController.h in Headers */,
|
||||
86C40E0C1A8D7C5C00081FAC /* ORKConsentReviewStepViewController.h in Headers */,
|
||||
86C40C321A8D7C5C00081FAC /* ORKFitnessStepViewController.h in Headers */,
|
||||
@@ -3641,6 +3690,7 @@
|
||||
FF919A361E81AD9C005C2A1E /* ORKSpatialSpanMemoryResult.h in Headers */,
|
||||
86C40E081A8D7C5C00081FAC /* ORKConsentReviewStep.h in Headers */,
|
||||
86C40C901A8D7C5C00081FAC /* ORKActiveStepViewController_Internal.h in Headers */,
|
||||
6553165221CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.h in Headers */,
|
||||
65DA22F021BA4393007750B9 /* ORKTouchAbilityPinchStep.h in Headers */,
|
||||
86C40CD81A8D7C5C00081FAC /* ORKTextFieldView.h in Headers */,
|
||||
86C40DD01A8D7C5C00081FAC /* ORKTaskViewController_Private.h in Headers */,
|
||||
@@ -3941,6 +3991,7 @@
|
||||
861D2AED1B8409B2008C4CD0 /* ORKTimedWalkStepViewController.m in Sources */,
|
||||
86C40C341A8D7C5C00081FAC /* ORKFitnessStepViewController.m in Sources */,
|
||||
71769E2E208824D100A19914 /* ORKdBHLToneAudiometryOnboardingStep.m in Sources */,
|
||||
6553166321CCE99200D889BB /* ORKTouchAbilityScrollResult.m in Sources */,
|
||||
71769E3A20882CED00A19914 /* ORKdBHLToneAudiometryStep.m in Sources */,
|
||||
86C40E2E1A8D7C5C00081FAC /* ORKVisualConsentStep.m in Sources */,
|
||||
2433C9E41B9A506F0052D375 /* ORKKeychainWrapper.m in Sources */,
|
||||
@@ -3950,6 +4001,7 @@
|
||||
BC2908BC1FBD628F0030AB89 /* ORKTypes.m in Sources */,
|
||||
71D8EF1820B9EE1900EBCDC6 /* ORKHealthClinicalTypeRecorder.m in Sources */,
|
||||
CBD34A5B1BB207FC00F204EA /* ORKSurveyAnswerCellForLocation.m in Sources */,
|
||||
6553165321CCE86D00D889BB /* ORKTouchAbilityVerticalScrollStep.m in Sources */,
|
||||
959A2C011D68B9DA00841B04 /* ORKRangeOfMotionStepViewController.m in Sources */,
|
||||
861D2AF11B8409D9008C4CD0 /* ORKTimedWalkContentView.m in Sources */,
|
||||
86C40DC41A8D7C5C00081FAC /* ORKTapCountLabel.m in Sources */,
|
||||
@@ -3972,6 +4024,7 @@
|
||||
BA2FE3EF20B109C600AAC231 /* ORKAmslerGridResult.m in Sources */,
|
||||
10FF9ACC1B79F22900ECB5B4 /* ORKHolePegTestRemoveStepViewController.m in Sources */,
|
||||
86C40CD61A8D7C5C00081FAC /* ORKTableContainerView.m in Sources */,
|
||||
6553165721CCE8C500D889BB /* ORKTouchAbilityScrollStepViewController.m in Sources */,
|
||||
2429D5731BBB5397003A512F /* ORKRegistrationStep.m in Sources */,
|
||||
257FCE201B4D14E50001EF06 /* ORKTowerOfHanoiTowerView.m in Sources */,
|
||||
2489F7B61D65214D008DEF20 /* ORKVideoCaptureView.m in Sources */,
|
||||
@@ -4051,10 +4104,12 @@
|
||||
10FF9AC41B79EF2800ECB5B4 /* ORKHolePegTestRemoveStep.m in Sources */,
|
||||
10BAA2CB1B5FCB4F004FE478 /* ORKProgressView.m in Sources */,
|
||||
86C40D861A8D7C5C00081FAC /* ORKSelectionTitleLabel.m in Sources */,
|
||||
6553165B21CCE90C00D889BB /* ORKTouchAbilityScrollContentView.m in Sources */,
|
||||
FF36A49E1D1A15FC00DE8470 /* ORKTableStepViewController.m in Sources */,
|
||||
86C40D001A8D7C5C00081FAC /* ORKChoiceViewCell.m in Sources */,
|
||||
86C40C4C1A8D7C5C00081FAC /* ORKSpatialSpanTargetView.m in Sources */,
|
||||
86C40D9E1A8D7C5C00081FAC /* ORKSubheadlineLabel.m in Sources */,
|
||||
651C32C821CE302300E96661 /* ORKTouchAbilityHorizontalScrollStep.m in Sources */,
|
||||
10864CA31B27146B000F4158 /* ORKPSATContentView.m in Sources */,
|
||||
6146D0A41B84A91E0068491D /* ORKLineGraphAccessibilityElement.m in Sources */,
|
||||
D42FEFB91AF7557000A124F8 /* ORKImageCaptureView.m in Sources */,
|
||||
@@ -4150,7 +4205,7 @@
|
||||
86C40C641A8D7C5C00081FAC /* CLLocation+ORKJSONDictionary.m in Sources */,
|
||||
86C40D041A8D7C5C00081FAC /* ORKContinueButton.m in Sources */,
|
||||
24A4DA151B8D1115009C797A /* ORKPasscodeStep.m in Sources */,
|
||||
653BB635219AC4D700138F18 /* ORKTouchAbilityCustomView.m in Sources */,
|
||||
653BB635219AC4D700138F18 /* ORKTouchAbilityContentView.m in Sources */,
|
||||
86C40DEC1A8D7C5C00081FAC /* UIBarButtonItem+ORKBarButtonItem.m in Sources */,
|
||||
106FF2AF1B6FACA8004EACF2 /* ORKDirectionView.m in Sources */,
|
||||
6500FCA621CA472B00AC1CA3 /* ORKTouchAbilityArrowView.m in Sources */,
|
||||
@@ -4245,6 +4300,7 @@
|
||||
65EF3BFF21B7A21C007BE0D6 /* ORKTouchAbilitySwipeStepViewController.m in Sources */,
|
||||
2489F7B01D65214D008DEF20 /* ORKVideoCaptureCameraPreviewView.m in Sources */,
|
||||
2E8070FF1FAD256A00E4FC7F /* ORKSpeechRecognitionContentView.m in Sources */,
|
||||
6553165F21CCE97400D889BB /* ORKTouchAbilityScrollTrial.m in Sources */,
|
||||
BA0AA6951EAEC0B600671ACE /* ORKStroopContentView.m in Sources */,
|
||||
147503BA1AEE807C004B17F3 /* ORKToneAudiometryStep.m in Sources */,
|
||||
65991DC121C771960064301A /* ORKTouchAbilityPinchResult.m in Sources */,
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
@property (nonatomic, strong) ORKTouchAbilityTouchTracker *touchTracker;
|
||||
@property (nonatomic, readwrite) NSArray<ORKTouchAbilityGestureRecoginzerEvent *> *gestureRecognizerEvents;
|
||||
|
||||
@property (nonatomic, assign) BOOL shouldSendDelegateCallbacks;
|
||||
|
||||
@property (nonatomic, strong) UITapGestureRecognizer *tap;
|
||||
@property (nonatomic, strong) UILongPressGestureRecognizer *longPress;
|
||||
@property (nonatomic, strong) UIPanGestureRecognizer *pan;
|
||||
@@ -117,6 +119,7 @@
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
|
||||
self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
self.shouldSendDelegateCallbacks = YES;
|
||||
|
||||
// Views
|
||||
|
||||
@@ -330,6 +333,8 @@
|
||||
|
||||
- (void)setContentViewHidden:(BOOL)hidden animated:(BOOL)animated completion:(void (^)(BOOL))completion {
|
||||
|
||||
self.shouldSendDelegateCallbacks = !hidden;
|
||||
|
||||
NSTimeInterval totalDuration = 1.0;
|
||||
NSTimeInterval hideDuration = 0.2;
|
||||
NSTimeInterval remainDuration = totalDuration - hideDuration;
|
||||
@@ -422,7 +427,7 @@
|
||||
|
||||
- (void)touchTrackerDidBeginNewTrack:(ORKTouchAbilityTouchTracker *)touchTracker {
|
||||
|
||||
if (!self.isTracking) {
|
||||
if (!self.isTracking || !self.shouldSendDelegateCallbacks) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -433,7 +438,7 @@
|
||||
|
||||
- (void)touchTrackerDidCompleteNewTracks:(ORKTouchAbilityTouchTracker *)touchTracker {
|
||||
|
||||
if (!self.isTracking) {
|
||||
if (!self.isTracking || !self.shouldSendDelegateCallbacks) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
@import Foundation;
|
||||
#import <ResearchKit/ORKDefines.h>
|
||||
#import <ResearchKit/ORKActiveStep.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
ORK_CLASS_AVAILABLE
|
||||
@interface ORKTouchAbilityHorizontalScrollStep : ORKActiveStep
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityHorizontalScrollStep.h"
|
||||
#import "ORKTouchAbilityScrollStepViewController.h"
|
||||
#import "ORKhelpers_Internal.h"
|
||||
|
||||
@implementation ORKTouchAbilityHorizontalScrollStep
|
||||
|
||||
+ (Class)stepViewControllerClass {
|
||||
return [ORKTouchAbilityScrollStepViewController class];
|
||||
}
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier {
|
||||
self = [super initWithIdentifier:identifier];
|
||||
if (self) {
|
||||
self.shouldShowDefaultTimer = NO;
|
||||
self.shouldContinueOnFinish = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)validateParameters {
|
||||
[super validateParameters];
|
||||
|
||||
// TODO:
|
||||
}
|
||||
|
||||
- (BOOL)startsFinished {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
@import UIKit;
|
||||
#import "ORKTouchAbilityContentView.h"
|
||||
#import "ORKTouchAbilityScrollTrial.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class ORKTouchAbilityScrollContentView;
|
||||
@protocol ORKTouchAbilityScrollContentViewDataSource <NSObject>
|
||||
|
||||
@required
|
||||
- (NSUInteger)numberOfItemsInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView;
|
||||
- (NSUInteger)initialItemInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView;
|
||||
- (NSUInteger)targetItemInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView;
|
||||
|
||||
@end
|
||||
|
||||
@interface ORKTouchAbilityScrollContentView : ORKTouchAbilityContentView
|
||||
|
||||
@property (nonatomic, assign) ORKTouchAbilityScrollTrialDirection direction;
|
||||
@property (nonatomic, weak) id<ORKTouchAbilityScrollContentViewDataSource> _Nullable dataSource;
|
||||
|
||||
@property (nonatomic, readonly) NSTimeInterval timeIntervalBeforeStopDecelarating;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityScrollContentView.h"
|
||||
|
||||
#define VISIBLE_ITEMS 4
|
||||
|
||||
@interface ORKTouchAbilityScrollContentView () <
|
||||
UICollectionViewDataSource,
|
||||
UICollectionViewDelegate
|
||||
>
|
||||
|
||||
@property (nonatomic, assign) NSUInteger numberOfItems;
|
||||
@property (nonatomic, assign) NSUInteger initialItem;
|
||||
@property (nonatomic, assign) NSUInteger targetItem;
|
||||
|
||||
@property (nonatomic, assign) BOOL success;
|
||||
|
||||
@property (nonatomic, assign) CGPoint initialOffset;
|
||||
@property (nonatomic, assign) CGPoint targetOffset;
|
||||
@property (nonatomic, assign) CGPoint endDraggingOffset;
|
||||
@property (nonatomic, assign) CGPoint endScrollingOffset;
|
||||
|
||||
@property (nonatomic, assign) NSTimeInterval timeIntervalBeforeStopDecelarating;
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, strong) UICollectionViewFlowLayout *flowLayout;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ORKTouchAbilityScrollContentView
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setDirection:(ORKTouchAbilityScrollTrialDirection)direction {
|
||||
switch (direction) {
|
||||
case ORKTouchAbilityScrollTrialDirectionVertical:
|
||||
self.flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
break;
|
||||
|
||||
case ORKTouchAbilityScrollTrialDirectionHorizontal:
|
||||
self.flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView {
|
||||
if (!_collectionView) {
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:self.flowLayout];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UICollectionViewFlowLayout *)flowLayout {
|
||||
if (!_flowLayout) {
|
||||
_flowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
_flowLayout.minimumLineSpacing = 0.0;
|
||||
}
|
||||
return _flowLayout;
|
||||
}
|
||||
|
||||
#pragma mark - UIView
|
||||
|
||||
- (CGSize)intrinsicContentSize {
|
||||
return CGSizeMake(UIViewNoIntrinsicMetric, 10000.0);
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
|
||||
self.collectionView.backgroundColor = UIColor.clearColor;
|
||||
self.collectionView.delaysContentTouches = NO;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.delegate = self;
|
||||
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
|
||||
|
||||
self.collectionView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.contentView addSubview:self.collectionView];
|
||||
|
||||
NSMutableArray *constraintsArray = [NSMutableArray array];
|
||||
|
||||
[constraintsArray addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_collectionView]|"
|
||||
options:0
|
||||
metrics:nil
|
||||
views:NSDictionaryOfVariableBindings(_collectionView)]];
|
||||
|
||||
[constraintsArray addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_collectionView]|"
|
||||
options:0
|
||||
metrics:nil
|
||||
views:NSDictionaryOfVariableBindings(_collectionView)]];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:constraintsArray];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
|
||||
if (self.flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
|
||||
CGFloat width = CGRectGetWidth(self.contentView.bounds) / VISIBLE_ITEMS;
|
||||
CGFloat height = CGRectGetHeight(self.contentView.bounds);
|
||||
self.flowLayout.itemSize = CGSizeMake(width, height);
|
||||
} else {
|
||||
CGFloat width = CGRectGetWidth(self.contentView.bounds);
|
||||
CGFloat height = CGRectGetHeight(self.contentView.bounds) / VISIBLE_ITEMS;
|
||||
self.flowLayout.itemSize = CGSizeMake(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - ORKTouchAbilityContentView
|
||||
|
||||
+ (Class)trialClass {
|
||||
return [ORKTouchAbilityScrollTrial class];
|
||||
}
|
||||
|
||||
- (ORKTouchAbilityTrial *)trial {
|
||||
|
||||
ORKTouchAbilityScrollTrial *trial = (ORKTouchAbilityScrollTrial *)[super trial];
|
||||
|
||||
trial.direction = self.direction;
|
||||
trial.initialOffset = self.initialOffset;
|
||||
trial.targetOffset = self.targetOffset;
|
||||
trial.endDraggingOffset = self.endDraggingOffset;
|
||||
trial.endScrollingOffset = self.endScrollingOffset;
|
||||
|
||||
return trial;
|
||||
}
|
||||
|
||||
- (void)startTracking {
|
||||
[super startTracking];
|
||||
self.collectionView.userInteractionEnabled = YES;
|
||||
self.collectionView.scrollEnabled = YES;
|
||||
}
|
||||
|
||||
- (void)stopTracking {
|
||||
[super stopTracking];
|
||||
self.collectionView.userInteractionEnabled = NO;
|
||||
self.collectionView.scrollEnabled = NO;
|
||||
}
|
||||
|
||||
- (void)reloadData {
|
||||
[self resetTracks];
|
||||
|
||||
self.success = NO;
|
||||
self.numberOfItems = [self.dataSource numberOfItemsInScrollContentView:self] ?: 1;
|
||||
self.initialItem = [self.dataSource initialItemInScrollContentView:self] ?: 0;
|
||||
self.targetItem = [self.dataSource targetItemInScrollContentView:self] ?: 0;
|
||||
|
||||
[self.collectionView reloadData];
|
||||
[self setNeedsLayout];
|
||||
[self layoutIfNeeded];
|
||||
|
||||
if (self.flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
|
||||
|
||||
CGFloat width = CGRectGetWidth(self.collectionView.bounds) / VISIBLE_ITEMS;
|
||||
CGFloat offsetX = width * (self.initialItem + 0.5 - 2);
|
||||
CGFloat offsetY = self.collectionView.contentOffset.y;
|
||||
|
||||
self.initialOffset = CGPointMake(offsetX, offsetY);
|
||||
self.targetOffset = CGPointMake(self.targetItem * width, CGRectGetMinY(self.collectionView.bounds));
|
||||
|
||||
} else {
|
||||
|
||||
CGFloat height = CGRectGetHeight(self.collectionView.bounds) / VISIBLE_ITEMS;
|
||||
CGFloat offsetX = self.collectionView.contentOffset.x;
|
||||
CGFloat offsetY = height * (self.initialItem + 0.5 - 2);
|
||||
|
||||
self.initialOffset = CGPointMake(offsetX, offsetY);
|
||||
self.targetOffset = CGPointMake(CGRectGetMinX(self.collectionView.bounds), self.targetItem * height);
|
||||
}
|
||||
|
||||
[self.collectionView setContentOffset:self.initialOffset animated:NO];
|
||||
// self.collectionView.contentOffset = self.initialOffset;
|
||||
|
||||
self.endDraggingOffset = CGPointZero;
|
||||
self.endScrollingOffset = CGPointZero;
|
||||
|
||||
self.timeIntervalBeforeStopDecelarating = 0.0;
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.numberOfItems;
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
|
||||
|
||||
if (![cell.contentView viewWithTag:10000]) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.textAlignment = NSTextAlignmentCenter;
|
||||
label.font = [UIFont systemFontOfSize:42 weight:UIFontWeightBold];
|
||||
|
||||
[cell.contentView addSubview:label];
|
||||
label.frame = cell.contentView.bounds;
|
||||
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
label.tag = 10000;
|
||||
}
|
||||
|
||||
UILabel *label = (UILabel *)[cell.contentView viewWithTag:10000];
|
||||
label.text = [NSString stringWithFormat:@"%@", @(indexPath.item + 1)];
|
||||
|
||||
|
||||
if (indexPath.item == self.targetItem) {
|
||||
cell.contentView.backgroundColor = self.tintColor;
|
||||
label.textColor = [UIColor whiteColor];
|
||||
} else if (indexPath.item % 2 == 0) {
|
||||
cell.contentView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];
|
||||
label.textColor = [UIColor blackColor];
|
||||
} else {
|
||||
cell.contentView.backgroundColor = [UIColor whiteColor];
|
||||
label.textColor = [UIColor blackColor];
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.item == self.targetItem) {
|
||||
self.success = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.item == self.targetItem) {
|
||||
self.success = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIScrollViewDelegate
|
||||
|
||||
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
|
||||
|
||||
self.endDraggingOffset = scrollView.contentOffset;
|
||||
self.endScrollingOffset = *targetContentOffset;
|
||||
|
||||
CGFloat velocityX = fabs(velocity.x);
|
||||
CGFloat velocityY = fabs(velocity.y);
|
||||
|
||||
CGFloat v = self.flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal ? velocityX : velocityY;
|
||||
|
||||
if (v <= 0) {
|
||||
self.timeIntervalBeforeStopDecelarating = 0.0;
|
||||
} else {
|
||||
self.timeIntervalBeforeStopDecelarating = 0.0;
|
||||
//self.timeIntervalBeforeStopDecelarating = (log(v) * 0.5) + 2.3;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <ResearchKit/ResearchKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class ORKTouchAbilityScrollTrial;
|
||||
|
||||
ORK_CLASS_AVAILABLE
|
||||
@interface ORKTouchAbilityScrollResult : ORKStepResult
|
||||
@property (nonatomic, copy) NSArray<ORKTouchAbilityScrollTrial *> *trials;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityScrollResult.h"
|
||||
#import "ORKHelpers_Internal.h"
|
||||
|
||||
@implementation ORKTouchAbilityScrollResult
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[super encodeWithCoder:aCoder];
|
||||
ORK_ENCODE_OBJ(aCoder, trials);
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
if (self = [super initWithCoder:aDecoder]) {
|
||||
ORK_ENCODE_OBJ(aDecoder, trials);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
|
||||
BOOL isParentSame = [super isEqual:object];
|
||||
|
||||
__typeof(self) castObject = object;
|
||||
return isParentSame && ORKEqualObjects(self.trials, castObject.trials);
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return super.hash ^ self.trials.hash;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
ORKTouchAbilityScrollResult *result = [super copyWithZone:zone];
|
||||
result.trials = self.trials;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray<ORKTouchAbilityScrollTrial *> *)trials {
|
||||
if (!_trials) {
|
||||
_trials = [NSArray new];
|
||||
}
|
||||
return _trials;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
@import UIKit;
|
||||
#import <ResearchKit/ORKDefines.h>
|
||||
#import <ResearchKit/ORKActiveStepViewController.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
ORK_CLASS_AVAILABLE
|
||||
@interface ORKTouchAbilityScrollStepViewController : ORKActiveStepViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityScrollStepViewController.h"
|
||||
#import "ORKTouchAbilityVerticalScrollStep.h"
|
||||
#import "ORKTouchAbilityHorizontalScrollStep.h"
|
||||
|
||||
#import "ORKActiveStepView.h"
|
||||
#import "ORKTouchAbilityScrollContentView.h"
|
||||
#import "ORKTouchAbilityScrollResult.h"
|
||||
#import "ORKTouchAbilityScrollTrial.h"
|
||||
|
||||
#import "ORKActiveStepViewController_Internal.h"
|
||||
#import "ORKStepViewController_Internal.h"
|
||||
#import "ORKTaskViewController_Internal.h"
|
||||
#import "ORKNavigationContainerView_Internal.h"
|
||||
|
||||
#import "ORKCollectionResult_Private.h"
|
||||
#import "ORKTouchAbilitySwipeStep.h"
|
||||
#import "ORKNavigableOrderedTask.h"
|
||||
#import "ORKVerticalContainerView_Internal.h"
|
||||
#import "ORKHelpers_Internal.h"
|
||||
|
||||
#define NUMBER_OF_ITEMS 100
|
||||
#define TARGET_ITEM 50
|
||||
|
||||
@interface ORKTouchAbilityScrollStepViewController () <
|
||||
ORKTouchAbilityScrollContentViewDataSource,
|
||||
ORKTouchAbilityContentViewDelegate
|
||||
>
|
||||
|
||||
// Data
|
||||
@property (nonatomic, assign) NSUInteger currentTrialIndex;
|
||||
@property (nonatomic, strong) NSArray<NSNumber *> *targetsQueue;
|
||||
@property (nonatomic, strong) NSMutableArray<ORKTouchAbilityScrollTrial *> *trials;
|
||||
|
||||
@property (nonatomic, copy) dispatch_block_t endTrialWork;
|
||||
|
||||
// UI
|
||||
@property (nonatomic, strong) ORKTouchAbilityScrollContentView *contentView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ORKTouchAbilityScrollStepViewController
|
||||
|
||||
- (BOOL)isHorizontalStep {
|
||||
if ([self.step isKindOfClass:[ORKTouchAbilityHorizontalScrollStep class]]) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark - ORKActiveStepViewController
|
||||
|
||||
- (instancetype)initWithStep:(ORKStep *)step {
|
||||
self = [super initWithStep:step];
|
||||
if (self) {
|
||||
self.suspendIfInactive = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initializeInternalButtonItems {
|
||||
[super initializeInternalButtonItems];
|
||||
|
||||
self.internalContinueButtonItem = nil;
|
||||
self.internalDoneButtonItem = nil;
|
||||
}
|
||||
|
||||
- (ORKStepResult *)result {
|
||||
|
||||
ORKStepResult *sResult = [super result];
|
||||
|
||||
NSMutableArray *results = [[NSMutableArray alloc] initWithArray:sResult.results];
|
||||
|
||||
ORKTouchAbilityScrollResult *scrollResult = [[ORKTouchAbilityScrollResult alloc] initWithIdentifier:self.step.identifier];
|
||||
|
||||
scrollResult.trials = self.trials;
|
||||
|
||||
[results addObject:scrollResult];
|
||||
sResult.results = [results copy];
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
- (void)finish {
|
||||
[self.contentView stopTracking];
|
||||
[super finish];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.currentTrialIndex = 0;
|
||||
self.targetsQueue = [self makeTargets];
|
||||
self.trials = [NSMutableArray new];
|
||||
|
||||
self.contentView = [[ORKTouchAbilityScrollContentView alloc] init];
|
||||
self.contentView.direction = self.isHorizontalStep ? ORKTouchAbilityScrollTrialDirectionHorizontal : ORKTouchAbilityScrollTrialDirectionVertical;
|
||||
self.contentView.dataSource = self;
|
||||
self.contentView.delegate = self;
|
||||
|
||||
self.activeStepView.activeCustomView = self.contentView;
|
||||
self.activeStepView.stepViewFillsAvailableSpace = YES;
|
||||
self.activeStepView.scrollContainerShouldCollapseNavbar = NO;
|
||||
|
||||
[self.activeStepView updateTitle:nil text:@"Vertical scroll"];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[self start];
|
||||
[self.contentView startTracking];
|
||||
}
|
||||
|
||||
- (NSArray *)makeTargets {
|
||||
|
||||
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
||||
[array addObject:@(TARGET_ITEM - 5)];
|
||||
[array addObject:@(TARGET_ITEM - 3)];
|
||||
[array addObject:@(TARGET_ITEM + 3)];
|
||||
[array addObject:@(TARGET_ITEM + 5)];
|
||||
[array addObjectsFromArray:array];
|
||||
|
||||
NSUInteger count = [array count];
|
||||
for (NSUInteger i = 0; i < count; i++) {
|
||||
NSUInteger nElements = count - i;
|
||||
NSUInteger n = (arc4random() % nElements) + i;
|
||||
[array exchangeObjectAtIndex:i withObjectAtIndex:n];
|
||||
}
|
||||
|
||||
return [array copy];
|
||||
}
|
||||
|
||||
#pragma mark - ORKTouchAbilityScrollContentViewDataSource
|
||||
|
||||
- (NSUInteger)numberOfItemsInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView {
|
||||
return NUMBER_OF_ITEMS;
|
||||
}
|
||||
|
||||
- (NSUInteger)targetItemInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView {
|
||||
return self.targetsQueue[self.currentTrialIndex].unsignedIntegerValue;
|
||||
}
|
||||
|
||||
- (NSUInteger)initialItemInScrollContentView:(ORKTouchAbilityScrollContentView *)scrollContentView {
|
||||
return TARGET_ITEM;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - ORKTouchAbilityContentViewDelegate
|
||||
|
||||
- (void)touchAbilityContentViewDidBeginNewTrack:(ORKTouchAbilityContentView *)contentView {
|
||||
|
||||
if (self.endTrialWork) {
|
||||
dispatch_block_cancel(self.endTrialWork);
|
||||
self.endTrialWork = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchAbilityContentViewDidCompleteNewTracks:(ORKTouchAbilityContentView *)contentView {
|
||||
|
||||
self.endTrialWork = dispatch_block_create(0, ^{
|
||||
[self endTrial];
|
||||
});
|
||||
|
||||
NSTimeInterval delay = self.contentView.timeIntervalBeforeStopDecelarating + 1.0;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), self.endTrialWork);
|
||||
}
|
||||
|
||||
- (void)endTrial {
|
||||
|
||||
// Calculate current progress and display using progress view.
|
||||
|
||||
NSUInteger total = self.targetsQueue.count;
|
||||
NSUInteger done = self.currentTrialIndex + 1;
|
||||
CGFloat progress = (CGFloat)done/(CGFloat)total;
|
||||
|
||||
[self.contentView setProgress:progress animated:YES];
|
||||
|
||||
|
||||
// Animate the target view.
|
||||
|
||||
[self.contentView setContentViewHidden:YES animated:YES completion:^(BOOL finished) {
|
||||
|
||||
// Stop tracking new touch events.
|
||||
|
||||
[self.contentView stopTracking];
|
||||
|
||||
[self.trials addObject:(ORKTouchAbilityScrollTrial *)self.contentView.trial];
|
||||
|
||||
|
||||
// Determind if should continue or finish.
|
||||
|
||||
self.currentTrialIndex += 1;
|
||||
if (self.currentTrialIndex < self.targetsQueue.count) {
|
||||
|
||||
// Reload and start tracking again.
|
||||
[self.contentView reloadData];
|
||||
[self.contentView setContentViewHidden:NO animated:NO];
|
||||
[self.contentView startTracking];
|
||||
|
||||
} else {
|
||||
|
||||
// Finish step.
|
||||
[self finish];
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ORKTouchAbilityTrial.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, ORKTouchAbilityScrollTrialDirection) {
|
||||
ORKTouchAbilityScrollTrialDirectionHorizontal,
|
||||
ORKTouchAbilityScrollTrialDirectionVertical
|
||||
};
|
||||
|
||||
ORK_CLASS_AVAILABLE
|
||||
@interface ORKTouchAbilityScrollTrial : ORKTouchAbilityTrial
|
||||
|
||||
@property (nonatomic, assign) ORKTouchAbilityScrollTrialDirection direction;
|
||||
|
||||
@property (nonatomic, assign) CGPoint initialOffset;
|
||||
@property (nonatomic, assign) CGPoint targetOffset;
|
||||
@property (nonatomic, assign) CGPoint endDraggingOffset;
|
||||
@property (nonatomic, assign) CGPoint endScrollingOffset;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityScrollTrial.h"
|
||||
#import "ORKHelpers_Internal.h"
|
||||
|
||||
@implementation ORKTouchAbilityScrollTrial
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[super encodeWithCoder:aCoder];
|
||||
ORK_ENCODE_ENUM(aCoder, direction);
|
||||
ORK_ENCODE_CGPOINT(aCoder, initialOffset);
|
||||
ORK_ENCODE_CGPOINT(aCoder, targetOffset);
|
||||
ORK_ENCODE_CGPOINT(aCoder, endDraggingOffset);
|
||||
ORK_ENCODE_CGPOINT(aCoder, endScrollingOffset);
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
if (self = [super initWithCoder:aDecoder]) {
|
||||
ORK_DECODE_ENUM(aDecoder, direction);
|
||||
ORK_DECODE_CGPOINT(aDecoder, initialOffset);
|
||||
ORK_DECODE_CGPOINT(aDecoder, targetOffset);
|
||||
ORK_DECODE_CGPOINT(aDecoder, endDraggingOffset);
|
||||
ORK_ENCODE_CGPOINT(aDecoder, endScrollingOffset);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
ORKTouchAbilityScrollTrial *trial = [super copyWithZone:zone];
|
||||
trial.direction = self.direction;
|
||||
trial.initialOffset = self.initialOffset;
|
||||
trial.targetOffset = self.targetOffset;
|
||||
trial.endDraggingOffset = self.endDraggingOffset;
|
||||
trial.endScrollingOffset = self.endScrollingOffset;
|
||||
return trial;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
|
||||
BOOL isParentSame = [super isEqual:object];
|
||||
|
||||
__typeof(self) castObject = object;
|
||||
|
||||
return (isParentSame &&
|
||||
self.direction == castObject.direction &&
|
||||
CGPointEqualToPoint(self.initialOffset, castObject.initialOffset) &&
|
||||
CGPointEqualToPoint(self.targetOffset, castObject.targetOffset) &&
|
||||
CGPointEqualToPoint(self.endDraggingOffset, castObject.endDraggingOffset) &&
|
||||
CGPointEqualToPoint(self.endScrollingOffset, castObject.endScrollingOffset));
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,10 +1,33 @@
|
||||
//
|
||||
// ORKTouchAbilitySwipeContentView.m
|
||||
// ResearchKit
|
||||
//
|
||||
// Created by Tommy Lin on 2018/12/5.
|
||||
// Copyright © 2018 researchkit.org. All rights reserved.
|
||||
//
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#import "ORKTouchAbilitySwipeContentView.h"
|
||||
#import "ORKTouchAbilityArrowView.h"
|
||||
|
||||
@@ -41,7 +41,6 @@ ORK_CLASS_AVAILABLE
|
||||
@property (nonatomic, assign) UISwipeGestureRecognizerDirection resultDirection;
|
||||
@property (nonatomic, assign) BOOL success;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithTargetDirection:(UISwipeGestureRecognizerDirection)direction;
|
||||
|
||||
@end
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
NSLog(@"%@ dealloc", NSStringFromClass(self.class));
|
||||
ORK_Log_Debug(@"%@ dealloc", NSStringFromClass(self.class));
|
||||
}
|
||||
|
||||
#pragma mark - ORKTouchAbilityTapStepViewController
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
@import Foundation;
|
||||
#import <ResearchKit/ORKDefines.h>
|
||||
#import <ResearchKit/ORKActiveStep.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
ORK_CLASS_AVAILABLE
|
||||
@interface ORKTouchAbilityVerticalScrollStep : ORKActiveStep
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2018, Muh-Tarng Lin. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder(s) nor the names of any contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission. No license is granted to the trademarks of
|
||||
the copyright holders even if such marks are included in this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "ORKTouchAbilityVerticalScrollStep.h"
|
||||
#import "ORKTouchAbilityScrollStepViewController.h"
|
||||
#import "ORKhelpers_Internal.h"
|
||||
|
||||
@implementation ORKTouchAbilityVerticalScrollStep
|
||||
|
||||
+ (Class)stepViewControllerClass {
|
||||
return [ORKTouchAbilityScrollStepViewController class];
|
||||
}
|
||||
|
||||
- (instancetype)initWithIdentifier:(NSString *)identifier {
|
||||
self = [super initWithIdentifier:identifier];
|
||||
if (self) {
|
||||
self.shouldShowDefaultTimer = NO;
|
||||
self.shouldContinueOnFinish = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)validateParameters {
|
||||
[super validateParameters];
|
||||
|
||||
// TODO:
|
||||
}
|
||||
|
||||
- (BOOL)startsFinished {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user