File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use strict" ;
22var ui_frame = require ( "ui/frame" ) ;
3+ var application = require ( "application" ) ;
4+ var platform = require ( "platform" ) ;
35var page ;
46var list ;
57var album ;
68function pageLoaded ( args ) {
79 page = args . object ;
810 page . bindingContext = page . navigationContext ;
911 list = page . getViewById ( "images-list" ) ;
12+ list . listViewLayout . spanCount = Math . floor ( platform . screen . mainScreen . widthDIPs / 80 ) ;
13+ application . on ( "orientationChanged" , function ( e ) {
14+ var currentPageWidth = platform . screen . mainScreen . heightDIPs ;
15+ console . log ( currentPageWidth ) ;
16+ console . log ( currentPageWidth ) ;
17+ list . listViewLayout . spanCount = Math . floor ( currentPageWidth / 80 ) ;
18+ } ) ;
1019}
1120exports . pageLoaded = pageLoaded ;
1221function done ( args ) {
Original file line number Diff line number Diff line change 11import ui_frame = require( "ui/frame" ) ;
2+ import application = require( "application" ) ;
3+ import platform = require( "platform" ) ;
24
35var page ;
46var list ;
@@ -10,9 +12,14 @@ export function pageLoaded(args) {
1012 list = page . getViewById ( "images-list" ) ;
1113
1214 // Get the current Size, and then adjust the number of columns based on it...
13- var size = iOSProperty ( UIScreen , UIScreen . mainScreen ) . bounds . size . width ;
14- list . listViewLayout . spanCount = Math . floor ( size / 80 ) ;
15+ list . listViewLayout . spanCount = Math . floor ( platform . screen . mainScreen . widthDIPs / 80 ) ;
1516
17+ application . on ( "orientationChanged" , function ( e :application . OrientationChangedEventData ) {
18+ var currentPageWidth = platform . screen . mainScreen . heightDIPs
19+ console . log ( currentPageWidth ) ;
20+ console . log ( currentPageWidth ) ;
21+ list . listViewLayout . spanCount = Math . floor ( currentPageWidth / 80 ) ;
22+ } ) ;
1623}
1724
1825export function done ( args ) {
@@ -21,13 +28,4 @@ export function done(args) {
2128 topmost . goBack ( ) ;
2229
2330 page . bindingContext . imagePicker . done ( ) ;
24- }
25-
26- function iOSProperty ( _this , property ) {
27- if ( typeof property === "function" ) {
28- return property . call ( _this ) ;
29- }
30- else {
31- return property ;
32- }
3331}
Original file line number Diff line number Diff line change 1818 },
1919 "main" : " viewmodel.js" ,
2020 "devDependencies" : {
21- "tns-platform-declarations" : " * " ,
21+ "tns-platform-declarations" : " next " ,
2222 "typescript" : " ^2.0.3"
2323 },
2424 "scripts" : {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ var ImagePicker = (function (_super) {
2828 ImagePicker . prototype . present = function ( ) {
2929 var _this = this ;
3030 if ( this . _resolve || this . _reject ) {
31- return Promise . reject ( new Error ( "Selection is allready in progress..." ) ) ;
31+ return Promise . reject ( new Error ( "Selection is already in progress..." ) ) ;
3232 }
3333 else {
3434 return new Promise ( function ( resolve , reject ) {
@@ -83,6 +83,13 @@ var ImagePicker = (function (_super) {
8383 enumerable : true ,
8484 configurable : true
8585 } ) ;
86+ Object . defineProperty ( ImagePicker . prototype , "newestFirst" , {
87+ get : function ( ) {
88+ return this . _options && ! ! this . _options . newestFirst ;
89+ } ,
90+ enumerable : true ,
91+ configurable : true
92+ } ) ;
8693 ImagePicker . prototype . cancel = function ( ) {
8794 this . notifyCanceled ( ) ;
8895 } ;
@@ -367,7 +374,12 @@ var AlbumPH = (function (_super) {
367374 this . _setThumb = true ;
368375 this . imagePicker . createPHImageThumb ( this , asset ) ;
369376 }
370- this . assets . push ( item ) ;
377+ if ( this . imagePicker . newestFirst ) {
378+ this . assets . unshift ( item ) ;
379+ }
380+ else {
381+ this . assets . push ( item ) ;
382+ }
371383 } ;
372384 return AlbumPH ;
373385} ( Album ) ) ;
You can’t perform that action at this time.
0 commit comments