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

fix(android): do not set properties on recycled proxy #11302

Merged
merged 6 commits into from Nov 6, 2019

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Oct 29, 2019

  • Do not set properties on recycled ListView proxies
  • Retain accessibility functionality
TEST CASE #1
const win = Ti.UI.createWindow({
    backgroundColor: 'gray'
});
const listView = Ti.UI.createListView({
    templates: {
        template: {
            type: 'Ti.UI.View',
            childTemplates: [{
                type: 'Ti.UI.View',
                bindId: 'view',
                properties: {
                    height: 30,
                    backgroundColor: 'white'
                },
                childTemplates: [{
                    type: 'Ti.UI.Label',
                    bindId: 'label',
                    properties: {
                        color: 'black'
                    }
                }]
            }]
        }
    },
    defaultItemTemplate: 'template'
});

const items = [];
for (let i = 0; i < 18; i++) {
    items.push({
        template: 'template',
        label: {
            text: `Item #${i}`
        }
    });
}
items.push({
    template: 'template',
    label: {
        text: `Item #19`
    },
    view: {
        backgroundColor: 'red'
    }
});
listView.sections = [Ti.UI.createListSection({
    items
})];

win.add(listView);
win.open();
  • Only the last list entry should have a red background.
TEST CASE #2
const win = Ti.UI.createWindow({
    backgroundColor: 'white'
});
const listView = Ti.UI.createListView({
    templates: {
        template: {
            childTemplates: [{
                    type: 'Ti.UI.Label',
                    bindId: 'info',
                    properties: {
                        color: 'black',
                        font: {
                            fontFamily: 'Arial',
                            fontSize: '20dp',
                            fontWeight: 'bold'
                        },
                        left: '60dp',
                        top: 0
                    }
                },
                {
                    type: 'Ti.UI.Label',
                    bindId: 'es_info',
                    properties: {
                        color: 'gray',
                        font: {
                            fontFamily: 'Arial',
                            fontSize: '14dp'
                        },
                        left: '60dp',
                        top: '25dp'
                    }
                }
            ]
        }
    },
    defaultItemTemplate: 'template'
});

listView.setSections([
    Ti.UI.createListSection({
        headerTitle: 'Fruits / Frutas',
        items: [{
                info: {
                    text: 'Apple',
                    accessibilityLabel: 'Apple Label'
                },
                es_info: {
                    text: 'Manzana',
                    accessibilityHint: 'Manzana Hint'
                }
            },
            {
                info: {
                    text: 'Banana',
                    accessibilityLabel: 'Banana Label',
                    accessibilityValue: 'Banana Value'
                },
                es_info: {
                    text: 'Banana',
                    accessibilityHint: 'Banana Hint',
                    accessibilityValue: 'Banana Value'
                }
            }
        ]
    })
]);

win.add(listView);
win.open();
  • Enable Text-to-Speech
  • Select each item to confirm accessibilityHint has been set

JIRA Ticket

@build
Copy link
Contributor

build commented Oct 29, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖

✅ All tests are passing
Nice one! All 4268 tests are passing.
(There are 473 skipped tests not included in that total)

📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.

Generated by 🚫 dangerJS against 8a03dc7

@hansemannn
Copy link
Collaborator

Thanks for this! We have been workarounding this issue for a long time.

Copy link
Contributor

@jquick-axway jquick-axway 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

@lokeshchdhry
Copy link
Contributor

@garymathews , the build is failing with:

[2019-10-30T16:45:34.777Z] [javac] /Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-11302/android/titanium/src/java/org/appcelerator/titanium/proxy/MenuItemProxy.java:177: error: cannot find symbol
[2019-10-30T16:45:34.777Z] [javac] 		String contentDescription = composeContentDescription();
[2019-10-30T16:45:34.777Z]     [javac] 		                            ^
[2019-10-30T16:45:34.777Z]     [javac]   symbol:   method composeContentDescription()
[2019-10-30T16:45:34.777Z]     [javac]   location: class MenuItemProxy

@lokeshchdhry
Copy link
Contributor

FR Passed.

Studio Ver: 5.1.4.201909061933
SDK Ver: 8.3.0 local build
OS Ver: 10.14.5
Xcode Ver: Xcode 11.1
Appc NPM: 4.2.15
Appc CLI: 7.1.2-master.3
Daemon Ver: 1.1.3
Ti CLI Ver: 5.2.2
Alloy Ver: 1.14.1
Node Ver: 10.16.1
NPM Ver: 6.9.0
Java Ver: 10.0.2
Android Devices: ⇨ google Pixel (Android 9)
Emulator: Android 4.4

@sgtcoolguy sgtcoolguy merged commit e4459a1 into tidev:master Nov 6, 2019
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

8 participants