@Test public void detachingFromWindow_disconnectsService_whenServiceConnectionIsNotNull() { CustomTabsServiceConnection serviceConnection = mock(CustomTabsServiceConnection.class); when(customTabHelper.getServiceConnection()).thenReturn(serviceConnection); UrlWidget widget = createWidget(promptWithAnswer(null)); widget.onDetachedFromWindow(); verify(spyActivity).unbindService(serviceConnection); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (customTabHelper.getServiceConnection() != null) { getContext().unbindService(customTabHelper.getServiceConnection()); } }
UrlWidget extends QuestionWidget { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (customTabHelper.getServiceConnection() != null) { getContext().unbindService(customTabHelper.getServiceConnection()); } } }
UrlWidget extends QuestionWidget { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (customTabHelper.getServiceConnection() != null) { getContext().unbindService(customTabHelper.getServiceConnection()); } } UrlWidget(Context context, QuestionDetails questionDetails, CustomTabHelper customTabHelper); }
UrlWidget extends QuestionWidget { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (customTabHelper.getServiceConnection() != null) { getContext().unbindService(customTabHelper.getServiceConnection()); } } UrlWidget(Context context, QuestionDetails questionDetails, CustomTabHelper customTabHelper); @Override void clearAnswer(); @Override IAnswerData getAnswer(); @Override void setOnLongClickListener(OnLongClickListener l); @Override void cancelLongPress(); void onButtonClick(); }
UrlWidget extends QuestionWidget { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (customTabHelper.getServiceConnection() != null) { getContext().unbindService(customTabHelper.getServiceConnection()); } } UrlWidget(Context context, QuestionDetails questionDetails, CustomTabHelper customTabHelper); @Override void clearAnswer(); @Override IAnswerData getAnswer(); @Override void setOnLongClickListener(OnLongClickListener l); @Override void cancelLongPress(); void onButtonClick();  }