Skip to content

Instantly share code, notes, and snippets.

@AppWerft
Created April 16, 2015 14:54
Show Gist options
  • Save AppWerft/fc842df9475a387477a4 to your computer and use it in GitHub Desktop.
Save AppWerft/fc842df9475a387477a4 to your computer and use it in GitHub Desktop.
module.exports = function(_video) {
var self = require('ui/win')({
videoItem : _video,
title : Ti.Android ? 'Wein Videos' : _video.title,
subtitle : _video.title,
layout : 'vertical'
});
self.addEventListener('open', function() {
self.add(Ti.UI.createImageView({
image : 'http://i.ytimg.com/vi/' + _video.video + '/maxresdefault.jpg',
top : 0,
width : Ti.UI.FILL,
height : Ti.UI.SIZE
}));
self.children[0].addEventListener('postlayout', addText);
function addText() {
self.add(Ti.UI.createScrollView({
scrollType : 'vertical',
contentWidth : Ti.UI.FILL,
layout : 'vertical',
top : 0
}));
self.children[1].addEventListener('scroll', function(_e) {
self.children[0].top = -_e.source.contentOffset.y * 0.9;
});
self.children[1].add(Ti.UI.createLabel({
top : 10,
left : 10,
right : 10,
height : Ti.UI.SIZE,
bottom : 50,
text : _video.description,
font : {
fontFamily : 'TVinoBold',
fontSize : 20
},
width : Ti.UI.FILL
}));
self.children[0].removeEventListener('postlayout', addText);
}
self.children[0].addEventListener('click', function() {
if (_video.latlng)
var mapwin = require('ui/mapwin')(_video).open();
});
});
Ti.Android && self.addEventListener('open', require('ui/detailwin.actionbar'));
return self;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment