Source:
private void updateSeekOptions() { final Resources res = getResources(); final String[] durationsValues = res.getStringArray(R.array.seek_duration_value); final List<String> displayedDurationValues = new LinkedList<>(); final List<String> displayedDescriptionValues = new LinkedList<>(); int currentDurationValue; final boolean inexactSeek = getPreferenceManager().getSharedPreferences() .getBoolean(res.getString(R.string.use_inexact_seek_key), false); for (String durationsValue : durationsValues) { currentDurationValue = Integer.parseInt(durationsValue) / (int) DateUtils.SECOND_IN_MILLIS; if (inexactSeek && currentDurationValue % 10 == 5) { continue; } displayedDurationValues.add(durationsValue); try { displayedDescriptionValues.add(String.format( res.getQuantityString(R.plurals.seconds, currentDurationValue), currentDurationValue)); } catch (Resources.NotFoundException ignored) { } } final ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key)); durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0])); durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0])); final int selectedDuration = Integer.parseInt(durations.getValue()); if (selectedDuration / (int) DateUtils.SECOND_IN_MILLIS % 10 == 5) { final int newDuration = selectedDuration / (int) DateUtils.SECOND_IN_MILLIS + 5; durations.setValue(Integer.toString(newDuration * (int) DateUtils.SECOND_IN_MILLIS)); Toast toast = Toast .makeText(getContext(), getString(R.string.new_seek_duration_toast, newDuration), Toast.LENGTH_LONG); toast.show(); } }

Target:
private void updateSeekOptions() { final Resources res = getResources(); final String[] durationsValues = res.getStringArray(R.array.seek_duration_value); final List<String> displayedDurationValues = new LinkedList<>(); final List<String> displayedDescriptionValues = new LinkedList<>(); int currentDurationValue; final boolean inexactSeek = getPreferenceManager().getSharedPreferences() .getBoolean(res.getString(R.string.use_inexact_seek_key), false); for (String durationsValue : durationsValues) { currentDurationValue = Integer.parseInt(durationsValue) / (int) DateUtils.SECOND_IN_MILLIS; if (inexactSeek && currentDurationValue % 10 == 5) { continue; } displayedDurationValues.add(durationsValue); try { displayedDescriptionValues.add(String.format( res.getQuantityString(R.plurals.seconds, currentDurationValue), currentDurationValue)); } catch (Resources.NotFoundException ignored) { } } final ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key)); durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0])); durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0])); final int selectedDuration = Integer.parseInt(durations.getValue()); if (inexactSeek && selectedDuration / (int) DateUtils.SECOND_IN_MILLIS % 10 == 5) { final int newDuration = selectedDuration / (int) DateUtils.SECOND_IN_MILLIS + 5; durations.setValue(Integer.toString(newDuration * (int) DateUtils.SECOND_IN_MILLIS)); Toast toast = Toast .makeText(getContext(), getString(R.string.new_seek_duration_toast, newDuration), Toast.LENGTH_LONG); toast.show(); } }