签约 充值

This commit is contained in:
2025-12-04 10:19:57 +08:00
parent 23a07562b7
commit ea188cde92
3 changed files with 40 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ import android.os.Build
import android.os.Handler
import android.os.Looper
import android.util.AttributeSet
import android.util.Log
import android.view.TextureView
import android.view.View
import android.widget.FrameLayout
@@ -126,8 +127,17 @@ open class AnimView @JvmOverloads constructor(context: Context, attrs: Attribute
}
override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int) {
ALog.i(TAG, "onSurfaceTextureSizeChanged $width x $height")
player.onSurfaceTextureSizeChanged(width, height)
Log.i(TAG, "onSurfaceTextureSizeChanged $width x $height")
// player.onSurfaceTextureSizeChanged(width, height)
// 处理宽高为0的情况使用TextureView的实际尺寸
if (width == 0 || height == 0) {
val actualWidth = if (width == 0) innerTextureView?.width ?: width else width
val actualHeight = if (height == 0) innerTextureView?.height ?: height else height
Log.e(TAG, "使用实际尺寸: width=$actualWidth height=$actualHeight")
player.onSurfaceTextureSizeChanged(actualWidth, actualHeight)
} else {
player.onSurfaceTextureSizeChanged(width, height)
}
}
override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {
@@ -146,9 +156,18 @@ open class AnimView @JvmOverloads constructor(context: Context, attrs: Attribute
}
override fun onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int) {
ALog.i(TAG, "onSurfaceTextureAvailable width=$width height=$height")
Log.e(TAG, "onSurfaceTextureAvailable width=$width height=$height")
this.surface = surface
player.onSurfaceTextureAvailable(width, height)
// 处理宽高为0的情况使用TextureView的实际尺寸
if (width == 0 || height == 0) {
val actualWidth = if (width == 0) innerTextureView?.width ?: width else width
val actualHeight = if (height == 0) innerTextureView?.height ?: height else height
Log.e(TAG, "使用实际尺寸: width=$actualWidth height=$actualHeight")
player.onSurfaceTextureAvailable(actualWidth, actualHeight)
} else {
player.onSurfaceTextureAvailable(width, height)
}
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {