From 42cd6ea0078378947fc2e70bd0190bd54c225473 Mon Sep 17 00:00:00 2001 From: inorichi Date: Wed, 16 Dec 2015 16:10:34 +0100 Subject: [PATCH] Invert seekbar and textviews on right to left reader --- .../kanade/mangafeed/ui/reader/ReaderActivity.java | 8 ++++---- .../eu/kanade/mangafeed/ui/reader/ReaderMenu.java | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderActivity.java index cdad40313..e63f8feac 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderActivity.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderActivity.java @@ -57,10 +57,10 @@ public class ReaderActivity extends BaseRxActivity { protected CompositeSubscription subscriptions; private Subscription customBrightnessSubscription; - private static final int LEFT_TO_RIGHT = 1; - private static final int RIGHT_TO_LEFT = 2; - private static final int VERTICAL = 3; - private static final int WEBTOON = 4; + public static final int LEFT_TO_RIGHT = 1; + public static final int RIGHT_TO_LEFT = 2; + public static final int VERTICAL = 3; + public static final int WEBTOON = 4; public static final int BLACK_THEME = 1; diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderMenu.java b/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderMenu.java index da5bd6762..2914dfc74 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderMenu.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/reader/ReaderMenu.java @@ -48,6 +48,7 @@ public class ReaderMenu { @State boolean showing; private PopupWindow settingsPopup; private PopupWindow brightnessPopup; + private boolean inverted; private DecimalFormat decimalFormat; @@ -61,6 +62,7 @@ public class ReaderMenu { seekBar.setOnSeekBarChangeListener(new PageSeekBarChangeListener()); decimalFormat = new DecimalFormat("#.##"); + inverted = false; initializeOptions(); } @@ -105,7 +107,19 @@ public class ReaderMenu { } public void onChapterReady(int numPages, Manga manga, Chapter chapter) { + if (manga.viewer == ReaderActivity.RIGHT_TO_LEFT && !inverted) { + // Invert the seekbar and textview fields for the right to left reader + seekBar.setRotation(180); + TextView aux = currentPage; + currentPage = totalPages; + totalPages = aux; + // Don't invert again on chapter change + inverted = true; + } + + // Set initial values totalPages.setText("" + numPages); + currentPage.setText("" + (chapter.last_page_read + 1)); seekBar.setMax(numPages - 1); activity.setToolbarTitle(manga.title);