diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 9624886b..433628fc 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -6,6 +6,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 00000000..efc9bd2d
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,458 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/build.gradle b/sample/build.gradle
index 01d373f4..bcfe7b5d 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -10,22 +10,20 @@ android {
applicationId "com.zww.sample"
minSdkVersion 21
targetSdkVersion 30
- versionCode 1
- versionName "1.0"
+ versionCode 2
+ versionName "1.3.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
- buildConfigField("String", "BASE_URL", '"http://www.68jason.com/"')
- buildConfigField("String", "NSFW_SAVE_PATH", '"nsfw_modle/nsfw.tflite"')
+ buildConfigField("String", "BASE_URL", '"https://www.jason1024.cn:8888"')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
- buildConfigField("String", "BASE_URL", '"http://www.68jason.com/"')
- buildConfigField("String", "NSFW_SAVE_PATH", '"/nsfw_modle/nsfw.tflite"')
+ buildConfigField("String", "BASE_URL", '"https://www.jason1024.cn:8888"')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
diff --git a/sample/src/main/java/com/zww/sample/MainActivity.kt b/sample/src/main/java/com/zww/sample/MainActivity.kt
index bddf7e2a..0d286aa5 100644
--- a/sample/src/main/java/com/zww/sample/MainActivity.kt
+++ b/sample/src/main/java/com/zww/sample/MainActivity.kt
@@ -3,6 +3,7 @@ package com.zww.sample
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
+import com.kongzue.dialog.v3.MessageDialog
import com.luck.picture.lib.PictureSelector
import com.luck.picture.lib.config.PictureConfig
import com.luck.picture.lib.config.PictureMimeType
@@ -25,6 +26,26 @@ class MainActivity : BaseActivity() {
c()
}
})
+ mViewModel.dialogShow.observe(this, androidx.lifecycle.Observer {
+ if (it){
+ MessageDialog.build(this).also {
+ it.message = "后台正在下载模型文件,大约耗时1分钟,请等待完成。(简化demo未做进度条处理,完成后会有toast提示)"
+ it.title = "提示"
+ it.cancelable = false
+ it.okButton = "好的"
+ it.show()
+ }
+ }else{
+ MessageDialog.build(this).also {
+ it.message = "模型已下载,等待模型初始化完成的toast后可点击右上角识别按钮"
+ it.title = "提示"
+ it.cancelable = false
+ it.okButton = "好的"
+ it.show()
+ }
+ }
+ })
+ mViewModel.isShowDialog()
}
override fun isInitImmersionBar() = true
diff --git a/sample/src/main/java/com/zww/sample/model/AppRepository.kt b/sample/src/main/java/com/zww/sample/model/AppRepository.kt
index 8ddb98b3..b644d505 100644
--- a/sample/src/main/java/com/zww/sample/model/AppRepository.kt
+++ b/sample/src/main/java/com/zww/sample/model/AppRepository.kt
@@ -82,7 +82,7 @@ class AppRepository constructor(
*/
override fun initNSFW() {
Classifier.Build().context(mContext).isOpenGPU(true).nsfwModuleFilePath(nsfwPath).build()
- ToastUtils.showLong("NSFW初始化成功")
+ ToastUtils.showLong("NSFW初始化成功,可点击右上角识别按钮开始识别")
"NSFW初始化成功".d()
isSDKInit = true
}
diff --git a/sample/src/main/java/com/zww/sample/ui/viewmodels/MainViewModel.kt b/sample/src/main/java/com/zww/sample/ui/viewmodels/MainViewModel.kt
index a8409f32..301c155a 100644
--- a/sample/src/main/java/com/zww/sample/ui/viewmodels/MainViewModel.kt
+++ b/sample/src/main/java/com/zww/sample/ui/viewmodels/MainViewModel.kt
@@ -16,6 +16,7 @@ import java.text.DecimalFormat
class MainViewModel : BaseViewModel() {
val bName = MutableLiveData("扫描资源文件")
val selectPhoto = MutableLiveData(0)
+ val dialogShow = MutableLiveData(true)
val adapter = object : BaseQuickAdapter(R.layout.item_main) {
override fun convert(holder: BaseViewHolder, item: ScoreBean) {
holder.getView(R.id.iv).also { iv ->
@@ -42,9 +43,13 @@ class MainViewModel : BaseViewModel() {
)
}
}
+ fun isShowDialog(){
+ dialogShow.value = !mAppRepository.isFileDownloaded()
+ }
fun changeFrom() {
if (!mAppRepository.isSDKInit) {
+ dialogShow.value = true
ToastUtils.showShort("SDK未初始化完成,如果为第一次打开请耐心等待下载完成")
return
}