mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-24 06:05:49 +03:00
Fix SwipeRefresh initial position in MangaController (#6211)
* Lower position of swipe refresh * Tweak existing code that sets swipe refresh position
This commit is contained in:
parent
d2fc6d9f44
commit
78de11a9e3
1 changed files with 7 additions and 10 deletions
|
@ -18,6 +18,7 @@ import androidx.annotation.FloatRange
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.doOnLayout
|
||||
import androidx.core.view.isVisible
|
||||
|
@ -291,19 +292,15 @@ class MangaController :
|
|||
}
|
||||
}
|
||||
|
||||
binding.swipeRefresh.doOnLayout { swipeRefresh ->
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.swipeRefresh) { swipeRefresh, windowInsets ->
|
||||
swipeRefresh as SwipeRefreshLayout
|
||||
swipeRefresh.setOnApplyWindowInsetsListener { _, windowInsets ->
|
||||
val topStatusBarInset = WindowInsetsCompat.toWindowInsetsCompat(windowInsets)
|
||||
.getInsets(WindowInsetsCompat.Type.statusBars())
|
||||
.top
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
|
||||
swipeRefresh.isRefreshing = false
|
||||
swipeRefresh.setProgressViewEndTarget(false, getMainAppBarHeight() + topStatusBarInset)
|
||||
swipeRefresh.setProgressViewEndTarget(false, getMainAppBarHeight() + insets.top)
|
||||
updateRefreshing()
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tablet layout
|
||||
binding.infoRecycler?.adapter = mangaInfoAdapter
|
||||
|
|
Loading…
Reference in a new issue