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-24822] Fix TableView issue on Android N #9144

Merged
merged 5 commits into from Jun 26, 2017

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Jun 14, 2017

TEST CASE #1
  • This should not crash
var win = Ti.UI.createWindow({
        backgroundColor: 'gray',
        layout: 'vertical'
    }),
    tv = Ti.UI.createTableView({
        headerTitle: 'TableView',
        data: [
            {
                title: 'Apples',
                hasChild: true
            }, {
                title: 'Bananas'
            }
        ],
        height: Ti.UI.SIZE
    }),
    ls = Ti.UI.createListSection({
        headerTitle: 'ListView'
    }),
    lv = Ti.UI.createListView({
        height: Ti.UI.SIZE
    });

ls.setItems([
    {
        properties: {
            title: 'Apples',
            accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK
        }
    }, {
        properties: {
           title: 'Bananas',
           accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DETAIL
       }
    }
]);
lv.sections = [ls];

win.add(tv);
win.add(lv);
win.open();
TEST CASE #2
  • This should return the correct index positions
var win = Ti.UI.createWindow({
        backgroundColor: 'white',
        layout: 'vertical'
    }),
    tableData = [{
        title: 'Apples',
        color: 'black'
    }, {
        title: 'Bananas',
        color: 'black'
    }, {
        title: 'Carrots',
        color: 'black'
    }, {
        title: 'Potatoes',
        color: 'black'
    }],
    table = Ti.UI.createTableView({
        minRowHeight: 50,
        data: tableData,
        width: Ti.UI.FILL,
        height: Ti.UI.SIZE
    });
table.addEventListener('click', function(e) {
    alert('index: ' + e.index);
});
win.add(table);
win.open();

JIRA Ticket

// TIMOB-24560: prevent duplicate TableViewRowProxyItem on Android N
if (Build.VERSION.SDK_INT > 23) {
ArrayList<Item> models = viewModel.getViewModel();
if (models.contains(v.getRowData())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should check if "models" is null before using it.
It can be null if TableViewModel.release() gets called.

The rest looks fine. 👍

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

@ssjsamir ssjsamir self-requested a review June 26, 2017 21:02
@ssjsamir
Copy link
Contributor

FR Passed - 1st Test case no longer crashed and 2nd test case returned the correct index positions.

Test Steps

  • Downloaded the SDK Build form this PR
  • Created a new Titanium project
  • Copied the 1st test case from description
  • Ran the application
  • Saw the TableView and application did not crash
  • Copied the 2nd test case from description
  • Clicked on each item
  • Correct index was returned

Test Environment
Appcelerator Command-Line Interface, version 6.2.2
Google Nexus 6P (7.1.1)
Operating System Name: Mac OS X El Capitan
Operating System Version: 10.11.6
Node.js Version: 6.10.1
Xcode: 8.2
Appcelerator Studio: 4.9.0.201705251638

@ssjsamir ssjsamir merged commit aa4a45e into tidev:master Jun 26, 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