Backout 052d4aab3722

Reviewed By: mkonicek

Differential Revision: D2586735

fb-gh-sync-id: 477a1c84fcf2a22b681407c7e93102dd59118f25
This commit is contained in:
Krzysztof Magiera
2015-10-27 12:57:04 -07:00
committed by facebook-github-bot-0
parent 1c1e1ece99
commit 0e4dec930b
5 changed files with 57 additions and 8 deletions

View File

@@ -9,6 +9,9 @@
package com.facebook.react.uimanager;
import android.os.SystemClock;
import android.support.v4.util.Pools;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.Event;
@@ -19,10 +22,30 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
*/
/* package */ class OnLayoutEvent extends Event<OnLayoutEvent> {
private final int mX, mY, mWidth, mHeight;
private static final Pools.SynchronizedPool<OnLayoutEvent> EVENTS_POOL =
new Pools.SynchronizedPool<>(20);
protected OnLayoutEvent(int viewTag, int x, int y, int width, int height) {
super(viewTag, 0);
private int mX, mY, mWidth, mHeight;
public static OnLayoutEvent obtain(int viewTag, int x, int y, int width, int height) {
OnLayoutEvent event = EVENTS_POOL.acquire();
if (event == null) {
event = new OnLayoutEvent();
}
event.init(viewTag, x, y, width, height);
return event;
}
@Override
public void onDispose() {
EVENTS_POOL.release(this);
}
private OnLayoutEvent() {
}
protected void init(int viewTag, int x, int y, int width, int height) {
super.init(viewTag, SystemClock.uptimeMillis());
mX = x;
mY = y;
mWidth = width;