@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader
import android.annotation.SuppressLint
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.annotation.TargetApi
import android.app.ActionBar
import android.app.ProgressDialog
import android.app.ProgressDialog
import android.content.ClipData
import android.content.ClipData
import android.content.Context
import android.content.Context
@ -189,6 +190,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
readingModeToast ?. cancel ( )
readingModeToast ?. cancel ( )
progressDialog ?. dismiss ( )
progressDialog ?. dismiss ( )
progressDialog = null
progressDialog = null
listeners = mutableListOf ( )
}
}
/ * *
/ * *
@ -486,12 +488,23 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
)
)
}
}
private var listeners : MutableList < ActionBar . OnMenuVisibilityListener > = mutableListOf ( )
fun addOnMenuVisibilityListener ( listener : ActionBar . OnMenuVisibilityListener ) {
listeners . add ( listener )
}
fun removeOnMenuVisibilityListener ( listener : ActionBar . OnMenuVisibilityListener ) {
listeners . remove ( listener )
}
/ * *
/ * *
* Sets the visibility of the menu according to [ visible ] and with an optional parameter to
* Sets the visibility of the menu according to [ visible ] and with an optional parameter to
* [ animate ] the views .
* [ animate ] the views .
* /
* /
fun setMenuVisibility ( visible : Boolean , animate : Boolean = true ) {
fun setMenuVisibility ( visible : Boolean , animate : Boolean = true ) {
menuVisible = visible
menuVisible = visible
listeners . forEach { listener -> listener . onMenuVisibilityChanged ( visible ) }
if ( visible ) {
if ( visible ) {
windowInsetsController . show ( WindowInsetsCompat . Type . systemBars ( ) )
windowInsetsController . show ( WindowInsetsCompat . Type . systemBars ( ) )
binding . readerMenu . isVisible = true
binding . readerMenu . isVisible = true
@ -737,6 +750,15 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
}
}
}
}
/ * *
* Called from the viewer to hide the menu .
* /
fun hideMenu ( ) {
if ( menuVisible ) {
setMenuVisibility ( false )
}
}
/ * *
/ * *
* Called from the page sheet . It delegates the call to the presenter to do some IO , which
* Called from the page sheet . It delegates the call to the presenter to do some IO , which
* will call [ onShareImageResult ] with the path the image was saved on when it ' s ready .
* will call [ onShareImageResult ] with the path the image was saved on when it ' s ready .