@Test public void renderTest() throws NoSuchFieldException, IllegalAccessException { View mMock = Mockito.mock(View.class); DismissOnTouchNoButtonRenderer renderer = new DismissOnTouchNoButtonRenderer.Builder().build(); ReflectionUtil.setField(DismissOnTouchNoButtonRenderer.class, renderer, "inflated", mMock); renderer.render(null); verify(mMock, times(1)).setOnClickListener(any(View.OnClickListener.class)); verify(mMock).setLayoutParams(any(FrameLayout.LayoutParams.class)); verify(mMock).setVisibility(View.VISIBLE); }
@Override public View render(final CoachmarkViewLayout layout) { if (inflated == null) { LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflated = inflater.inflate(R.layout.dismiss_no_button_view, null); layout.addView(inflated); } inflated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mListener == null || mListener.onClicked()) { layout.dismiss(); } } }); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); inflated.setLayoutParams(params); inflated.setVisibility(View.VISIBLE); return inflated; }
DismissOnTouchNoButtonRenderer implements ButtonRenderer { @Override public View render(final CoachmarkViewLayout layout) { if (inflated == null) { LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflated = inflater.inflate(R.layout.dismiss_no_button_view, null); layout.addView(inflated); } inflated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mListener == null || mListener.onClicked()) { layout.dismiss(); } } }); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); inflated.setLayoutParams(params); inflated.setVisibility(View.VISIBLE); return inflated; } }
DismissOnTouchNoButtonRenderer implements ButtonRenderer { @Override public View render(final CoachmarkViewLayout layout) { if (inflated == null) { LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflated = inflater.inflate(R.layout.dismiss_no_button_view, null); layout.addView(inflated); } inflated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mListener == null || mListener.onClicked()) { layout.dismiss(); } } }); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); inflated.setLayoutParams(params); inflated.setVisibility(View.VISIBLE); return inflated; } private  DismissOnTouchNoButtonRenderer(); }
DismissOnTouchNoButtonRenderer implements ButtonRenderer { @Override public View render(final CoachmarkViewLayout layout) { if (inflated == null) { LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflated = inflater.inflate(R.layout.dismiss_no_button_view, null); layout.addView(inflated); } inflated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mListener == null || mListener.onClicked()) { layout.dismiss(); } } }); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); inflated.setLayoutParams(params); inflated.setVisibility(View.VISIBLE); return inflated; } private  DismissOnTouchNoButtonRenderer(); @Override View render(final CoachmarkViewLayout layout); }
DismissOnTouchNoButtonRenderer implements ButtonRenderer { @Override public View render(final CoachmarkViewLayout layout) { if (inflated == null) { LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflated = inflater.inflate(R.layout.dismiss_no_button_view, null); layout.addView(inflated); } inflated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mListener == null || mListener.onClicked()) { layout.dismiss(); } } }); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); inflated.setLayoutParams(params); inflated.setVisibility(View.VISIBLE); return inflated; } private  DismissOnTouchNoButtonRenderer(); @Override View render(final CoachmarkViewLayout layout);  }