-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathRCTImageSequenceManager.java
More file actions
81 lines (70 loc) · 2.32 KB
/
RCTImageSequenceManager.java
File metadata and controls
81 lines (70 loc) · 2.32 KB
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
package dk.madslee.imageSequence;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
import java.util.ArrayList;
public class RCTImageSequenceManager extends SimpleViewManager<RCTImageSequenceView> {
@Override
public String getName() {
return "RCTImageSequence";
}
@Override
protected RCTImageSequenceView createViewInstance(ThemedReactContext reactContext) {
return new RCTImageSequenceView(reactContext);
}
/**
* sets the speed of the animation.
*
* @param view
* @param framesPerSecond
*/
@ReactProp(name = "framesPerSecond")
public void setFramesPerSecond(final RCTImageSequenceView view, Integer framesPerSecond) {
view.setFramesPerSecond(framesPerSecond);
}
/**
* @param view
* @param images an array of ReadableMap's {uri: "http://...."} return value of the resolveAssetSource(....)
*/
@ReactProp(name = "images")
public void setImages(final RCTImageSequenceView view, ReadableArray images) {
ArrayList<String> uris = new ArrayList<>();
for (int index = 0; index < images.size(); index++) {
ReadableMap map = images.getMap(index);
uris.add(map.getString("uri"));
}
view.setImages(uris);
}
/**
* sets if animations is looped indefinitely.
*
* @param view
* @param loop
*/
@ReactProp(name = "loop")
public void setLoop(final RCTImageSequenceView view, Boolean loop) {
view.setLoop(loop);
}
/**
* sets the width for optional downsampling.
*
* @param view
* @param downsampleWidth
*/
@ReactProp(name = "downsampleWidth")
public void setDownsampleWidth(final RCTImageSequenceView view, Integer downsampleWidth) {
view.setDownsampleWidth(downsampleWidth);
}
/**
* sets the height for optional downsampling.
*
* @param view
* @param downsampleHeight
*/
@ReactProp(name = "downsampleHeight")
public void setDownsampleHeight(final RCTImageSequenceView view, Integer downsampleHeight) {
view.setDownsampleHeight(downsampleHeight);
}
}