Browse Source

dsiable scrolling on appbar if no tabs where added to media fragment

fixes #33
pull/34/head
Jannik 1 year ago
parent
commit
9d3e9c5019
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 8
      app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragment.kt
  2. 1
      app/src/main/res/layout/fragment_media.xml

8
app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragment.kt

@ -13,6 +13,7 @@ import androidx.fragment.app.activityViewModels
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.tabs.TabLayoutMediator
import jp.wasabeef.glide.transformations.BlurTransformation
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.DataTypes.MediaType
/**
* The media detail fragment.
* 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()
}
// 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
}

1
app/src/main/res/layout/fragment_media.xml

@ -18,6 +18,7 @@
android:background="?themePrimary">
<LinearLayout
android:id="@+id/linear_media"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close