More consistent usage of visibility extensions
This commit is contained in:
parent
e195257d2a
commit
d5ff5fd6f8
13 changed files with 57 additions and 41 deletions
|
@ -9,6 +9,8 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||||
import eu.davidea.flexibleadapter.items.IFlexible
|
import eu.davidea.flexibleadapter.items.IFlexible
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder
|
import eu.davidea.viewholders.FlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
|
|
||||||
class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
|
class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
|
||||||
|
|
||||||
|
@ -23,17 +25,17 @@ class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: Holder, position: Int, payloads: List<Any?>) {
|
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: Holder, position: Int, payloads: List<Any?>) {
|
||||||
holder.progressBar.visibility = View.GONE
|
holder.progressBar.gone()
|
||||||
holder.progressMessage.visibility = View.GONE
|
holder.progressMessage.gone()
|
||||||
|
|
||||||
if (!adapter.isEndlessScrollEnabled) {
|
if (!adapter.isEndlessScrollEnabled) {
|
||||||
loadMore = false
|
loadMore = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadMore) {
|
if (loadMore) {
|
||||||
holder.progressBar.visibility = View.VISIBLE
|
holder.progressBar.visible()
|
||||||
} else {
|
} else {
|
||||||
holder.progressMessage.visibility = View.VISIBLE
|
holder.progressMessage.visible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import kotlinx.android.synthetic.main.extension_detail_controller.extension_icon
|
import kotlinx.android.synthetic.main.extension_detail_controller.extension_icon
|
||||||
import kotlinx.android.synthetic.main.extension_detail_controller.extension_lang
|
import kotlinx.android.synthetic.main.extension_detail_controller.extension_lang
|
||||||
import kotlinx.android.synthetic.main.extension_detail_controller.extension_obsolete
|
import kotlinx.android.synthetic.main.extension_detail_controller.extension_obsolete
|
||||||
|
@ -86,7 +87,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension.isObsolete) {
|
if (extension.isObsolete) {
|
||||||
extension_obsolete.visibility = View.VISIBLE
|
extension_obsolete.visible()
|
||||||
}
|
}
|
||||||
|
|
||||||
val themedContext by lazy { getPreferenceThemeContext() }
|
val themedContext by lazy { getPreferenceThemeContext() }
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.source.LocalSource
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
|
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||||
import kotlinx.android.synthetic.main.catalogue_grid_item.download_text
|
import kotlinx.android.synthetic.main.catalogue_grid_item.download_text
|
||||||
import kotlinx.android.synthetic.main.catalogue_grid_item.local_text
|
import kotlinx.android.synthetic.main.catalogue_grid_item.local_text
|
||||||
import kotlinx.android.synthetic.main.catalogue_grid_item.thumbnail
|
import kotlinx.android.synthetic.main.catalogue_grid_item.thumbnail
|
||||||
|
@ -37,16 +38,16 @@ class LibraryGridHolder(
|
||||||
|
|
||||||
// Update the unread count and its visibility.
|
// Update the unread count and its visibility.
|
||||||
with(unread_text) {
|
with(unread_text) {
|
||||||
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
|
visibleIf { item.manga.unread > 0 }
|
||||||
text = item.manga.unread.toString()
|
text = item.manga.unread.toString()
|
||||||
}
|
}
|
||||||
// Update the download count and its visibility.
|
// Update the download count and its visibility.
|
||||||
with(download_text) {
|
with(download_text) {
|
||||||
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
|
visibleIf { item.downloadCount > 0 }
|
||||||
text = item.downloadCount.toString()
|
text = item.downloadCount.toString()
|
||||||
}
|
}
|
||||||
// set local visibility if its local manga
|
// set local visibility if its local manga
|
||||||
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
local_text.visibleIf { item.manga.source == LocalSource.ID }
|
||||||
|
|
||||||
// Update the cover.
|
// Update the cover.
|
||||||
GlideApp.with(view.context).clear(thumbnail)
|
GlideApp.with(view.context).clear(thumbnail)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||||
import eu.kanade.tachiyomi.source.LocalSource
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
|
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||||
import kotlinx.android.synthetic.main.catalogue_list_item.download_text
|
import kotlinx.android.synthetic.main.catalogue_list_item.download_text
|
||||||
import kotlinx.android.synthetic.main.catalogue_list_item.local_text
|
import kotlinx.android.synthetic.main.catalogue_list_item.local_text
|
||||||
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
|
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
|
||||||
|
@ -38,16 +39,16 @@ class LibraryListHolder(
|
||||||
|
|
||||||
// Update the unread count and its visibility.
|
// Update the unread count and its visibility.
|
||||||
with(unread_text) {
|
with(unread_text) {
|
||||||
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
|
visibleIf { item.manga.unread > 0 }
|
||||||
text = item.manga.unread.toString()
|
text = item.manga.unread.toString()
|
||||||
}
|
}
|
||||||
// Update the download count and its visibility.
|
// Update the download count and its visibility.
|
||||||
with(download_text) {
|
with(download_text) {
|
||||||
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
|
visibleIf { item.downloadCount > 0 }
|
||||||
text = "${item.downloadCount}"
|
text = "${item.downloadCount}"
|
||||||
}
|
}
|
||||||
// show local text badge if local manga
|
// show local text badge if local manga
|
||||||
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
local_text.visibleIf { item.manga.source == LocalSource.ID }
|
||||||
|
|
||||||
// Create thumbnail onclick to simulate long click
|
// Create thumbnail onclick to simulate long click
|
||||||
thumbnail.setOnClickListener {
|
thumbnail.setOnClickListener {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||||
|
import eu.kanade.tachiyomi.util.view.invisible
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
||||||
|
@ -117,23 +119,23 @@ class TrackSearchDialog : DialogController {
|
||||||
|
|
||||||
private fun search(query: String) {
|
private fun search(query: String) {
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.VISIBLE
|
view.progress.visible()
|
||||||
view.track_search_list.visibility = View.INVISIBLE
|
view.track_search_list.invisible()
|
||||||
trackController.presenter.search(query, service)
|
trackController.presenter.search(query, service)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onSearchResults(results: List<TrackSearch>) {
|
fun onSearchResults(results: List<TrackSearch>) {
|
||||||
selectedItem = null
|
selectedItem = null
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.INVISIBLE
|
view.progress.invisible()
|
||||||
view.track_search_list.visibility = View.VISIBLE
|
view.track_search_list.visible()
|
||||||
adapter?.setItems(results)
|
adapter?.setItems(results)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onSearchResultsError() {
|
fun onSearchResultsError() {
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.VISIBLE
|
view.progress.visible()
|
||||||
view.track_search_list.visibility = View.INVISIBLE
|
view.track_search_list.invisible()
|
||||||
adapter?.setItems(emptyList())
|
adapter?.setItems(emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||||
} else {
|
} else {
|
||||||
resetDefaultMenuAndBar()
|
resetDefaultMenuAndBar()
|
||||||
}
|
}
|
||||||
reader_menu.visibility = View.VISIBLE
|
reader_menu.visible()
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
|
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.enter_from_top)
|
||||||
|
@ -342,7 +342,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||||
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top)
|
val toolbarAnimation = AnimationUtils.loadAnimation(this, R.anim.exit_to_top)
|
||||||
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
|
toolbarAnimation.setAnimationListener(object : SimpleAnimationListener() {
|
||||||
override fun onAnimationEnd(animation: Animation) {
|
override fun onAnimationEnd(animation: Animation) {
|
||||||
reader_menu.visibility = View.GONE
|
reader_menu.gone()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar.startAnimation(toolbarAnimation)
|
toolbar.startAnimation(toolbarAnimation)
|
||||||
|
@ -741,7 +741,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||||
subscriptions.add(customFilterColorSubscription)
|
subscriptions.add(customFilterColorSubscription)
|
||||||
} else {
|
} else {
|
||||||
customFilterColorSubscription?.let { subscriptions.remove(it) }
|
customFilterColorSubscription?.let { subscriptions.remove(it) }
|
||||||
color_overlay.visibility = View.GONE
|
color_overlay.gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,11 +767,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||||
|
|
||||||
// Set black overlay visibility.
|
// Set black overlay visibility.
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
brightness_overlay.visibility = View.VISIBLE
|
brightness_overlay.visible()
|
||||||
val alpha = (abs(value) * 2.56).toInt()
|
val alpha = (abs(value) * 2.56).toInt()
|
||||||
brightness_overlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
|
brightness_overlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
|
||||||
} else {
|
} else {
|
||||||
brightness_overlay.visibility = View.GONE
|
brightness_overlay.gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||||
* Sets the color filter [value].
|
* Sets the color filter [value].
|
||||||
*/
|
*/
|
||||||
private fun setColorFilterValue(value: Int) {
|
private fun setColorFilterValue(value: Int) {
|
||||||
color_overlay.visibility = View.VISIBLE
|
color_overlay.visible()
|
||||||
color_overlay.setFilterColor(value, preferences.colorFilterMode().getOrDefault())
|
color_overlay.setFilterColor(value, preferences.colorFilterMode().getOrDefault())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
||||||
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
@ -234,11 +236,11 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
|
||||||
private fun setCustomBrightnessValue(value: Int, view: View, isDisabled: Boolean = false) = with(view) {
|
private fun setCustomBrightnessValue(value: Int, view: View, isDisabled: Boolean = false) = with(view) {
|
||||||
// Set black overlay visibility.
|
// Set black overlay visibility.
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
brightness_overlay.visibility = View.VISIBLE
|
brightness_overlay.visible()
|
||||||
val alpha = (abs(value) * 2.56).toInt()
|
val alpha = (abs(value) * 2.56).toInt()
|
||||||
brightness_overlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
|
brightness_overlay.setBackgroundColor(Color.argb(alpha, 0, 0, 0))
|
||||||
} else {
|
} else {
|
||||||
brightness_overlay.visibility = View.GONE
|
brightness_overlay.gone()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDisabled)
|
if (!isDisabled)
|
||||||
|
@ -259,7 +261,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
|
||||||
subscriptions.add(customFilterColorSubscription)
|
subscriptions.add(customFilterColorSubscription)
|
||||||
} else {
|
} else {
|
||||||
customFilterColorSubscription?.let { subscriptions.remove(it) }
|
customFilterColorSubscription?.let { subscriptions.remove(it) }
|
||||||
color_overlay.visibility = View.GONE
|
color_overlay.gone()
|
||||||
}
|
}
|
||||||
setColorFilterSeekBar(enabled, view)
|
setColorFilterSeekBar(enabled, view)
|
||||||
}
|
}
|
||||||
|
@ -270,7 +272,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
|
||||||
* @param view view of the dialog
|
* @param view view of the dialog
|
||||||
*/
|
*/
|
||||||
private fun setColorFilterValue(@ColorInt color: Int, view: View) = with(view) {
|
private fun setColorFilterValue(@ColorInt color: Int, view: View) = with(view) {
|
||||||
color_overlay.visibility = View.VISIBLE
|
color_overlay.visible()
|
||||||
color_overlay.setFilterColor(color, preferences.colorFilterMode().getOrDefault())
|
color_overlay.setFilterColor(color, preferences.colorFilterMode().getOrDefault())
|
||||||
setValues(color, view)
|
setValues(color, view)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.reader
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.core.widget.NestedScrollView
|
import androidx.core.widget.NestedScrollView
|
||||||
|
@ -87,7 +86,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||||
show_page_number.bindToPreference(preferences.showPageNumber())
|
show_page_number.bindToPreference(preferences.showPageNumber())
|
||||||
fullscreen.bindToPreference(preferences.fullscreen())
|
fullscreen.bindToPreference(preferences.fullscreen())
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
cutout_short.visibility = View.VISIBLE
|
cutout_short.visible()
|
||||||
cutout_short.bindToPreference(preferences.cutoutShort())
|
cutout_short.bindToPreference(preferences.cutoutShort())
|
||||||
}
|
}
|
||||||
keepscreen.bindToPreference(preferences.keepScreenOn())
|
keepscreen.bindToPreference(preferences.keepScreenOn())
|
||||||
|
|
|
@ -16,6 +16,7 @@ import android.view.animation.LinearInterpolator
|
||||||
import android.view.animation.RotateAnimation
|
import android.view.animation.RotateAnimation
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,14 +156,14 @@ class ReaderProgressBar @JvmOverloads constructor(
|
||||||
if (visibility == View.GONE) return
|
if (visibility == View.GONE) return
|
||||||
|
|
||||||
if (!animate) {
|
if (!animate) {
|
||||||
visibility = View.GONE
|
gone()
|
||||||
} else {
|
} else {
|
||||||
ObjectAnimator.ofFloat(this, "alpha", 1f, 0f).apply {
|
ObjectAnimator.ofFloat(this, "alpha", 1f, 0f).apply {
|
||||||
interpolator = DecelerateInterpolator()
|
interpolator = DecelerateInterpolator()
|
||||||
duration = 1000
|
duration = 1000
|
||||||
addListener(object : AnimatorListenerAdapter() {
|
addListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
override fun onAnimationEnd(animation: Animator?) {
|
||||||
visibility = View.GONE
|
gone()
|
||||||
alpha = 1f
|
alpha = 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +65,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
pager.visibility = View.GONE // Don't layout the pager yet
|
pager.gone() // Don't layout the pager yet
|
||||||
pager.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
pager.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||||
pager.offscreenPageLimit = 1
|
pager.offscreenPageLimit = 1
|
||||||
pager.id = R.id.reader_pager
|
pager.id = R.id.reader_pager
|
||||||
|
@ -195,7 +197,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||||
Timber.d("Pager first layout")
|
Timber.d("Pager first layout")
|
||||||
val pages = chapters.currChapter.pages ?: return
|
val pages = chapters.currChapter.pages ?: return
|
||||||
moveToPage(pages[chapters.currChapter.requestedPage])
|
moveToPage(pages[chapters.currChapter.requestedPage])
|
||||||
pager.visibility = View.VISIBLE
|
pager.visible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import rx.subscriptions.CompositeSubscription
|
import rx.subscriptions.CompositeSubscription
|
||||||
|
@ -63,7 +65,7 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
|
||||||
val subscriptions = CompositeSubscription()
|
val subscriptions = CompositeSubscription()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
recycler.visibility = View.GONE // Don't let the recycler layout yet
|
recycler.gone() // Don't let the recycler layout yet
|
||||||
recycler.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
recycler.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
||||||
recycler.itemAnimator = null
|
recycler.itemAnimator = null
|
||||||
recycler.layoutManager = layoutManager
|
recycler.layoutManager = layoutManager
|
||||||
|
@ -184,7 +186,7 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
|
||||||
Timber.d("Recycler first layout")
|
Timber.d("Recycler first layout")
|
||||||
val pages = chapters.currChapter.pages ?: return
|
val pages = chapters.currChapter.pages ?: return
|
||||||
moveToPage(pages[chapters.currChapter.requestedPage])
|
moveToPage(pages[chapters.currChapter.requestedPage])
|
||||||
recycler.visibility = View.VISIBLE
|
recycler.visible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,13 @@ package eu.kanade.tachiyomi.widget
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.MenuRes
|
import androidx.annotation.MenuRes
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import kotlinx.android.synthetic.main.common_action_toolbar.view.common_action_menu
|
import kotlinx.android.synthetic.main.common_action_toolbar.view.common_action_menu
|
||||||
import kotlinx.android.synthetic.main.common_action_toolbar.view.common_action_toolbar
|
import kotlinx.android.synthetic.main.common_action_toolbar.view.common_action_toolbar
|
||||||
|
|
||||||
|
@ -47,13 +48,13 @@ class ActionToolbar @JvmOverloads constructor(context: Context, attrs: Attribute
|
||||||
common_action_menu.setOnMenuItemClickListener { listener(it) }
|
common_action_menu.setOnMenuItemClickListener { listener(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
common_action_toolbar.visibility = View.VISIBLE
|
common_action_toolbar.visible()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the menu toolbar.
|
* Hide the menu toolbar.
|
||||||
*/
|
*/
|
||||||
fun hide() {
|
fun hide() {
|
||||||
common_action_toolbar.visibility = View.GONE
|
common_action_toolbar.gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewAnimationUtils
|
import android.view.ViewAnimationUtils
|
||||||
|
import eu.kanade.tachiyomi.util.view.invisible
|
||||||
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
|
|
||||||
class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||||
View(context, attrs) {
|
View(context, attrs) {
|
||||||
|
@ -19,7 +21,7 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
|
||||||
*/
|
*/
|
||||||
fun hideRevealEffect(centerX: Int, centerY: Int, initialRadius: Int) {
|
fun hideRevealEffect(centerX: Int, centerY: Int, initialRadius: Int) {
|
||||||
// Make the view visible.
|
// Make the view visible.
|
||||||
this.visibility = View.VISIBLE
|
this.visible()
|
||||||
|
|
||||||
// Create the animation (the final radius is zero).
|
// Create the animation (the final radius is zero).
|
||||||
val anim = ViewAnimationUtils.createCircularReveal(
|
val anim = ViewAnimationUtils.createCircularReveal(
|
||||||
|
@ -32,7 +34,7 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
|
||||||
anim.addListener(object : AnimatorListenerAdapter() {
|
anim.addListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
super.onAnimationEnd(animation)
|
super.onAnimationEnd(animation)
|
||||||
this@RevealAnimationView.visibility = View.INVISIBLE
|
this@RevealAnimationView.invisible()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
|
||||||
* @return sdk version lower then 21
|
* @return sdk version lower then 21
|
||||||
*/
|
*/
|
||||||
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener): Boolean {
|
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener): Boolean {
|
||||||
this.visibility = View.VISIBLE
|
this.visible()
|
||||||
|
|
||||||
val height = this.height
|
val height = this.height
|
||||||
|
|
||||||
|
|
Reference in a new issue