diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index b589d56..61a9130 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 21a162b..aab12fe 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -1,19 +1,22 @@
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7bb9736..826d4bc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/app/build.gradle b/app/build.gradle
index 5f2fa3e..a6939bd 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 30
+ compileSdkVersion 32
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.android.UniPlugin"
minSdkVersion 21
- targetSdkVersion 28 //建议此属性值设为21 io.dcloud.PandoraEntry 作为apk入口时 必须设置 targetSDKVersion>=21 沉浸式才生效
+ targetSdkVersion 32 //建议此属性值设为21 io.dcloud.PandoraEntry 作为apk入口时 必须设置 targetSDKVersion>=21 沉浸式才生效
versionCode 1
versionName "1.0"
@@ -77,10 +77,7 @@ dependencies {
implementation 'androidx.webkit:webkit:1.3.0'
// 添加uni-app插件
- implementation project(':uniplugin_component')
- implementation project(':uniplugin_module')
- implementation project(':uniplugin_richalert')
- implementation project(':scanCode')
+ implementation project(':scan_code_plugin')
diff --git a/app/libs/mlkit-scanner-release.aar b/app/libs/mlkit-scanner-release.aar
index 31f597d..e08b633 100644
Binary files a/app/libs/mlkit-scanner-release.aar and b/app/libs/mlkit-scanner-release.aar differ
diff --git a/scanCode/build.gradle b/scanCode/build.gradle
deleted file mode 100644
index 12e040d..0000000
--- a/scanCode/build.gradle
+++ /dev/null
@@ -1,58 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 29
- defaultConfig {
- minSdkVersion 21
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-repositories {
- flatDir {
- dirs 'libs'
- }
-}
-
-dependencies {
- compileOnly fileTree(dir: 'libs', include: ['*.jar'])
-
- compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar','mlkit-scanner-release.aar'])
-
- compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
- compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
- compileOnly 'androidx.appcompat:appcompat:1.0.0'
- implementation 'com.alibaba:fastjson:1.2.83'
- implementation 'com.facebook.fresco:fresco:1.13.0'
- //添加扫码识别库
- //Camera核心 (*必须)
- implementation 'com.github.jenly1314.MLKit:mlkit-camera-core:1.4.0'
- //公共库 (可选) (1.3.0新增:当使用到MLKit下面的子库时,需依赖公共库)
- implementation 'com.github.jenly1314.MLKit:mlkit-common:1.4.0'
- //条码识别 (可选)
- implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:1.4.0'
-// implementation 'com.github.ITxiaoguang:MLKitScanner:1.0.0'
-// implementation 'com.google.mlkit:barcode-scanning:17.0.2'
-// implementation "androidx.camera:camera-core:1.0.2"
-// implementation "androidx.camera:camera-camera2:1.0.2"
-// implementation "androidx.camera:camera-lifecycle:1.0.2"
-// implementation "androidx.camera:camera-view:1.0.0-alpha25"
-
- /*implementation 'com.android.support:appcompat-v7:28.0.0'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'*/
-}
diff --git a/scanCode/src/main/java/cn/bnyer/scancode/MainScanActivity.java b/scanCode/src/main/java/cn/bnyer/scancode/MainScanActivity.java
deleted file mode 100644
index 6ba1ed3..0000000
--- a/scanCode/src/main/java/cn/bnyer/scancode/MainScanActivity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.bnyer.scancode;
-
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import com.google.mlkit.vision.barcode.common.Barcode;
-import com.king.mlkit.vision.barcode.BarcodeCameraScanActivity;
-import com.king.mlkit.vision.camera.AnalyzeResult;
-import com.king.mlkit.vision.camera.CameraScan;
-import com.king.mlkit.vision.camera.analyze.Analyzer;
-
-import java.util.List;
-
-public class MainScanActivity extends BarcodeCameraScanActivity {
-
- @Override
- public void initCameraScan(@NonNull CameraScan cameraScan) {
- super.initCameraScan(cameraScan);
- cameraScan.setPlayBeep(true).setVibrate(true);
- }
-
- @Nullable
- @Override
- public Analyzer> createAnalyzer() {
- Log.i("======", "开始分析数据结果:");
- return null;
- }
-
- @Override
- public void onScanResultCallback(@NonNull AnalyzeResult result) {
- Log.i("======", "开始解析扫码结果:" + result);
- Analyzer> analyzer = this.createAnalyzer();
- Log.i("======", "获取到的分析结果:" + analyzer);
- }
-
- @Override
- public void onScanResultFailure() {
- Log.i("======", "扫码失败了:");
- super.onScanResultFailure();
- }
-
-
-}
diff --git a/scanCode/src/main/java/cn/bnyer/scancode/scanCode.java b/scanCode/src/main/java/cn/bnyer/scancode/scanCode.java
deleted file mode 100644
index 104ff9d..0000000
--- a/scanCode/src/main/java/cn/bnyer/scancode/scanCode.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package cn.bnyer.scancode;
-
-import android.content.Intent;
-
-import com.google.mlkit.vision.barcode.BarcodeScannerOptions;
-import com.google.mlkit.vision.barcode.common.Barcode;
-import com.king.mlkit.vision.camera.analyze.Analyzer;
-import com.xiaoguang.widget.mlkitscanner.ScanManager;
-import com.xiaoguang.widget.mlkitscanner.callback.act.ScanCallback;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.List;
-
-import io.dcloud.feature.uniapp.annotation.UniJSMethod;
-import io.dcloud.feature.uniapp.bridge.UniJSCallback;
-import io.dcloud.feature.uniapp.common.UniModule;
-
-public class scanCode extends UniModule {
-
- @UniJSMethod(uiThread = false)
- public void add(JSONObject json, UniJSCallback callback) throws JSONException {
- final int a = json.getInt("a");
- final int b = json.getInt("b");
- callback.invoke(new JSONObject(){
- {
- put("code",0);
- put("result",a + b);
- }
- });
- }
-
-// @UniJSMethod(uiThread = false)
-// public void startScan(){
-// MainScanActivity activity = new MainScanActivity();
-// activity.initCameraScan();
-// }
-//
-// @UniJSMethod(uiThread = false)
-// public void createAnalyzer(){
-// MainScanActivity activity = new MainScanActivity();
-//
-// }
-//
-// @UniJSMethod(uiThread = false)
-// public void getScanResult(){
-// MainScanActivity activity = new MainScanActivity();
-// Analyzer> analyzer = activity.createAnalyzer();
-// activity.onScanResultCallback(analyzer);
-// }
-}
diff --git a/scanCode/.gitignore b/scan_code_plugin/.gitignore
similarity index 100%
rename from scanCode/.gitignore
rename to scan_code_plugin/.gitignore
diff --git a/scan_code_plugin/build.gradle b/scan_code_plugin/build.gradle
new file mode 100644
index 0000000..966c87c
--- /dev/null
+++ b/scan_code_plugin/build.gradle
@@ -0,0 +1,120 @@
+//plugins {
+// id 'com.android.library'
+//}
+
+//android {
+// namespace 'com.jiyi.jy_mlscansdk'
+// compileSdk 32 //29
+//
+// defaultConfig {
+// minSdkVersion 21
+// targetSdkVersion 32
+// versionCode 1
+// versionName "1.0"
+//
+//// minSdk 21
+//// targetSdk 32
+//
+// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+// consumerProguardFiles "consumer-rules.pro"
+// }
+//
+// buildTypes {
+// release {
+// minifyEnabled false
+// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+// }
+// }
+// compileOptions {
+// sourceCompatibility JavaVersion.VERSION_1_8
+// targetCompatibility JavaVersion.VERSION_1_8
+// }
+// buildToolsVersion '30.0.3'
+//}
+//
+//dependencies {
+//
+//// implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+//// implementation fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
+////
+//// implementation "com.android.support:recyclerview-v7:28.0.0"
+//// implementation "com.android.support:support-v4:28.0.0"
+//// implementation "com.android.support:appcompat-v7:28.0.0"
+//// implementation 'com.alibaba:fastjson:1.1.46.android'
+//// implementation 'com.facebook.fresco:fresco:1.13.0'
+////
+//// implementation 'com.google.mlkit:barcode-scanning:16.2.0'
+//// def camerax_version = '1.0.1';
+//// implementation "androidx.camera:camera-core:${camerax_version}"
+//// implementation "androidx.camera:camera-camera2:${camerax_version}"
+//// implementation "androidx.camera:camera-lifecycle:${camerax_version}"
+//// implementation "androidx.camera:camera-view:1.0.0-alpha25"
+//
+// compileOnly fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+// compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar','mlkit-scanner-release.aar'])
+//
+// compileOnly "com.android.support:recyclerview-v7:28.0.0"
+// compileOnly "com.android.support:support-v4:28.0.0"
+// compileOnly "com.android.support:appcompat-v7:28.0.0"
+// compileOnly 'com.alibaba:fastjson:1.1.46.android'
+// compileOnly 'com.facebook.fresco:fresco:1.13.0'
+//
+// compileOnly 'com.google.mlkit:barcode-scanning:16.2.0'
+// def camerax_version = '1.0.1';
+// compileOnly "androidx.camera:camera-core:${camerax_version}"
+// compileOnly "androidx.camera:camera-camera2:${camerax_version}"
+// compileOnly "androidx.camera:camera-lifecycle:${camerax_version}"
+// compileOnly "androidx.camera:camera-view:1.0.0-alpha25"
+//
+//
+//}
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 32
+ defaultConfig {
+ //applicationId 'com.jiyi.jy_mlscansdk'
+ minSdkVersion 21
+ targetSdkVersion 32
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
+
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+repositories {
+ flatDir {
+ dirs 'libs'
+ }
+}
+
+dependencies {
+ compileOnly fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+ compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar','mlkit-scanner-release.aar'])
+
+ //noinspection GradleCompatible
+ compileOnly 'com.android.support:recyclerview-v7:28.0.0'
+ //noinspection GradleCompatible
+ compileOnly 'com.android.support:support-v4:28.0.0'
+ //noinspection GradleCompatible
+ compileOnly 'com.android.support:appcompat-v7:28.0.0'
+ compileOnly 'com.alibaba:fastjson:1.1.46.android'
+ compileOnly 'com.facebook.fresco:fresco:1.13.0'
+
+ compileOnly 'com.google.mlkit:barcode-scanning:16.2.0'
+ def camerax_version = '1.0.1';
+ compileOnly "androidx.camera:camera-core:${camerax_version}"
+ compileOnly "androidx.camera:camera-camera2:${camerax_version}"
+ compileOnly "androidx.camera:camera-lifecycle:${camerax_version}"
+ compileOnly "androidx.camera:camera-view:1.0.0-alpha25"
+}
\ No newline at end of file
diff --git a/scanCode/consumer-rules.pro b/scan_code_plugin/consumer-rules.pro
similarity index 100%
rename from scanCode/consumer-rules.pro
rename to scan_code_plugin/consumer-rules.pro
diff --git a/scan_code_plugin/local.properties b/scan_code_plugin/local.properties
new file mode 100644
index 0000000..47e6fab
--- /dev/null
+++ b/scan_code_plugin/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Thu Aug 17 09:37:12 CST 2023
+sdk.dir=D\:\\andoridSdk
diff --git a/scanCode/proguard-rules.pro b/scan_code_plugin/proguard-rules.pro
similarity index 100%
rename from scanCode/proguard-rules.pro
rename to scan_code_plugin/proguard-rules.pro
diff --git a/scanCode/src/main/AndroidManifest.xml b/scan_code_plugin/src/main/AndroidManifest.xml
similarity index 67%
rename from scanCode/src/main/AndroidManifest.xml
rename to scan_code_plugin/src/main/AndroidManifest.xml
index ae17557..4652c4b 100644
--- a/scanCode/src/main/AndroidManifest.xml
+++ b/scan_code_plugin/src/main/AndroidManifest.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/scan_code_plugin/src/main/java/com/jiyi/jy_mlscansdk/JYMLScanSDKModule.java b/scan_code_plugin/src/main/java/com/jiyi/jy_mlscansdk/JYMLScanSDKModule.java
new file mode 100644
index 0000000..2f323b1
--- /dev/null
+++ b/scan_code_plugin/src/main/java/com/jiyi/jy_mlscansdk/JYMLScanSDKModule.java
@@ -0,0 +1,66 @@
+package com.jiyi.jy_mlscansdk;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.util.Log;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.taobao.weex.annotation.JSMethod;
+import com.taobao.weex.bridge.JSCallback;
+import com.xiaoguang.widget.mlkitscanner.ScanManager;
+import com.xiaoguang.widget.mlkitscanner.callback.act.ScanCallback;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import io.dcloud.feature.uniapp.common.UniModule;
+
+public class JYMLScanSDKModule extends UniModule {
+
+ private String TAG = "JYMLScanSDKModule";
+
+ @JSMethod(uiThread = false)
+ public void startScan(final JSCallback callback) {
+
+ (new Thread(new Runnable() {
+ public void run() {
+ try {
+ Activity activity = (Activity) mUniSDKInstance.getContext();
+ ScanManager.startScan(activity, new ScanCallback() {
+ @Override
+ public void onActivityResult(int resultCode, Intent data) {
+// handlerResult(i, intent);
+ if (resultCode == ScanManager.RESULT_SUCCESS) {
+ ArrayList results = data.getStringArrayListExtra(ScanManager.INTENT_KEY_RESULT_SUCCESS);
+ Log.d(TAG, "handlerResult: " + results.toString());
+
+ JSONObject result = new JSONObject();
+ result.put("errorCode", "0");
+ result.put("data", results.toString());
+
+ callback.invokeAndKeepAlive(result);
+ }else {
+ JSONObject result = new JSONObject();
+ result.put("errorCode", "1");
+ result.put("data", resultCode);
+
+ callback.invokeAndKeepAlive(result);
+ }
+ }
+ });
+ } catch (Exception err) {
+
+ }
+ }
+ })).start();
+
+ }
+
+ private void handlerResult(int resultCode, Intent data) {
+ if (resultCode == ScanManager.RESULT_SUCCESS) {
+ ArrayList results = data.getStringArrayListExtra(ScanManager.INTENT_KEY_RESULT_SUCCESS);
+ Log.d(TAG, "handlerResult: " + results.toString());
+ }
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index 3877c85..1dd1688 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -9,3 +9,5 @@ include ':test'
include ':mylibrary'
include ':mylibrary'
include ':scanCode'
+include ':jy-mlscansdk'
+include ':scan_code_plugin'
diff --git a/uniplugin_component/.gitignore b/uniplugin_component/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/uniplugin_component/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/uniplugin_component/build.gradle b/uniplugin_component/build.gradle
deleted file mode 100644
index b3d03cd..0000000
--- a/uniplugin_component/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 29
-
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-repositories {
- flatDir {
- dirs 'libs'
- }
-}
-
-dependencies {
- compileOnly fileTree(dir: 'libs', include: ['*.jar'])
-
- compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
-
- compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
- compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
- compileOnly 'androidx.appcompat:appcompat:1.0.0'
- implementation 'com.alibaba:fastjson:1.2.83'
- implementation 'com.facebook.fresco:fresco:1.13.0'
-
- /*implementation 'com.android.support:appcompat-v7:28.0.0'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'*/
-}
diff --git a/uniplugin_component/proguard-rules.pro b/uniplugin_component/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/uniplugin_component/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/uniplugin_component/src/main/AndroidManifest.xml b/uniplugin_component/src/main/AndroidManifest.xml
deleted file mode 100644
index dd8b4af..0000000
--- a/uniplugin_component/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/uniplugin_component/src/main/java/io/dcloud/uniplugin/TestText.java b/uniplugin_component/src/main/java/io/dcloud/uniplugin/TestText.java
deleted file mode 100644
index 3c665de..0000000
--- a/uniplugin_component/src/main/java/io/dcloud/uniplugin/TestText.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.dcloud.uniplugin;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.widget.TextView;
-import java.util.HashMap;
-import java.util.Map;
-
-import io.dcloud.feature.uniapp.UniSDKInstance;
-import io.dcloud.feature.uniapp.annotation.UniJSMethod;
-import io.dcloud.feature.uniapp.ui.action.AbsComponentData;
-import io.dcloud.feature.uniapp.ui.component.AbsVContainer;
-import io.dcloud.feature.uniapp.ui.component.UniComponent;
-import io.dcloud.feature.uniapp.ui.component.UniComponentProp;
-
-public class TestText extends UniComponent {
-
- public TestText(UniSDKInstance instance, AbsVContainer parent, AbsComponentData basicComponentData) {
- super(instance, parent, basicComponentData);
- }
-
- @Override
- protected TextView initComponentHostView(Context context) {
- TextView textView = new TextView(context);
- textView.setTextSize(20);
- textView.setTextColor(Color.BLACK);
- return textView;
- }
-
- @UniComponentProp(name = "tel")
- public void setTel(String telNumber) {
- getHostView().setText("tel: " + telNumber);
- Map params = new HashMap<>();
- Map number = new HashMap<>();
- number.put("tel", telNumber);
- //目前uni限制 参数需要放入到"detail"中 否则会被清理
- params.put("detail", number);
- fireEvent("onTel", params);
- }
-
- @UniJSMethod
- public void clearTel() {
- getHostView().setText("");
- }
-
- @Override
- public void onActivityResume() {
- super.onActivityResume();
- }
-
- @Override
- public void onActivityPause() {
- super.onActivityPause();
- }
-
- @Override
- public void onActivityDestroy() {
- super.onActivityDestroy();
- }
-}
diff --git a/uniplugin_component/src/main/res/values/strings.xml b/uniplugin_component/src/main/res/values/strings.xml
deleted file mode 100644
index a8400dc..0000000
--- a/uniplugin_component/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- uniplugin_richAlert
-
diff --git a/uniplugin_module/.gitignore b/uniplugin_module/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/uniplugin_module/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/uniplugin_module/build.gradle b/uniplugin_module/build.gradle
deleted file mode 100644
index f03dda1..0000000
--- a/uniplugin_module/build.gradle
+++ /dev/null
@@ -1,45 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 29
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-repositories {
- flatDir {
- dirs 'libs'
- }
-}
-
-dependencies {
- compileOnly fileTree(dir: 'libs', include: ['*.jar'])
-
- compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
-
- compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
- compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
- compileOnly 'androidx.appcompat:appcompat:1.0.0'
- implementation 'com.alibaba:fastjson:1.2.83'
- implementation 'com.facebook.fresco:fresco:1.13.0'
-
- /*implementation 'com.android.support:appcompat-v7:28.0.0'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'*/
-}
diff --git a/uniplugin_module/proguard-rules.pro b/uniplugin_module/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/uniplugin_module/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/uniplugin_module/src/main/AndroidManifest.xml b/uniplugin_module/src/main/AndroidManifest.xml
deleted file mode 100644
index 8656ea2..0000000
--- a/uniplugin_module/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/uniplugin_module/src/main/java/io/dcloud/uniplugin/NativePageActivity.java b/uniplugin_module/src/main/java/io/dcloud/uniplugin/NativePageActivity.java
deleted file mode 100644
index 4374fa4..0000000
--- a/uniplugin_module/src/main/java/io/dcloud/uniplugin/NativePageActivity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package io.dcloud.uniplugin;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.TextView;
-
-public class NativePageActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- FrameLayout rootView = new FrameLayout(this);
- TextView textView = new TextView(this);
- textView.setTextColor(Color.BLACK);
- textView.setTextSize(30);
- textView.setText("点击我将返回 并携带参数返回");
- rootView.addView(textView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 300));
- textView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent();
- intent.putExtra("respond", "我是原生页面");
- setResult(TestModule.REQUEST_CODE, intent);
- finish();
- }
- });
- setContentView(rootView);
- }
-}
diff --git a/uniplugin_module/src/main/java/io/dcloud/uniplugin/TestModule.java b/uniplugin_module/src/main/java/io/dcloud/uniplugin/TestModule.java
deleted file mode 100644
index 098ef4b..0000000
--- a/uniplugin_module/src/main/java/io/dcloud/uniplugin/TestModule.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.dcloud.uniplugin;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.util.Log;
-
-import com.alibaba.fastjson.JSONObject;
-
-import io.dcloud.feature.uniapp.annotation.UniJSMethod;
-import io.dcloud.feature.uniapp.bridge.UniJSCallback;
-import io.dcloud.feature.uniapp.common.UniModule;
-
-
-public class TestModule extends UniModule {
-
- String TAG = "TestModule";
- public static int REQUEST_CODE = 1000;
-
- //run ui thread
- @UniJSMethod(uiThread = true)
- public void testAsyncFunc(JSONObject options, UniJSCallback callback) {
- Log.e(TAG, "testAsyncFunc--"+options);
- if(callback != null) {
- JSONObject data = new JSONObject();
- data.put("code", "success");
- callback.invoke(data);
- //callback.invokeAndKeepAlive(data);
- }
- }
-
- //run JS thread
- @UniJSMethod (uiThread = false)
- public JSONObject testSyncFunc(){
- JSONObject data = new JSONObject();
- data.put("code", "success");
- return data;
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if(requestCode == REQUEST_CODE && data.hasExtra("respond")) {
- Log.e("TestModule", "原生页面返回----"+data.getStringExtra("respond"));
- } else {
- super.onActivityResult(requestCode, resultCode, data);
- }
- }
-
- @UniJSMethod (uiThread = true)
- public void gotoNativePage(){
- if(mUniSDKInstance != null && mUniSDKInstance.getContext() instanceof Activity) {
- Intent intent = new Intent(mUniSDKInstance.getContext(), NativePageActivity.class);
- ((Activity)mUniSDKInstance.getContext()).startActivityForResult(intent, REQUEST_CODE);
- }
- }
-}
diff --git a/uniplugin_module/src/main/res/values/strings.xml b/uniplugin_module/src/main/res/values/strings.xml
deleted file mode 100644
index a8400dc..0000000
--- a/uniplugin_module/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- uniplugin_richAlert
-
diff --git a/uniplugin_richalert/.gitignore b/uniplugin_richalert/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/uniplugin_richalert/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/uniplugin_richalert/build.gradle b/uniplugin_richalert/build.gradle
deleted file mode 100644
index ff741bc..0000000
--- a/uniplugin_richalert/build.gradle
+++ /dev/null
@@ -1,41 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
- compileSdkVersion 29
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
-
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-repositories {
- flatDir {
- dirs 'libs'
- }
-}
-
-dependencies {
- compileOnly fileTree(dir: 'libs', include: ['*.jar'])
-
- compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
- compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
- compileOnly 'androidx.appcompat:appcompat:1.0.0'
- compileOnly 'com.alibaba:fastjson:1.2.83'
-
- compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
-
- compileOnly 'com.alibaba:fastjson:1.1.46.android'
-}
diff --git a/uniplugin_richalert/proguard-rules.pro b/uniplugin_richalert/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/uniplugin_richalert/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/uniplugin_richalert/src/androidTest/java/uni/dcloud/io/uniplugin_richalert/ExampleInstrumentedTest.java b/uniplugin_richalert/src/androidTest/java/uni/dcloud/io/uniplugin_richalert/ExampleInstrumentedTest.java
deleted file mode 100644
index eca43f7..0000000
--- a/uniplugin_richalert/src/androidTest/java/uni/dcloud/io/uniplugin_richalert/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("uni.dcloud.io.uniplugin_richalert.test", appContext.getPackageName());
- }
-}
diff --git a/uniplugin_richalert/src/main/AndroidManifest.xml b/uniplugin_richalert/src/main/AndroidManifest.xml
deleted file mode 100644
index 2c50730..0000000
--- a/uniplugin_richalert/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/Person.java b/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/Person.java
deleted file mode 100644
index 55c9d87..0000000
--- a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/Person.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert.Info;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Person {
- public String label;
- public String content;
- public JSONObject attribute;
-}
diff --git a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/SaxHelper.java b/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/SaxHelper.java
deleted file mode 100644
index a88648e..0000000
--- a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/Info/SaxHelper.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert.Info;
-
-import android.text.TextUtils;
-
-import com.alibaba.fastjson.JSONObject;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.util.ArrayList;
-
-
-public class SaxHelper extends DefaultHandler {
- private Person person;
- private ArrayList persons;
- //当前解析的元素标签
- private String tagName = null;
-
- /**
- * 当读取到文档开始标志是触发,通常在这里完成一些初始化操作
- */
- @Override
- public void startDocument() throws SAXException {
- this.persons = new ArrayList();
- //Log.i("SAX", "读取到文档头,开始解析xml");
- }
-
-
- /**
- * 读到一个开始标签时调用,第二个参数为标签名,最后一个参数为属性数组
- */
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- this.person = new Person();
- this.persons.add(this.person);
- person.label = localName;
- if(attributes != null && attributes.getLength() > 0) {
- JSONObject attr = new JSONObject();
- for(int i=0;i getPersons() {
- return persons;
- }
-
-}
diff --git a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert.java b/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert.java
deleted file mode 100644
index b16279e..0000000
--- a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert.java
+++ /dev/null
@@ -1,391 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.graphics.Color;
-import androidx.annotation.NonNull;
-import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.method.LinkMovementMethod;
-import android.text.style.ClickableSpan;
-import android.text.style.ForegroundColorSpan;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.LinearLayout;
-import android.widget.ScrollView;
-import android.widget.TextView;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import io.dcloud.feature.uniapp.bridge.UniJSCallback;
-import io.dcloud.feature.uniapp.utils.UniResourceUtils;
-import uni.dcloud.io.uniplugin_richalert.Info.Person;
-import uni.dcloud.io.uniplugin_richalert.Info.SaxHelper;
-
-
-public class RichAlert {
-
- public static String TITLE = "title";
- public static String TITLE_COLOR = "titleColor";
-
- int mPositiveColor = Color.BLACK;
- int mNegativeColor = Color.BLACK;
- int mNeutralColor = Color.BLACK;
- int mPosition = Gravity.CENTER;
- Context mContext;
- LinearLayout mContentViewRootView;
- CheckBox mCheckBox;
- TextView mMessageView;
- TextView mTitleView;
- AlertDialog mAlertDialog;
- AlertDialog.Builder mBuilder;
-
- String SELECTED = "isSelected";
-
- public RichAlert(@NonNull Context context) {
- mContext = context;
- mBuilder = new AlertDialog.Builder(context);
- }
-
- /**
- * 显示弹窗
- */
- public void show() {
- mAlertDialog = mBuilder.create();
- if(mContentViewRootView != null) {
- mAlertDialog.setView(mContentViewRootView);
- if(mCheckBox != null) {
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- layoutParams.leftMargin = dip2px(mContext, 11);
- mContentViewRootView.addView(mCheckBox, layoutParams);
- }
- }
-
- mAlertDialog.setCanceledOnTouchOutside(false);
- mAlertDialog.show();
-
- setButtonColor(AlertDialog.BUTTON_POSITIVE, mPositiveColor);
- setButtonColor(AlertDialog.BUTTON_NEGATIVE, mNegativeColor);
- setButtonColor(AlertDialog.BUTTON_NEUTRAL, mNeutralColor);
-
- Window dialogWindow = mAlertDialog.getWindow();//获取window对象
- dialogWindow.setGravity(mPosition);
- }
-
- /**
- * 设置弹窗标题
- * @param title
- * @param Color
- * @return
- */
- public RichAlert setTitle(CharSequence title, int Color, String align) {
-// mBuilder.setTitle(title);
- initContentView(mContext);
- if(mTitleView != null) {
- mTitleView.setVisibility(View.VISIBLE);
- mTitleView.setText(title);
- mTitleView.setTextColor(Color);
- mTitleView.setGravity(getAlign(align) | Gravity.CENTER_VERTICAL);
- }
- return this;
- }
-
- /**
- * 设置弹窗主显示内容
- * @param content
- * @param Color
- * @param jsCallback
- * @return
- */
- public RichAlert setContent(String content, int Color, String align, UniJSCallback jsCallback) {
- try {
- initContentView(mContext);
- ArrayList data = readxmlForDom(content);
- if(data != null && data.size() > 0) {
- CharSequence ct = getContentCharSequence(data, jsCallback);
- mMessageView.setText(ct);
- } else {
- mMessageView.setText(content);
- }
- mMessageView.setTextColor(Color);
- mMessageView.setGravity(getAlign(align));
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- return this;
- }
-
-
- /**
- * 生成自定义内容布局
- * 此处使用代码编写的布局,也可以使用XML布局方式加载
- * @param context
- */
- private void initContentView(Context context) {
- if(mContentViewRootView == null && context != null) {
- mContentViewRootView = new LinearLayout(context);
- mContentViewRootView.setOrientation(LinearLayout.VERTICAL);
- LinearLayout titleLayout = new LinearLayout(context);
- mTitleView = new TextView(context);
- mTitleView.setGravity(Gravity.CENTER);
- mTitleView.setPadding(dip2px(mContext, 16), 0, dip2px(mContext, 16), 0);
- mTitleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17);
- LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dip2px(mContext, 45));
- titleLayout.addView(mTitleView, titleParams);
- mTitleView.setVisibility(View.GONE);
- mContentViewRootView.addView(titleLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
- ScrollView scrollView = new ScrollView(context);
- mMessageView = new TextView(context);
- ScrollView.LayoutParams params = new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
- params.topMargin = dip2px(context, 25);
- params.bottomMargin = dip2px(context, 25);
- params.leftMargin = dip2px(context, 16);
- params.rightMargin = dip2px(context, 16);
- mContentViewRootView.addView(scrollView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1));
- scrollView.addView(mMessageView, params);
- mMessageView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
- mMessageView.setMovementMethod(LinkMovementMethod.getInstance());
- }
- }
-
- /**
- * 设置弹窗按钮
- * @param buttons
- * @param jsCallback
- * @return
- */
- public RichAlert setButtons(JSONArray buttons, final UniJSCallback jsCallback) {
- if(buttons != null && buttons.size() > 0) {
- for(int i = 0; i < buttons.size();i++) {
- JSONObject button = buttons.getJSONObject(i);
- String title = button.getString(TITLE);
- int color = UniResourceUtils.getColor(button.getString(TITLE_COLOR), RichAlertModule.defColor);
- if(TextUtils.isEmpty(title)) {
- continue;
- }
- if(i > 2) { //buttons 最多支持三个button
- return this;
- }
- final int index = i;
- DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int n) {
- JSONObject result = new JSONObject();
- result.put("type", "button");
- result.put("index", index);
- jsCallback.invoke(result);
- }
- };
- switch(i) {
- case 0: {
- mBuilder.setNegativeButton(title, listener);
- mNegativeColor = color;
- break;
- }
- case 1: {
- mBuilder.setNeutralButton(title, listener);
- mNeutralColor = color;
- break;
- }
- case 2: {
- mBuilder.setPositiveButton(title, listener);
- mPositiveColor = color;
- break;
- }
- }
- }
- }
- return this;
- }
-
-
- /**
- * 设置按钮文字颜色
- * 需要在show操作之后调用
- * @param type
- * @param color
- */
- private void setButtonColor(int type, int color) {
- if(mAlertDialog != null) {
- Button button = mAlertDialog.getButton(type);
- if(button != null) {
- button.setTextColor(color);
- }
- }
- }
-
- /**
- * 提示框位置
- * @param position
- * @return
- */
- public RichAlert setPosition(String position) {
- mPosition = getAlign(position);
- return this;
- }
-
- /**
- * 设置复选框提示
- * @param checkBox
- * @param jsCallback
- * @return
- */
- public RichAlert setCheckBox(JSONObject checkBox, final UniJSCallback jsCallback) {
- if(checkBox == null) {
- return this;
- }
- mCheckBox = new CheckBox(mContext);
-
- mCheckBox.setText(checkBox.getString(TITLE));
- int color = UniResourceUtils.getColor(checkBox.getString(TITLE_COLOR), RichAlertModule.defColor);
- mCheckBox.setTextColor(color);
- boolean isSelected = false;
- if(checkBox.containsKey(SELECTED)) {
- isSelected = checkBox.getBoolean(SELECTED);
- }
- mCheckBox.setChecked(isSelected);
- mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- JSONObject result = new JSONObject();
- result.put("type", "checkBox");
- result.put("isSelected", isChecked);
- jsCallback.invokeAndKeepAlive(result);
- }
- });
- return this;
- }
-
-
- /**
- * 将Person转换对应的Span
- * @param data
- * @param jsCallback
- * @return
- */
- private CharSequence getContentCharSequence(ArrayList data, UniJSCallback jsCallback) {
- SpannableStringBuilder spannableString = new SpannableStringBuilder();
- for(Person person : data) {
- if(TextUtils.isEmpty(person.content)) {
- continue;
- }
- if(person.label.equalsIgnoreCase("a")) {
- setASpan(spannableString, person, jsCallback);
- } else {
- spannableString.append(person.content);
- }
- }
-
- return spannableString;
- }
-
- /**
- * 设置A标签指定的Span 包含点击事件
- * @param spannableString
- * @param person
- * @param jsCallback
- */
- private void setASpan(SpannableStringBuilder spannableString, final Person person, final UniJSCallback jsCallback) {
- int start = spannableString.toString().length();
- spannableString.append(person.content);
- int end = spannableString.toString().length();
- ClickableSpan clickableSpan = new ClickableSpan() {
-
- public void onClick(View view) {
- //Do something with URL here.
- JSONObject result = new JSONObject();
- result.put("type", "a");
- result.putAll(person.attribute);
- jsCallback.invokeAndKeepAlive(result);
- }
- };
- spannableString.setSpan(clickableSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- ForegroundColorSpan foregroundColorSpan=new ForegroundColorSpan(Color.BLUE);
- spannableString.setSpan(foregroundColorSpan,start,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
-
- /**
- * 解析XML 获取person数组
- * @param content
- * @return
- * @throws Exception
- */
- private ArrayList readxmlForDom(String content) throws Exception {
- content = "" + content + "";
- //获取文件资源建立输入流对象
- InputStream is = new ByteArrayInputStream(content.getBytes());
- //创建一个SAXParserFactory解析器工程
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SaxHelper helper = new SaxHelper();
- //③创建SAX解析器
- SAXParser parser = factory.newSAXParser();
- parser.parse(is, helper);
- return helper.getPersons();
- }
-
- public boolean isShowing() {
- return mAlertDialog == null ? false : mAlertDialog.isShowing();
- }
-
- public void dismiss() {
- if(mAlertDialog != null) {
- mAlertDialog.dismiss();
- mAlertDialog = null;
- mContentViewRootView.removeAllViews();
- mContentViewRootView = null;
- mMessageView = null;
- mTitleView = null;
- mCheckBox = null;
- }
- }
-
- public void setOnDismissListener(DialogInterface.OnDismissListener listener) {
- if(mAlertDialog != null)
- mAlertDialog.setOnDismissListener(listener);
- }
-
- public void setOnCancelListener(DialogInterface.OnCancelListener listener) {
- if(mAlertDialog != null)
- mAlertDialog.setOnCancelListener(listener);
- }
-
- private int dip2px(Context context, float dipValue) {
- float scale = context.getResources().getDisplayMetrics().density;
- return (int) (dipValue * scale + 0.5f);
- }
-
- private int getAlign(String alignString) {
- int align = Gravity.CENTER;
- if(!TextUtils.isEmpty(alignString)) {
- switch (alignString) {
- case "left":
- align = Gravity.LEFT;
- break;
- case "right" :
- align = Gravity.RIGHT;
- break;
- case "bottom":
- align = Gravity.BOTTOM;
- break;
- }
- }
- return align;
- }
-}
diff --git a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlertModule.java b/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlertModule.java
deleted file mode 100644
index 3a331c6..0000000
--- a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlertModule.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert;
-
-import android.app.Activity;
-import android.content.DialogInterface;
-import android.graphics.Color;
-import android.text.TextUtils;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import io.dcloud.feature.uniapp.annotation.UniJSMethod;
-import io.dcloud.feature.uniapp.bridge.UniJSCallback;
-import io.dcloud.feature.uniapp.common.UniDestroyableModule;
-import io.dcloud.feature.uniapp.utils.UniLogUtils;
-import io.dcloud.feature.uniapp.utils.UniResourceUtils;
-
-public class RichAlertModule extends UniDestroyableModule {
- public String CONTENT = "content";
- public String CONTENT_COLOR = "contentColor";
- public String CONTENT_ALIGN = "contentAlign";
- public String POSITION = "position";
- public String BUTTONS = "buttons";
- public String CHECKBOX = "checkBox";
- public String TITLE_ALIGN = "titleAlign";
- //默认黑色
- public static int defColor = Color.BLACK;
-
- RichAlert alert;
-
- @UniJSMethod(uiThread = true)
- public void show(JSONObject options, UniJSCallback jsCallback) {
- if (mUniSDKInstance.getContext() instanceof Activity) {
- String content = options.getString(CONTENT);
- int contentColor = UniResourceUtils.getColor(options.getString(CONTENT_COLOR), defColor);
- String contentAlign = options.getString(CONTENT_ALIGN);
-
- String title = options.getString(RichAlert.TITLE);
- int titleColor = UniResourceUtils.getColor(options.getString(RichAlert.TITLE_COLOR), defColor);
- String titleAlign = options.getString(TITLE_ALIGN);
-
- String postion = options.getString(POSITION);
-
- RichAlert richAlert = new RichAlert(mUniSDKInstance.getContext());
-
- JSONArray buttons = options.getJSONArray(BUTTONS);
- JSONObject checkBox = options.getJSONObject(CHECKBOX);
-
- if(!TextUtils.isEmpty(title)) {
- richAlert.setTitle(title, titleColor, titleAlign);
- }
- if(!TextUtils.isEmpty(content)) {
- richAlert.setContent(content, contentColor, contentAlign,jsCallback);
- }
- if(checkBox != null) {
- richAlert.setCheckBox(checkBox, jsCallback);
- }
- if(buttons != null) {
- richAlert.setButtons(buttons, jsCallback);
- }
- if(!TextUtils.isEmpty(postion)) {
- richAlert.setPosition(postion);
- }
-
- richAlert.show();
- tracking(richAlert, jsCallback);
- }
- }
-
- private void tracking(RichAlert dialog, final UniJSCallback jsCallback) {
- alert = dialog;
- dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- JSONObject result = new JSONObject();
- result.put("type", "backCancel");
- jsCallback.invoke(result);
- }
- });
- dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
- @Override
- public void onDismiss(DialogInterface dialog) {
- alert = null;
- }
- });
- }
-
- @UniJSMethod(uiThread = true)
- public void dismiss() {
- destroy();
- }
-
- @Override
- public void destroy() {
- if (alert != null && alert.isShowing()) {
- UniLogUtils.w("Dismiss the active dialog");
- alert.dismiss();
- }
- }
-
-}
diff --git a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert_AppProxy.java b/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert_AppProxy.java
deleted file mode 100644
index 6e1ad10..0000000
--- a/uniplugin_richalert/src/main/java/uni/dcloud/io/uniplugin_richalert/RichAlert_AppProxy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert;
-
-import android.app.Application;
-
-import io.dcloud.feature.uniapp.UniAppHookProxy;
-
-
-public class RichAlert_AppProxy implements UniAppHookProxy {
- @Override
- public void onCreate(Application application) {
- //可写初始化触发逻辑
- }
-
- @Override
- public void onSubProcessCreate(Application application) {
- //子进程初始化回调
- }
-}
diff --git a/uniplugin_richalert/src/main/res/values/strings.xml b/uniplugin_richalert/src/main/res/values/strings.xml
deleted file mode 100644
index a8400dc..0000000
--- a/uniplugin_richalert/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- uniplugin_richAlert
-
diff --git a/uniplugin_richalert/src/test/java/uni/dcloud/io/uniplugin_richalert/ExampleUnitTest.java b/uniplugin_richalert/src/test/java/uni/dcloud/io/uniplugin_richalert/ExampleUnitTest.java
deleted file mode 100644
index 823af59..0000000
--- a/uniplugin_richalert/src/test/java/uni/dcloud/io/uniplugin_richalert/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package uni.dcloud.io.uniplugin_richalert;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file