@Test public void updateSelectionIndex_whenDeletingAcrossTheGap_staysAtEnd() { assertEquals(2, mExpiryDateEditText.updateSelectionIndex(2, 4, 0)); }
@VisibleForTesting int updateSelectionIndex( int newLength, int editActionStart, int editActionAddition) { int newPosition, gapsJumped = 0; boolean skipBack = false; if (editActionStart <= 2 && editActionStart + editActionAddition >= 2) { gapsJumped = 1; } if (editActionAddition == 0 && editActionStart == 3) { skipBack = true; } newPosition = editActionStart + editActionAddition + gapsJumped; if (skipBack && newPosition > 0) { newPosition--; } return newPosition <= newLength ? newPosition : newLength; }
ExpiryDateEditText extends StripeEditText { @VisibleForTesting int updateSelectionIndex( int newLength, int editActionStart, int editActionAddition) { int newPosition, gapsJumped = 0; boolean skipBack = false; if (editActionStart <= 2 && editActionStart + editActionAddition >= 2) { gapsJumped = 1; } if (editActionAddition == 0 && editActionStart == 3) { skipBack = true; } newPosition = editActionStart + editActionAddition + gapsJumped; if (skipBack && newPosition > 0) { newPosition--; } return newPosition <= newLength ? newPosition : newLength; } }
ExpiryDateEditText extends StripeEditText { @VisibleForTesting int updateSelectionIndex( int newLength, int editActionStart, int editActionAddition) { int newPosition, gapsJumped = 0; boolean skipBack = false; if (editActionStart <= 2 && editActionStart + editActionAddition >= 2) { gapsJumped = 1; } if (editActionAddition == 0 && editActionStart == 3) { skipBack = true; } newPosition = editActionStart + editActionAddition + gapsJumped; if (skipBack && newPosition > 0) { newPosition--; } return newPosition <= newLength ? newPosition : newLength; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); }
ExpiryDateEditText extends StripeEditText { @VisibleForTesting int updateSelectionIndex( int newLength, int editActionStart, int editActionAddition) { int newPosition, gapsJumped = 0; boolean skipBack = false; if (editActionStart <= 2 && editActionStart + editActionAddition >= 2) { gapsJumped = 1; } if (editActionAddition == 0 && editActionStart == 3) { skipBack = true; } newPosition = editActionStart + editActionAddition + gapsJumped; if (skipBack && newPosition > 0) { newPosition--; } return newPosition <= newLength ? newPosition : newLength; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); boolean isDateValid(); @Nullable @Size(2) int[] getValidDateFields(); void setExpiryDateEditListener(ExpiryDateEditListener expiryDateEditListener); }
ExpiryDateEditText extends StripeEditText { @VisibleForTesting int updateSelectionIndex( int newLength, int editActionStart, int editActionAddition) { int newPosition, gapsJumped = 0; boolean skipBack = false; if (editActionStart <= 2 && editActionStart + editActionAddition >= 2) { gapsJumped = 1; } if (editActionAddition == 0 && editActionStart == 3) { skipBack = true; } newPosition = editActionStart + editActionAddition + gapsJumped; if (skipBack && newPosition > 0) { newPosition--; } return newPosition <= newLength ? newPosition : newLength; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); boolean isDateValid(); @Nullable @Size(2) int[] getValidDateFields(); void setExpiryDateEditListener(ExpiryDateEditListener expiryDateEditListener);  }