diff --git a/app/build.gradle b/app/build.gradle index bf82a4c..87eac08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ applicationId "com.casic.detector" minSdkVersion 22 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0.0" + versionCode 1001 + versionName "1.0.0.1" ndk { moduleName "serial_port" @@ -60,7 +60,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = "COM_TCY" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" + outputFileName = "COM_TCY_" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" } } diff --git a/app/build.gradle b/app/build.gradle index bf82a4c..87eac08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ applicationId "com.casic.detector" minSdkVersion 22 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0.0" + versionCode 1001 + versionName "1.0.0.1" ndk { moduleName "serial_port" @@ -60,7 +60,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = "COM_TCY" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" + outputFileName = "COM_TCY_" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" } } diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 497f4bd..1c7d95b 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -29,7 +29,7 @@ return labelBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String): MutableList { + fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { val property = when (selectedItem) { LocaleConstant.SPINNER_ARRAY[0] -> LabelBeanDao.Properties.IdentifierId LocaleConstant.SPINNER_ARRAY[1] -> LabelBeanDao.Properties.Area @@ -40,7 +40,11 @@ LocaleConstant.SPINNER_ARRAY[6] -> LabelBeanDao.Properties.InstallTime else -> LabelBeanDao.Properties.Remark } - return labelBeanDao.queryBuilder().where(property.eq(value)).list() + return if (value == null) { + labelBeanDao.queryBuilder().where(property.isNotNull).list() + } else { + labelBeanDao.queryBuilder().where(property.eq(value)).list() + } } fun queryLabelById(identifierId: String): List { diff --git a/app/build.gradle b/app/build.gradle index bf82a4c..87eac08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ applicationId "com.casic.detector" minSdkVersion 22 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0.0" + versionCode 1001 + versionName "1.0.0.1" ndk { moduleName "serial_port" @@ -60,7 +60,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = "COM_TCY" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" + outputFileName = "COM_TCY_" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" } } diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 497f4bd..1c7d95b 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -29,7 +29,7 @@ return labelBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String): MutableList { + fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { val property = when (selectedItem) { LocaleConstant.SPINNER_ARRAY[0] -> LabelBeanDao.Properties.IdentifierId LocaleConstant.SPINNER_ARRAY[1] -> LabelBeanDao.Properties.Area @@ -40,7 +40,11 @@ LocaleConstant.SPINNER_ARRAY[6] -> LabelBeanDao.Properties.InstallTime else -> LabelBeanDao.Properties.Remark } - return labelBeanDao.queryBuilder().where(property.eq(value)).list() + return if (value == null) { + labelBeanDao.queryBuilder().where(property.isNotNull).list() + } else { + labelBeanDao.queryBuilder().where(property.eq(value)).list() + } } fun queryLabelById(identifierId: String): List { diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt index 570dbc5..00e58d0 100644 --- a/app/src/main/java/com/casic/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt @@ -210,7 +210,6 @@ .setContext(context) .setTitle("查看标识器") .setSpinnerArray(LocaleConstant.SPINNER_ARRAY) - .setHintMessage("请输入查询条件") .setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : diff --git a/app/build.gradle b/app/build.gradle index bf82a4c..87eac08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ applicationId "com.casic.detector" minSdkVersion 22 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0.0" + versionCode 1001 + versionName "1.0.0.1" ndk { moduleName "serial_port" @@ -60,7 +60,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = "COM_TCY" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" + outputFileName = "COM_TCY_" + getBuildDate() + "_" + defaultConfig.versionName + ".apk" } } diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 497f4bd..1c7d95b 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -29,7 +29,7 @@ return labelBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String): MutableList { + fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { val property = when (selectedItem) { LocaleConstant.SPINNER_ARRAY[0] -> LabelBeanDao.Properties.IdentifierId LocaleConstant.SPINNER_ARRAY[1] -> LabelBeanDao.Properties.Area @@ -40,7 +40,11 @@ LocaleConstant.SPINNER_ARRAY[6] -> LabelBeanDao.Properties.InstallTime else -> LabelBeanDao.Properties.Remark } - return labelBeanDao.queryBuilder().where(property.eq(value)).list() + return if (value == null) { + labelBeanDao.queryBuilder().where(property.isNotNull).list() + } else { + labelBeanDao.queryBuilder().where(property.eq(value)).list() + } } fun queryLabelById(identifierId: String): List { diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt index 570dbc5..00e58d0 100644 --- a/app/src/main/java/com/casic/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt @@ -210,7 +210,6 @@ .setContext(context) .setTitle("查看标识器") .setSpinnerArray(LocaleConstant.SPINNER_ARRAY) - .setHintMessage("请输入查询条件") .setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : diff --git a/app/src/main/java/com/casic/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/detector/widgets/QueryMarkerDialog.kt index f453bc1..b661064 100644 --- a/app/src/main/java/com/casic/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/detector/widgets/QueryMarkerDialog.kt @@ -5,10 +5,15 @@ import android.os.Bundle import android.view.View import android.widget.* +import androidx.appcompat.widget.AppCompatAutoCompleteTextView import com.casic.detector.R +import com.casic.detector.utils.DataBaseManager import com.pengxh.kt.lite.extensions.initDialogLayoutParams -import com.pengxh.kt.lite.extensions.show -import com.pengxh.kt.lite.widget.DeleteEditText +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + class QueryMarkerDialog private constructor(builder: Builder) : Dialog( builder.context, R.style.UserDefinedDialogStyle @@ -16,7 +21,6 @@ private val ctx = builder.context private val title = builder.title private val spinnerArray = builder.spinnerArray - private val hint = builder.hint private val positiveBtn = builder.positiveBtn private val negativeBtn = builder.negativeBtn private val listener = builder.listener @@ -25,7 +29,6 @@ lateinit var context: Context lateinit var title: String lateinit var spinnerArray: Array - lateinit var hint: String lateinit var positiveBtn: String lateinit var negativeBtn: String lateinit var listener: OnDialogButtonClickListener @@ -45,11 +48,6 @@ return this } - fun setHintMessage(hint: String): Builder { - this.hint = hint - return this - } - fun setPositiveButton(name: String): Builder { positiveBtn = name return this @@ -83,7 +81,7 @@ private fun initView() { val dialogTitleView: TextView = findViewById(R.id.dialogTitleView) val dialogSpinnerView: Spinner = findViewById(R.id.dialogSpinnerView) - val dialogInputView: DeleteEditText = findViewById(R.id.dialogInputView) + val dialogInputView: AppCompatAutoCompleteTextView = findViewById(R.id.dialogInputView) val dialogCancelButton = findViewById