@Test public void shouldDisplayFreezeHeaderWhenLocationIsAboveOrAtRnrItemsListWhenScrolling() { when(rnrFormList.getHeight()).thenReturn(2000); int numberOfItemsInRNR = 10; mmiaRequisitionFragment.actionBarHeight = 100; mockRightViewGroup = mock(ViewGroup.class); when(rnrFormList.getRightViewGroup()).thenReturn(mockRightViewGroup); final View mockView = mock(View.class); when(mockRightViewGroup.getChildAt(numberOfItemsInRNR - 1)).thenReturn(mockView); when(mockView.getHeight()).thenReturn(100); when(rnrFormList.getRightViewGroup().getChildCount()).thenReturn(numberOfItemsInRNR); doAnswer(invocation -> { Object[] args = invocation.getArguments(); ((int[]) args[0])[0] = 50; ((int[]) args[0])[1] = -1700; return null; }).when(rnrFormList).getLocationOnScreen(any(int[].class)); when(mmiaRequisitionFragment.rnrItemsHeaderFreeze.getHeight()).thenReturn(100); mmiaRequisitionFragment.hideOrDisplayRnrItemsHeader(); verify(mockRnrItemsHeaderFreeze).setVisibility(View.VISIBLE); }
protected void hideOrDisplayRnrItemsHeader() { rnrItemsHeaderFreeze.setVisibility(isNeedHideFreezeHeader() ? View.INVISIBLE : View.VISIBLE); }
MMIARequisitionFragment extends BaseReportFragment implements MMIARequisitionPresenter.MMIARequisitionView { protected void hideOrDisplayRnrItemsHeader() { rnrItemsHeaderFreeze.setVisibility(isNeedHideFreezeHeader() ? View.INVISIBLE : View.VISIBLE); } }
MMIARequisitionFragment extends BaseReportFragment implements MMIARequisitionPresenter.MMIARequisitionView { protected void hideOrDisplayRnrItemsHeader() { rnrItemsHeaderFreeze.setVisibility(isNeedHideFreezeHeader() ? View.INVISIBLE : View.VISIBLE); }  }
MMIARequisitionFragment extends BaseReportFragment implements MMIARequisitionPresenter.MMIARequisitionView { protected void hideOrDisplayRnrItemsHeader() { rnrItemsHeaderFreeze.setVisibility(isNeedHideFreezeHeader() ? View.INVISIBLE : View.VISIBLE); }  @Override void onCreate(Bundle savedInstanceState); @Override View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override void onViewCreated(View view, Bundle savedInstanceState); @Override void refreshRequisitionForm(RnRForm form); @NonNull Subscriber<Void> getOnSavedSubscriber(); @Override void showValidationAlert(); @Override void setProcessButtonName(String buttonName); @Override void completeSuccess(); @NonNull String getSignatureDialogTitle(); @Override void onActivityResult(int requestCode, int resultCode, Intent data); }
MMIARequisitionFragment extends BaseReportFragment implements MMIARequisitionPresenter.MMIARequisitionView { protected void hideOrDisplayRnrItemsHeader() { rnrItemsHeaderFreeze.setVisibility(isNeedHideFreezeHeader() ? View.INVISIBLE : View.VISIBLE); }  @Override void onCreate(Bundle savedInstanceState); @Override View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override void onViewCreated(View view, Bundle savedInstanceState); @Override void refreshRequisitionForm(RnRForm form); @NonNull Subscriber<Void> getOnSavedSubscriber(); @Override void showValidationAlert(); @Override void setProcessButtonName(String buttonName); @Override void completeSuccess(); @NonNull String getSignatureDialogTitle(); @Override void onActivityResult(int requestCode, int resultCode, Intent data); static final int REQUEST_FOR_CUSTOM_REGIME; }