diff --git a/app/src/main/java/io/neurolab/fragments/NeuroSettingsFragment.java b/app/src/main/java/io/neurolab/fragments/NeuroSettingsFragment.java index f3ce40b1..523000a9 100644 --- a/app/src/main/java/io/neurolab/fragments/NeuroSettingsFragment.java +++ b/app/src/main/java/io/neurolab/fragments/NeuroSettingsFragment.java @@ -57,15 +57,15 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin // TODO: Set limits to following preferences case KEY_SAMPLES: samplesPref.setSummary(samplesPref.getText() + " sample" + - pluralize(Integer.valueOf(samplesPref.getText()))); + pluralize(samplesPref.getText())); break; case KEY_BINS: binsPref.setSummary(binsPref.getText() + " bin" + - pluralize(Integer.valueOf(binsPref.getText()))); + pluralize(binsPref.getText())); break; case KEY_CHANNELS: channelsPref.setSummary(channelsPref.getText() + " channel" + - pluralize(Integer.valueOf(channelsPref.getText()))); + pluralize(channelsPref.getText())); break; default: break; @@ -91,15 +91,15 @@ public void onDestroyView() { public void onResume() { super.onResume(); samplesPref.setSummary(samplesPref.getText() + " sample" + - pluralize(Integer.valueOf(samplesPref.getText()))); + pluralize(samplesPref.getText())); binsPref.setSummary(binsPref.getText() + " bin" + - pluralize(Integer.valueOf(binsPref.getText()))); + pluralize(binsPref.getText())); channelsPref.setSummary(channelsPref.getText() + " channel" + - pluralize(Integer.valueOf(channelsPref.getText()))); + pluralize(channelsPref.getText())); } - private String pluralize(int count) { - return count > 1 ? "s" : ""; + private String pluralize(String text) { + return ("0".equals(text) || "1".equals(text)) ? "" : "s"; } @Override