diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
new file mode 100644
index 0000000..c92507a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
@@ -0,0 +1,13 @@
+package com.casic.qd.smartwell.model
+
+class LoginResultModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var kaptcha: String? = null
+ var token: String? = null
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
new file mode 100644
index 0000000..c92507a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
@@ -0,0 +1,13 @@
+package com.casic.qd.smartwell.model
+
+class LoginResultModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var kaptcha: String? = null
+ var token: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
new file mode 100644
index 0000000..251b59e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
@@ -0,0 +1,18 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * PublicKey 登录校验Key
+ */
+class PublicKeyModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var isAppKaptcha = false
+ var isKaptcha = false
+ var publicKey: String? = null
+ var sid: String? = null
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
new file mode 100644
index 0000000..c92507a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
@@ -0,0 +1,13 @@
+package com.casic.qd.smartwell.model
+
+class LoginResultModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var kaptcha: String? = null
+ var token: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
new file mode 100644
index 0000000..251b59e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
@@ -0,0 +1,18 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * PublicKey 登录校验Key
+ */
+class PublicKeyModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var isAppKaptcha = false
+ var isKaptcha = false
+ var publicKey: String? = null
+ var sid: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
new file mode 100644
index 0000000..56c2e88
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
@@ -0,0 +1,31 @@
+package com.casic.qd.smartwell.model
+
+class UserDetailModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var account: String? = null
+ var attr1: String? = null
+ var avatar: String? = null
+ var bizData: String? = null
+ var dataScope: List? = null
+ var deptId: String? = null
+ var deptName: String? = null
+ var devices: List? = null
+ var id: String? = null
+ var ipAddr: String? = null
+ var name: String? = null
+ var phone: String? = null
+ var roleList: List? = null
+ var roleNames: List? = null
+ var roleTips: List? = null
+ var scopeType: String? = null
+ var sysData: String? = null
+ var targetId: String? = null
+ var targetName: String? = null
+ var tenantId: String? = null
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
new file mode 100644
index 0000000..c92507a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
@@ -0,0 +1,13 @@
+package com.casic.qd.smartwell.model
+
+class LoginResultModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var kaptcha: String? = null
+ var token: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
new file mode 100644
index 0000000..251b59e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
@@ -0,0 +1,18 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * PublicKey 登录校验Key
+ */
+class PublicKeyModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var isAppKaptcha = false
+ var isKaptcha = false
+ var publicKey: String? = null
+ var sid: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
new file mode 100644
index 0000000..56c2e88
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
@@ -0,0 +1,31 @@
+package com.casic.qd.smartwell.model
+
+class UserDetailModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var account: String? = null
+ var attr1: String? = null
+ var avatar: String? = null
+ var bizData: String? = null
+ var dataScope: List? = null
+ var deptId: String? = null
+ var deptName: String? = null
+ var devices: List? = null
+ var id: String? = null
+ var ipAddr: String? = null
+ var name: String? = null
+ var phone: String? = null
+ var roleList: List? = null
+ var roleNames: List? = null
+ var roleTips: List? = null
+ var scopeType: String? = null
+ var sysData: String? = null
+ var targetId: String? = null
+ var targetName: String? = null
+ var tenantId: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt
new file mode 100644
index 0000000..10fb21f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt
@@ -0,0 +1,41 @@
+package com.casic.qd.smartwell.model
+
+class WellDetailModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var area: String? = null
+ var areaFullName: String? = null
+ var bfzt: String? = null
+ var bfztName: String? = null
+ var coordinateX: String? = null
+ var coordinateY: String? = null
+ var deep: String? = null
+ var deptName: String? = null
+ var deptid: String? = null
+ var deviceCount: String? = null
+ var id: String? = null
+ var latBaidu: String? = null
+ var latGaode: String? = null
+ var lngBaidu: String? = null
+ var lngGaode: String? = null
+ var notes: String? = null
+ var photos: String? = null
+ var position: String? = null
+ var qu: String? = null
+ var responsibleDept: String? = null
+ var responsibleDeptName: String? = null
+ var ts: String? = null
+ var valid: String? = null
+ var wellCode: String? = null
+ var wellFlag1: String? = null
+ var wellFlag2: String? = null
+ var wellFlag3: String? = null
+ var wellName: String? = null
+ var wellType: String? = null
+ var wellTypeName: String? = null
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class, value: String) {
+ val intent = Intent(this, clazz)
+ intent.putExtra(Constant.INTENT_PARAM, value)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(clazz: Class, values: ArrayList) {
+ val intent = Intent(this, clazz)
+ intent.putStringArrayListExtra(Constant.INTENT_PARAM, values)
+ startActivity(intent)
+}
+
+fun Context.navigatePageTo(
+ clazz: Class,
+ index: Int,
+ imageList: ArrayList
+) {
+ val intent = Intent(this, clazz)
+ intent.putExtra("index", index)
+ intent.putStringArrayListExtra("images", imageList)
+ startActivity(intent)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
new file mode 100644
index 0000000..9327e3d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Int.kt
@@ -0,0 +1,16 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.base.BaseApplication
+import kotlin.random.Random
+
+//颜色扩展
+fun Int.convertColor(): Int = ContextCompat.getColor(BaseApplication.obtainInstance(), this)
+
+//随机数
+fun Int.randomNumber(): Int {
+ if (this < 100) {
+ return Random.nextInt(100)
+ }
+ return Random.nextInt(this - 100, this + 100)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
new file mode 100644
index 0000000..4ef137e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/QMUIEmptyView.kt
@@ -0,0 +1,12 @@
+package com.casic.qd.smartwell.extensions
+
+import android.view.View
+import com.qmuiteam.qmui.widget.QMUIEmptyView
+
+fun QMUIEmptyView.showEmptyPage(onButtonClickListener: View.OnClickListener) {
+ this.show(false, "抱歉,无法查询到相关记录", null, "重试", onButtonClickListener)
+}
+
+fun QMUIEmptyView.showEmptyPage(title: String, onButtonClickListener: View.OnClickListener) {
+ this.show(false, title, null, "刷新", onButtonClickListener)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
new file mode 100644
index 0000000..8870765
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/String.kt
@@ -0,0 +1,52 @@
+package com.casic.qd.smartwell.extensions
+
+import android.graphics.Color
+import android.view.Gravity
+import android.widget.TextView
+import android.widget.Toast
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.base.BaseApplication
+import com.casic.qd.smartwell.model.ErrorMessageModel
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import org.json.JSONObject
+
+/**
+ * String扩展方法
+ */
+
+//将Toast扩展到String
+fun String.show() {
+ val context = BaseApplication.obtainInstance()
+ val toast = Toast(context)
+ val textView = TextView(context)
+ textView.setBackgroundResource(R.drawable.bg_toast_layout)
+ textView.setTextColor(Color.WHITE)
+ textView.textSize = 16.0f
+ textView.text = this
+ textView.setPadding(
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10),
+ QMUIDisplayHelper.dp2px(context, 20),
+ QMUIDisplayHelper.dp2px(context, 10)
+ )
+ toast.setGravity(Gravity.BOTTOM, 0, QMUIDisplayHelper.dp2px(context, 80))
+ toast.view = textView
+ toast.duration = Toast.LENGTH_SHORT
+ toast.show()
+}
+
+fun String.separateResponseCode(): Int {
+ if (this.isBlank()) {
+ return 404
+ }
+ return JSONObject(this).getInt("code")
+}
+
+fun String.toErrorMessage(): String {
+ val errorModel = Gson().fromJson(
+ this, object : TypeToken() {}.type
+ )
+ return errorModel.message.toString()
+}
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
new file mode 100644
index 0000000..80ec161
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/ViewModel.kt
@@ -0,0 +1,33 @@
+package com.casic.qd.smartwell.extensions
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.CoroutineExceptionHandler
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+
+/**
+ * ViewModel扩展方法:启动协程
+ * @param block 协程逻辑
+ * @param onError 错误回调方法
+ * @param onComplete 完成回调方法
+ */
+fun ViewModel.launch(
+ block: suspend CoroutineScope.() -> Unit,
+ onError: (e: Throwable) -> Unit = {},
+ onComplete: () -> Unit = {}
+) {
+ viewModelScope.launch(
+ CoroutineExceptionHandler { _, throwable ->
+ run {
+ onError(throwable)
+ }
+ }
+ ) {
+ try {
+ block.invoke(this)
+ } finally {
+ onComplete()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
new file mode 100644
index 0000000..de1293f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/AlarmListModel.kt
@@ -0,0 +1,38 @@
+package com.casic.qd.smartwell.model
+
+class AlarmListModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var rows: MutableList? = null
+ var total = 0
+
+ class RowsBean {
+ var alarmContent = 0
+ var deptName: String? = null
+ var jobStatus: String? = null
+ var alarmContentName: String? = null
+ var wellCode: String? = null
+ var alarmTime: String? = null
+ var deptid: String? = null
+ var alarmTypeName: String? = null
+ var alarmMessage: String? = null
+ var staff: String? = null
+ var deviceId: String? = null
+ var jobId: String? = null
+ var alarmType: String? = null
+ var alarmValue: String? = null
+ var devcode: String? = null
+ var statusName: String? = null
+ var alarmLevel: String? = null
+ var tel: String? = null
+ var id: String? = null
+ var wellId: String? = null
+ var position: String? = null
+ var status: String? = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
new file mode 100644
index 0000000..d6af0f1
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/BannerImageModel.kt
@@ -0,0 +1,30 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * @author Administrator
+ * @description TODO
+ * @package com.example.mutidemo.bean
+ * @date 2022/2/17 23:43
+ * @email 290677893@qq.com
+ */
+class BannerImageModel {
+ /**
+ * success : true
+ * code : 200
+ * message : 请求成功
+ * data : [{"imageTitle":"测试标题1","imageLink":"https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题2","imageLink":"https://images.pexels.com/photos/796602/pexels-photo-796602.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题3","imageLink":"https://images.pexels.com/photos/1109543/pexels-photo-1109543.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题4","imageLink":"https://images.pexels.com/photos/296115/pexels-photo-296115.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"},{"imageTitle":"测试标题5","imageLink":"https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500"}]
+ */
+ var isSuccess = false
+ var code = 0
+ var message: String? = null
+ var data: List? = null
+
+ class DataBean {
+ /**
+ * imageTitle : 测试标题1
+ * imageLink : https://images.pexels.com/photos/1036808/pexels-photo-1036808.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500
+ */
+ var imageTitle: String? = null
+ var imageLink: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
new file mode 100644
index 0000000..554e513
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/ErrorMessageModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.model
+
+class ErrorMessageModel {
+ var code = 0
+ var data: String? = null
+ var exceptionClazz: String? = null
+ var message: String? = null
+ var isSuccess = false
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
new file mode 100644
index 0000000..c92507a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/LoginResultModel.kt
@@ -0,0 +1,13 @@
+package com.casic.qd.smartwell.model
+
+class LoginResultModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var kaptcha: String? = null
+ var token: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
new file mode 100644
index 0000000..251b59e
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/PublicKeyModel.kt
@@ -0,0 +1,18 @@
+package com.casic.qd.smartwell.model
+
+/**
+ * PublicKey 登录校验Key
+ */
+class PublicKeyModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var isAppKaptcha = false
+ var isKaptcha = false
+ var publicKey: String? = null
+ var sid: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
new file mode 100644
index 0000000..56c2e88
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/UserDetailModel.kt
@@ -0,0 +1,31 @@
+package com.casic.qd.smartwell.model
+
+class UserDetailModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var account: String? = null
+ var attr1: String? = null
+ var avatar: String? = null
+ var bizData: String? = null
+ var dataScope: List? = null
+ var deptId: String? = null
+ var deptName: String? = null
+ var devices: List? = null
+ var id: String? = null
+ var ipAddr: String? = null
+ var name: String? = null
+ var phone: String? = null
+ var roleList: List? = null
+ var roleNames: List? = null
+ var roleTips: List? = null
+ var scopeType: String? = null
+ var sysData: String? = null
+ var targetId: String? = null
+ var targetName: String? = null
+ var tenantId: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt b/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt
new file mode 100644
index 0000000..10fb21f
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/model/WellDetailModel.kt
@@ -0,0 +1,41 @@
+package com.casic.qd.smartwell.model
+
+class WellDetailModel {
+ var code = 0
+ var data: DataBean? = null
+ var message: String? = null
+ var isSuccess = false
+
+ class DataBean {
+ var area: String? = null
+ var areaFullName: String? = null
+ var bfzt: String? = null
+ var bfztName: String? = null
+ var coordinateX: String? = null
+ var coordinateY: String? = null
+ var deep: String? = null
+ var deptName: String? = null
+ var deptid: String? = null
+ var deviceCount: String? = null
+ var id: String? = null
+ var latBaidu: String? = null
+ var latGaode: String? = null
+ var lngBaidu: String? = null
+ var lngGaode: String? = null
+ var notes: String? = null
+ var photos: String? = null
+ var position: String? = null
+ var qu: String? = null
+ var responsibleDept: String? = null
+ var responsibleDeptName: String? = null
+ var ts: String? = null
+ var valid: String? = null
+ var wellCode: String? = null
+ var wellFlag1: String? = null
+ var wellFlag2: String? = null
+ var wellFlag3: String? = null
+ var wellName: String? = null
+ var wellType: String? = null
+ var wellTypeName: String? = null
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/utils/AuthenticationHelper.kt b/app/src/main/java/com/casic/qd/smartwell/utils/AuthenticationHelper.kt
new file mode 100644
index 0000000..e46ad9d
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/utils/AuthenticationHelper.kt
@@ -0,0 +1,22 @@
+package com.casic.qd.smartwell.utils
+
+object AuthenticationHelper {
+
+ fun savePublicKey(key: String) {
+ SaveKeyValues.putValue("keyString", key)
+ }
+
+ val publicKey: String?
+ get() = SaveKeyValues.getValue("keyString", "") as String?
+
+ fun saveToken(token: String?) {
+ SaveKeyValues.putValue("token", token!!)
+ }
+
+ val token: String?
+ get() = SaveKeyValues.getValue("token", "") as String?
+
+ fun removeToken() {
+ SaveKeyValues.removeKey("token")
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..60307ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea/
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/QingDaoSmartWell.jks b/app/QingDaoSmartWell.jks
new file mode 100644
index 0000000..76f8be5
--- /dev/null
+++ b/app/QingDaoSmartWell.jks
Binary files differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..c86566b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,84 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+
+android {
+ compileSdkVersion 31
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.casic.qd.smartwell"
+ minSdkVersion 23
+ targetSdkVersion 31
+ versionCode 1
+ versionName "1.0.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlin {
+ experimental {
+ coroutines 'enable'
+ }
+ }
+ buildToolsVersion '30.0.3'
+}
+
+dependencies {
+ implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.appcompat:appcompat:1.4.0'
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ //基础依赖库
+ implementation 'com.github.AndroidCoderPeng:Android-library:1.6.0'
+ //Google官方授权框架
+ implementation 'pub.devrel:easypermissions:3.0.0'
+ //腾讯Android UI框架
+ implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
+ implementation 'com.qmuiteam:arch:0.3.1'
+ //沉浸式状态栏。基础依赖包,必须要依赖
+ implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
+ //MVVM+LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
+ //Kotlin协程
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ //图片加载框架
+ implementation 'com.github.bumptech.glide:glide:4.9.0'
+ //图片选择框架
+ implementation 'io.github.lucksiege:pictureselector:v3.0.4'
+ //高德地图
+ implementation 'com.amap.api:3dmap:7.9.1'
+ implementation 'com.amap.api:location:5.3.1'
+ //返回值转换器
+ implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
+ implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
+ //okhttp3日志拦截器
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
+ //网络请求和接口封装
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
+ implementation 'com.squareup.okhttp3:okhttp:4.9.0'
+ //官方Json解析库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //上拉加载下拉刷新
+ implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
+ //图表
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
+ //轮播图
+ implementation 'io.github.youth5201314:banner:2.2.2'
+ //WebView
+ implementation 'com.just.agentweb:agentweb-androidx:4.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f9514b2
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
new file mode 100644
index 0000000..8720afe
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/AlarmListAdapter.kt
@@ -0,0 +1,76 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.model.AlarmListModel
+import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+
+class AlarmListAdapter(
+ context: Context, private val dataRows: MutableList
+) : RecyclerView.Adapter() {
+
+ private var layoutInflater: LayoutInflater = LayoutInflater.from(context)
+
+ override fun onCreateViewHolder(
+ parent: ViewGroup, viewType: Int
+ ): AlarmListAdapter.ItemViewHolder {
+ return ItemViewHolder(
+ layoutInflater.inflate(R.layout.item_alarm_recycleview, parent, false)
+ )
+ }
+
+ override fun getItemCount(): Int = dataRows.size
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ //绑定数据
+ val rowsBean = dataRows[position]
+ holder.alarmMessageView.text = rowsBean.alarmMessage
+ val alarmValue = rowsBean.alarmValue.toString()
+ if (alarmValue.isBlank()) {
+ holder.alarmValueView.text = "报警值未知"
+ } else {
+ holder.alarmValueView.text = alarmValue
+ }
+ holder.wellCodeView.text = rowsBean.wellCode
+ holder.devCodeView.text = rowsBean.devcode
+ holder.wellLocationView.text = rowsBean.position
+ holder.createTimeView.text = rowsBean.alarmTime
+ //绑定事件
+ if (listener != null) {
+ holder.itemView.setOnClickListener {
+ listener!!.onClicked(position)
+ }
+ holder.operationButton.setChangeAlphaWhenPress(true)
+ holder.operationButton.setOnClickListener {
+ listener!!.onOperationClicked(position)
+ }
+ }
+ }
+
+ inner class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ var alarmMessageView: TextView = view.findViewById(R.id.alarmMessageView)
+ var alarmValueView: TextView = view.findViewById(R.id.alarmValueView)
+ var wellCodeView: TextView = view.findViewById(R.id.wellCodeView)
+ var devCodeView: TextView = view.findViewById(R.id.devCodeView)
+ var wellLocationView: TextView = view.findViewById(R.id.wellLocationView)
+ var createTimeView: TextView = view.findViewById(R.id.createTimeView)
+ var operationButton: QMUIRoundButton = view.findViewById(R.id.operationButton)
+ }
+
+ private var listener: OnItemClickListener? = null
+
+ interface OnItemClickListener {
+ fun onClicked(position: Int)
+
+ fun onOperationClicked(position: Int)
+ }
+
+ fun setOnItemClickListener(onClickListener: OnItemClickListener?) {
+ this.listener = onClickListener
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
new file mode 100644
index 0000000..8ff874a
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/adapter/HomeRecycleAdapter.kt
@@ -0,0 +1,48 @@
+package com.casic.qd.smartwell.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.utils.Constant
+
+class HomeRecycleAdapter(private val context: Context) :
+ RecyclerView.Adapter() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
+ val view: View =
+ LayoutInflater.from(context).inflate(R.layout.item_home_recycleview, parent, false)
+ return ItemViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
+ holder.imageView.setBackgroundResource(Constant.HOME_ICONS[position])
+ holder.textView.text = Constant.HOME_ITEMS[position]
+ if (clickListener != null) {
+ holder.itemView.setOnClickListener {
+ clickListener!!.onClick(position)
+ }
+ }
+ }
+
+ override fun getItemCount(): Int = Constant.HOME_ITEMS.size
+
+ private var clickListener: OnGridItemClickListener? = null
+
+ interface OnGridItemClickListener {
+ fun onClick(position: Int)
+ }
+
+ fun setOnGridItemClickListener(onGridItemClickListener: OnGridItemClickListener?) {
+ clickListener = onGridItemClickListener
+ }
+
+ class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val imageView: ImageView = itemView.findViewById(R.id.imageView)
+ val textView: TextView = itemView.findViewById(R.id.textView)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
new file mode 100644
index 0000000..6655804
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseActivity.kt
@@ -0,0 +1,75 @@
+package com.casic.qd.smartwell.base
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import com.casic.qd.smartwell.R
+import com.casic.qd.smartwell.extensions.convertColor
+import com.casic.qd.smartwell.extensions.isNetworkConnected
+import com.casic.qd.smartwell.extensions.show
+import com.casic.qd.smartwell.utils.PageNavigationManager
+import com.casic.qd.smartwell.utils.StatusBarColorUtil
+import com.gyf.immersionbar.ImmersionBar
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.cancel
+
+/**
+ * 普通页面的基础类
+ * */
+abstract class BaseActivity : AppCompatActivity(), CoroutineScope by MainScope() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ if (this.javaClass.simpleName == "SplashScreenActivity" || this.javaClass.simpleName == "LoginActivity") {
+ //闪屏页和登录页不做网络判断
+ setupPage()
+ } else {
+ if (this.isNetworkConnected()) {
+ setupPage()
+ } else {
+ "网络好像走丢了~".show()
+ setContentView(R.layout.page_empty)
+ }
+ }
+ PageNavigationManager.addActivity(this)
+ }
+
+ private fun setupPage() {
+ setContentView(initLayoutView())
+ ImmersionBar.with(this).statusBarDarkFont(false).init() //沉浸式状态栏
+ if (this.javaClass.simpleName != "SplashScreenActivity" && this.javaClass.simpleName != "LoginActivity") {
+ StatusBarColorUtil.setColor(this, R.color.mainThemeColor.convertColor())
+ }
+ setupTopBarLayout()
+ initData()
+ initEvent()
+ }
+
+ /**
+ * 初始化xml布局
+ */
+ abstract fun initLayoutView(): Int
+
+ /**
+ * 特定页面定制沉浸式状态栏
+ */
+ protected abstract fun setupTopBarLayout()
+
+ /**
+ * 初始化默认数据
+ */
+ abstract fun initData()
+
+ /**
+ * 初始化业务逻辑
+ */
+ abstract fun initEvent()
+
+ /**
+ * 取消协程
+ * */
+ override fun onDestroy() {
+ cancel()
+ super.onDestroy()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
new file mode 100644
index 0000000..f7ebc55
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseApplication.kt
@@ -0,0 +1,20 @@
+package com.casic.qd.smartwell.base
+
+import android.app.Application
+import com.casic.qd.smartwell.utils.SaveKeyValues
+import kotlin.properties.Delegates
+
+class BaseApplication : Application() {
+
+ companion object {
+ private var instance: BaseApplication by Delegates.notNull()
+
+ fun obtainInstance() = instance
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ SaveKeyValues.initSharedPreferences()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
new file mode 100644
index 0000000..2d8ce49
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/base/BaseViewModel.kt
@@ -0,0 +1,9 @@
+package com.casic.qd.smartwell.base
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import com.casic.qd.smartwell.utils.LoadState
+
+abstract class BaseViewModel : ViewModel() {
+ val loadState = MutableLiveData()
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
new file mode 100644
index 0000000..ab62dc8
--- /dev/null
+++ b/app/src/main/java/com/casic/qd/smartwell/extensions/Context.kt
@@ -0,0 +1,51 @@
+package com.casic.qd.smartwell.extensions
+
+import android.content.Context
+import android.content.Intent
+import android.net.ConnectivityManager
+import com.casic.qd.smartwell.base.BaseActivity
+import com.casic.qd.smartwell.utils.Constant
+
+/**
+ * 判断是否有网络连接
+ * @return
+ */
+fun Context.isNetworkConnected(): Boolean { //true是连接,false是没连接
+ val manager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
+ if (manager == null) {
+ return false
+ } else {
+ val netWorkInfo = manager.activeNetworkInfo
+ if (netWorkInfo != null) {
+ return netWorkInfo.isAvailable
+ }
+ }
+ return false
+}
+
+fun Context.navigatePageTo(clazz: Class) {
+ startActivity(Intent(this, clazz))
+}
+
+fun Context.navigatePageTo(clazz: Class