dsiable scrolling on appbar if no tabs where added to media fragment
fixes #33
This commit is contained in:
parent
542164be9f
commit
9d3e9c5019
|
@ -13,6 +13,7 @@ import androidx.fragment.app.activityViewModels
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation
|
import jp.wasabeef.glide.transformations.BlurTransformation
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
@ -23,6 +24,7 @@ import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel
|
||||||
import org.mosad.teapod.util.*
|
import org.mosad.teapod.util.*
|
||||||
import org.mosad.teapod.util.DataTypes.MediaType
|
import org.mosad.teapod.util.DataTypes.MediaType
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The media detail fragment.
|
* The media detail fragment.
|
||||||
* Note: the fragment is created only once, when selecting a similar title etc.
|
* Note: the fragment is created only once, when selecting a similar title etc.
|
||||||
|
@ -147,6 +149,12 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
|
||||||
pagerAdapter.notifyDataSetChanged()
|
pagerAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disable scrolling on appbar, if no tabs where added
|
||||||
|
if(fragments.isEmpty()) {
|
||||||
|
val params = binding.linearMedia.layoutParams as AppBarLayout.LayoutParams
|
||||||
|
params.scrollFlags = 0 // clear all scroll flags
|
||||||
|
}
|
||||||
|
|
||||||
binding.frameLoading.visibility = View.GONE // hide loading indicator
|
binding.frameLoading.visibility = View.GONE // hide loading indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
android:background="?themePrimary">
|
android:background="?themePrimary">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_media"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
|
Loading…
Reference in New Issue