@Test public void onActivityPaused() throws Exception { ScreenListener listener = mock(ScreenListener.class); screenTracker.addListener(listener); Activity activity = mock(Activity.class); screenTracker.onActivityResumed(activity); screenTracker.onActivityPaused(activity); ArgumentCaptor<Screen> screenCaptor = ArgumentCaptor.forClass(Screen.class); verify(listener, times(2)).onScreenChanged(screenCaptor.capture()); Screen screen = screenCaptor.getValue(); assertNull(screen.getActivity()); }
@Override public void onActivityPaused(Activity activity) { if (ObjectUtil.equals(activity, currentScreen.getActivity())) { currentScreen.clearActivity(); fireOnScreenChanged(); } }
ScreenTracker extends SimpleActivityLifecycleCallbacks implements PhialScopeNotifier.OnScopeChangedListener { @Override public void onActivityPaused(Activity activity) { if (ObjectUtil.equals(activity, currentScreen.getActivity())) { currentScreen.clearActivity(); fireOnScreenChanged(); } } }
ScreenTracker extends SimpleActivityLifecycleCallbacks implements PhialScopeNotifier.OnScopeChangedListener { @Override public void onActivityPaused(Activity activity) { if (ObjectUtil.equals(activity, currentScreen.getActivity())) { currentScreen.clearActivity(); fireOnScreenChanged(); } }  }
ScreenTracker extends SimpleActivityLifecycleCallbacks implements PhialScopeNotifier.OnScopeChangedListener { @Override public void onActivityPaused(Activity activity) { if (ObjectUtil.equals(activity, currentScreen.getActivity())) { currentScreen.clearActivity(); fireOnScreenChanged(); } }  void addListener(ScreenListener listener); void removeListener(ScreenListener listener); Screen getCurrentScreen(); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onEnterScope(String scopeName, View view); @Override void onExitScope(String scopeName); boolean matchesAny(Set<TargetScreen> targetScreen); View findTarget(int id); }
ScreenTracker extends SimpleActivityLifecycleCallbacks implements PhialScopeNotifier.OnScopeChangedListener { @Override public void onActivityPaused(Activity activity) { if (ObjectUtil.equals(activity, currentScreen.getActivity())) { currentScreen.clearActivity(); fireOnScreenChanged(); } }  void addListener(ScreenListener listener); void removeListener(ScreenListener listener); Screen getCurrentScreen(); @Override void onActivityResumed(Activity activity); @Override void onActivityPaused(Activity activity); @Override void onEnterScope(String scopeName, View view); @Override void onExitScope(String scopeName); boolean matchesAny(Set<TargetScreen> targetScreen); View findTarget(int id);  }