mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +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:
parent
be4e801b53
commit
ef56e2e140
6 changed files with 24 additions and 3 deletions
|
@ -713,6 +713,10 @@
|
|||
<node name="summaryOn" value="Show page number in footer"/>
|
||||
<node name="summaryOff" value="Don't show page number in footer"/>
|
||||
</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="summaryOn" value="Show battery level in footer"/>
|
||||
<node name="summaryOff" value="Don't show battery level in footer"/>
|
||||
|
|
|
@ -713,6 +713,10 @@
|
|||
<node name="summaryOn" value="Show page number in footer"/>
|
||||
<node name="summaryOff" value="Don't show page number in footer"/>
|
||||
</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="summaryOn" value="Show battery level in footer"/>
|
||||
<node name="summaryOff" value="Don't show battery level in footer"/>
|
||||
|
|
|
@ -558,6 +558,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
footerPreferences.add(statusLineScreen.addOption(footerOptions.ShowTOCMarks, "tocMarks"));
|
||||
|
||||
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.ShowBattery, "showBattery"));
|
||||
footerPreferences.add(statusLineScreen.addPreference(new FontPreference(
|
||||
|
|
|
@ -532,9 +532,13 @@ public final class FBView extends ZLTextView {
|
|||
final StringBuilder info = new StringBuilder();
|
||||
final FooterOptions footerOptions = myViewOptions.getFooterOptions();
|
||||
if (footerOptions.ShowProgress.getValue()) {
|
||||
info.append(pagePosition.Current);
|
||||
info.append("/");
|
||||
info.append(pagePosition.Total);
|
||||
if (footerOptions.ShowProgressAsPercentage.getValue()) {
|
||||
info.append(pagePosition.getPercentageString());
|
||||
} else {
|
||||
info.append(pagePosition.Current);
|
||||
info.append("/");
|
||||
info.append(pagePosition.Total);
|
||||
}
|
||||
}
|
||||
if (footerOptions.ShowClock.getValue()) {
|
||||
if (info.length() > 0) {
|
||||
|
@ -546,6 +550,7 @@ public final class FBView extends ZLTextView {
|
|||
if (info.length() > 0) {
|
||||
info.append(separator);
|
||||
}
|
||||
info.append("⚡ ");
|
||||
info.append(myReader.getBatteryLevel());
|
||||
info.append("%");
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public class FooterOptions {
|
|||
public final ZLBooleanOption ShowClock;
|
||||
public final ZLBooleanOption ShowBattery;
|
||||
public final ZLBooleanOption ShowProgress;
|
||||
public final ZLBooleanOption ShowProgressAsPercentage;
|
||||
public final ZLStringOption Font;
|
||||
|
||||
public FooterOptions() {
|
||||
|
@ -33,6 +34,7 @@ public class FooterOptions {
|
|||
ShowClock = new ZLBooleanOption("Options", "ShowClockInFooter", 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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,6 +706,11 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
Current = current;
|
||||
Total = total;
|
||||
}
|
||||
|
||||
public String getPercentageString() {
|
||||
float percentage = ((float) Current / Total) * 100;
|
||||
return String.format("%.0f%%", percentage);
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized PagePosition pagePosition() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue