This commit is contained in:
lunaticbum 2026-04-21 14:02:33 +09:00
parent c8000d022c
commit fd0ee96c04
2 changed files with 3 additions and 38 deletions

View File

@ -884,7 +884,7 @@ class CompletedFilesFragment : Fragment() {
}
// [단계 2] 특수 폴더 정리 및 잔여 파일 trash 이동
val subtitleExts = setOf("srt", "smi", "ass", "vtt", "txt")
val subtitleExts = setOf("srt", "smi", "ass", "vtt")
val protectedDirs = setOf("Images", "Videos", "Documents", "Etc", "trash", "Youtube")
rootDir.listFiles()?.filter { it.isDirectory && !protectedDirs.contains(it.name) }?.forEach { folder ->
@ -901,11 +901,9 @@ class CompletedFilesFragment : Fragment() {
videoFiles.forEach { videoFile ->
if (videoFile.renameTo(File(videoTargetDir, videoFile.name))) {
movedCount++
val videoNameOnly = videoFile.nameWithoutExtension
potentialSubtitles.forEach { subFile ->
// if (subFile.nameWithoutExtension.startsWith(videoNameOnly)) {
if (subFile.renameTo(File(videoTargetDir, subFile.name))) movedCount++
// }
}
}
}
@ -1164,40 +1162,7 @@ class CompletedFilesAdapter(
Glide.with(itemView.context).load(file).placeholder(android.R.drawable.ic_menu_report_image).into(ivThumb)
}
}
var localPlayer: NativePlayer? = null
val textureView = itemView.findViewById<TextureView>(R.id.previewTextureView)
ivThumb?.setOnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
// 💡 0.5초 뒤에도 누르고 있다면 재생 시작
v.postDelayed({
if (v.isPressed && extVideos.contains(file.extension.lowercase())) {
textureView.visibility = View.VISIBLE
localPlayer = NativePlayer().apply {
initialize()
val pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY)
setDataSource(pfd.detachFd(), -1)
onPreparedListener = {
seekTo(60.0) // 1분 지점
play(Surface(textureView.surfaceTexture))
}
prepareAsync()
}
}
}, 500)
}
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
// 💡 손을 떼면 즉시 뷰 숨기고 플레이어 파괴
v.isPressed = false
textureView.visibility = View.GONE
localPlayer?.stop()
localPlayer?.destroy()
localPlayer = null
}
}
true // 이벤트를 소비하여 롱클릭/클릭 충돌 방지 (필요 시 조정)
}
itemView.setOnClickListener { onItemClick(file) }
itemView.setOnLongClickListener {
if (file.name != "..") onItemLongClick(file)

View File

@ -327,7 +327,7 @@ class MyWallpaperService : WallpaperService() {
}
val requiredSizeRatio = 0.4
val requiredSizeRatio = 0.5
private fun getVideoSize(file: File): Pair<Int, Int>? {
val retriever = android.media.MediaMetadataRetriever()