├── .env ├── .gitignore ├── .gitlab-ci.yml ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── markdown-navigator-enh.xml ├── markdown-navigator.xml ├── misc.xml ├── modules │ └── native │ │ └── src │ │ └── main │ │ └── cpp │ │ ├── com_example_anative_NativeColorRenderer.h │ │ ├── com_example_anative_NativeColorRenderer_Companion.h │ │ └── com_example_anative_Test.h └── vcs.xml ├── OpenGL ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── opengl │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── sample │ │ │ └── demo1.glsl │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── opengl │ │ │ ├── GLMainActivity.kt │ │ │ ├── camera │ │ │ ├── CameraSize.kt │ │ │ └── ICamera.kt │ │ │ └── sample │ │ │ └── ColorGLActivity.kt │ └── res │ │ ├── layout │ │ ├── activity_color_g_l.xml │ │ └── activity_g_l_main.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── example │ └── opengl │ └── ExampleUnitTest.kt ├── app ├── .gitignore ├── allwins.jks ├── build.gradle ├── proguard-rules.pro ├── release │ ├── app-release.apk │ └── output.json └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cj │ │ └── customwidget │ │ ├── Aes.java │ │ ├── Charset.kt │ │ ├── EncryptUtils.kt │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── cj │ │ │ └── customwidget │ │ │ ├── APP.kt │ │ │ ├── ASMActivity.java │ │ │ ├── MainActivity.kt │ │ │ ├── MainActivity2.kt │ │ │ ├── ScrollingActivity.kt │ │ │ ├── ext │ │ │ ├── CharSequenceExt.kt │ │ │ └── Ext.kt │ │ │ ├── helper │ │ │ ├── IAudioPlay.kt │ │ │ ├── MediaPlayerAudioPlay.kt │ │ │ └── MusicCropWarp.kt │ │ │ ├── page │ │ │ ├── CropMusicActivity.kt │ │ │ ├── LooperRecyclerViewActivity.kt │ │ │ ├── ShadowActivity.kt │ │ │ ├── VideoCropSeekActivity.kt │ │ │ ├── falling │ │ │ │ ├── FallingActivity.kt │ │ │ │ ├── FallingAdapter.kt │ │ │ │ └── RedPackAnim.kt │ │ │ ├── opengl │ │ │ │ ├── CameraReviewActivity.kt │ │ │ │ └── OpenGLActivity.kt │ │ │ ├── viewmodel │ │ │ │ ├── VM1Activity.kt │ │ │ │ ├── VM2Activity.kt │ │ │ │ ├── VMFragment.kt │ │ │ │ ├── VMScope.kt │ │ │ │ ├── ViewModel1.kt │ │ │ │ ├── ViewModel2.kt │ │ │ │ └── ViewModelExt.kt │ │ │ └── viewmodelv2 │ │ │ │ └── ShareViewModel.kt │ │ │ ├── util │ │ │ ├── ActivityGestureHelper.kt │ │ │ ├── CharSequenceExt.kt │ │ │ ├── CompatibleUtil.kt │ │ │ ├── FastBlur.java │ │ │ ├── LogUtils.java │ │ │ ├── MediaUtil.kt │ │ │ └── TestUtil.java │ │ │ └── widget │ │ │ ├── ArcView.kt │ │ │ ├── BlurringView.kt │ │ │ ├── CropSeekBar.kt │ │ │ ├── CustomTextView.kt │ │ │ ├── DateView.kt │ │ │ ├── EventContainerView.kt │ │ │ ├── FallingView.kt │ │ │ ├── LooperLinearLayoutManager.kt │ │ │ ├── LooperLinearLayoutManager2.kt │ │ │ ├── MarqueTextView.kt │ │ │ ├── MarqueeViewGroup.kt │ │ │ ├── MusicCropView.kt │ │ │ ├── PathView.kt │ │ │ ├── RecordProgressButton.kt │ │ │ ├── RecordView.kt │ │ │ ├── ShadowGroup.kt │ │ │ ├── SpreadView2.java │ │ │ ├── StatusView.kt │ │ │ ├── SuffixAutoCompleteView.kt │ │ │ ├── TextSeekBar.kt │ │ │ ├── TopicEditTextView.kt │ │ │ ├── UploadProgressView.kt │ │ │ ├── camera │ │ │ └── CameraInterface.kt │ │ │ ├── event │ │ │ ├── EventView1.kt │ │ │ └── EventView2.kt │ │ │ ├── reader │ │ │ ├── DirectDrawer.java │ │ │ └── RecordRenderer.kt │ │ │ └── videocrop │ │ │ └── VideoCropSeekBar.kt │ └── res │ │ ├── anim │ │ ├── anim_alpha_action_inv.xml │ │ ├── anim_alpha_action_v.xml │ │ ├── anim_dialog_in_from_b.xml │ │ ├── anim_dialog_out_from_b.xml │ │ ├── slide_in_from_bottom.xml │ │ ├── slide_in_from_left.xml │ │ ├── slide_in_from_right.xml │ │ ├── slide_in_from_top.xml │ │ ├── slide_out_to_bottom.xml │ │ ├── slide_out_to_left.xml │ │ ├── slide_out_to_right.xml │ │ └── slide_out_to_top.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── ic_redpack_boom.gif │ │ ├── shape_c7_5.xml │ │ └── shape_email_bg.xml │ │ ├── layout │ │ ├── activity_a_s_m.xml │ │ ├── activity_camera_review.xml │ │ ├── activity_crop_music.xml │ │ ├── activity_falling.xml │ │ ├── activity_g_p_u_image.xml │ │ ├── activity_home.xml │ │ ├── activity_looper_recycler_view.xml │ │ ├── activity_main.xml │ │ ├── activity_main2.xml │ │ ├── activity_main3.xml │ │ ├── activity_main4.xml │ │ ├── activity_open_g_l.xml │ │ ├── activity_record.xml │ │ ├── activity_scrolling.xml │ │ ├── activity_shadow.xml │ │ ├── activity_v_m1.xml │ │ ├── activity_v_m2.xml │ │ ├── activity_video_crop_seek.xml │ │ ├── content_scrolling.xml │ │ ├── dialog_lll.xml │ │ ├── dialog_record_close.xml │ │ ├── fragment_vm.xml │ │ ├── item_redpack.xml │ │ ├── item_text.xml │ │ └── view_date.xml │ │ ├── menu │ │ └── menu_scrolling.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_bg_default.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_moment_thumb.png │ │ ├── ic_readpack.png │ │ ├── ic_readpack2.png │ │ ├── ic_record_pause.png │ │ ├── ic_shoot_beauty_level_bg.png │ │ └── img.jpg │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ ├── audio.mp3 │ │ └── video.mp4 │ │ ├── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml │ │ └── xml │ │ ├── frame_file_paths.xml │ │ └── network_security_config.xml │ └── test │ └── java │ └── com │ └── cj │ └── customwidget │ ├── Bean2.kt │ ├── CountryBean.java │ ├── ExampleUnitTest.kt │ ├── GoodChild.java │ ├── Goods.java │ ├── JavaTest.java │ ├── TestBean.java │ ├── TestParseInnerProValue.java │ ├── UnicodeUtil.java │ ├── code2.json │ └── country.json ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── myPlugin ├── build.gradle └── src │ └── main │ └── resources │ └── META-INF │ └── gradle-plugins │ └── com.luan.plugin.properties ├── native ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── anative │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── cpp │ │ ├── CMakeLists.txt │ │ └── native-color.cpp │ └── java │ │ └── com │ │ └── example │ │ └── anative │ │ └── Testaaa.kt │ └── test │ └── java │ └── com │ └── example │ └── anative │ └── ExampleUnitTest.kt └── settings.gradle /.env: -------------------------------------------------------------------------------- 1 | App_Identifier = "com.xx.xxx" 2 | 3 | # Apple email address 4 | Apple_Id = "xxx@sina.com" 5 | 6 | # TeamId 7 | Team_Id = "xxx" 8 | 9 | # target scheme 10 | Scheme = "xxx" 11 | 12 | # xcodeproj 13 | Xcodeproj ="xxx.xcodeproj" 14 | 15 | # xcworkspace 16 | Workspace="xxx.xcworkspace" 17 | 18 | # ipa输出路径-- Appstore 19 | Appstore_Output_Path = "builds/appstore" 20 | 21 | # ipa输出路径-- 蒲公英 22 | Pgy_Output_Path = "builds/pgy" 23 | 24 | # ipa输出路径-- TestFlight 25 | TF_Output_Path = "./builds/testflight" 26 | 27 | # 蒲公英 的api_key 28 | Pgy_Api_Key = "xxx" 29 | 30 | # 蒲公英 的user_key 31 | Pgy_User_Key = "xxx" 32 | 33 | 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # 就是上文说的stages 2 | stages: 3 | - build_debug # 这里就是一个stage,可以定义多个stage,这个stage就是下面的build_debug 4 | 5 | # 构建之前会执行的脚本,这里导入本地的环境变量 6 | before_script: 7 | - export ANDROID_HOME=/Users/lucas/Library/Android/sdk 8 | - export PATH=$PATH:${ANDROID_HOME}/tools 9 | - export PATH=$PATH:${ANDROID_HOME}/platform-tools 10 | - chmod +x ./gradlew 11 | 12 | # 声明一个名叫build_debug的构建任务 13 | build_debug: 14 | stage: build_debug 15 | # 构建中,执行一些脚本 16 | script: 17 | - ./gradlew --stacktrace assembleDevelopDebug 18 | # 指定监听哪一个分支或什么时候触发Pipeline 19 | only: 20 | - tags #这里tags的作用是当修改gitlab项目tag的时候会触发 21 | - test # 监听GitLab的这个分支 22 | # - master 23 | # 指定由哪一个runner运行 24 | tags: 25 | - dev # 这个dev是上文注册Runner时的tag,和注册时候tag一样的话就会用对应的Runner来执行任务 26 | # 指定成功后应附加到任务的文件和目录的列表 27 | artifacts: 28 | paths: 29 | - app/build/outputs/ 30 | 31 | # 构建完成之后执行的脚本 32 | #after_script: 33 | # - 这里如果是要配合monkey的话,一般在这个地方执行monkey的脚本 34 | 35 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | CustomWidget -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 123 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 25 | 26 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | 44 | 45 | 49 | 50 | -------------------------------------------------------------------------------- /.idea/markdown-navigator-enh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | -------------------------------------------------------------------------------- /.idea/modules/native/src/main/cpp/com_example_anative_NativeColorRenderer.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_example_anative_NativeColorRenderer */ 4 | 5 | #ifndef _Included_com_example_anative_NativeColorRenderer 6 | #define _Included_com_example_anative_NativeColorRenderer 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_example_anative_NativeColorRenderer 12 | * Method: surfaceCreate 13 | * Signature: (I)V 14 | */ 15 | JNIEXPORT void JNICALL Java_com_example_anative_NativeColorRenderer_surfaceCreate 16 | (JNIEnv *, jobject, jint); 17 | 18 | /* 19 | * Class: com_example_anative_NativeColorRenderer 20 | * Method: surfaceChange 21 | * Signature: (II)V 22 | */ 23 | JNIEXPORT void JNICALL Java_com_example_anative_NativeColorRenderer_surfaceChange 24 | (JNIEnv *, jobject, jint, jint); 25 | 26 | /* 27 | * Class: com_example_anative_NativeColorRenderer 28 | * Method: drawFrame 29 | * Signature: (Ljavax/microedition/khronos/opengles/GL10;)V 30 | */ 31 | JNIEXPORT void JNICALL Java_com_example_anative_NativeColorRenderer_drawFrame 32 | (JNIEnv *, jobject, jobject); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif 38 | -------------------------------------------------------------------------------- /.idea/modules/native/src/main/cpp/com_example_anative_NativeColorRenderer_Companion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_example_anative_NativeColorRenderer_Companion */ 4 | 5 | #ifndef _Included_com_example_anative_NativeColorRenderer_Companion 6 | #define _Included_com_example_anative_NativeColorRenderer_Companion 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /.idea/modules/native/src/main/cpp/com_example_anative_Test.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_example_anative_Test */ 4 | 5 | #ifndef _Included_com_example_anative_Test 6 | #define _Included_com_example_anative_Test 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_example_anative_Test 12 | * Method: testaaa 13 | * Signature: (I)Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_com_example_anative_Test_testaaa 16 | (JNIEnv *, jobject, jint); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OpenGL/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /OpenGL/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | } 6 | 7 | android { 8 | compileSdkVersion 30 9 | buildToolsVersion "30.0.2" 10 | 11 | defaultConfig { 12 | minSdkVersion 21 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | consumerProguardFiles "consumer-rules.pro" 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | compileOptions { 28 | sourceCompatibility JavaVersion.VERSION_1_8 29 | targetCompatibility JavaVersion.VERSION_1_8 30 | } 31 | kotlinOptions { 32 | jvmTarget = '1.8' 33 | } 34 | } 35 | 36 | dependencies { 37 | 38 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 39 | implementation 'androidx.core:core-ktx:1.3.2' 40 | implementation 'androidx.appcompat:appcompat:1.2.0' 41 | implementation 'com.google.android.material:material:1.2.1' 42 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 43 | testImplementation 'junit:junit:4.+' 44 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 45 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 46 | 47 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5' 48 | } -------------------------------------------------------------------------------- /OpenGL/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LucasDevelop/CustomView/8870a0ad65a15cd63281931aa1611e773fd84b36/OpenGL/consumer-rules.pro -------------------------------------------------------------------------------- /OpenGL/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /OpenGL/src/androidTest/java/com/example/opengl/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.opengl 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.example.opengl.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /OpenGL/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OpenGL/src/main/assets/sample/demo1.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | uniform mat4 u_mvpMatraix; 3 | in vec4 a_position; 4 | in vec4 a_color; 5 | out vec4 v_color; 6 | void main() { 7 | v_color = a_color; 8 | gl_Position = u_mvpMatraix*a_position; 9 | } 10 | -------------------------------------------------------------------------------- /OpenGL/src/main/java/com/example/opengl/GLMainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.opengl 2 | 3 | import android.content.Intent 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import com.example.opengl.sample.ColorGLActivity 7 | import kotlinx.android.synthetic.main.activity_g_l_main.* 8 | 9 | class GLMainActivity : AppCompatActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContentView(R.layout.activity_g_l_main) 13 | v_color.setOnClickListener{startActivity(Intent(this,ColorGLActivity::class.java))} 14 | } 15 | } -------------------------------------------------------------------------------- /OpenGL/src/main/java/com/example/opengl/camera/CameraSize.kt: -------------------------------------------------------------------------------- 1 | package com.example.opengl.camera 2 | 3 | class CameraSize { 4 | var width = 0 5 | var height = 0 6 | } -------------------------------------------------------------------------------- /OpenGL/src/main/java/com/example/opengl/camera/ICamera.kt: -------------------------------------------------------------------------------- 1 | package com.example.opengl.camera 2 | 3 | import android.hardware.Camera 4 | import android.view.SurfaceView 5 | 6 | interface ICamera { 7 | //摄像头-前后 8 | enum class FACING(val value: Int) { 9 | FRONT(Camera.CameraInfo.CAMERA_FACING_FRONT), 10 | BACK(Camera.CameraInfo.CAMERA_FACING_BACK) 11 | } 12 | 13 | //打开相机 14 | fun open(facing: FACING) 15 | 16 | //开始预览 17 | fun preview() 18 | 19 | //关闭相机 20 | fun close() 21 | 22 | //设置预览界面 23 | fun setPreviewTexture(surfaceView: SurfaceView) 24 | 25 | //获取预览大小 26 | fun getPreviewSize(): CameraSize 27 | 28 | //获取预览方向 29 | fun getRotation():Int 30 | 31 | } -------------------------------------------------------------------------------- /OpenGL/src/main/java/com/example/opengl/sample/ColorGLActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.opengl.sample 2 | 3 | import android.opengl.GLES30 4 | import android.opengl.GLSurfaceView 5 | import androidx.appcompat.app.AppCompatActivity 6 | import android.os.Bundle 7 | import com.example.opengl.R 8 | import javax.microedition.khronos.egl.EGLConfig 9 | import javax.microedition.khronos.opengles.GL10 10 | 11 | class ColorGLActivity : AppCompatActivity() { 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | GLSurfaceView(this).apply { 15 | setContentView(this) 16 | setEGLContextClientVersion(3) 17 | setRenderer(object :GLSurfaceView.Renderer{ 18 | override fun onSurfaceCreated(gl: GL10, config: EGLConfig) { 19 | GLES30.glClearColor(255f,0f,0f,255f) 20 | } 21 | 22 | override fun onSurfaceChanged(gl: GL10?, width: Int, height: Int) { 23 | //设置窗口 24 | GLES30.glViewport(0,0,width,height) 25 | } 26 | 27 | override fun onDrawFrame(gl: GL10?) { 28 | //把颜色缓冲区设置为预设的颜色 29 | GLES30.glClear(GL10.GL_COLOR_BUFFER_BIT) 30 | } 31 | }) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /OpenGL/src/main/res/layout/activity_color_g_l.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /OpenGL/src/main/res/layout/activity_g_l_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 |