Parcourir la source

第一次提交

樊春春 il y a 3 ans
commit
0b2149165e
97 fichiers modifiés avec 4805 ajouts et 0 suppressions
  1. 10 0
      .gitignore
  2. 3 0
      .idea/.gitignore
  3. BIN
      .idea/caches/build_file_checksums.ser
  4. 29 0
      .idea/codeStyles/Project.xml
  5. 6 0
      .idea/compiler.xml
  6. 3 0
      .idea/dictionaries/fanchunchun.xml
  7. 20 0
      .idea/gradle.xml
  8. 45 0
      .idea/jarRepositories.xml
  9. 52 0
      .idea/misc.xml
  10. 10 0
      .idea/runConfigurations.xml
  11. 1 0
      app/.gitignore
  12. 68 0
      app/build.gradle
  13. BIN
      app/libs/Amap_2DMap_V5.2.0_20170627.jar
  14. BIN
      app/libs/BaiduLBS_Android.jar
  15. BIN
      app/libs/android-async-http-1.4.6.jar
  16. BIN
      app/libs/qiniu-android-sdk-7.0.3.jar
  17. 21 0
      app/proguard-rules.pro
  18. BIN
      app/release/app-release.apk
  19. 1 0
      app/release/output.json
  20. 26 0
      app/src/androidTest/java/com/ahau/againstpest/ExampleInstrumentedTest.java
  21. 68 0
      app/src/main/AndroidManifest.xml
  22. 74 0
      app/src/main/java/com/ahau/againstpest/HttpProcessor/AsyncProcessor.java
  23. 36 0
      app/src/main/java/com/ahau/againstpest/HttpProcessor/HttpCallback.java
  24. 85 0
      app/src/main/java/com/ahau/againstpest/HttpProcessor/HttpHelper.java
  25. 13 0
      app/src/main/java/com/ahau/againstpest/HttpProcessor/ICallback.java
  26. 16 0
      app/src/main/java/com/ahau/againstpest/HttpProcessor/IHttpProcessor.java
  27. 776 0
      app/src/main/java/com/ahau/againstpest/MyView/SpinnerEditText.java
  28. 21 0
      app/src/main/java/com/ahau/againstpest/MyView/TextWatchAdapter.java
  29. 528 0
      app/src/main/java/com/ahau/againstpest/activity/AgainPestActivity.java
  30. 99 0
      app/src/main/java/com/ahau/againstpest/activity/LocationActivity.java
  31. 159 0
      app/src/main/java/com/ahau/againstpest/activity/LoginActivity.java
  32. 53 0
      app/src/main/java/com/ahau/againstpest/activity/SearchActivity.java
  33. 225 0
      app/src/main/java/com/ahau/againstpest/base/BaiduBaseActivity.java
  34. 43 0
      app/src/main/java/com/ahau/againstpest/base/MyApplication.java
  35. 17 0
      app/src/main/java/com/ahau/againstpest/bean/AreaBean.java
  36. 70 0
      app/src/main/java/com/ahau/againstpest/bean/PestBean.java
  37. 46 0
      app/src/main/java/com/ahau/againstpest/model/IPestModel.java
  38. 174 0
      app/src/main/java/com/ahau/againstpest/model/PestModelImpl.java
  39. 26 0
      app/src/main/java/com/ahau/againstpest/presenter/BasePresenter.java
  40. 76 0
      app/src/main/java/com/ahau/againstpest/presenter/PestPresenter.java
  41. 35 0
      app/src/main/java/com/ahau/againstpest/utils/CacheUtils.java
  42. 31 0
      app/src/main/java/com/ahau/againstpest/utils/GsonUtils.java
  43. 70 0
      app/src/main/java/com/ahau/againstpest/utils/LoginUtils.java
  44. 35 0
      app/src/main/java/com/ahau/againstpest/utils/PermissionUtils.java
  45. 42 0
      app/src/main/java/com/ahau/againstpest/utils/PrefUtils.java
  46. 118 0
      app/src/main/java/com/ahau/againstpest/utils/ScreenUtils.java
  47. 89 0
      app/src/main/java/com/ahau/againstpest/utils/SpinerPopWindow.java
  48. 181 0
      app/src/main/java/com/ahau/againstpest/utils/TakingPhotoUtils.java
  49. 18 0
      app/src/main/java/com/ahau/againstpest/utils/URLUtils.java
  50. 27 0
      app/src/main/java/com/ahau/againstpest/utils/Utils.java
  51. 34 0
      app/src/main/java/com/ahau/againstpest/view/BaseActivity.java
  52. 23 0
      app/src/main/java/com/ahau/againstpest/view/IPestView.java
  53. BIN
      app/src/main/jniLibs/armeabi/libBaiduMapSDK_base_v5_0_0.so
  54. BIN
      app/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v5_0_0.so
  55. BIN
      app/src/main/jniLibs/armeabi/liblocSDK7b.so
  56. BIN
      app/src/main/res/drawable-hdpi/againpest.jpg
  57. BIN
      app/src/main/res/drawable-hdpi/bottom_nor.png
  58. BIN
      app/src/main/res/drawable-hdpi/choose.png
  59. BIN
      app/src/main/res/drawable-hdpi/close.png
  60. BIN
      app/src/main/res/drawable-hdpi/ic_launcher.png
  61. BIN
      app/src/main/res/drawable-hdpi/loginbg.png
  62. BIN
      app/src/main/res/drawable-hdpi/map.jpg
  63. BIN
      app/src/main/res/drawable-hdpi/password.png
  64. BIN
      app/src/main/res/drawable-hdpi/pest.jpg
  65. BIN
      app/src/main/res/drawable-hdpi/phone.png
  66. BIN
      app/src/main/res/drawable-hdpi/right_arrow.png
  67. 5 0
      app/src/main/res/drawable/btn_background.xml
  68. 426 0
      app/src/main/res/layout/activity_again_pest.xml
  69. 76 0
      app/src/main/res/layout/activity_location.xml
  70. 109 0
      app/src/main/res/layout/activity_login.xml
  71. 90 0
      app/src/main/res/layout/activity_search.xml
  72. 22 0
      app/src/main/res/layout/listpopwindow.xml
  73. 97 0
      app/src/main/res/layout/personpicchange.xml
  74. 10 0
      app/src/main/res/layout/spiner_item_layout.xml
  75. 16 0
      app/src/main/res/layout/spiner_window_layout.xml
  76. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  77. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  78. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  79. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  80. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  81. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  82. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  83. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  84. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  85. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  86. 10 0
      app/src/main/res/values/colors.xml
  87. 3 0
      app/src/main/res/values/strings.xml
  88. 12 0
      app/src/main/res/values/styles.xml
  89. 4 0
      app/src/main/res/xml/network_security_config.xml
  90. 17 0
      app/src/test/java/com/ahau/againstpest/ExampleUnitTest.java
  91. 30 0
      build.gradle
  92. 13 0
      gradle.properties
  93. BIN
      gradle/wrapper/gradle-wrapper.jar
  94. 5 0
      gradle/wrapper/gradle-wrapper.properties
  95. 172 0
      gradlew
  96. 84 0
      gradlew.bat
  97. 1 0
      settings.gradle

+ 10 - 0
.gitignore

@@ -0,0 +1,10 @@
+*.iml
+.gradle
+/local.properties
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild

+ 3 - 0
.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

BIN
.idea/caches/build_file_checksums.ser


+ 29 - 0
.idea/codeStyles/Project.xml

@@ -0,0 +1,29 @@
+<component name="ProjectCodeStyleConfiguration">
+  <code_scheme name="Project" version="173">
+    <Objective-C-extensions>
+      <file>
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
+      </file>
+      <class>
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
+        <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
+      </class>
+      <extensions>
+        <pair source="cpp" header="h" fileNamingConvention="NONE" />
+        <pair source="c" header="h" fileNamingConvention="NONE" />
+      </extensions>
+    </Objective-C-extensions>
+  </code_scheme>
+</component>

+ 6 - 0
.idea/compiler.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="1.8" />
+  </component>
+</project>

+ 3 - 0
.idea/dictionaries/fanchunchun.xml

@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="fanchunchun" />
+</component>

+ 20 - 0
.idea/gradle.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleMigrationSettings" migrationVersion="1" />
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <option name="testRunner" value="PLATFORM" />
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="modules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/app" />
+          </set>
+        </option>
+        <option name="resolveModulePerSourceSet" value="false" />
+      </GradleProjectSettings>
+    </option>
+  </component>
+</project>

+ 45 - 0
.idea/jarRepositories.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="BintrayJCenter" />
+      <option name="name" value="BintrayJCenter" />
+      <option name="url" value="https://jcenter.bintray.com/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="maven" />
+      <option name="name" value="maven" />
+      <option name="url" value="https://jitpack.io" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="Google" />
+      <option name="name" value="Google" />
+      <option name="url" value="https://dl.google.com/dl/android/maven2/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="$USER_HOME$/Library/Android/sdk/extras/m2repository" />
+      <option name="name" value="$USER_HOME$/Library/Android/sdk/extras/m2repository" />
+      <option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/m2repository" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="$USER_HOME$/Library/Android/sdk/extras/android/m2repository" />
+      <option name="name" value="$USER_HOME$/Library/Android/sdk/extras/android/m2repository" />
+      <option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/android/m2repository/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="$USER_HOME$/Library/Android/sdk/extras/google/m2repository" />
+      <option name="name" value="$USER_HOME$/Library/Android/sdk/extras/google/m2repository" />
+      <option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/google/m2repository" />
+    </remote-repository>
+  </component>
+</project>

+ 52 - 0
.idea/misc.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="NullableNotNullManager">
+    <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
+    <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
+    <option name="myNullables">
+      <value>
+        <list size="14">
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
+          <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
+          <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
+          <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
+          <item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
+          <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
+          <item index="7" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
+          <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
+          <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
+          <item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
+          <item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
+          <item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
+          <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
+        </list>
+      </value>
+    </option>
+    <option name="myNotNulls">
+      <value>
+        <list size="13">
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
+          <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
+          <item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
+          <item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
+          <item index="6" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
+          <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
+          <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
+          <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
+          <item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
+          <item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
+          <item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
+        </list>
+      </value>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+  <component name="ProjectType">
+    <option name="id" value="Android" />
+  </component>
+</project>

+ 10 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 1 - 0
app/.gitignore

@@ -0,0 +1 @@
+/build

+ 68 - 0
app/build.gradle

@@ -0,0 +1,68 @@
+apply plugin: 'com.android.application'
+
+android {
+    signingConfigs {
+        releaseConfig {
+            storeFile file('/Users/fanchunchun/.android/android.keystore')
+            storePassword '347470868'
+            keyAlias 'ccc'
+            keyPassword '347470868'
+        }
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+
+    compileSdkVersion 28
+    defaultConfig {
+        applicationId "com.ahau.againstpest"
+        minSdkVersion 15
+        targetSdkVersion 28
+        versionCode 1
+        versionName "1.0"
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    implementation fileTree(include: ['*.jar'], dir: 'libs')
+    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
+    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
+    androidTestImplementation 'com.android.support.test:runner:1.0.2'
+    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+
+    implementation 'org.apache.httpcomponents:httpcore:4.4.2'
+    implementation 'com.google.code.gson:gson:2.8.5'
+    implementation 'cz.msebera.android:httpclient:4.4.1.2'
+    implementation 'com.android.support:design:28.0.0-alpha3'
+    implementation 'com.github.z2wenfa:SpinnerEditText:0.9'
+}
+
+//signingConfigs{
+//    release {
+//        storeFile file("/Users/fanchunchun/.android")        //证书存放目录
+//        storePassword "347470868"                               //密码
+//        keyAlias "ccc"                                                //别名
+//        keyPassword "347470868"                                //密码(就是设置证书那两个密码,建议都填一样的)
+//    }
+//}
+//
+//
+//buildTypes {
+//    debug {
+//        signingConfig signingConfigs.release
+//    }
+//
+//    release {
+//        signingConfig signingConfigs.release
+//    }
+//}

BIN
app/libs/Amap_2DMap_V5.2.0_20170627.jar


BIN
app/libs/BaiduLBS_Android.jar


BIN
app/libs/android-async-http-1.4.6.jar


BIN
app/libs/qiniu-android-sdk-7.0.3.jar


+ 21 - 0
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

BIN
app/release/app-release.apk


+ 1 - 0
app/release/output.json

@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

+ 26 - 0
app/src/androidTest/java/com/ahau/againstpest/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package com.ahau.againstpest;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getTargetContext();
+
+        assertEquals("com.ahau.againstpest", appContext.getPackageName());
+    }
+}

+ 68 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.ahau.againstpest"
+    xmlns:tools="http://schemas.android.com/tools">
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <uses-permission android:name="android.permission.INTERNET"/>
+
+
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <!-- 获取网络状态 -->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <!-- 访问网络 -->
+    <uses-permission android:name="android.permission.INTERNET" />
+    <!-- 获取WiFi状态 -->
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <!-- 允许程序写入外部存储,如SD卡上写文件 -->
+    <permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <permission android:name="android.permission.WRITE_SETTINGS" />
+    <!-- 读取电话状态 -->
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.CALL_PHONE" />
+    <!-- 获取精确位置 GPS芯片接收卫星的定位信息,定位精度达10米以内 -->
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+
+    <!-- 通过WiFi或移动基站的方式获取用户错略的经纬度信息 -->
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+    <permission android:name="android.permission.CHANGE_CONFIGURATION" />
+
+    <uses-sdk android:minSdkVersion="17" tools:overrideLibrary="com.z2wenfa.spinneredittext" />
+    <!-- 获取模拟定位信息 -->
+
+    <application
+        android:name=".base.MyApplication"
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme"
+
+        android:usesCleartextTraffic="true"
+        android:networkSecurityConfig="@xml/network_security_config">
+
+        <meta-data
+            android:name="com.baidu.lbsapi.API_KEY"
+            android:value="QBSD7yQZCUe7O5hapEHt5FRQzXkHeDuR" />
+        <service
+            android:name="com.baidu.location.f"
+            android:enabled="true"
+            android:process=":remote"></service>
+
+        <activity android:name=".activity.LoginActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".activity.LocationActivity" />
+        <activity android:name=".activity.SearchActivity" />
+        <activity android:name=".activity.AgainPestActivity" />
+        <uses-library android:name="org.apache.http.legacy" android:required="false" />
+    </application>
+
+</manifest>

+ 74 - 0
app/src/main/java/com/ahau/againstpest/HttpProcessor/AsyncProcessor.java

@@ -0,0 +1,74 @@
+package com.ahau.againstpest.HttpProcessor;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.loopj.android.http.AsyncHttpClient;
+import com.loopj.android.http.AsyncHttpResponseHandler;
+
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+
+import java.util.Map;
+
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/6
+ */
+
+public class AsyncProcessor implements IHttpProcessor {
+
+    public static final String TAG = "AsyncProcessor";
+
+    Context  mContext;
+    @Override
+    public void post(String url, Map<String, Object> params, final ICallback callback) {
+
+        // 创建异步请求端对象
+        AsyncHttpClient client = new AsyncHttpClient();
+
+        // 发送get请求对象
+        client.post(mContext,url, (HttpEntity) params,"application/json", new AsyncHttpResponseHandler() {
+            @Override
+            public void onSuccess(int i, Header[] headers, byte[] bytes) {
+                String result = new String(bytes);
+                callback.onSuccess(result);
+            }
+
+            @Override
+            public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
+                callback.onSuccess(throwable.toString());
+            }
+        });
+
+    }
+
+    @Override
+    public void get(String url, Map<String, Object> params, final ICallback callback) {
+
+        // 创建异步请求端对象
+        AsyncHttpClient client = new AsyncHttpClient();
+
+        // 发送get请求对象
+        client.get(url, new AsyncHttpResponseHandler() {
+
+
+            @Override
+                    public void onSuccess(int i, Header[] headers, byte[] bytes) {
+                        String result = new String(bytes);
+                        Log.i(TAG, "请求成功" + result);
+                        callback.onSuccess(result);
+                    }
+
+                    @Override
+                    public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
+                        Log.i(TAG, "请求异常" + throwable.toString());
+                        callback.onSuccess(throwable.toString());
+                    }
+                }
+        );
+    }
+}

+ 36 - 0
app/src/main/java/com/ahau/againstpest/HttpProcessor/HttpCallback.java

@@ -0,0 +1,36 @@
+package com.ahau.againstpest.HttpProcessor;
+
+import com.google.gson.Gson;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public abstract class HttpCallback<Result> implements ICallback {
+    @Override
+    public void onSuccess(String result) {
+        Gson gson = new Gson();
+        Class<?> clz = analysisClassInfo(this);
+        Result objResult = (Result) gson.fromJson(result, clz);
+        onSuccess(objResult);
+    }
+
+    public abstract void onSuccess(Result result);
+
+    private Class<?> analysisClassInfo(Object object) {
+        Type getType = object.getClass().getGenericSuperclass();
+        Type[] params = ((ParameterizedType)getType).getActualTypeArguments();
+        return (Class<?>) params[0];
+    }
+
+    @Override
+    public void onFailure(String e) {
+
+    }
+}

+ 85 - 0
app/src/main/java/com/ahau/againstpest/HttpProcessor/HttpHelper.java

@@ -0,0 +1,85 @@
+package com.ahau.againstpest.HttpProcessor;
+
+import android.util.Log;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 注释:代理模式的代理
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public class HttpHelper implements IHttpProcessor{
+    private static IHttpProcessor mIHttpProcessor = null;
+    private Map<String, Object> mParams;
+    private static HttpHelper _instance;
+
+    private HttpHelper() {
+        mParams = new HashMap<>();
+    }
+
+
+    /**
+     * 单例设计模式
+     * @return
+     */
+    public static  HttpHelper obtain() {
+        synchronized (HttpHelper.class) {
+            if (_instance == null) {
+                _instance = new HttpHelper();
+            }
+        }
+        return _instance;
+    }
+
+    public static void  init(IHttpProcessor httpProcessor) {
+        mIHttpProcessor = httpProcessor;
+    }
+
+    @Override
+    public void post(String url, Map<String, Object> params, ICallback callback) {
+        final String finalUrl = appendParams(url, params);
+        mIHttpProcessor.post(finalUrl, params,callback);
+    }
+
+    @Override
+    public void get(String url, Map<String, Object> params, ICallback callback) {
+        final String finalUrl = appendParams(url, params);
+        mIHttpProcessor.get(finalUrl, params, callback);
+    }
+
+    private String appendParams(String url, Map<String, Object> params) {
+        if (params == null || params.isEmpty()) {
+            return url;
+        }
+
+        StringBuilder urlBuilder = new StringBuilder(url);
+        if (urlBuilder.indexOf("?")<= 0) {
+            urlBuilder.append("?");
+        }else {
+            if (!urlBuilder.toString().endsWith("?")) {
+                urlBuilder.append("&");
+            }
+        }
+        for (Map.Entry<String, Object> entry : params.entrySet()) {
+            urlBuilder.append(entry.getKey()).append("=").append(encode(entry.getValue().toString()));
+        }
+        return urlBuilder.toString();
+    }
+
+    //URI不允许有空格等字符,如果参数值有空格,需要此方法转换
+    private static String encode(String str) {
+        try {
+            return URLEncoder.encode(str, "utf-8");
+        } catch (UnsupportedEncodingException e) {
+            //针对不支持的编码时报错,utf-8应该是支持的
+            Log.e("参数转码异常", e.toString());
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 13 - 0
app/src/main/java/com/ahau/againstpest/HttpProcessor/ICallback.java

@@ -0,0 +1,13 @@
+package com.ahau.againstpest.HttpProcessor;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public interface ICallback {
+    void onSuccess(String result);
+    void onFailure(String e);
+}

+ 16 - 0
app/src/main/java/com/ahau/againstpest/HttpProcessor/IHttpProcessor.java

@@ -0,0 +1,16 @@
+package com.ahau.againstpest.HttpProcessor;
+
+import java.util.Map;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public interface IHttpProcessor {
+    //网络访问: Post, get, Del, Update, put
+    void post(String url, Map<String, Object> params, ICallback callback);
+    void get(String url, Map<String, Object> params, ICallback callback);
+}

+ 776 - 0
app/src/main/java/com/ahau/againstpest/MyView/SpinnerEditText.java

@@ -0,0 +1,776 @@
+package com.ahau.againstpest.MyView;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.Rect;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.os.Handler;
+import android.os.Message;
+import android.support.annotation.RequiresApi;
+import android.support.v7.widget.AppCompatEditText;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.ActionMode;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.widget.AbsListView;
+import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
+import android.widget.ListPopupWindow;
+import android.widget.ListView;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+
+import com.ahau.againstpest.R;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 一个既可以编辑又可以下拉选中的自定义View
+ * 1.获得一个列表内容 在编辑框文本变化时 动态显示相关列表内容 (完成)
+ * 2.点击列表内容能够修改编辑框显示文本 同时出发文本修改变化事件 文本修改后光标改到文本末尾 (完成)
+ * 3.当Foucs发生变化且是选中时显示相关列表内容(完成)
+ * 4.点击选中项触发事件 获得选中的Bean
+ * <p>
+ * Created by z2wenfa on 2017/2/14.
+ */
+
+public class SpinnerEditText<T> extends AppCompatEditText {
+    private Context context;
+    private int maxHeight;
+    private int childHeight;
+
+
+    private DrawableLeftListener mLeftListener;
+    private DrawableRightListener mRightListener;
+
+    final int DRAWABLE_LEFT = 0;
+    final int DRAWABLE_TOP = 1;
+    final int DRAWABLE_RIGHT = 2;
+    final int DRAWABLE_BOTTOM = 3;
+
+    public static final int STATUS_NORMAL = 0;
+    public static final int STATUS_EXCEPTION = 1;
+
+    private boolean isNecessary = false;//是否是必须条件
+    private boolean autoCheckStatusByTextIsEmpty = false;//是否自动判断状态通过判断文本是否异常
+    private int status = STATUS_NORMAL;//当前显示状态 异常状态编辑框 Stoke颜色设置为红色
+
+
+    private static final int TYPE_UP = 0;//Pop向上显示
+
+    public static final int TYPE_DOWN = 1;//pop向下显示
+    public int showType = TYPE_UP;//Popupwindow显示类型
+    private boolean autoCheckShowType = true;
+
+    private boolean forbidShowPopOnce = false;//禁止弹出一次Pop选择框
+
+
+    public SpinnerEditText(Context context) {
+        super(context);
+        this.context = context;
+        init();
+    }
+
+    public SpinnerEditText(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        this.context = context;
+        init();
+    }
+
+    public SpinnerEditText(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        this.context = context;
+        init();
+    }
+
+
+    @Override
+    public boolean onTextContextMenuItem(int id) {
+        if (id == android.R.id.paste) {
+            return false;
+        }
+        return super.onTextContextMenuItem(id);
+    }
+
+    private void init() {
+
+        setLongClickable(false);
+        maxHeight = dp2px(context, 120);
+        childHeight = dp2px(context, 40);
+        setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);//设置字体大小
+
+
+        this.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
+
+            @Override
+            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+
+//                showPopWindow();
+                return false;
+            }
+
+            @Override
+            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+                return false;
+            }
+
+            @Override
+            public void onDestroyActionMode(ActionMode mode) {
+
+            }
+
+            @Override
+            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+                return false;
+            }
+        });
+
+        this.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
+
+        //文本变换事件
+        addTextChangedListener(new TextWatchAdapter() {
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+                if (popupWindow != null && SpinnerEditText.this.hasFocus()) {
+                    handler.removeMessages(2);
+                    handler.sendEmptyMessage(2);
+                }
+
+                if (autoCheckStatusByTextIsEmpty) {
+                    if (TextUtils.isEmpty(charSequence.toString())) {
+                        setStatus(STATUS_EXCEPTION);
+                    } else {
+                        setStatus(STATUS_NORMAL);
+                    }
+
+                }
+            }
+        });
+
+        //焦点变换事件
+        setOnFocusChangeListener(new OnFocusChangeListener() {
+            @Override
+            public void onFocusChange(View v, boolean hasFocus) {
+
+                if (popupWindow != null && hasFocus) {
+                    betterShow(getText().toString(), 250);
+                }
+
+                for (OnFocusChangeListener onFocusChangeListener : onFocusChangeListenerList) {
+                    onFocusChangeListener.onFocusChange(v, hasFocus);
+                }
+            }
+        });
+
+        setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (popupWindow != null && isFocused()) {
+                    betterShow(getText().toString(), 250);
+                } else {
+                    dismissPopupWindow();
+                }
+            }
+        });
+
+
+        setRightCompoundDrawable(R.drawable.vector_drawable_arrowdown);
+        int paddingleft = dp2px(context, 5);
+        int paddingright = dp2px(context, 10);
+        setPadding(paddingleft, 0, paddingright, 0);
+
+        setDrawableRightListener(new DrawableRightListener() {
+            @Override
+            public void onDrawableRightClick(View view) {
+
+
+                if (popupWindow == null) {
+                    return;
+                }
+                if (popupWindowIsShowing) {
+                    popupWindow.dismiss();
+                    popupWindowIsShowing = false;
+
+                } else {
+                    requestFocus();
+                    betterShow("", 0);
+                }
+            }
+        });
+
+    }
+
+    Handler handler = new Handler() {
+        @Override
+        public void handleMessage(final Message msg) {
+            super.handleMessage(msg);
+            switch (msg.what) {
+                case 1:
+                    dismissPopupWindow();
+                    showPopUpwindow(msg.obj.toString());
+                    popupWindowIsShowing = true;
+                    break;
+                case 2:
+                    setSelectedItem(null);
+//                    getOnFocusChangeListener().onFocusChange(SpinnerEditText.this, true);
+                    if (popupWindow != null && isFocused()) {
+                        betterShow(getText().toString(), 250);
+                    } else {
+                        dismissPopupWindow();
+                    }
+                    break;
+                case 3:
+                    dismissPopupWindow();
+                    break;
+                case 4:
+                    popupWindowIsShowing = false;
+                    break;
+            }
+        }
+    };
+
+
+
+    //优化过后的Popupwindo显示方法
+    private void betterShow(String searchStr, long delayTime) {
+
+        if (searchStr.equals("")) {
+            handler.removeMessages(1);
+        }
+
+        if (!handler.hasMessages(1, "")) {
+
+            if (forbidShowPopOnce) {
+                forbidShowPopOnce = false;
+                return;
+            }
+
+            Message message = new Message();
+            message.what = 1;
+            message.obj = searchStr;
+            handler.sendMessageDelayed(message, delayTime);
+        }
+
+    }
+
+    //设置右侧图标
+    public void setRightCompoundDrawable(int resId) {
+
+        int start = dp2px(getContext(), 0);
+        int end = dp2px(getContext(), 20);
+        Drawable drawable = null;
+        if (resId > 0) {
+            drawable = getContext().getResources().getDrawable(resId);
+            drawable.setBounds(start, start, end, end);
+        }
+
+        setCompoundDrawables(null, null, drawable, null);
+    }
+
+    private class ViewHolder {
+        TextView itemTextView;
+    }
+
+    public void setList(String key, List<T> itemList) {
+        this.realShowItemList.clear();
+        this.realShowItemList.addAll(itemList);
+        this.itemList.clear();
+        this.itemList.addAll(getFilterList(key, itemList));
+        initOrUpdateListPopupWindow();
+    }
+
+    public void setList(List<T> itemList) {
+        setList("", itemList);
+    }
+
+    private Map<String, List<T>> map = new HashMap<>();//根据文本值获得对应的集合
+
+    private List<T> getFilterList(String key, List<T> addList) {
+        if (map.get(key) == null) {
+            List<T> list = new ArrayList<>();
+            list.addAll(addList);
+            map.put(key, list);
+        } else if (isAlwaysClearList()) {
+            map.put(key, addList);
+        }
+        return map.get(key);
+    }
+
+    //显示当前文本下的列表
+    private void showPopUpwindow(String text) {
+        if (!needShowSpinner) return;
+
+
+        if (itemList.isEmpty()) {
+            return;
+        }
+
+        if (!isAlwaysShowAllItemList()) {
+            realShowItemList.clear();
+            if (text.trim().equals("")) {
+                realShowItemList.addAll(itemList);
+            } else {
+                for (T item : itemList) {
+                    String content = item.toString();
+                    if (content == null) continue;
+                    if (content.toLowerCase().contains(text.toLowerCase())) {
+                        realShowItemList.add(item);
+                    }
+                }
+            }
+        }
+
+
+        if (!realShowItemList.isEmpty()) {
+            updateHeightAndShow();
+
+        } else {
+            handler.sendEmptyMessage(3);
+        }
+    }
+
+
+    protected void dismissPopupWindow() {
+        if (popupWindow != null)
+            popupWindow.dismiss();
+    }
+
+    public interface OnItemClickListener<T> {
+        void onItemClick(T t, SpinnerEditText<T> var1, View var2, int position, long var4, String selectContent);
+    }
+
+    private OnItemClickListener<T> onItemClickListener;
+
+    public void setOnItemClickListener(OnItemClickListener<T> onItemClickListener) {
+        this.onItemClickListener = onItemClickListener;
+    }
+
+    private List<OnFocusChangeListener> onFocusChangeListenerList = new ArrayList<>();
+
+    public void addOnFocusChangeListener(OnFocusChangeListener onFocusChangeListener) {
+        onFocusChangeListenerList.add(onFocusChangeListener);
+    }
+
+    //获得当前值
+    public String getValue() {
+        String value = getText().toString();
+        if (value.equals("null")) {
+            return null;
+        }
+        return value.trim();
+    }
+
+    private T selectedItem;
+
+    public T getSelectedItem() {
+        return selectedItem;
+    }
+
+    public void setSelectedItem(T selectedItem) {
+        this.selectedItem = selectedItem;
+    }
+
+    private boolean alwaysShowAllItemList;//是否总是显示全部的条目
+
+    public boolean isAlwaysShowAllItemList() {
+        return alwaysShowAllItemList;
+    }
+
+    public void setAlwaysShowAllItemList(boolean alwaysShowAllItemList) {
+        this.alwaysShowAllItemList = alwaysShowAllItemList;
+    }
+
+    private boolean alwaysClearList = true;//是否总是清空集合
+
+    public boolean isAlwaysClearList() {
+        return alwaysClearList;
+    }
+
+    public void setAlwaysClearList(boolean alwaysClearList) {
+        this.alwaysClearList = alwaysClearList;
+    }
+
+    private boolean needShowSpinner = true;//是否需要显示下拉框
+
+    public boolean isNeedShowSpinner() {
+        return needShowSpinner;
+    }
+
+    public void setNeedShowSpinner(boolean needShowSpinner) {
+        this.needShowSpinner = needShowSpinner;
+    }
+
+    public int selectedItemPosition;
+
+    public int getSelectedItemPosition() {
+        return selectedItemPosition;
+    }
+
+    public void setSelectedItemPosition(int selectedItemPosition) {
+        this.selectedItemPosition = selectedItemPosition;
+//        popupWindow.setSelection(selectedItemPosition);
+    }
+
+    public void setDrawableLeftListener(DrawableLeftListener listener) {
+        this.mLeftListener = listener;
+    }
+
+    public void setDrawableRightListener(DrawableRightListener listener) {
+        this.mRightListener = listener;
+    }
+
+    public interface DrawableLeftListener {
+        void onDrawableLeftClick(View view);
+    }
+
+    public interface DrawableRightListener {
+        void onDrawableRightClick(View view);
+    }
+
+    public void dismissRightIcon() {
+        setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
+
+        setDrawableRightListener(null);
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                if (mRightListener != null) {
+
+                    int eventX = (int) event.getRawX();
+                    int eventY = (int) event.getRawY();
+
+                    Rect rect = new Rect();
+                    getGlobalVisibleRect(rect);
+
+                    rect.left = rect.right - dp2px(context, 48);
+                    if (rect.contains(eventX, eventY)) {
+                        return true;
+                    }
+
+                }
+                return super.onTouchEvent(event);
+            case MotionEvent.ACTION_UP:
+                if (mLeftListener != null) {
+                    Drawable drawableLeft = getCompoundDrawables()[DRAWABLE_LEFT];
+                    if (drawableLeft != null && event.getRawX() <= (getLeft() + drawableLeft.getBounds().width())) {
+                        mLeftListener.onDrawableLeftClick(this);
+                        return true;
+                    }
+                }
+
+
+                if (mRightListener != null && event.getAction() == MotionEvent.ACTION_UP) {
+
+                    int eventX = (int) event.getRawX();
+                    int eventY = (int) event.getRawY();
+
+                    Rect rect = new Rect();
+                    getGlobalVisibleRect(rect);
+
+                    rect.left = rect.right - dp2px(context, 48);
+                    if (rect.contains(eventX, eventY)) {
+                        mRightListener.onDrawableRightClick(this);
+                        return true;
+                    }
+
+                }
+
+                break;
+
+        }
+        return super.onTouchEvent(event);
+    }
+
+    //------------------------------初始化Popupwindow ----------------------------
+    private static final int TYPE_WRAP_CONTENT = 0, TYPE_MATCH_PARENT = 1;
+    private boolean popupWindowIsShowing = false;//当前Popupwindow是否正在显示
+    private PopupWindow popupWindow;
+    private List<T> itemList = new ArrayList<>();
+    private List<T> realShowItemList = new ArrayList<>();//过滤后显示的集合
+    private BaseAdapter adapter;
+    private ListView listView;
+    private FrameLayout popupView;
+
+    public List<T> getRealShowItemList() {
+        return realShowItemList;
+    }
+
+    public List<T> getItemList() {
+        return itemList;
+    }
+
+
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    private void initOrUpdateListPopupWindow() {
+
+        if (popupWindow == null) {
+
+            popupWindow = new PopupWindow(context);
+            listView = new ListView(context);
+            setVerticalScrollBarEnabled(true);
+            listView.setBackground(getResources().getDrawable(R.drawable.graybox));
+            popupView = new FrameLayout(context);
+            popupView.setBackgroundColor(Color.GRAY);
+            popupView.addView(listView);
+            popupWindow.setContentView(popupView);
+//            popupView.setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
+
+            adapter = new BaseAdapter() {
+                @Override
+                public int getCount() {
+                    return realShowItemList.size();
+                }
+
+                @Override
+                public T getItem(int position) {
+                    return realShowItemList.get(position);
+                }
+
+                @Override
+                public long getItemId(int position) {
+                    return position;
+                }
+
+                @Override
+                public View getView(final int position, View convertView, ViewGroup parent) {
+                    ViewHolder holder = null;
+                    if (convertView == null) {
+                        holder = new ViewHolder();
+                        convertView = LayoutInflater.from(context).inflate(R.layout.listpopwindow, null, false);
+                        holder.itemTextView = (TextView) convertView.findViewById(R.id.tv);
+                        convertView.setTag(holder);
+
+
+                    } else {
+                        holder = (ViewHolder) convertView.getTag();
+                    }
+
+                    if (realShowItemList != null) {
+                        final String itemName = realShowItemList.get(position).toString();
+                        if (holder.itemTextView != null) {
+                            holder.itemTextView.setText(itemName);
+                        }
+                    }
+
+                    convertView.setOnClickListener(new OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+
+                            T t = realShowItemList.get(position);
+
+                            int i = position;
+                            for (int i1 = 0; i1 < itemList.size(); i1++) {
+                                if (itemList.get(i1).toString().equals(t.toString())) {
+                                    i = i1;
+                                    break;
+                                }
+                            }
+
+                            String selectedContent = t.toString();
+
+                            setSelectedItemPosition(i);
+                            SpinnerEditText.this.setSelectedItem(t);
+                            if (onItemClickListener != null)
+                                onItemClickListener.onItemClick(t, SpinnerEditText.this, v, i, i, selectedContent);
+
+                            forbidShowPopOnce = true;
+                            if (!itemList.isEmpty() && i < itemList.size()) {
+                                SpinnerEditText.this.setText(selectedContent);
+                                setSelectedItem(itemList.get(i));
+                                setSelectedItemPosition(i);
+                            } else {
+                                setText("");
+                            }
+
+                            setSelection(getText().toString().length());
+                            handler.removeMessages(1);
+                            popupWindow.dismiss();
+                        }
+                    });
+
+                    return convertView;
+                }
+            };
+
+
+            listView.setAdapter(adapter);
+            popupWindow.setWidth(AbsListView.LayoutParams.WRAP_CONTENT);
+            popupWindow.setHeight(AbsListView.LayoutParams.WRAP_CONTENT);
+            popupWindow.setSoftInputMode(ListPopupWindow.INPUT_METHOD_NEEDED);
+
+            popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+                @Override
+                public void onDismiss() {
+                    handler.sendEmptyMessageDelayed(4, 100);
+                }
+            });
+
+
+            popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+            popupWindow.setAnimationStyle(R.style.AnimationFromButtom);
+            popupWindow.setOutsideTouchable(true);
+            popupWindow.setFocusable(false);
+        }
+        adapter.notifyDataSetChanged();
+    }
+
+    private int willShowHeight;
+
+    private void updateHeightAndShow() {
+        post(new Runnable() {
+            @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+            @Override
+            public void run() {
+
+                willShowHeight = realShowItemList.size() * childHeight;
+                if (willShowHeight > maxHeight) {
+                    willShowHeight = maxHeight;
+                }
+
+                Rect rect = new Rect();
+                getGlobalVisibleRect(rect);
+
+                if (autoCheckShowType) {
+                    if (rect.top <= willShowHeight || willShowHeight < maxHeight) {
+                        showType = TYPE_DOWN;
+                    } else {
+                        showType = TYPE_UP;
+                    }
+                }
+
+
+                if (willShowHeight < getHeight())
+                    willShowHeight = getHeight();
+
+
+                popupWindow.setHeight(willShowHeight);
+                listView.setLayoutParams(new FrameLayout.LayoutParams(getWidth(), willShowHeight));
+
+                initOrUpdateListPopupWindow();
+
+
+                if (showType == TYPE_UP) {
+                    showAsPopUp(SpinnerEditText.this);
+                } else {
+                    showAsPopBottom(SpinnerEditText.this);
+                }
+
+            }
+        });
+    }
+
+    /**
+     * anchor上方
+     *
+     * @param anchor
+     */
+    public void showAsPopUp(View anchor) {
+        showAsPopUp(anchor, 0, dp2px(context, 0));
+    }
+
+    public void showAsPopBottom(View anChor) {
+        popupWindow.showAsDropDown(anChor, 0, 0);
+    }
+
+    private void showAsPopUp(View anchor, int xoff, int yoff) {
+        popupWindow.setAnimationStyle(R.style.AnimationUpPopup);
+        popupView.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+        int[] location = new int[2];
+        anchor.getLocationInWindow(location);
+
+
+        //计算显示位置 如果高度不够自动调整到合适高度
+        int offsetY = -getHeight() - willShowHeight;
+        if (offsetY + location[1] < 0) {
+            popupWindow.setHeight(location[1] - getHeight() / 2);
+            listView.setLayoutParams(new FrameLayout.LayoutParams(getWidth(), location[1] - getHeight() / 2));
+        }
+
+        popupWindow.showAsDropDown(anchor, 0, offsetY);
+    }
+
+    public void dismissPop() {
+        if (popupWindow != null)
+            popupWindow.dismiss();
+    }
+
+
+    //------------------------------初始化Popupwindow ----------------------------
+
+
+    /**
+     * 根据手机的分辨率从 DP 的单位 转成为PX(像素)
+     */
+    public static int dp2px(Context context, float dpValue) {
+        final float scale = context.getResources().getDisplayMetrics().density;
+        return (int) (dpValue * scale + 0.5f);
+    }
+
+    //-----------设置自动判断Popupwindow显示类型---------------------
+
+    //手动设置显示类型 自动判断显示类型失效
+    public void setShowType(int showType) {
+        this.showType = showType;
+        autoCheckShowType = false;
+    }
+
+    //设置是否自动判断显示类型
+    public void setAutoCheckShowType(boolean autoCheckShowType) {
+        this.autoCheckShowType = autoCheckShowType;
+    }
+
+    //-----------设置自动判断Popupwindow显示类型---------------------
+
+    //-------------------根据文本值为空判断状态是否为异常-----------------
+
+    //获得当前编辑框的状态是否异常
+    public int getStatus() {
+        return status;
+    }
+
+    //设置自动根据文本内容是否为空 设置是否异常
+    public void autoCheckStatusByTextIsEmpty(Boolean autoCheckStatusByTextIsEmpty) {
+        this.autoCheckStatusByTextIsEmpty = autoCheckStatusByTextIsEmpty;
+        if (TextUtils.isEmpty(getText())) {
+            setStatus(STATUS_EXCEPTION);
+        } else {
+            setStatus(STATUS_NORMAL);
+        }
+    }
+
+    //设置当前SpinnerEdit的状态
+    public void setStatus(int status) {
+        if (status == STATUS_NORMAL) {
+            this.status = STATUS_NORMAL;
+            setBackgroundResource(R.drawable.whitebox);
+
+        } else if (status == STATUS_EXCEPTION) {
+            this.status = STATUS_EXCEPTION;
+            setBackgroundResource(R.drawable.whitebox_with_readstroke);
+        }
+    }
+
+    public void setNecessary(boolean necessary) {
+        isNecessary = necessary;
+    }
+
+    public boolean isNecessary() {
+        return isNecessary;
+    }
+    //-------------------根据文本值为空判断状态是否为异常-----------------
+}

+ 21 - 0
app/src/main/java/com/ahau/againstpest/MyView/TextWatchAdapter.java

@@ -0,0 +1,21 @@
+package com.ahau.againstpest.MyView;
+
+import android.text.Editable;
+import android.text.TextWatcher;
+
+/**
+ * TextWatcher的实现抽象类
+ * Created by z2wenfa on 2016/11/10.
+ */
+public abstract class TextWatchAdapter implements TextWatcher {
+    @Override
+    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+    }
+
+
+    @Override
+    public void afterTextChanged(Editable s) {
+
+    }
+}

+ 528 - 0
app/src/main/java/com/ahau/againstpest/activity/AgainPestActivity.java

@@ -0,0 +1,528 @@
+package com.ahau.againstpest.activity;
+
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.ahau.againstpest.MyView.SpinnerEditText;
+import com.ahau.againstpest.R;
+import com.ahau.againstpest.bean.PestBean;
+import com.ahau.againstpest.presenter.PestPresenter;
+import com.ahau.againstpest.utils.TakingPhotoUtils;
+import com.ahau.againstpest.utils.TakingPhotoUtils.onGetTypeClckListener;
+import com.ahau.againstpest.utils.URLUtils;
+import com.ahau.againstpest.view.BaseActivity;
+import com.ahau.againstpest.view.IPestView;
+import com.loopj.android.http.AsyncHttpClient;
+import com.loopj.android.http.AsyncHttpResponseHandler;
+import com.qiniu.android.http.ResponseInfo;
+import com.qiniu.android.storage.UpCompletionHandler;
+import com.qiniu.android.storage.UploadManager;
+import com.qiniu.android.utils.UrlSafeBase64;
+
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.util.TextUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+import static com.ahau.againstpest.R.id.addpestpic;
+
+
+public class AgainPestActivity extends BaseActivity<IPestView, PestPresenter<IPestView>> implements OnClickListener, IPestView {
+
+    private static final int Adressrequest = 0;
+    private static final int Pestrequest = 5;
+    private static final int Genderrequest = 4;
+
+
+    private TextView tv_date, jingduTV, weiduTV;
+    private Button tijiaobtn;
+    private String adddate, adressid, pestname, pestfirstgrade, pestsecondgrade, researchpeople, remark,gaodejingdu, gaodeweidu;;
+    String AccessKey = "UeKrDBz5wknxCwwob0IffRIIQm43EYMbWtiGgIDn";
+    String SecretKey = "KHtAQ8-HQYejTPjIRq5a9aH-wZcsJIcrDrfie0vI";
+    private static final String MAC_NAME = "HmacSHA1";
+    private static final String ENCODING = "UTF-8";
+    private RelativeLayout addpicLO, addpicLO2;
+    private Bitmap bitmap = null;
+    private EditText remark_ET;
+    private TextView researchpeople_TV;
+    private ImageView addpicIV, addpicIV2;
+    private TextView sptadressid;
+    private File file;
+    private Uri ImgUri;
+
+    private Type type;
+
+    private TakingPhotoUtils puWindow;
+    private SpinnerEditText<PestBean.Pest> v_pestname;
+    private SpinnerEditText<PestBean.Pest.PestGrade> v_firstgrade;
+    private SpinnerEditText<PestBean.Pest.PestGrade.SecondGrade> v_secondgrade;
+
+
+    public enum Type {
+        PHONE, CAMERA
+    }
+
+    private String Httpnet;
+    private Object Httpnet2;
+    private int k;
+
+
+    /**
+     * 获取害虫的名字
+     *
+     * @param pest
+     */
+    @Override
+    public void showPest(List<PestBean.Pest> pest) {
+
+        v_pestname.setList(pest);
+        v_pestname.setSelection(0);
+        v_pestname.setOnItemClickListener(new SpinnerEditText.OnItemClickListener<PestBean.Pest>() {
+            @Override
+            public void onItemClick(PestBean.Pest pest, SpinnerEditText<PestBean.Pest> spinnerEditText, View view, int i, long l, String s) {
+
+                Log.d("pestgrade", pest.grade + "");
+                if (!((pest.grade + "").equals("null"))) {
+                    v_firstgrade.setList(pest.grade);
+                    v_firstgrade.setSelection(0);
+                    v_firstgrade.setOnItemClickListener(new SpinnerEditText.OnItemClickListener<PestBean.Pest.PestGrade>() {
+                        @Override
+                        public void onItemClick(PestBean.Pest.PestGrade pestGrade, SpinnerEditText<PestBean.Pest.PestGrade> spinnerEditText, View view, int i, long l, String s) {
+                            if (!((pestGrade.nextgrade + "").equals("null"))) {
+                                v_secondgrade.setList(pestGrade.nextgrade);
+                                v_secondgrade.setSelection(0);
+                            } else {
+                                v_secondgrade.dismissPop();
+                            }
+                        }
+                    });
+                } else {
+                }
+            }
+        });
+    }
+
+    /**
+     * 获取当前时间
+     */
+    @Override
+    public void setDate(String date) {
+        tv_date.setText(date);
+    }
+
+    /**
+     * 获取当前经纬度
+     */
+    @Override
+    public void setLatlng(String[] latlng) {
+        jingduTV.setText(latlng[0]);
+        weiduTV.setText(latlng[1]);
+        gaodejingdu = latlng[2];
+        gaodeweidu = latlng[3];
+    }
+
+    /**
+     * 获取调查人姓名
+     *
+     * @param researName
+     */
+    @Override
+    public void setResearName(String researName) {
+        researchpeople_TV.setText(researName);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_again_pest);
+        intiViews();
+
+        pestPresenter.fetch();
+    }
+
+    @Override
+    protected PestPresenter<IPestView> createPresenter() {
+        return new PestPresenter<>();
+    }
+
+
+    /**
+     * 初始化控件
+     */
+    private void intiViews() {
+
+        tv_date = findViewById(R.id.tv_date);  //日期
+
+        jingduTV = findViewById(R.id.jingdu);// 经纬度
+        weiduTV = findViewById(R.id.weidu);
+
+        sptadressid = findViewById(R.id.adressid);
+
+        remark_ET = findViewById(R.id.remark);
+        researchpeople_TV = findViewById(R.id.researchpeople);
+
+
+        v_pestname = findViewById(R.id.pestname);
+        v_firstgrade = findViewById(R.id.firstgrade);
+        v_secondgrade = findViewById(R.id.secondgrade);
+
+
+        addpicIV = findViewById(R.id.pestpic);
+        addpicIV2 = findViewById(R.id.pestpic2);
+
+        addpicLO = findViewById(addpestpic);
+        addpicLO.setOnClickListener(this);
+
+        addpicLO2 = findViewById(R.id.addpestpic2);
+        addpicLO2.setOnClickListener(this);
+
+        //提交数据按钮
+        tijiaobtn = findViewById(R.id.tijiao);
+        tijiaobtn.setOnClickListener(this);
+
+
+    }
+
+    /**
+     * 点击事件
+     */
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()) {
+            case R.id.tijiao:
+                getinfo();
+                if (tijiaoIssuccess()) {
+                    new AlertDialog.Builder(this).setTitle("提示").setMessage("确定数据无误,确定提交吗?")
+                            .setPositiveButton("确定", new DialogInterface.OnClickListener() {
+
+                                @Override
+                                public void onClick(DialogInterface dialog, int which) {
+
+                                    uploadpictoqiniu(1);
+
+                                    finish();
+                                }
+                            }).show();
+                }
+
+
+                break;
+            case addpestpic:
+                k = 1;
+                puWindow = new TakingPhotoUtils(AgainPestActivity.this, AgainPestActivity.this);
+                puWindow.showPopupWindow(findViewById(R.id.set_act_parent));
+                puWindow.setOnGetTypeClckListener(new onGetTypeClckListener() {
+
+                    @Override
+                    public void getType(Type type) {
+                        AgainPestActivity.this.type = type;
+                    }
+
+                    @Override
+                    public void getImgUri(Uri ImgUri, File file) {
+                        AgainPestActivity.this.ImgUri = ImgUri;
+                        AgainPestActivity.this.file = file;
+                    }
+
+                });
+
+                break;
+
+            case R.id.addpestpic2:
+
+                k = 2;
+                puWindow = new TakingPhotoUtils(AgainPestActivity.this, AgainPestActivity.this);
+                puWindow.showPopupWindow(findViewById(R.id.set_act_parent));
+                puWindow.setOnGetTypeClckListener(new onGetTypeClckListener() {
+
+                    @Override
+                    public void getType(Type type) {
+                        AgainPestActivity.this.type = type;
+                    }
+
+                    @Override
+                    public void getImgUri(Uri ImgUri, File file) {
+                        AgainPestActivity.this.ImgUri = ImgUri;
+                        AgainPestActivity.this.file = file;
+                    }
+
+                });
+
+
+                break;
+
+        }
+
+    }
+
+
+    public void getinfo() {
+        adddate = tv_date.getText().toString();//时间
+        adressid = sptadressid.getText().toString(); //地区id
+        pestname = v_pestname.getText().toString();//害虫名字
+        pestfirstgrade = v_firstgrade.getText().toString();
+        pestsecondgrade = v_secondgrade.getText().toString();
+        researchpeople = researchpeople_TV.getText().toString();//调查人
+        remark = remark_ET.getText().toString(); // 备注
+
+
+    }
+
+
+    /**
+     * 判断是否提交成功
+     */
+    private boolean tijiaoIssuccess() {
+
+        if (TextUtils.isEmpty(adressid) && adressid.equals("0")) {
+
+            Toast.makeText(AgainPestActivity.this, "区域编号不能为空,请选择!", Toast.LENGTH_SHORT).show();
+            return false;
+        }
+
+        return true;
+
+        /*if (TextUtils.isEmpty(pestname) && pestname.equals("0")) {
+
+            Toast.makeText(AgainPestActivity.this, "虫种不能为空,请选择!", Toast.LENGTH_SHORT).show();
+            return false;
+        }else if (TextUtils.isEmpty(adressid) && adressid.equals("0")) {
+
+            Toast.makeText(AgainPestActivity.this, "区域编号不能为空,请选择!", Toast.LENGTH_SHORT).show();
+            return false;
+        } else if (addpicIV.getDrawable() == null) {
+
+            Toast.makeText(AgainPestActivity.this, "图片1不能为空,请添加!", Toast.LENGTH_SHORT).show();
+            return false;
+        } else if (addpicIV2.getDrawable() == null) {
+
+            Toast.makeText(AgainPestActivity.this, "图片2不能为空,请添加!", Toast.LENGTH_SHORT).show();
+            return false;
+        }
+        return true;*/
+    }
+
+
+    /**
+     * 上传图片至七牛云
+     *
+     * @param
+     */
+    public void uploadpictoqiniu(final int i) {
+        try {
+            // 构造上传策略
+            JSONObject _json = new JSONObject();
+            long _dataline = System.currentTimeMillis() / 1000 + 3600;
+            _json.put("deadline", _dataline);// 有效时间为一个小时
+            _json.put("scope", "oldtreetest"); // bucket name 空间名称
+            String _encodedPutPolicy = UrlSafeBase64.encodeToString(_json.toString().getBytes());
+            byte[] _sign = HmacSHA1Encrypt(_encodedPutPolicy, SecretKey);
+            String _encodedSign = UrlSafeBase64.encodeToString(_sign);
+            String _uploadToken = AccessKey + ':' + _encodedSign + ':' + _encodedPutPolicy;
+            // String SAVE_FILE_DIRECTORY = uri.toString();
+
+            String SAVE_FILE_DIRECTORY = Environment.getExternalStorageDirectory() + "/temp" + i + ".jpg";
+            System.out.println("SAVE_FILE_DIRECTORY" + SAVE_FILE_DIRECTORY);
+            UploadManager uploadManager = new UploadManager();
+
+            uploadManager.put(SAVE_FILE_DIRECTORY, null, _uploadToken, new UpCompletionHandler() {
+
+                @Override
+                public void complete(String key, ResponseInfo info, JSONObject response) {
+
+                    try {
+
+                        String netname = response.getString("hash");
+
+                        if (i == 1) {
+                            Httpnet = "http://ojcst7op3.bkt.clouddn.com/" + netname;
+                            uploadpictoqiniu(2);
+                        } else if (i == 2) {
+                            Httpnet2 = "http://ojcst7op3.bkt.clouddn.com/" + netname;
+                            uploadinformation();
+                        }
+                        System.out.println("11" + Httpnet);
+                        System.out.println("12" + Httpnet2);
+                        //	uploadinformation();
+
+                    } catch (JSONException e) {
+
+                        e.printStackTrace();
+                    }
+
+                    // System.out.println("qiniu222" + response.toString());
+
+                }
+            }, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static byte[] HmacSHA1Encrypt(String encryptText, String encryptKey) throws Exception {
+        byte[] data = encryptKey.getBytes(ENCODING);
+        // 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称
+        SecretKey secretKey = new SecretKeySpec(data, MAC_NAME);
+        // 生成一个指定 Mac 算法 的 Mac 对象
+        Mac mac = Mac.getInstance(MAC_NAME);
+        // 用给定密钥初始化 Mac 对象
+        mac.init(secretKey);
+        byte[] text = encryptText.getBytes(ENCODING);
+        // 完成 Mac 操作
+        return mac.doFinal(text);
+    }
+
+
+    /**
+     * 提交的信息
+     */
+    public void uploadinformation() {
+
+        try {
+            final JSONObject jsonObject = new JSONObject();
+            try {
+
+                jsonObject.put("date", adddate);
+                jsonObject.put("areanumber", adressid);
+                jsonObject.put("pestname", pestname);
+                jsonObject.put("pestfirstgrade", pestfirstgrade);
+                jsonObject.put("pestsecondgrade", pestsecondgrade);
+                jsonObject.put("researchprople", researchpeople);
+                jsonObject.put("remark", remark);
+
+                jsonObject.put("longitude", gaodeweidu);
+                jsonObject.put("latitude", gaodejingdu);
+
+                jsonObject.put("pestpicurl1", Httpnet);
+                jsonObject.put("pestpicurl2", Httpnet2);
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+
+            ByteArrayEntity entity = null;
+            try {
+                entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8"));
+                entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+
+            /*final Map<String, Object> params = new HashMap<>();
+            params.put("entity", entity);
+            HttpHelper.obtain().post(URLUtils.PestCollectUrl, entity, new HttpCallback<String>() {
+                @Override
+                public void onSuccess(String s) {
+                    Toast.makeText(AgainPestActivity.this, "信息上传成功!" + s, Toast.LENGTH_SHORT).show();
+                    Log.d("tag", "信息上传成功");
+                }
+
+                @Override
+                public void onFailure(String e) {
+                    Toast.makeText(AgainPestActivity.this, "信息上传失败!", Toast.LENGTH_SHORT).show();
+                    Log.e("tag", "信息上传失败");
+                }
+            });*/
+
+            String url = URLUtils.PestCollectUrl;
+            //String url = "http://192.168.1.107:8080/Tree/FileUploadServlet";
+            AsyncHttpClient client = new AsyncHttpClient();
+            //client.post(url, params, new AsyncHttpResponseHandler() {
+            client.post(this, url, (HttpEntity) entity, "application/json", new AsyncHttpResponseHandler() {
+
+                @Override
+                public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
+
+                    Toast.makeText(AgainPestActivity.this, "信息上传成功!", Toast.LENGTH_SHORT).show();
+                }
+
+                @Override
+                public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
+                    Toast.makeText(AgainPestActivity.this, "信息上传失败!", Toast.LENGTH_SHORT).show();
+                }
+
+            });
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+        if (requestCode == 1) {
+            if (ImgUri != null) {
+                Log.d("ImgUri", ImgUri.toString());
+                puWindow.onPhoto(k, ImgUri, 1000, 1000);
+            }
+        } else if (requestCode == 2) {
+            if (data != null) {
+                Uri uri = data.getData(); // 从相册选择的图片可以直接获得uri(uniform resource
+                // bitmap = BitmapFactory.decodeFile(uri.toString());
+                // addpicIV.setVisibility(View.VISIBLE);
+                // addpicIV.setImageBitmap(bitmap); // identifier)资源标识
+                puWindow.onPhoto(k, uri, 1000, 1000);
+            }
+        } else if (requestCode == 3) {
+            if (type == Type.PHONE) {
+                if (data != null) {
+                    // Bundle extras = data.getExtras();
+                    if (k == 1) {
+                        bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/temp1.jpg");
+                        addpicIV.setVisibility(View.VISIBLE);
+                        addpicIV.setImageBitmap(bitmap);
+                    } else if (k == 2) {
+                        bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/temp2.jpg");
+                        addpicIV2.setVisibility(View.VISIBLE);
+                        addpicIV2.setImageBitmap(bitmap);
+                    }
+
+                }
+            } else if (type == Type.CAMERA) {
+
+                if (k == 1) {
+                    bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/temp1.jpg");
+                    addpicIV.setVisibility(View.VISIBLE);
+                    addpicIV.setImageBitmap(bitmap);
+                } else if (k == 2) {
+                    bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/temp2.jpg");
+                    addpicIV2.setVisibility(View.VISIBLE);
+                    addpicIV2.setImageBitmap(bitmap);
+                }
+
+            }
+        }
+    }
+
+
+}

+ 99 - 0
app/src/main/java/com/ahau/againstpest/activity/LocationActivity.java

@@ -0,0 +1,99 @@
+package com.ahau.againstpest.activity;
+
+import com.ahau.againstpest.base.BaiduBaseActivity;
+import com.baidu.location.BDLocation;
+import com.baidu.location.BDLocationListener;
+import com.baidu.location.LocationClient;
+import com.baidu.location.LocationClientOption;
+import com.baidu.mapapi.map.MapStatus;
+import com.baidu.mapapi.map.MapStatusUpdateFactory;
+import com.baidu.mapapi.map.MyLocationConfiguration;
+import com.baidu.mapapi.map.MyLocationConfiguration.LocationMode;
+import com.baidu.mapapi.map.MyLocationData;
+import com.baidu.mapapi.model.LatLng;
+
+
+/**
+ *
+ */
+public class LocationActivity extends BaiduBaseActivity {
+
+    private boolean isFirstLoc = true;
+    private LocationMode mCurrentMode;
+    public BDLocationListener myListener = new MyLocationListener();
+
+
+    private Mlocationdata currentlocation;// 当前经纬度
+    //private GeoPoint currentgeopoint;// 当前经纬度对应geopoint
+
+    private LocationClient mLocationClient;
+
+
+    @Override
+    protected void onDestroy() {
+        mLocationClient.stop();        // 停止定位
+        super.onDestroy();
+    }
+
+
+    public class Mlocationdata {
+        public int latE6;
+        public int lngE6;
+
+        public Mlocationdata(double lat, double lng) {
+            this.latE6 = (int) (lat * 1E6);
+            this.lngE6 = (int) (lng * 1E6);
+        }
+    }
+
+    @Override
+    public void init() {
+        // 开启定位图层
+        baiduMap.setMyLocationEnabled(true);
+        // 定位初始化
+        mLocationClient = new LocationClient(this);
+        mLocationClient.registerLocationListener(myListener);
+        LocationClientOption option = new LocationClientOption();
+        option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
+        option.setOpenGps(true); // 打开gps
+        option.setCoorType("bd09ll"); // 设置坐标类型
+        option.setScanSpan(1000);
+        mLocationClient.setLocOption(option);
+        mLocationClient.start();
+        mCurrentMode = LocationMode.COMPASS;
+        baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
+                        mCurrentMode, true, null));
+    }
+
+    /**
+     * 定位SDK监听函数
+     */
+    public class MyLocationListener implements BDLocationListener {
+
+        @Override
+        public void onReceiveLocation(BDLocation location) {
+            // map view 销毁后不在处理新接收的位置
+            if (location == null || baiduMap == null) {
+                return;
+            }
+            MyLocationData locData = new MyLocationData.Builder()
+                    .accuracy(location.getRadius())
+                    // 此处设置开发者获取到的方向信息,顺时针0-360
+                    .direction(100).latitude(location.getLatitude())
+                    .longitude(location.getLongitude()).build();
+            baiduMap.setMyLocationData(locData);
+
+            if (isFirstLoc) {
+                isFirstLoc = false;
+                LatLng ll = new LatLng(location.getLatitude(),
+                        location.getLongitude());
+                MapStatus.Builder builder = new MapStatus.Builder();
+                builder.target(ll).zoom(18.0f);
+                baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
+
+            }
+        }
+    }
+
+
+}

+ 159 - 0
app/src/main/java/com/ahau/againstpest/activity/LoginActivity.java

@@ -0,0 +1,159 @@
+package com.ahau.againstpest.activity;
+
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.ahau.againstpest.HttpProcessor.HttpCallback;
+import com.ahau.againstpest.HttpProcessor.HttpHelper;
+import com.ahau.againstpest.R;
+import com.ahau.againstpest.utils.LoginUtils;
+import com.ahau.againstpest.utils.URLUtils;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
+    private Button loginbtn, registerbtn;
+    private String username, password;
+    private Boolean isrem;
+    private CheckBox remembercb;
+    private EditText usernameET, passwordET;
+    private String userinfo_url;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+
+        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
+        // 锁定屏幕
+        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_login);
+
+        intiViews();
+    }
+
+
+    @Override
+    public void onClick(View v) {
+
+        switch (v.getId()) {
+            case R.id.login:
+                if (loginIssuccess()) {
+                    Toast.makeText(LoginActivity.this, "正在登录,请稍等!", Toast.LENGTH_SHORT).show();
+                    //dologin(); //不需要验证用户名,密码
+                    login();
+                }
+                break;
+            default:
+                break;
+
+        }
+    }
+
+    private void intiViews() {
+        // TODO Auto-generated method stub
+        loginbtn = (Button) findViewById(R.id.login);
+        usernameET = (EditText) findViewById(R.id.username);
+        passwordET = (EditText) findViewById(R.id.pwd);
+        remembercb = (CheckBox) findViewById(R.id.remcb);
+        loginbtn.setOnClickListener(this);
+
+        //账户名密码的回显
+        Map<String, String> map = LoginUtils.getUtil(getApplicationContext());
+        if (map != null) {
+            String username = (String) map.get("username");
+            String password = (String) map.get("password");
+
+            usernameET.setText(username);
+            passwordET.setText(password);
+
+            remembercb.setChecked(true);
+
+        }
+    }
+
+
+    private boolean loginIssuccess() {
+
+        username = usernameET.getText().toString();
+        password = passwordET.getText().toString();
+        isrem = remembercb.isChecked();
+
+        if (TextUtils.isEmpty(username)) {
+            // 用户输入用户名为空
+            Toast.makeText(LoginActivity.this, "用户名不能为空!", Toast.LENGTH_SHORT).show();
+            return false;
+        } else if (TextUtils.isEmpty(password)) {
+            // 密码不能为空
+            Toast.makeText(LoginActivity.this, "密码不能为空!", Toast.LENGTH_SHORT).show();
+            return false;
+        }
+
+        LoginUtils.saveUtil(getApplicationContext(), username, password);
+
+        return true;
+
+    }
+
+
+    private void login() {
+        /**
+         * AsyncHttpClient client = new AsyncHttpClient();
+         * client.get("http://www.google.com", new AsyncHttpResponseHandler() {
+         *
+         * @Override public void onSuccess(String response) {
+         * System.out.println(response); } });
+         */
+        getUserinfo(username, password);
+    }
+
+    private void getUserinfo(String username, String password) {
+
+        userinfo_url = URLUtils.defaultUrl + "/login?username=" + username + "&password="
+                + password;
+
+        // 服务器端写的是doGet()方法,因此此处必须是get请求,如果利用post请求,OnFailure()方法error会报错
+        Map<String, Object> params = new HashMap<>();
+        HttpHelper.obtain().get(userinfo_url, params, new HttpCallback<String>() {
+            @Override
+            public void onSuccess(String s) {
+                if (!TextUtils.isEmpty(s)) {
+                    JSONObject jsonObject;
+                    try {
+                        jsonObject = new JSONObject(s);
+                        System.out.println(jsonObject);
+                        String status = jsonObject.getString("status");
+                        if (status.equals("false")) {
+
+                            Toast.makeText(LoginActivity.this, " 用户名或密码输入错误,请重新登录!", Toast.LENGTH_SHORT).show();
+                        } else if (status.equals("true")) {
+                            dologin();
+
+                        }
+                    } catch (JSONException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+                }
+            }
+        });
+    }
+    public void dologin() {
+        Intent intent = new Intent();
+        intent.setClass(LoginActivity.this, SearchActivity.class);
+        startActivity(intent);
+    }
+}

+ 53 - 0
app/src/main/java/com/ahau/againstpest/activity/SearchActivity.java

@@ -0,0 +1,53 @@
+package com.ahau.againstpest.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.widget.RelativeLayout;
+
+import com.ahau.againstpest.R;
+
+public class SearchActivity extends AppCompatActivity implements View.OnClickListener {
+
+    private RelativeLayout againpest_layout, location_layout;
+
+    protected void onCreate(Bundle savedInstanceState) {
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_search);
+        intiViews();
+    }
+
+    private void intiViews() {
+        againpest_layout = (RelativeLayout) findViewById(R.id.againpest_layout);
+
+        againpest_layout.setOnClickListener(this);
+
+        location_layout = (RelativeLayout) findViewById(R.id.position_layout);
+        location_layout.setOnClickListener(this);
+
+    }
+
+    @Override
+    public void onClick(View v) {
+
+        switch (v.getId()) {
+
+            case R.id.againpest_layout:
+                Intent intent = new Intent();
+                intent.setClass(this, AgainPestActivity.class);
+                startActivity(intent);
+                break;
+
+            case R.id.position_layout:
+                Intent intent1 = new Intent();
+                intent1.setClass(this, LocationActivity.class);
+                startActivity(intent1);
+                break;
+
+            default:
+                break;
+        }
+    }
+}

+ 225 - 0
app/src/main/java/com/ahau/againstpest/base/BaiduBaseActivity.java

@@ -0,0 +1,225 @@
+package com.ahau.againstpest.base;
+
+import android.Manifest;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.design.widget.Snackbar;
+import android.support.v4.app.ActivityCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+
+import com.ahau.againstpest.R;
+import com.ahau.againstpest.utils.PermissionUtils;
+import com.ahau.againstpest.utils.Utils;
+import com.baidu.mapapi.map.BaiduMap;
+import com.baidu.mapapi.map.BaiduMapOptions;
+import com.baidu.mapapi.map.MapStatus;
+import com.baidu.mapapi.map.MapStatusUpdate;
+import com.baidu.mapapi.map.MapStatusUpdateFactory;
+import com.baidu.mapapi.map.MapView;
+import com.baidu.mapapi.map.UiSettings;
+import com.baidu.mapapi.model.LatLng;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+
+public abstract class BaiduBaseActivity extends AppCompatActivity {
+
+    private static final String TAG = "BaiduBaseActivity";
+    private static final String TAG1 = "TAG1";
+    private static final int REQUEST_CONTACTS = 100;
+    private static final String[] PERMISSIONS_CONTACT = {Manifest.permission.ACCESS_COARSE_LOCATION,
+            Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE};
+
+    private LatLng p;
+    protected MapView mapView;
+    protected BaiduMap baiduMap;
+
+    // 这里加final是为了不让子类覆盖,原因是为了预防这里的一些类还没初始化的时候就被子类调用
+    @Override
+    protected final void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_location);
+        //获取地图控件引用
+        mapView = (MapView) findViewById(R.id.map_view);
+
+        baiduMap = mapView.getMap();    // 获取地图控制器
+
+        // 1.	隐藏缩放按钮、比例尺
+        // mapView.showScaleControl(false);	// 隐藏比例按钮,默认是显示的
+        // mapView.showZoomControls(false);	// 隐藏缩放按钮,默认是显示的
+
+        // 2.	获取获取最小(3)、最大缩放级别(20)
+        float maxZoomLevel = baiduMap.getMaxZoomLevel(); // 获取地图最大缩放级别
+        float minZoomLevel = baiduMap.getMinZoomLevel(); // 获取地图最小缩放级别
+        Log.i(TAG, "minZoomLevel = " + minZoomLevel + ", maxZoomLevel" + maxZoomLevel);
+
+        // 3.	设置地图中心点
+        Intent intent = getIntent();
+        if (intent.hasExtra("x") && intent.hasExtra("y")) {
+            // 当用intent参数时,设置中心点为指定点
+            Bundle b = intent.getExtras();
+
+            p = new LatLng(b.getDouble("y"), b.getDouble("x"));
+            mapView = new MapView(this,
+                    new BaiduMapOptions().mapStatus(new MapStatus.Builder()
+                            .target(p).build()));
+        } else {
+            mapView = new MapView(this, new BaiduMapOptions());
+        }
+        MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLng(p);
+        baiduMap.setMapStatus(mapStatusUpdate);
+
+        // 4.	设置地图缩放为15
+        mapStatusUpdate = MapStatusUpdateFactory.zoomTo(15);
+        baiduMap.setMapStatus(mapStatusUpdate);
+
+        // 6.	获取地图Ui控制器:隐藏指南针
+        UiSettings uiSettings = baiduMap.getUiSettings();
+        uiSettings.setCompassEnabled(true);	//  显示指南针
+
+        if (Build.VERSION.SDK_INT >= 23) {
+            showContacts(mapView);
+        } else {
+            init();
+        }
+    }
+
+    /**
+     * 这个方法让子类实现
+     */
+    public abstract void init();
+
+    /**
+     * 在屏幕中央显示一个Toast
+     *
+     * @param text
+     */
+    public void showToast(CharSequence text) {
+        Utils.showToast(this, text);
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        //在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理
+        mapView.onDestroy();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        //在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理
+        mapView.onResume();
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理
+        mapView.onPause();
+    }
+
+    public void showContacts(View v) {
+        Log.i(TAG, "Show contacts button pressed. Checking permissions.");
+
+        // Verify that all required contact permissions have been granted.
+        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
+                != PackageManager.PERMISSION_GRANTED
+                || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
+                != PackageManager.PERMISSION_GRANTED
+                || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                != PackageManager.PERMISSION_GRANTED
+                || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)
+                != PackageManager.PERMISSION_GRANTED) {
+            // Contacts permissions have not been granted.
+            Log.i(TAG, "Contact permissions has NOT been granted. Requesting permissions.");
+            requestContactsPermissions(v);
+
+        } else {
+
+            // Contact permissions have been granted. Show the contacts fragment.
+            Log.i(TAG,
+                    "Contact permissions have already been granted. Displaying contact details.");
+            init();
+        }
+    }
+
+    /**
+     * 判断用户是否已经授权,如果已经授权,直接开始定位,如果没有授权,
+     *
+     * requestContactsPermissions(v);
+     * 提示用户进行授权
+     *
+     * @param v
+     */
+    private void requestContactsPermissions(View v) {
+        // BEGIN_INCLUDE(contacts_permission_request)
+        if (ActivityCompat.shouldShowRequestPermissionRationale(this,
+                Manifest.permission.ACCESS_COARSE_LOCATION)
+                || ActivityCompat.shouldShowRequestPermissionRationale(this,
+                Manifest.permission.ACCESS_FINE_LOCATION)
+                || ActivityCompat.shouldShowRequestPermissionRationale(this,
+                Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                || ActivityCompat.shouldShowRequestPermissionRationale(this,
+                Manifest.permission.READ_PHONE_STATE)
+                ) {
+
+            // Provide an additional rationale to the user if the permission was not granted
+            // and the user would benefit from additional context for the use of the permission.
+            // For example, if the request has been denied previously.
+            Log.i(TAG1,
+                    "Displaying contacts permission rationale to provide additional context.");
+
+            // Display a SnackBar with an explanation and a button to trigger the request.
+            Snackbar.make(v, "permission_contacts_rationale",
+                    Snackbar.LENGTH_INDEFINITE)
+                    .setAction("ok", new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            ActivityCompat
+                                    .requestPermissions(BaiduBaseActivity.this, PERMISSIONS_CONTACT,
+                                            REQUEST_CONTACTS);
+                        }
+                    })
+                    .show();
+        } else {
+            // Contact permissions have not been granted yet. Request them directly.
+            ActivityCompat.requestPermissions(this, PERMISSIONS_CONTACT, REQUEST_CONTACTS);
+        }
+        // END_INCLUDE(contacts_permission_request)
+    }
+
+    /**
+     * 对授权的结果进行判定
+     *
+     * @param requestCode
+     * @param permissions
+     * @param grantResults
+     */
+    @Override
+    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+
+        if (requestCode == REQUEST_CONTACTS) {
+            if (PermissionUtils.verifyPermissions(grantResults)) {
+
+                init();
+
+            } else {
+
+            }
+
+
+        } else {
+            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        }
+    }
+}

+ 43 - 0
app/src/main/java/com/ahau/againstpest/base/MyApplication.java

@@ -0,0 +1,43 @@
+package com.ahau.againstpest.base;
+
+import android.app.Application;
+import android.content.Context;
+
+import com.ahau.againstpest.HttpProcessor.AsyncProcessor;
+import com.ahau.againstpest.HttpProcessor.HttpHelper;
+import com.baidu.mapapi.SDKInitializer;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+
+public class MyApplication extends Application {
+
+    private static Context mContext;
+
+    private static MyApplication instance;
+    public static MyApplication getInstance() {
+        return instance;
+    }
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        instance = this;
+
+        mContext = getApplicationContext();
+
+        //在使用SDK各组件之前初始化context信息,传入ApplicationContext
+        //注意该方法要再setContentView方法之前实现
+        SDKInitializer.initialize(getApplicationContext());
+
+
+        HttpHelper.init(new AsyncProcessor());
+    }
+
+    public static Context getGlobalContext(){
+        return mContext;
+    }
+}

+ 17 - 0
app/src/main/java/com/ahau/againstpest/bean/AreaBean.java

@@ -0,0 +1,17 @@
+package com.ahau.againstpest.bean;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/5
+ */
+
+public class AreaBean {
+    public String id;
+
+    @Override
+    public String toString() {
+        return id;
+    }
+}

+ 70 - 0
app/src/main/java/com/ahau/againstpest/bean/PestBean.java

@@ -0,0 +1,70 @@
+package com.ahau.againstpest.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 注释:害虫等级的封装
+ * 使用Gson解析时,对象书写技巧:
+ * 1、逢{}创建对象,逢[]创建集合
+ * 2、所有字段名称和json返回名称完全一致
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+
+public class PestBean {
+    public ArrayList<Pest> pest;
+
+    @Override
+    public String toString() {
+        return "PestBean [pest= " + pest
+                + "]";
+    }
+
+    public class Pest {
+        public String pestname;
+        public List<PestGrade> grade;
+
+        @Override
+        public String toString() {
+            return pestname;
+        }
+
+        public class PestGrade {
+            public String firstgrade;
+            public List<SecondGrade> nextgrade;
+
+            @Override
+            public String toString() {
+                return firstgrade;
+            }
+            /*@Override
+            public String toString() {
+                return "PestGrade [firstgrade=" + firstgrade + ", nextgrade=" + nextgrade
+                        + "]";
+            }*/
+
+            public class SecondGrade {
+                public String secondgrade;
+
+                /*@Override
+                public String toString() {
+                    return "SecondGrade [secondgrade=" + secondgrade + "]";
+                }*/
+
+                @Override
+                public String toString() {
+                    return secondgrade;
+                }
+            }
+        }
+    }
+
+
+}
+
+
+
+
+

+ 46 - 0
app/src/main/java/com/ahau/againstpest/model/IPestModel.java

@@ -0,0 +1,46 @@
+package com.ahau.againstpest.model;
+
+import com.ahau.againstpest.bean.PestBean;
+
+import java.util.List;
+
+/**
+ * 注释:用来加载数据
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public interface IPestModel {
+
+    void getPest(PestGetListener pestGetListener);
+    //设计一个内部回调接口
+    interface PestGetListener {
+        void onComplete(List<PestBean.Pest> pest);
+    }
+
+    //获取当前的日期
+    void getDate(DateListener dateListener);
+    interface DateListener {
+        void onComplete(String date);
+    }
+    //获取当前经纬度数据
+    void getLatlng(LatlngListener latlngListener);
+    interface LatlngListener {
+        void onComplete(String[] latlng);
+    }
+
+
+    //获取调查人姓名
+    void getResearName(ResearNameListener researNameListener);
+    interface ResearNameListener{
+        void onComplete(String researName);
+    }
+/*
+    //获取照片的url地址
+    void getPicUrl(PicUrlListener picUrlListener);
+    interface PicUrlListener {
+        void onComplete(String url);
+    }*/
+
+}

+ 174 - 0
app/src/main/java/com/ahau/againstpest/model/PestModelImpl.java

@@ -0,0 +1,174 @@
+package com.ahau.againstpest.model;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.location.Location;
+import android.location.LocationManager;
+import android.support.v4.app.ActivityCompat;
+import android.util.Log;
+
+import com.ahau.againstpest.HttpProcessor.HttpCallback;
+import com.ahau.againstpest.HttpProcessor.HttpHelper;
+import com.ahau.againstpest.base.MyApplication;
+import com.ahau.againstpest.bean.PestBean;
+import com.ahau.againstpest.utils.LoginUtils;
+import com.ahau.againstpest.utils.URLUtils;
+import com.amap.api.maps2d.CoordinateConverter;
+import com.amap.api.maps2d.model.LatLng;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import static android.support.v4.content.ContextCompat.getSystemService;
+
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public class PestModelImpl implements IPestModel {
+
+
+    /**
+     * 害虫的名字
+     *
+     * @param pestGetListener
+     */
+    @Override
+    public void getPest(final PestGetListener pestGetListener) {
+
+        Map<String, Object> params = new HashMap<>();
+
+        HttpHelper.obtain().get(URLUtils.PestUrl, params, new HttpCallback<PestBean>() {
+            @Override
+            public void onSuccess(PestBean pestBean) {
+
+                ArrayList<PestBean.Pest> mPestNameList;
+                //String[] arr;
+
+                mPestNameList = pestBean.pest;
+                Log.i("TAG", pestBean.toString());
+
+             /*   *
+                 * 设置虫种
+                arr = new String[mPestNameList.size() + 1];
+                arr[0] = "请选择:";
+                for (int i = 0; i < mPestNameList.size(); i++) {
+                    arr[i + 1] = mPestNameList.get(i).pestname;
+                }
+                Log.i("tag", arr[0]);*/
+                pestGetListener.onComplete(mPestNameList);
+            }
+
+            @Override
+            public void onFailure(String e) {
+                Log.e("tag", "网络请求失败");
+            }
+
+        });
+
+    }
+
+    /**
+     * 当前日期
+     *
+     * @param dateListener
+     */
+    @Override
+    public void getDate(DateListener dateListener) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");// yyyy/MM/dd  HH:mm:ss
+        //获取当前时间
+        Date date = new Date(System.currentTimeMillis());
+        String sDate = simpleDateFormat.format(date);
+        dateListener.onComplete(sDate);
+    }
+
+    /**
+     * 经纬度数据
+     *
+     * @param latlngListener
+     */
+    @Override
+    public void getLatlng(LatlngListener latlngListener) {
+        String[] latlng = new String[4];
+        String jingdu, weidu, gaodejingdu, gaodeweidu; //经纬度
+//        LocationManager locationmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+        LocationManager locationmanager = (LocationManager) MyApplication.getInstance().getSystemService(Context.LOCATION_SERVICE);
+
+        if (ActivityCompat.checkSelfPermission(MyApplication.getInstance(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(MyApplication.getInstance(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+            // TODO: Consider calling
+            //    ActivityCompat#requestPermissions
+            // here to request the missing permissions, and then overriding
+            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
+            //                                          int[] grantResults)
+            // to handle the case where the user grants the permission. See the documentation
+            // for ActivityCompat#requestPermissions for more details.
+            return;
+        }
+        Location location = locationmanager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
+
+        if (location != null) {
+            double lat = location.getLatitude();// 经度
+            double lng = location.getLongitude();// 纬度
+            System.out.println(lat);
+            jingdu = "" + lat;
+            weidu = "" + lng;
+
+        } else {
+            location = locationmanager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+            if (location != null) {
+                double lat = location.getLatitude();// 经度
+                double lng = location.getLongitude();// 纬度
+                System.out.println(lat);
+                jingdu = "" + lat;
+                weidu = "" + lng;
+            } else {
+                jingdu = "";
+                weidu = "";
+            }
+        }
+        if (!jingdu.isEmpty() && !weidu.isEmpty()) {
+
+            LatLng latLng = new LatLng(Double.valueOf(jingdu), Double.valueOf(weidu));
+            CoordinateConverter converter = new CoordinateConverter();
+            // CoordType.GPS 待转换坐标类型
+            converter.from(CoordinateConverter.CoordType.GPS);
+            // sourceLatLng待转换坐标点 LatLng类型
+            converter.coord(latLng);
+            // 执行转换操作
+            LatLng desLatLng = converter.convert();
+            gaodejingdu = "" + desLatLng.latitude;
+            gaodeweidu = "" + desLatLng.longitude;
+            latlng[2] = gaodejingdu;
+            latlng[3] = gaodeweidu;
+        }
+        latlng[0] = jingdu;
+        latlng[1] = weidu;
+
+
+        latlngListener.onComplete(latlng);
+
+    }
+
+
+    /**
+     * 获取调查人姓名
+     *
+     * @param researNameListener
+     */
+    @Override
+    public void getResearName(ResearNameListener researNameListener) {
+        Map<String, String> map = LoginUtils.getUtil(MyApplication.getGlobalContext());
+        String ResearName = map.get("username");
+        researNameListener.onComplete(ResearName);
+    }
+
+}
+

+ 26 - 0
app/src/main/java/com/ahau/againstpest/presenter/BasePresenter.java

@@ -0,0 +1,26 @@
+package com.ahau.againstpest.presenter;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public class BasePresenter<T > {
+    //1, view 层的引用
+    protected WeakReference<T> mViewRef;
+
+
+    //进行绑定
+    public void attachView(T view) {
+        mViewRef = new WeakReference<T>(view);
+    }
+
+    //进行解绑
+    public void detachView() {
+        mViewRef.clear();
+    }
+}

+ 76 - 0
app/src/main/java/com/ahau/againstpest/presenter/PestPresenter.java

@@ -0,0 +1,76 @@
+package com.ahau.againstpest.presenter;
+
+import com.ahau.againstpest.bean.PestBean;
+import com.ahau.againstpest.model.IPestModel;
+import com.ahau.againstpest.model.PestModelImpl;
+import com.ahau.againstpest.view.IPestView;
+
+import java.util.List;
+
+/**
+ * 注释:表示层
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public class PestPresenter<T extends IPestView> extends BasePresenter<T> {
+
+    //2, model层的引用
+    IPestModel pestModel = new PestModelImpl();
+
+    //3, 构造方法
+    public PestPresenter() {
+    }
+
+    //4, 执行操作(UI)逻辑
+    public void fetch() {
+
+        if (mViewRef.get() != null) {
+            if (pestModel != null) {
+                //获取pest的名字
+                pestModel.getPest(new IPestModel.PestGetListener() {
+                    @Override
+                    public void onComplete(List<PestBean.Pest> pest) {
+                        if (mViewRef.get() != null) {
+                            mViewRef.get().showPest(pest);
+                        }
+                    }
+                });
+                //设置当前时间
+                pestModel.getDate(new IPestModel.DateListener() {
+                    @Override
+                    public void onComplete(String date) {
+                        if (mViewRef.get() != null) {
+                            mViewRef.get().setDate(date);
+                        }
+                    }
+                });
+                //设置经纬度
+                pestModel.getLatlng(new IPestModel.LatlngListener() {
+                    @Override
+                    public void onComplete(String[] latlng) {
+                        if (mViewRef.get() != null) {
+                            mViewRef.get().setLatlng(latlng);
+                        }
+                        System.out.println(latlng[0]);
+                    }
+
+                });
+                //设置调查人姓名
+                pestModel.getResearName(new IPestModel.ResearNameListener() {
+                    @Override
+                    public void onComplete(String researName) {
+                        if (mViewRef.get() != null) {
+                            mViewRef.get().setResearName(researName);
+                        }
+                        System.out.println(researName);
+                    }
+                });
+            }
+
+        }
+
+
+    }
+}

+ 35 - 0
app/src/main/java/com/ahau/againstpest/utils/CacheUtils.java

@@ -0,0 +1,35 @@
+package com.ahau.againstpest.utils;
+
+import android.content.Context;
+
+/**
+ * 注释:网络缓存工具
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+
+public class CacheUtils {
+
+    /**
+     * 以url为key,以json为value,保存到本地
+     * @param url
+     * @param json
+     * @param ctx
+     */
+    public static void setCache(String url, String json, Context ctx) {
+        PrefUtils.setString(ctx, url, json);
+    }
+
+    /**
+     * 获取缓存
+     * @param url
+     * @param ctx
+     * @return
+     */
+    public static String getCache(String url, Context ctx) {
+        return PrefUtils.getString(ctx, url, null);
+
+    }
+
+}

+ 31 - 0
app/src/main/java/com/ahau/againstpest/utils/GsonUtils.java

@@ -0,0 +1,31 @@
+package com.ahau.againstpest.utils;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import java.util.List;
+
+/**
+ * 注释:封装的GSON解析工具类,提供泛型参数
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+
+public class GsonUtils {
+    // 将Json数据解析成相应的映射对象
+    public static <T> T parseJsonWithGson(String jsonData, Class<T> type) {
+        Gson gson = new Gson();
+        T result = gson.fromJson(jsonData, type);
+        return result;
+    }
+
+    // 将Json数组解析成相应的映射对象列表
+    public static <T> List<T> parseJsonArrayWithGson(String jsonData, Class<T> type) {
+        Gson gson = new Gson();
+        List<T> result = gson.fromJson(jsonData, new TypeToken<List<T>>() {
+        }.getType());
+        return result;
+    }
+}

+ 70 - 0
app/src/main/java/com/ahau/againstpest/utils/LoginUtils.java

@@ -0,0 +1,70 @@
+package com.ahau.againstpest.utils;
+
+import android.content.Context;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by fanchunchun on 2018/3/27.
+ */
+
+public class LoginUtils {
+
+    /**
+     * 保存账户名,密码
+     *
+     * @param mContext 上下文
+     * @param username 用户名
+     * @param password 密码
+     * @return
+     */
+
+    public static boolean saveUtil(Context mContext, String username, String password) {
+        String userinfo = username + "##" + password;
+
+
+        try {
+            FileOutputStream fos = mContext.openFileOutput("userinfo.txt", Context.MODE_PRIVATE);
+            fos.write(userinfo.getBytes());
+            fos.close();
+            return true;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    /**
+     * @param mContext
+     * @return 提取账户名密码
+     */
+    public static Map<String, String> getUtil(Context mContext) {
+
+        try {
+            FileInputStream fis = mContext.openFileInput("userinfo.txt");
+            BufferedReader buffer = new BufferedReader(new InputStreamReader(fis));
+            String readLine = buffer.readLine();
+
+            String[] split = readLine.split("##");
+            HashMap<String, String> map = new HashMap<String, String>();
+            map.put("username", split[0]);
+            map.put("password", split[1]);
+
+            buffer.close();
+            fis.close();
+
+            return map;
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+}

+ 35 - 0
app/src/main/java/com/ahau/againstpest/utils/PermissionUtils.java

@@ -0,0 +1,35 @@
+package com.ahau.againstpest.utils;
+
+import android.content.pm.PackageManager;
+
+/**
+ * Utility class that wraps access to the runtime permissions API in M and provides basic helper
+ * methods.
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+public abstract class PermissionUtils {
+
+    /**
+     * Check that all given permissions have been granted by verifying that each entry in the
+     * given array is of the value {@link PackageManager#PERMISSION_GRANTED}.
+     *
+     * @see com.ahau.againstpest.activity.LocationActivity#onRequestPermissionsResult(int, String[], int[])
+     */
+    public static boolean verifyPermissions(int[] grantResults) {
+        // At least one result must be checked.
+        if(grantResults.length < 1){
+            return false;
+        }
+
+        // Verify that each required permission has been granted, otherwise return false.
+        for (int result : grantResults) {
+            if (result != PackageManager.PERMISSION_GRANTED) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}

+ 42 - 0
app/src/main/java/com/ahau/againstpest/utils/PrefUtils.java

@@ -0,0 +1,42 @@
+package com.ahau.againstpest.utils;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+/**
+ * Created by fanchunchun on 2018/3/30.
+ * SharePreferrnce封装
+ */
+
+public class PrefUtils {
+
+    public static boolean getBoolean (Context ctx,String key, boolean defValue) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        return sp.getBoolean(key , defValue);
+    }
+
+    public static void setBoolean (Context ctx,String key, boolean defValue) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        sp.edit().putBoolean(key, defValue);
+    }
+
+    public static String getString (Context ctx,String key, String defValue) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        return sp.getString(key ,defValue);
+    }
+
+    public static void setString (Context ctx,String key, String value) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        sp.edit().putString(key, value).commit();
+    }
+
+    public static int getInt (Context ctx,String key, int defValue) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        return sp.getInt(key ,defValue);
+    }
+
+    public static void setInt (Context ctx,String key, int value) {
+        SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
+        sp.edit().putInt(key, value).commit();
+    }
+}

+ 118 - 0
app/src/main/java/com/ahau/againstpest/utils/ScreenUtils.java

@@ -0,0 +1,118 @@
+package com.ahau.againstpest.utils;
+
+/**
+ * Created by fanchunchun on 2018/3/27.
+ */
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.WindowManager;
+
+/**
+ * 获得屏幕相关的辅助类
+ *
+ */
+public class ScreenUtils {
+    private ScreenUtils() {
+		/* cannot be instantiated */
+        throw new UnsupportedOperationException("cannot be instantiated");
+    }
+
+    /**
+     * 获得屏幕宽度
+     *
+     * @param context
+     * @return
+     */
+    public static int getScreenWidth(Context context) {
+        WindowManager wm = (WindowManager) context
+                .getSystemService(Context.WINDOW_SERVICE);
+        DisplayMetrics outMetrics = new DisplayMetrics();
+        wm.getDefaultDisplay().getMetrics(outMetrics);
+        return outMetrics.widthPixels;
+    }
+
+    /**
+     * 获得屏幕高度
+     *
+     * @param context
+     * @return
+     */
+    public static int getScreenHeight(Context context) {
+        WindowManager wm = (WindowManager) context
+                .getSystemService(Context.WINDOW_SERVICE);
+        DisplayMetrics outMetrics = new DisplayMetrics();
+        wm.getDefaultDisplay().getMetrics(outMetrics);
+        return outMetrics.heightPixels;
+    }
+
+    /**
+     * 获得状态栏的高度
+     *
+     * @param context
+     * @return
+     */
+    public static int getStatusHeight(Context context) {
+
+        int statusHeight = -1;
+        try {
+            Class<?> clazz = Class.forName("com.android.internal.R$dimen");
+            Object object = clazz.newInstance();
+            int height = Integer.parseInt(clazz.getField("status_bar_height")
+                    .get(object).toString());
+            statusHeight = context.getResources().getDimensionPixelSize(height);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return statusHeight;
+    }
+
+    /**
+     * 获取当前屏幕截图,包含状态栏
+     *
+     * @param activity
+     * @return
+     */
+    public static Bitmap snapShotWithStatusBar(Activity activity) {
+        View view = activity.getWindow().getDecorView();
+        view.setDrawingCacheEnabled(true);
+        view.buildDrawingCache();
+        Bitmap bmp = view.getDrawingCache();
+        int width = getScreenWidth(activity);
+        int height = getScreenHeight(activity);
+        Bitmap bp = null;
+        bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
+        view.destroyDrawingCache();
+        return bp;
+
+    }
+
+    /**
+     * 获取当前屏幕截图,不包含状态栏
+     *
+     * @param activity
+     * @return
+     */
+    public static Bitmap snapShotWithoutStatusBar(Activity activity) {
+        View view = activity.getWindow().getDecorView();
+        view.setDrawingCacheEnabled(true);
+        view.buildDrawingCache();
+        Bitmap bmp = view.getDrawingCache();
+        Rect frame = new Rect();
+        activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
+        int statusBarHeight = frame.top;
+
+        int width = getScreenWidth(activity);
+        int height = getScreenHeight(activity);
+        Bitmap bp = null;
+        bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
+                - statusBarHeight);
+        view.destroyDrawingCache();
+        return bp;
+
+    }
+}

+ 89 - 0
app/src/main/java/com/ahau/againstpest/utils/SpinerPopWindow.java

@@ -0,0 +1,89 @@
+package com.ahau.againstpest.utils;
+
+import android.content.Context;
+import android.graphics.drawable.ColorDrawable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.view.WindowManager;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+
+import com.ahau.againstpest.R;
+
+import java.util.List;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/2
+ */
+
+public class SpinerPopWindow<T> extends PopupWindow {
+    private LayoutInflater inflater;
+    private ListView mListView;
+    private List<T> list;
+    private MyAdapter mAdapter;
+
+    public SpinerPopWindow(Context context, List<T> list, OnItemClickListener clickListener) {
+        super(context);
+        inflater = LayoutInflater.from(context);
+        this.list = list;
+        init(clickListener);
+    }
+
+    private void init(OnItemClickListener clickListener) {
+        View view = inflater.inflate(R.layout.spiner_window_layout, null);
+        setContentView(view);
+        setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
+        setWidth(LayoutParams.WRAP_CONTENT);
+        setHeight(LayoutParams.WRAP_CONTENT);
+        setFocusable(true);
+        ColorDrawable dw = new ColorDrawable(0x00);
+        setBackgroundDrawable(dw);
+        mListView = (ListView) view.findViewById(R.id.listview);
+        mListView.setAdapter(mAdapter = new MyAdapter());
+        mListView.setOnItemClickListener(clickListener);
+    }
+
+    private class MyAdapter extends BaseAdapter {
+        @Override
+        public int getCount() {
+            return list.size();
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return list.get(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            ViewHolder holder = null;
+            if (convertView == null) {
+                holder = new ViewHolder();
+                convertView = inflater.inflate(R.layout.spiner_item_layout, null);
+                holder.tvName = (TextView) convertView.findViewById(R.id.tv_name);
+                convertView.setTag(holder);
+            } else {
+                holder = (ViewHolder) convertView.getTag();
+            }
+            holder.tvName.setText(getItem(position).toString());
+            return convertView;
+        }
+    }
+
+    private class ViewHolder {
+        private TextView tvName;
+    }
+}

+ 181 - 0
app/src/main/java/com/ahau/againstpest/utils/TakingPhotoUtils.java

@@ -0,0 +1,181 @@
+package com.ahau.againstpest.utils;
+
+import android.app.Activity;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.net.Uri;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.PopupWindow;
+import android.widget.RelativeLayout;
+
+import com.ahau.againstpest.R;
+import com.ahau.againstpest.activity.AgainPestActivity.Type;
+
+import java.io.File;
+
+/**
+ * Created by fanchunchun on 2018/3/28.
+ */
+
+public class TakingPhotoUtils extends PopupWindow implements View.OnClickListener{
+    public Context mContext;
+
+    private Type type;
+
+    public Activity mActivity;
+
+    private File file;
+    private Uri ImgUri;
+
+    private RelativeLayout mTakePhoto, mAlbumPhoto;
+    private Button mCancel;
+
+    public TakingPhotoUtils(Context context, Activity mActivity) {
+        initView(context);
+        this.mActivity = mActivity;
+    }
+
+    private void initView(Context mContext) {
+        this.mContext = mContext;
+
+        View v = LayoutInflater.from(mContext).inflate(R.layout.personpicchange, null);
+        setContentView(v);
+
+        setWidth(WindowManager.LayoutParams.MATCH_PARENT);
+        setHeight(WindowManager.LayoutParams.MATCH_PARENT);
+        setBackgroundDrawable(new BitmapDrawable());
+        //因为某些机型是虚拟按键的,所以要加上以下设置防止挡住按键.
+        setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
+
+        mTakePhoto = (RelativeLayout) v.findViewById(R.id.photo_take);
+        mAlbumPhoto = (RelativeLayout) v.findViewById(R.id.photo_album);
+        mCancel = (Button) v.findViewById(R.id.photo_cancel);
+
+        mTakePhoto.setOnClickListener(this);
+        mAlbumPhoto.setOnClickListener(this);
+        mCancel.setOnClickListener(this);
+
+
+
+        // 设置SelectPicPopupWindow弹出窗体可点击
+        this.setTouchable(true);
+        this.setFocusable(true);
+        this.setOutsideTouchable(true);
+
+        // 刷新状态
+        this.update();
+        // 设置SelectPicPopupWindow弹出窗体动画效果
+        // this.setAnimationStyle(R.style.popuwindow_from_bottom);
+
+        // 实例化一个ColorDrawable颜色为半透明
+        ColorDrawable dw = new ColorDrawable(0x50000000);
+        // 设置SelectPicPopupWindow弹出窗体的背景
+        this.setBackgroundDrawable(dw);
+    }
+
+    public void showPopupWindow(View parent) {
+
+        if (!this.isShowing()) {
+            this.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
+        } else {
+            this.dismiss();
+
+        }
+    }
+
+    @Override
+    public void onClick(View arg0) {
+        switch (arg0.getId()) {
+            case R.id.photo_take:
+                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+                ContentValues contentValues = new ContentValues(1);
+                file = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg"); // 图片名称为当前时间.jpg
+                contentValues.put(MediaStore.Images.Media.DATA, file.getAbsolutePath());
+                ImgUri = mContext.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,contentValues);
+
+                intent.putExtra(MediaStore.EXTRA_OUTPUT, ImgUri);// 将拍摄的照片保存至imguri
+                mActivity.startActivityForResult(intent, 1);
+                type = Type.CAMERA;
+                if (listener != null) {
+                    listener.getType(type);
+                    listener.getImgUri(ImgUri, file);
+                }
+
+                this.dismiss();
+                break;
+            case R.id.photo_album:
+                Intent intent2 = new Intent("android.intent.action.PICK");
+                intent2.setType("image/*");// audio/* 选择音频 video/* 选择视频
+                // viedo/*;image/*同时选择视频和图片
+                mActivity.startActivityForResult(intent2, 2);
+                type = Type.PHONE;
+                if (listener != null) {
+                    listener.getType(type);
+                }
+                this.dismiss();
+                break;
+            case R.id.photo_cancel:
+                this.dismiss();
+                break;
+            default:
+                break;
+        }
+    }
+
+    public void onPhoto(int k,Uri uri, int outputX, int outputY) { // 裁剪照片
+        Intent intent = null;
+        String padress="";
+        intent = new Intent("com.android.camera.action.CROP");
+        intent.setDataAndType(uri, "image/*");
+
+
+
+        if(k==1)   //判断当前添加的是第几张照片
+        {
+            padress="/temp1.jpg";
+        }else if(k==2){
+            padress="/temp2.jpg";
+        }
+        Uri tempPhotoUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory() +""+padress));
+        // tempPhotoUri =
+        // Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/" +
+        // "temp.jpg");
+
+        intent.putExtra(MediaStore.EXTRA_OUTPUT, tempPhotoUri);
+
+        // intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);//输出至URI
+        // intent.putExtra("return-data", true);//是否将数据保留在BITMAP中返回
+//		intent.putExtra("circleCrop", false);// 圆形 裁剪区域
+        intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
+        // intent.putExtra("outputFormat",
+        // Bitmap.CompressFormat.JPEG.toString());
+        // intent.putExtra("noFaceDetection", true); // no face detection
+        Log.d("tempPhotoUri",tempPhotoUri.toString());
+
+        mActivity.startActivityForResult(intent, 3);
+    }
+
+    public interface onGetTypeClckListener {
+        void getType(Type type);
+
+        void getImgUri(Uri ImgUri, File file);
+    }
+
+    private onGetTypeClckListener listener;
+
+    public void setOnGetTypeClckListener(onGetTypeClckListener listener) {
+        this.listener = listener;
+    }
+}
+

+ 18 - 0
app/src/main/java/com/ahau/againstpest/utils/URLUtils.java

@@ -0,0 +1,18 @@
+package com.ahau.againstpest.utils;
+
+/**
+ * Created by fanchunchun on 2018/3/27.
+ */
+
+public class URLUtils {
+    public static String defaultUrl = "http://175.27.233.172:8080/againstpest";
+    public static String AgainPestUrl = "http://175.27.233.172:8080/againstpest";
+    public static String PestUrl = defaultUrl + "/pestdic";
+    public static String PestCollectUrl = defaultUrl + "/pestsec";
+
+    /*public static String defaultUrl = "http://192.168.1.123:8080";
+    public static String AgainPestUrl = "http://192.168.1.123:8080";
+    //public static String PestUrl = defaultUrl + "/pestgrade.json";
+    public static String PestUrl = defaultUrl + "/pestdic";
+    public static String PestCollectUrl = defaultUrl + "/pestsec";*/
+}

+ 27 - 0
app/src/main/java/com/ahau/againstpest/utils/Utils.java

@@ -0,0 +1,27 @@
+package com.ahau.againstpest.utils;
+
+import android.content.Context;
+import android.view.Gravity;
+import android.widget.Toast;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/3/31
+ */
+
+public class Utils {
+
+    /**
+     * 在屏幕中央显示一个Toast
+     * @param text
+     */
+    public static void showToast(Context context, CharSequence text) {
+        Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
+        toast.setGravity(Gravity.CENTER, 0, 0);
+        toast.show();
+    }
+
+}
+

+ 34 - 0
app/src/main/java/com/ahau/againstpest/view/BaseActivity.java

@@ -0,0 +1,34 @@
+package com.ahau.againstpest.view;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import com.ahau.againstpest.presenter.BasePresenter;
+
+/**
+ * 注释:
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public abstract class BaseActivity<V,T extends BasePresenter<V>> extends Activity{
+
+    //表示层的引用
+    public T pestPresenter;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        pestPresenter = createPresenter();
+        pestPresenter.attachView((V) this);
+    }
+
+    protected abstract T createPresenter();
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        pestPresenter.detachView();
+    }
+}

+ 23 - 0
app/src/main/java/com/ahau/againstpest/view/IPestView.java

@@ -0,0 +1,23 @@
+package com.ahau.againstpest.view;
+
+import com.ahau.againstpest.bean.PestBean;
+
+import java.util.List;
+
+/**
+ * 注释:定义出所有UI逻辑
+ *
+ * @author fanchunchun
+ * @date 2018/4/3
+ */
+
+public interface IPestView {
+    //显示DropEditText的数据(使用回调的方式返回数据) 获取害虫等级三级联动
+    void showPest(List<PestBean.Pest> pest);
+    //显示当前时间
+    void setDate(String date);
+    //获取当前的经纬度
+    void setLatlng(String[] latlng);
+    //获取调查人姓名
+    void setResearName(String researName);
+}

BIN
app/src/main/jniLibs/armeabi/libBaiduMapSDK_base_v5_0_0.so


BIN
app/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v5_0_0.so


BIN
app/src/main/jniLibs/armeabi/liblocSDK7b.so


BIN
app/src/main/res/drawable-hdpi/againpest.jpg


BIN
app/src/main/res/drawable-hdpi/bottom_nor.png


BIN
app/src/main/res/drawable-hdpi/choose.png


BIN
app/src/main/res/drawable-hdpi/close.png


BIN
app/src/main/res/drawable-hdpi/ic_launcher.png


BIN
app/src/main/res/drawable-hdpi/loginbg.png


BIN
app/src/main/res/drawable-hdpi/map.jpg


BIN
app/src/main/res/drawable-hdpi/password.png


BIN
app/src/main/res/drawable-hdpi/pest.jpg


BIN
app/src/main/res/drawable-hdpi/phone.png


BIN
app/src/main/res/drawable-hdpi/right_arrow.png


+ 5 - 0
app/src/main/res/drawable/btn_background.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="10sp"/>
+    <solid android:color="@color/blue"/>
+</shape>

+ 426 - 0
app/src/main/res/layout/activity_again_pest.xml

@@ -0,0 +1,426 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/set_act_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#ffffffff"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="144px"
+        android:background="@color/blue"
+        android:focusable="true"
+        android:focusableInTouchMode="true"
+        android:gravity="center"
+        android:text="@string/app_name"
+        android:textColor="#ffffff"
+        android:textSize="25sp" />
+
+    <ScrollView
+        android:id="@+id/scroll"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#ffffffff"
+            android:orientation="vertical">
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/date_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text="当前日期:"
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <TextView
+                    android:id="@+id/tv_date"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="14dp"
+                    android:layout_toRightOf="@id/date_text"
+                    android:background="@null"
+                    android:textSize="20sp">
+
+                </TextView>
+
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/tv_newadress_area"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="18dp"
+                    android:text="区域编号:"
+                    android:textColor="#3366cc"
+                    android:textSize="20sp" />
+
+                <EditText
+                    android:id="@+id/adressid"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="14dp"
+                    android:layout_toRightOf="@id/tv_newadress_area"
+                    android:background="@drawable/whitebox"
+                    android:hint="请输入:"
+                    android:textColor="#343434"
+                    android:textSize="20sp" />
+
+
+
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/pesttype_text"
+                    android:layout_width="90dp"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text="虫种:"
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <com.ahau.againstpest.MyView.SpinnerEditText
+
+                    android:id="@+id/pestname"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="14dp"
+                    android:layout_toRightOf="@id/pesttype_text"
+                    android:background="@drawable/whitebox"
+                    android:hint="请选择:"
+                    android:textColor="#343434"
+                    android:textSize="20sp" />
+
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/pestgrade_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:layout_gravity="center"
+                    android:text="害虫时期:"
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <com.ahau.againstpest.MyView.SpinnerEditText
+
+                    android:id="@+id/firstgrade"
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:layout_height="match_parent"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="14dp"
+                    android:layout_toRightOf="@id/pestgrade_text"
+                    android:background="@drawable/whitebox"
+                    android:hint="请选择:"
+                    android:textColor="#343434"
+                    android:textSize="20sp" />
+                <com.ahau.againstpest.MyView.SpinnerEditText
+
+                    android:id="@+id/secondgrade"
+                    android:layout_width="0dp"
+                    android:layout_weight="1"
+                    android:layout_height="match_parent"
+                    android:layout_centerVertical="true"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginLeft="14dp"
+                    android:layout_toRightOf="@id/firstgrade"
+                    android:background="@drawable/whitebox"
+                    android:hint="请选择:"
+                    android:textColor="#343434"
+                    android:textSize="20sp" />
+
+            </LinearLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/researchpeople_text"
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text="调查人: "
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <TextView
+                    android:id="@+id/researchpeople"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_marginLeft="30dp"
+                    android:layout_toRightOf="@id/researchpeople_text"
+                    android:text="@string/app_name"
+                    android:gravity="center|left"
+                    android:textColor="#b3b3b3"
+                    android:textSize="20sp" />
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="80dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/remark_text"
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text="备注: "
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <EditText
+                    android:id="@+id/remark"
+                    android:layout_width="match_parent"
+                    android:layout_height="fill_parent"
+                    android:layout_marginLeft="11dp"
+                    android:layout_toRightOf="@id/remark_text"
+                    android:background="@null"
+                    android:hint="点击输入"
+                    android:textColor="#b3b3b3"
+                    android:textSize="20sp" />
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+
+            <RelativeLayout
+                android:id="@+id/addpestpic"
+                android:layout_width="fill_parent"
+                android:layout_height="140dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/pestpic_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text=" 害虫图片1: "
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <TextView
+                    android:id="@+id/pestpicadd_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="40dp"
+                    android:layout_toRightOf="@id/pestpic_text"
+                    android:background="#ffffffff"
+                    android:text=" 点击添加图片"
+                    android:textColor="#ff000000"
+                    android:textSize="20sp"
+                    android:visibility="visible" />
+
+                <ImageView
+                    android:id="@+id/pestpic"
+                    android:layout_width="120dp"
+                    android:layout_height="120dp"
+                    android:layout_centerHorizontal="true"
+                    android:layout_centerInParent="true"
+                    android:layout_marginLeft="40dp"
+                    android:layout_toRightOf="@id/pestpic_text"
+                    android:background="#ffffffff"
+                    android:visibility="invisible" />
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+            <RelativeLayout
+                android:id="@+id/addpestpic2"
+                android:layout_width="fill_parent"
+                android:layout_height="140dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/pestpic_text2"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="18dp"
+                    android:background="#ffffffff"
+                    android:text=" 害虫图片2: "
+                    android:textColor="#ff3366cc"
+                    android:textSize="20sp" />
+
+                <TextView
+                    android:id="@+id/pestpicadd_text2"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="30dp"
+                    android:layout_toRightOf="@id/pestpic_text2"
+                    android:background="#ffffffff"
+                    android:text=" 点击添加图片"
+                    android:textColor="#ff000000"
+                    android:textSize="20sp"
+                    android:visibility="visible" />
+
+                <ImageView
+                    android:id="@+id/pestpic2"
+                    android:layout_width="120dp"
+                    android:layout_height="120dp"
+                    android:layout_centerHorizontal="true"
+                    android:layout_centerInParent="true"
+                    android:layout_marginLeft="30dp"
+                    android:layout_toRightOf="@id/pestpic_text2"
+                    android:background="#ffffffff"
+                    android:visibility="invisible" />
+            </RelativeLayout>
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="#ff3366cc" />
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:background="#ffffffff">
+
+                <TextView
+                    android:id="@+id/jingdu_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="30dp"
+                    android:background="#ffffffff"
+                    android:text="纬度:"
+                    android:textColor="#ff3366cc"
+                    android:textSize="16sp" />
+
+                <TextView
+                    android:id="@+id/jingdu"
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="11dp"
+                    android:layout_toRightOf="@id/jingdu_text"
+                    android:background="@null"
+                    android:text="bb"
+                    android:textColor="#b3b3b3"
+                    android:textSize="14sp" />
+
+                <TextView
+                    android:id="@+id/weidu_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginLeft="20dp"
+                    android:layout_toRightOf="@id/jingdu"
+                    android:background="#ffffffff"
+                    android:text="经度:"
+                    android:textColor="#ff3366cc"
+                    android:textSize="16sp" />
+
+                <TextView
+                    android:id="@+id/weidu"
+                    android:layout_width="100dp"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_toRightOf="@id/weidu_text"
+                    android:text="aa"
+                    android:textColor="#b3b3b3"
+                    android:textSize="14sp" />
+            </RelativeLayout>
+
+            <Button
+                android:id="@+id/tijiao"
+                android:layout_width="332dp"
+                android:layout_height="44dp"
+                android:layout_gravity="center_horizontal"
+                android:layout_marginTop="16dp"
+                android:background="@drawable/btn_background"
+                android:text="提交"
+                android:textColor="#ffffffff"
+                android:textSize="25sp" />
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="20dp"
+                android:background="#ffffffff" />
+        </LinearLayout>
+    </ScrollView>
+
+</LinearLayout>

+ 76 - 0
app/src/main/res/layout/activity_location.xml

@@ -0,0 +1,76 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/container"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#000000"
+    android:orientation="vertical"
+    tools:context="com.ahau.againstpest.activity.LocationActivity"
+    tools:ignore="MergeRootFrame">
+
+
+    <RelativeLayout
+        android:id="@+id/MyLayout_top"
+        android:layout_width="fill_parent"
+        android:layout_height="60dp"
+        android:layout_alignParentTop="true"
+        android:background="@color/blue"
+        android:gravity="center"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/square"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:text="@string/app_name"
+            android:textColor="#ff3366cc"
+            android:textSize="16sp" />
+
+    </RelativeLayout>
+    <!-- 底部添加按钮 -->
+    <RelativeLayout
+        android:id="@+id/My_bottomLO"
+        android:layout_width="fill_parent"
+        android:layout_height="50dp"
+        android:layout_alignParentBottom="true"
+        android:gravity="center"
+        android:orientation="horizontal">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_alignParentBottom="true"
+            android:orientation="horizontal">
+
+            <Button
+                android:id="@+id/button1"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:background="@color/blue"
+                android:text="当前位置"
+                android:textColor="#ff3366cc" />
+        </LinearLayout>
+
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/Content_Layout"
+
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:layout_above="@id/My_bottomLO"
+        android:layout_below="@id/MyLayout_top"
+
+        android:gravity="center">
+
+        <com.baidu.mapapi.map.MapView
+            android:id="@+id/map_view"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:clickable="true" />
+    </RelativeLayout>
+
+
+</RelativeLayout>

+ 109 - 0
app/src/main/res/layout/activity_login.xml

@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@null"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="80dp"
+        android:gravity="center"
+        android:text="@string/app_name"
+        android:textColor="#f7f9f6"
+        android:textSize="30sp"
+        android:background="@color/blue"/>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0.1dp"
+        android:layout_marginTop="15dp"
+        android:background="#dbdbdb" />
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="60dp"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="40dp"
+            android:layout_marginLeft="17dp"
+            android:src="@drawable/phone" />
+
+        <EditText
+            android:id="@+id/username"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_marginLeft="11dp"
+            android:background="@null"
+            android:hint="请输入用户名"
+
+            android:textColor="#b3b3b3"
+            android:textSize="18sp" />
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0.1dp"
+        android:layout_marginLeft="41dp"
+        android:background="#dbdbdb" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="60dp"
+        android:layout_marginTop="2dp"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="35dp"
+            android:layout_marginLeft="14dp"
+            android:src="@drawable/password" />
+
+        <EditText
+            android:id="@+id/pwd"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"
+            android:layout_marginLeft="12dp"
+            android:background="@null"
+            android:hint="请输入密码"
+            android:inputType="textPassword"
+            android:textColor="#b3b3b3"
+            android:textSize="18sp" />
+    </LinearLayout>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="0.1dp"
+        android:background="#dbdbdb" />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <CheckBox
+            android:id="@+id/remcb"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:checked="false"
+            android:text="记住密码"
+            android:textColor="@color/blue"
+            android:textSize="18sp" />
+
+        <Button
+            android:id="@+id/login"
+            android:layout_width="300dp"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:text="登录"
+            android:background="@drawable/btn_background"
+            android:textColor="#ffffffff"
+            android:textSize="18sp" />
+    </RelativeLayout>
+
+
+
+
+</LinearLayout>

+ 90 - 0
app/src/main/res/layout/activity_search.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#ffffffff"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="144px"
+        android:background="@color/blue"
+        android:gravity="center"
+        android:text="@string/app_name"
+        android:textColor="#ffffff"
+        android:textSize="20sp" />
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="120dp"
+        android:layout_alignParentLeft="true"
+        android:background="@drawable/againpest" />
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="10dp"
+        android:background="#ffdbdbdb" />
+
+    <RelativeLayout
+        android:id="@+id/againpest_layout"
+        android:layout_width="fill_parent"
+        android:layout_height="100dp"
+        android:background="#ffffffff">
+
+        <Button
+            android:id="@+id/pest_image1"
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="20dp"
+            android:layout_marginTop="10dp"
+            android:background="@drawable/pest" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:layout_marginLeft="10dp"
+            android:layout_toRightOf="@id/pest_image1"
+            android:text="@string/app_name"
+            android:textColor="#ff828282"
+            android:textSize="16sp" />
+    </RelativeLayout>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="5dp"
+        android:background="#ffdbdbdb" />
+
+    <RelativeLayout
+        android:id="@+id/position_layout"
+        android:layout_width="fill_parent"
+        android:layout_height="100dp"
+        android:background="#ffffffff">
+
+        <Button
+            android:id="@+id/position_image1"
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="20dp"
+            android:layout_marginTop="10dp"
+            android:background="@drawable/map" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:layout_marginLeft="10dp"
+            android:layout_toRightOf="@id/position_image1"
+            android:text="当前位置定位"
+            android:textColor="#ff828282"
+            android:textSize="16sp" />
+    </RelativeLayout>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="5dp"
+        android:background="#ffdbdbdb" />
+
+</LinearLayout>

+ 22 - 0
app/src/main/res/layout/listpopwindow.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+             android:layout_width="match_parent"
+             android:layout_height="wrap_content"
+             android:descendantFocusability="blocksDescendants"
+             android:minHeight="40dp"
+             android:orientation="vertical">
+
+
+    <TextView
+
+        android:id="@+id/tv"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#FFFFFF"
+        android:gravity="left|center_vertical"
+        android:minHeight="40dp"
+        android:minWidth="80dp"
+        android:paddingLeft="5dp"
+        android:text="单个条目"
+        android:textSize="20dp" />
+</FrameLayout>

+ 97 - 0
app/src/main/res/layout/personpicchange.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="center_horizontal"
+    android:orientation="vertical"
+    android:background="#00000000">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="229dp"
+        android:layout_alignParentBottom="true"
+        android:background="#f9f9f9"
+        android:orientation="vertical" >
+        <RelativeLayout
+
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+
+            >
+
+            <TextView
+
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+
+                android:textColor="#ff000000"
+                android:text="设置害虫图片"
+                android:layout_centerInParent="true"
+                android:textSize="23sp"
+                />
+
+
+        </RelativeLayout>
+        <RelativeLayout
+            android:id="@+id/photo_take"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            android:background="#fff"
+            >
+
+            <TextView
+
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+
+                android:textColor="#ff343434"
+                android:text="拍摄新照片"
+                android:layout_centerInParent="true"
+                android:textSize="20sp"
+                />
+
+
+        </RelativeLayout>
+        <ImageView
+
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+
+            android:background="#f9f9f9"
+
+            />
+        <RelativeLayout
+            android:id="@+id/photo_album"
+            android:layout_width="match_parent"
+            android:layout_height="48dp"
+            android:background="#fff"
+            >
+
+            <TextView
+
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+
+                android:textColor="#ff343434"
+                android:text="从本地图库选择"
+                android:layout_centerInParent="true"
+                android:textSize="20sp"
+                />
+
+        </RelativeLayout>
+
+
+        <Button
+            android:id="@+id/photo_cancel"
+            android:layout_width="332dp"
+            android:layout_height="44dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="30dp"
+            android:background="@drawable/btn_background"
+            android:text="取消"
+            android:textColor="#ffffffff"
+            android:textSize="18sp" />
+
+    </LinearLayout>
+
+</RelativeLayout>

+ 10 - 0
app/src/main/res/layout/spiner_item_layout.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:id="@+id/tv_name"/>
+
+</LinearLayout>

+ 16 - 0
app/src/main/res/layout/spiner_window_layout.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:layout_alignParentRight="true"
+    android:orientation="vertical">
+
+    <ListView
+        android:id="@+id/listview"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:cacheColorHint="#00000000"
+        android:background="#fff"
+        android:scrollbars="none" >
+    </ListView>
+</LinearLayout>  

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png


+ 10 - 0
app/src/main/res/values/colors.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#3F51B5</color>
+    <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorAccent">#FF4081</color>
+
+    <color name="green">#66fd3c</color>
+    <color name="red">#ff4343</color>
+    <color name="blue">#d5190db7</color>
+</resources>

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">重大病虫害监测预警采集系统</string>
+</resources>

+ 12 - 0
app/src/main/res/values/styles.xml

@@ -0,0 +1,12 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+        <!-- Customize your theme here. -->
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
+        <item name="windowNoTitle">true</item>
+    </style>
+
+</resources>

+ 4 - 0
app/src/main/res/xml/network_security_config.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<network-security-config>
+    <base-config cleartextTrafficPermitted="true" />
+</network-security-config>

+ 17 - 0
app/src/test/java/com/ahau/againstpest/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.ahau.againstpest;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 30 - 0
build.gradle

@@ -0,0 +1,30 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    
+    repositories {
+        google()
+        jcenter()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.1.2'
+        
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+
+}
+
+allprojects {
+    repositories {
+        google()
+        jcenter()
+        maven { url 'https://jitpack.io' }
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}
+

+ 13 - 0
gradle.properties

@@ -0,0 +1,13 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 172 - 0
gradlew

@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

+ 84 - 0
gradlew.bat

@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 1 - 0
settings.gradle

@@ -0,0 +1 @@
+include ':app'