(final int w, final int h, final Graphics g)
| 561 | } |
| 562 | |
| 563 | private void drawProgressBar(final int w, final int h, final Graphics g) { |
| 564 | |
| 565 | /* Update the state */ |
| 566 | repaintProgressBar = false; |
| 567 | |
| 568 | /* setup some temp vars */ |
| 569 | final int fillHeight = h - (statusBarHeight + progressBarHeight) / 2; |
| 570 | final int progressBarHeight_2 = progressBarHeight / 2; |
| 571 | |
| 572 | /* |
| 573 | * Clearing background |
| 574 | */ |
| 575 | g.setColor(currentScheme.colors[ColorScheme.COLOR_BACKGROUND]); |
| 576 | |
| 577 | g.fillRect(progressBarX, h - statusBarHeight, |
| 578 | progressBarWidth, statusBarHeight); |
| 579 | |
| 580 | /* drawing progress bar */ |
| 581 | g.setColor(currentScheme.colors[ColorScheme.COLOR_TEXT_STATUS_2]); |
| 582 | g.drawLine(progressBarX, fillHeight + progressBarHeight_2, |
| 583 | progressBarX + progressBarWidth - 1, fillHeight + progressBarHeight_2); |
| 584 | |
| 585 | g.setColor(currentScheme.colors[ColorScheme.COLOR_TEXT_STATUS]); |
| 586 | |
| 587 | g.drawRect( |
| 588 | progressBarX, h - ((statusBarHeight + progressBarHeight) / 2), |
| 589 | progressBarWidth - 1, progressBarHeight); |
| 590 | |
| 591 | final int pagesBarWidth; |
| 592 | |
| 593 | if (pagesCount > 0) { |
| 594 | pagesBarWidth = |
| 595 | (int) (progressBarWidth |
| 596 | * (((float) chapterBooklet.getCurrentPageIndex() - 1) |
| 597 | / pagesCount)); |
| 598 | } else { |
| 599 | /* |
| 600 | * This should never happen, how could there be 0 pages?! |
| 601 | */ |
| 602 | pagesBarWidth = progressBarWidth; |
| 603 | } |
| 604 | |
| 605 | final int chaptersCount = currentBook.getChaptersCount() - 1; |
| 606 | final int chaptersBarWidth; |
| 607 | |
| 608 | if (chaptersCount > 0) { |
| 609 | chaptersBarWidth = |
| 610 | (int) (progressBarWidth |
| 611 | * (((float) (currentBook.getCurrentChapter().getNumber())) |
| 612 | / chaptersCount)); |
| 613 | } else { |
| 614 | /* |
| 615 | * This should never happen, how could there be 0 chapters?! |
| 616 | */ |
| 617 | chaptersBarWidth = progressBarWidth; |
| 618 | } |
| 619 | |
| 620 |
no test coverage detected