本文整理匯總了Java中com.facebook.react.uimanager.events.RCTEventEmitter類的典型用法代碼示例。如果您正苦於以下問題:Java RCTEventEmitter類的具體用法?Java RCTEventEmitter怎麽用?Java RCTEventEmitter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RCTEventEmitter類屬於com.facebook.react.uimanager.events包,在下文中一共展示了RCTEventEmitter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleError
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
private void handleError() {
LogUtils.d(TAG, "handleError");
if(tweetView != null) {
tweetView.setVisibility(View.INVISIBLE);
}
WritableMap evt = Arguments.createMap();
evt.putString("message", "Could not load tweet");
ReactContext ctx = (ReactContext) getContext();
ctx.getJSModule(RCTEventEmitter.class).receiveEvent(
getId(),
"onLoadError",
evt);
}
示例2: createViewInstance
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
protected PLVideoTextureView createViewInstance(ThemedReactContext reactContext) {
themedReactContext = reactContext;
LayoutInflater inflater=LayoutInflater.from(reactContext);
mEventEmitter=reactContext.getJSModule(RCTEventEmitter.class);
//plVideoTextureView=(PLVideoTextureView) inflater.inflate(R.layout.video_view,null);
plVideoTextureView=new PLVideoTextureView(reactContext);
plVideoTextureView.setOnPreparedListener(mOnPreparedListener);
plVideoTextureView.setOnInfoListener(mOnInfoListener);
plVideoTextureView.setOnErrorListener(mOnErrorListener);
plVideoTextureView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
plVideoTextureView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
plVideoTextureView.setOnCompletionListener(mOnCompletionListener);
plVideoTextureView.setOnSeekCompleteListener(mOnSeekCompleteListener);
reactContext.addLifecycleEventListener(this);//監聽LifecycleEventListener的生命周期需要添加這句
return plVideoTextureView;
}
示例3: createViewInstance
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
this.reactContext = reactContext;
mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
mVideoView = new PLVideoView(reactContext);
// Set some listeners
mVideoView.setOnPreparedListener(mOnPreparedListener);
mVideoView.setOnInfoListener(mOnInfoListener);
mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
mVideoView.setOnCompletionListener(mOnCompletionListener);
mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mVideoView.setOnErrorListener(mOnErrorListener);
reactContext.addLifecycleEventListener(this);
return mVideoView;
}
示例4: createViewInstance
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
protected RNBottomNavigation createViewInstance(final ThemedReactContext reactContext) {
final RNBottomNavigation bottomNavigation = new RNBottomNavigation(reactContext);
bottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
WritableMap event = Arguments.createMap();
event.putInt("selectedPosition", item.getOrder());
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
bottomNavigation.getId(),
"topChange",
event
);
return true;
}
});
return bottomNavigation;
}
開發者ID:timomeh,項目名稱:react-native-android-bottom-navigation,代碼行數:22,代碼來源:RNBottomNavigationManager.java
示例5: onException
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public boolean onException(
Exception e,
GlideUrl uri,
Target<GlideDrawable> target,
boolean isFirstResource
) {
OkHttpProgressGlideModule.forget(uri.toStringUrl());
if (!(target instanceof ImageViewTarget)) {
return false;
}
ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
示例6: onResourceReady
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public boolean onResourceReady(
GlideDrawable resource,
GlideUrl uri,
Target<GlideDrawable> target,
boolean isFromMemoryCache,
boolean isFirstResource
) {
if (!(target instanceof ImageViewTarget)) {
return false;
}
ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, new WritableNativeMap());
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
示例7: dispatch
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
WritableMap eventData = null;
if (mImageUri != null || mEventType == ON_LOAD) {
eventData = Arguments.createMap();
if (mImageUri != null) {
eventData.putString("uri", mImageUri);
}
if (mEventType == ON_LOAD) {
WritableMap source = Arguments.createMap();
source.putDouble("width", mWidth);
source.putDouble("height", mHeight);
if (mImageUri != null) {
source.putString("url", mImageUri);
}
eventData.putMap("source", source);
}
}
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), eventData);
}
示例8: createJSModules
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
DeviceEventManagerModule.RCTDeviceEventEmitter.class,
JSTimersExecution.class,
RCTEventEmitter.class,
RCTNativeAppEventEmitter.class,
AppRegistry.class,
com.facebook.react.bridge.Systrace.class,
HMRClient.class));
if (ReactBuildConfig.DEBUG) {
jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
jsModules.add(JSCHeapCapture.HeapCapture.class);
jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
}
return jsModules;
}
示例9: onDateSelected
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
@SuppressLint("SimpleDateFormat") SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
Calendar calendar = date.getCalendar();
WritableMap event = Arguments.createMap();
event.putString("date", df.format(calendar.getTime()));
event.putBoolean("selected", selected);
ReactContext reactContext = (ReactContext) getContext();
reactContext
.getJSModule(RCTEventEmitter.class)
.receiveEvent(
getId(),
"topDateChange",
event
);
}
示例10: onLoadFailed
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
ThemedReactContext context = view.getThemedReactContext();
if (context != null) {
WritableMap event = Arguments.createMap();
if (e != null) {
event.putString("error", e.getMessage());
} else {
event.putString("error", "Unknown");
}
final Uri uri = view.getImageUri();
if (uri != null) {
event.putString("uri", uri.toString());
}
context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event);
}
}
示例11: RCTVideoView
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
public RCTVideoView(ThemedReactContext themedReactContext) {
super(themedReactContext);
mEventEmitter = themedReactContext.getJSModule(RCTEventEmitter.class);
Vitamio.isInitialized(themedReactContext);
mProgressUpdateRunnable = new Runnable() {
@Override
public void run() {
if (mMediaPlayerValid) {
WritableMap event = Arguments.createMap();
event.putDouble(EVENT_PROP_CURRENT_TIME, getCurrentPosition() / 1000.0);
event.putDouble(EVENT_PROP_PLAYABLE_DURATION, mVideoBufferedDuration / 1000.0);
mEventEmitter.receiveEvent(getId(), Events.EVENT_PROGRESS.toString(), event);
}
mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable, 250);
}
};
mProgressUpdateHandler.post(mProgressUpdateRunnable);
}
示例12: onMapClick
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
/**
* Called after a tap gesture at a particular coordinate, but only if a marker was not tapped.
*
* @param latLng
*/
@Override
public void onMapClick(LatLng latLng) {
WritableMap event = Arguments.createMap();
WritableMap data = Arguments.createMap();
data.putDouble("latitude", latLng.latitude);
data.putDouble("longitude", latLng.longitude);
event.putString("event", "didTapAtCoordinate");
event.putMap("data", data);
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
mapView.getId(),
"topChange",
event
);
}
示例13: handleMarkerEvent
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
/**
* Handles marker events by emitting react events.
*
* @param eventName
* @param marker
*/
private void handleMarkerEvent(String eventName, Marker marker) {
WritableMap event = Arguments.createMap();
WritableMap data = Arguments.createMap();
data.putDouble("latitude", marker.getPosition().latitude);
data.putDouble("longitude", marker.getPosition().longitude);
data.putString("publicId", publicMarkerIds.get(marker.getId()));
event.putString("event", "didTapMarker");
event.putMap("data", data);
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
mapView.getId(),
"topChange",
event
);
}
示例14: onImageFileSaved
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
@Override
protected void onImageFileSaved(String imagePath) {
super.onImageFileSaved(imagePath);
WritableMap event = Arguments.createMap();
event.putString("message", "file://" + imagePath);
event.putString("type", "camera_capture");
ReactContext reactContext = (ReactContext)getContext();
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
getId(),
"topChange",
event
);
stopCamera();
startCamera();
}
示例15: initMenu
import com.facebook.react.uimanager.events.RCTEventEmitter; //導入依賴的package包/類
private void initMenu(float density) {
mShowMenu = true;
if (mChatInput.getSoftInputState()) {
EmoticonsKeyboardUtils.closeSoftKeyboard(mChatInput.getInputView());
}
if (mChatInput.getSoftInputState() || mChatInput.getMenuState() == View.VISIBLE) {
EventBus.getDefault().post(new ScrollEvent(false));
} else {
EventBus.getDefault().post(new ScrollEvent(true));
}
WritableMap event = Arguments.createMap();
if (mChatInput.getSoftKeyboardHeight() == 0) {
event.putDouble("height", mInitialChatInputHeight + mMenuContainerHeight / density);
} else {
event.putDouble("height", mInitialChatInputHeight + mChatInput.getSoftKeyboardHeight() / density);
}
mContext.getJSModule(RCTEventEmitter.class).receiveEvent(mChatInput.getId(), ON_INPUT_SIZE_CHANGED_EVENT, event);
}