Merge branch 'feat/GHZS-3760' into 'dev'
feat: 帮助与反馈第二期迭代 https://jira.shanqu.cc/browse/GHZS-3760 See merge request halo/android/assistant-android!1424
This commit is contained in:
@ -1,24 +1,23 @@
|
||||
package com.gh.gamecenter.qa.editor
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.util.AttributeSet
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import android.view.Surface
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.SeekBar
|
||||
import android.view.*
|
||||
import android.widget.*
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.observer.MuteCallback
|
||||
import com.gh.gamecenter.common.observer.VolumeObserver
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.databinding.LayoutFullScreenDetailVideoPortraitBinding
|
||||
@ -39,6 +38,7 @@ class FullScreenVideoView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
private var mVolumeObserver: VolumeObserver
|
||||
private var mMuteDisposable: Disposable? = null
|
||||
private var mVideoIsMuted = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
private var mSpeedPopupWindow: PopupWindow? = null
|
||||
private lateinit var mBinding: LayoutFullScreenDetailVideoPortraitBinding
|
||||
val backBtn: View = findViewById(R.id.back)
|
||||
var uuid = UUID.randomUUID().toString()
|
||||
@ -59,6 +59,14 @@ class FullScreenVideoView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
showBackBtn()
|
||||
|
||||
mBinding.layoutBottom.volume.setOnClickListener { toggleMute() }
|
||||
mBinding.layoutBottom.speedTv.visibility = View.VISIBLE
|
||||
mBinding.layoutBottom.speedTv.setOnClickListener {
|
||||
cancelDismissControlViewTimer()
|
||||
mSpeedPopupWindow = showPlaySpeedPopupWindow(mContext, speed, mBinding.layoutBottom.root)
|
||||
mSpeedPopupWindow?.setOnDismissListener {
|
||||
startDismissControlViewTimer()
|
||||
}
|
||||
}
|
||||
}
|
||||
mFullscreenButton.visibility = View.GONE
|
||||
|
||||
@ -239,6 +247,12 @@ class FullScreenVideoView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
return CustomManager.getCustomManager(getKey())
|
||||
}
|
||||
|
||||
override fun hideAllWidget() {
|
||||
super.hideAllWidget()
|
||||
|
||||
mSpeedPopupWindow?.dismiss()
|
||||
}
|
||||
|
||||
fun getKey(): String {
|
||||
return uuid
|
||||
}
|
||||
@ -446,4 +460,55 @@ class FullScreenVideoView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
// onLossAudio 回调的时候再决定是否需要暂停
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun showPlaySpeedPopupWindow(context: Context,
|
||||
currentSpeed: Float,
|
||||
anchorView: View): PopupWindow {
|
||||
val availableVideoSpeed = arrayListOf(2.0F, 1.5F, 1.0F, 0.75F, 0.5F)
|
||||
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val layout = inflater.inflate(R.layout.popup_video_play_speed, null)
|
||||
val popupWindow = BugFixedPopupWindow(
|
||||
layout,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
|
||||
val container = layout.findViewById<LinearLayout>(R.id.container)
|
||||
for (videoSpeed in availableVideoSpeed) {
|
||||
val item = inflater.inflate(R.layout.item_video_play_speed, container, false)
|
||||
container.addView(item)
|
||||
|
||||
val tv = item.findViewById<TextView>(R.id.titleTv)
|
||||
tv.text = "${videoSpeed}X"
|
||||
if (videoSpeed == currentSpeed) {
|
||||
tv.setTextColor(R.color.text_aw_primary.toColor(context))
|
||||
tv.setTypeface(Typeface.DEFAULT, Typeface.BOLD)
|
||||
} else {
|
||||
tv.setTextColor(R.color.text_aw_secondary.toColor(context))
|
||||
tv.setTypeface(Typeface.DEFAULT, Typeface.NORMAL)
|
||||
}
|
||||
|
||||
item.setOnClickListener {
|
||||
speed = videoSpeed
|
||||
if (videoSpeed != 1.0F) {
|
||||
mBinding.layoutBottom.speedTv.text = tv.text
|
||||
mBinding.layoutBottom.speedTv.setTypeface(Typeface.DEFAULT, Typeface.BOLD)
|
||||
} else {
|
||||
mBinding.layoutBottom.speedTv.text = resources.getString(R.string.video_speed)
|
||||
mBinding.layoutBottom.speedTv.setTypeface(Typeface.DEFAULT, Typeface.NORMAL)
|
||||
}
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
popupWindow.run {
|
||||
isTouchable = true
|
||||
isFocusable = true
|
||||
showAutoOrientation(anchorView = anchorView)
|
||||
}
|
||||
|
||||
return popupWindow
|
||||
}
|
||||
|
||||
}
|
||||
5
app/src/main/res/drawable/divider_video_play_speed.xml
Normal file
5
app/src/main/res/drawable/divider_video_play_speed.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size android:height="1dp" />
|
||||
<solid android:color="@color/white_alpha_5" />
|
||||
</shape>
|
||||
12
app/src/main/res/layout/item_video_play_speed.xml
Normal file
12
app/src/main/res/layout/item_video_play_speed.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/titleTv"
|
||||
style="@style/TextCaption1"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp"
|
||||
android:text="2.0X"
|
||||
android:textColor="@color/text_aw_secondary"
|
||||
android:textStyle="bold" />
|
||||
@ -38,6 +38,21 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/speedTv"
|
||||
style="@style/TextCaption1"
|
||||
android:layout_width="41dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:text="@string/video_speed"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/fullscreen"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="0dp"
|
||||
@ -62,7 +77,7 @@
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="00:00"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/fullscreen"
|
||||
app:layout_constraintRight_toLeftOf="@id/speedTv"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
|
||||
16
app/src/main/res/layout/popup_video_play_speed.xml
Normal file
16
app/src/main/res/layout/popup_video_play_speed.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/background_shape_black_90_radius_4"
|
||||
android:divider="@drawable/divider_video_play_speed"
|
||||
android:dividerPadding="16dp"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle" />
|
||||
</FrameLayout>
|
||||
@ -164,6 +164,8 @@
|
||||
|
||||
<string name="clean_apk_version">版本:V%1$s | %2$s</string>
|
||||
|
||||
<string name="video_speed">倍速</string>
|
||||
|
||||
<string name="regulation_link"><u>了解更多</u></string>
|
||||
<string name="regulation_hint">小助手邀你共建良好的社区氛围,请通过“光环助手礼仪测试”后发言。</string>
|
||||
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/black_alpha_90" />
|
||||
</shape>
|
||||
@ -207,6 +207,8 @@
|
||||
<color name="black_alpha_40">#66000000</color>
|
||||
<color name="black_alpha_50">#80000000</color>
|
||||
<color name="black_alpha_60">#99000000</color>
|
||||
<color name="black_alpha_80">#CC000000</color>
|
||||
<color name="black_alpha_90">#E6000000</color>
|
||||
<!-- 100% — FF
|
||||
95% — F2
|
||||
90% — E6
|
||||
@ -228,8 +230,8 @@
|
||||
10% — 1A
|
||||
5% — 0D
|
||||
0% — 00 -->
|
||||
<color name="black_alpha_80">#CC000000</color>
|
||||
|
||||
<color name="white_alpha_5">#0DFFFFFF</color>
|
||||
<color name="white_alpha_10">#1AFFFFFF</color>
|
||||
<color name="white_alpha_20">#33FFFFFF</color>
|
||||
<color name="white_alpha_40">#66FFFFFF</color>
|
||||
|
||||
Reference in New Issue
Block a user