@Test public void testFindSecondDigit() { assertThat(LetterTileDrawable.findSecondDigit("10", '1')).isEqualTo('0'); assertThat(LetterTileDrawable.findSecondDigit("01", '1')).isEqualTo('@'); assertThat(LetterTileDrawable.findSecondDigit("100", '1')).isEqualTo('0'); assertThat(LetterTileDrawable.findSecondDigit("01 ", '1')).isEqualTo('@'); assertThat(LetterTileDrawable.findSecondDigit("012310", '1')).isEqualTo('2'); }
static char findSecondDigit(@NonNull String identifier, char firstChar) { if (isDigit(firstChar)) { int idx = identifier.indexOf(firstChar) + 1; if (idx < identifier.length() && isDigit(identifier.charAt(idx))) { return identifier.charAt(idx); } } return '@'; }
LetterTileDrawable extends Drawable { static char findSecondDigit(@NonNull String identifier, char firstChar) { if (isDigit(firstChar)) { int idx = identifier.indexOf(firstChar) + 1; if (idx < identifier.length() && isDigit(identifier.charAt(idx))) { return identifier.charAt(idx); } } return '@'; } }
LetterTileDrawable extends Drawable { static char findSecondDigit(@NonNull String identifier, char firstChar) { if (isDigit(firstChar)) { int idx = identifier.indexOf(firstChar) + 1; if (idx < identifier.length() && isDigit(identifier.charAt(idx))) { return identifier.charAt(idx); } } return '@'; } LetterTileDrawable(final Resources res); }
LetterTileDrawable extends Drawable { static char findSecondDigit(@NonNull String identifier, char firstChar) { if (isDigit(firstChar)) { int idx = identifier.indexOf(firstChar) + 1; if (idx < identifier.length() && isDigit(identifier.charAt(idx))) { return identifier.charAt(idx); } } return '@'; } LetterTileDrawable(final Resources res); static LetterTileDrawable fromText(Resources res, String identifier); @Override void draw(final Canvas canvas); @Override void setAlpha(final int alpha); @Override void setColorFilter(final ColorFilter cf); @Override int getOpacity(); void setScale(float scale); void setOffset(float offset); LetterTileDrawable setText(final String identifier); void setIsCircular(boolean isCircle); }
LetterTileDrawable extends Drawable { static char findSecondDigit(@NonNull String identifier, char firstChar) { if (isDigit(firstChar)) { int idx = identifier.indexOf(firstChar) + 1; if (idx < identifier.length() && isDigit(identifier.charAt(idx))) { return identifier.charAt(idx); } } return '@'; } LetterTileDrawable(final Resources res); static LetterTileDrawable fromText(Resources res, String identifier); @Override void draw(final Canvas canvas); @Override void setAlpha(final int alpha); @Override void setColorFilter(final ColorFilter cf); @Override int getOpacity(); void setScale(float scale); void setOffset(float offset); LetterTileDrawable setText(final String identifier); void setIsCircular(boolean isCircle);  }