New reader menu (#368)

This commit is contained in:
inorichi 2016-06-27 16:46:31 +02:00 committed by GitHub
parent fe6dff9086
commit 05c0516a57
22 changed files with 585 additions and 538 deletions

View File

@ -155,12 +155,14 @@ dependencies {
compile 'ch.acra:acra:4.8.5' compile 'ch.acra:acra:4.8.5'
// UI // UI
compile 'com.dmitrymalkovich.android:material-design-dimens:1.2'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4' compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'eu.davidea:flexible-adapter:4.2.0' compile 'eu.davidea:flexible-adapter:4.2.0'
compile 'com.nononsenseapps:filepicker:2.5.2' compile 'com.nononsenseapps:filepicker:2.5.2'
compile 'com.github.amulyakhare:TextDrawable:558677e' compile 'com.github.amulyakhare:TextDrawable:558677e'
compile 'com.afollestad.material-dialogs:core:0.8.5.9' compile 'com.afollestad.material-dialogs:core:0.8.5.9'
compile 'net.xpece.android:support-preference:0.8.1' compile 'net.xpece.android:support-preference:0.8.1'
compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
// Tests // Tests
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
@ -183,4 +185,5 @@ buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
} }

View File

@ -18,7 +18,7 @@ class PreferenceKeys(context: Context) {
val showPageNumber = context.getString(R.string.pref_show_page_number_key) val showPageNumber = context.getString(R.string.pref_show_page_number_key)
val hideStatusBar = context.getString(R.string.pref_hide_status_bar_key) val fullscreen = context.getString(R.string.pref_fullscreen_key)
val keepScreenOn = context.getString(R.string.pref_keep_screen_on_key) val keepScreenOn = context.getString(R.string.pref_keep_screen_on_key)

View File

@ -42,7 +42,7 @@ class PreferencesHelper(context: Context) {
fun showPageNumber() = rxPrefs.getBoolean(keys.showPageNumber, true) fun showPageNumber() = rxPrefs.getBoolean(keys.showPageNumber, true)
fun hideStatusBar() = rxPrefs.getBoolean(keys.hideStatusBar, true) fun fullscreen() = rxPrefs.getBoolean(keys.fullscreen, true)
fun keepScreenOn() = rxPrefs.getBoolean(keys.keepScreenOn, true) fun keepScreenOn() = rxPrefs.getBoolean(keys.keepScreenOn, true)

View File

@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.source.model
import eu.kanade.tachiyomi.data.network.ProgressListener import eu.kanade.tachiyomi.data.network.ProgressListener
import eu.kanade.tachiyomi.ui.reader.ReaderChapter import eu.kanade.tachiyomi.ui.reader.ReaderChapter
import rx.subjects.PublishSubject import rx.subjects.Subject
class Page( class Page(
val pageNumber: Int, val pageNumber: Int,
@ -21,13 +21,13 @@ class Page(
@Transient @Volatile var progress: Int = 0 @Transient @Volatile var progress: Int = 0
@Transient private var statusSubject: PublishSubject<Int>? = null @Transient private var statusSubject: Subject<Int, Int>? = null
override fun update(bytesRead: Long, contentLength: Long, done: Boolean) { override fun update(bytesRead: Long, contentLength: Long, done: Boolean) {
progress = (100 * bytesRead / contentLength).toInt() progress = (100 * bytesRead / contentLength).toInt()
} }
fun setStatusSubject(subject: PublishSubject<Int>?) { fun setStatusSubject(subject: Subject<Int, Int>?) {
this.statusSubject = subject this.statusSubject = subject
} }

View File

@ -1,16 +1,16 @@
package eu.kanade.tachiyomi.ui.reader package eu.kanade.tachiyomi.ui.reader
import android.app.Dialog
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Color import android.graphics.Color
import android.os.Build import android.os.Build
import android.os.Build.VERSION_CODES.KITKAT
import android.os.Bundle import android.os.Bundle
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.view.* import android.view.*
import android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE import android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import android.widget.SeekBar import android.widget.SeekBar
@ -33,11 +33,13 @@ import eu.kanade.tachiyomi.util.toast
import eu.kanade.tachiyomi.widget.SimpleAnimationListener import eu.kanade.tachiyomi.widget.SimpleAnimationListener
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
import kotlinx.android.synthetic.main.activity_reader.* import kotlinx.android.synthetic.main.activity_reader.*
import kotlinx.android.synthetic.main.reader_menu.* import me.zhanghai.android.systemuihelper.SystemUiHelper
import me.zhanghai.android.systemuihelper.SystemUiHelper.*
import nucleus.factory.RequiresPresenter import nucleus.factory.RequiresPresenter
import rx.Subscription import rx.Subscription
import rx.subscriptions.CompositeSubscription import rx.subscriptions.CompositeSubscription
import timber.log.Timber import timber.log.Timber
import uy.kohesive.injekt.injectLazy
import java.text.DecimalFormat import java.text.DecimalFormat
@RequiresPresenter(ReaderPresenter::class) @RequiresPresenter(ReaderPresenter::class)
@ -62,8 +64,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
private var viewer: BaseReader? = null private var viewer: BaseReader? = null
private var uiFlags: Int = 0
lateinit var subscriptions: CompositeSubscription lateinit var subscriptions: CompositeSubscription
private set private set
@ -77,16 +77,13 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
private val decimalFormat = DecimalFormat("#.###") private val decimalFormat = DecimalFormat("#.###")
private var popupMenu: ReaderPopupMenu? = null
private var nextChapterBtn: MenuItem? = null
private var prevChapterBtn: MenuItem? = null
private val volumeKeysEnabled by lazy { preferences.readWithVolumeKeys().getOrDefault() } private val volumeKeysEnabled by lazy { preferences.readWithVolumeKeys().getOrDefault() }
val preferences: PreferencesHelper val preferences by injectLazy<PreferencesHelper>()
get() = presenter.prefs
private var systemUi: SystemUiHelper? = null
private var menuVisible = false
override fun onCreate(savedState: Bundle?) { override fun onCreate(savedState: Bundle?) {
super.onCreate(savedState) super.onCreate(savedState)
@ -100,47 +97,56 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
setupToolbar(toolbar) setupToolbar(toolbar)
subscriptions = CompositeSubscription() subscriptions = CompositeSubscription()
initializeMenu()
initializeSettings() initializeSettings()
initializeBottomMenu()
if (savedState != null) { if (savedState != null) {
setMenuVisibility(savedState.getBoolean(MENU_VISIBLE), animate = false) menuVisible = savedState.getBoolean(MENU_VISIBLE)
} }
maxBitmapSize = GLUtil.getMaxTextureSize() setMenuVisibility(menuVisible)
}
override fun onResume() { maxBitmapSize = GLUtil.getMaxTextureSize()
super.onResume()
setSystemUiVisibility() left_chapter.setOnClickListener {
if (viewer != null) {
if (viewer is RightToLeftReader)
requestNextChapter()
else
requestPreviousChapter()
}
}
right_chapter.setOnClickListener {
if (viewer != null) {
if (viewer is RightToLeftReader)
requestPreviousChapter()
else
requestNextChapter()
}
}
} }
override fun onDestroy() { override fun onDestroy() {
subscriptions.unsubscribe() subscriptions.unsubscribe()
popupMenu?.dismiss()
viewer = null viewer = null
super.onDestroy() super.onDestroy()
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.reader, menu) menuInflater.inflate(R.menu.reader, menu)
nextChapterBtn = menu.findItem(R.id.action_next_chapter)
prevChapterBtn = menu.findItem(R.id.action_previous_chapter)
setAdjacentChaptersVisibility()
return true return true
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.action_previous_chapter -> requestPreviousChapter() R.id.action_settings -> ReaderSettingsDialog().show(supportFragmentManager, "settings")
R.id.action_next_chapter -> requestNextChapter()
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
} }
return true return true
} }
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
outState.putBoolean(MENU_VISIBLE, reader_menu.visibility == View.VISIBLE) outState.putBoolean(MENU_VISIBLE, menuVisible)
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
} }
@ -148,7 +154,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
val chapterToUpdate = presenter.getMangaSyncChapterToUpdate() val chapterToUpdate = presenter.getMangaSyncChapterToUpdate()
if (chapterToUpdate > 0) { if (chapterToUpdate > 0) {
if (presenter.prefs.askUpdateMangaSync()) { if (preferences.askUpdateMangaSync()) {
MaterialDialog.Builder(this) MaterialDialog.Builder(this)
.content(getString(R.string.confirm_update_manga_sync, chapterToUpdate)) .content(getString(R.string.confirm_update_manga_sync, chapterToUpdate))
.positiveText(android.R.string.yes) .positiveText(android.R.string.yes)
@ -165,13 +171,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
} }
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
setSystemUiVisibility()
}
}
override fun dispatchKeyEvent(event: KeyEvent): Boolean { override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (!isFinishing) { if (!isFinishing) {
when (event.keyCode) { when (event.keyCode) {
@ -270,16 +269,19 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
viewer?.onPageListAppendReady(chapter) viewer?.onPageListAppendReady(chapter)
} }
@Suppress("UNUSED_PARAMETER")
fun onAdjacentChapters(previous: Chapter?, next: Chapter?) { fun onAdjacentChapters(previous: Chapter?, next: Chapter?) {
setAdjacentChaptersVisibility() val isInverted = viewer is RightToLeftReader
}
private fun setAdjacentChaptersVisibility() { // Chapters are inverted for the right to left reader
prevChapterBtn?.isVisible = presenter.hasPreviousChapter() val hasRightChapter = (if (isInverted) previous else next) != null
nextChapterBtn?.isVisible = presenter.hasNextChapter() val hasLeftChapter = (if (isInverted) next else previous) != null
}
right_chapter.isEnabled = hasRightChapter
right_chapter.alpha = if (hasRightChapter) 1f else 0.4f
left_chapter.isEnabled = hasLeftChapter
left_chapter.alpha = if (hasLeftChapter) 1f else 0.4f
}
private fun getOrCreateViewer(manga: Manga): BaseReader { private fun getOrCreateViewer(manga: Manga): BaseReader {
val mangaViewer = if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer val mangaViewer = if (manga.viewer == 0) preferences.defaultViewer() else manga.viewer
@ -323,7 +325,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
fun toggleMenu() { fun toggleMenu() {
setMenuVisibility(reader_menu.visibility == View.GONE) setMenuVisibility(!menuVisible)
} }
fun requestNextChapter() { fun requestNextChapter() {
@ -338,34 +340,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
} }
private fun setMenuVisibility(visible: Boolean, animate: Boolean = true) { private fun initializeBottomMenu() {
if (visible) {
reader_menu.visibility = View.VISIBLE
if (animate) {
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
toolbar.startAnimation(toolbarAnimation)
val bottomMenuAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_bottom)
reader_menu_bottom.startAnimation(bottomMenuAnimation)
}
} else {
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top)
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationEnd(animation: Animation) {
reader_menu.visibility = View.GONE
}
})
toolbar.startAnimation(toolbarAnimation)
val bottomMenuAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_bottom)
reader_menu_bottom.startAnimation(bottomMenuAnimation)
popupMenu?.dismiss()
}
}
private fun initializeMenu() {
// Intercept all events in this layout // Intercept all events in this layout
reader_menu_bottom.setOnTouchListener { v, event -> true } reader_menu_bottom.setOnTouchListener { v, event -> true }
@ -376,94 +351,17 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
} }
}) })
lock_orientation.setOnClickListener { v ->
showImmersiveDialog(MaterialDialog.Builder(this)
.title(R.string.pref_rotation_type)
.items(R.array.rotation_type)
.itemsCallbackSingleChoice(preferences.rotation().getOrDefault() - 1,
{ d, itemView, which, text ->
preferences.rotation().set(which + 1)
true
})
.build())
}
reader_zoom_selector.setOnClickListener { v ->
showImmersiveDialog(MaterialDialog.Builder(this)
.title(R.string.pref_zoom_start)
.items(R.array.zoom_start)
.itemsCallbackSingleChoice(preferences.zoomStart().getOrDefault() - 1,
{ d, itemView, which, text ->
preferences.zoomStart().set(which + 1)
true
})
.build())
}
reader_scale_type_selector.setOnClickListener { v ->
showImmersiveDialog(MaterialDialog.Builder(this)
.title(R.string.pref_image_scale_type)
.items(R.array.image_scale_type)
.itemsCallbackSingleChoice(preferences.imageScaleType().getOrDefault() - 1,
{ d, itemView, which, text ->
preferences.imageScaleType().set(which + 1)
true
})
.build())
}
reader_selector.setOnClickListener { v ->
showImmersiveDialog(MaterialDialog.Builder(this)
.title(R.string.pref_viewer_type)
.items(R.array.viewers_selector)
.itemsCallbackSingleChoice(presenter.manga.viewer,
{ d, itemView, which, text ->
presenter.updateMangaViewer(which)
recreate()
true
})
.build())
}
val popupView = layoutInflater.inflate(R.layout.reader_popup, null)
popupMenu = ReaderPopupMenu(this, popupView)
reader_extra_settings.setOnClickListener {
popupMenu?.let {
if (!it.isShowing)
it.showAtLocation(reader_extra_settings,
Gravity.BOTTOM or Gravity.RIGHT, 0, reader_menu_bottom.height)
else
it.dismiss()
}
}
} }
private fun initializeSettings() { private fun initializeSettings() {
subscriptions += preferences.rotation().asObservable()
.subscribe { setRotation(it) }
subscriptions += preferences.showPageNumber().asObservable() subscriptions += preferences.showPageNumber().asObservable()
.subscribe { setPageNumberVisibility(it) } .subscribe { setPageNumberVisibility(it) }
subscriptions += preferences.rotation().asObservable() subscriptions += preferences.fullscreen().asObservable()
.subscribe { .subscribe { setFullscreen(it) }
setRotation(it)
val isPortrait = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
val resourceId = if (it == 1)
R.drawable.ic_screen_rotation_white_24dp
else if (isPortrait)
R.drawable.ic_screen_lock_portrait_white_24dp
else
R.drawable.ic_screen_lock_landscape_white_24dp
lock_orientation.setImageResource(resourceId)
}
subscriptions += preferences.hideStatusBar().asObservable()
.subscribe { setStatusBarVisibility(it) }
subscriptions += preferences.keepScreenOn().asObservable() subscriptions += preferences.keepScreenOn().asObservable()
.subscribe { setKeepScreenOn(it) } .subscribe { setKeepScreenOn(it) }
@ -496,6 +394,16 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
page_number.visibility = if (visible) View.VISIBLE else View.INVISIBLE page_number.visibility = if (visible) View.VISIBLE else View.INVISIBLE
} }
private fun setFullscreen(enabled: Boolean) {
systemUi = if (enabled) {
val level = if (Build.VERSION.SDK_INT >= KITKAT) LEVEL_IMMERSIVE else LEVEL_HIDE_STATUS_BAR
val flags = FLAG_IMMERSIVE_STICKY or FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
SystemUiHelper(this, level, flags)
} else {
null
}
}
private fun setKeepScreenOn(enabled: Boolean) { private fun setKeepScreenOn(enabled: Boolean) {
if (enabled) { if (enabled) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@ -523,29 +431,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
window.attributes = window.attributes.apply { screenBrightness = value } window.attributes = window.attributes.apply { screenBrightness = value }
} }
private fun setStatusBarVisibility(hidden: Boolean) {
createUiHideFlags(hidden)
setSystemUiVisibility()
}
private fun createUiHideFlags(statusBarHidden: Boolean) {
uiFlags = 0
uiFlags = uiFlags or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
if (statusBarHidden) {
uiFlags = uiFlags or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_FULLSCREEN
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
uiFlags = uiFlags or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
}
}
fun setSystemUiVisibility() {
window.decorView.systemUiVisibility = uiFlags
}
private fun applyTheme(theme: Int) { private fun applyTheme(theme: Int) {
readerTheme = theme readerTheme = theme
val rootView = window.decorView.rootView val rootView = window.decorView.rootView
@ -560,12 +445,38 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
} }
private fun showImmersiveDialog(dialog: Dialog) { private fun setMenuVisibility(visible: Boolean) {
// Hack to not leave immersive mode menuVisible = visible
dialog.window.setFlags(FLAG_NOT_FOCUSABLE, FLAG_NOT_FOCUSABLE) if (visible) {
dialog.show() systemUi?.show()
dialog.window.decorView.systemUiVisibility = window.decorView.systemUiVisibility reader_menu.visibility = View.VISIBLE
dialog.window.clearFlags(FLAG_NOT_FOCUSABLE)
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationStart(animation: Animation) {
// Fix status bar being translucent the first time it's opened.
if (Build.VERSION.SDK_INT >= 21) {
window.addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
}
})
toolbar.startAnimation(toolbarAnimation)
val bottomMenuAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_bottom)
reader_menu_bottom.startAnimation(bottomMenuAnimation)
} else {
systemUi?.hide()
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top)
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
override fun onAnimationEnd(animation: Animation) {
reader_menu.visibility = View.GONE
}
})
toolbar.startAnimation(toolbarAnimation)
val bottomMenuAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_bottom)
reader_menu_bottom.startAnimation(bottomMenuAnimation)
}
} }
} }

View File

@ -1,108 +0,0 @@
package eu.kanade.tachiyomi.ui.reader
import android.app.Dialog
import android.view.View
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
import android.widget.PopupWindow
import android.widget.SeekBar
import com.afollestad.materialdialogs.MaterialDialog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
import kotlinx.android.synthetic.main.reader_popup.view.*
import java.lang.ref.WeakReference
class ReaderPopupMenu(activity: ReaderActivity, val view: View) : PopupWindow(view, WRAP_CONTENT, WRAP_CONTENT) {
val activity = WeakReference(activity)
init {
animationStyle = R.style.reader_settings_popup_animation
setValues(activity.preferences)
}
private fun setValues(preferences: PreferencesHelper) = with(view) {
enable_transitions.isChecked = preferences.enableTransitions().getOrDefault()
show_page_number.isChecked = preferences.showPageNumber().getOrDefault()
hide_status_bar.isChecked = preferences.hideStatusBar().getOrDefault()
keep_screen_on.isChecked = preferences.keepScreenOn().getOrDefault()
reader_theme.isChecked = preferences.readerTheme().getOrDefault() == 1
setDecoderInitial(preferences.imageDecoder().getOrDefault())
// Add a listener to change the corresponding setting
enable_transitions.setOnCheckedChangeListener { v, isChecked ->
preferences.enableTransitions().set(isChecked)
}
show_page_number.setOnCheckedChangeListener { v, isChecked ->
preferences.showPageNumber().set(isChecked)
}
hide_status_bar.setOnCheckedChangeListener { v, isChecked ->
preferences.hideStatusBar().set(isChecked)
}
keep_screen_on.setOnCheckedChangeListener { v, isChecked ->
preferences.keepScreenOn().set(isChecked)
}
reader_theme.setOnCheckedChangeListener { v, isChecked ->
preferences.readerTheme().set(if (isChecked) 1 else 0)
}
image_decoder_container.setOnClickListener { v ->
showImmersiveDialog(MaterialDialog.Builder(view.context)
.title(R.string.pref_image_decoder)
.items(R.array.image_decoders)
.itemsCallbackSingleChoice(preferences.imageDecoder().getOrDefault(), { dialog, itemView, which, text ->
preferences.imageDecoder().set(which)
setDecoderInitial(which)
true
})
.build())
}
activity.get().subscriptions.add(preferences.customBrightness().asObservable()
.subscribe { isEnabled ->
custom_brightness.isChecked = isEnabled
brightness_seekbar.isEnabled = isEnabled
})
custom_brightness.setOnCheckedChangeListener { v, isChecked ->
preferences.customBrightness().set(isChecked)
}
brightness_seekbar.max = 100
brightness_seekbar.progress = Math.round(
preferences.customBrightnessValue().getOrDefault() * brightness_seekbar.max)
brightness_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
preferences.customBrightnessValue().set(progress.toFloat() / seekBar.max)
}
}
})
}
private fun setDecoderInitial(decoder: Int) {
val initial: String
when (decoder) {
0 -> initial = "R"
1 -> initial = "S"
else -> initial = ""
}
view.image_decoder_initial.text = initial
}
private fun showImmersiveDialog(dialog: Dialog) {
// Hack to not leave immersive mode
dialog.window.setFlags(FLAG_NOT_FOCUSABLE, FLAG_NOT_FOCUSABLE)
dialog.show()
dialog.window.decorView.systemUiVisibility = activity.get().window.decorView.systemUiVisibility
dialog.window.clearFlags(FLAG_NOT_FOCUSABLE)
}
}

View File

@ -0,0 +1,129 @@
package eu.kanade.tachiyomi.ui.reader
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import android.view.View
import android.widget.SeekBar
import com.afollestad.materialdialogs.MaterialDialog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.util.plusAssign
import eu.kanade.tachiyomi.widget.SimpleItemSelectedListener
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
import kotlinx.android.synthetic.main.dialog_reader_settings.view.*
import rx.Observable
import rx.android.schedulers.AndroidSchedulers
import rx.subscriptions.CompositeSubscription
import uy.kohesive.injekt.injectLazy
import java.util.concurrent.TimeUnit.MILLISECONDS
class ReaderSettingsDialog : DialogFragment() {
private val preferences by injectLazy<PreferencesHelper>()
private lateinit var subscriptions: CompositeSubscription
override fun onCreateDialog(savedState: Bundle?): Dialog {
val dialog = MaterialDialog.Builder(activity)
.title(R.string.label_settings)
.customView(R.layout.dialog_reader_settings, true)
.positiveText(android.R.string.ok)
.build()
subscriptions = CompositeSubscription()
onViewCreated(dialog.view, savedState)
return dialog
}
override fun onViewCreated(view: View, savedState: Bundle?) = with(view) {
viewer.setSelection((activity as ReaderActivity).presenter.manga.viewer, false)
viewer.onItemSelectedListener = SimpleItemSelectedListener { position ->
subscriptions += Observable.timer(250, MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
(activity as ReaderActivity).presenter.updateMangaViewer(position)
activity.recreate()
}
}
rotation_mode.setSelection(preferences.rotation().getOrDefault() - 1, false)
rotation_mode.onItemSelectedListener = SimpleItemSelectedListener { position ->
subscriptions += Observable.timer(250, MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
preferences.rotation().set(position + 1)
}
}
scale_type.setSelection(preferences.imageScaleType().getOrDefault() - 1, false)
scale_type.onItemSelectedListener = SimpleItemSelectedListener { position ->
preferences.imageScaleType().set(position + 1)
}
zoom_start.setSelection(preferences.zoomStart().getOrDefault() - 1, false)
zoom_start.onItemSelectedListener = SimpleItemSelectedListener { position ->
preferences.zoomStart().set(position + 1)
}
image_decoder.setSelection(preferences.imageDecoder().getOrDefault(), false)
image_decoder.onItemSelectedListener = SimpleItemSelectedListener { position ->
preferences.imageDecoder().set(position)
}
background_color.setSelection(preferences.readerTheme().getOrDefault(), false)
background_color.onItemSelectedListener = SimpleItemSelectedListener { position ->
preferences.readerTheme().set(position)
}
enable_transitions.isChecked = preferences.enableTransitions().getOrDefault()
enable_transitions.setOnCheckedChangeListener { v, isChecked ->
preferences.enableTransitions().set(isChecked)
}
show_page_number.isChecked = preferences.showPageNumber().getOrDefault()
show_page_number.setOnCheckedChangeListener { v, isChecked ->
preferences.showPageNumber().set(isChecked)
}
fullscreen.isChecked = preferences.fullscreen().getOrDefault()
fullscreen.setOnCheckedChangeListener { v, isChecked ->
preferences.fullscreen().set(isChecked)
}
keep_screen_on.isChecked = preferences.keepScreenOn().getOrDefault()
keep_screen_on.setOnCheckedChangeListener { v, isChecked ->
preferences.keepScreenOn().set(isChecked)
}
subscriptions += preferences.customBrightness().asObservable()
.subscribe { isEnabled ->
custom_brightness.isChecked = isEnabled
brightness_seekbar.isEnabled = isEnabled
}
custom_brightness.setOnCheckedChangeListener { v, isChecked ->
preferences.customBrightness().set(isChecked)
}
brightness_seekbar.max = 100
brightness_seekbar.progress = Math.round(
preferences.customBrightnessValue().getOrDefault() * brightness_seekbar.max)
brightness_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
preferences.customBrightnessValue().set(progress.toFloat() / seekBar.max)
}
}
})
}
override fun onDestroyView() {
subscriptions.unsubscribe()
super.onDestroyView()
}
}

View File

@ -23,6 +23,7 @@ import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers import rx.schedulers.Schedulers
import rx.subjects.PublishSubject import rx.subjects.PublishSubject
import rx.subjects.SerializedSubject
import java.io.File import java.io.File
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
@ -150,7 +151,7 @@ class PagerReaderFragment : BaseFragment() {
*/ */
private fun observeStatus() { private fun observeStatus() {
page?.let { page -> page?.let { page ->
val statusSubject = PublishSubject.create<Int>() val statusSubject = SerializedSubject(PublishSubject.create<Int>())
page.setStatusSubject(statusSubject) page.setStatusSubject(statusSubject)
statusSubscription?.unsubscribe() statusSubscription?.unsubscribe()

View File

@ -14,6 +14,7 @@ import kotlinx.android.synthetic.main.item_webtoon_reader.view.*
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import rx.subjects.PublishSubject import rx.subjects.PublishSubject
import rx.subjects.SerializedSubject
import java.io.File import java.io.File
/** /**
@ -56,7 +57,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() { setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
override fun onImageLoaded() { override fun onImageLoaded() {
// When the image is loaded, reset the minimum height to avoid gaps // When the image is loaded, reset the minimum height to avoid gaps
view.frame_container.minimumHeight = 0 view.frame_container.minimumHeight = 30
} }
override fun onImageLoadError(e: Exception) { override fun onImageLoadError(e: Exception) {
@ -106,7 +107,7 @@ class WebtoonHolder(private val view: View, private val adapter: WebtoonAdapter)
*/ */
private fun observeStatus() { private fun observeStatus() {
page?.let { page -> page?.let { page ->
val statusSubject = PublishSubject.create<Int>() val statusSubject = SerializedSubject(PublishSubject.create<Int>())
page.setStatusSubject(statusSubject) page.setStatusSubject(statusSubject)
statusSubscription?.unsubscribe() statusSubscription?.unsubscribe()

View File

@ -0,0 +1,16 @@
package eu.kanade.tachiyomi.widget
import android.view.View
import android.widget.AdapterView
import android.widget.AdapterView.OnItemSelectedListener
class SimpleItemSelectedListener(private val callback: (Int) -> Unit): OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
}
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
callback(position)
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:height="@dimen/material_layout_keylines_horizontal_mobile_margin"
android:width="0dp"/>
<solid
android:color="@android:color/transparent"/>
</shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
</vector>

View File

@ -1,30 +1,102 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" android:layout_width="match_parent"
android:gravity="center"> android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center">
<FrameLayout <FrameLayout
android:id="@+id/reader" android:id="@+id/reader_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<FrameLayout
android:id="@+id/reader"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<ProgressBar
android:id="@+id/please_wait"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<TextView
android:id="@+id/page_number"
style="@style/TextAppearance.Regular.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:background="?android:attr/colorBackground"
android:padding="4dp"/>
</FrameLayout> </FrameLayout>
<ProgressBar <FrameLayout
android:id="@+id/please_wait" android:id="@+id/reader_menu"
style="?android:attr/progressBarStyleLarge" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="wrap_content" android:fitsSystemWindows="true"
android:layout_gravity="center"/> android:visibility="invisible"
tools:visibility="visible">
<TextView <android.support.v7.widget.Toolbar
android:id="@+id/page_number" android:id="@+id/toolbar"
style="@style/TextAppearance.Regular.Caption" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content" android:background="?colorPrimary"
android:layout_gravity="bottom|start" android:elevation="4dp"
android:background="?android:attr/colorBackground" android:theme="?attr/actionBarTheme"/>
android:padding="4dp"/>
<include layout="@layout/reader_menu"/> <LinearLayout
android:id="@+id/reader_menu_bottom"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
android:gravity="center"
android:background="?colorPrimary"
android:orientation="horizontal">
<ImageButton
android:id="@+id/left_chapter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_skip_previous_white_24dp"/>
<TextView
android:id="@+id/left_page_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"/>
<SeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:id="@+id/right_page_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"/>
<ImageButton
android:id="@+id/right_chapter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_skip_next_white_24dp"/>
</LinearLayout>
</FrameLayout>
</FrameLayout> </FrameLayout>

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/material_component_dialogs_padding_around_content_area"
android:divider="@drawable/empty_divider"
android:showDividers="middle">
<!-- Viewer for this series -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/viewer_for_this_series" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/viewer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/viewers_selector">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<!-- Rotation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/pref_rotation_type" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/rotation_mode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/rotation_type">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<!-- Scale type -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/pref_image_scale_type" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/scale_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/image_scale_type">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<!-- Zoom start position -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/pref_zoom_start" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/zoom_start"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/zoom_start">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<!-- Image decoder -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/pref_image_decoder" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/image_decoder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/image_decoders">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<!-- Background color -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/pref_reader_theme" />
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/background_color"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:entries="@array/reader_themes">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
<android.support.v7.widget.SwitchCompat
android:id="@+id/enable_transitions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_enable_transitions"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_page_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_show_page_number"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/fullscreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_fullscreen"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/keep_screen_on"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_keep_screen_on"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/custom_brightness"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_custom_brightness"/>
<SeekBar
android:id="@+id/brightness_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.Regular.Body1.Light"/>
</LinearLayout>

View File

@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/reader_menu"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?colorPrimary"
android:elevation="4dp"
android:theme="?attr/actionBarTheme"/>
<LinearLayout
android:id="@+id/reader_menu_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?colorPrimary"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<TextView
android:id="@+id/left_page_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="12dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="12dp"
android:gravity="center_horizontal"
android:textSize="15sp"/>
<SeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
/>
<TextView
android:id="@+id/right_page_text"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dp"
android:gravity="center_horizontal"
android:textSize="15sp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#777777"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/lock_orientation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_screen_rotation_white_24dp"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/reader_zoom_selector"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_crop_original_white_24dp"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/reader_scale_type_selector"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_zoom_out_map_white_24dp"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/reader_selector"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_view_carousel_white_24dp"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/reader_extra_settings"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?android:selectableItemBackground"
app:srcCompat="@drawable/ic_more_vert_white_24dp"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/colorPrimary"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:paddingTop="5dp">
<LinearLayout
android:id="@+id/image_decoder_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/image_decoder_initial"
android:layout_width="32dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="?colorAccent"
style="@style/TextAppearance.Regular.SubHeading"/>
<TextView
android:id="@+id/image_decoder"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_image_decoder"
style="@style/TextAppearance.Regular.Body1.Light"/>
</LinearLayout>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/reader_theme"
android:button="@drawable/reader_background_checkbox"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_reader_theme"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/enable_transitions"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_enable_transitions"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/show_page_number"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_show_page_number"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/hide_status_bar"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_hide_status_bar"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/keep_screen_on"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:gravity="center"
android:text="@string/pref_keep_screen_on"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/custom_brightness"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/pref_custom_brightness"/>
<SeekBar
android:id="@+id/brightness_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.Regular.Body1.Light"/>
</LinearLayout>

View File

@ -3,17 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/action_previous_chapter" android:id="@+id/action_settings"
android:title="@string/action_previous_chapter" android:title="@string/label_settings"
android:icon="@drawable/ic_skip_previous_white_24dp" android:icon="@drawable/ic_settings_white_24dp"
android:visible="false" app:showAsAction="always"
app:showAsAction="always" /> />
<item
android:id="@+id/action_next_chapter"
android:title="@string/action_next_chapter"
android:icon="@drawable/ic_skip_next_white_24dp"
android:visible="false"
app:showAsAction="always" />
</menu> </menu>

View File

@ -19,4 +19,14 @@
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item> <item name="android:navigationBarColor">@color/colorPrimaryDark</item>
</style> </style>
<!--==============-->
<!-- Reader Theme -->
<!--==============-->
<style name="Theme.Reader" parent="Theme.Base.Reader">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item>
</style>
</resources> </resources>

View File

@ -21,7 +21,7 @@
<string name="pref_default_viewer_key">pref_default_viewer_key</string> <string name="pref_default_viewer_key">pref_default_viewer_key</string>
<string name="pref_image_scale_type_key">pref_image_scale_type_key</string> <string name="pref_image_scale_type_key">pref_image_scale_type_key</string>
<string name="pref_zoom_start_key">pref_zoom_start_key</string> <string name="pref_zoom_start_key">pref_zoom_start_key</string>
<string name="pref_hide_status_bar_key">pref_hide_status_bar_key</string> <string name="pref_fullscreen_key">fullscreen</string>
<string name="pref_rotation_type_key">pref_rotation_type_key</string> <string name="pref_rotation_type_key">pref_rotation_type_key</string>
<string name="pref_enable_transitions_key">pref_enable_transitions_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_show_page_number_key">pref_show_page_number_key</string>

View File

@ -96,7 +96,7 @@
<string name="dark_theme">Dark theme</string> <string name="dark_theme">Dark theme</string>
<!-- Reader section --> <!-- Reader section -->
<string name="pref_hide_status_bar">Hide status bar</string> <string name="pref_fullscreen">Fullscreen</string>
<string name="pref_lock_orientation">Lock orientation</string> <string name="pref_lock_orientation">Lock orientation</string>
<string name="pref_enable_transitions">Enable transitions</string> <string name="pref_enable_transitions">Enable transitions</string>
<string name="pref_show_page_number">Show page number</string> <string name="pref_show_page_number">Show page number</string>
@ -264,6 +264,7 @@
<string name="no_previous_chapter">Previous chapter not found</string> <string name="no_previous_chapter">Previous chapter not found</string>
<string name="decode_image_error">Image could not be loaded.\nTry changing the image decoder or with one of the options below</string> <string name="decode_image_error">Image could not be loaded.\nTry changing the image decoder or with one of the options below</string>
<string name="confirm_update_manga_sync">Update last chapter read in enabled services to %1$d?</string> <string name="confirm_update_manga_sync">Update last chapter read in enabled services to %1$d?</string>
<string name="viewer_for_this_series">Viewer for this series</string>
<!-- Backup fragment --> <!-- Backup fragment -->
<string name="backup">Backup</string> <string name="backup">Backup</string>

View File

@ -83,10 +83,16 @@
<!--==============--> <!--==============-->
<!-- Reader Theme --> <!-- Reader Theme -->
<!--==============--> <!--==============-->
<style name="Theme.Reader" parent="Theme.Base.Dark"> <style name="Theme.Base.Reader" parent="Theme.Base.Dark">
<item name="colorPrimary">@color/md_blue_grey_900</item> <item name="colorPrimary">@color/md_blue_grey_900</item>
<item name="colorPrimaryDark">#171E22</item>
</style> </style>
<style name="Theme.Reader" parent="Theme.Base.Reader">
<!-- Attributes specific for SDK 16 to SDK 20 -->
</style>
<!--===============--> <!--===============-->
<!-- Launch Screen --> <!-- Launch Screen -->
<!--===============--> <!--===============-->

View File

@ -55,8 +55,8 @@
android:summary="%s" /> android:summary="%s" />
<SwitchPreference <SwitchPreference
android:title="@string/pref_hide_status_bar" android:title="@string/pref_fullscreen"
android:key="@string/pref_hide_status_bar_key" android:key="@string/pref_fullscreen_key"
android:defaultValue="true" /> android:defaultValue="true" />
<SwitchPreference <SwitchPreference