This commit is contained in:
lunaticbum 2026-04-20 17:48:09 +09:00
parent 6813a6bdd7
commit 5b86fc7e2b
5 changed files with 37 additions and 12 deletions

View File

@ -122,6 +122,7 @@
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
android:screenOrientation="sensor" android:screenOrientation="sensor"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:excludeFromRecents="true"
android:exported="false"> android:exported="false">
</activity> </activity>
@ -131,6 +132,7 @@
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:excludeFromRecents="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:exported="false"> android:exported="false">
</activity> </activity>
@ -141,6 +143,7 @@
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
android:screenOrientation="sensor" android:screenOrientation="sensor"
android:excludeFromRecents="true"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:exported="false"> android:exported="false">
</activity> </activity>

View File

@ -754,7 +754,7 @@ function extractSubtitleList() {
if (subList.length > 0) { if (subList.length > 0) {
sendMessage({ sendMessage({
type: "SUBTITLE_LIST_RESULT", type: "SUBTITLE_LIST_RESULT",
list: subList subTitles: subList
}); });
} }
} }

View File

@ -26,7 +26,6 @@ import android.widget.Spinner
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AlertDialog
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
@ -181,25 +180,33 @@ class CompletedFilesFragment : Fragment() {
currentDir = file currentDir = file
loadFiles() loadFiles()
} else { } else {
val intentFlags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
if (extVideos.contains(file.extension.lowercase())) { if (extVideos.contains(file.extension.lowercase())) {
trackFileAccess(file.name) trackFileAccess(file.name)
loadFiles() loadFiles()
val intent = Intent(requireContext(), PlayerActivity::class.java).apply { val intent = Intent(requireContext(), PlayerActivity::class.java).apply {
putExtra("VIDEO_PATH", file.absolutePath) putExtra("VIDEO_PATH", file.absolutePath)
// 💡 기존 인스턴스가 있으면 제거하고 새로 시작
flags = intentFlags
} }
startActivity(intent) startActivity(intent)
} else if(extImages.contains(file.extension.lowercase())) { } else if (extImages.contains(file.extension.lowercase())) {
val intent = Intent(requireContext(), ImageViewerActivity::class.java).apply { val intent = Intent(requireContext(), ImageViewerActivity::class.java).apply {
putExtra("IMAGE_PATH", file.absolutePath) putExtra("IMAGE_PATH", file.absolutePath)
// 💡 이미지 뷰어도 동일하게 적용
flags = intentFlags
} }
startActivity(intent) startActivity(intent)
} else if(extDocs.contains(file.extension.lowercase())) { } else if (extDocs.contains(file.extension.lowercase())) {
val intent = Intent(requireContext(), DocumentViewerActivity::class.java).apply { val intent = Intent(requireContext(), DocumentViewerActivity::class.java).apply {
putExtra("FILE_PATH", file.absolutePath) putExtra("FILE_PATH", file.absolutePath)
// 💡 문서 뷰어도 동일하게 적용
flags = intentFlags
} }
startActivity(intent) startActivity(intent)
} else { } else {
openPrivateFile(requireContext(), file) // 이미지나 문서는 기존처럼 openPrivateFile(requireContext(), file)
} }
} }
} }

View File

@ -654,7 +654,7 @@ open class GeckoWeb @JvmOverloads constructor(
when (msg.type) { when (msg.type) {
"SUBTITLE_LIST_RESULT" -> { "SUBTITLE_LIST_RESULT" -> {
(context as? PlayerActivity)?.let { player -> (context as? PlayerActivity)?.let { player ->
// PlayerActivity에 리스트 전달 Blog.LOGE("msg.subTitles ${msg.subTitles}")
player.runOnUiThread { player.runOnUiThread {
player.showDownSubtitleSelectionDialog(msg.subTitles) player.showDownSubtitleSelectionDialog(msg.subTitles)
} }

View File

@ -1,6 +1,7 @@
package bums.lunatic.launcher.player package bums.lunatic.launcher.player
import android.app.AlertDialog import android.app.AlertDialog
import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.graphics.Color import android.graphics.Color
import android.graphics.SurfaceTexture import android.graphics.SurfaceTexture
@ -501,14 +502,26 @@ class PlayerActivity : AppCompatActivity(), TextureView.SurfaceTextureListener {
} }
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent) // 새로운 인텐트로 교체
// 💡 새로운 비디오 경로를 가져와서 재생 엔진 재설정
videoPath = intent?.getStringExtra("VIDEO_PATH") ?: ""
if (videoPath.isNotEmpty()) {
nativePlayer?.stop()
prepareEngine()
}
}
fun showDownSubtitleSelectionDialog(subList: List<Map<String, String>>) { fun showDownSubtitleSelectionDialog(subList: List<Map<String, String>>) {
val items = subList.map { "[${it["lang"]}] ${it["title"]}" }.toTypedArray() val items = subList.map { item ->
" [${item["lang"]}] ${item["title"]} (${item["size"]})"
}.toTypedArray()
Blog.LOGE("items >> ${items.size}")
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle("자막 선택") .setTitle("자막 선택 (원본 파일명: ${subList[0]["originalFileName"]})")
.setItems(items) { _, which -> .setItems(items) { _, which ->
val selected = subList[which] val selected = subList[which]
val detailUrl = selected["downloadUrl"] val detailUrl = selected["downloadUrl"]
@ -518,6 +531,7 @@ class PlayerActivity : AppCompatActivity(), TextureView.SurfaceTextureListener {
geckoWeb.sendJsonMsg("GO_TO_SUBTITLE_DETAIL", "url" to detailUrl) geckoWeb.sendJsonMsg("GO_TO_SUBTITLE_DETAIL", "url" to detailUrl)
} }
} }
.setNegativeButton("취소", null)
.show() .show()
} }
/** /**
@ -548,6 +562,7 @@ class PlayerActivity : AppCompatActivity(), TextureView.SurfaceTextureListener {
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
geckoWeb.visibility = View.GONE
Toast.makeText(this@PlayerActivity, "자막 저장 완료: ${newSubFile.name}", Toast.LENGTH_SHORT).show() Toast.makeText(this@PlayerActivity, "자막 저장 완료: ${newSubFile.name}", Toast.LENGTH_SHORT).show()
// 1. 플레이어의 자막 경로 업데이트 // 1. 플레이어의 자막 경로 업데이트