當前位置: 首頁>>代碼示例>>Java>>正文


Java ThemedReactContext.addLifecycleEventListener方法代碼示例

本文整理匯總了Java中com.facebook.react.uimanager.ThemedReactContext.addLifecycleEventListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ThemedReactContext.addLifecycleEventListener方法的具體用法?Java ThemedReactContext.addLifecycleEventListener怎麽用?Java ThemedReactContext.addLifecycleEventListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.react.uimanager.ThemedReactContext的用法示例。


在下文中一共展示了ThemedReactContext.addLifecycleEventListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例4: 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

示例5: 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

示例6: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //導入方法依賴的package包/類
@Override
public CrosswalkWebView createViewInstance (ThemedReactContext context) {
    Activity _activity = reactContext.getCurrentActivity();
    CrosswalkWebView crosswalkWebView = new CrosswalkWebView(context, _activity);
    context.addLifecycleEventListener(crosswalkWebView);
    reactContext.addActivityEventListener(new XWalkActivityEventListener(crosswalkWebView));
    return crosswalkWebView;
}
 
開發者ID:KingBarbarian,項目名稱:react-native-android-new-crosswalk,代碼行數:9,代碼來源:CrosswalkWebViewGroupManager.java

示例7: createViewInstance

import com.facebook.react.uimanager.ThemedReactContext; //導入方法依賴的package包/類
@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
  ReactWebView webView = new ReactWebView(reactContext);
  webView.setWebChromeClient(new WebChromeClient() {
    @Override
    public boolean onConsoleMessage(ConsoleMessage message) {
      if (ReactBuildConfig.DEBUG) {
        return super.onConsoleMessage(message);
      }
      // Ignore console logs in non debug builds.
      return true;
    }

    @Override
    public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
      callback.invoke(origin, true, false);
    }
  });
  reactContext.addLifecycleEventListener(webView);
  mWebViewConfig.configWebView(webView);
  webView.getSettings().setBuiltInZoomControls(true);
  webView.getSettings().setDisplayZoomControls(false);
  webView.getSettings().setDomStorageEnabled(true);

  // Fixes broken full-screen modals/galleries due to body height being 0.
  webView.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT,
              LayoutParams.MATCH_PARENT));

  if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
  }

  return webView;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:36,代碼來源:ReactWebViewManager.java


注:本文中的com.facebook.react.uimanager.ThemedReactContext.addLifecycleEventListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。