mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 18:38:23 +01: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
@ -18,6 +18,7 @@ import androidx.annotation.FloatRange
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.view.ActionMode
|
import androidx.appcompat.view.ActionMode
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.doOnLayout
|
import androidx.core.view.doOnLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@ -291,17 +292,13 @@ class MangaController :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.swipeRefresh.doOnLayout { swipeRefresh ->
|
ViewCompat.setOnApplyWindowInsetsListener(binding.swipeRefresh) { swipeRefresh, windowInsets ->
|
||||||
swipeRefresh as SwipeRefreshLayout
|
swipeRefresh as SwipeRefreshLayout
|
||||||
swipeRefresh.setOnApplyWindowInsetsListener { _, windowInsets ->
|
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
|
||||||
val topStatusBarInset = WindowInsetsCompat.toWindowInsetsCompat(windowInsets)
|
swipeRefresh.isRefreshing = false
|
||||||
.getInsets(WindowInsetsCompat.Type.statusBars())
|
swipeRefresh.setProgressViewEndTarget(false, getMainAppBarHeight() + insets.top)
|
||||||
.top
|
updateRefreshing()
|
||||||
swipeRefresh.isRefreshing = false
|
windowInsets
|
||||||
swipeRefresh.setProgressViewEndTarget(false, getMainAppBarHeight() + topStatusBarInset)
|
|
||||||
updateRefreshing()
|
|
||||||
windowInsets
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user