@Test public void onDeleteFromExpiryDate_whenEmpty_shiftsFocusToCardNumberAndDeletesDigit() { mCardInputWidget.setCardInputListener(mCardInputListener); mCardNumberEditText.setText(VALID_VISA_WITH_SPACES); assertTrue(mExpiryEditText.hasFocus()); reset(mCardInputListener); ViewTestUtils.sendDeleteKeyEvent(mExpiryEditText); verify(mCardInputListener, times(1)).onFocusChange(FOCUS_CARD); assertEquals(R.id.et_expiry_date, mOnGlobalFocusChangeListener.getOldFocusId()); assertEquals(R.id.et_card_number, mOnGlobalFocusChangeListener.getNewFocusId()); String subString = VALID_VISA_WITH_SPACES.substring(0, VALID_VISA_WITH_SPACES.length() - 1); assertEquals(subString, mCardNumberEditText.getText().toString()); assertEquals(subString.length(), mCardNumberEditText.getSelectionStart()); }
public void setCardInputListener(@Nullable CardInputListener listener) { mCardInputListener = listener; }
CardInputWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener listener) { mCardInputListener = listener; } }
CardInputWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener listener) { mCardInputListener = listener; } CardInputWidget(Context context);  CardInputWidget(Context context, AttributeSet attrs);  CardInputWidget(Context context, AttributeSet attrs, int defStyleAttr); }
CardInputWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener listener) { mCardInputListener = listener; } CardInputWidget(Context context);  CardInputWidget(Context context, AttributeSet attrs);  CardInputWidget(Context context, AttributeSet attrs, int defStyleAttr); @Nullable Card getCard(); void setCardInputListener(@Nullable CardInputListener listener); void setCardNumber(String cardNumber); void setExpiryDate(
            @IntRange(from = 1, to = 12) int month,
            @IntRange(from = 0, to = 9999) int year); void setCvcCode(String cvcCode); void clear(); void setEnabled(boolean isEnabled); @Override boolean isEnabled(); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override void onWindowFocusChanged(boolean hasWindowFocus); }
CardInputWidget extends LinearLayout { public void setCardInputListener(@Nullable CardInputListener listener) { mCardInputListener = listener; } CardInputWidget(Context context);  CardInputWidget(Context context, AttributeSet attrs);  CardInputWidget(Context context, AttributeSet attrs, int defStyleAttr); @Nullable Card getCard(); void setCardInputListener(@Nullable CardInputListener listener); void setCardNumber(String cardNumber); void setExpiryDate(
            @IntRange(from = 1, to = 12) int month,
            @IntRange(from = 0, to = 9999) int year); void setCvcCode(String cvcCode); void clear(); void setEnabled(boolean isEnabled); @Override boolean isEnabled(); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override void onWindowFocusChanged(boolean hasWindowFocus);  }