File tree Expand file tree Collapse file tree 4 files changed +33
-14
lines changed Expand file tree Collapse file tree 4 files changed +33
-14
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
var ui_frame = require ( "ui/frame" ) ;
3
+ var application = require ( "application" ) ;
4
+ var platform = require ( "platform" ) ;
3
5
var page ;
4
6
var list ;
5
7
var album ;
6
8
function pageLoaded ( args ) {
7
9
page = args . object ;
8
10
page . bindingContext = page . navigationContext ;
9
11
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
+ } ) ;
10
19
}
11
20
exports . pageLoaded = pageLoaded ;
12
21
function done ( args ) {
Original file line number Diff line number Diff line change 1
1
import ui_frame = require( "ui/frame" ) ;
2
+ import application = require( "application" ) ;
3
+ import platform = require( "platform" ) ;
2
4
3
5
var page ;
4
6
var list ;
@@ -10,9 +12,14 @@ export function pageLoaded(args) {
10
12
list = page . getViewById ( "images-list" ) ;
11
13
12
14
// 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 ) ;
15
16
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
+ } ) ;
16
23
}
17
24
18
25
export function done ( args ) {
@@ -21,13 +28,4 @@ export function done(args) {
21
28
topmost . goBack ( ) ;
22
29
23
30
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
- }
33
31
}
Original file line number Diff line number Diff line change 18
18
},
19
19
"main" : " viewmodel.js" ,
20
20
"devDependencies" : {
21
- "tns-platform-declarations" : " * " ,
21
+ "tns-platform-declarations" : " next " ,
22
22
"typescript" : " ^2.0.3"
23
23
},
24
24
"scripts" : {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ var ImagePicker = (function (_super) {
28
28
ImagePicker . prototype . present = function ( ) {
29
29
var _this = this ;
30
30
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..." ) ) ;
32
32
}
33
33
else {
34
34
return new Promise ( function ( resolve , reject ) {
@@ -83,6 +83,13 @@ var ImagePicker = (function (_super) {
83
83
enumerable : true ,
84
84
configurable : true
85
85
} ) ;
86
+ Object . defineProperty ( ImagePicker . prototype , "newestFirst" , {
87
+ get : function ( ) {
88
+ return this . _options && ! ! this . _options . newestFirst ;
89
+ } ,
90
+ enumerable : true ,
91
+ configurable : true
92
+ } ) ;
86
93
ImagePicker . prototype . cancel = function ( ) {
87
94
this . notifyCanceled ( ) ;
88
95
} ;
@@ -367,7 +374,12 @@ var AlbumPH = (function (_super) {
367
374
this . _setThumb = true ;
368
375
this . imagePicker . createPHImageThumb ( this , asset ) ;
369
376
}
370
- this . assets . push ( item ) ;
377
+ if ( this . imagePicker . newestFirst ) {
378
+ this . assets . unshift ( item ) ;
379
+ }
380
+ else {
381
+ this . assets . push ( item ) ;
382
+ }
371
383
} ;
372
384
return AlbumPH ;
373
385
} ( Album ) ) ;
You can’t perform that action at this time.
0 commit comments