代码拉取完成,页面将自动刷新
同步操作将从 AnJoiner/FFmpegCommand 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package com.coder.ffmpegtest.ui
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.method.ScrollingMovementMethod
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.coder.ffmpeg.annotation.CodecAttribute
import com.coder.ffmpeg.jni.FFmpegCommand
import com.coder.ffmpegtest.R
import com.coder.ffmpegtest.model.CommandBean
import com.coder.ffmpegtest.ui.adapter.FFmpegCommandAdapter
import java.util.ArrayList
/**
*
* @author: AnJoiner
* @datetime: 20-11-14
*/
class KFFmpegCodecActivity : AppCompatActivity(){
private var mRecyclerView: RecyclerView? = null
private var tvContent: TextView? = null
private var mAdapter: FFmpegCommandAdapter? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_ffmpeg_codec)
init()
}
private fun init() {
initView()
initData()
initListener()
}
private fun initView() {
mRecyclerView = findViewById(R.id.rv)
tvContent = findViewById(R.id.tv_content)
tvContent?.movementMethod = ScrollingMovementMethod.getInstance();
}
private fun initData() {
val commands = this.resources.getStringArray(R.array.codecs)
val beans: MutableList<CommandBean> = ArrayList()
for (i in commands.indices) {
beans.add(CommandBean(commands[i], i))
}
mAdapter = FFmpegCommandAdapter(beans)
mRecyclerView!!.layoutManager = GridLayoutManager(this, 3)
mRecyclerView!!.adapter = mAdapter
}
private fun initListener() {
mAdapter!!.setItemClickListener (object : FFmpegCommandAdapter.ItemClickListener {
override fun itemClick(id: Int) {
when (id) {
0 -> enCodecs()
1 -> deCodecs()
2 -> audioCodecs()
3 -> audioDeCodecs()
4 -> videoCodecs()
5 -> videoDeCodecs()
6 -> otherCodecs()
7 -> otherDeCodecs()
}
}
})
}
private fun enCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.ENCODE)
}
private fun deCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.DECODE)
}
private fun audioCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.ENCODE_AUDIO)
}
private fun audioDeCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.DECODE_AUDIO)
}
private fun videoCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.ENCODE_VIDEO)
}
private fun videoDeCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.DECODE_VIDEO)
}
private fun otherCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.ENCODE_OTHER)
}
private fun otherDeCodecs(){
tvContent?.text = FFmpegCommand.getSupportCodec(CodecAttribute.DECODE_OTHER)
}
companion object{
fun start(context: Context){
val intent = Intent(context,KFFmpegCodecActivity::class.java)
context.startActivity(intent)
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。