@Test public void onActivityResultTest() { spyOnTimelineInteractor(); fragment.onActivityResult(80, Activity.RESULT_OK, null); verify(fragment.timelineInteractor).update(); final Timeline timeline = mock(Timeline.class); final Intent data = new Intent(); data.putExtra(TimelineActivity.class.getSimpleName() + "EXTRA_LOCAL_DATE", date); data.putExtra(TimelineActivity.class.getSimpleName() + "EXTRA_TIMELINE", timeline); fragment.onActivityResult(101, Activity.RESULT_OK, data); verify(fragment.getParentFragmentParent()).jumpTo(eq(date), eq(timeline)); }
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; } if (requestCode == REQUEST_CODE_CHANGE_SRC) { this.timelineInteractor.update(); } else if (requestCode == ZOOMED_OUT_TIMELINE_REQUEST && data != null) { final LocalDate date = (LocalDate) data.getSerializableExtra(TimelineActivity.EXTRA_LOCAL_DATE); final Timeline timeline = (Timeline) data.getSerializableExtra(TimelineActivity.EXTRA_TIMELINE); getParentFragmentParent().jumpTo(date, timeline); } }
TimelineFragment extends ControllerPresenterFragment<TimelineView> implements TimelineAdapter.OnItemClickListener,
        BaseFragmentPagerAdapter.Controller { @Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; } if (requestCode == REQUEST_CODE_CHANGE_SRC) { this.timelineInteractor.update(); } else if (requestCode == ZOOMED_OUT_TIMELINE_REQUEST && data != null) { final LocalDate date = (LocalDate) data.getSerializableExtra(TimelineActivity.EXTRA_LOCAL_DATE); final Timeline timeline = (Timeline) data.getSerializableExtra(TimelineActivity.EXTRA_TIMELINE); getParentFragmentParent().jumpTo(date, timeline); } } }
TimelineFragment extends ControllerPresenterFragment<TimelineView> implements TimelineAdapter.OnItemClickListener,
        BaseFragmentPagerAdapter.Controller { @Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; } if (requestCode == REQUEST_CODE_CHANGE_SRC) { this.timelineInteractor.update(); } else if (requestCode == ZOOMED_OUT_TIMELINE_REQUEST && data != null) { final LocalDate date = (LocalDate) data.getSerializableExtra(TimelineActivity.EXTRA_LOCAL_DATE); final Timeline timeline = (Timeline) data.getSerializableExtra(TimelineActivity.EXTRA_TIMELINE); getParentFragmentParent().jumpTo(date, timeline); } }  }
TimelineFragment extends ControllerPresenterFragment<TimelineView> implements TimelineAdapter.OnItemClickListener,
        BaseFragmentPagerAdapter.Controller { @Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; } if (requestCode == REQUEST_CODE_CHANGE_SRC) { this.timelineInteractor.update(); } else if (requestCode == ZOOMED_OUT_TIMELINE_REQUEST && data != null) { final LocalDate date = (LocalDate) data.getSerializableExtra(TimelineActivity.EXTRA_LOCAL_DATE); final Timeline timeline = (Timeline) data.getSerializableExtra(TimelineActivity.EXTRA_TIMELINE); getParentFragmentParent().jumpTo(date, timeline); } }  static TimelineFragment newInstance(@NonNull final LocalDate date,
                                               @Nullable final Timeline cachedTimeline); @Override void setVisibleToUser(final boolean isVisible); @Override void initializePresenterView(); @Override void onCreate(final Bundle savedInstanceState); @Override void onViewCreated(final View view, final Bundle savedInstanceState); @Override void onTrimMemory(final int level); @Override void onPause(); @Override void onDestroyView(); @Override void onDetach(); @Override void onActivityResult(final int requestCode, final int resultCode, final Intent data); @Override void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults); void showTimelineNavigator(@NonNull final LocalDate date,
                                      @Nullable final Timeline timeline); void share(); void showBreakdown(@NonNull final View sender); void dismissVisibleOverlaysAndDialogs(); @SuppressWarnings("ConstantConditions") @NonNull LocalDate getDate(); @Nullable Timeline getCachedTimeline(); void onSwipeBetweenDatesStarted(); void scrollToTop(); void update(); boolean isAtLeastThreeDaysOld(); void bindTimeline(@NonNull final Timeline timeline); void timelineUnavailable(final Throwable e); @Override void onSegmentItemClicked(final int position, final View view, @NonNull final TimelineEvent event); @Override void onEventItemClicked(final int eventPosition, @NonNull final TimelineEvent event); }
TimelineFragment extends ControllerPresenterFragment<TimelineView> implements TimelineAdapter.OnItemClickListener,
        BaseFragmentPagerAdapter.Controller { @Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; } if (requestCode == REQUEST_CODE_CHANGE_SRC) { this.timelineInteractor.update(); } else if (requestCode == ZOOMED_OUT_TIMELINE_REQUEST && data != null) { final LocalDate date = (LocalDate) data.getSerializableExtra(TimelineActivity.EXTRA_LOCAL_DATE); final Timeline timeline = (Timeline) data.getSerializableExtra(TimelineActivity.EXTRA_TIMELINE); getParentFragmentParent().jumpTo(date, timeline); } }  static TimelineFragment newInstance(@NonNull final LocalDate date,
                                               @Nullable final Timeline cachedTimeline); @Override void setVisibleToUser(final boolean isVisible); @Override void initializePresenterView(); @Override void onCreate(final Bundle savedInstanceState); @Override void onViewCreated(final View view, final Bundle savedInstanceState); @Override void onTrimMemory(final int level); @Override void onPause(); @Override void onDestroyView(); @Override void onDetach(); @Override void onActivityResult(final int requestCode, final int resultCode, final Intent data); @Override void onRequestPermissionsResult(final int requestCode, @NonNull final String[] permissions, @NonNull final int[] grantResults); void showTimelineNavigator(@NonNull final LocalDate date,
                                      @Nullable final Timeline timeline); void share(); void showBreakdown(@NonNull final View sender); void dismissVisibleOverlaysAndDialogs(); @SuppressWarnings("ConstantConditions") @NonNull LocalDate getDate(); @Nullable Timeline getCachedTimeline(); void onSwipeBetweenDatesStarted(); void scrollToTop(); void update(); boolean isAtLeastThreeDaysOld(); void bindTimeline(@NonNull final Timeline timeline); void timelineUnavailable(final Throwable e); @Override void onSegmentItemClicked(final int position, final View view, @NonNull final TimelineEvent event); @Override void onEventItemClicked(final int eventPosition, @NonNull final TimelineEvent event); static final int ZOOMED_OUT_TIMELINE_REQUEST; }