mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +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="summaryOn" value="Show TOC marks in the footer bar"/>
|
||||||
<node name="summaryOff" value="Don't show TOC marks in the footer bar"/>
|
<node name="summaryOff" value="Don't show TOC marks in the footer bar"/>
|
||||||
</node>
|
</node>
|
||||||
<node name="showProgressTypes" value="Show Progress">
|
<node name="displayProgress" value="Show reading progress">
|
||||||
<node name="hide" value="Do not show progress"/>
|
<node name="dontDisplay" value="Do not show"/>
|
||||||
<node name="showProgressAsPages" value="As page numbers"/>
|
<node name="asPages" value="As page numbers"/>
|
||||||
<node name="showProgressAsPercentage" value="As percentage"/>
|
<node name="asPercentage" value="As percentage"/>
|
||||||
<node name="showProgressAsBoth" value="As pages and percentage"/>
|
<node name="asPagesAndPercentage" value="As pages and percentage"/>
|
||||||
</node>
|
</node>
|
||||||
<node name="showBattery" value="Show battery level">
|
<node name="showBattery" value="Show battery level">
|
||||||
<node name="summaryOn" value="Show battery level in footer"/>
|
<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"));
|
newStyleFooterPreferences.add(statusLineScreen.addOption(profile.FooterNGForegroundUnreadOption, "footerForegroundUnreadColor"));
|
||||||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowTOCMarks, "tocMarks"));
|
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowTOCMarks, "tocMarks"));
|
||||||
|
|
||||||
statusLineScreen.addPreference(new ZLChoicePreference(
|
statusLineScreen.addPreference(new ZLEnumPreference(
|
||||||
this, statusLineScreen.Resource.getResource("showProgressTypes"),
|
this,
|
||||||
footerOptions.ShowProgressType, footerOptions.getProgressValueResourceKeys()
|
footerOptions.ShowProgress,
|
||||||
|
statusLineScreen.Resource.getResource("showProgressTypes")
|
||||||
) {
|
) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
|
|
|
@ -22,11 +22,18 @@ package org.geometerplus.fbreader.fbreader.options;
|
||||||
import org.geometerplus.zlibrary.core.options.*;
|
import org.geometerplus.zlibrary.core.options.*;
|
||||||
|
|
||||||
public class FooterOptions {
|
public class FooterOptions {
|
||||||
|
enum ProgressDisplayType {
|
||||||
|
dontDisplay,
|
||||||
|
asPages,
|
||||||
|
asPercentage,
|
||||||
|
asPagesAndPercentage
|
||||||
|
}
|
||||||
|
|
||||||
public final ZLBooleanOption ShowTOCMarks;
|
public final ZLBooleanOption ShowTOCMarks;
|
||||||
public final ZLBooleanOption ShowClock;
|
public final ZLBooleanOption ShowClock;
|
||||||
public final ZLBooleanOption ShowBattery;
|
public final ZLBooleanOption ShowBattery;
|
||||||
|
|
||||||
public final ZLIntegerRangeOption ShowProgressType;
|
public final ZLEnumOption<ProgressDisplayType> ShowProgress;
|
||||||
|
|
||||||
public final ZLStringOption Font;
|
public final ZLStringOption Font;
|
||||||
|
|
||||||
|
@ -36,35 +43,28 @@ public class FooterOptions {
|
||||||
ShowBattery = new ZLBooleanOption("Options", "ShowBatteryInFooter", true);
|
ShowBattery = new ZLBooleanOption("Options", "ShowBatteryInFooter", true);
|
||||||
Font = new ZLStringOption("Options", "FooterFont", "Droid Sans");
|
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() {
|
public boolean showProgressAsPercentage() {
|
||||||
return ShowProgressType.getValue() == ProgressTypes.showProgressAsPercentage.ordinal() ||
|
switch (ShowProgress.getValue()) {
|
||||||
ShowProgressType.getValue() == ProgressTypes.showProgressAsBoth.ordinal();
|
case asPercentage:
|
||||||
|
case asPagesAndPercentage:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showProgressAsPages() {
|
public boolean showProgressAsPages() {
|
||||||
return ShowProgressType.getValue() == ProgressTypes.showProgressAsPages.ordinal() ||
|
switch (ShowProgress.getValue()) {
|
||||||
ShowProgressType.getValue() == ProgressTypes.showProgressAsBoth.ordinal();
|
case asPages:
|
||||||
}
|
case asPagesAndPercentage:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
public String[] getProgressValueResourceKeys() {
|
return false;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ProgressTypes {
|
|
||||||
hide,
|
|
||||||
showProgressAsPages,
|
|
||||||
showProgressAsPercentage,
|
|
||||||
showProgressAsBoth
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue