Java Code Examples for com.facebook.react.bridge.LifecycleEventListener

The following are top voted examples for showing how to use com.facebook.react.bridge.LifecycleEventListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: RNLearn_Project1   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 2
Project: RNLearn_Project1   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 3
Project: ReactNativeSignatureExample   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 4
Project: react-native-ibeacon-android   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 5
Project: react-native-box-loaders   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 6
Project: Ironman   File: ReactIntegrationTestCase.java   View source code 6 votes vote down vote up
protected static void initializeJavaModule(final BaseJavaModule javaModule) {
  final Semaphore semaphore = new Semaphore(0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          javaModule.initialize();
          if (javaModule instanceof LifecycleEventListener) {
            ((LifecycleEventListener) javaModule).onHostResume();
          }
          semaphore.release();
        }
      });
  try {
    SoftAssertions.assertCondition(
        semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS),
        "Timed out initializing timing module");
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}
 
Example 7
Project: react-native-notifications   File: ReactAppLifecycleFacade.java   View source code 6 votes vote down vote up
public void init(ReactContext reactContext) {
    mReactContext = reactContext;
    reactContext.addLifecycleEventListener(new LifecycleEventListener() {
        @Override
        public void onHostResume() {
            Log.d(LOGTAG, "onHostResume");
            switchToVisible();
        }

        @Override
        public void onHostPause() {
            Log.d(LOGTAG, "onHostPause");
            switchToInvisible();
        }

        @Override
        public void onHostDestroy() {
            Log.d(LOGTAG, "onHostDestroy");
            switchToInvisible();
        }
    });
}
 
Example 8
Project: RNLearn_Project1   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 9
Project: RNLearn_Project1   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}
 
Example 10
Project: RNLearn_Project1   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 11
Project: RNLearn_Project1   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}
 
Example 12
Project: ReactNativeSignatureExample   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 13
Project: ReactNativeSignatureExample   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}
 
Example 14
Project: react-native-ibeacon-android   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 15
Project: react-native-ibeacon-android   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}
 
Example 16
Project: react-native-box-loaders   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 17
Project: react-native-box-loaders   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}
 
Example 18
Project: Ironman   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void addLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.addLifecycleEventListener(listener);
}
 
Example 19
Project: Ironman   File: ThemedReactContext.java   View source code 4 votes vote down vote up
@Override
public void removeLifecycleEventListener(LifecycleEventListener listener) {
  mReactApplicationContext.removeLifecycleEventListener(listener);
}