Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[TIMOB-25360] Android: ScrollView enhancements #9513

Merged
merged 8 commits into from Oct 23, 2017

Conversation

jquick-axway
Copy link
Contributor

JIRA:

Summary:

  • TIMOB-25197 Added RefreshControl support to vertical and horizontal ScrollViews.
  • TIMOB-8898 Added Ti.UI.FIll and Ti.UI.SIZE support to ScrollView "contentWidth" and "contentHeight" properties.
  • TIMOB-25360 ScrollView child views that use Ti.UI.FILL should do a 100% fill like iOS if contentWidth/Height properties are not set.
  • TIMOB-25377 ScrollView child percent size/position should be relative to container size, like iOS.
    • Was relative to ScrollView's scrollable content area.
  • TIMOB-12153 ListView/TableView height set to Ti.UI.SIZE will return wrong height when put inside a ScrollView.
    • Was returning a height equivalent to Ti.UI.FILL, which was limited to size of parent view or window.
  • Improved ScrollView measurement/layout performance:
    • Was always doing a 2-pass measurement, which would cause issues with percentage calculations.
    • Now only does a 1-pass measurement.

Vertical ScrollView RefreshControl Test:

  1. Run script "RefreshVScrollViewTest.js" that is attached to TIMOB-25197 on Android.
  2. Attempt to swipe down on the ScrollView.
  3. Verify that a refresh control is NOT displayed.
  4. Tap the "Enable Refresh" button.
  5. Swipe down on the ScrollView.
  6. Verify that a refresh control is displayed and a new row is added 2 seconds later.
  7. Swipe down on the ScrollView.
  8. Verify that a red refresh control is displayed.
  9. Swipe down on the ScrollView.
  10. Verify that a green refresh control is displayed.
  11. Swipe down on the ScrollView.
  12. Verify that a blue refresh control is displayed.
  13. Change orientation to landscape.
  14. Keep swiping down until the ScrollView becomes scrollable.
  15. Verify that the ScrollView's contents can still be scrolled.

Horizontal ScrollView RefreshControl Test:

  1. Run script "RefreshHScrollViewTest.js" that is attached to TIMOB-25197 on Android.
  2. Attempt to swipe down on the ScrollView.
  3. Verify that a refresh control is NOT displayed.
  4. Tap the "Enable Refresh" button.
  5. Swipe down on the ScrollView.
  6. Verify that a refresh control is displayed and a new row is added 2 seconds later.
  7. Keep swiping down until the ScrollView becomes scrollable.
  8. Verify that the ScrollView's contents can be scroll horizontally.

ScrollView Percent Test:

  1. Run test code attached to TIMOB-25377 on Android.
  2. Verify that green view fills 50% of the vertical space within the window.
  3. Scroll to the bottom.
  4. Verify that blue view fills 100% of the window.
  5. Change orientation from portrait to landscape (or vice-versa).
  6. Repeat steps 2-4 above.

Vertical ScrollView Fill Test:

  1. Run script "VerticalScrollFillTest.js" that is attached to TIMOB-25360 on Android.
  2. Scroll down to the blue view.
  3. Verify that the blue view takes up 100% of the window.
  4. Scroll down to the purple view.
  5. Verify that the purple view takes up 100% of the window.

(See the JIRA case's attached "VerticalScrollFill-Good.gif" for example of expected result.)


Horizontal ScrollView Fill Test:

  1. Run script "HorizontalScrollFillTest.js" that is attached to TIMOB-25360 on Android.
  2. Scroll right to the blue view.
  3. Verify that the blue view takes up 100% of the window.
  4. Scroll right to the purple view.
  5. Verify that the purple view takes up 100% of the window.

(See the JIRA case's attached "HorizontalScrollFill-Good.gif" for example of expected result.)


ScrollView "contentHeight" Fill Test:

  1. Run test code attached to TIMOB-8898 on Android.
  2. Attempt to scroll down.
  3. Verify that you can't scroll down. (This is because "contentHeight" is set to Ti.UI.FILL, which limits scrollable height to container's height.)

ScrollView TableView Size Test:

  1. Run test code attached to TIMOB-12153 on Android.
  2. Verify that you can scroll down to the bottom.

(Note that the TableView is not scrollable. Instead, the TableView is using Ti.UI.SIZE for height and you're scrolling the ScrollView instead.)

- [TIMOB-25197] Added RefreshControl support to vertical and horizontal ScrollViews.
- [TIMOB-8898] Added Ti.UI.FIll and Ti.UI.SIZE support to ScrollView "contentWidth" and "contentHeight" properties.
- [TIMOB-25360] ScrollView child views that use Ti.UI.FILL should do a 100% fill like iOS if contentWidth/Height properties are not set.
- [TIMOB-25377] ScrollView child percent size/position should be relative to container size, like iOS.
  * Was relative to ScrollView's scrollable content area.
- [TIMOB-12153] ListView/TableView height set to Ti.UI.SIZE will return wrong height when put inside a ScrollView.
  * Was returning a height equivalent to Ti.UI.FILL, which was limited to size of parent view or window.
- Improved ScrollView measurement/layout performance:
  * Was always doing a 2-pass measurement, which would cause issues with percentage calculations.
  * Now only does a 1-pass mearurement.
@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Oct 10, 2017

FR Passed. Used the test code in the tickets to test :

  1. https://jira.appcelerator.org/browse/TIMOB-25197 : RefreshControl works as expected in a horizontal & vertical scrollview.
  2. https://jira.appcelerator.org/browse/TIMOB-25360 : width & height set to Ti.UI.FILL is displayed in parity to IOS.
  3. https://jira.appcelerator.org/browse/TIMOB-25377 : ScrollView child with percent size are displayed as expected & fill the scrollView appropriately.
  4. https://jira.appcelerator.org/browse/TIMOB-12153 : Scrollview with a tableview does scroll as expected if contentHeight is set to auto.
  5. https://jira.appcelerator.org/browse/TIMOB-8898 : FILL behavior on contentWidth/contentHeight property of scroll view works as expected.

Studio Ver: 4.10.0.201709271713
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.10-2
Appc CLI: 6.3.0-master.7
Ti CLI Ver: 5.0.14
Alloy Ver: 1.10.5
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Pixel --- Android 7.1.1
Emulator: Android 6.0.0

* Determines if this view's onMeasure() has been called.
* @return Returns true if this view's onMeasure() has been called. Returns false if not.
*/
public boolean wasOnMeasureCalled()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this getOnMeasureCalled ?

for (int index = getChildCount() - 1; index >= 0; index--) {
// Fetch the next child.
View child = getChildAt(index);
if (child == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could combine if statements:

if (child == null || child.getVisibility() == View.GONE) {
    continue;
}

if (newValue instanceof RefreshControlProxy) {
Log.w(TAG, REFRESH_CONTROL_NOT_SUPPORTED_MESSAGE);
View nativeView = getNativeView();
if (newValue == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified to:

if (nativeView instanceof TiSwipeRefreshLayout) {
	RefreshControlProxy.unassignFrom((TiSwipeRefreshLayout) nativeView);

	if (newValue instanceof RefreshControlProxy) {
		((RefreshControlProxy) newValue).assignTo((TiSwipeRefreshLayout) nativeView);
	}
} else {
	Log.e(TAG, "Invalid value assigned to property '" + key + "'. Must be of type 'RefreshControl'.");
}

@jquick-axway
Copy link
Contributor Author

Updated PR based on feedback.

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@jquick-axway
Copy link
Contributor Author

@lokeshchdhry, this PR can be merged now.

@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Oct 23, 2017

Merging this PR as of now, but the regressions for scrollview :
https://jira.appcelerator.org/browse/TIMOB-25415
https://jira.appcelerator.org/browse/TIMOB-25411
https://jira.appcelerator.org/browse/TIMOB-25410
will be addressed in another PR with the fix for master.
Also, the above tickets this PR addresses will be again verified with the PR with regression fixes.

@lokeshchdhry lokeshchdhry merged commit e5f3c08 into tidev:master Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants