签约 充值
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user