Skip to content

Commit

Permalink
Merge pull request #8 from huaxiaolin/main
Browse files Browse the repository at this point in the history
update to 3.9.0
  • Loading branch information
yunxiao3344 authored Dec 2, 2024
2 parents 72b1ff9 + 354c918 commit 488fdd4
Show file tree
Hide file tree
Showing 291 changed files with 1,275 additions and 144 deletions.
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
if (project.android.hasProperty("namespace")) {
namespace 'com.tencent.effect.tencent_effect_flutter'
}
compileSdkVersion 31

compileOptions {
Expand Down Expand Up @@ -63,7 +66,7 @@ android {
compileOnly fileTree(dir: "libs", include: ['*.aar'])
// compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")
compileOnly 'androidx.annotation:annotation:1.1.0'
compileOnly 'com.tencent.mediacloud:TencentEffect_S1-04:3.5.0.5'
compileOnly 'com.tencent.mediacloud:TencentEffect_S1-07:3.9.0.8'
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.tencent.xmagic.XmagicApi;
import com.tencent.xmagic.XmagicApi.XmagicAIDataListener;
import com.tencent.xmagic.XmagicApi.XmagicTipsListener;
import com.tencent.xmagic.XmagicConstant;
import com.tencent.xmagic.XmagicProperty;
import com.tencent.xmagic.avatar.AvatarData;
import com.tencent.xmagic.bean.TEBodyData;
Expand Down Expand Up @@ -53,7 +54,7 @@ public class XmagicApiManager implements SensorEventListener, XmagicAIDataListen
private int xMagicLogLevel = Log.WARN;


private boolean isPerformance = false;
private XmagicConstant.EffectMode effectMode = XmagicConstant.EffectMode.PRO;


private volatile boolean enableAiData = false;
Expand All @@ -72,7 +73,6 @@ public static XmagicApiManager getInstance() {


/**
*
* @param context
* @return
*/
Expand Down Expand Up @@ -110,7 +110,7 @@ public void setTELicense(Context context, String url, String key, TELicenseCheck
}

public void onCreateApi() {
XmagicApi api = new XmagicApi(mApplicationContext, XmagicResParser.getResPath(), (s, i) -> {
XmagicApi api = new XmagicApi(mApplicationContext, this.effectMode,XmagicResParser.getResPath(), (s, i) -> {
if (managerListener != null) {
managerListener.onXmagicPropertyError(s, i);
}
Expand All @@ -124,9 +124,6 @@ public void onCreateApi() {
api.setTipsListener(this);
}
api.setXmagicLogLevel(xMagicLogLevel);
if (isPerformance) {
api.setDowngradePerformance();
}
xmagicApi = api;
}

Expand Down Expand Up @@ -178,7 +175,7 @@ public void onDestroy() {
enableAiData = false;
enableYTData = false;
enableTipsListener = false;
isPerformance = false;
effectMode = XmagicConstant.EffectMode.PRO;
currentStreamType = XmagicApi.PROCESS_TYPE_CAMERA_STREAM;
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "onDestroy: xmagicApi is null ");
Expand Down Expand Up @@ -248,8 +245,6 @@ public int process(int textureId, int width, int height) {


/**
*
* @param properties
*/
public void isBeautyAuthorized(List<XmagicProperty<?>> properties) {
Expand All @@ -262,8 +257,6 @@ public void isBeautyAuthorized(List<XmagicProperty<?>> properties) {
}

/**
*
* @return
*/
public boolean isSupportBeauty() {
Expand All @@ -275,7 +268,6 @@ public boolean isSupportBeauty() {
}

/**
*
* @param assetsList
*/
public void isDeviceSupport(List<XmagicProperty<?>> assetsList) {
Expand All @@ -288,8 +280,6 @@ public void isDeviceSupport(List<XmagicProperty<?>> assetsList) {


/**
*
* @param motionResPath
*/
public boolean isDeviceSupport(String motionResPath) {
Expand Down Expand Up @@ -340,8 +330,6 @@ public Context getApplicationContext() {
}

/**
*
* @return
*/
public boolean xMagicApiIsNull() {
Expand All @@ -357,7 +345,6 @@ public int getCurrentStreamType() {
}



public void enableEnhancedMode() {
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "enableEnhancedMode: xmagicApi is null ");
Expand All @@ -367,17 +354,39 @@ public void enableEnhancedMode() {
}



@Deprecated
public void setDowngradePerformance() {
isPerformance = true;
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "setDowngradePerformance: xmagicApi is null ");
LogUtils.w(TAG, "setDowngradePerformance: xmagicApi is null ");
return;
}
xmagicApi.setDowngradePerformance();
effectMode = XmagicConstant.EffectMode.NORMAL;
}


@Deprecated
public void enableHighPerformance() {
if (xMagicApiIsNull()) {
LogUtils.w(TAG, "enableHighPerformance: xmagicApi is null ");
return;
}
effectMode = XmagicConstant.EffectMode.NORMAL;
}


public void setEffectMode(XmagicConstant.EffectMode effectMode) {
this.effectMode = effectMode;
if (this.xmagicApi != null) {
LogUtils.e(TAG, "enableHighPerformance: xmagicApi is not null ");
}
}

public int getDeviceLevel(Context context) {
int level = XmagicApi.getDeviceLevel(context).getValue();
LogUtils.i(TAG, "getDeviceLevel value is " + level);
return level;
}


public void onPauseAudio() {
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "onPauseAudio: xmagicApi is null ");
Expand All @@ -386,7 +395,7 @@ public void onPauseAudio() {
xmagicApi.onPauseAudio();
}


public void setAudioMute(boolean isMute) {
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "setAudioMute: xmagicApi is null ");
Expand All @@ -395,7 +404,7 @@ public void setAudioMute(boolean isMute) {
xmagicApi.setAudioMute(isMute);
}


public void setFeatureEnableDisable(String featureName, boolean enable) {
if (xMagicApiIsNull()) {
LogUtils.e(TAG, "setFeatureEnableDisable: xmagicApi is null ");
Expand All @@ -405,7 +414,6 @@ public void setFeatureEnableDisable(String featureName, boolean enable) {
}



public void setImageOrientation(int rotationType) {
TEImageOrientation orientation = null;
switch (rotationType) {
Expand Down Expand Up @@ -436,7 +444,7 @@ public void setImageOrientation(int rotationType) {
xmagicApi.setImageOrientation(orientation);
}


public void enableAIDataListener(boolean enable) {
this.enableAiData = enable;
if (this.xmagicApi != null) {
Expand All @@ -449,7 +457,7 @@ public void enableAIDataListener(boolean enable) {
LogUtils.d(TAG, "enableAIDataListener: enable = " + enable);
}


public void enableYTDataListener(boolean enable) {
this.enableYTData = enable;
if (this.xmagicApi != null) {
Expand All @@ -462,7 +470,7 @@ public void enableYTDataListener(boolean enable) {
LogUtils.d(TAG, "enableYTDataListener: enable = " + enable);
}


public void enableTipsListener(boolean enable) {
this.enableTipsListener = enable;
if (this.xmagicApi != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ public interface XmagicPlugin {
void isDeviceSupportMotion(@NonNull MethodCall call, @NonNull MethodChannel.Result result);
void enableEnhancedMode(@NonNull MethodCall call, @NonNull MethodChannel.Result result);

@Deprecated
void setDowngradePerformance(@NonNull MethodCall call, @NonNull MethodChannel.Result result);
void enableHighPerformance(@NonNull MethodCall call, @NonNull MethodChannel.Result result);
void setEffectMode(@NonNull MethodCall call, @NonNull MethodChannel.Result result);

void getDeviceLevel(@NonNull MethodCall call, @NonNull MethodChannel.Result result);

void setAudioMute(@NonNull MethodCall call, @NonNull MethodChannel.Result result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.google.gson.reflect.TypeToken;
import com.tencent.effect.tencent_effect_flutter.utils.LogUtils;
import com.tencent.effect.tencent_effect_flutter.res.XmagicResParser;
import com.tencent.xmagic.XmagicConstant;
import com.tencent.xmagic.XmagicProperty;

import java.lang.reflect.Type;
Expand Down Expand Up @@ -423,6 +424,32 @@ public void setDowngradePerformance(@NonNull MethodCall call, @NonNull MethodCha
result.success(true);
}

@Override
public void enableHighPerformance(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
XmagicApiManager.getInstance().enableHighPerformance();
result.success(true);
}

@Override
public void setEffectMode(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
if (call.arguments instanceof String) {
String effectMode = (String) call.arguments;
if (effectMode.equals("0")) {
XmagicApiManager.getInstance().setEffectMode(XmagicConstant.EffectMode.NORMAL);
} else {
XmagicApiManager.getInstance().setEffectMode(XmagicConstant.EffectMode.PRO);
}
result.success(null);
return;
}
resultParameterError(call.method, result);
}

@Override
public void getDeviceLevel(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
result.success(XmagicApiManager.getInstance().getDeviceLevel(applicationContext));
}


@Override
public void setAudioMute(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
Expand Down
4 changes: 2 additions & 2 deletions demo/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34 //flutter.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -55,5 +55,5 @@ flutter {
}

dependencies {
implementation 'com.tencent.mediacloud:TencentEffect_S1-07:3.5.0.5'
implementation 'com.tencent.mediacloud:TencentEffect_S1-07:3.9.0.8'
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"alpha":1.0,"effectName":"lut","resourcePath":"image/lut.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureLipsLut","resourcePath":"image/kouhong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureRedCheek","resourcePath":"image/saihong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureSoftlight","resourcePath":"image/xiurong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeShadow","resourcePath":"image/yanying.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeLiner","resourcePath":"image/yanxian.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyelash","resourcePath":"image/jiemao.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyebrow","resourcePath":"image/meimao.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeball","resourcePath":"image/meitong.png"},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyelids","resourcePath":""},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyewocan","resourcePath":""}]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"alpha":0.0,"effectName":"lut","resourcePath":""},{"alpha":1.0,"effectName":"beauty.faceFeatureLipsLut","resourcePath":"image/kouhong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureRedCheek","resourcePath":"image/saihong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureSoftlight","resourcePath":"image/xiurong.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeShadow","resourcePath":"image/yanying.png"},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeLiner","resourcePath":""},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyelash","resourcePath":""},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyebrow","resourcePath":"image/meimao.png"},{"alpha":1.0,"effectName":"beauty.faceFeatureEyesMakeup.eyeball","resourcePath":"image/meitong.png"},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyelids","resourcePath":""},{"alpha":0.0,"effectName":"beauty.faceFeatureEyesMakeup.eyewocan","resourcePath":""}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package io.flutter.plugins;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;

import io.flutter.embedding.engine.FlutterEngine;

/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.github.ponnamkarthik.toast.fluttertoast.FlutterToastPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin fluttertoast, io.github.ponnamkarthik.toast.fluttertoast.FlutterToastPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin image_picker_android, io.flutter.plugins.imagepicker.ImagePickerPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.tencent.live.TencentLiveCloudPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin live_flutter_plugin, com.tencent.live.TencentLiveCloudPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.github.sososdk.orientation.OrientationPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin orientation, com.github.sososdk.orientation.OrientationPlugin", e);
}
try {
flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin package_info_plus, dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.baseflow.permissionhandler.PermissionHandlerPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin permission_handler_android, com.baseflow.permissionhandler.PermissionHandlerPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin shared_preferences_android, io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.tencent.effect.tencent_effect_flutter.TencentEffectFlutterPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin tencent_effect_flutter, com.tencent.effect.tencent_effect_flutter.TencentEffectFlutterPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.tencent.trtcplugin.TRTCCloudPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin tencent_trtc_cloud, com.tencent.trtcplugin.TRTCCloudPlugin", e);
}
}
}
4 changes: 2 additions & 2 deletions demo/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Binary file added demo/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading

0 comments on commit 488fdd4

Please sign in to comment.