mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-29 10:23:21 -05:00
More bottom inset padding fixes
This commit is contained in:
parent
10163aab21
commit
776f6a9a16
13 changed files with 23 additions and 37 deletions
|
@ -38,15 +38,12 @@ fun Controller.withFadeTransaction(): RouterTransaction {
|
||||||
|
|
||||||
val Controller.insets: WindowInsets?
|
val Controller.insets: WindowInsets?
|
||||||
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
activity!!.window.decorView.rootWindowInsets
|
activity?.window?.decorView?.rootWindowInsets
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun Controller.applyBottomInsetPadding(view: View, paddingBottom: Int = view.paddingBottom) {
|
fun Controller.applyBottomInsetPadding(view: View, paddingBottom: Int = view.paddingBottom) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
val bottomInset = insets?.systemWindowInsetBottom ?: 0
|
||||||
view.updatePadding(bottom = paddingBottom + insets!!.systemWindowInsetBottom)
|
view.updatePadding(bottom = paddingBottom + bottomInset)
|
||||||
} else {
|
|
||||||
view.updatePadding(bottom = paddingBottom)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,7 @@ open class ExtensionController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = ExtensionControllerBinding.inflate(inflater)
|
binding = ExtensionControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.getPreferenceKey
|
import eu.kanade.tachiyomi.source.getPreferenceKey
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController
|
import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.util.preference.DSL
|
import eu.kanade.tachiyomi.util.preference.DSL
|
||||||
import eu.kanade.tachiyomi.util.preference.onChange
|
import eu.kanade.tachiyomi.util.preference.onChange
|
||||||
|
@ -66,6 +67,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
val themedInflater = inflater.cloneInContext(getPreferenceThemeContext())
|
||||||
binding = ExtensionDetailControllerBinding.inflate(themedInflater)
|
binding = ExtensionDetailControllerBinding.inflate(themedInflater)
|
||||||
|
applyBottomInsetPadding(binding.extensionPrefsRecycler)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,7 @@ class MigrationSourcesController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = MigrationSourcesControllerBinding.inflate(inflater)
|
binding = MigrationSourcesControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,7 @@ class SourceController :
|
||||||
*/
|
*/
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = SourceMainControllerBinding.inflate(inflater)
|
binding = SourceMainControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
|
import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
|
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||||
|
@ -59,6 +60,7 @@ open class GlobalSearchController(
|
||||||
*/
|
*/
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = GlobalSearchControllerBinding.inflate(inflater)
|
binding = GlobalSearchControllerBinding.inflate(inflater)
|
||||||
|
applyBottomInsetPadding(binding.recycler)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,7 @@ class CategoryController :
|
||||||
*/
|
*/
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = CategoriesControllerBinding.inflate(inflater)
|
binding = CategoriesControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,7 @@ class DownloadController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = DownloadControllerBinding.inflate(inflater)
|
binding = DownloadControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,9 +195,7 @@ class MangaController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = MangaControllerBinding.inflate(inflater)
|
binding = MangaControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.ui.more
|
package eu.kanade.tachiyomi.ui.more
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
@ -13,7 +9,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.data.download.DownloadService
|
import eu.kanade.tachiyomi.data.download.DownloadService
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding
|
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||||
import eu.kanade.tachiyomi.ui.download.DownloadController
|
import eu.kanade.tachiyomi.ui.download.DownloadController
|
||||||
|
@ -44,14 +39,6 @@ class MoreController :
|
||||||
private var isDownloading: Boolean = false
|
private var isDownloading: Boolean = false
|
||||||
private var downloadQueueSize: Int = 0
|
private var downloadQueueSize: Int = 0
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle?): View {
|
|
||||||
val view = super.onCreateView(inflater, container, savedInstanceState)
|
|
||||||
|
|
||||||
applyBottomInsetPadding(view, view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding))
|
|
||||||
|
|
||||||
return view
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||||
titleRes = R.string.label_more
|
titleRes = R.string.label_more
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,7 @@ class HistoryController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = HistoryControllerBinding.inflate(inflater)
|
binding = HistoryControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,7 @@ class UpdatesController :
|
||||||
|
|
||||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||||
binding = UpdatesControllerBinding.inflate(inflater)
|
binding = UpdatesControllerBinding.inflate(inflater)
|
||||||
|
|
||||||
applyBottomInsetPadding(binding.recycler)
|
applyBottomInsetPadding(binding.recycler)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ import com.bluelinelabs.conductor.ControllerChangeType
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.applyBottomInsetPadding
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -42,7 +44,19 @@ abstract class SettingsController : PreferenceController() {
|
||||||
if (untilDestroySubscriptions.isUnsubscribed) {
|
if (untilDestroySubscriptions.isUnsubscribed) {
|
||||||
untilDestroySubscriptions = CompositeSubscription()
|
untilDestroySubscriptions = CompositeSubscription()
|
||||||
}
|
}
|
||||||
return super.onCreateView(inflater, container, savedInstanceState)
|
|
||||||
|
val view = super.onCreateView(inflater, container, savedInstanceState)
|
||||||
|
|
||||||
|
if (this is RootController) {
|
||||||
|
applyBottomInsetPadding(
|
||||||
|
view,
|
||||||
|
view.context.resources.getDimensionPixelSize(R.dimen.action_toolbar_list_padding)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
applyBottomInsetPadding(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(view: View) {
|
override fun onAttach(view: View) {
|
||||||
|
|
Loading…
Reference in a new issue