@Test public void initView_whenZipRequiredThenSetToHidden_secondRowLosesPostalCodeAndAdjustsMargin() { assertEquals(View.VISIBLE, mFullGroup.postalCodeInputLayout.getVisibility()); mCardMultilineWidget.setShouldShowPostalCode(false); assertEquals(View.GONE, mFullGroup.postalCodeInputLayout.getVisibility()); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mFullGroup.cvcInputLayout.getLayoutParams(); assertEquals(0, params.rightMargin); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { assertEquals(0, params.getMarginEnd()); } }
public void setShouldShowPostalCode(boolean shouldShowPostalCode) { mShouldShowPostalCode = shouldShowPostalCode; adjustViewForPostalCodeAttribute(); }
CardMultilineWidget extends LinearLayout { public void setShouldShowPostalCode(boolean shouldShowPostalCode) { mShouldShowPostalCode = shouldShowPostalCode; adjustViewForPostalCodeAttribute(); } }
CardMultilineWidget extends LinearLayout { public void setShouldShowPostalCode(boolean shouldShowPostalCode) { mShouldShowPostalCode = shouldShowPostalCode; adjustViewForPostalCodeAttribute(); } CardMultilineWidget(Context context);  CardMultilineWidget(Context context, AttributeSet attrs);  CardMultilineWidget(Context context, AttributeSet attrs, int defStyleAttr); @VisibleForTesting  CardMultilineWidget(Context context, boolean shouldShowPostalCode); }
CardMultilineWidget extends LinearLayout { public void setShouldShowPostalCode(boolean shouldShowPostalCode) { mShouldShowPostalCode = shouldShowPostalCode; adjustViewForPostalCodeAttribute(); } CardMultilineWidget(Context context);  CardMultilineWidget(Context context, AttributeSet attrs);  CardMultilineWidget(Context context, AttributeSet attrs, int defStyleAttr); @VisibleForTesting  CardMultilineWidget(Context context, boolean shouldShowPostalCode); void clear(); void setCardInputListener(@Nullable CardInputListener cardInputListener); @Nullable Card getCard(); boolean validateAllFields(); @Override void onWindowFocusChanged(boolean hasWindowFocus); void setShouldShowPostalCode(boolean shouldShowPostalCode); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled); }
CardMultilineWidget extends LinearLayout { public void setShouldShowPostalCode(boolean shouldShowPostalCode) { mShouldShowPostalCode = shouldShowPostalCode; adjustViewForPostalCodeAttribute(); } CardMultilineWidget(Context context);  CardMultilineWidget(Context context, AttributeSet attrs);  CardMultilineWidget(Context context, AttributeSet attrs, int defStyleAttr); @VisibleForTesting  CardMultilineWidget(Context context, boolean shouldShowPostalCode); void clear(); void setCardInputListener(@Nullable CardInputListener cardInputListener); @Nullable Card getCard(); boolean validateAllFields(); @Override void onWindowFocusChanged(boolean hasWindowFocus); void setShouldShowPostalCode(boolean shouldShowPostalCode); @Override boolean isEnabled(); @Override void setEnabled(boolean enabled);  }