-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME
126 lines (106 loc) · 3.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
OXGAssetsPicker
==============
It's ALAssets Picker For Titanium.
Features
--------
- Album View
- Photo View
- Support EXIF
- Click Event Base
Screenshots
-----------
![Albums](https://github.com/hiphapis/OXGAssetsPicker/blob/master/screenshots/albums.png?raw=true)
![Photos](https://github.com/hiphapis/OXGAssetsPicker/blob/master/screenshots/photos.png?raw=true)
Demo
----
You can show Album View & Photo View.
Follow this code (from example/app.js)
var win = Ti.UI.createWindow({});
var albumWin = Ti.UI.createWindow({ title: "Albums" });
var nav = Titanium.UI.iPhone.createNavigationGroup({ window: albumWin });
win.add(nav);
var OXGAssetsPicker = require('com.oxgcp.assetpicker');
Ti.API.info("module is => " + OXGAssetsPicker);
var album = OXGAssetsPicker.createAlbumView({
top:0,
left:0,
width:Ti.UI.FILL,
height:Ti.UI.FILL,
backgroundColor:'#000fff',
});
albumWin.add(album);
album.addEventListener('album:selected', function(ae) {
console.log(ae);
var photoWin = Titanium.UI.createWindow({ title: ae.groupName });
var photo = OXGAssetsPicker.createPhotoView({
groupName: ae.groupName, // load all photos If you remove property of groupName
filter: "photo", // or "video", "all"
backgroundColor:'#fff000', // set clearColor If you remove property of backgroundColor
top:0,
left:0,
width:320,
height:460,
multiple: true,
limit: 2,
});
photoWin.add(photo);
photo.addEventListener('photo:selected', function(pe) {
console.log(pe);
});
photo.addEventListener('photo:limit', function(pe) {
console.log("limit");
});
nav.open(photoWin, { animated:true });
});
win.open();
Run Simulator
`$ titanium run`
Help: [Step 0: Setting Up your Module Environment](http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_Module_Development_Guide-section-29004946_iOSModuleDevelopmentGuide-Step0%3ASettingUpyourModuleEnvironment)
If you want Packagin and Distribution Then read it.
[Step 3: Packaging your Module for Distribution](http://docs.appcelerator.com/titanium/latest/#!/guide/iOS_Module_Development_Guide-section-29004946_iOSModuleDevelopmentGuide-Step3%3APackagingyourModuleforDistribution)
ALBUM
-----
var win = Ti.UI.createWindow({});
var album = OXGAssetsPicker.createAlbumView({
top:0,
left:0,
width:Ti.UI.FILL,
height:Ti.UI.FILL,
backgroundColor:'#000fff',
});
album.addEventListener('album:selected', function(ae) {
console.log("groupName: " + ae.groupName);
console.log("numberOfAssets: " + ae.numberOfAssets);
});
win.add(album);
### Return
- groupName: return selected group name.
- numberOfAssets : return assets count of selected group.
PHOTO
-----
var win = Ti.UI.createWindow({});
var photo = OXGAssetsPicker.createPhotoView({
top:0,
left:0,
width:Ti.UI.FILL,
height:Ti.UI.FILL,
backgroundColor:'#fff000',
});
photo.addEventListener('photo:selected', function(pe) {
console.log(pe);
});
win.add(photo);
### Property
- groupName: (optional)
- filter: (optional) *all, photo, video
- multiple: (optional) *false, true
- sort: (optional) *nil, recent => nil is created_at asc
- limit: (optional) *nil,
- selectedPhotos: (optional) *nil => array of selected photo index [1,2,3]
### Return
- image
- index
- meta
- exif
- selected
- url