change listener to kotlin

pull/166/head
xufuji456 4 years ago
parent b493895fbc
commit a72f230e9b
  1. 22
      app/src/main/java/com/frank/ffmpeg/activity/FilterActivity.kt
  2. 15
      app/src/main/java/com/frank/ffmpeg/format/VideoLayout.java
  3. 15
      app/src/main/java/com/frank/ffmpeg/format/VideoLayout.kt
  4. 5
      app/src/main/java/com/frank/ffmpeg/handler/FFmpegHandler.java
  5. 11
      app/src/main/java/com/frank/ffmpeg/listener/OnHandleListener.java
  6. 11
      app/src/main/java/com/frank/ffmpeg/listener/OnHandleListener.kt
  7. 11
      app/src/main/java/com/frank/ffmpeg/listener/OnItemClickListener.java
  8. 11
      app/src/main/java/com/frank/ffmpeg/listener/OnItemClickListener.kt

@ -106,14 +106,16 @@ class FilterActivity : BaseActivity(), SurfaceHolder.Callback {
} }
private fun registerLister() { private fun registerLister() {
horizontalAdapter!!.setOnItemClickListener(OnItemClickListener { position -> horizontalAdapter!!.setOnItemClickListener(object : OnItemClickListener {
if (!surfaceCreated) override fun onItemClick(position: Int) {
return@OnItemClickListener if (!surfaceCreated)
if (!FileUtil.checkFileExist(videoPath)) { return
showSelectFile() if (!FileUtil.checkFileExist(videoPath)) {
return@OnItemClickListener showSelectFile()
return
}
doFilterPlay(position)
} }
doFilterPlay(position)
}) })
surfaceView!!.setOnClickListener { surfaceView!!.setOnClickListener {
@ -167,7 +169,7 @@ class FilterActivity : BaseActivity(), SurfaceHolder.Callback {
super.onDestroy() super.onDestroy()
isPlaying = false isPlaying = false
//FIXME //FIXME
// videoPlayer.release(); // videoPlayer?.release()
videoPlayer = null videoPlayer = null
horizontalAdapter = null horizontalAdapter = null
} }
@ -187,8 +189,8 @@ class FilterActivity : BaseActivity(), SurfaceHolder.Callback {
companion object { companion object {
private val MSG_HIDE = 222 private const val MSG_HIDE = 222
private val DELAY_TIME = 5000 private const val DELAY_TIME = 5000
} }
} }

@ -1,15 +0,0 @@
package com.frank.ffmpeg.format;
/**
* layout of video
* Created by frank on 2018/6/18.
*/
public class VideoLayout {
//horizontal join
public final static int LAYOUT_HORIZONTAL = 1;
//vertical join
public final static int LAYOUT_VERTICAL = 2;
}

@ -0,0 +1,15 @@
package com.frank.ffmpeg.format
/**
* layout of video
* Created by frank on 2018/6/18.
*/
object VideoLayout {
//horizontal join
const val LAYOUT_HORIZONTAL = 1
//vertical join
const val LAYOUT_VERTICAL = 2
}

@ -130,6 +130,11 @@ public class FFmpegHandler {
mHandler.obtainMessage(MSG_BEGIN).sendToTarget(); mHandler.obtainMessage(MSG_BEGIN).sendToTarget();
} }
@Override
public void onProgress(int progress, int duration) {
}
@Override @Override
public void onEnd(int resultCode, String resultMsg) { public void onEnd(int resultCode, String resultMsg) {
Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg); Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg);

@ -1,11 +0,0 @@
package com.frank.ffmpeg.listener;
/**
* listener of FFmpeg processing
* Created by frank on 2019/11/11.
*/
public interface OnHandleListener {
void onBegin();
default void onProgress(int progress, int duration){}
void onEnd(int resultCode, String resultMsg);
}

@ -0,0 +1,11 @@
package com.frank.ffmpeg.listener
/**
* listener of FFmpeg processing
* Created by frank on 2019/11/11.
*/
interface OnHandleListener {
fun onBegin()
fun onProgress(progress: Int, duration: Int)
fun onEnd(resultCode: Int, resultMsg: String)
}

@ -1,11 +0,0 @@
package com.frank.ffmpeg.listener;
/**
* listener of RecyclerView item clicking
* Created by frank on 2018/6/6.
*/
public interface OnItemClickListener {
void onItemClick(int position);
}

@ -0,0 +1,11 @@
package com.frank.ffmpeg.listener
/**
* listener of RecyclerView item clicking
* Created by frank on 2018/6/6.
*/
interface OnItemClickListener {
fun onItemClick(position: Int)
}
Loading…
Cancel
Save