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-25086] Android: Modified TextArea and vertical ScrollView to support nested scrolling. #9402

Merged
merged 7 commits into from
Sep 8, 2017

Conversation

jquick-axway
Copy link
Contributor

JIRA: https://jira.appcelerator.org/browse/TIMOB-25086

Summary:

  • TextArea:
    • Can now be scrolled vertically within a ScrollView, TableView, or ListView.
    • Will scroll parent ScrollView when reaching top/bottom scroll bounds of TextArea. (All OS versions.)
    • Will scroll parent TableView/ListView on Android 4.4 and above when reaching scroll bounds.
  • Vertical ScrollView:
    • Can now be scrolled within another ScrollView, TableView, or ListView.
    • Will scroll parent ScrollView when reaching top/bottom scroll bounds. (All OS versions.)
    • Will scroll parent TableView/ListView on Android 4.4 and above when reaching scroll bounds.
  • Modified TextField/TextArea to use Google's "TextInputEditText" class:
    • Resolves warning logged by the new "TextInputLayout" class Titanium using.
    • Displays hint text in IME when in "extract" mode.

ScrollView Test:

  1. Run TIMOB-25086 script ScrollViewTextAreasTest.js on Android.
  2. Scroll one of the TextAreas fields up and down.
  3. Verify that the TextArea scrolls.
  4. Verify when scrolling up, ScrollView scrolls up when reaching bounds of the TextArea.
  5. Verify when scrolling down, ScrollView scrolls down when reaching bounds of the TextArea.
  6. Do a long-press on one of the words in the TextArea.
  7. Verify that the word gets highlighted.
  8. Tap another TextArea.
  9. Verify that the tapped TextArea is in edit mode.
  10. Scroll the ScrollView itself by dragging the left side of the view.

TableView Test:

  1. Run TIMOB-25086 script TableOfTextAreasTest.js on Android 5.0 or higher.
  2. Scroll one of the TextAreas fields up and down.
  3. Verify that the TextArea scrolls.
  4. Verify when scrolling up, TableView scrolls up when reaching bounds of the TextArea. (Only supported on Android 4.4 and higher.)
  5. Verify when scrolling down, TableView scrolls down when reaching bounds of the TextArea. (Only supported on Android 4.4 and higher.)
  6. Do a long-press on one of the words in the TextArea.
  7. Verify that the word gets highlighted.
  8. Tap another TextArea.
  9. Verify that the tapped TextArea is in edit mode.
  10. Scroll the TableView itself by dragging the left side of the view.
  11. Run steps 2-10 above on an Android 4.4 device.
  12. Run steps 2-10 above on an Android 4.1 device. (Note steps 4 and 5 where TableView cannot be scrolled when scrolling TextArea. This is normal.)

Deeply Nested Scrolling Test:

  1. Run TIMOB-25086 script ScrollViewNestingTest.js on Android.
  2. Verify that WebViews cannot be scrolled.
  3. Verify that the TextArea can be scrolled vertically.
  4. Verify that the inner/nested vertical ScrollView can be scrolled.
  5. Verify that the horizontal ScrollView can be scrolled.
  6. Verify that the TableView can be scrolled. (This is only supported on Android 5.0 and higher.)
  7. Verify that the ListView can be scrolled. (This is only supported on Android 5.0 and higher.)
  8. Tap the floating blue "Disable canCancelEvents" button in the bottom right corner. (Window's main ScrollView cannot be scrolled in this mode except via a scrollable child view.)
  9. Verify that the ListView can be scrolled. (Works on all Android OS version.)
  10. Verify that the TableView can be scrolled. (Works on all Android OS version.)
  11. Verify that the horizontal ScrollView can be scrolled.
  12. Verify that the inner/nested vertical ScrollView can be scrolled.
  13. Verify that the WebViews can be scrolled.

…e scrollable within another scrollable view.

- Created new TiListView class:
  * New class used by Titanium ListView and TableView.
  * Needed to support nested scrolling child views on OS versions older than Android 5.0.
  * Moved TiListView "canScroll" property to this new class. (This means we can support "Ti.UI.TableView.scrollable" property in the future.)
private static class ApiLevel16
{
/** Constructor made private to prevent instances from being made. */
private ApiLevel16() {}
Copy link
Contributor

@garymathews garymathews Sep 8, 2017

Choose a reason for hiding this comment

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

Minor, you can make this an abstract class to prevent instances from being made instead of creating a private constructor.

private static abstract class ApiLevel16

Same for the others

* @param listView The list view to be scrolled. Can be null, in which case this method will no-op.
* @param y The y-axis distance in pixels to scroll the list view by.
*/
public static void scrollListBy(ListView listView, int y)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure of the benefit of this since there are a lot of dalvikvm reference warnings from the support libraries themselves. But since it's here, why not?

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: minor, see above
FT: PASS

Awesome!! 🎉

Copy link
Contributor

@mukherjee2 mukherjee2 left a comment

Choose a reason for hiding this comment

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

Tested with this environment:
Node Version: 6.10.3
NPM Version: 3.10.10
Mac OS: 10.12.4
Appc CLI: 6.2.4-master.9
Appc CLI NPM: 4.2.9
Titanium SDK version: 7.0.0.v20170907111553
Appcelerator Studio, build: 4.9.1.201707200100
Android OS 4.1, 4.4, 7.1

I tested with the above Android OS versions as specified in the test cases. The three test cases that Josh wrote in this PR were used to validate the fix. All passed.

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.

3 participants