Skip to content

Commit 94e3ff1

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/histogram
2 parents 8edf005 + fb50943 commit 94e3ff1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+827
-233
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ target/
99
tmp
1010
objs/
1111
obj/
12+
build/
13+
library/.cxx/

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
"files.exclude": {
66
},
77
"files.associations": {
8+
"*.h": "cpp",
9+
"*.cc": "cpp",
10+
"params.txt": "json",
11+
"CMakeLists*.txt": "cmake",
12+
"__config": "c"
813
}
914
}

.vscode/tasks.json

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"version": "2.0.0",
55
"tasks": [
66
{
7-
"label": "[Android] Build Android Demo",
7+
"label": "[Debug] Build Android Demo",
88
"type": "shell",
99
"command": "bash",
1010
"args": [
1111
"vscode_tasks.sh",
12+
"--debug",
1213
"--build"
1314
],
1415
"options": {
@@ -18,11 +19,12 @@
1819
"problemMatcher": "$gcc"
1920
},
2021
{
21-
"label": "[Android] Run Android Demo",
22+
"label": "[Debug] Run Android Demo",
2223
"type": "shell",
2324
"command": "bash",
2425
"args": [
2526
"vscode_tasks.sh",
27+
"--debug",
2628
"--run"
2729
],
2830
"options": {
@@ -32,11 +34,12 @@
3234
"problemMatcher": "$gcc"
3335
},
3436
{
35-
"label": "[Android] Build And Run Android Demo",
37+
"label": "[Debug] Build And Run Android Demo",
3638
"type": "shell",
3739
"command": "bash",
3840
"args": [
3941
"vscode_tasks.sh",
42+
"--debug",
4043
"--build",
4144
"--run"
4245
],
@@ -47,7 +50,53 @@
4750
"problemMatcher": "$gcc"
4851
},
4952
{
50-
"label": "[Android] Build Native Library",
53+
"label": "[Release] Build Android Demo",
54+
"type": "shell",
55+
"command": "bash",
56+
"args": [
57+
"vscode_tasks.sh",
58+
"--release",
59+
"--build"
60+
],
61+
"options": {
62+
"cwd": "${workspaceFolder}"
63+
},
64+
"group": "build",
65+
"problemMatcher": "$gcc"
66+
},
67+
{
68+
"label": "[Release] Run Android Demo",
69+
"type": "shell",
70+
"command": "bash",
71+
"args": [
72+
"vscode_tasks.sh",
73+
"--release",
74+
"--run"
75+
],
76+
"options": {
77+
"cwd": "${workspaceFolder}"
78+
},
79+
"group": "build",
80+
"problemMatcher": "$gcc"
81+
},
82+
{
83+
"label": "[Release] Build And Run Android Demo",
84+
"type": "shell",
85+
"command": "bash",
86+
"args": [
87+
"vscode_tasks.sh",
88+
"--release",
89+
"--build",
90+
"--run"
91+
],
92+
"options": {
93+
"cwd": "${workspaceFolder}"
94+
},
95+
"group": "build",
96+
"problemMatcher": "$gcc"
97+
},
98+
{
99+
"label": "[Release] Build Native Library With NDK Build",
51100
"type": "shell",
52101
"command": "bash",
53102
"args": [
@@ -58,6 +107,66 @@
58107
},
59108
"group": "build",
60109
"problemMatcher": "$gcc"
110+
},
111+
{
112+
"label": "Enable Gradle CMake Build",
113+
"type": "shell",
114+
"command": "bash",
115+
"args": [
116+
"vscode_tasks.sh",
117+
"--enable-cmake"
118+
],
119+
"options": {
120+
"cwd": "${workspaceFolder}"
121+
},
122+
"group": "build",
123+
"problemMatcher": "$gcc"
124+
},
125+
{
126+
"label": "Setup Gradle Project",
127+
"type": "shell",
128+
"command": "bash",
129+
"args": [
130+
"vscode_tasks.sh",
131+
"--setup-project"
132+
],
133+
"options": {
134+
"cwd": "${workspaceFolder}"
135+
},
136+
"group": "build",
137+
"problemMatcher": "$gcc"
138+
},
139+
{
140+
"label": "[Debug] Enable CMake And Build Project With CMake",
141+
"type": "shell",
142+
"command": "bash",
143+
"args": [
144+
"vscode_tasks.sh",
145+
"--debug",
146+
"--enable-cmake",
147+
"--build"
148+
],
149+
"options": {
150+
"cwd": "${workspaceFolder}"
151+
},
152+
"group": "build",
153+
"problemMatcher": "$gcc"
154+
},
155+
{
156+
"label": "[Release] Enable CMake And Build Project With CMake",
157+
"type": "shell",
158+
"command": "bash",
159+
"args": [
160+
"vscode_tasks.sh",
161+
"--release",
162+
"--enable-cmake",
163+
"--build"
164+
],
165+
"options": {
166+
"cwd": "${workspaceFolder}"
167+
},
168+
"group": "build",
169+
"problemMatcher": "$gcc"
61170
}
62171
]
63172
}

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,21 @@ dependencies {
3535

3636
* Demo and Library will be updated as needed. Welcome for your questions or PR.
3737

38-
* To build with the jni part, pleasae try:
38+
## Build
39+
40+
* Build with `Android Studio` and CMake: (Recommended)
41+
* Put `usingCMakeCompile=true` in your `local.properties`
42+
* Open the repo with the latest version of `Android Studio`
43+
* Waiting for the initialization. (NDK/cmake install)
44+
* Done.
45+
46+
* Using `Visual Studio Code`: (Simple)
47+
* Setup ENV variable `ANDROID_HOME` to your Android SDK installation directory.
48+
* Open the repo with `Visual Studio Code`
49+
* Press `⌘ + shift + B` (Mac) or `ctrl + shift + B` (Win/Linux), choose the option `Enable CMake And Build Project With CMake`.
50+
* Done.
51+
52+
* Build `JNI` part with ndk-build: (Not recommended)
3953

4054
```shell
4155
export NDK=path/of/your/ndk
@@ -55,9 +69,9 @@ $NDK/ndk-build
5569
#And remove the loading part of ffmpeg&facetracker
5670
$NDK/ndk-build
5771

58-
#For Window user, you should include the `.cmd` extension to `ndk-build` like this:
59-
cd your_path_to\android-gpuimage-plus-master\library\src\main\jni
60-
your_path_to_ndk\ndk-bundle\ndk-build.cmd
72+
#For Windows user, you should include the `.cmd` extension to `ndk-build` like this:
73+
cd <your\path\to\this\repo>\library\src\main\jni
74+
<your\path\to\ndk>\ndk-build.cmd
6175

6276
#Also remember to comment out these line in NativeLibraryLoader
6377
//System.loadLibrary("ffmpeg");

build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
buildscript {
44
repositories {
5-
jcenter()
5+
mavenCentral()
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.4.2'
9+
classpath 'com.android.tools.build:gradle:7.3.1'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -15,7 +15,20 @@ buildscript {
1515

1616
allprojects {
1717
repositories {
18-
jcenter()
18+
mavenCentral()
1919
google()
2020
}
2121
}
22+
23+
ext {
24+
android = [
25+
compileSdkVersion: 30,
26+
buildToolsVersion: '30.0.3',
27+
minSdkVersion : 16,
28+
targetSdkVersion : 25, // higher target version needs more storage permission request.
29+
versionCode : 1,
30+
versionName : "1.0.0",
31+
applicationId : "org.wysaid.cgeDemo",
32+
appcompatX : "1.2.0"
33+
]
34+
}

cgeDemo/build.gradle

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
apply plugin: 'com.android.application'
22

3+
def usingCMakeCompile() {
4+
/// define gradle.ext.usingCMakeCompile = false to disable CMakeCompile Mode.
5+
return gradle.ext != null && gradle.ext.has("usingCMakeCompile") && gradle.ext.usingCMakeCompile;
6+
}
7+
8+
def usingCMakeCompileDebug() {
9+
/// define gradle.ext.usingCMakeCompileDebug = true to enable CMake Debug Mode.
10+
return gradle.ext != null && gradle.ext.has("usingCMakeCompileDebug") && gradle.ext.usingCMakeCompileDebug;
11+
}
12+
313
android {
4-
compileSdkVersion 25
14+
compileSdkVersion rootProject.ext.android.compileSdkVersion
15+
buildToolsVersion rootProject.ext.android.buildToolsVersion
16+
17+
if (usingCMakeCompile()) {
18+
ndkVersion "23.1.7779620"
19+
}
520

621
defaultConfig {
7-
applicationId "org.wysaid.cgeDemo"
8-
minSdkVersion 14
9-
targetSdkVersion 22
10-
versionCode 1
11-
versionName "1.0"
22+
applicationId rootProject.ext.android.applicationId
23+
minSdkVersion rootProject.ext.android.minSdkVersion
24+
targetSdkVersion rootProject.ext.android.targetSdkVersion
25+
versionCode rootProject.ext.android.versionCode
26+
versionName rootProject.ext.android.versionName
27+
signingConfig signingConfigs.debug
1228
}
1329
buildTypes {
1430
release {
1531
minifyEnabled false
1632
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1733
}
1834
}
35+
namespace 'org.wysaid.cgeDemo'
1936

2037
}
2138

2239
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:25.2.0'
25-
compile project(':library')
40+
implementation fileTree(dir: 'libs', include: ['*.jar'])
41+
implementation project(':library')
42+
implementation 'androidx.appcompat:appcompat:' + rootProject.ext.android.appcompatX
2643
}

cgeDemo/src/main/AndroidManifest.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.wysaid.cgeDemo">
4-
<!-- <uses-sdk android:minSdkVersion="14" -->
5-
<!-- android:targetSdkVersion="22" -->
6-
<!-- /> -->
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
73
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
84
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
95
<uses-permission android:name="android.permission.CAMERA" />

cgeDemo/src/main/java/org/wysaid/cgeDemo/BasicImageDemoActivity.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
import android.graphics.BitmapFactory;
66
import android.net.Uri;
77
import android.os.Bundle;
8-
import android.support.v7.app.AppCompatActivity;
9-
import android.support.v7.widget.AppCompatButton;
8+
9+
1010
import android.util.Log;
1111
import android.view.View;
1212
import android.widget.LinearLayout;
1313
import android.widget.SeekBar;
1414

15+
import androidx.appcompat.app.AppCompatActivity;
16+
import androidx.appcompat.widget.AppCompatButton;
17+
1518
import org.wysaid.common.Common;
1619
import org.wysaid.myUtils.ImageUtil;
1720
import org.wysaid.myUtils.MsgUtil;
@@ -137,8 +140,8 @@ public void surfaceCreated() {
137140
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
138141
@Override
139142
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
140-
if(mActiveConfig != null) {
141-
float intensity = progress / (float)seekBar.getMax();
143+
if (mActiveConfig != null) {
144+
float intensity = progress / (float) seekBar.getMax();
142145
mActiveConfig.setIntensity(intensity, true);
143146
}
144147
}
@@ -156,7 +159,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
156159

157160
LinearLayout menuLayout = (LinearLayout) findViewById(R.id.menuLayout);
158161

159-
if(BASIC_FILTER_NAMES.length == mAdjustConfigs.length) {
162+
if (BASIC_FILTER_NAMES.length == mAdjustConfigs.length) {
160163

161164
for (int i = 0; i != BASIC_FILTER_NAMES.length; ++i) {
162165
MyButton btn = new MyButton(this, mAdjustConfigs[i]);
@@ -244,7 +247,7 @@ public void resetBtnClicked(View view) {
244247
public void run() {
245248

246249
CGEImageHandler handler = mImageView.getImageHandler();
247-
for(AdjustConfig config : mAdjustConfigs) {
250+
for (AdjustConfig config : mAdjustConfigs) {
248251

249252
handler.setFilterIntensityAtIndex(config.originValue, config.index, false);
250253
}

cgeDemo/src/main/java/org/wysaid/cgeDemo/CameraDemoActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import android.hardware.Camera;
77
import android.net.Uri;
88
import android.os.Bundle;
9-
import android.support.v7.app.AppCompatActivity;
9+
1010
import android.util.Log;
1111
import android.view.Menu;
1212
import android.view.MenuItem;
@@ -16,10 +16,13 @@
1616
import android.widget.LinearLayout;
1717
import android.widget.SeekBar;
1818

19+
import androidx.appcompat.app.AppCompatActivity;
20+
1921
import org.wysaid.camera.CameraInstance;
2022
import org.wysaid.myUtils.FileUtil;
2123
import org.wysaid.myUtils.ImageUtil;
2224
import org.wysaid.myUtils.MsgUtil;
25+
import org.wysaid.myUtils.PermissionUtil;
2326
import org.wysaid.nativePort.CGENativeLibrary;
2427
import org.wysaid.view.CameraRecordGLSurfaceView;
2528

@@ -112,6 +115,7 @@ public void endRecordingOK() {
112115
protected void onCreate(Bundle savedInstanceState) {
113116
super.onCreate(savedInstanceState);
114117
setContentView(R.layout.activity_camera_demo);
118+
PermissionUtil.verifyStoragePermissions(this);
115119

116120
// lastVideoPathFileName = FileUtil.getPathInPackage(CameraDemoActivity.this, true) + "/lastVideoPath.txt";
117121
Button takePicBtn = (Button) findViewById(R.id.takePicBtn);

0 commit comments

Comments
 (0)