Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
This commit is contained in:
1
app/src/main/assets/lottie/follow.json
Normal file
1
app/src/main/assets/lottie/follow.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,7 @@
|
||||
package com.gh.gamecenter.video.detail
|
||||
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
@ -69,6 +71,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
private var mLastClickTime = 0L
|
||||
private var mLottieLike: LottieAnimationView? = null
|
||||
private var mHandler: Handler? = null
|
||||
private var weChatAnimate: AnimatorSet? = null
|
||||
|
||||
init {
|
||||
mHandler = Handler(Handler.Callback {
|
||||
@ -168,7 +171,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
} else {
|
||||
likeIv.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_video_detail_like))
|
||||
}
|
||||
attentionIv.goneIf(videoEntity.me.isFollower || videoEntity.user.id == UserManager.getInstance().userId)
|
||||
attentionIv.goneIf(videoEntity.user.id == UserManager.getInstance().userId || videoEntity.me.isFollower)
|
||||
attentionIv.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_video_detail_follow))
|
||||
if (!likeContainer.hasOnClickListeners())
|
||||
RxView.clicks(likeContainer)
|
||||
@ -245,10 +248,17 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
ToastUtils.showToast("网络错误")
|
||||
return@setOnClickListener
|
||||
}
|
||||
mViewModel?.follow(videoEntity)
|
||||
recordMta("关注用户")
|
||||
uploadVideoStreamingPlaying("关注用户")
|
||||
MtaHelper.onEvent("视频详情", "关注用户", mCombinedTitleAndId)
|
||||
attentionLottie.visibility = View.VISIBLE
|
||||
attentionIv.visibility = View.GONE
|
||||
attentionLottie.setAnimation("lottie/follow.json")
|
||||
attentionLottie.playAnimation()
|
||||
attentionLottie.doOnAnimationEnd {
|
||||
attentionLottie.visibility = View.GONE
|
||||
mViewModel?.follow(videoEntity)
|
||||
recordMta("关注用户")
|
||||
uploadVideoStreamingPlaying("关注用户")
|
||||
MtaHelper.onEvent("视频详情", "关注用户", mCombinedTitleAndId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,6 +412,27 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
}
|
||||
}
|
||||
|
||||
private fun playWechatAnimation() {
|
||||
if (weChatAnimate == null) {
|
||||
shareIv.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_video_detail_share_wechat))
|
||||
val scaleXAnimation = ObjectAnimator.ofFloat(shareIv, "scaleX", 1f, 0.9f, 1f)
|
||||
scaleXAnimation.repeatCount = -1
|
||||
val scaleYAnimation = ObjectAnimator.ofFloat(shareIv, "scaleY", 1f, 0.9f, 1f)
|
||||
scaleYAnimation.repeatCount = -1
|
||||
|
||||
weChatAnimate = AnimatorSet()
|
||||
weChatAnimate?.play(scaleXAnimation)?.with(scaleYAnimation)
|
||||
weChatAnimate?.duration = 1500
|
||||
weChatAnimate?.start()
|
||||
}
|
||||
}
|
||||
|
||||
fun removeWechatAnimation() {
|
||||
weChatAnimate?.end()
|
||||
weChatAnimate = null
|
||||
shareIv.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_video_detail_share))
|
||||
}
|
||||
|
||||
override fun createNetWorkState() {
|
||||
if (mNetInfoModule == null) {
|
||||
mNetInfoModule = NetInfoModule(mContext.applicationContext, NetInfoModule.NetChangeListener { state ->
|
||||
@ -707,6 +738,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
repeatPlayCount++
|
||||
seekOnStart = 0
|
||||
startPlayLogic()
|
||||
playWechatAnimation()
|
||||
}
|
||||
|
||||
override fun onCompletion() {
|
||||
|
||||
@ -12,10 +12,6 @@ import java.util.*
|
||||
// 由于兼容性问题,本游戏详情页不应该被低于 Android 4.4 的设备打开
|
||||
class VideoDetailActivity : BaseActivity() {
|
||||
var uuid = UUID.randomUUID()
|
||||
// var isPauseVideo = true//跳转页面时是否需要暂停视频
|
||||
var mLastTime = 0L
|
||||
var mIsDown = false
|
||||
private val mIntervalTime = 500
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_video_detail
|
||||
@ -35,22 +31,6 @@ class VideoDetailActivity : BaseActivity() {
|
||||
supportFragmentManager.beginTransaction().replace(R.id.layout_activity_content, containerFragment).commitNowAllowingStateLoss()
|
||||
}
|
||||
|
||||
//限制视频滑动频率
|
||||
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
if (ev.action == MotionEvent.ACTION_DOWN) {
|
||||
mIsDown = true
|
||||
} else if (ev.action == MotionEvent.ACTION_MOVE) {
|
||||
if (mIsDown && System.currentTimeMillis() - mLastTime < mIntervalTime) {
|
||||
return true
|
||||
}
|
||||
} else if (ev.action == MotionEvent.ACTION_UP) {
|
||||
mLastTime = System.currentTimeMillis()
|
||||
mIsDown = false
|
||||
}
|
||||
return super.dispatchTouchEvent(ev)
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
CustomManager.releaseAllVideos("detail_$uuid")
|
||||
mBaseHandler.postDelayed({
|
||||
|
||||
@ -220,6 +220,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
mViewModel.entranceDetail, video.id, mViewModel.uuid, 0.0, 0, 0, "play")
|
||||
}
|
||||
val detailPlayerView = recyclerview.findViewHolderForAdapterPosition(position)?.itemView as? DetailPlayerView
|
||||
detailPlayerView?.removeWechatAnimation()
|
||||
detailPlayerView?.repeatPlayCount = 0
|
||||
detailPlayerView?.unObserveVolume(requireActivity() as AppCompatActivity)
|
||||
detailPlayerView?.removeLikeAnimation()
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#66000000"/>
|
||||
<corners android:radius="30dp"/>
|
||||
<solid android:color="#99000000"/>
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
@ -49,7 +49,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/mTabIndicator"
|
||||
android:layout_marginTop="24dp">
|
||||
android:layout_marginTop="5dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/marquee_ad"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -91,9 +91,9 @@
|
||||
android:clickable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="5dp">
|
||||
|
||||
<ImageView
|
||||
@ -121,7 +121,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/gameNameLl"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@ -258,7 +258,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="22dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/gameContainer"
|
||||
@ -289,12 +289,20 @@
|
||||
android:src="@drawable/ic_video_detail_follow"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:id="@+id/attentionLottie"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/likeContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -318,7 +326,7 @@
|
||||
android:id="@+id/commentContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -343,11 +351,12 @@
|
||||
android:id="@+id/shareContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shareIv"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/ic_video_detail_share" />
|
||||
|
||||
Reference in New Issue
Block a user