[Timetable] Fix Timetable crashing with Swipe Refresh Layout and no parent.

This commit is contained in:
Kuba Szczodrzyński 2020-01-06 15:57:15 +01:00
parent 45753583ee
commit e123ff1bec
2 changed files with 6 additions and 5 deletions

View File

@ -145,9 +145,10 @@ class TimetableFragment : Fragment(), CoroutineScope {
b.viewPager.adapter = pagerAdapter b.viewPager.adapter = pagerAdapter
b.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { b.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {
if (b.refreshLayout != null) { // TODO: 2020-01-05 resolve issues with page scrolling (and scrolling up) with viewpager and swipe to refresh
/*if (b.refreshLayout != null) {
b.refreshLayout.isEnabled = state == ViewPager.SCROLL_STATE_IDLE b.refreshLayout.isEnabled = state == ViewPager.SCROLL_STATE_IDLE
} }*/
} }
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {

View File

@ -3,10 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator <!--<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
android:id="@+id/refreshLayout" android:id="@+id/refreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">-->
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -93,5 +93,5 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator> <!--</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>-->
</layout> </layout>