@Test public void deleteWhenEmpty_fromExpiry_shiftsToCardNumber() { mCardMultilineWidget.setCardInputListener(mFullCardListener); mNoZipCardMultilineWidget.setCardInputListener(mNoZipCardListener); String deleteOneCharacterString = VALID_VISA_WITH_SPACES .substring(0, VALID_VISA_WITH_SPACES.length() - 1); mFullGroup.cardNumberEditText.setText(VALID_VISA_WITH_SPACES); reset(mFullCardListener); assertTrue(mFullGroup.expiryDateEditText.hasFocus()); ViewTestUtils.sendDeleteKeyEvent(mFullGroup.expiryDateEditText); verify(mFullCardListener, times(1)).onFocusChange(FOCUS_CARD); assertTrue(mFullGroup.cardNumberEditText.hasFocus()); assertEquals(deleteOneCharacterString, mFullGroup.cardNumberEditText.getText().toString()); mNoZipGroup.cardNumberEditText.setText(VALID_VISA_WITH_SPACES); reset(mNoZipCardListener); assertTrue(mNoZipGroup.expiryDateEditText.hasFocus()); ViewTestUtils.sendDeleteKeyEvent(mNoZipGroup.expiryDateEditText); verify(mNoZipCardListener, times(1)).onFocusChange(FOCUS_CARD); assertTrue(mNoZipGroup.cardNumberEditText.hasFocus()); assertEquals(deleteOneCharacterString, mNoZipGroup.cardNumberEditText.getText().toString()); }
public void setCardInputListener(@Nullable CardInputListener cardInputListener) { mCardInputListener = cardInputListener; }
CardMultilineWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener cardInputListener) { mCardInputListener = cardInputListener; } }
CardMultilineWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener cardInputListener) { mCardInputListener = cardInputListener; } 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 setCardInputListener(@Nullable CardInputListener cardInputListener) { mCardInputListener = cardInputListener; } 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 setCardInputListener(@Nullable CardInputListener cardInputListener) { mCardInputListener = cardInputListener; } 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);  }