@Test public void notifier_onActivityResumedForFirstTime_notifiesListener() { foregroundNotifier.onActivityResumed(null); assertThat(subscriber.getEvents().get(0)).contains(ON_FOREGROUND); }
@Override public void onActivityResumed(Activity activity) { paused = false; boolean wasBackground = !foreground; foreground = true; if (check != null) { handler.removeCallbacks(check); } if (wasBackground) { Logging.logi("went foreground"); foregroundSubject.onNext(ON_FOREGROUND); } }
ForegroundNotifier implements Application.ActivityLifecycleCallbacks { @Override public void onActivityResumed(Activity activity) { paused = false; boolean wasBackground = !foreground; foreground = true; if (check != null) { handler.removeCallbacks(check); } if (wasBackground) { Logging.logi("went foreground"); foregroundSubject.onNext(ON_FOREGROUND); } } }
ForegroundNotifier implements Application.ActivityLifecycleCallbacks { @Override public void onActivityResumed(Activity activity) { paused = false; boolean wasBackground = !foreground; foreground = true; if (check != null) { handler.removeCallbacks(check); } if (wasBackground) { Logging.logi("went foreground"); foregroundSubject.onNext(ON_FOREGROUND); } }  }
ForegroundNotifier implements Application.ActivityLifecycleCallbacks { @Override public void onActivityResumed(Activity activity) { paused = false; boolean wasBackground = !foreground; foreground = true; if (check != null) { handler.removeCallbacks(check); } if (wasBackground) { Logging.logi("went foreground"); foregroundSubject.onNext(ON_FOREGROUND); } }  ConnectableFlowable<String> foregroundFlowable(); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onActivityCreated(Activity activity, Bundle savedInstanceState); @Override void onActivityStarted(Activity activity); @Override void onActivityStopped(Activity activity); @Override void onActivitySaveInstanceState(Activity activity, Bundle outState); @Override void onActivityDestroyed(Activity activity); }
ForegroundNotifier implements Application.ActivityLifecycleCallbacks { @Override public void onActivityResumed(Activity activity) { paused = false; boolean wasBackground = !foreground; foreground = true; if (check != null) { handler.removeCallbacks(check); } if (wasBackground) { Logging.logi("went foreground"); foregroundSubject.onNext(ON_FOREGROUND); } }  ConnectableFlowable<String> foregroundFlowable(); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onActivityCreated(Activity activity, Bundle savedInstanceState); @Override void onActivityStarted(Activity activity); @Override void onActivityStopped(Activity activity); @Override void onActivitySaveInstanceState(Activity activity, Bundle outState); @Override void onActivityDestroyed(Activity activity); static final long DELAY_MILLIS; }