Invert seekbar and textviews on right to left reader

This commit is contained in:
inorichi 2015-12-16 16:10:34 +01:00
parent 04d9176c3c
commit 42cd6ea007
2 changed files with 18 additions and 4 deletions

View file

@ -57,10 +57,10 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
protected CompositeSubscription subscriptions; protected CompositeSubscription subscriptions;
private Subscription customBrightnessSubscription; private Subscription customBrightnessSubscription;
private static final int LEFT_TO_RIGHT = 1; public static final int LEFT_TO_RIGHT = 1;
private static final int RIGHT_TO_LEFT = 2; public static final int RIGHT_TO_LEFT = 2;
private static final int VERTICAL = 3; public static final int VERTICAL = 3;
private static final int WEBTOON = 4; public static final int WEBTOON = 4;
public static final int BLACK_THEME = 1; public static final int BLACK_THEME = 1;

View file

@ -48,6 +48,7 @@ public class ReaderMenu {
@State boolean showing; @State boolean showing;
private PopupWindow settingsPopup; private PopupWindow settingsPopup;
private PopupWindow brightnessPopup; private PopupWindow brightnessPopup;
private boolean inverted;
private DecimalFormat decimalFormat; private DecimalFormat decimalFormat;
@ -61,6 +62,7 @@ public class ReaderMenu {
seekBar.setOnSeekBarChangeListener(new PageSeekBarChangeListener()); seekBar.setOnSeekBarChangeListener(new PageSeekBarChangeListener());
decimalFormat = new DecimalFormat("#.##"); decimalFormat = new DecimalFormat("#.##");
inverted = false;
initializeOptions(); initializeOptions();
} }
@ -105,7 +107,19 @@ public class ReaderMenu {
} }
public void onChapterReady(int numPages, Manga manga, Chapter chapter) { 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); totalPages.setText("" + numPages);
currentPage.setText("" + (chapter.last_page_read + 1));
seekBar.setMax(numPages - 1); seekBar.setMax(numPages - 1);
activity.setToolbarTitle(manga.title); activity.setToolbarTitle(manga.title);