Code:
Ext.define('KTS.view.shared.Shared_film_detail', { extend: 'Ext.Container',
xtype: 'shared_film_detail',
config: {
layout: 'vbox',
cls: 'film_detail',
scrollable: 'vertical',
flex: 1,
items: [
{
xtype: 'container',
itemId: 'film_detail_top_container',
layout: 'hbox',
flex: 2,
items: [
{
xtype: 'image',
itemId: 'film_detail_poster',
style: '-webkit-box-ordinal-group: 1;',
flex: 7,
listeners: {
tap: function() {
this.up('shared_film_detail').fireEvent('poster_tapped', this.up('shared_film_detail'),this );
}
}
},
{
xtype: 'container',
flex: 2,
style: '-webkit-box-ordinal-group: 2;',
layout: 'vbox',
items: [
{
xtype: 'image',
src: 'css/images/FilmtijdIcon.svg',
style: 'background-position: bottom center; background-size: 50%;',
flex: 1,
},
{
xtype: 'label',
style: 'text-align: center',
itemId: 'film_detail_duration_text',
},
{
xtype: 'image',
id: 'film_detail_trailer_btn',
src: 'css/images/FilmtrailerIcon.svg',
style: 'background-position: bottom center; background-size: 50%;',
flex: 1,
},
{
xtype: 'label',
style: 'text-align: center',
html: __.FILM_DETAIL_TRAILER,
},
{
}
]
}
]
},
{
xtype: 'container',
layout: 'vbox',
flex: 1,
items: [
{
xtype: 'label',
itemId: 'film_detail_title',
cls: 'film_detail_title'
},
{
xtype: 'label',
itemId: 'film_detail_genre',
cls: 'film_detail_subtitle'
},
{
xtype: 'label',
itemId: 'film_detail_description',
cls: 'film_detail_text'
},
{
xtype: 'label',
cls: 'film_detail_subtitle',
html: __.FILM_DETAIL_DIRECTING,
},
{
xtype: 'label',
itemId: 'film_detail_directing',
cls: 'film_detail_text'
},
{
xtype: 'label',
cls: 'film_detail_subtitle',
html: __.FILM_DETAIL_CAST
},
{
xtype: 'label',
itemId: 'film_detail_cast',
cls: 'film_detail_text'
},
]
}
]
},
onOrientationChange: function(orientation) {
if(orientation == 'portrait') {
this.down('#film_detail_top_container').show();
} else if(orientation == 'landscape') {
this.down('#film_detail_top_container').hide();
}
},
updateWithMovie: function(r) {
this.setRecord(r);
//A whole lot to do for changing images.. damn you sencha
var poster = this.down('#film_detail_poster');
var config = poster.getInitialConfig();
config.src = r.get('ImageUrl');
this.down('#film_detail_top_container').remove(poster, true);
poster = new Ext.Img(config);
this.down('#film_detail_top_container').add(poster);
//Set other information
this.down('#film_detail_duration_text').setHtml(r.get('Length'));
this.down('#film_detail_title').setHtml(r.get('Title'));
this.down('#film_detail_genre').setHtml(r.get('Genre').join(', '));
this.down('#film_detail_description').setHtml(r.get('Description'));
this.down('#film_detail_directing').setHtml(r.get('Director'));
this.down('#film_detail_cast').setHtml(r.get('Cast').join(', '));
//get the scroller
this.getScrollable().getScroller().refreshMaxPosition();
this.getScrollable().getScroller().refresh();
this.getScrollable().getScroller().fireEvent('maxpositionchange', this.getScrollable().getScroller());
}
});