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

[ANDROID] added LottieView in ListItem but only the last one is displayed #16

Closed
bduyng opened this issue Aug 2, 2017 · 7 comments · Fixed by #17
Closed

[ANDROID] added LottieView in ListItem but only the last one is displayed #16

bduyng opened this issue Aug 2, 2017 · 7 comments · Fixed by #17
Assignees

Comments

@bduyng
Copy link

bduyng commented Aug 2, 2017

Please check the below testing code and attached file.

Screenshot
screenshot_1501667367

Reproduce code

var TiAnimation = require('ti.animation');
var win = Ti.UI.createWindow({backgroundColor: 'white'});

var myTemplate = {
    properties: {
        width:  Ti.UI.FILL,
        height: 200
    },
    childTemplates: [
        {
            type:   'TiAnimation.LottieView',
            bindId: 'ani',
            properties: {
                file: 'sample_lottie.json',
                contentMode: 0,
                width: 150, height: 150,
                loop: false, autoStart: false,
                backgroundColor: 'blue'
            }
        },
        {
            type: 'Ti.UI.Label',
            bindId: 'info',
            properties: {
                color: 'black',
                font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
                left: '60dp', top: 0,
            }
        },
    ]
};

var listView = Ti.UI.createListView({
    templates: { 'template': myTemplate },
    efaultItemTemplate: 'template'
});
var sections = [];

var fruitSection = Ti.UI.createListSection();
var fruitDataSet = [
    { info: { text: 'Hello' }, ani: { top: 10, left: 10 }},
    { info: { text: 'World' }, ani: { top: 30, left: 30 }},
    { info: { text: 'Titanium' }, ani: { top: 50, left: 50 }}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

function onItemclick(e) {
    var item = e.section.getItemAt(e.itemIndex);
    item.ani.start = true;
    item.ani.onFinished = function() {
        item.ani.start = false
        e.section.updateItemAt(e.itemIndex, item);
    }
    e.section.updateItemAt(e.itemIndex, item);
}

listView.addEventListener('itemclick', onItemclick);

listView.setSections(sections);
win.add(listView);
win.open();
@m1ga m1ga self-assigned this Aug 3, 2017
@m1ga
Copy link
Owner

m1ga commented Aug 3, 2017

Thank you for the bug report. I'll have a look at it soon

@bduyng
Copy link
Author

bduyng commented Aug 3, 2017

Awesome! Thanks a lot @miga!!!. I can't wait to see the fix :). I also updated the lottie iOS to v2 and adding more apis to my fork. Will make a PR when I finish it

@m1ga
Copy link
Owner

m1ga commented Aug 12, 2017

@bduyng short update: I'm still testing. I've added some debug stuff and it looks like it is always using the last element.
Will do some refactoring to see what the problem is

@m1ga
Copy link
Owner

m1ga commented Aug 13, 2017

Progress!
screenshot_20170813-153827

Using a separate view file solves the problem! Have to convert some more code but it looks promising already

@bduyng
Copy link
Author

bduyng commented Aug 13, 2017

@m1ga: wow that is awesome! Thanks for you updates and hard working. Please let me know if you need any help. You mean use duplicate json will sloves the problem? I think we are really close!!!

@m1ga
Copy link
Owner

m1ga commented Aug 13, 2017

No, it was a conceptual mistake I did in the code. You can keep your code like it is and it will work

@bduyng
Copy link
Author

bduyng commented Aug 25, 2017

hi @m1ga, thanks for your awesome work!! I was missed your last message here but fortunately the issue is fixed now. Cheers!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants