Add more settings to the reader

This commit is contained in:
inorichi 2015-11-21 02:27:34 +01:00
parent 5e2269df14
commit e66ba4d834
22 changed files with 301 additions and 84 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import com.f2prateek.rx.preferences.Preference;
import com.f2prateek.rx.preferences.RxSharedPreferences; import com.f2prateek.rx.preferences.RxSharedPreferences;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
@ -36,21 +37,24 @@ public class PreferencesHelper {
prefs.edit().clear().apply(); prefs.edit().clear().apply();
} }
public boolean isHideStatusBarSet() { public Preference<Boolean> lockOrientation() {
return prefs.getBoolean(getKey(R.string.pref_hide_status_bar_key), true); return rxPrefs.getBoolean(getKey(R.string.pref_lock_orientation_key), true);
} }
public boolean isOrientationLocked() { public Preference<Boolean> enableTransitions() {
return prefs.getBoolean(getKey(R.string.pref_lock_orientation_key), true); return rxPrefs.getBoolean(getKey(R.string.pref_enable_transitions_key), true);
} }
public void setOrientationLocked(boolean lock) { public Preference<Boolean> showPageNumber() {
prefs.edit().putBoolean(getKey(R.string.pref_lock_orientation_key), lock).apply(); return rxPrefs.getBoolean(getKey(R.string.pref_show_page_number_key), true);
} }
public Observable<Boolean> isOrientationLockedObservable() { public Preference<Boolean> hideStatusBar() {
return rxPrefs.getBoolean(getKey(R.string.pref_lock_orientation_key), true) return rxPrefs.getBoolean(getKey(R.string.pref_hide_status_bar_key), true);
.asObservable(); }
public Preference<Boolean> keepScreenOn() {
return rxPrefs.getBoolean(getKey(R.string.pref_keep_screen_on_key), true);
} }
public int getDefaultViewer() { public int getDefaultViewer() {

View File

@ -165,7 +165,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
return true; return true;
} else { } else {
getPresenter().onChapterClicked(adapter.getItem(position)); getPresenter().onChapterClicked(adapter.getItem(position));
Intent intent = ReaderActivity.newInstance(getActivity()); Intent intent = ReaderActivity.newIntent(getActivity());
startActivity(intent); startActivity(intent);
return false; return false;
} }

View File

@ -2,11 +2,13 @@ package eu.kanade.mangafeed.ui.reader;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.Surface;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
@ -34,6 +36,7 @@ import eu.kanade.mangafeed.ui.reader.viewer.webtoon.WebtoonReader;
import eu.kanade.mangafeed.util.ToastUtil; import eu.kanade.mangafeed.util.ToastUtil;
import icepick.Icepick; import icepick.Icepick;
import nucleus.factory.RequiresPresenter; import nucleus.factory.RequiresPresenter;
import rx.subscriptions.CompositeSubscription;
@RequiresPresenter(ReaderPresenter.class) @RequiresPresenter(ReaderPresenter.class)
public class ReaderActivity extends BaseRxActivity<ReaderPresenter> { public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
@ -42,20 +45,20 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
@Bind(R.id.reader) FrameLayout container; @Bind(R.id.reader) FrameLayout container;
@Bind(R.id.toolbar) Toolbar toolbar; @Bind(R.id.toolbar) Toolbar toolbar;
@Inject PreferencesHelper prefs; @Inject PreferencesHelper preferences;
private BaseReader viewer; private BaseReader viewer;
private ReaderMenu readerMenu; private ReaderMenu readerMenu;
private int uiFlags; private int uiFlags;
private CompositeSubscription subscriptions;
private static final int LEFT_TO_RIGHT = 1; private static final int LEFT_TO_RIGHT = 1;
private static final int RIGHT_TO_LEFT = 2; private static final int RIGHT_TO_LEFT = 2;
private static final int VERTICAL = 3; private static final int VERTICAL = 3;
private static final int WEBTOON = 4; private static final int WEBTOON = 4;
public static Intent newIntent(Context context) {
public static Intent newInstance(Context context) {
return new Intent(context, ReaderActivity.class); return new Intent(context, ReaderActivity.class);
} }
@ -67,14 +70,16 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
ButterKnife.bind(this); ButterKnife.bind(this);
setupToolbar(toolbar); setupToolbar(toolbar);
subscriptions = new CompositeSubscription();
readerMenu = new ReaderMenu(this, prefs); readerMenu = new ReaderMenu(this);
Icepick.restoreInstanceState(readerMenu, savedState); Icepick.restoreInstanceState(readerMenu, savedState);
if (savedState != null && readerMenu.showing) if (savedState != null && readerMenu.showing)
readerMenu.show(false); readerMenu.show(false);
createUiHideFlags();
enableHardwareAcceleration(); enableHardwareAcceleration();
initializeSettings();
} }
@Override @Override
@ -86,7 +91,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
hideSystemUI(); setSystemUiVisibility();
} }
@Override @Override
@ -102,16 +107,17 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
private void createUiHideFlags() { private void createUiHideFlags(boolean statusBarHidden) {
uiFlags = 0;
uiFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; uiFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (prefs.isHideStatusBarSet()) if (statusBarHidden)
uiFlags |= View.SYSTEM_UI_FLAG_FULLSCREEN; uiFlags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
uiFlags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; uiFlags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
} }
public void onChapterReady(List<Page> pages, Manga manga, Chapter chapter) { public void onChapterReady(List<Page> pages, Manga manga, Chapter chapter) {
viewer = getViewer(manga); viewer = createViewer(manga);
viewer.onPageListReady(pages); viewer.onPageListReady(pages);
viewer.updatePageNumber(); viewer.updatePageNumber();
readerMenu.onChapterReady(pages.size(), manga, chapter); readerMenu.onChapterReady(pages.size(), manga, chapter);
@ -132,7 +138,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
viewer.setSelectedPage(pageIndex); viewer.setSelectedPage(pageIndex);
} }
public void hideSystemUI() { public void setSystemUiVisibility() {
getWindow().getDecorView().setSystemUiVisibility(uiFlags); getWindow().getDecorView().setSystemUiVisibility(uiFlags);
} }
@ -154,8 +160,12 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
return container; return container;
} }
private BaseReader getViewer(Manga manga) { public PreferencesHelper getPreferences() {
int mangaViewer = manga.viewer == 0 ? prefs.getDefaultViewer() : manga.viewer; return preferences;
}
private BaseReader createViewer(Manga manga) {
int mangaViewer = manga.viewer == 0 ? preferences.getDefaultViewer() : manga.viewer;
switch (mangaViewer) { switch (mangaViewer) {
case LEFT_TO_RIGHT: default: case LEFT_TO_RIGHT: default:
@ -169,4 +179,69 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
} }
} }
private void initializeSettings() {
subscriptions.add(preferences.showPageNumber()
.asObservable()
.subscribe(this::setPageNumberVisibility));
subscriptions.add(preferences.lockOrientation()
.asObservable()
.subscribe(this::setOrientation));
subscriptions.add(preferences.hideStatusBar()
.asObservable()
.subscribe(this::setStatusBarVisibility));
preferences.keepScreenOn()
.asObservable()
.subscribe(this::setKeepScreenOn);
}
private void setOrientation(boolean locked) {
if (locked) {
int orientation;
int rotation = ((WindowManager) getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break;
case Surface.ROTATION_90:
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
case Surface.ROTATION_180:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
break;
default:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
break;
}
setRequestedOrientation(orientation);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
private void setPageNumberVisibility(boolean visible) {
pageNumber.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
private void setStatusBarVisibility(boolean hidden) {
createUiHideFlags(hidden);
setSystemUiVisibility();
}
private void setKeepScreenOn(boolean enabled) {
if (enabled) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
protected void setMangaDefaultViewer(int viewer) {
getPresenter().updateMangaViewer(viewer);
recreate();
}
} }

View File

@ -2,16 +2,18 @@ package eu.kanade.mangafeed.ui.reader;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.pm.ActivityInfo;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Surface; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.CheckBox;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
@ -37,18 +39,21 @@ public class ReaderMenu {
@Bind(R.id.total_pages) TextView totalPages; @Bind(R.id.total_pages) TextView totalPages;
@Bind(R.id.lock_orientation) ImageButton lockOrientation; @Bind(R.id.lock_orientation) ImageButton lockOrientation;
@Bind(R.id.reader_selector) ImageButton readerSelector; @Bind(R.id.reader_selector) ImageButton readerSelector;
@Bind(R.id.reader_extra_settings) ImageButton extraSettings;
private ReaderActivity activity; private ReaderActivity activity;
private PreferencesHelper preferences; private PreferencesHelper preferences;
@State boolean showing; @State boolean showing;
private PopupWindow popupWindow;
private DecimalFormat decimalFormat; private DecimalFormat decimalFormat;
private CompositeSubscription subscriptions; private CompositeSubscription subscriptions;
public ReaderMenu(ReaderActivity activity, PreferencesHelper preferences) { public ReaderMenu(ReaderActivity activity) {
this.activity = activity; this.activity = activity;
this.preferences = preferences; this.preferences = activity.getPreferences();
ButterKnife.bind(this, activity); ButterKnife.bind(this, activity);
// Intercept all image events in this layout // Intercept all image events in this layout
@ -94,6 +99,8 @@ public class ReaderMenu {
Animation bottomMenuAnimation = AnimationUtils.loadAnimation(activity, R.anim.exit_to_bottom); Animation bottomMenuAnimation = AnimationUtils.loadAnimation(activity, R.anim.exit_to_bottom);
bottomMenu.startAnimation(bottomMenuAnimation); bottomMenu.startAnimation(bottomMenuAnimation);
popupWindow.dismiss();
showing = false; showing = false;
} }
@ -116,11 +123,18 @@ public class ReaderMenu {
private void initializeOptions() { private void initializeOptions() {
// Orientation changes // Orientation changes
lockOrientation.setOnClickListener(v -> subscriptions.add(preferences.lockOrientation().asObservable()
preferences.setOrientationLocked(!preferences.isOrientationLocked())); .subscribe(locked -> {
int resourceId = !locked ? R.drawable.ic_screen_rotation :
activity.getResources().getConfiguration().orientation == 1 ?
R.drawable.ic_screen_lock_portrait :
R.drawable.ic_screen_lock_landscape;
subscriptions.add(preferences.isOrientationLockedObservable() lockOrientation.setImageResource(resourceId);
.subscribe(this::onOrientationOptionChanged)); }));
lockOrientation.setOnClickListener(v ->
preferences.lockOrientation().set(!preferences.lockOrientation().get()));
// Reader selector // Reader selector
readerSelector.setOnClickListener(v -> { readerSelector.setOnClickListener(v -> {
@ -128,57 +142,84 @@ public class ReaderMenu {
final Dialog dialog = new AlertDialog.Builder(activity) final Dialog dialog = new AlertDialog.Builder(activity)
.setSingleChoiceItems(R.array.viewers_selector, manga.viewer, (d, which) -> { .setSingleChoiceItems(R.array.viewers_selector, manga.viewer, (d, which) -> {
if (manga.viewer != which) { if (manga.viewer != which) {
activity.getPresenter().updateMangaViewer(which); activity.setMangaDefaultViewer(which);
activity.recreate();
} }
d.dismiss(); d.dismiss();
}) })
.create(); .create();
showImmersiveDialog(dialog);
});
// Hack to not leave immersive mode // Extra settings menu
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, final View popupView = activity.getLayoutInflater().inflate(R.layout.reader_popup, null);
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); popupWindow = new SettingsPopupWindow(popupView);
dialog.getWindow().getDecorView().setSystemUiVisibility(
activity.getWindow().getDecorView().getSystemUiVisibility()); extraSettings.setOnClickListener(v -> {
dialog.show(); if (!popupWindow.isShowing())
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); popupWindow.showAtLocation(extraSettings,
WindowManager wm = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE); Gravity.BOTTOM | Gravity.RIGHT, 0, bottomMenu.getHeight());
wm.updateViewLayout(activity.getWindow().getDecorView(), activity.getWindow().getAttributes()); else
popupWindow.dismiss();
}); });
} }
private void onOrientationOptionChanged(boolean locked) { private void showImmersiveDialog(Dialog dialog) {
if (locked) // Hack to not leave immersive mode
lockOrientation(); dialog.getWindow().setFlags(LayoutParams.FLAG_NOT_FOCUSABLE,
else LayoutParams.FLAG_NOT_FOCUSABLE);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); dialog.getWindow().getDecorView().setSystemUiVisibility(
int resourceId = !locked ? R.drawable.ic_screen_rotation : activity.getWindow().getDecorView().getSystemUiVisibility());
activity.getResources().getConfiguration().orientation == 1 ? dialog.show();
R.drawable.ic_screen_lock_portrait : dialog.getWindow().clearFlags(LayoutParams.FLAG_NOT_FOCUSABLE);
R.drawable.ic_screen_lock_landscape; WindowManager wm = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
wm.updateViewLayout(activity.getWindow().getDecorView(), activity.getWindow().getAttributes());
lockOrientation.setImageResource(resourceId);
} }
private void lockOrientation() { class SettingsPopupWindow extends PopupWindow {
int orientation;
int rotation = ((WindowManager) activity.getSystemService( @Bind(R.id.enable_transitions) CheckBox enableTransitions;
Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); @Bind(R.id.show_page_number) CheckBox showPageNumber;
switch (rotation) { @Bind(R.id.hide_status_bar) CheckBox hideStatusBar;
case Surface.ROTATION_0: @Bind(R.id.keep_screen_on) CheckBox keepScreenOn;
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break; public SettingsPopupWindow(View view) {
case Surface.ROTATION_90: super(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; setAnimationStyle(R.style.reader_settings_popup_animation);
break; ButterKnife.bind(this, view);
case Surface.ROTATION_180: initializePopupMenu();
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
break;
default:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
break;
} }
activity.setRequestedOrientation(orientation);
private void initializePopupMenu() {
subscriptions.add(preferences.enableTransitions()
.asObservable()
.subscribe(enableTransitions::setChecked));
subscriptions.add(preferences.showPageNumber()
.asObservable()
.subscribe(showPageNumber::setChecked));
subscriptions.add(preferences.hideStatusBar()
.asObservable()
.subscribe(hideStatusBar::setChecked));
subscriptions.add(preferences.keepScreenOn()
.asObservable()
.subscribe(keepScreenOn::setChecked));
enableTransitions.setOnCheckedChangeListener((view, isChecked) ->
preferences.enableTransitions().set(isChecked));
showPageNumber.setOnCheckedChangeListener((view, isChecked) ->
preferences.showPageNumber().set(isChecked));
hideStatusBar.setOnCheckedChangeListener((view, isChecked) ->
preferences.hideStatusBar().set(isChecked));
keepScreenOn.setOnCheckedChangeListener((view, isChecked) ->
preferences.keepScreenOn().set(isChecked));
}
} }
class PageSeekBarChangeListener implements SeekBar.OnSeekBarChangeListener { class PageSeekBarChangeListener implements SeekBar.OnSeekBarChangeListener {
@ -214,4 +255,5 @@ public class ReaderMenu {
} }
} }
} }

View File

@ -11,6 +11,7 @@ import eu.kanade.mangafeed.data.source.model.Page;
import eu.kanade.mangafeed.ui.reader.ReaderActivity; import eu.kanade.mangafeed.ui.reader.ReaderActivity;
import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader; import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader;
import eu.kanade.mangafeed.ui.reader.viewer.common.ViewPagerReaderAdapter; import eu.kanade.mangafeed.ui.reader.viewer.common.ViewPagerReaderAdapter;
import rx.Subscription;
public abstract class HorizontalReader extends BaseReader { public abstract class HorizontalReader extends BaseReader {
@ -18,11 +19,17 @@ public abstract class HorizontalReader extends BaseReader {
protected ViewPagerReaderAdapter adapter; protected ViewPagerReaderAdapter adapter;
private boolean transitions;
private Subscription transitionsSubscription;
public HorizontalReader(ReaderActivity activity) { public HorizontalReader(ReaderActivity activity) {
super(activity); super(activity);
activity.getLayoutInflater().inflate(R.layout.reader_horizontal, container); activity.getLayoutInflater().inflate(R.layout.reader_horizontal, container);
ButterKnife.bind(this, container); ButterKnife.bind(this, container);
transitionsSubscription = activity.getPreferences().enableTransitions().asObservable()
.subscribe(value -> transitions = value);
viewPager.setOffscreenPageLimit(3); viewPager.setOffscreenPageLimit(3);
viewPager.addOnPageChangeListener(new HorizontalViewPager.SimpleOnPageChangeListener() { viewPager.addOnPageChangeListener(new HorizontalViewPager.SimpleOnPageChangeListener() {
@Override @Override
@ -42,7 +49,22 @@ public abstract class HorizontalReader extends BaseReader {
onLastPageOut(); onLastPageOut();
} }
}); });
viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap); viewPager.setOnChapterSingleTapListener(new HorizontalViewPager.OnChapterSingleTapListener() {
@Override
public void onCenterTap() {
activity.onCenterSingleTap();
}
@Override
public void onLeftSideTap() {
viewPager.setCurrentItem(viewPager.getCurrentItem() - 1, transitions);
}
@Override
public void onRightSideTap() {
viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, transitions);
}
});
} }
@Override @Override
@ -67,6 +89,11 @@ public abstract class HorizontalReader extends BaseReader {
return viewPager.onImageTouch(motionEvent); return viewPager.onImageTouch(motionEvent);
} }
@Override
public void destroySubscriptions() {
transitionsSubscription.unsubscribe();
}
public abstract void onFirstPageOut(); public abstract void onFirstPageOut();
public abstract void onLastPageOut(); public abstract void onLastPageOut();

View File

@ -90,7 +90,9 @@ public class HorizontalViewPager extends ViewPager {
} }
public interface OnChapterSingleTapListener { public interface OnChapterSingleTapListener {
void onSingleTap(); void onCenterTap();
void onLeftSideTap();
void onRightSideTap();
} }
public void setOnChapterBoundariesOutListener(OnChapterBoundariesOutListener onChapterBoundariesOutListener) { public void setOnChapterBoundariesOutListener(OnChapterBoundariesOutListener onChapterBoundariesOutListener) {
@ -111,7 +113,9 @@ public class HorizontalViewPager extends ViewPager {
if (positionX < getWidth() * LEFT_REGION) { if (positionX < getWidth() * LEFT_REGION) {
if (position != 0) { if (position != 0) {
setCurrentItem(position - 1, true); if (mOnChapterSingleTapListener != null) {
mOnChapterSingleTapListener.onLeftSideTap();
}
} else { } else {
if (mOnChapterBoundariesOutListener != null) { if (mOnChapterBoundariesOutListener != null) {
mOnChapterBoundariesOutListener.onFirstPageOutEvent(); mOnChapterBoundariesOutListener.onFirstPageOutEvent();
@ -119,7 +123,9 @@ public class HorizontalViewPager extends ViewPager {
} }
} else if (positionX > getWidth() * RIGHT_REGION) { } else if (positionX > getWidth() * RIGHT_REGION) {
if (position != getAdapter().getCount() - 1) { if (position != getAdapter().getCount() - 1) {
setCurrentItem(position + 1, true); if (mOnChapterSingleTapListener != null) {
mOnChapterSingleTapListener.onRightSideTap();
}
} else { } else {
if (mOnChapterBoundariesOutListener != null) { if (mOnChapterBoundariesOutListener != null) {
mOnChapterBoundariesOutListener.onLastPageOutEvent(); mOnChapterBoundariesOutListener.onLastPageOutEvent();
@ -127,7 +133,7 @@ public class HorizontalViewPager extends ViewPager {
} }
} else { } else {
if (mOnChapterSingleTapListener != null) { if (mOnChapterSingleTapListener != null) {
mOnChapterSingleTapListener.onSingleTap(); mOnChapterSingleTapListener.onCenterTap();
} }
} }

View File

@ -2,7 +2,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"> android:shareInterpolator="false">
<translate <translate
android:duration="400" android:duration="200"
android:fromXDelta="-100%" android:fromXDelta="-100%"
android:toXDelta="0%" /> android:toXDelta="0%" />
</set> </set>

View File

@ -2,7 +2,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"> android:shareInterpolator="false">
<translate <translate
android:duration="400" android:duration="200"
android:fromXDelta="100%" android:fromXDelta="100%"
android:toXDelta="0%" /> android:toXDelta="0%" />
</set> </set>

View File

@ -2,7 +2,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"> android:shareInterpolator="false">
<translate <translate
android:duration="400" android:duration="200"
android:fromXDelta="0%" android:fromXDelta="0%"
android:toXDelta="-100%" /> android:toXDelta="-100%" />
</set> </set>

View File

@ -2,7 +2,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"> android:shareInterpolator="false">
<translate <translate
android:duration="400" android:duration="200"
android:fromXDelta="0%" android:fromXDelta="0%"
android:toXDelta="100%" /> android:toXDelta="100%" />
</set> </set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@ -77,13 +77,15 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/reader_selector"
android:src="@drawable/ic_view_carousel"
android:background="?android:selectableItemBackground" /> android:background="?android:selectableItemBackground" />
<ImageButton <ImageButton
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/reader_selector" android:id="@+id/reader_extra_settings"
android:src="@drawable/ic_view_carousel" android:src="@drawable/ic_more_vert"
android:background="?android:selectableItemBackground" /> android:background="?android:selectableItemBackground" />
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333333"
android:paddingRight="10dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/enable_transitions"
style="@style/grey_text"
android:text="@string/pref_enable_transitions"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/show_page_number"
style="@style/grey_text"
android:text="@string/pref_show_page_number"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/hide_status_bar"
style="@style/grey_text"
android:text="@string/pref_hide_status_bar"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/keep_screen_on"
style="@style/grey_text"
android:text="Keep screen on"/>
</LinearLayout>

View File

@ -3,9 +3,14 @@
<string name="pref_category_reader_key">pref_category_reader_key</string> <string name="pref_category_reader_key">pref_category_reader_key</string>
<string name="pref_category_accounts_key">pref_category_accounts_key</string> <string name="pref_category_accounts_key">pref_category_accounts_key</string>
<string name="pref_category_downloads_key">pref_category_downloads_key</string> <string name="pref_category_downloads_key">pref_category_downloads_key</string>
<string name="pref_default_viewer_key">pref_default_viewer_key</string>
<string name="pref_hide_status_bar_key">pref_hide_status_bar_key</string> <string name="pref_hide_status_bar_key">pref_hide_status_bar_key</string>
<string name="pref_lock_orientation_key">pref_lock_orientation_key</string> <string name="pref_lock_orientation_key">pref_lock_orientation_key</string>
<string name="pref_default_viewer_key">pref_default_viewer_key</string> <string name="pref_enable_transitions_key">pref_enable_transitions_key</string>
<string name="pref_show_page_number_key">pref_show_page_number_key</string>
<string name="pref_keep_screen_on_key">pref_keep_screen_on_key</string>
<string name="pref_download_directory_key">pref_download_directory_key</string> <string name="pref_download_directory_key">pref_download_directory_key</string>
<string name="pref_download_threads_key">pref_download_threads_key</string> <string name="pref_download_threads_key">pref_download_threads_key</string>
</resources> </resources>

View File

@ -34,6 +34,9 @@
<string name="right_to_left_viewer">Right to left</string> <string name="right_to_left_viewer">Right to left</string>
<string name="vertical_viewer">Vertical</string> <string name="vertical_viewer">Vertical</string>
<string name="webtoon_viewer">Webtoon (experimental)</string> <string name="webtoon_viewer">Webtoon (experimental)</string>
<string name="pref_lock_orientation">Lock orientation</string>
<string name="pref_enable_transitions">Enable transitions</string>
<string name="pref_show_page_number">Show page number</string>
<!-- Downloads section --> <!-- Downloads section -->
<string name="pref_download_directory">Downloads directory</string> <string name="pref_download_directory">Downloads directory</string>
@ -83,6 +86,5 @@
<string name="notification_completed">Update completed</string> <string name="notification_completed">Update completed</string>
<string name="notification_no_new_chapters">No new chapters found</string> <string name="notification_no_new_chapters">No new chapters found</string>
<string name="notification_new_chapters">Found new chapters for:</string> <string name="notification_new_chapters">Found new chapters for:</string>
<string name="pref_lock_orientation">Lock orientation</string>
</resources> </resources>

View File

@ -99,4 +99,11 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
<item name="android:textIsSelectable">false</item> <item name="android:textIsSelectable">false</item>
</style> </style>
<style name="reader_settings_popup_animation">
<item name="android:windowEnterAnimation">@anim/enter_from_right</item>
<item name="android:windowExitAnimation">@anim/exit_to_right</item>
</style>
<style name="grey_text">
<item name="android:textColor">#e0e0e0</item>
</style>
</resources> </resources>

View File

@ -9,6 +9,14 @@
android:key="@string/pref_lock_orientation_key" android:key="@string/pref_lock_orientation_key"
android:defaultValue="true" /> android:defaultValue="true" />
<CheckBoxPreference android:title="@string/pref_enable_transitions"
android:key="@string/pref_enable_transitions_key"
android:defaultValue="true" />
<CheckBoxPreference android:title="@string/pref_show_page_number"
android:key="@string/pref_show_page_number_key"
android:defaultValue="true" />
<ListPreference android:title="@string/pref_viewer_type" <ListPreference android:title="@string/pref_viewer_type"
android:key="@string/pref_default_viewer_key" android:key="@string/pref_default_viewer_key"
android:entries="@array/viewers" android:entries="@array/viewers"