mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
ZLIntegerRangeOption => ZLEnumOption
This commit is contained in:
parent
67b8a512ed
commit
a8f4c69858
3 changed files with 33 additions and 32 deletions
|
@ -710,11 +710,11 @@
|
|||
<node name="summaryOn" value="Show TOC marks in the footer bar"/>
|
||||
<node name="summaryOff" value="Don't show TOC marks in the footer bar"/>
|
||||
</node>
|
||||
<node name="showProgressTypes" value="Show Progress">
|
||||
<node name="hide" value="Do not show progress"/>
|
||||
<node name="showProgressAsPages" value="As page numbers"/>
|
||||
<node name="showProgressAsPercentage" value="As percentage"/>
|
||||
<node name="showProgressAsBoth" value="As pages and percentage"/>
|
||||
<node name="displayProgress" value="Show reading progress">
|
||||
<node name="dontDisplay" value="Do not show"/>
|
||||
<node name="asPages" value="As page numbers"/>
|
||||
<node name="asPercentage" value="As percentage"/>
|
||||
<node name="asPagesAndPercentage" value="As pages and percentage"/>
|
||||
</node>
|
||||
<node name="showBattery" value="Show battery level">
|
||||
<node name="summaryOn" value="Show battery level in footer"/>
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<ProgressDisplayType> 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<ProgressDisplayType>(
|
||||
"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();
|
||||
}
|
||||
|
||||
return resourceKeys;
|
||||
switch (ShowProgress.getValue()) {
|
||||
case asPages:
|
||||
case asPagesAndPercentage:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum ProgressTypes {
|
||||
hide,
|
||||
showProgressAsPages,
|
||||
showProgressAsPercentage,
|
||||
showProgressAsBoth
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue