├── .gitignore
├── .idea
├── .gitignore
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── yk
│ │ └── mediademo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── yk
│ │ │ └── mediademo
│ │ │ ├── MainActivity.java
│ │ │ ├── constants
│ │ │ └── Constants.java
│ │ │ ├── data
│ │ │ ├── adapter
│ │ │ │ ├── FilterAdapter.java
│ │ │ │ ├── FunctionAdapter.java
│ │ │ │ ├── ImageAdapter.java
│ │ │ │ ├── TransitionAdapter.java
│ │ │ │ └── VideoAdapter.java
│ │ │ └── bean
│ │ │ │ ├── Function.java
│ │ │ │ ├── Image.java
│ │ │ │ └── Video.java
│ │ │ ├── ui
│ │ │ ├── activity
│ │ │ │ ├── ImageListActivity.java
│ │ │ │ ├── ImageShowActivity.java
│ │ │ │ ├── ImageTransition2Activity.java
│ │ │ │ ├── ImageTransitionActivity.java
│ │ │ │ ├── PcmActivity.java
│ │ │ │ ├── RecordVideoActivity.java
│ │ │ │ ├── TakePhotoActivity.java
│ │ │ │ ├── TextureViewCameraActivity.java
│ │ │ │ ├── VideoListActivity.java
│ │ │ │ ├── VideoPlayActivity.java
│ │ │ │ ├── VideoShowActivity.java
│ │ │ │ └── YuvActivity.java
│ │ │ ├── base
│ │ │ │ └── IActivityInit.java
│ │ │ └── widget
│ │ │ │ ├── FilterView.java
│ │ │ │ ├── Transition2ListView.java
│ │ │ │ └── TransitionListView.java
│ │ │ └── utils
│ │ │ ├── AlbumUtils.java
│ │ │ ├── FolderUtils.java
│ │ │ ├── FunctionUtils.java
│ │ │ └── LocalMediaUtils.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_image_list.xml
│ │ ├── activity_image_show.xml
│ │ ├── activity_image_transition.xml
│ │ ├── activity_image_transition_2.xml
│ │ ├── activity_main.xml
│ │ ├── activity_pcm.xml
│ │ ├── activity_record_video.xml
│ │ ├── activity_take_photo.xml
│ │ ├── activity_texture_view_camera.xml
│ │ ├── activity_video_list.xml
│ │ ├── activity_video_play.xml
│ │ ├── activity_video_show.xml
│ │ ├── activity_yuv.xml
│ │ ├── item_filter.xml
│ │ ├── item_function.xml
│ │ ├── item_image.xml
│ │ ├── item_transition.xml
│ │ ├── item_video.xml
│ │ ├── view_filter.xml
│ │ └── view_transition.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.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_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── yk
│ └── mediademo
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── media
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── yk
│ │ └── media
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── image
│ │ │ ├── Eason.jpg
│ │ │ ├── Eason2.jpg
│ │ │ ├── Eason3.jpg
│ │ │ └── Eason4.jpg
│ │ └── render
│ │ │ ├── base
│ │ │ ├── base
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── image
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── oes
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ └── transition
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── filter
│ │ │ ├── conveyor_belt_h
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── conveyor_belt_v
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── four_part
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── gaussian_blur
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── gray
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── mean_blur
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── motion_blur
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── nine_part
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── pip
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── retain_frame
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── scale
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── skew
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── three_part
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ └── two_part
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── other
│ │ │ ├── move_line_horizontal
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_line_vertical
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── retain_frame_horizontal
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ └── retain_frame_vertical
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── transition
│ │ │ ├── cut_1
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── cut_2
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── cut_3
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── cut_4
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── flip_horizontal
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── flip_vertical
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── mix
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_down
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_left
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_left_down
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_left_top
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_right
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_right_down
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_right_top
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── move_top
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── page_up
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── pull
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ ├── push
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ └── vortex
│ │ │ │ ├── frag.frag
│ │ │ │ └── vertex.frag
│ │ │ └── transition2
│ │ │ ├── base
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── move
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_center
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_circle
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_down
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_left
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_left_up
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_right
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ ├── wipe_right_down
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ │ │ └── wipe_up
│ │ │ ├── frag.frag
│ │ │ └── vertex.frag
│ └── java
│ │ └── com
│ │ └── yk
│ │ └── media
│ │ ├── core
│ │ ├── camera
│ │ │ ├── Camera1.java
│ │ │ ├── CameraConstants.java
│ │ │ ├── CameraManager.java
│ │ │ ├── CameraUtils.java
│ │ │ ├── ICamera.java
│ │ │ └── OnCameraListener.java
│ │ ├── pcm
│ │ │ ├── PcmDecoder.java
│ │ │ ├── PcmEncoder.java
│ │ │ ├── PcmPlayer.java
│ │ │ └── PcmRecorder.java
│ │ ├── photo
│ │ │ ├── OnPhotoListener.java
│ │ │ ├── PhotoEGL.java
│ │ │ ├── PhotoHelper.java
│ │ │ └── PhotoRender.java
│ │ ├── play
│ │ │ ├── IPlay.java
│ │ │ ├── OnPlayListener.java
│ │ │ └── PlayManager.java
│ │ ├── record
│ │ │ └── video
│ │ │ │ ├── OnRecordListener.java
│ │ │ │ ├── VideoRecorder.java
│ │ │ │ ├── VideoRender.java
│ │ │ │ └── params
│ │ │ │ ├── AudioEncodeParam.java
│ │ │ │ ├── CameraParam.java
│ │ │ │ ├── MicParam.java
│ │ │ │ ├── RecordParam.java
│ │ │ │ └── VideoEncodeParam.java
│ │ ├── videoplay
│ │ │ └── VideoPlayer.java
│ │ └── yuv
│ │ │ ├── YuvDecoder.java
│ │ │ ├── YuvEncoder.java
│ │ │ └── YuvRecord.java
│ │ ├── data
│ │ └── base
│ │ │ └── Size.java
│ │ ├── opengles
│ │ ├── egl
│ │ │ └── EglHelper.java
│ │ ├── render
│ │ │ ├── ImageRender.java
│ │ │ ├── OesRender.java
│ │ │ ├── RenderConstants.java
│ │ │ ├── Renderer.java
│ │ │ ├── Transition2Render.java
│ │ │ ├── TransitionRender.java
│ │ │ ├── base
│ │ │ │ ├── BaseImageRender.java
│ │ │ │ ├── BaseOesRender.java
│ │ │ │ ├── BaseRender.java
│ │ │ │ ├── IRender.java
│ │ │ │ └── OnSurfaceTextureListener.java
│ │ │ ├── bean
│ │ │ │ ├── base
│ │ │ │ │ └── BaseRenderBean.java
│ │ │ │ ├── filter
│ │ │ │ │ ├── GaussianBlurBean.java
│ │ │ │ │ ├── MeanBlurBean.java
│ │ │ │ │ ├── MotionBlurBean.java
│ │ │ │ │ └── ScaleBean.java
│ │ │ │ └── transition
│ │ │ │ │ └── BaseTransitionBean.java
│ │ │ ├── filter
│ │ │ │ ├── BaseFilter.java
│ │ │ │ ├── BlueLineChallengeHFilter.java
│ │ │ │ ├── BlueLineChallengeVFilter.java
│ │ │ │ ├── ConveyorBeltHFilter.java
│ │ │ │ ├── ConveyorBeltVFilter.java
│ │ │ │ ├── FourPartFilter.java
│ │ │ │ ├── GaussianBlurFilter.java
│ │ │ │ ├── GrayFilter.java
│ │ │ │ ├── MeanBlurFilter.java
│ │ │ │ ├── MotionBlurFilter.java
│ │ │ │ ├── NinePartFilter.java
│ │ │ │ ├── PipFilter.java
│ │ │ │ ├── RetainFrameFilter.java
│ │ │ │ ├── ScaleFilter.java
│ │ │ │ ├── SkewFilter.java
│ │ │ │ ├── ThreePartFilter.java
│ │ │ │ └── TwoPartFilter.java
│ │ │ ├── manager
│ │ │ │ ├── RenderManager.java
│ │ │ │ └── RenderProcess.java
│ │ │ ├── other
│ │ │ │ ├── MoveLineHorizontalRender.java
│ │ │ │ ├── MoveLineVerticalRender.java
│ │ │ │ ├── RetainFrameHorizontalRender.java
│ │ │ │ └── RetainFrameVerticalRender.java
│ │ │ ├── transition
│ │ │ │ ├── BlurTransition.java
│ │ │ │ ├── Cut1Transition.java
│ │ │ │ ├── Cut2Transition.java
│ │ │ │ ├── Cut3Transition.java
│ │ │ │ ├── Cut4Transition.java
│ │ │ │ ├── FlipHorizontalTransition.java
│ │ │ │ ├── FlipVerticalTransition.java
│ │ │ │ ├── MixTransition.java
│ │ │ │ ├── MoveDownTransition.java
│ │ │ │ ├── MoveLeftDownTransition.java
│ │ │ │ ├── MoveLeftTransition.java
│ │ │ │ ├── MoveRightDownTransition.java
│ │ │ │ ├── MoveRightTopTransition.java
│ │ │ │ ├── MoveRightTransition.java
│ │ │ │ ├── MoveTopMoveTransition.java
│ │ │ │ ├── MoveTopTransition.java
│ │ │ │ ├── PageUpTransition.java
│ │ │ │ ├── PullTransition.java
│ │ │ │ ├── PushTransition.java
│ │ │ │ ├── VortexTransition.java
│ │ │ │ ├── base
│ │ │ │ │ └── BaseTransition.java
│ │ │ │ └── manager
│ │ │ │ │ └── TransitionManager.java
│ │ │ └── transition2
│ │ │ │ ├── MoveDownTransition.java
│ │ │ │ ├── MoveLeftDownTransition.java
│ │ │ │ ├── MoveLeftTransition.java
│ │ │ │ ├── MoveLeftUpTransition.java
│ │ │ │ ├── MoveRightDownTransition.java
│ │ │ │ ├── MoveRightTransition.java
│ │ │ │ ├── MoveRightUpTransition.java
│ │ │ │ ├── MoveUpTransition.java
│ │ │ │ ├── WipeCenterTransition.java
│ │ │ │ ├── WipeCircleTransition.java
│ │ │ │ ├── WipeDownTransition.java
│ │ │ │ ├── WipeLeftTransition.java
│ │ │ │ ├── WipeLeftUpTransition.java
│ │ │ │ ├── WipeRightDownTransition.java
│ │ │ │ ├── WipeRightTransition.java
│ │ │ │ ├── WipeUpTransition.java
│ │ │ │ ├── base
│ │ │ │ └── BaseTransition.java
│ │ │ │ └── manager
│ │ │ │ └── TransitionManager.java
│ │ └── view
│ │ │ ├── CameraView.java
│ │ │ ├── ImageView.java
│ │ │ ├── Transition2View.java
│ │ │ ├── TransitionView.java
│ │ │ ├── VideoView.java
│ │ │ └── base
│ │ │ └── EGLTextureView.java
│ │ └── utils
│ │ ├── FilterUtils.java
│ │ ├── OpenGLESUtils.java
│ │ ├── Transition2Utils.java
│ │ ├── TransitionUtils.java
│ │ └── YuvUtils.java
│ └── test
│ └── java
│ └── com
│ └── yk
│ └── media
│ └── ExampleUnitTest.java
└── settings.gradle
/.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 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 JYangkai
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdkVersion 30
7 | buildToolsVersion "30.0.3"
8 |
9 | defaultConfig {
10 | applicationId "com.yk.mediademo"
11 | minSdkVersion 21
12 | targetSdkVersion 30
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 |
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | implementation 'com.google.android.material:material:1.1.0'
35 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
36 | implementation project(path: ':media')
37 | testImplementation 'junit:junit:4.+'
38 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
40 |
41 | // Glide
42 | implementation 'com.github.bumptech.glide:glide:4.11.0'
43 | }
--------------------------------------------------------------------------------
/app/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
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/yk/mediademo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.yk.mediademo", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/constants/Constants.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.constants;
2 |
3 | public interface Constants {
4 | interface Function {
5 | String FUNCTION_TEXTURE_VIEW_CAMERA = "TextureView 相机预览";
6 | String FUNCTION_TAKE_PHOTO = "拍照";
7 | String FUNCTION_RECORD_VIDEO = "录像";
8 | String FUNCTION_IMAGE_SHOW = "图片展示";
9 | String FUNCTION_IMAGE_LIST = "图片列表";
10 | String FUNCTION_VIDEO_LIST = "视频列表";
11 | String FUNCTION_IMAGE_TRANSITION = "图片转场";
12 | String FUNCTION_IMAGE_TRANSITION_2 = "图片转场2";
13 | String FUNCTION_PCM = "PCM";
14 | String FUNCTION_YUV = "YUV";
15 | String FUNCTION_VIDEO_PLAY = "视频播放";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/data/adapter/FunctionAdapter.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.data.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.appcompat.widget.AppCompatButton;
12 | import androidx.recyclerview.widget.RecyclerView;
13 |
14 | import com.yk.mediademo.R;
15 | import com.yk.mediademo.data.bean.Function;
16 |
17 | import java.util.List;
18 |
19 | public class FunctionAdapter extends RecyclerView.Adapter {
20 | private static final String TAG = "FunctionAdapter";
21 |
22 | private Context context;
23 |
24 | private final List functionList;
25 |
26 | public FunctionAdapter(List functionList) {
27 | this.functionList = functionList;
28 | }
29 |
30 | @NonNull
31 | @Override
32 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
33 | if (context == null) {
34 | context = parent.getContext();
35 | }
36 | View view = LayoutInflater.from(context).inflate(R.layout.item_function, parent, false);
37 | ViewHolder holder = new ViewHolder(view);
38 | holder.btnEnter.setOnClickListener(new View.OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | int position = holder.getAdapterPosition();
42 | Function function = functionList.get(position);
43 | Log.d(TAG, "onClick: function:" + function);
44 | context.startActivity(new Intent(context, function.getCls()));
45 | }
46 | });
47 | return holder;
48 | }
49 |
50 | @Override
51 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
52 | Function function = functionList.get(position);
53 | holder.btnEnter.setText(function.getName());
54 | }
55 |
56 | @Override
57 | public int getItemCount() {
58 | return functionList.size();
59 | }
60 |
61 | static class ViewHolder extends RecyclerView.ViewHolder {
62 |
63 | AppCompatButton btnEnter;
64 |
65 | public ViewHolder(@NonNull View itemView) {
66 | super(itemView);
67 | btnEnter = itemView.findViewById(R.id.btnEnter);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/data/bean/Function.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.data.bean;
2 |
3 | public class Function {
4 | private String name;
5 | private Class> cls;
6 |
7 | public Function(String name, Class> cls) {
8 | this.name = name;
9 | this.cls = cls;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public void setName(String name) {
17 | this.name = name;
18 | }
19 |
20 | public Class> getCls() {
21 | return cls;
22 | }
23 |
24 | public void setCls(Class> cls) {
25 | this.cls = cls;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "Function{" +
31 | "name='" + name + '\'' +
32 | ", cls=" + cls +
33 | '}';
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/data/bean/Image.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.data.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Image implements Serializable {
6 | private String name;
7 | private String path;
8 |
9 | public Image(String name, String path) {
10 | this.name = name;
11 | this.path = path;
12 | }
13 |
14 | public String getName() {
15 | return name;
16 | }
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public String getPath() {
23 | return path;
24 | }
25 |
26 | public void setPath(String path) {
27 | this.path = path;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "LocalImage{" +
33 | "name='" + name + '\'' +
34 | ", path='" + path + '\'' +
35 | '}';
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/data/bean/Video.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.data.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Video implements Serializable {
6 | private String name;
7 | private String path;
8 |
9 | public Video(String name, String path) {
10 | this.name = name;
11 | this.path = path;
12 | }
13 |
14 | public String getName() {
15 | return name;
16 | }
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public String getPath() {
23 | return path;
24 | }
25 |
26 | public void setPath(String path) {
27 | this.path = path;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "LocalImage{" +
33 | "name='" + name + '\'' +
34 | ", path='" + path + '\'' +
35 | '}';
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/ui/activity/ImageTransitionActivity.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.ui.activity;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.annotation.Nullable;
6 | import androidx.appcompat.app.AppCompatActivity;
7 |
8 | import com.yk.media.opengles.render.bean.base.BaseRenderBean;
9 | import com.yk.media.opengles.view.TransitionView;
10 | import com.yk.mediademo.R;
11 | import com.yk.mediademo.data.adapter.TransitionAdapter;
12 | import com.yk.mediademo.ui.base.IActivityInit;
13 | import com.yk.mediademo.ui.widget.TransitionListView;
14 |
15 | public class ImageTransitionActivity extends AppCompatActivity implements IActivityInit {
16 | private TransitionView transitionView;
17 | private TransitionListView transitionListView;
18 |
19 | private String fileName;
20 | private String fileName2;
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_image_transition);
26 | findView();
27 | initData();
28 | bindEvent();
29 | }
30 |
31 | @Override
32 | public void findView() {
33 | transitionView = findViewById(R.id.transitionView);
34 | transitionListView = findViewById(R.id.transitionListView);
35 | }
36 |
37 | @Override
38 | public void initData() {
39 | fileName = "image/Eason3.jpg";
40 | fileName2 = "image/Eason4.jpg";
41 | }
42 |
43 | @Override
44 | public void bindEvent() {
45 | transitionListView.setOnClickTransitionListener(new TransitionAdapter.OnClickTransitionListener() {
46 | @Override
47 | public void onClickTransition(BaseRenderBean bean) {
48 | transitionView.start(bean);
49 | }
50 | });
51 | }
52 |
53 | @Override
54 | protected void onResume() {
55 | super.onResume();
56 | transitionView.setAssetsFileName(fileName, fileName2);
57 | }
58 |
59 | @Override
60 | protected void onPause() {
61 | super.onPause();
62 | transitionView.stop();
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/ui/activity/VideoShowActivity.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.ui.activity;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.annotation.Nullable;
6 | import androidx.appcompat.app.AppCompatActivity;
7 |
8 | import com.yk.media.opengles.view.VideoView;
9 | import com.yk.mediademo.R;
10 | import com.yk.mediademo.data.bean.Video;
11 | import com.yk.mediademo.ui.base.IActivityInit;
12 |
13 | public class VideoShowActivity extends AppCompatActivity implements IActivityInit {
14 | public static final String EXTRA_VIDEO = "extra_video";
15 |
16 | private VideoView videoView;
17 |
18 | private Video video;
19 |
20 | @Override
21 | protected void onCreate(@Nullable Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_video_show);
24 | findView();
25 | initData();
26 | bindEvent();
27 | }
28 |
29 | @Override
30 | public void findView() {
31 | videoView = findViewById(R.id.videoView);
32 | }
33 |
34 | @Override
35 | public void initData() {
36 | video = (Video) getIntent().getSerializableExtra(EXTRA_VIDEO);
37 | }
38 |
39 | @Override
40 | public void bindEvent() {
41 |
42 | }
43 |
44 | @Override
45 | protected void onResume() {
46 | super.onResume();
47 | if (video != null) {
48 | videoView.play(video.getPath());
49 | }
50 | }
51 |
52 | @Override
53 | protected void onPause() {
54 | super.onPause();
55 | videoView.stop();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/ui/base/IActivityInit.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.ui.base;
2 |
3 | public interface IActivityInit {
4 | void findView();
5 |
6 | void initData();
7 |
8 | void bindEvent();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/utils/FolderUtils.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.utils;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.File;
6 |
7 | public class FolderUtils {
8 | private static final String FOLDER_IMAGE = "folder_image";
9 | private static final String FOLDER_VIDEO = "folder_video";
10 | private static final String FOLDER_AUDIO = "folder_audio";
11 |
12 | public static String getImageFolderPath(Context context) {
13 | return getFolderPath(context, FOLDER_IMAGE);
14 | }
15 |
16 | public static String getVideoFolderPath(Context context) {
17 | return getFolderPath(context, FOLDER_VIDEO);
18 | }
19 |
20 | public static String getAudioFolderPath(Context context) {
21 | return getFolderPath(context, FOLDER_AUDIO);
22 | }
23 |
24 | public static String getFolderPath(Context context, String folder) {
25 | return context.getExternalFilesDir(folder).getPath() + File.separator;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/utils/FunctionUtils.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.utils;
2 |
3 | import com.yk.mediademo.constants.Constants;
4 | import com.yk.mediademo.data.bean.Function;
5 | import com.yk.mediademo.ui.activity.ImageListActivity;
6 | import com.yk.mediademo.ui.activity.ImageShowActivity;
7 | import com.yk.mediademo.ui.activity.ImageTransition2Activity;
8 | import com.yk.mediademo.ui.activity.ImageTransitionActivity;
9 | import com.yk.mediademo.ui.activity.PcmActivity;
10 | import com.yk.mediademo.ui.activity.RecordVideoActivity;
11 | import com.yk.mediademo.ui.activity.TakePhotoActivity;
12 | import com.yk.mediademo.ui.activity.TextureViewCameraActivity;
13 | import com.yk.mediademo.ui.activity.VideoListActivity;
14 | import com.yk.mediademo.ui.activity.VideoPlayActivity;
15 | import com.yk.mediademo.ui.activity.YuvActivity;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | public class FunctionUtils {
21 | public static final List FUNCTION_LIST = new ArrayList<>();
22 |
23 | static {
24 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_TEXTURE_VIEW_CAMERA, TextureViewCameraActivity.class));
25 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_TAKE_PHOTO, TakePhotoActivity.class));
26 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_RECORD_VIDEO, RecordVideoActivity.class));
27 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_IMAGE_SHOW, ImageShowActivity.class));
28 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_IMAGE_LIST, ImageListActivity.class));
29 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_VIDEO_LIST, VideoListActivity.class));
30 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_IMAGE_TRANSITION, ImageTransitionActivity.class));
31 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_IMAGE_TRANSITION_2, ImageTransition2Activity.class));
32 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_PCM, PcmActivity.class));
33 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_YUV, YuvActivity.class));
34 | FUNCTION_LIST.add(new Function(Constants.Function.FUNCTION_VIDEO_PLAY, VideoPlayActivity.class));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/yk/mediademo/utils/LocalMediaUtils.java:
--------------------------------------------------------------------------------
1 | package com.yk.mediademo.utils;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | import com.yk.mediademo.data.bean.Image;
7 | import com.yk.mediademo.data.bean.Video;
8 |
9 | import java.io.File;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class LocalMediaUtils {
14 |
15 | public static List getImageList(Context context) {
16 | String folder = FolderUtils.getImageFolderPath(context);
17 | if (TextUtils.isEmpty(folder)) {
18 | return null;
19 | }
20 | File file = new File(folder);
21 | if (!file.exists()) {
22 | return null;
23 | }
24 | if (!file.isDirectory()) {
25 | return null;
26 | }
27 | File[] files = file.listFiles();
28 | if (files == null || files.length <= 0) {
29 | return null;
30 | }
31 | List list = new ArrayList<>();
32 | for (File file1 : files) {
33 | list.add(new Image(file1.getName(), file1.getAbsolutePath()));
34 | }
35 | return list;
36 | }
37 |
38 | public static List