Add a few more animations to homepage

This commit is contained in:
Blatzar 2022-10-31 16:46:02 +01:00
parent 0e8aacf989
commit a201f5e4f8
2 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.home package com.lagradost.cloudstream3.ui.home
import android.animation.LayoutTransition
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
@ -23,6 +24,8 @@ import androidx.fragment.app.activityViewModels
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.transition.ChangeBounds
import androidx.transition.TransitionManager
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
@ -549,7 +552,7 @@ class HomeFragment : Fragment() {
home_preview?.isVisible = true home_preview?.isVisible = true
(home_preview_viewpager?.adapter as? HomeScrollAdapter)?.apply { (home_preview_viewpager?.adapter as? HomeScrollAdapter)?.apply {
setItems(preview.value) setItems(preview.value)
// home_preview_viewpager?.setCurrentItem(1000, false) // home_preview_viewpager?.setCurrentItem(1000, false)
} }
//.also { //.also {
@ -574,10 +577,15 @@ class HomeFragment : Fragment() {
setPageTransformer(false, HomeScrollTransformer()) setPageTransformer(false, HomeScrollTransformer())
adapter = HomeScrollAdapter { load -> adapter = HomeScrollAdapter { load ->
load.apply { load.apply {
home_preview_title_holder?.let { parent ->
TransitionManager.beginDelayedTransition(parent, ChangeBounds())
}
home_preview_tags?.text = tags?.joinToString("") ?: "" home_preview_tags?.text = tags?.joinToString("") ?: ""
home_preview_tags?.isGone = tags.isNullOrEmpty() home_preview_tags?.isGone = tags.isNullOrEmpty()
home_preview_image?.setImage(posterUrl, posterHeaders) home_preview_image?.setImage(posterUrl, posterHeaders)
home_preview_title?.text = name home_preview_title?.text = name
home_preview_play?.setOnClickListener { home_preview_play?.setOnClickListener {
activity?.loadResult(url, apiName, START_ACTION_RESUME_LATEST) activity?.loadResult(url, apiName, START_ACTION_RESUME_LATEST)
//activity.loadSearchResult(url, START_ACTION_RESUME_LATEST) //activity.loadSearchResult(url, START_ACTION_RESUME_LATEST)

View file

@ -363,19 +363,20 @@
--> -->
<LinearLayout <LinearLayout
android:id="@+id/home_preview_title_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/home_preview_title" android:id="@+id/home_preview_title"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:paddingHorizontal="30dp"
android:textColor="?attr/white" android:textColor="?attr/white"
android:textSize="17sp" android:textSize="17sp"
android:textStyle="bold" android:textStyle="bold"
@ -392,7 +393,7 @@
tools:text="5 seasons 50 episodes" />--> tools:text="5 seasons 50 episodes" />-->
<TextView <TextView
android:id="@+id/home_preview_tags" android:id="@+id/home_preview_tags"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:paddingStart="30dp" android:paddingStart="30dp"