1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

Add ShowProgressAsPercentage option

If progress is show: This toggles between showing the percentage completed and the number of pages completed.

Also added a battery unicode symbol in front of the battery display, to clearly show the point of that percentage.
This commit is contained in:
Danie Roux 2015-08-23 15:55:46 +02:00
parent be4e801b53
commit ef56e2e140
6 changed files with 24 additions and 3 deletions

View file

@ -713,6 +713,10 @@
<node name="summaryOn" value="Show page number in footer"/> <node name="summaryOn" value="Show page number in footer"/>
<node name="summaryOff" value="Don't show page number in footer"/> <node name="summaryOff" value="Don't show page number in footer"/>
</node> </node>
<node name="showProgressAsPercentage" value="Show pages as percentage">
<node name="summaryOn" value="Show progress as percentage in footer"/>
<node name="summaryOff" value="Show page number in footer"/>
</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"/>
<node name="summaryOff" value="Don't show battery level in footer"/> <node name="summaryOff" value="Don't show battery level in footer"/>

View file

@ -713,6 +713,10 @@
<node name="summaryOn" value="Show page number in footer"/> <node name="summaryOn" value="Show page number in footer"/>
<node name="summaryOff" value="Don't show page number in footer"/> <node name="summaryOff" value="Don't show page number in footer"/>
</node> </node>
<node name="showProgressAsPercentage" value="Show pages as percentage">
<node name="summaryOn" value="Show progress as percentage in footer"/>
<node name="summaryOff" value="Show page number in footer"/>
</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"/>
<node name="summaryOff" value="Don't show battery level in footer"/> <node name="summaryOff" value="Don't show battery level in footer"/>

View file

@ -558,6 +558,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
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.ShowProgress, "showProgress"));
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowProgressAsPercentage, "showProgressAsPercentage"));
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(

View file

@ -532,9 +532,13 @@ public final class FBView extends ZLTextView {
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.ShowProgress.getValue()) {
info.append(pagePosition.Current); if (footerOptions.ShowProgressAsPercentage.getValue()) {
info.append("/"); info.append(pagePosition.getPercentageString());
info.append(pagePosition.Total); } else {
info.append(pagePosition.Current);
info.append("/");
info.append(pagePosition.Total);
}
} }
if (footerOptions.ShowClock.getValue()) { if (footerOptions.ShowClock.getValue()) {
if (info.length() > 0) { if (info.length() > 0) {
@ -546,6 +550,7 @@ public final class FBView extends ZLTextView {
if (info.length() > 0) { if (info.length() > 0) {
info.append(separator); info.append(separator);
} }
info.append("");
info.append(myReader.getBatteryLevel()); info.append(myReader.getBatteryLevel());
info.append("%"); info.append("%");
} }

View file

@ -26,6 +26,7 @@ public class FooterOptions {
public final ZLBooleanOption ShowClock; public final ZLBooleanOption ShowClock;
public final ZLBooleanOption ShowBattery; public final ZLBooleanOption ShowBattery;
public final ZLBooleanOption ShowProgress; public final ZLBooleanOption ShowProgress;
public final ZLBooleanOption ShowProgressAsPercentage;
public final ZLStringOption Font; public final ZLStringOption Font;
public FooterOptions() { public FooterOptions() {
@ -33,6 +34,7 @@ public class FooterOptions {
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); 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");
} }
} }

View file

@ -706,6 +706,11 @@ public abstract class ZLTextView extends ZLTextViewBase {
Current = current; Current = current;
Total = total; Total = total;
} }
public String getPercentageString() {
float percentage = ((float) Current / Total) * 100;
return String.format("%.0f%%", percentage);
}
} }
public final synchronized PagePosition pagePosition() { public final synchronized PagePosition pagePosition() {