diff --git a/.idea/dictionaries/liushilin.xml b/.idea/dictionaries/liushilin.xml index 439f402..2fb2c69 100644 --- a/.idea/dictionaries/liushilin.xml +++ b/.idea/dictionaries/liushilin.xml @@ -1,6 +1,7 @@ + afdd nanchen diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/nanchen/screenrecorder/MainActivity.kt b/app/src/main/java/com/nanchen/screenrecorder/MainActivity.kt index 9c3d42f..0855502 100644 --- a/app/src/main/java/com/nanchen/screenrecorder/MainActivity.kt +++ b/app/src/main/java/com/nanchen/screenrecorder/MainActivity.kt @@ -9,12 +9,12 @@ import android.os.Bundle import android.util.Log import android.widget.Toast import com.blankj.utilcode.util.PathUtils -import com.nanchen.screenrecord.ScreenRecorder +import com.nanchen.screenrecordhelper.ScreenRecordHelper import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { - private var screenRecorder: ScreenRecorder? = null + private var screenRecordHelper: ScreenRecordHelper? = null private val afdd: AssetFileDescriptor by lazy { assets.openFd("test.aac") } override fun onCreate(savedInstanceState: Bundle?) { @@ -23,8 +23,8 @@ class MainActivity : AppCompatActivity() { btnStart.setOnClickListener { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - if (screenRecorder == null) { - screenRecorder = ScreenRecorder(this, object : ScreenRecorder.OnVideoRecordListener { + if (screenRecordHelper == null) { + screenRecordHelper = ScreenRecordHelper(this, object : ScreenRecordHelper.OnVideoRecordListener { override fun onBeforeRecord() { } @@ -42,9 +42,9 @@ class MainActivity : AppCompatActivity() { }, PathUtils.getExternalStoragePath() + "/nanchen") } - screenRecorder?.apply { + screenRecordHelper?.apply { if (!isRecording) { - screenRecorder?.startRecord() + screenRecordHelper?.startRecord() } } } else { @@ -54,7 +54,7 @@ class MainActivity : AppCompatActivity() { btnStop.setOnClickListener { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - screenRecorder?.apply { + screenRecordHelper?.apply { if (isRecording) { if (mediaPlayer != null) { stopRecord(mediaPlayer!!.duration.toLong(), 15 * 1000, afdd) @@ -98,13 +98,13 @@ class MainActivity : AppCompatActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && data != null) { - screenRecorder?.onActivityResult(requestCode, resultCode, data) + screenRecordHelper?.onActivityResult(requestCode, resultCode, data) } } override fun onDestroy() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - screenRecorder?.clearAll() + screenRecordHelper?.clearAll() } afdd.close() super.onDestroy() diff --git a/screenrecord/build.gradle b/screenrecord/build.gradle index 2b74958..b77141e 100644 --- a/screenrecord/build.gradle +++ b/screenrecord/build.gradle @@ -3,8 +3,6 @@ apply plugin: 'kotlin-android' android { compileSdkVersion 28 - - defaultConfig { minSdkVersion 14 targetSdkVersion 28 diff --git a/screenrecord/src/androidTest/java/com/nanchen/screenrecord/ExampleInstrumentedTest.java b/screenrecord/src/androidTest/java/com/nanchen/screenrecordhelper/ExampleInstrumentedTest.java similarity index 94% rename from screenrecord/src/androidTest/java/com/nanchen/screenrecord/ExampleInstrumentedTest.java rename to screenrecord/src/androidTest/java/com/nanchen/screenrecordhelper/ExampleInstrumentedTest.java index 8157c67..1246899 100644 --- a/screenrecord/src/androidTest/java/com/nanchen/screenrecord/ExampleInstrumentedTest.java +++ b/screenrecord/src/androidTest/java/com/nanchen/screenrecordhelper/ExampleInstrumentedTest.java @@ -1,4 +1,4 @@ -package com.nanchen.screenrecord; +package com.nanchen.screenrecordhelper; import android.content.Context; import android.support.test.InstrumentationRegistry; diff --git a/screenrecord/src/main/AndroidManifest.xml b/screenrecord/src/main/AndroidManifest.xml index ff396d6..ad60ea5 100644 --- a/screenrecord/src/main/AndroidManifest.xml +++ b/screenrecord/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.nanchen.screenrecordhelper"> diff --git a/screenrecord/src/main/java/com/nanchen/screenrecord/ScreenRecorder.kt b/screenrecord/src/main/java/com/nanchen/screenrecordhelper/ScreenRecordHelper.kt similarity index 98% rename from screenrecord/src/main/java/com/nanchen/screenrecord/ScreenRecorder.kt rename to screenrecord/src/main/java/com/nanchen/screenrecordhelper/ScreenRecordHelper.kt index f27c410..3ae62b2 100644 --- a/screenrecord/src/main/java/com/nanchen/screenrecord/ScreenRecorder.kt +++ b/screenrecord/src/main/java/com/nanchen/screenrecordhelper/ScreenRecordHelper.kt @@ -1,4 +1,4 @@ -package com.nanchen.screenrecord +package com.nanchen.screenrecordhelper import android.app.Activity import android.content.Context @@ -30,7 +30,7 @@ import java.nio.ByteBuffer * Date: 2019/6/21 15:19 */ @RequiresApi(Build.VERSION_CODES.LOLLIPOP) -class ScreenRecorder @JvmOverloads constructor( +class ScreenRecordHelper @JvmOverloads constructor( private var activity: Activity, private val listener: OnVideoRecordListener?, private var savePath: String = Environment.getExternalStorageDirectory().absolutePath + File.separator @@ -328,7 +328,7 @@ class ScreenRecorder @JvmOverloads constructor( companion object { private const val VIDEO_FRAME_RATE = 30 private const val REQUEST_CODE = 1024 - private const val TAG = "ScreenRecorder" + private const val TAG = "ScreenRecordHelper" } interface OnVideoRecordListener { diff --git a/screenrecord/src/test/java/com/nanchen/screenrecord/ExampleUnitTest.java b/screenrecord/src/test/java/com/nanchen/screenrecordhelper/ExampleUnitTest.java similarity index 89% rename from screenrecord/src/test/java/com/nanchen/screenrecord/ExampleUnitTest.java rename to screenrecord/src/test/java/com/nanchen/screenrecordhelper/ExampleUnitTest.java index e6060fc..94dd000 100644 --- a/screenrecord/src/test/java/com/nanchen/screenrecord/ExampleUnitTest.java +++ b/screenrecord/src/test/java/com/nanchen/screenrecordhelper/ExampleUnitTest.java @@ -1,4 +1,4 @@ -package com.nanchen.screenrecord; +package com.nanchen.screenrecordhelper; import org.junit.Test;