diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml index d2ddf59be..f69adf9b0 100644 --- a/assets/resources/application/en.xml +++ b/assets/resources/application/en.xml @@ -710,11 +710,11 @@ - - - - - + + + + + diff --git a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java index 06445bb30..19268707f 100644 --- a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java +++ b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java @@ -557,9 +557,10 @@ public class PreferenceActivity extends ZLPreferenceActivity { newStyleFooterPreferences.add(statusLineScreen.addOption(profile.FooterNGForegroundUnreadOption, "footerForegroundUnreadColor")); footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowTOCMarks, "tocMarks")); - statusLineScreen.addPreference(new ZLChoicePreference( - this, statusLineScreen.Resource.getResource("showProgressTypes"), - footerOptions.ShowProgressType, footerOptions.getProgressValueResourceKeys() + statusLineScreen.addPreference(new ZLEnumPreference( + this, + footerOptions.ShowProgress, + statusLineScreen.Resource.getResource("showProgressTypes") ) { @Override public boolean isEnabled() { diff --git a/src/org/geometerplus/fbreader/fbreader/options/FooterOptions.java b/src/org/geometerplus/fbreader/fbreader/options/FooterOptions.java index 4c9d6da95..6ed488c54 100644 --- a/src/org/geometerplus/fbreader/fbreader/options/FooterOptions.java +++ b/src/org/geometerplus/fbreader/fbreader/options/FooterOptions.java @@ -22,11 +22,18 @@ package org.geometerplus.fbreader.fbreader.options; import org.geometerplus.zlibrary.core.options.*; public class FooterOptions { + enum ProgressDisplayType { + dontDisplay, + asPages, + asPercentage, + asPagesAndPercentage + } + public final ZLBooleanOption ShowTOCMarks; public final ZLBooleanOption ShowClock; public final ZLBooleanOption ShowBattery; - public final ZLIntegerRangeOption ShowProgressType; + public final ZLEnumOption ShowProgress; public final ZLStringOption Font; @@ -36,35 +43,28 @@ public class FooterOptions { ShowBattery = new ZLBooleanOption("Options", "ShowBatteryInFooter", true); Font = new ZLStringOption("Options", "FooterFont", "Droid Sans"); - ShowProgressType = new ZLIntegerRangeOption("Options", "ShowProgressType", 0, 4, ProgressTypes.showProgressAsPages.ordinal()); + ShowProgress = new ZLEnumOption( + "Options", "ShowProgress", ProgressDisplayType.asPages + ); } public boolean showProgressAsPercentage() { - return ShowProgressType.getValue() == ProgressTypes.showProgressAsPercentage.ordinal() || - ShowProgressType.getValue() == ProgressTypes.showProgressAsBoth.ordinal(); + switch (ShowProgress.getValue()) { + case asPercentage: + case asPagesAndPercentage: + return true; + default: + return false; + } } public boolean showProgressAsPages() { - return ShowProgressType.getValue() == ProgressTypes.showProgressAsPages.ordinal() || - ShowProgressType.getValue() == ProgressTypes.showProgressAsBoth.ordinal(); - } - - - public String[] getProgressValueResourceKeys() { - ProgressTypes[] progressTypes = ProgressTypes.values(); - String[] resourceKeys = new String[progressTypes.length]; - - for (int i = 0; i < progressTypes.length; i++) { - resourceKeys[i] = progressTypes[i].name(); + switch (ShowProgress.getValue()) { + case asPages: + case asPagesAndPercentage: + return true; + default: + return false; } - - return resourceKeys; } } - -enum ProgressTypes { - hide, - showProgressAsPages, - showProgressAsPercentage, - showProgressAsBoth -} \ No newline at end of file