当前位置: 首页>>代码示例>>Java>>正文


Java ThemedReactContext.getJSModule方法代码示例

本文整理汇总了Java中com.facebook.react.uimanager.ThemedReactContext.getJSModule方法的典型用法代码示例。如果您正苦于以下问题:Java ThemedReactContext.getJSModule方法的具体用法?Java ThemedReactContext.getJSModule怎么用?Java ThemedReactContext.getJSModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.uimanager.ThemedReactContext的用法示例。


在下文中一共展示了ThemedReactContext.getJSModule方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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;
}
 
开发者ID:2534290808,项目名称:react-native-android-piliplayer,代码行数:18,代码来源:PLVideoTextureViewManager.java

示例2: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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;
}
 
开发者ID:pili-engineering,项目名称:pili-react-native,代码行数:18,代码来源:PiliPlayerViewManager.java

示例3: onException

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例4: onResourceReady

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例5: ReactVideoView

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的package包/类
public ReactVideoView(ThemedReactContext themedReactContext) {
    super(themedReactContext);

    mThemedReactContext = themedReactContext;
    mEventEmitter = themedReactContext.getJSModule(RCTEventEmitter.class);
    themedReactContext.addLifecycleEventListener(this);

    initializeMediaPlayerIfNeeded();
    setSurfaceTextureListener(this);

    mProgressUpdateRunnable = new Runnable() {
        @Override
        public void run() {

            if (mMediaPlayerValid && !isCompleted &&!mPaused) {
                WritableMap event = Arguments.createMap();
                event.putDouble(EVENT_PROP_CURRENT_TIME, mMediaPlayer.getCurrentPosition() / 1000.0);
                event.putDouble(EVENT_PROP_PLAYABLE_DURATION, mVideoBufferedDuration / 1000.0); //TODO:mBufferUpdateRunnable
                mEventEmitter.receiveEvent(getId(), Events.EVENT_PROGRESS.toString(), event);

                // Check for update after an interval
                // TODO: The update interval is fixed at 250. There is a property in React component that defines this value. Totally ignored !!!
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable, 250);
            }
        }
    };
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:28,代码来源:ReactVideoView.java

示例6: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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);
    mProgressUpdateRunnable=new Runnable() {
        @Override
        public void run() {
            if(mVideoView.isPlaying()){
                WritableMap event = Arguments.createMap();
                event.putDouble("currentTime", mVideoView.getCurrentPosition()/1000);
                mEventEmitter.receiveEvent(getTargetId(), PiliPlayerViewManager.Events.PROGRESS.toString(), event);
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable,1000);
            }
        }
    };
    return mVideoView;
}
 
开发者ID:An-uking,项目名称:react-native-pili-player,代码行数:29,代码来源:PiliLiveViewManager.java

示例7: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的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);
    mProgressUpdateRunnable=new Runnable() {
        @Override
        public void run() {
            if(mVideoView.isPlaying()){
                WritableMap event = Arguments.createMap();
                event.putDouble("currentTime", mVideoView.getCurrentPosition()/1000);
                event.putDouble("totalTime", mVideoView.getDuration()/1000); //TODO:mBufferUpdateRunnable
                mEventEmitter.receiveEvent(getTargetId(), Events.PROGRESS.toString(), event);
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable,1000);
            }
        }
    };
    return mVideoView;
}
 
开发者ID:An-uking,项目名称:react-native-pili-player,代码行数:31,代码来源:PiliPlayerViewManager.java

示例8: onProgress

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的package包/类
@Override
public void onProgress(String key, long bytesRead, long expectedLength) {
    List<ImageViewWithUrl> viewsForKey = VIEWS_FOR_URLS.get(key);
    if (viewsForKey != null) {
        for (ImageViewWithUrl view: viewsForKey) {
            WritableMap event = new WritableNativeMap();
            event.putInt("loaded", (int) bytesRead);
            event.putInt("total", (int) expectedLength);
            ThemedReactContext context = (ThemedReactContext) view.getContext();
            RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
            int viewId = view.getId();
            eventEmitter.receiveEvent(viewId, REACT_ON_PROGRESS_EVENT, event);
        }
    }
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:16,代码来源:FastImageViewManager.java

示例9: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //导入方法依赖的package包/类
@Override
public BarcodePicker createViewInstance(ThemedReactContext context) {
    // Store event dispatcher for emission of events
    eventDispatcher = context.getNativeModule(UIManagerModule.class).getEventDispatcher();

    nativeAppEventEmitter = context.getJSModule(RCTNativeAppEventEmitter.class);

    // BarcodePicker extends View
    picker = new BarcodePicker(context, scanSettings);

    // Tell picker to call our didScan method on scan
    picker.setOnScanListener(this);

    return picker;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:16,代码来源:SGScanditPicker.java


注:本文中的com.facebook.react.uimanager.ThemedReactContext.getJSModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。