├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── README_ZH.md
├── ScreenShot.PNG
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── huawei
│ │ └── image
│ │ └── render
│ │ └── sample
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── AlphaAnimation
│ │ │ ├── aixin7.png
│ │ │ ├── bj.jpg
│ │ │ └── manifest.xml
│ │ ├── DropPhysicalView
│ │ │ ├── background.jpg
│ │ │ ├── jinbi.png
│ │ │ ├── manifest.xml
│ │ │ ├── shiwu.png
│ │ │ └── xx.png
│ │ ├── FlipBook
│ │ │ ├── bg1.jpg
│ │ │ ├── bg2.jpg
│ │ │ ├── bg3.jpg
│ │ │ ├── front.jpg
│ │ │ └── manifest.xml
│ │ ├── Marquee
│ │ │ ├── bj.jpg
│ │ │ └── manifest.xml
│ │ ├── MeshImage
│ │ │ ├── background.jpg
│ │ │ ├── manifest.xml
│ │ │ └── part.png
│ │ ├── Paint
│ │ │ ├── bg.jpg
│ │ │ ├── manifest.xml
│ │ │ ├── part.png
│ │ │ └── part_2.png
│ │ ├── ParticleScatter
│ │ │ ├── bj.jpg
│ │ │ ├── manifest.xml
│ │ │ └── maojiao.png
│ │ ├── ParticleView
│ │ │ ├── background.jpg
│ │ │ ├── manifest.xml
│ │ │ └── particle.png
│ │ ├── PositionAnimation
│ │ │ ├── bj.jpg
│ │ │ ├── manifest.xml
│ │ │ └── ty.png
│ │ ├── RotateView
│ │ │ ├── 1.jpg
│ │ │ ├── bj.jpg
│ │ │ └── manifest.xml
│ │ ├── RotationAnimation
│ │ │ ├── bj.jpg
│ │ │ ├── manifest.xml
│ │ │ └── ty.png
│ │ ├── SizeAnimation
│ │ │ ├── default_background.jpg
│ │ │ ├── manifest.xml
│ │ │ └── ty.png
│ │ ├── SourcesAnimation
│ │ │ ├── bj.jpg
│ │ │ ├── manifest.xml
│ │ │ ├── zuida1_1.png
│ │ │ ├── zuida1_2.png
│ │ │ ├── zuida1_3.png
│ │ │ ├── zuida1_4.png
│ │ │ └── zuida1_5.png
│ │ └── WaterWallpaper
│ │ │ ├── background.jpg
│ │ │ └── manifest.xml
│ ├── ic_launcher-playstore.png
│ ├── java
│ │ └── com
│ │ │ └── huawei
│ │ │ └── image
│ │ │ └── render
│ │ │ └── sample
│ │ │ ├── activity
│ │ │ ├── ImageKitRenderDemoActivity.kt
│ │ │ └── ImageKitRenderDemoActivity1.kt
│ │ │ └── util
│ │ │ └── Utils.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_entries.xml
│ │ ├── activity_image_kit_demo.xml
│ │ ├── activity_image_kit_demo_1.xml
│ │ ├── activity_main.xml
│ │ └── recycler_view.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── values-zh-rCN
│ │ └── strings.xml
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── huawei
│ └── image
│ └── render
│ └── sample
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── render.gif
└── 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 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/.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 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## HUAWEI Image Kit Render Sample for Kotlin
2 |
3 | English | [中文](README_ZH.md)
4 |
5 | ## Table of Contents
6 |
7 | * [Introduction](#introduction)
8 | * [Getting Started](#getting-started)
9 | * [Supported Environments](#supported-environments)
10 | * [Result](#result)
11 | * [License](#license)
12 |
13 | ## Introduction
14 | The Image Render service provides basic and advanced animation effects to help you reproduce image contents in an efficient way. This sample code encapsulates APIs of the HUAWEI Image Kit Render Service, it provides a sample programs for your reference or usage.
15 |
16 | 1. Supports five basic animations and any of their combination.
17 |
18 | 2. Provides nine advanced animation effects, bringing more fun to user interactions.
19 |
20 | For details, please refer to [XML Syntax Specifications for Image Render](https://developer.huawei.com/consumer/en/doc/development/Media-Guides/xml-introduction-0000001050439245?ha_source=hms1).
21 |
22 | ## Getting Started
23 | 1. Check whether the Android studio development environment is ready. Open the sample code project directory with file "build.gradle" in Android Studio. Run TestApp on your divice or simulator which have installed latest Huawei Mobile Service(HMS).
24 | 2. Register a [HUAWEI account](https://developer.huawei.com/consumer/en/).
25 | 3. Create an app and configure the app information in AppGallery Connect.
26 | See details: [HUAWEI Image Service Development Preparation](https://developer.huawei.com/consumer/en/doc/development/Media-Guides/config-agc-0000001050199019?ha_source=hms1)
27 | 4. To build this demo, please first import the demo in the Android Studio (3.x+).
28 | 5. Run the sample on your Android device or emulator.
29 |
30 | ## Supported Environments
31 | - Android Studio 3.0 or later.
32 |
33 | - Java SDK 1.8 or later.
34 |
35 | - Android SDK version is 26 or later.
36 |
37 | - Gradle 3.3.2.
38 |
39 | - HMS Core (APK) 4.0.2.300 or later(applicable to the SDK, but not the fallback-SDK).
40 |
41 |
42 | ## Result
43 |
44 |
45 |
46 | ## License
47 |
48 | ImageRenderSample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
49 |
--------------------------------------------------------------------------------
/README_ZH.md:
--------------------------------------------------------------------------------
1 | # 华为图像服务场景动效Kotlin示例代码
2 |
3 | [English](README.md) | 中文
4 |
5 | ## 目录
6 |
7 | * [简介](#简介)
8 | * [开发准备](#开发准备)
9 | * [环境要求](#环境要求)
10 | * [运行结果](#运行结果)
11 | * [授权许可](#授权许可)
12 |
13 | ## 简介
14 | 场景动效服务提供基础动效和高级动效,帮助您实现图片内容高效再生产。本示例代码对华为图像服务场景动效接口进行封装,包含丰富的示例程序,方便您参考或直接使用。
15 |
16 | 1. 提供5种基础动效,并支持多动效叠加使用。
17 |
18 | 2. 提供9种效果炫酷的高级动效,并支持用户交互。
19 |
20 | 更多信息请参见[场景动效xml规范说明文档](https://developer.huawei.com/consumer/cn/doc/development/Media-Guides/xml-introduction-0000001050439245?ha_source=hms1).
21 |
22 | ## 开发准备
23 | 1. 检查Android Studio开发环境是否就绪。将示例工程导入Android Studio(3.0及以上版本)中。
24 | 2. 在Android Studio中打开示例工程项目级build.gradle文件,并在您已安装最新版华为移动服务的设备或模拟器上运行测试应用。
25 | 3. 注册[华为帐号](https://developer.huawei.com/consumer/cn/)。
26 | 4. 创建应用并在AppGallery Connect中配置相关信息。具体请参考[开发准备](https://developer.huawei.com/consumer/cn/doc/development/Media-Guides/config-agc-0000001050199019?ha_source=hms1)。
27 | 5. 在Android设备或模拟器上运行您的应用。
28 |
29 | ## 环境要求
30 | - Android Studio 3.0及以上
31 |
32 | - JDK 1.8及以上
33 |
34 | - Android SDK 26及以上
35 |
36 | - Gradle 3.3.2
37 |
38 | - HMS Core (APK) 4.0.2.300及以上(仅依赖SDK情况下需要满足此要求,fallback-SDK无此要求)
39 |
40 |
41 | ## 运行结果
42 |
43 |
44 |
45 | ## 技术支持
46 | 如果您对HMS Core还处于评估阶段,可在[Reddit社区](https://www.reddit.com/r/HuaweiDevelopers/)获取关于HMS Core的最新讯息,并与其他开发者交流见解。
47 |
48 | 如果您对使用HMS示例代码有疑问,请尝试:
49 | - 开发过程遇到问题上[Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services),在`huawei-mobile-services`标签下提问,有华为研发专家在线一对一解决您的问题。
50 | - 到[华为开发者论坛](https://developer.huawei.com/consumer/cn/forum/blockdisplay?fid=18) HMS Core板块与其他开发者进行交流。
51 |
52 | 如果您在尝试示例代码中遇到问题,请向仓库提交[issue](https://github.com/HMS-Core/hms-image-render-java/issues),也欢迎您提交[Pull Request](https://github.com/HMS-Core/hms-image-render-java/pulls)。
53 |
54 | ## 授权许可
55 | 场景动效Java示例代码经过[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0)授权许可。
56 |
--------------------------------------------------------------------------------
/ScreenShot.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/ScreenShot.PNG
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'com.huawei.agconnect'
5 |
6 | android {
7 | compileSdkVersion 28
8 | buildToolsVersion "28.0.3"
9 | defaultConfig {
10 | applicationId "com.huawei.image.render.sample"
11 | minSdkVersion 26
12 | targetSdkVersion 28
13 | versionCode 1
14 | versionName "1.0"
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | lintOptions {
23 | abortOnError false
24 | }
25 | }
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: 'libs', include: ['*.jar'])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
31 | implementation 'com.android.support:appcompat-v7:28.0.0'
32 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
33 | testImplementation 'junit:junit:4.12'
34 | implementation('com.huawei.hms:image-render:1.0.3.301')
35 | implementation('com.huawei.hms:image-render-fallback:1.0.3.301')
36 | }
37 |
--------------------------------------------------------------------------------
/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
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/huawei/image/render/sample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.huawei.image.render.sample
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.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.getTargetContext()
22 | assertEquals("com.huawei.image.render.sample", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/assets/AlphaAnimation/aixin7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/AlphaAnimation/aixin7.png
--------------------------------------------------------------------------------
/app/src/main/assets/AlphaAnimation/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/AlphaAnimation/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/AlphaAnimation/manifest.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 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/assets/DropPhysicalView/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/DropPhysicalView/background.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/DropPhysicalView/jinbi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/DropPhysicalView/jinbi.png
--------------------------------------------------------------------------------
/app/src/main/assets/DropPhysicalView/manifest.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 |
26 |
27 |
28 |
29 |
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/assets/DropPhysicalView/shiwu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/DropPhysicalView/shiwu.png
--------------------------------------------------------------------------------
/app/src/main/assets/DropPhysicalView/xx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/DropPhysicalView/xx.png
--------------------------------------------------------------------------------
/app/src/main/assets/FlipBook/bg1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/FlipBook/bg1.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/FlipBook/bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/FlipBook/bg2.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/FlipBook/bg3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/FlipBook/bg3.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/FlipBook/front.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/FlipBook/front.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/FlipBook/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/assets/Marquee/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/Marquee/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/Marquee/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/assets/MeshImage/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/MeshImage/background.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/MeshImage/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/assets/MeshImage/part.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/MeshImage/part.png
--------------------------------------------------------------------------------
/app/src/main/assets/Paint/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/Paint/bg.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/Paint/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/assets/Paint/part.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/Paint/part.png
--------------------------------------------------------------------------------
/app/src/main/assets/Paint/part_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/Paint/part_2.png
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleScatter/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/ParticleScatter/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleScatter/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleScatter/maojiao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/ParticleScatter/maojiao.png
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleView/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/ParticleView/background.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleView/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/assets/ParticleView/particle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/ParticleView/particle.png
--------------------------------------------------------------------------------
/app/src/main/assets/PositionAnimation/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/PositionAnimation/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/PositionAnimation/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/assets/PositionAnimation/ty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/PositionAnimation/ty.png
--------------------------------------------------------------------------------
/app/src/main/assets/RotateView/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/RotateView/1.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/RotateView/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/RotateView/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/RotateView/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/assets/RotationAnimation/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/RotationAnimation/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/RotationAnimation/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/assets/RotationAnimation/ty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/RotationAnimation/ty.png
--------------------------------------------------------------------------------
/app/src/main/assets/SizeAnimation/default_background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SizeAnimation/default_background.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/SizeAnimation/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/assets/SizeAnimation/ty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SizeAnimation/ty.png
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/bj.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/bj.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/zuida1_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/zuida1_1.png
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/zuida1_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/zuida1_2.png
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/zuida1_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/zuida1_3.png
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/zuida1_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/zuida1_4.png
--------------------------------------------------------------------------------
/app/src/main/assets/SourcesAnimation/zuida1_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/SourcesAnimation/zuida1_5.png
--------------------------------------------------------------------------------
/app/src/main/assets/WaterWallpaper/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/assets/WaterWallpaper/background.jpg
--------------------------------------------------------------------------------
/app/src/main/assets/WaterWallpaper/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/huawei/image/render/sample/activity/ImageKitRenderDemoActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package com.huawei.image.render.sample.activity
17 |
18 | import android.Manifest
19 | import android.app.Activity
20 | import android.content.Intent
21 | import android.content.pm.PackageManager
22 | import android.os.Bundle
23 | import android.os.Environment
24 | import android.support.v4.app.ActivityCompat
25 | import android.support.v4.content.ContextCompat
26 | import android.util.Log
27 | import android.view.View
28 | import android.view.WindowManager
29 | import android.widget.*
30 | import android.widget.AdapterView.OnItemSelectedListener
31 | import com.huawei.hms.image.render.*
32 | import com.huawei.hms.image.render.ImageRender.RenderCallBack
33 | import com.huawei.image.render.sample.R
34 | import com.huawei.image.render.sample.activity.ImageKitRenderDemoActivity
35 | import com.huawei.image.render.sample.util.Utils
36 | import org.json.JSONException
37 | import org.json.JSONObject
38 | import java.io.File
39 | import java.io.FileOutputStream
40 | import java.io.IOException
41 | import java.util.*
42 |
43 | /**
44 | * The ImageRenderSample code provides examples of initializing the service, obtaining views, playing animation, pausing animation, and destroying resources.
45 | *
46 | * @author huawei
47 | * @since 5.0.0
48 | */
49 | class ImageKitRenderDemoActivity : Activity() {
50 | /**
51 | * Layout container
52 | */
53 | private var contentView: FrameLayout? = null
54 |
55 | // imageRender object
56 | private var imageRenderAPI: ImageRenderImpl? = null
57 | private var sourcePath: String? = null
58 | private var textProgress: TextView? = null
59 | private var mCurrentDemo: String? = null
60 | private var marqueeVis = 1
61 | private var hashCode: String? = null
62 | override fun onCreate(savedInstanceState: Bundle?) {
63 | super.onCreate(savedInstanceState)
64 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
65 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
66 | window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
67 | setContentView(R.layout.activity_image_kit_demo)
68 | sourcePath =
69 | filesDir.path + File.separator + SOURCE_PATH
70 | initView()
71 | val permissionCheck = ContextCompat.checkSelfPermission(
72 | this@ImageKitRenderDemoActivity,
73 | Manifest.permission.WRITE_EXTERNAL_STORAGE
74 | )
75 | if (permissionCheck == PackageManager.PERMISSION_GRANTED) {
76 | initData()
77 | initImageRender()
78 | } else {
79 | ActivityCompat.requestPermissions(
80 | this@ImageKitRenderDemoActivity,
81 | arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
82 | PERMISSION_REQUEST_CODE
83 | )
84 | }
85 | }
86 |
87 | /**
88 | * Initialize the view.
89 | */
90 | private fun initView() {
91 | contentView = findViewById(R.id.content)
92 | textProgress = findViewById(R.id.text_progress)
93 | val spinner =
94 | findViewById(R.id.spinner_animations)
95 | spinner.onItemSelectedListener = object : OnItemSelectedListener {
96 | override fun onItemSelected(
97 | parent: AdapterView<*>?,
98 | view: View,
99 | position: Int,
100 | id: Long
101 | ) {
102 | mCurrentDemo = spinner.adapter.getItem(position).toString()
103 | changeAnimation(mCurrentDemo!!)
104 | }
105 |
106 | override fun onNothingSelected(parent: AdapterView<*>?) {}
107 | }
108 | }
109 |
110 | /**
111 | * change the animation which is choose in spinner
112 | * @param animationName animationName
113 | */
114 | private fun changeAnimation(animationName: String) {
115 | if (!Utils.copyAssetsFilesToDirs(
116 | this,
117 | animationName,
118 | sourcePath.toString()
119 | )
120 | ) {
121 | Log.e(
122 | TAG,
123 | "copy files failure, please check permissions"
124 | )
125 | return
126 | }
127 | if (imageRenderAPI == null) {
128 | Log.e(
129 | TAG,
130 | "initRemote fail, please check kit version"
131 | )
132 | return
133 | }
134 | if (contentView!!.childCount > 0) {
135 | imageRenderAPI!!.removeRenderView()
136 | contentView!!.removeAllViews()
137 | addView()
138 | }
139 | }
140 |
141 | /**
142 | * Create default resources.
143 | * You can compile the manifest.xml file and image resource file. The code is for reference only.
144 | */
145 | private fun initData() {
146 | // Absolute path of the resource files.
147 | if (!Utils.createResourceDirs(sourcePath)) {
148 | Log.e(
149 | TAG,
150 | "Create dirs fail, please check permission"
151 | )
152 | }
153 | if (!Utils.copyAssetsFileToDirs(
154 | this,
155 | "AlphaAnimation" + File.separator + "aixin7.png",
156 | sourcePath + File.separator + "aixin7.png"
157 | )
158 | ) {
159 | Log.e(
160 | TAG,
161 | "Copy resource file fail, please check permission"
162 | )
163 | }
164 | if (!Utils.copyAssetsFileToDirs(
165 | this,
166 | "AlphaAnimation" + File.separator + "bj.jpg",
167 | sourcePath + File.separator + "bj.jpg"
168 | )
169 | ) {
170 | Log.e(
171 | TAG,
172 | "Copy resource file fail, please check permission"
173 | )
174 | }
175 | if (!Utils.copyAssetsFileToDirs(
176 | this,
177 | "AlphaAnimation" + File.separator + "manifest.xml",
178 | sourcePath + File.separator + "manifest.xml"
179 | )
180 | ) {
181 | Log.e(
182 | TAG,
183 | "Copy resource file fail, please check permission"
184 | )
185 | }
186 | }
187 |
188 | /**
189 | * Use the ImageRender API.
190 | */
191 | private fun initImageRender() {
192 | // Obtain an ImageRender object.
193 | ImageRender.getInstance(this, object : RenderCallBack {
194 | override fun onSuccess(imageRender: ImageRenderImpl) {
195 | Log.i(
196 | TAG,
197 | "getImageRenderAPI success"
198 | )
199 | imageRenderAPI = imageRender
200 | useImageRender()
201 | }
202 |
203 | override fun onFailure(i: Int) {
204 | Log.e(
205 | TAG,
206 | "getImageRenderAPI failure, errorCode = $i"
207 | )
208 | }
209 | })
210 | }
211 |
212 | /**
213 | * The Image Render service is required.
214 | */
215 | private fun useImageRender() {
216 | if (imageRenderAPI == null) {
217 | Log.e(
218 | TAG,
219 | "initRemote fail, please check kit version"
220 | )
221 | return
222 | }
223 | addView()
224 | }
225 |
226 | private fun addView() {
227 | // Initialize the ImageRender object.
228 | val initResult = imageRenderAPI!!.doInit(
229 | sourcePath,
230 | Utils.authJson
231 | )
232 | Log.i(
233 | TAG,
234 | "DoInit result == $initResult"
235 | )
236 | if (initResult == 0) {
237 | // Obtain the rendered view.
238 | val renderView = imageRenderAPI!!.renderView
239 | if (renderView.getResultCode() == ResultCode.SUCCEED) {
240 | val view = renderView.getView()
241 | if (null != view) {
242 | // Add the rendered view to the layout.
243 | contentView!!.addView(view)
244 | hashCode = view.hashCode().toString()
245 | } else {
246 | Log.w(
247 | TAG,
248 | "GetRenderView fail, view is null"
249 | )
250 | }
251 | } else if (renderView.getResultCode() == ResultCode.ERROR_GET_RENDER_VIEW_FAILURE) {
252 | Log.w(TAG, "GetRenderView fail")
253 | } else if (renderView.getResultCode() == ResultCode.ERROR_XSD_CHECK_FAILURE) {
254 | Log.w(
255 | TAG,
256 | "GetRenderView fail, resource file parameter error, please check resource file."
257 | )
258 | } else if (renderView.getResultCode() == ResultCode.ERROR_VIEW_PARSE_FAILURE) {
259 | Log.w(
260 | TAG,
261 | "GetRenderView fail, resource file parsing failed, please check resource file."
262 | )
263 | } else if (renderView.getResultCode() == ResultCode.ERROR_REMOTE) {
264 | Log.w(
265 | TAG,
266 | "GetRenderView fail, remote call failed, please check HMS service"
267 | )
268 | } else if (renderView.getResultCode() == ResultCode.ERROR_DOINIT) {
269 | Log.w(
270 | TAG,
271 | "GetRenderView fail, init failed, please init again"
272 | )
273 | }
274 | } else {
275 | Log.w(
276 | TAG,
277 | "Do init fail, errorCode == $initResult"
278 | )
279 | }
280 | }
281 |
282 | override fun onDestroy() {
283 | // Destroy the view.
284 | if (null != imageRenderAPI) {
285 | imageRenderAPI!!.removeRenderView()
286 | }
287 | super.onDestroy()
288 | }
289 |
290 | override fun onResume() {
291 | super.onResume()
292 | Log.i(TAG, "onResume")
293 | if (null != imageRenderAPI) {
294 | imageRenderAPI!!.bindRenderView(
295 | sourcePath,
296 | Utils.authJson,
297 | object : IBindCallBack {
298 | override fun onBind(renderView: RenderView, i: Int) {
299 | if (renderView != null) {
300 | if (renderView.getResultCode() == ResultCode.SUCCEED) {
301 | val view = renderView.getView()
302 | if (null != view) {
303 | contentView!!.addView(view)
304 | hashCode = view.hashCode().toString()
305 | }
306 | }
307 | }
308 | }
309 |
310 | override fun onParseEnd() {}
311 | })
312 | }
313 | }
314 |
315 | /**
316 | * Play the animation.
317 | *
318 | * @param view button
319 | */
320 | fun startAnimation(view: View?) {
321 | // Play the rendered view.
322 | Log.i(TAG, "Start animation")
323 | if (null != imageRenderAPI) {
324 | val playResult = imageRenderAPI!!.playAnimation()
325 | if (playResult == ResultCode.SUCCEED) {
326 | Log.i(
327 | TAG,
328 | "Start animation success"
329 | )
330 | } else {
331 | Log.i(
332 | TAG,
333 | "Start animation failure"
334 | )
335 | }
336 | } else {
337 | Log.w(
338 | TAG,
339 | "Start animation fail, please init first."
340 | )
341 | }
342 | }
343 |
344 | /**
345 | * Stop the animation.
346 | *
347 | * @param view button
348 | */
349 | fun stopAnimation(view: View?) {
350 | // Stop the renderView animation.
351 | Log.i(TAG, "Stop animation")
352 | if (null != imageRenderAPI) {
353 | val playResult = imageRenderAPI!!.stopAnimation()
354 | if (playResult == ResultCode.SUCCEED) {
355 | Log.i(
356 | TAG,
357 | "Stop animation success"
358 | )
359 | } else {
360 | Log.i(
361 | TAG,
362 | "Stop animation failure"
363 | )
364 | }
365 | } else {
366 | Log.w(
367 | TAG,
368 | "Stop animation fail, please init first."
369 | )
370 | }
371 | }
372 |
373 | /**
374 | * Pause animation
375 | *
376 | * @param view button
377 | */
378 | fun pauseAnimation(view: View?) {
379 | if (imageRenderAPI != null) {
380 | val result = imageRenderAPI!!.pauseAnimation(true)
381 | Log.d(
382 | TAG,
383 | "pauseAnimation result == $result"
384 | )
385 | }
386 | }
387 |
388 | /**
389 | * Resume animation
390 | *
391 | * @param view button
392 | */
393 | fun resumeAnimation(view: View?) {
394 | if (imageRenderAPI != null) {
395 | val result = imageRenderAPI!!.resumeAnimation()
396 | Log.d(
397 | TAG,
398 | "resumeAnimation result == $result"
399 | )
400 | }
401 | }
402 |
403 | /**
404 | * Set variable value
405 | *
406 | * @param view button
407 | */
408 | fun setVariable(view: View?) {
409 | if ("Marquee" == mCurrentDemo) {
410 | marqueeVis = 1 - marqueeVis
411 | imageRenderAPI!!.setKeyValueInfo("SetVariable", "var", "" + marqueeVis)
412 | }
413 | }
414 |
415 | override fun onPause() {
416 | super.onPause()
417 | Log.i(TAG, "onPause")
418 | if (null != imageRenderAPI) {
419 | imageRenderAPI!!.unBindRenderView(hashCode)
420 | }
421 | }
422 |
423 | /**
424 | * Next page
425 | *
426 | * @param view button
427 | */
428 | fun nextPage(view: View?) {
429 | val intent =
430 | Intent(this@ImageKitRenderDemoActivity, ImageKitRenderDemoActivity1::class.java)
431 | startActivity(intent)
432 | }
433 |
434 | /**
435 | * Start record.
436 | *
437 | * @param view button
438 | */
439 | fun startRecord(view: View?) {
440 | Log.d(
441 | "#######start record:",
442 | System.currentTimeMillis().toString() + ""
443 | )
444 | Toast.makeText(this, "start record", Toast.LENGTH_SHORT).show()
445 | if (null != imageRenderAPI) {
446 | val result = recordInfo
447 | val start = imageRenderAPI!!.startRecord(result, object : IStreamCallBack {
448 | override fun onRecordSuccess(hashMap: HashMap) {
449 | runOnUiThread {
450 | Toast.makeText(
451 | this@ImageKitRenderDemoActivity,
452 | "record success",
453 | Toast.LENGTH_SHORT
454 | ).show()
455 | }
456 | saveRecordResult(hashMap)
457 | }
458 |
459 | override fun onRecordFailure(hashMap: HashMap) {
460 | val errorCode = hashMap["errorCode"] as Int
461 | val errorMessage = hashMap["errorMessage"] as String?
462 | Log.i(
463 | TAG,
464 | "back result$errorCode;back msg$errorMessage"
465 | )
466 | }
467 |
468 | // progress:{1-100}
469 | override fun onProgress(progress: Int) {
470 | showRecordProgress(progress)
471 | }
472 | })
473 | if (start == ResultCode.SUCCEED) {
474 | Log.i(TAG, "start record success")
475 | } else {
476 | Log.i(
477 | TAG,
478 | "start record failure:$start"
479 | )
480 | }
481 | } else {
482 | Log.w(
483 | TAG,
484 | "start record fail, please init first."
485 | )
486 | }
487 | }
488 |
489 | private val recordInfo: JSONObject
490 | private get() {
491 | val result = JSONObject()
492 | val recordType =
493 | (findViewById(R.id.recordtype) as EditText).text.toString()
494 | val videoScale =
495 | (findViewById(R.id.videoscale) as EditText).text.toString()
496 | val videoFps =
497 | (findViewById(R.id.videofps) as EditText).text.toString()
498 | val gifScale =
499 | (findViewById(R.id.gifscale) as EditText).text.toString()
500 | val gifFps =
501 | (findViewById(R.id.giffps) as EditText).text.toString()
502 | try {
503 | val videoJson = JSONObject()
504 | val gifJson = JSONObject()
505 | result.put("recordType", recordType)
506 | videoJson.put("videoScale", videoScale)
507 | videoJson.put("videoFps", videoFps)
508 | gifJson.put("gifScale", gifScale)
509 | gifJson.put("gifFps", gifFps)
510 | result.put("video", videoJson)
511 | result.put("gif", gifJson)
512 | } catch (e: JSONException) {
513 | Log.w(TAG, e.message)
514 | }
515 | return result
516 | }
517 |
518 | private fun saveRecordResult(hashMap: HashMap) {
519 | val fileName = (Environment.getExternalStorageDirectory()
520 | .toString() + File.separator
521 | + "VideoAndPic")
522 | val fileDir = File(fileName)
523 | if (!fileDir.exists()) {
524 | if (!fileDir.mkdir()) {
525 | return
526 | }
527 | }
528 | val mp4Path =
529 | fileName + File.separator + System.currentTimeMillis() + ".mp4"
530 | val gifPath =
531 | fileName + File.separator + System.currentTimeMillis() + ".gif"
532 | val recordType = hashMap["recordType"] as String?
533 | val videoBytes = hashMap["videoBytes"] as ByteArray?
534 | val gifBytes = hashMap["gifBytes"] as ByteArray?
535 | try {
536 | if (recordType == "1") {
537 | videoBytes?.let { saveFile(it, mp4Path) }
538 | } else if (recordType == "2") {
539 | gifBytes?.let { saveFile(it, gifPath) }
540 | } else if (recordType == "3") {
541 | videoBytes?.let { saveFile(it, mp4Path) }
542 | gifBytes?.let { saveFile(it, gifPath) }
543 | }
544 | } catch (e: IOException) {
545 | Log.w(TAG, e.message)
546 | }
547 | }
548 |
549 | @Throws(IOException::class)
550 | private fun saveFile(bytes: ByteArray, path: String) {
551 | val fos = FileOutputStream(File(path))
552 | try {
553 | fos.write(bytes, 0, bytes.size)
554 | fos.close()
555 | } catch (e: IOException) {
556 | Log.e(TAG, e.message)
557 | } finally {
558 | try {
559 | fos.close()
560 | } catch (e: IOException) {
561 | Log.e(TAG, e.message)
562 | }
563 | }
564 | }
565 |
566 | private fun showRecordProgress(progress: Int) {
567 | runOnUiThread { textProgress!!.text = "progress:$progress%" }
568 | }
569 |
570 | /**
571 | * Stop record.
572 | *
573 | * @param view button
574 | */
575 | fun stopRecord(view: View?) {
576 | Toast.makeText(this, "stop record", Toast.LENGTH_SHORT).show()
577 | if (null != imageRenderAPI) {
578 | val result = imageRenderAPI!!.stopRecord()
579 | if (result == ResultCode.SUCCEED) {
580 | Log.i(TAG, "stop record success")
581 | } else {
582 | Log.i(TAG, "stop record failure:$result")
583 | }
584 | } else {
585 | Log.w(
586 | TAG,
587 | "stop record fail, please init first."
588 | )
589 | }
590 | }
591 |
592 | override fun onRequestPermissionsResult(
593 | requestCode: Int,
594 | permissions: Array,
595 | grantResults: IntArray
596 | ) {
597 | if (requestCode == PERMISSION_REQUEST_CODE) {
598 | if (grantResults.size > 0
599 | && grantResults[0] == PackageManager.PERMISSION_GRANTED
600 | ) {
601 | // The permission is granted.
602 | initData()
603 | initImageRender()
604 | } else {
605 | // The permission is rejected.
606 | Log.w(TAG, "permission denied")
607 | Toast.makeText(
608 | this@ImageKitRenderDemoActivity,
609 | "Please grant the app the permission to read the SD card",
610 | Toast.LENGTH_SHORT
611 | ).show()
612 | }
613 | }
614 | }
615 |
616 | companion object {
617 | /**
618 | * TAG
619 | */
620 | const val TAG = "ImageKitRenderDemo"
621 |
622 | /**
623 | * Resource folder, which can be set as you want.
624 | */
625 | const val SOURCE_PATH = "sources"
626 |
627 | /**
628 | * requestCode for applying for permissions.
629 | */
630 | const val PERMISSION_REQUEST_CODE = 0x01
631 | }
632 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/huawei/image/render/sample/activity/ImageKitRenderDemoActivity1.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package com.huawei.image.render.sample.activity
17 |
18 | import android.annotation.SuppressLint
19 | import android.app.Activity
20 | import android.os.Build
21 | import android.os.Bundle
22 | import android.os.SystemClock
23 | import android.support.annotation.RequiresApi
24 | import android.util.Log
25 | import android.view.View
26 | import android.view.WindowManager
27 | import android.widget.FrameLayout
28 | import com.huawei.hms.image.render.*
29 | import com.huawei.hms.image.render.ImageRender.RenderCallBack
30 | import com.huawei.image.render.sample.R
31 | import com.huawei.image.render.sample.util.Utils
32 | import java.io.File
33 |
34 | /**
35 | * 功能描述
36 | *
37 | * @author c00511068
38 | * @since 2020-09-07
39 | */
40 | class ImageKitRenderDemoActivity1 : Activity() {
41 | /**
42 | * 布Layout container
43 | */
44 | private var contentView: FrameLayout? = null
45 |
46 | // imageRender object
47 | private var imageRenderAPI: ImageRenderImpl? = null
48 |
49 | // Resource folder, which can be set as you want.
50 | private var sourcePath: String? = null
51 | private var hashCode: String? = null
52 | private var view: View? = null
53 |
54 | @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
55 | override fun onCreate(savedInstanceState: Bundle?) {
56 | super.onCreate(savedInstanceState)
57 | Log.i(TAG, "onCreate")
58 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
59 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
60 | window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
61 | setContentView(R.layout.activity_image_kit_demo_1)
62 | sourcePath =
63 | filesDir.path + File.separator + ImageKitRenderDemoActivity.SOURCE_PATH
64 | initView()
65 | initImageRender()
66 | }
67 |
68 | /**
69 | * Initialize the view.
70 | */
71 | @SuppressLint("ClickableViewAccessibility")
72 | private fun initView() {
73 | contentView = findViewById(R.id.content)
74 | }
75 |
76 | /**
77 | * Get ImageRenderAPI
78 | */
79 | private fun initImageRender() {
80 | Log.i(
81 | TAG,
82 | "timerecorde" + SystemClock.elapsedRealtime()
83 | )
84 | Log.d(
85 | TAG,
86 | "initImageRender time = " + SystemClock.uptimeMillis()
87 | )
88 | ImageRender.getInstance(this, object : RenderCallBack {
89 | override fun onSuccess(imageRender: ImageRenderImpl) {
90 | imageRenderAPI = imageRender
91 | }
92 |
93 | override fun onFailure(i: Int) {
94 | Log.e(
95 | TAG,
96 | "Get ImageRender instance failed, errorCode:$i"
97 | )
98 | }
99 | })
100 | }
101 |
102 | override fun onResume() {
103 | super.onResume()
104 | Log.i(TAG, "onResume")
105 | if (null != imageRenderAPI) {
106 | imageRenderAPI!!.bindRenderView(
107 | sourcePath,
108 | Utils.authJson,
109 | object : IBindCallBack {
110 | override fun onParseEnd() {}
111 | override fun onBind(renderView: RenderView, i: Int) {
112 | if (renderView != null) {
113 | if (renderView.getResultCode() == ResultCode.SUCCEED) {
114 | view = renderView.getView()
115 | if (null != view) {
116 | hashCode = view.hashCode().toString()
117 | contentView!!.addView(view)
118 | }
119 | }
120 | }
121 | }
122 | })
123 | }
124 | }
125 |
126 | override fun onDestroy() {
127 | Log.d(TAG, "onDestroy")
128 | super.onDestroy()
129 | }
130 |
131 | override fun onPause() {
132 | super.onPause()
133 | Log.i(TAG, "onPause")
134 | if (null != imageRenderAPI) {
135 | imageRenderAPI!!.unBindRenderView(hashCode)
136 | }
137 | }
138 |
139 | /**
140 | * Start the animation
141 | *
142 | * @param view button
143 | */
144 | fun startAnimation(view: View?) {
145 | Log.i(TAG, "Start animation")
146 | if (null != imageRenderAPI) {
147 | val playResult = imageRenderAPI!!.playAnimation()
148 | Log.i(
149 | TAG,
150 | "Start animation:$playResult"
151 | )
152 | } else {
153 | Log.w(
154 | TAG,
155 | "Start animation fail, please init first."
156 | )
157 | }
158 | }
159 |
160 | /**
161 | * Pause the animation
162 | *
163 | * @param view button
164 | */
165 | fun pauseAnimation(view: View?) {
166 | // imageRender停止renderView动画
167 | Log.i(TAG, "Pause animation")
168 | if (null != imageRenderAPI) {
169 | val pauseResult = imageRenderAPI!!.pauseAnimation(true)
170 | if (pauseResult == ResultCode.SUCCEED) {
171 | Log.i(
172 | TAG,
173 | "Pause animation success"
174 | )
175 | } else {
176 | Log.i(
177 | TAG,
178 | "Pause animation failure"
179 | )
180 | }
181 | } else {
182 | Log.w(
183 | TAG,
184 | "Pause animation fail, please init first."
185 | )
186 | }
187 | }
188 |
189 | /**
190 | * Resume the animation
191 | *
192 | * @param view button
193 | */
194 | fun restartAnimation(view: View?) {
195 | Log.i(TAG, "restart animation")
196 | if (null != imageRenderAPI) {
197 | val playResult = imageRenderAPI!!.resumeAnimation()
198 | if (playResult == ResultCode.SUCCEED) {
199 | Log.i(
200 | TAG,
201 | "Restart animation success"
202 | )
203 | } else {
204 | Log.i(
205 | TAG,
206 | "Restart animation failure"
207 | )
208 | }
209 | } else {
210 | Log.w(
211 | TAG,
212 | "Restart animation fail, please init first."
213 | )
214 | }
215 | }
216 |
217 | /**
218 | * Stop the animation.
219 | *
220 | * @param view button
221 | */
222 | fun stopAnimation(view: View?) {
223 | // Stop the renderView animation.
224 | Log.i(TAG, "Stop animation")
225 | if (null != imageRenderAPI) {
226 | val playResult = imageRenderAPI!!.stopAnimation()
227 | if (playResult == ResultCode.SUCCEED) {
228 | Log.i(
229 | TAG,
230 | "Stop animation success"
231 | )
232 | } else {
233 | Log.i(
234 | TAG,
235 | "Stop animation failure"
236 | )
237 | }
238 | } else {
239 | Log.w(
240 | TAG,
241 | "Stop animation fail, please init first."
242 | )
243 | }
244 | }
245 |
246 | companion object {
247 | /**
248 | * TAG
249 | */
250 | const val TAG = "ImageKitRenderDemo1"
251 |
252 | /**
253 | * requestCode for applying for permissions.
254 | */
255 | const val PERMISSION_REQUEST_CODE = 0x01
256 | }
257 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/huawei/image/render/sample/util/Utils.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package com.huawei.image.render.sample.util
17 |
18 | import android.content.Context
19 | import android.util.Log
20 | import org.json.JSONException
21 | import org.json.JSONObject
22 | import java.io.File
23 | import java.io.FileOutputStream
24 | import java.io.IOException
25 | import java.io.InputStream
26 |
27 | /**
28 | * Function Description
29 | *
30 | * @since 2020-04-28
31 | */
32 | object Utils {
33 | /**
34 | * TAG
35 | */
36 | private const val TAG = "Utils"
37 |
38 | /**
39 | * create demo dir
40 | *
41 | * @param dirPath dir path
42 | * @return result
43 | */
44 | fun createResourceDirs(dirPath: String?): Boolean {
45 | val dir = File(dirPath)
46 | return if (!dir.exists()) {
47 | if (dir.parentFile.mkdir()) {
48 | dir.mkdir()
49 | } else {
50 | dir.mkdir()
51 | }
52 | } else false
53 | }
54 |
55 | /**
56 | * copy assets folders to sdCard
57 | * @param context context
58 | * @param foldersName folderName
59 | * @param path path
60 | * @return result
61 | */
62 | fun copyAssetsFilesToDirs(
63 | context: Context,
64 | foldersName: String,
65 | path: String
66 | ): Boolean {
67 | try {
68 | val files = context.assets.list(foldersName)
69 | for (file in files) {
70 | if (!copyAssetsFileToDirs(
71 | context,
72 | foldersName + File.separator + file,
73 | path + File.separator + file
74 | )
75 | ) {
76 | Log.e(
77 | TAG,
78 | "Copy resource file fail, please check permission"
79 | )
80 | return false
81 | }
82 | }
83 | } catch (e: IOException) {
84 | Log.e(TAG, e.message)
85 | return false
86 | }
87 | return true
88 | }
89 |
90 | /**
91 | * copy resource file to sdCard
92 | *
93 | * @param context context
94 | * @param fileName fileName
95 | * @param path sdCard path
96 | * @return result
97 | */
98 | fun copyAssetsFileToDirs(
99 | context: Context,
100 | fileName: String?,
101 | path: String?
102 | ): Boolean {
103 | var inputStream: InputStream? = null
104 | var outputStream: FileOutputStream? = null
105 | try {
106 | inputStream = context.assets.open(fileName)
107 | val file = File(path)
108 | outputStream = FileOutputStream(file)
109 | val temp = ByteArray(4096)
110 | var n: Int
111 | while (-1 != inputStream.read(temp).also { n = it }) {
112 | outputStream.write(temp, 0, n)
113 | }
114 | } catch (e: IOException) {
115 | Log.e(TAG, e.message)
116 | return false
117 | } finally {
118 | try {
119 | inputStream?.close()
120 | } catch (e: IOException) {
121 | Log.e(TAG, e.message)
122 | } finally {
123 | if (outputStream != null) {
124 | try {
125 | outputStream.close()
126 | } catch (e: IOException) {
127 | Log.e(TAG, e.message)
128 | }
129 | }
130 | }
131 | }
132 | return true
133 | }
134 |
135 | /**
136 | * Add authentication parameters.
137 | *
138 | * @return JsonObject of Authentication parameters.
139 | */
140 | val authJson: JSONObject
141 | get() {
142 | val authJson = JSONObject()
143 | try {
144 | authJson.put("projectId", "projectId-test")
145 | authJson.put("appId", "appId-test")
146 | authJson.put("authApiKey", "authApiKey-test")
147 | authJson.put("clientSecret", "clientSecret-test")
148 | authJson.put("clientId", "clientId-test")
149 | authJson.put("token", "token-test")
150 | } catch (e: JSONException) {
151 | Log.w(
152 | TAG,
153 | "Get authJson fail, please check auth info"
154 | )
155 | }
156 | return authJson
157 | }
158 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_entries.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_image_kit_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
16 |
20 |
27 |
28 |
35 |
36 |
37 |
43 |
50 |
51 |
58 |
59 |
66 |
67 |
74 |
81 |
82 |
89 |
90 |
91 |
96 |
97 |
104 |
111 |
118 |
125 |
132 |
139 |
140 |
148 |
149 |
156 |
157 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_image_kit_demo_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
15 |
19 |
26 |
27 |
28 |
29 |
34 |
41 |
42 |
49 |
50 |
57 |
58 |
65 |
66 |
67 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
29 |
30 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recycler_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | imageRender示例
3 | imageRender示例
4 | imageRender示例1
5 | 播放
6 | 停止
7 | 暂停
8 | 恢复
9 | 开始录制
10 | 结束录制
11 | 跑马灯可见性
12 | 下一页
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - AlphaAnimation
5 | - PositionAnimation
6 | - RotationAnimation
7 | - SizeAnimation
8 | - SourcesAnimation
9 | - ParticleView
10 | - WaterWallpaper
11 | - Paint
12 | - MeshImage
13 | - Marquee
14 | - FlipBook
15 | - ParticleScatter
16 | - RotateView
17 | - DropPhysicalView
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3DDC84
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ImageRenderSample
3 | ImageRenderSample
4 | ImageRenderSample1
5 | play
6 | stop
7 | pause
8 | resume
9 | startRecord
10 | stopRecord
11 | setVar
12 | nextPage
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/huawei/image/render/sample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.huawei.image.render.sample
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.21'
5 | repositories {
6 | google()
7 | jcenter()
8 | maven {url 'https://developer.huawei.com/repo/'}
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.3.2'
12 | classpath 'com.huawei.agconnect:agcp:1.4.1.300'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | maven { url 'https://developer.huawei.com/repo/'}
24 | }
25 | }
26 |
27 | repositories {
28 | flatDir {
29 | dirs 'libs'
30 | }
31 | }
32 |
33 | task clean(type: Delete) {
34 | delete rootProject.buildDir
35 | }
36 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # Kotlin code style for this project: "official" or "obsolete":
15 | kotlin.code.style=official
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Aug 21 15:30:50 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/render.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMS-Core/hms-image-render-kotlin/6e213394fa98f315f89cb1a7360d293191585715/render.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------