From b0cd29958b73c9283152376122094b84411e2ba3 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Sun, 31 Oct 2021 00:18:34 +0800 Subject: [PATCH] see if video file --- .../frank/ffmpeg/activity/VideoHandleActivity.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt index 4dce853..a317f19 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt @@ -50,6 +50,7 @@ class VideoHandleActivity : BaseActivity() { private val outputPath2 = PATH + File.separator + "output2.ts" private val listPath = PATH + File.separator + "listFile.txt" + private var list :List ?= null private var isJointing = false @SuppressLint("HandlerLeak") @@ -107,7 +108,7 @@ class VideoHandleActivity : BaseActivity() { private fun intView() { layoutProgress = getView(R.id.layout_progress) txtProgress = getView(R.id.txt_progress) - val list = listOf( + list = listOf( getString(R.string.video_transform), getString(R.string.video_cut), getString(R.string.video_concat), @@ -136,7 +137,7 @@ class VideoHandleActivity : BaseActivity() { adapter.setOnItemClickListener(object : OnItemClickListener { override fun onItemClick(position: Int) { currentPosition = position - if (getString(R.string.video_from_photo) == list[position]) { + if (getString(R.string.video_from_photo) == (list as List)[position]) { handlePhoto() } else { selectFile() @@ -164,10 +165,11 @@ class VideoHandleActivity : BaseActivity() { if (!FileUtil.checkFileExist(srcFile)) { return } -// if (!FileUtil.isVideo(srcFile)) { -// showToast(getString(R.string.wrong_video_format)) -// return -// } + if (!FileUtil.isVideo(srcFile) + && (list as List)[currentPosition] != getString(R.string.video_zoom)) { + showToast(getString(R.string.wrong_video_format)) + return + } val suffix = FileUtil.getFileSuffix(srcFile) if (suffix == null || suffix.isEmpty()) { return