mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
Collapse "show pages" and "show percentage" into a list of options
This simplifies the UI some what.
This commit is contained in:
parent
ef56e2e140
commit
e15f54582b
3 changed files with 59 additions and 20 deletions
|
@ -557,8 +557,12 @@ 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"));
|
||||||
|
|
||||||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowProgress, "showProgress"));
|
|
||||||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowProgressAsPercentage, "showProgressAsPercentage"));
|
statusLineScreen.addPreference(new ZLChoicePreference(
|
||||||
|
this, statusLineScreen.Resource.getResource("showProgressTypes"),
|
||||||
|
footerOptions.ShowProgressType, footerOptions.getProgressValueResourceKeys()
|
||||||
|
));
|
||||||
|
|
||||||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowClock, "showClock"));
|
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowClock, "showClock"));
|
||||||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowBattery, "showBattery"));
|
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowBattery, "showBattery"));
|
||||||
footerPreferences.add(statusLineScreen.addPreference(new FontPreference(
|
footerPreferences.add(statusLineScreen.addPreference(new FontPreference(
|
||||||
|
|
|
@ -531,25 +531,24 @@ public final class FBView extends ZLTextView {
|
||||||
protected String buildInfoString(PagePosition pagePosition, String separator) {
|
protected String buildInfoString(PagePosition pagePosition, String separator) {
|
||||||
final StringBuilder info = new StringBuilder();
|
final StringBuilder info = new StringBuilder();
|
||||||
final FooterOptions footerOptions = myViewOptions.getFooterOptions();
|
final FooterOptions footerOptions = myViewOptions.getFooterOptions();
|
||||||
if (footerOptions.ShowProgress.getValue()) {
|
|
||||||
if (footerOptions.ShowProgressAsPercentage.getValue()) {
|
if (footerOptions.showProgressAsPages()) {
|
||||||
info.append(pagePosition.getPercentageString());
|
maybeAddSeparator(separator, info);
|
||||||
} else {
|
info.append(pagePosition.Current);
|
||||||
info.append(pagePosition.Current);
|
info.append("/");
|
||||||
info.append("/");
|
info.append(pagePosition.Total);
|
||||||
info.append(pagePosition.Total);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (footerOptions.showProgressAsPercentage()) {
|
||||||
|
maybeAddSeparator(separator, info);
|
||||||
|
info.append(pagePosition.getPercentageString());
|
||||||
|
}
|
||||||
|
|
||||||
if (footerOptions.ShowClock.getValue()) {
|
if (footerOptions.ShowClock.getValue()) {
|
||||||
if (info.length() > 0) {
|
maybeAddSeparator(separator, info);
|
||||||
info.append(separator);
|
|
||||||
}
|
|
||||||
info.append(ZLibrary.Instance().getCurrentTimeString());
|
info.append(ZLibrary.Instance().getCurrentTimeString());
|
||||||
}
|
}
|
||||||
if (footerOptions.ShowBattery.getValue()) {
|
if (footerOptions.ShowBattery.getValue()) {
|
||||||
if (info.length() > 0) {
|
maybeAddSeparator(separator, info);
|
||||||
info.append(separator);
|
|
||||||
}
|
|
||||||
info.append("⚡ ");
|
info.append("⚡ ");
|
||||||
info.append(myReader.getBatteryLevel());
|
info.append(myReader.getBatteryLevel());
|
||||||
info.append("%");
|
info.append("%");
|
||||||
|
@ -557,6 +556,12 @@ public final class FBView extends ZLTextView {
|
||||||
return info.toString();
|
return info.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeAddSeparator(String separator, StringBuilder info) {
|
||||||
|
if (info.length() > 0) {
|
||||||
|
info.append(separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<FontEntry> myFontEntry;
|
private List<FontEntry> myFontEntry;
|
||||||
private Map<String,Integer> myHeightMap = new HashMap<String,Integer>();
|
private Map<String,Integer> myHeightMap = new HashMap<String,Integer>();
|
||||||
private Map<String,Integer> myCharHeightMap = new HashMap<String,Integer>();
|
private Map<String,Integer> myCharHeightMap = new HashMap<String,Integer>();
|
||||||
|
|
|
@ -25,16 +25,46 @@ public class FooterOptions {
|
||||||
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 ZLBooleanOption ShowProgress;
|
|
||||||
public final ZLBooleanOption ShowProgressAsPercentage;
|
public final ZLIntegerRangeOption ShowProgressType;
|
||||||
|
|
||||||
public final ZLStringOption Font;
|
public final ZLStringOption Font;
|
||||||
|
|
||||||
public FooterOptions() {
|
public FooterOptions() {
|
||||||
ShowTOCMarks = new ZLBooleanOption("Options", "FooterShowTOCMarks", true);
|
ShowTOCMarks = new ZLBooleanOption("Options", "FooterShowTOCMarks", true);
|
||||||
ShowClock = new ZLBooleanOption("Options", "ShowClockInFooter", true);
|
ShowClock = new ZLBooleanOption("Options", "ShowClockInFooter", true);
|
||||||
ShowBattery = new ZLBooleanOption("Options", "ShowBatteryInFooter", true);
|
ShowBattery = new ZLBooleanOption("Options", "ShowBatteryInFooter", true);
|
||||||
ShowProgress = new ZLBooleanOption("Options", "ShowProgressInFooter", true);
|
|
||||||
ShowProgressAsPercentage = new ZLBooleanOption("Options", "ShowProgressInFooterAsPercentage", false);
|
|
||||||
Font = new ZLStringOption("Options", "FooterFont", "Droid Sans");
|
Font = new ZLStringOption("Options", "FooterFont", "Droid Sans");
|
||||||
|
|
||||||
|
ShowProgressType = new ZLIntegerRangeOption("Options", "ShowProgressType", 0, 4, ProgressTypes.showProgressAsPages.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showProgressAsPercentage() {
|
||||||
|
return ShowProgressType.getValue() == ProgressTypes.showProgressAsPercentage.ordinal() ||
|
||||||
|
ShowProgressType.getValue() == ProgressTypes.showProgressAsBoth.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ProgressTypes {
|
||||||
|
hide,
|
||||||
|
showProgressAsPages,
|
||||||
|
showProgressAsPercentage,
|
||||||
|
showProgressAsBoth
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue