首页展开 折叠优化

This commit is contained in:
renhaoting 2025-12-03 19:30:11 +08:00
parent 4ff522f3cd
commit 0991ab3993
5 changed files with 34 additions and 11 deletions

View File

@ -106,7 +106,7 @@ class BenefitActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
} }
BOX_SUB_TASK_TYPE_ZERO_BUY -> { BOX_SUB_TASK_TYPE_ZERO_BUY -> {
Router.ZeroBuy.startActivity(this@BenefitActivity)
} }
} }

View File

@ -12,6 +12,7 @@ import android.view.animation.ScaleAnimation
import androidx.annotation.NonNull import androidx.annotation.NonNull
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelFragment import com.ama.core.architecture.appBase.AppViewsEmptyViewModelFragment
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.common.widget.PopMenuIconView import com.ama.core.common.widget.PopMenuIconView
import com.gamedog.vididin.R import com.gamedog.vididin.R
import com.gamedog.vididin.VididinEvents import com.gamedog.vididin.VididinEvents
@ -34,6 +35,7 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
private var mPlayer: YouTubePlayer? = null private var mPlayer: YouTubePlayer? = null
private var mVideoData: YoutubeVideo? = null private var mVideoData: YoutubeVideo? = null
private var mIsPlaying: Boolean = false private var mIsPlaying: Boolean = false
private var mIsIntroExpand: Boolean = false
private var mCurPlayedSecond: Float = 0F private var mCurPlayedSecond: Float = 0F
private var mTotalDuration: Float = 0F private var mTotalDuration: Float = 0F
private val mTickerTimer = TickerTimer() private val mTickerTimer = TickerTimer()
@ -46,10 +48,6 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
override fun ViewBinding.initViews() { override fun ViewBinding.initViews() {
maskView.setOnClickListener {
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
}
playIcon.setOnClickListener { playIcon.setOnClickListener {
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play() if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
} }
@ -72,6 +70,20 @@ class HomeItemFragment : AppViewsEmptyViewModelFragment<ViewBinding>() {
Router.Benefit.startActivity(requireActivity()) Router.Benefit.startActivity(requireActivity())
} }
)) ))
setOnClickBatch(ivIntroExpand, maskView) {
when (this) {
maskView -> {
if (mIsPlaying) mPlayer?.pause() else mPlayer?.play()
}
ivIntroExpand -> {
mIsIntroExpand = !mIsIntroExpand
tvVideoIntro.maxLines = if (mIsIntroExpand) 8 else 2
ivIntroExpand.setImageResource(if (mIsIntroExpand) R.mipmap.arrow_down else R.mipmap.arrow_up)
}
}
}
} }

View File

@ -42,25 +42,36 @@
android:id="@+id/tv_video_from" android:id="@+id/tv_video_from"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:text="From" android:text="From"
android:textSize="15sp" android:textSize="15sp"
android:textColor="@color/white" /> android:textColor="@color/white" />
<androidx.core.widget.NestedScrollView <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="wrap_content">
android:layout_marginTop="10dp"
>
<TextView <TextView
android:id="@+id/tv_video_intro" android:id="@+id/tv_video_intro"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="introduce" android:text="introduce"
android:clickable="false"
android:maxLines="2"
android:layout_marginEnd="45dp"
android:textSize="15sp" android:textSize="15sp"
android:textColor="@color/white_al80" /> android:textColor="@color/white_al80" />
</androidx.core.widget.NestedScrollView> <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_intro_expand"
android:layout_width="40dp"
android:layout_height="40dp"
android:paddingHorizontal="10dp"
android:paddingVertical="5dp"
android:layout_gravity="right|bottom"
android:src="@mipmap/arrow_up"
/>
</FrameLayout>
</LinearLayout> </LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB