mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 07:37:37 +03:00
Compare commits
9 Commits
52cc90eec0
...
de68a7d67f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de68a7d67f | ||
|
|
9b8d565b99 | ||
|
|
58c2d8453e | ||
|
|
0645ad9632 | ||
|
|
df8ce19144 | ||
|
|
a28a9ab6d6 | ||
|
|
1beef69f82 | ||
|
|
30b56eb977 | ||
|
|
e0db851db9 |
@ -74,25 +74,14 @@ void ScreenComponents::fillPopupProgress(const GfxRenderer& renderer, const Popu
|
||||
renderer.displayBuffer(HalDisplay::FAST_REFRESH);
|
||||
}
|
||||
|
||||
void ScreenComponents::drawBookProgressBar(const GfxRenderer& renderer, const size_t bookProgress) {
|
||||
void ScreenComponents::drawStatusProgressBar(const GfxRenderer& renderer, const size_t progress) {
|
||||
int vieweableMarginTop, vieweableMarginRight, vieweableMarginBottom, vieweableMarginLeft;
|
||||
renderer.getOrientedViewableTRBL(&vieweableMarginTop, &vieweableMarginRight, &vieweableMarginBottom,
|
||||
&vieweableMarginLeft);
|
||||
|
||||
const int progressBarMaxWidth = renderer.getScreenWidth() - vieweableMarginLeft - vieweableMarginRight;
|
||||
const int progressBarY = renderer.getScreenHeight() - vieweableMarginBottom - PROGRESS_BAR_HEIGHT;
|
||||
const int barWidth = progressBarMaxWidth * bookProgress / 100;
|
||||
renderer.fillRect(vieweableMarginLeft, progressBarY, barWidth, PROGRESS_BAR_HEIGHT, true);
|
||||
}
|
||||
|
||||
void ScreenComponents::drawChapterProgressBar(const GfxRenderer& renderer, const size_t chapterProgress) {
|
||||
int vieweableMarginTop, vieweableMarginRight, vieweableMarginBottom, vieweableMarginLeft;
|
||||
renderer.getOrientedViewableTRBL(&vieweableMarginTop, &vieweableMarginRight, &vieweableMarginBottom,
|
||||
&vieweableMarginLeft);
|
||||
|
||||
const int progressBarMaxWidth = renderer.getScreenWidth() - vieweableMarginLeft - vieweableMarginRight;
|
||||
const int progressBarY = renderer.getScreenHeight() - vieweableMarginBottom - PROGRESS_BAR_HEIGHT;
|
||||
const int barWidth = progressBarMaxWidth * chapterProgress / 100;
|
||||
const int barWidth = progressBarMaxWidth * progress / 100;
|
||||
renderer.fillRect(vieweableMarginLeft, progressBarY, barWidth, PROGRESS_BAR_HEIGHT, true);
|
||||
}
|
||||
|
||||
|
||||
@ -22,20 +22,8 @@ class ScreenComponents {
|
||||
int height;
|
||||
};
|
||||
|
||||
struct PopupLayout {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
static void drawBattery(const GfxRenderer& renderer, int left, int top, bool showPercentage = true);
|
||||
static void drawBookProgressBar(const GfxRenderer& renderer, size_t bookProgress);
|
||||
static void drawChapterProgressBar(const GfxRenderer& renderer, size_t chapterProgress);
|
||||
|
||||
static PopupLayout drawPopup(const GfxRenderer& renderer, const char* message);
|
||||
|
||||
static void fillPopupProgress(const GfxRenderer& renderer, const PopupLayout& layout, int progress);
|
||||
static void drawStatusProgressBar(const GfxRenderer& renderer, size_t progress);
|
||||
|
||||
static PopupLayout drawPopup(const GfxRenderer& renderer, const char* message);
|
||||
|
||||
|
||||
@ -541,14 +541,14 @@ void EpubReaderActivity::renderStatusBar(const int orientedMarginRight, const in
|
||||
|
||||
if (showBookProgressBar) {
|
||||
// Draw progress bar at the very bottom of the screen, from edge to edge of viewable area
|
||||
ScreenComponents::drawBookProgressBar(renderer, static_cast<size_t>(bookProgress));
|
||||
ScreenComponents::drawStatusProgressBar(renderer, static_cast<size_t>(bookProgress));
|
||||
}
|
||||
|
||||
if (showChapterProgressBar) {
|
||||
// Draw chapter progress bar at the very bottom of the screen, from edge to edge of viewable area
|
||||
const float chapterProgress =
|
||||
(section->pageCount > 0) ? (static_cast<float>(section->currentPage + 1) / section->pageCount) * 100 : 0;
|
||||
ScreenComponents::drawChapterProgressBar(renderer, static_cast<size_t>(chapterProgress));
|
||||
ScreenComponents::drawStatusProgressBar(renderer, static_cast<size_t>(chapterProgress));
|
||||
}
|
||||
|
||||
if (showBattery) {
|
||||
|
||||
@ -527,12 +527,12 @@ void TxtReaderActivity::renderStatusBar(const int orientedMarginRight, const int
|
||||
|
||||
if (showProgressBar) {
|
||||
// Draw progress bar at the very bottom of the screen, from edge to edge of viewable area
|
||||
ScreenComponents::drawBookProgressBar(renderer, static_cast<size_t>(progress));
|
||||
ScreenComponents::drawStatusProgressBar(renderer, static_cast<size_t>(progress));
|
||||
}
|
||||
|
||||
if (showChapterProgressBar) {
|
||||
// For text mode, treat the entire book as one chapter, so chapter progress == book progress
|
||||
ScreenComponents::drawChapterProgressBar(renderer, static_cast<size_t>(progress));
|
||||
ScreenComponents::drawStatusProgressBar(renderer, static_cast<size_t>(progress));
|
||||
}
|
||||
|
||||
if (showBattery) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user