use CoordinatorLayout instead of NestedScrollView in media fragment
This commit is contained in:
parent
f342d1a3f4
commit
e762745705
|
@ -11,7 +11,7 @@ android {
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 3000 //00.03.000
|
versionCode 3000 //00.03.000
|
||||||
versionName "0.3.90"
|
versionName "0.3.91"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
resValue "string", "build_time", buildTime()
|
resValue "string", "build_time", buildTime()
|
||||||
|
|
|
@ -17,9 +17,9 @@ 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.*
|
||||||
import org.mosad.teapod.R
|
import org.mosad.teapod.R
|
||||||
|
import org.mosad.teapod.databinding.FragmentMediaBinding
|
||||||
import org.mosad.teapod.ui.activity.main.MainActivity
|
import org.mosad.teapod.ui.activity.main.MainActivity
|
||||||
import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel
|
import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel
|
||||||
import org.mosad.teapod.databinding.FragmentMediaBinding
|
|
||||||
import org.mosad.teapod.util.*
|
import org.mosad.teapod.util.*
|
||||||
import org.mosad.teapod.util.DataTypes.MediaType
|
import org.mosad.teapod.util.DataTypes.MediaType
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
|
||||||
|
|
||||||
// tab layout and pager TODO
|
// tab layout and pager TODO
|
||||||
pagerAdapter = ScreenSlidePagerAdapter(requireActivity())
|
pagerAdapter = ScreenSlidePagerAdapter(requireActivity())
|
||||||
|
// fix material components issue #1878, if more tabs are added increase
|
||||||
|
binding.pagerEpisodesSimilar.offscreenPageLimit = 2
|
||||||
binding.pagerEpisodesSimilar.adapter = pagerAdapter
|
binding.pagerEpisodesSimilar.adapter = pagerAdapter
|
||||||
TabLayoutMediator(binding.tabEpisodesSimilar, binding.pagerEpisodesSimilar) { tab, position ->
|
TabLayoutMediator(binding.tabEpisodesSimilar, binding.pagerEpisodesSimilar) { tab, position ->
|
||||||
tab.text = if (model.media.type == MediaType.TVSHOW && position == 0) {
|
tab.text = if (model.media.type == MediaType.TVSHOW && position == 0) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -7,167 +7,182 @@
|
||||||
android:background="?themePrimary"
|
android:background="?themePrimary"
|
||||||
tools:context=".ui.activity.main.fragments.MediaFragment">
|
tools:context=".ui.activity.main.fragments.MediaFragment">
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/app_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:background="?themePrimary">
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_scrollFlags="scroll">
|
||||||
|
|
||||||
<ImageView
|
<RelativeLayout
|
||||||
android:id="@+id/image_backdrop"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:adjustViewBounds="false"
|
|
||||||
android:contentDescription="@string/media_poster_backdrop_desc"
|
|
||||||
android:maxHeight="231dp"
|
|
||||||
android:minHeight="220dp"
|
|
||||||
android:scaleType="centerCrop" />
|
|
||||||
|
|
||||||
<com.google.android.material.imageview.ShapeableImageView
|
|
||||||
android:id="@+id/image_poster"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
|
|
||||||
tools:src="@drawable/ic_launcher_background" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/linear_media_info"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_year"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="2dp"
|
|
||||||
android:text="@string/text_year_ex" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_age"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="7dp"
|
|
||||||
android:background="@drawable/shape_rounded_corner"
|
|
||||||
android:paddingStart="3dp"
|
|
||||||
android:paddingTop="2dp"
|
|
||||||
android:paddingEnd="3dp"
|
|
||||||
android:paddingBottom="2dp"
|
|
||||||
android:text="@string/text_age_ex" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_episodes_or_runtime"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="7dp"
|
|
||||||
android:padding="2dp"
|
|
||||||
android:text="@string/text_episodes_count" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/button_play"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="7dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:layout_marginEnd="7dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/button_play"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textColor="?themePrimary"
|
|
||||||
android:textSize="16sp"
|
|
||||||
app:backgroundTint="?buttonBackground"
|
|
||||||
app:icon="@drawable/ic_baseline_play_arrow_24"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:iconTint="?themePrimary" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="7dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:layout_marginEnd="7dp"
|
|
||||||
android:text="@string/text_title_ex"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/text_overview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginTop="7dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:text="@string/text_overview_ex" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/linear_actions"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginStart="12dp"
|
|
||||||
android:layout_marginTop="7dp"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/linear_my_list_action"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_my_list_action"
|
android:id="@+id/image_backdrop"
|
||||||
android:layout_width="48dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/my_list"
|
android:adjustViewBounds="false"
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
android:contentDescription="@string/media_poster_backdrop_desc"
|
||||||
app:tint="?buttonBackground" />
|
android:maxHeight="231dp"
|
||||||
|
android:minHeight="220dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
|
android:id="@+id/image_poster"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
|
||||||
|
tools:src="@drawable/ic_launcher_background" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_media_info"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_my_list_action"
|
android:id="@+id/text_year"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/my_list"
|
android:padding="2dp"
|
||||||
android:textColor="?textSecondary"
|
android:text="@string/text_year_ex" />
|
||||||
android:textSize="12sp" />
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_age"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="7dp"
|
||||||
|
android:background="@drawable/shape_rounded_corner"
|
||||||
|
android:paddingStart="3dp"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingEnd="3dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:text="@string/text_age_ex" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_episodes_or_runtime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="7dp"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:text="@string/text_episodes_count" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/button_play"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="7dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/button_play"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="?themePrimary"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:backgroundTint="?buttonBackground"
|
||||||
|
app:icon="@drawable/ic_baseline_play_arrow_24"
|
||||||
|
app:iconGravity="textStart"
|
||||||
|
app:iconTint="?themePrimary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="7dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:text="@string/text_title_ex"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_overview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:text="@string/text_overview_ex" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_actions"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linear_my_list_action"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_my_list_action"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:contentDescription="@string/my_list"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
|
app:tint="?buttonBackground" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_my_list_action"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/my_list"
|
||||||
|
android:textColor="?textSecondary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tab_episodes_similar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="7dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
app:tabGravity="start"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabSelectedTextColor="?textPrimary"
|
||||||
|
app:tabTextColor="?textSecondary" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/tab_episodes_similar"
|
android:id="@+id/pager_episodes_similar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/transparent"
|
app:layout_anchor="@id/app_layout"
|
||||||
android:layout_marginStart="7dp"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_gravity="bottom"/>
|
||||||
android:layout_marginEnd="7dp"
|
|
||||||
app:tabMode="scrollable"
|
|
||||||
app:tabGravity="start"
|
|
||||||
app:tabSelectedTextColor="?textPrimary"
|
|
||||||
app:tabTextColor="?textSecondary" />
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
android:id="@+id/pager_episodes_similar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/frame_loading"
|
android:id="@+id/frame_loading"
|
||||||
|
@ -186,4 +201,4 @@
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</RelativeLayout>
|
|
@ -4,13 +4,12 @@
|
||||||
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_episodes"
|
android:id="@+id/recycler_episodes"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
|
||||||
android:paddingStart="7dp"
|
android:paddingStart="7dp"
|
||||||
android:paddingEnd="7dp"
|
android:paddingEnd="7dp"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_media_similar"
|
android:id="@+id/recycler_media_similar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingStart="3dp"
|
android:paddingStart="3dp"
|
||||||
android:paddingTop="6dp"
|
android:paddingTop="6dp"
|
||||||
|
|
Loading…
Reference in New Issue