Ver Fonte

新工程RA Image
从POP 导入修改得到。
已修改加密,网络访问,和登陆界面。

Ray Zhang há 9 anos atrás
pai
commit
f98618be8b
100 ficheiros alterados com 14691 adições e 0 exclusões
  1. BIN
      RA Image/.gradle/3.3/taskArtifacts/fileHashes.bin
  2. BIN
      RA Image/.gradle/3.3/taskArtifacts/fileSnapshots.bin
  3. BIN
      RA Image/.gradle/3.3/taskArtifacts/taskArtifacts.bin
  4. BIN
      RA Image/.gradle/3.3/taskArtifacts/taskArtifacts.lock
  5. BIN
      RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin
  6. BIN
      RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock
  7. BIN
      RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin
  8. BIN
      RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock
  9. 22 0
      RA Image/.idea/compiler.xml
  10. 3 0
      RA Image/.idea/copyright/profiles_settings.xml
  11. 3 0
      RA Image/.idea/dictionaries/ray.xml
  12. 18 0
      RA Image/.idea/gradle.xml
  13. 12 0
      RA Image/.idea/libraries/animated_vector_drawable_25_3_1.xml
  14. 12 0
      RA Image/.idea/libraries/appcompat_v7_25_3_1.xml
  15. 9 0
      RA Image/.idea/libraries/bcprov_jdk15on_157.xml
  16. 10 0
      RA Image/.idea/libraries/constraint_layout_1_0_2.xml
  17. 9 0
      RA Image/.idea/libraries/constraint_layout_solver_1_0_2.xml
  18. 9 0
      RA Image/.idea/libraries/core_2_3_0.xml
  19. 9 0
      RA Image/.idea/libraries/httpmime_4_1_1.xml
  20. 9 0
      RA Image/.idea/libraries/org_apache_http_legacy_android_25.xml
  21. 11 0
      RA Image/.idea/libraries/support_annotations_25_3_1.xml
  22. 12 0
      RA Image/.idea/libraries/support_compat_25_3_1.xml
  23. 12 0
      RA Image/.idea/libraries/support_core_ui_25_3_1.xml
  24. 12 0
      RA Image/.idea/libraries/support_core_utils_25_3_1.xml
  25. 12 0
      RA Image/.idea/libraries/support_fragment_25_3_1.xml
  26. 12 0
      RA Image/.idea/libraries/support_media_compat_25_3_1.xml
  27. 10 0
      RA Image/.idea/libraries/support_v4_25_3_1.xml
  28. 12 0
      RA Image/.idea/libraries/support_vector_drawable_25_3_1.xml
  29. 49 0
      RA Image/.idea/misc.xml
  30. 9 0
      RA Image/.idea/modules.xml
  31. 12 0
      RA Image/.idea/runConfigurations.xml
  32. 6 0
      RA Image/.idea/vcs.xml
  33. 2952 0
      RA Image/.idea/workspace.xml
  34. 19 0
      RA Image/RA Image.iml
  35. 123 0
      RA Image/app/app.iml
  36. 36 0
      RA Image/app/build.gradle
  37. BIN
      RA Image/app/libs/bcprov-jdk15on-157.jar
  38. BIN
      RA Image/app/libs/core-2.3.0.jar
  39. BIN
      RA Image/app/libs/httpmime-4.1.1.jar
  40. 31 0
      RA Image/app/proguard-project.txt
  41. 131 0
      RA Image/app/src/main/AndroidManifest.xml
  42. 112 0
      RA Image/app/src/main/java/com/usai/redant/camera/AutoFocusManager.java
  43. 307 0
      RA Image/app/src/main/java/com/usai/redant/camera/CameraConfigurationManager.java
  44. 311 0
      RA Image/app/src/main/java/com/usai/redant/camera/CameraManager.java
  45. 43 0
      RA Image/app/src/main/java/com/usai/redant/camera/FrontLightMode.java
  46. 56 0
      RA Image/app/src/main/java/com/usai/redant/camera/PreviewCallback.java
  47. 62 0
      RA Image/app/src/main/java/com/usai/redant/camera/open/OpenCameraInterface.java
  48. 74 0
      RA Image/app/src/main/java/com/usai/redant/raimage/AboutActivity.java
  49. 87 0
      RA Image/app/src/main/java/com/usai/redant/raimage/AmbientLightManager.java
  50. 128 0
      RA Image/app/src/main/java/com/usai/redant/raimage/BeepManager.java
  51. 33 0
      RA Image/app/src/main/java/com/usai/redant/raimage/BootReceiver.java
  52. 884 0
      RA Image/app/src/main/java/com/usai/redant/raimage/CaptureActivity.java
  53. 169 0
      RA Image/app/src/main/java/com/usai/redant/raimage/CaptureActivityHandler.java
  54. 101 0
      RA Image/app/src/main/java/com/usai/redant/raimage/DecodeFormatManager.java
  55. 121 0
      RA Image/app/src/main/java/com/usai/redant/raimage/DecodeHandler.java
  56. 236 0
      RA Image/app/src/main/java/com/usai/redant/raimage/DecodeHintManager.java
  57. 104 0
      RA Image/app/src/main/java/com/usai/redant/raimage/DecodeThread.java
  58. 49 0
      RA Image/app/src/main/java/com/usai/redant/raimage/FinishListener.java
  59. 533 0
      RA Image/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java
  60. 243 0
      RA Image/app/src/main/java/com/usai/redant/raimage/HttpHelper.java
  61. 116 0
      RA Image/app/src/main/java/com/usai/redant/raimage/InactivityTimer.java
  62. 261 0
      RA Image/app/src/main/java/com/usai/redant/raimage/Intents.java
  63. 63 0
      RA Image/app/src/main/java/com/usai/redant/raimage/LicenseActivity.java
  64. 780 0
      RA Image/app/src/main/java/com/usai/redant/raimage/LockerActivity.java
  65. 540 0
      RA Image/app/src/main/java/com/usai/redant/raimage/LoginActivity.java
  66. 904 0
      RA Image/app/src/main/java/com/usai/redant/raimage/MainActivity.java
  67. 13 0
      RA Image/app/src/main/java/com/usai/redant/raimage/ModeActivity.java
  68. 202 0
      RA Image/app/src/main/java/com/usai/redant/raimage/PhotoPreviewActivity.java
  69. 56 0
      RA Image/app/src/main/java/com/usai/redant/raimage/PreferencesActivity.java
  70. 71 0
      RA Image/app/src/main/java/com/usai/redant/raimage/PreferencesFragment.java
  71. 111 0
      RA Image/app/src/main/java/com/usai/redant/raimage/RedAntApplication.java
  72. 267 0
      RA Image/app/src/main/java/com/usai/redant/raimage/ServerSettingActivity.java
  73. 439 0
      RA Image/app/src/main/java/com/usai/redant/raimage/UploadQueueActivity.java
  74. 649 0
      RA Image/app/src/main/java/com/usai/redant/raimage/UploadService.java
  75. 35 0
      RA Image/app/src/main/java/com/usai/redant/raimage/ViewfinderResultPointCallback.java
  76. 187 0
      RA Image/app/src/main/java/com/usai/redant/raimage/ViewfinderView.java
  77. 163 0
      RA Image/app/src/main/java/com/usai/redant/raimage/testfullActivity.java
  78. 242 0
      RA Image/app/src/main/java/com/usai/util/AES.java
  79. 133 0
      RA Image/app/src/main/java/com/usai/util/Crypto.java
  80. 43 0
      RA Image/app/src/main/java/com/usai/util/MD5.java
  81. 1256 0
      RA Image/app/src/main/java/com/usai/util/Network.java
  82. 68 0
      RA Image/app/src/main/java/com/usai/util/SqlOpenHelper.java
  83. 536 0
      RA Image/app/src/main/java/com/usai/util/dbUtil.java
  84. 240 0
      RA Image/app/src/main/java/com/usai/util/dbgUtil.java
  85. 8 0
      RA Image/app/src/main/java/com/usai/util/package-info.java
  86. BIN
      RA Image/app/src/main/res/drawable-hdpi/bar2.png
  87. BIN
      RA Image/app/src/main/res/drawable-hdpi/ic_action_camera.png
  88. BIN
      RA Image/app/src/main/res/drawable-hdpi/ic_action_upload.png
  89. BIN
      RA Image/app/src/main/res/drawable-hdpi/ic_launcher.png
  90. 20 0
      RA Image/app/src/main/res/drawable-hdpi/imagebutton.xml
  91. BIN
      RA Image/app/src/main/res/drawable-hdpi/no_pic.png
  92. BIN
      RA Image/app/src/main/res/drawable-hdpi/picture_frame.png
  93. BIN
      RA Image/app/src/main/res/drawable-mdpi/ic_launcher.png
  94. BIN
      RA Image/app/src/main/res/drawable-xhdpi/ic_launcher.png
  95. BIN
      RA Image/app/src/main/res/drawable-xxhdpi/ic_launcher.png
  96. BIN
      RA Image/app/src/main/res/drawable-xxhdpi/red_ant_logo.png
  97. 4 0
      RA Image/app/src/main/res/drawable/ic_settings_gray_36dp.xml
  98. 28 0
      RA Image/app/src/main/res/drawable/round_button.xml
  99. 9 0
      RA Image/app/src/main/res/drawable/switch_thumb.xml
  100. 8 0
      RA Image/app/src/main/res/drawable/switch_track.xml

BIN
RA Image/.gradle/3.3/taskArtifacts/fileHashes.bin


BIN
RA Image/.gradle/3.3/taskArtifacts/fileSnapshots.bin


BIN
RA Image/.gradle/3.3/taskArtifacts/taskArtifacts.bin


BIN
RA Image/.gradle/3.3/taskArtifacts/taskArtifacts.lock


BIN
RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin


BIN
RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock


BIN
RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin


BIN
RA Image/.gradle/3.3/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock


+ 22 - 0
RA Image/.idea/compiler.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <resourceExtensions />
+    <wildcardResourcePatterns>
+      <entry name="!?*.java" />
+      <entry name="!?*.form" />
+      <entry name="!?*.class" />
+      <entry name="!?*.groovy" />
+      <entry name="!?*.scala" />
+      <entry name="!?*.flex" />
+      <entry name="!?*.kt" />
+      <entry name="!?*.clj" />
+      <entry name="!?*.aj" />
+    </wildcardResourcePatterns>
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="false">
+        <processorPath useClasspath="true" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>

+ 3 - 0
RA Image/.idea/copyright/profiles_settings.xml

@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+  <settings default="" />
+</component>

+ 3 - 0
RA Image/.idea/dictionaries/ray.xml

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

+ 18 - 0
RA Image/.idea/gradle.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <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>

+ 12 - 0
RA Image/.idea/libraries/animated_vector_drawable_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="animated-vector-drawable-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/.android/build-cache/3ba647aceeef16ab221e6627abb4836f7d50e735/output/jars/classes.jar!/" />
+      <root url="file://$USER_HOME$/.android/build-cache/3ba647aceeef16ab221e6627abb4836f7d50e735/output/res" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/25.3.1/animated-vector-drawable-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/appcompat_v7_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="appcompat-v7-25.3.1">
+    <CLASSES>
+      <root url="file://$USER_HOME$/.android/build-cache/2ce1a223a62a77e09c58bf0f78f6865e26fc8e9a/output/res" />
+      <root url="jar://$USER_HOME$/.android/build-cache/2ce1a223a62a77e09c58bf0f78f6865e26fc8e9a/output/jars/classes.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 9 - 0
RA Image/.idea/libraries/bcprov_jdk15on_157.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="bcprov-jdk15on-157">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/app/libs/bcprov-jdk15on-157.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 10 - 0
RA Image/.idea/libraries/constraint_layout_1_0_2.xml

@@ -0,0 +1,10 @@
+<component name="libraryTable">
+  <library name="constraint-layout-1.0.2">
+    <CLASSES>
+      <root url="file://$USER_HOME$/.android/build-cache/d94fa05ec921f6a30077cfd78e86aebd35b89466/output/res" />
+      <root url="jar://$USER_HOME$/.android/build-cache/d94fa05ec921f6a30077cfd78e86aebd35b89466/output/jars/classes.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
RA Image/.idea/libraries/constraint_layout_solver_1_0_2.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="constraint-layout-solver-1.0.2">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2/constraint-layout-solver-1.0.2.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
RA Image/.idea/libraries/core_2_3_0.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="core-2.3.0">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/app/libs/core-2.3.0.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
RA Image/.idea/libraries/httpmime_4_1_1.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="httpmime-4.1.1">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/app/libs/httpmime-4.1.1.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 9 - 0
RA Image/.idea/libraries/org_apache_http_legacy_android_25.xml

@@ -0,0 +1,9 @@
+<component name="libraryTable">
+  <library name="org.apache.http.legacy-android-25">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/platforms/android-25/optional/org.apache.http.legacy.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 11 - 0
RA Image/.idea/libraries/support_annotations_25_3_1.xml

@@ -0,0 +1,11 @@
+<component name="libraryTable">
+  <library name="support-annotations-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/25.3.1/support-annotations-25.3.1.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/25.3.1/support-annotations-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_compat_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-compat-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/.android/build-cache/a0411d23ab15cd89284c6b73732045d861fc286a/output/jars/classes.jar!/" />
+      <root url="file://$USER_HOME$/.android/build-cache/a0411d23ab15cd89284c6b73732045d861fc286a/output/res" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-compat/25.3.1/support-compat-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_core_ui_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-core-ui-25.3.1">
+    <CLASSES>
+      <root url="file://$USER_HOME$/.android/build-cache/4e05cf267620b21488fb998f93fe894892ed2b98/output/res" />
+      <root url="jar://$USER_HOME$/.android/build-cache/4e05cf267620b21488fb998f93fe894892ed2b98/output/jars/classes.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-ui/25.3.1/support-core-ui-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_core_utils_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-core-utils-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/.android/build-cache/574d4b689e6d9efb4205a6cdc1ed1f9e85af92df/output/jars/classes.jar!/" />
+      <root url="file://$USER_HOME$/.android/build-cache/574d4b689e6d9efb4205a6cdc1ed1f9e85af92df/output/res" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-utils/25.3.1/support-core-utils-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_fragment_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-fragment-25.3.1">
+    <CLASSES>
+      <root url="file://$USER_HOME$/.android/build-cache/f2ae6a430826315a413cf404661aa2347cac9ec1/output/res" />
+      <root url="jar://$USER_HOME$/.android/build-cache/f2ae6a430826315a413cf404661aa2347cac9ec1/output/jars/classes.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-fragment/25.3.1/support-fragment-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_media_compat_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-media-compat-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/.android/build-cache/9531d65c2b09d3d9f4eaf7e640d6ca157b91b439/output/jars/classes.jar!/" />
+      <root url="file://$USER_HOME$/.android/build-cache/9531d65c2b09d3d9f4eaf7e640d6ca157b91b439/output/res" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-media-compat/25.3.1/support-media-compat-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 10 - 0
RA Image/.idea/libraries/support_v4_25_3_1.xml

@@ -0,0 +1,10 @@
+<component name="libraryTable">
+  <library name="support-v4-25.3.1">
+    <CLASSES>
+      <root url="file://$USER_HOME$/.android/build-cache/be9a8742a9cce0e2a1528b71d2d6317784576498/output/res" />
+      <root url="jar://$USER_HOME$/.android/build-cache/be9a8742a9cce0e2a1528b71d2d6317784576498/output/jars/classes.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
+</component>

+ 12 - 0
RA Image/.idea/libraries/support_vector_drawable_25_3_1.xml

@@ -0,0 +1,12 @@
+<component name="libraryTable">
+  <library name="support-vector-drawable-25.3.1">
+    <CLASSES>
+      <root url="jar://$USER_HOME$/.android/build-cache/9d86770d3b701695caba4405b6b731e19c9f3773/output/jars/classes.jar!/" />
+      <root url="file://$USER_HOME$/.android/build-cache/9d86770d3b701695caba4405b6b731e19c9f3773/output/res" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-vector-drawable/25.3.1/support-vector-drawable-25.3.1-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>

+ 49 - 0
RA Image/.idea/misc.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
+  <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="4">
+          <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="edu.umd.cs.findbugs.annotations.Nullable" />
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
+        </list>
+      </value>
+    </option>
+    <option name="myNotNulls">
+      <value>
+        <list size="4">
+          <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" />
+        </list>
+      </value>
+    </option>
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="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>
+  <component name="SvnBranchConfigurationManager">
+    <option name="mySupportsUserInfoFilter" value="true" />
+  </component>
+</project>

+ 9 - 0
RA Image/.idea/modules.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/RA Image.iml" filepath="$PROJECT_DIR$/RA Image.iml" />
+      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
+    </modules>
+  </component>
+</project>

+ 12 - 0
RA Image/.idea/runConfigurations.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 6 - 0
RA Image/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="svn" />
+  </component>
+</project>

+ 2952 - 0
RA Image/.idea/workspace.xml

@@ -0,0 +1,2952 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AndroidLayouts">
+    <shared>
+      <config>
+        <devices>
+          <device id="Nexus 5X" />
+          <device id="pixel_xl" />
+          <device id="pixel" />
+          <device id="pixel_c" />
+          <device id="Nexus 5" />
+        </devices>
+      </config>
+    </shared>
+  </component>
+  <component name="AndroidLogFilters">
+    <option name="TOOL_WINDOW_LOG_LEVEL" value="verbose" />
+    <option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
+    <option name="TOOL_WINDOW_REGEXP_FILTER" value="false" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" readonly="true" id="c84dce3b-09ff-4e88-a0cc-545c53252476" name="Default" comment="" />
+    <ignored path="RedAnt Photo.iws" />
+    <ignored path=".idea/workspace.xml" />
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="CreatePatchCommitExecutor">
+    <option name="PATCH_PATH" value="" />
+  </component>
+  <component name="DockManager">
+    <window id="2">
+      <content type="file-editors">
+        <state>
+          <leaf>
+            <file leaf-file-name="LoginActivity.java" pinned="false" current-in-tab="true">
+              <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/LoginActivity.java">
+                <provider selected="true" editor-type-id="text-editor">
+                  <state relative-caret-position="195">
+                    <caret line="187" column="33" selection-start-line="187" selection-start-column="33" selection-end-line="187" selection-end-column="33" />
+                    <folding />
+                  </state>
+                </provider>
+              </entry>
+            </file>
+            <file leaf-file-name="AboutActivity.java" pinned="false" current-in-tab="false">
+              <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/AboutActivity.java">
+                <provider selected="true" editor-type-id="text-editor">
+                  <state relative-caret-position="330">
+                    <caret line="33" column="16" selection-start-line="33" selection-start-column="16" selection-end-line="33" selection-end-column="16" />
+                    <folding />
+                  </state>
+                </provider>
+              </entry>
+            </file>
+            <file leaf-file-name="activity_about.xml" pinned="false" current-in-tab="false">
+              <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_about.xml">
+                <provider editor-type-id="android-designer2">
+                  <state />
+                </provider>
+                <provider selected="true" editor-type-id="text-editor">
+                  <state relative-caret-position="0">
+                    <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+                    <folding />
+                  </state>
+                </provider>
+              </entry>
+            </file>
+            <file leaf-file-name="activity_login.xml" pinned="false" current-in-tab="false">
+              <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_login.xml">
+                <provider selected="true" editor-type-id="android-designer2">
+                  <state />
+                </provider>
+                <provider editor-type-id="text-editor">
+                  <state relative-caret-position="555">
+                    <caret line="47" column="50" selection-start-line="47" selection-start-column="50" selection-end-line="47" selection-end-column="50" />
+                    <folding>
+                      <element signature="e#1615#1636#0" expanded="true" />
+                    </folding>
+                  </state>
+                </provider>
+              </entry>
+            </file>
+            <file leaf-file-name="ServerSettingActivity.java" pinned="false" current-in-tab="false">
+              <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ServerSettingActivity.java">
+                <provider selected="true" editor-type-id="text-editor">
+                  <state relative-caret-position="-426">
+                    <caret line="151" column="19" selection-start-line="151" selection-start-column="19" selection-end-line="151" selection-end-column="19" />
+                    <folding />
+                  </state>
+                </provider>
+              </entry>
+            </file>
+          </leaf>
+        </state>
+      </content>
+    </window>
+  </component>
+  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+  <component name="ExternalProjectsData">
+    <projectState path="$PROJECT_DIR$">
+      <ProjectState />
+    </projectState>
+  </component>
+  <component name="ExternalProjectsManager">
+    <system id="GRADLE">
+      <state>
+        <projects_view />
+      </state>
+    </system>
+  </component>
+  <component name="FavoritesManager">
+    <favorites_list name="RedAnt Photo" />
+  </component>
+  <component name="FileEditorManager">
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
+      <file leaf-file-name="AndroidManifest.xml" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/src/main/AndroidManifest.xml">
+          <provider editor-type-id="android-manifest">
+            <state />
+          </provider>
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="145">
+              <caret line="99" column="32" selection-start-line="99" selection-start-column="27" selection-end-line="99" selection-end-column="32" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="FullScreenLoginActivity.java" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="154">
+              <caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="activity_mode.xml" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_mode.xml">
+          <provider editor-type-id="android-designer2">
+            <state />
+          </provider>
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="75">
+              <caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="ModeActivity.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ModeActivity.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="135">
+              <caret line="10" column="42" selection-start-line="10" selection-start-column="42" selection-end-line="10" selection-end-column="42" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Network.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/util/Network.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="151">
+              <caret line="609" column="0" selection-start-line="609" selection-start-column="0" selection-end-line="609" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="AES.java" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/util/AES.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="246">
+              <caret line="216" column="17" selection-start-line="216" selection-start-column="17" selection-end-line="216" selection-end-column="17" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="layoutResourceFile" />
+        <option value="resourceFile" />
+        <option value="Class" />
+      </list>
+    </option>
+  </component>
+  <component name="GradleLocalSettings">
+    <option name="myGradleHomes">
+      <map>
+        <entry key="$PROJECT_DIR$" value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3" />
+      </map>
+    </option>
+    <option name="myGradleVersions">
+      <map>
+        <entry key="$PROJECT_DIR$" value="3.3" />
+      </map>
+    </option>
+    <option name="availableProjects">
+      <map>
+        <entry>
+          <key>
+            <ExternalProjectPojo>
+              <option name="name" value="RA Image" />
+              <option name="path" value="$PROJECT_DIR$" />
+            </ExternalProjectPojo>
+          </key>
+          <value>
+            <list>
+              <ExternalProjectPojo>
+                <option name="name" value="RA Image" />
+                <option name="path" value="$PROJECT_DIR$" />
+              </ExternalProjectPojo>
+              <ExternalProjectPojo>
+                <option name="name" value=":app" />
+                <option name="path" value="$PROJECT_DIR$/app" />
+              </ExternalProjectPojo>
+            </list>
+          </value>
+        </entry>
+      </map>
+    </option>
+    <option name="availableTasks">
+      <map>
+        <entry key="$PROJECT_DIR$">
+          <value>
+            <list>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the sub-projects of root project 'RA Image'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="projects" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformClassesAndResourcesWithProguardForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="validateSigningDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support.constraint:constraint-layout:1.0.2" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportConstraintConstraintLayout102Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareDebugDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processReleaseJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateReleaseAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="lintDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the configuration model of root project 'RA Image'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="model" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Creates a version of android.jar that's suitable for unit tests." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mockableAndroidJar" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:appcompat-v7:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportAppcompatV72531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the tasks runnable from root project 'RA Image' (some of the displayed tasks may belong to subprojects)." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="tasks" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Initializes a new Gradle build. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="init" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="incrementalDebugJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-media-compat:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportMediaCompat2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-vector-drawable:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportVectorDrawable2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all device checks using Device Providers and Test Servers." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="deviceCheck" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays all dependencies declared in root project 'RA Image'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="dependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on all variants." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="lint" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="packageDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project and all projects it depends on." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="buildNeeded" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAndroidTestBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugUnitTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for the release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="testReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Deletes the build cache directory." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="cleanBuildCache" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the components produced by root project 'RA Image'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="components" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all Debug builds." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugAndroidTestManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugUnitTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-core-utils:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportCoreUtils2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-v4:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportV42531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformResourcesWithMergeJavaResForReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformClassesWithDexForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preDebugAndroidTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugAndroidTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processReleaseUnitTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="javaPreCompileDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the Release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="uninstallRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAndroidTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareDebugAndroidTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="incrementalDebugAndroidTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="checkReleaseManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="javaPreCompileDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeReleaseJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareReleaseDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs instrumentation tests using all Device Providers." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="deviceAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugAndroidTestAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processReleaseManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the android (on device) tests for the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="uninstallDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the insight into a specific dependency in root project 'RA Image'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="dependencyInsight" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateReleaseSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="incrementalReleaseUnitTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preReleaseBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all variants of all applications and secondary packages." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assemble" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="incrementalDebugUnitTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="incrementalReleaseJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays a help message." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="help" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseUnitTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs the android (on device) tests for the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="installDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="javaPreCompileReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-core-ui:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportCoreUi2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="javaPreCompileRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all device checks on currently connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="connectedCheck" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs the tests for debug on connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="connectedDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstall all applications." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="uninstallAll" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all the Test applications." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="packageRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="validateSigningDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Generates Gradle wrapper files. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="wrapper" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preDebugUnitTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileLint" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAndroidTestResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeReleaseShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the Android dependencies of the project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="androidDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugUnitTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugAndroidTestJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="extractProguardFiles" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformClassesWithDexForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAndroidTestAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="jarReleaseClasses" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareReleaseUnitTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for all variants." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="test" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preReleaseUnitTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-fragment:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportFragment2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all checks." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="check" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="javaPreCompileDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-compat:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportSupportCompat2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for the debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="testDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs instrumentation tests for all flavors on connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="connectedAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="jarDebugClasses" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformClassesWithDexForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:animated-vector-drawable:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareComAndroidSupportAnimatedVectorDrawable2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="installDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformResourcesWithMergeJavaResForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseUnitTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileReleaseAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on the Release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="lintRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project and all projects that depend on it." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="buildDependents" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the dependent components of components in root project 'RA Image'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="dependentComponents" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays all buildscript dependencies declared in root project 'RA Image'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="buildEnvironment" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="checkDebugManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prints out all the source sets defined in this project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="sourceSets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeReleaseAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateReleaseBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="prepareDebugUnitTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on just the fatal issues in the release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="lintVitalRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="uninstallDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the signing info for each variant." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="signingReport" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="mergeDebugAndroidTestShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Deletes the build directory." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="clean" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="preDebugBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="build" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all Release builds." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="assembleRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="compileDebugAndroidTestRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="processDebugManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="packageDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="generateReleaseResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the properties of root project 'RA Image'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$" />
+                <option name="name" value="properties" />
+              </ExternalTaskPojo>
+            </list>
+          </value>
+        </entry>
+        <entry key="$PROJECT_DIR$/app">
+          <value>
+            <list>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the sub-projects of project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="projects" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformClassesAndResourcesWithProguardForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="validateSigningDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support.constraint:constraint-layout:1.0.2" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportConstraintConstraintLayout102Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareDebugDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processReleaseJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateReleaseAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="lintDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Creates a version of android.jar that's suitable for unit tests." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mockableAndroidJar" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the configuration model of project ':app'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="model" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:appcompat-v7:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportAppcompatV72531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the tasks runnable from project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="tasks" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="incrementalDebugJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-media-compat:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportMediaCompat2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-vector-drawable:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportVectorDrawable2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all device checks using Device Providers and Test Servers." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="deviceCheck" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays all dependencies declared in project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="dependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on all variants." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="lint" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="packageDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project and all projects it depends on." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="buildNeeded" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAndroidTestBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugUnitTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for the release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="testReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Deletes the build cache directory." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="cleanBuildCache" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the components produced by project ':app'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="components" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all Debug builds." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugAndroidTestManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugUnitTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-core-utils:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportCoreUtils2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-v4:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportV42531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformResourcesWithMergeJavaResForReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformClassesWithDexForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preDebugAndroidTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugAndroidTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processReleaseUnitTestJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="javaPreCompileDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the Release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="uninstallRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAndroidTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareDebugAndroidTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="incrementalDebugAndroidTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="checkReleaseManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="javaPreCompileDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeReleaseJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareReleaseDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs instrumentation tests using all Device Providers." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="deviceAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugAndroidTestAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processReleaseManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the android (on device) tests for the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="uninstallDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the insight into a specific dependency in project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="dependencyInsight" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateReleaseSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="incrementalReleaseUnitTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preReleaseBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all variants of all applications and secondary packages." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assemble" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="incrementalDebugUnitTestJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="incrementalReleaseJavaCompilationSafeguard" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays a help message." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="help" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseUnitTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs the android (on device) tests for the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="installDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="javaPreCompileReleaseUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-core-ui:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportCoreUi2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="javaPreCompileRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all device checks on currently connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="connectedCheck" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs the tests for debug on connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="connectedDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstall all applications." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="uninstallAll" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all the Test applications." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="packageRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="validateSigningDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preDebugUnitTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileLint" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAndroidTestResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeReleaseShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the Android dependencies of the project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="androidDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugUnitTestSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformNativeLibsWithMergeJniLibsForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugAndroidTestJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="extractProguardFiles" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformClassesWithDexForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugJavaRes" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAndroidTestAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="jarReleaseClasses" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareReleaseUnitTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for all variants." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="test" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugNdk" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preReleaseUnitTestBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-fragment:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportFragment2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs all checks." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="check" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="javaPreCompileDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:support-compat:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportSupportCompat2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Run unit tests for the debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="testDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs and runs instrumentation tests for all flavors on connected devices." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="connectedAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="jarDebugClasses" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformClassesWithDexForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prepare com.android.support:animated-vector-drawable:25.3.1" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareComAndroidSupportAnimatedVectorDrawable2531Library" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Installs the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="installDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformResourcesWithMergeJavaResForRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseSources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseUnitTestJavaWithJavac" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileReleaseAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on the Release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="lintRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project and all projects that depend on it." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="buildDependents" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the dependent components of components in project ':app'. [incubating]" />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="dependentComponents" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays all buildscript dependencies declared in project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="buildEnvironment" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="checkDebugManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugJniLibFolders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Prints out all the source sets defined in this project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="sourceSets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="transformResourcesWithMergeJavaResForDebugUnitTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeReleaseAssets" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateReleaseBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="prepareDebugUnitTestDependencies" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateReleaseResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Runs lint on just the fatal issues in the release build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="lintVitalRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Uninstalls the Debug build." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="uninstallDebug" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the signing info for each variant." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="signingReport" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestAidl" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="mergeDebugAndroidTestShaders" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Deletes the build directory." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="clean" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="preDebugBuild" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugBuildConfig" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles and tests this project." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="build" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Assembles all Release builds." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="assembleRelease" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="compileDebugAndroidTestRenderscript" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateDebugAndroidTestResources" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="processDebugManifest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="packageDebugAndroidTest" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="generateReleaseResValues" />
+              </ExternalTaskPojo>
+              <ExternalTaskPojo>
+                <option name="description" value="Displays the properties of project ':app'." />
+                <option name="linkedExternalProjectPath" value="$PROJECT_DIR$/app" />
+                <option name="name" value="properties" />
+              </ExternalTaskPojo>
+            </list>
+          </value>
+        </entry>
+      </map>
+    </option>
+    <option name="modificationStamps">
+      <map>
+        <entry key="$PROJECT_DIR$" value="4489659934000" />
+      </map>
+    </option>
+    <option name="projectBuildClasspath">
+      <map>
+        <entry key="$PROJECT_DIR$">
+          <value>
+            <ExternalProjectBuildClasspathPojo>
+              <option name="modulesBuildClasspath">
+                <map>
+                  <entry key="$PROJECT_DIR$">
+                    <value>
+                      <ExternalModuleBuildClasspathPojo>
+                        <option name="entries">
+                          <list>
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle-core/2.3.2/gradle-core-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder/2.3.2/builder-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint/25.3.2/lint-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle-api/2.3.2/gradle-api-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/databinding/compilerCommon/2.3.2/compilerCommon-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm/5.0.4/asm-5.0.4-sources.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/proguard/proguard-gradle/5.3.2/proguard-gradle-5.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder-model/2.3.2/builder-model-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder-test-api/2.3.2/builder-test-api-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/sdklib/25.3.2/sdklib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/sdk-common/25.3.2/sdk-common-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/common/25.3.2/common-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/manifest-merger/25.3.2/manifest-merger-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/ddms/ddmlib/25.3.2/ddmlib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/jack/jack-api/0.13.0/jack-api-0.13.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/jill/jill-api/0.10.0/jill-api-0.10.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/protos/25.3.2/protos-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/shared/25.3.2/shared-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/tracker/25.3.2/tracker-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint-checks/25.3.2/lint-checks-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/guava/guava/18.0/guava-18.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/databinding/baseLibrary/2.3.2/baseLibrary-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-io/commons-io/2.4/commons-io-2.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/annotations/25.3.2/annotations-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/proguard/proguard-base/5.3.2/proguard-base-5.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/layoutlib/layoutlib-api/25.3.2/layoutlib-api-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/dvlib/25.3.2/dvlib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/repository/25.3.2/repository-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint-api/25.3.2/lint-api-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/intellij/annotations/12.0/annotations-12.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/external/com-intellij/uast/162.2228.14/uast-162.2228.14.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar" />
+                          </list>
+                        </option>
+                        <option name="path" value="$PROJECT_DIR$" />
+                      </ExternalModuleBuildClasspathPojo>
+                    </value>
+                  </entry>
+                  <entry key="$PROJECT_DIR$/app">
+                    <value>
+                      <ExternalModuleBuildClasspathPojo>
+                        <option name="entries">
+                          <list>
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle-core/2.3.2/gradle-core-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder/2.3.2/builder-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint/25.3.2/lint-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/gradle-api/2.3.2/gradle-api-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/databinding/compilerCommon/2.3.2/compilerCommon-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm/5.0.4/asm-5.0.4-sources.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-commons/5.0.4/asm-commons-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/proguard/proguard-gradle/5.3.2/proguard-gradle-5.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder-model/2.3.2/builder-model-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/builder-test-api/2.3.2/builder-test-api-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/sdklib/25.3.2/sdklib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/sdk-common/25.3.2/sdk-common-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/common/25.3.2/common-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/build/manifest-merger/25.3.2/manifest-merger-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/ddms/ddmlib/25.3.2/ddmlib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/jack/jack-api/0.13.0/jack-api-0.13.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/jill/jill-api/0.10.0/jill-api-0.10.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/protos/25.3.2/protos-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/shared/25.3.2/shared-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/analytics-library/tracker/25.3.2/tracker-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint-checks/25.3.2/lint-checks-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/guava/guava/18.0/guava-18.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/databinding/baseLibrary/2.3.2/baseLibrary-2.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/antlr/antlr4/4.5.3/antlr4-4.5.3.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-io/commons-io/2.4/commons-io-2.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/annotations/25.3.2/annotations-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/proguard/proguard-base/5.3.2/proguard-base-5.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/layoutlib/layoutlib-api/25.3.2/layoutlib-api-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/dvlib/25.3.2/dvlib-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/repository/25.3.2/repository-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/lint/lint-api/25.3.2/lint-api-25.3.2.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/intellij/annotations/12.0/annotations-12.0.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/external/com-intellij/uast/162.2228.14/uast-162.2228.14.jar" />
+                            <option value="$APPLICATION_HOME_DIR$/gradle/m2repository/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar" />
+                          </list>
+                        </option>
+                        <option name="path" value="$PROJECT_DIR$/app" />
+                      </ExternalModuleBuildClasspathPojo>
+                    </value>
+                  </entry>
+                </map>
+              </option>
+              <option name="name" value="app" />
+              <option name="projectBuildClasspath">
+                <list>
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/announce" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/antlr" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/base-services" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/base-services-groovy" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/build-cache-http" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/build-comparison" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/build-init" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/cli" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/code-quality" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/composite-builds" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/core" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/dependency-management" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/diagnostics" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ear" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ide" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ide-native" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ide-play" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/installation-beacon" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/internal-android-performance-testing" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/internal-integ-testing" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/internal-performance-testing" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/internal-testing" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ivy" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/jacoco" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/javascript" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/jetty" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/jvm-services" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/language-groovy" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/language-java" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/language-jvm" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/language-native" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/language-scala" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/launcher" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/logging" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/maven" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/messaging" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/model-core" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/model-groovy" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/native" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/open-api" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/osgi" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/platform-base" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/platform-jvm" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/platform-native" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/platform-play" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/plugin-development" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/plugin-use" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/plugins" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/process-services" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/publish" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/reporting" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/resources" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/resources-http" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/resources-s3" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/resources-sftp" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/scala" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/signing" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/test-kit" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/testing-base" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/testing-jvm" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/testing-native" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/tooling-api" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/tooling-api-builders" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/ui" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/workers" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/src/wrapper" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/ant-1.9.6.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/ant-launcher-1.9.6.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-base-services-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-base-services-groovy-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-cli-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-core-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-docs-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-installation-beacon-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-jvm-services-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-launcher-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-logging-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-messaging-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-model-core-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-model-groovy-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-native-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-open-api-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-process-services-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-resources-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-script-kotlin-0.5.1.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-tooling-api-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-ui-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-version-info-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/gradle-wrapper-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/groovy-all-2.4.7.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-announce-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-antlr-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-build-cache-http-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-build-comparison-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-build-init-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-code-quality-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-composite-builds-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-dependency-management-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-diagnostics-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-ear-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-ide-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-ide-native-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-ide-play-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-ivy-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-jacoco-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-javascript-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-jetty-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-language-groovy-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-language-java-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-language-jvm-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-language-native-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-language-scala-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-maven-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-osgi-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-platform-base-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-platform-jvm-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-platform-native-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-platform-play-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-plugin-development-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-plugin-use-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-plugins-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-publish-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-reporting-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-resources-http-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-resources-s3-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-resources-sftp-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-scala-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-signing-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-test-kit-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-testing-base-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-testing-jvm-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-testing-native-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-tooling-api-builders-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/gradle-workers-3.3.jar" />
+                  <option value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/lib/plugins/ivy-2.2.0.jar" />
+                  <option value="$PROJECT_DIR$/buildSrc/src/main/java" />
+                  <option value="$PROJECT_DIR$/buildSrc/src/main/groovy" />
+                </list>
+              </option>
+            </ExternalProjectBuildClasspathPojo>
+          </value>
+        </entry>
+      </map>
+    </option>
+    <option name="externalProjectsViewState">
+      <projects_view />
+    </option>
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullscreenLoginActivity.java" />
+        <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_test.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_fullscreen_login.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/values/strings.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/BeepManager.java" />
+        <option value="$PROJECT_DIR$/app/src/main/res/drawable/round_button.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/values/styles.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/values/ios_switch.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/drawable/ic_settings_black_24dp.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/drawable/ic_settings_gray_36dp.xml" />
+        <option value="$USER_HOME$/Library/Android/sdk/platforms/android-25/optional/org.apache.http.legacy.jar!/org/apache/http/client/HttpClient.class" />
+        <option value="$PROJECT_DIR$/app/src/main/res/drawable/track_off.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/drawable/track_on.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ServerSettingActivity.java" />
+        <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_login.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_full_screen_login.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/java/AES.java" />
+        <option value="$PROJECT_DIR$/app/build.gradle" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/UploadService.java" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/util/AES.java" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/RedAntApplication.java" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/util/Network.java" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ModeActivity.java" />
+        <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_mode.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" />
+        <option value="$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectFrameBounds">
+    <option name="x" value="1440" />
+    <option name="y" value="-158" />
+    <option name="width" value="1920" />
+    <option name="height" value="1058" />
+  </component>
+  <component name="ProjectInspectionProfilesVisibleTreeState">
+    <entry key="Project Default">
+      <profile-state>
+        <expanded-state>
+          <State>
+            <id />
+          </State>
+          <State>
+            <id>Android</id>
+          </State>
+          <State>
+            <id>Android &gt; Lint &gt; Correctness</id>
+          </State>
+          <State>
+            <id>Android &gt; Lint &gt; Performance</id>
+          </State>
+          <State>
+            <id>Android &gt; Lint &gt; Security</id>
+          </State>
+          <State>
+            <id>Android &gt; Lint &gt; Usability</id>
+          </State>
+          <State>
+            <id>Class structureJava</id>
+          </State>
+          <State>
+            <id>Dependency issuesJava</id>
+          </State>
+          <State>
+            <id>General</id>
+          </State>
+          <State>
+            <id>Inheritance issuesJava</id>
+          </State>
+          <State>
+            <id>Internationalization issues</id>
+          </State>
+          <State>
+            <id>Internationalization issuesJava</id>
+          </State>
+          <State>
+            <id>Java</id>
+          </State>
+          <State>
+            <id>Java language level migration aidsJava</id>
+          </State>
+          <State>
+            <id>Javadoc issuesJava</id>
+          </State>
+          <State>
+            <id>Numeric issuesJava</id>
+          </State>
+          <State>
+            <id>Portability issuesJava</id>
+          </State>
+          <State>
+            <id>Probable bugsJava</id>
+          </State>
+        </expanded-state>
+        <selected-state>
+          <State>
+            <id>Android</id>
+          </State>
+        </selected-state>
+      </profile-state>
+    </entry>
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="AndroidView" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+      <manualOrder />
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="Scope" />
+      <pane id="PackagesPane" />
+      <pane id="Scratches" />
+      <pane id="ProjectPane" />
+      <pane id="AndroidView">
+        <subPane />
+      </pane>
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="settings.editor.selected.configurable" value="editing.templates" />
+    <property name="settings.editor.splitter.proportion" value="0.2" />
+    <property name="android.sdk.path" value="$USER_HOME$/Library/Android/sdk" />
+    <property name="device.picker.selection" value="ccff6091" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/drawable" />
+    <property name="VectorAssetImportPath" value="$PROJECT_DIR$/../.." />
+    <property name="android.project.structure.last.selected" value="app" />
+    <property name="android.project.structure.proportion" value="0.15" />
+  </component>
+  <component name="RecentsManager">
+    <key name="android.template.packageName">
+      <recent name="com.usai.redant.raimage" />
+    </key>
+    <key name="android.template.parentActivityClass">
+      <recent name="" />
+    </key>
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="$PROJECT_DIR$/app/src/main/res/drawable" />
+      <recent name="$PROJECT_DIR$/app/src/main/res/values" />
+      <recent name="$PROJECT_DIR$/app/src/main/res/values-v14" />
+    </key>
+  </component>
+  <component name="RunManager" selected="Android App.app">
+    <configuration default="true" type="AndroidJUnit" factoryName="Android JUnit">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="TEST_OBJECT" value="class" />
+      <option name="VM_PARAMETERS" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <envs />
+      <patterns />
+      <method>
+        <option name="Make" enabled="false" />
+        <option name="Android.Gradle.BeforeRunTask" enabled="true" />
+      </method>
+    </configuration>
+    <configuration default="true" type="AndroidRunConfigurationType" factoryName="Android App">
+      <module name="" />
+      <option name="DEPLOY" value="true" />
+      <option name="ARTIFACT_NAME" value="" />
+      <option name="PM_INSTALL_OPTIONS" value="" />
+      <option name="ACTIVITY_EXTRA_FLAGS" value="" />
+      <option name="MODE" value="default_activity" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="CLEAR_LOGCAT" value="true" />
+      <option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
+      <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
+      <option name="FORCE_STOP_RUNNING_APP" value="true" />
+      <option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
+      <option name="USE_LAST_SELECTED_DEVICE" value="false" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
+      <option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
+      <option name="DEBUGGER_TYPE" value="Auto" />
+      <Auto>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Auto>
+      <Hybrid>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Hybrid>
+      <Java />
+      <Native>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Native>
+      <Profilers>
+        <option name="ENABLE_ADVANCED_PROFILING" value="false" />
+        <option name="SUPPORT_LIB_ENABLED" value="true" />
+        <option name="INSTRUMENTATION_ENABLED" value="true" />
+      </Profilers>
+      <option name="DEEP_LINK" value="" />
+      <option name="ACTIVITY_CLASS" value="" />
+      <method />
+    </configuration>
+    <configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Instrumented Tests">
+      <module name="" />
+      <option name="TESTING_TYPE" value="0" />
+      <option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="PACKAGE_NAME" value="" />
+      <option name="EXTRA_OPTIONS" value="" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="CLEAR_LOGCAT" value="false" />
+      <option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
+      <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
+      <option name="FORCE_STOP_RUNNING_APP" value="true" />
+      <option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
+      <option name="USE_LAST_SELECTED_DEVICE" value="false" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
+      <option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
+      <option name="DEBUGGER_TYPE" value="Auto" />
+      <Auto>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Auto>
+      <Hybrid>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Hybrid>
+      <Java />
+      <Native>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Native>
+      <Profilers>
+        <option name="ENABLE_ADVANCED_PROFILING" value="true" />
+        <option name="SUPPORT_LIB_ENABLED" value="true" />
+        <option name="INSTRUMENTATION_ENABLED" value="true" />
+      </Profilers>
+      <method />
+    </configuration>
+    <configuration default="true" type="Application" factoryName="Application">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <module name="" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
+      <ExternalSystemSettings>
+        <option name="executionName" />
+        <option name="externalProjectPath" />
+        <option name="externalSystemIdString" value="GRADLE" />
+        <option name="scriptParameters" />
+        <option name="taskDescriptions">
+          <list />
+        </option>
+        <option name="taskNames">
+          <list />
+        </option>
+        <option name="vmOptions" />
+      </ExternalSystemSettings>
+      <method />
+    </configuration>
+    <configuration default="true" type="JarApplication" factoryName="JAR Application">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="Java Scratch" factoryName="Java Scratch">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <option name="SCRATCH_FILE_ID" value="0" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <module name="" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
+      <method />
+    </configuration>
+    <configuration default="true" type="TestNG" factoryName="TestNG">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="SUITE_NAME" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="GROUP_NAME" />
+      <option name="TEST_OBJECT" value="CLASS" />
+      <option name="VM_PARAMETERS" value="-ea" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
+      <option name="OUTPUT_DIRECTORY" />
+      <option name="ANNOTATION_TYPE" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
+      <option name="PROPERTIES_FILE" />
+      <envs />
+      <properties />
+      <listeners />
+      <method />
+    </configuration>
+    <configuration default="true" type="TestNGTestDiscovery" factoryName="TestNG Test Discovery" changeList="All">
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="SUITE_NAME" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="METHOD_NAME" />
+      <option name="GROUP_NAME" />
+      <option name="TEST_OBJECT" value="CLASS" />
+      <option name="VM_PARAMETERS" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" />
+      <option name="OUTPUT_DIRECTORY" />
+      <option name="ANNOTATION_TYPE" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="singleModule" />
+      </option>
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
+      <option name="PROPERTIES_FILE" />
+      <envs />
+      <properties />
+      <listeners />
+      <method />
+    </configuration>
+    <configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
+      <module name="app" />
+      <option name="DEPLOY" value="true" />
+      <option name="ARTIFACT_NAME" value="" />
+      <option name="PM_INSTALL_OPTIONS" value="" />
+      <option name="ACTIVITY_EXTRA_FLAGS" value="" />
+      <option name="MODE" value="specific_activity" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="CLEAR_LOGCAT" value="true" />
+      <option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
+      <option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
+      <option name="FORCE_STOP_RUNNING_APP" value="true" />
+      <option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
+      <option name="USE_LAST_SELECTED_DEVICE" value="false" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
+      <option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
+      <option name="DEBUGGER_TYPE" value="Auto" />
+      <Auto>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Auto>
+      <Hybrid>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Hybrid>
+      <Java />
+      <Native>
+        <option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
+        <option name="SHOW_STATIC_VARS" value="true" />
+        <option name="WORKING_DIR" value="" />
+        <option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
+        <option name="SHOW_OPTIMIZED_WARNING" value="true" />
+      </Native>
+      <Profilers>
+        <option name="ENABLE_ADVANCED_PROFILING" value="false" />
+        <option name="SUPPORT_LIB_ENABLED" value="true" />
+        <option name="INSTRUMENTATION_ENABLED" value="true" />
+      </Profilers>
+      <option name="DEEP_LINK" value="" />
+      <option name="ACTIVITY_CLASS" value="com.usai.redant.raimage.FullScreenLoginActivity" />
+      <method />
+    </configuration>
+    <list size="1">
+      <item index="0" class="java.lang.String" itemvalue="Android App.app" />
+    </list>
+    <configuration name="&lt;template&gt;" type="Applet" default="true" selected="false">
+      <option name="MAIN_CLASS_NAME" />
+      <option name="HTML_FILE_NAME" />
+      <option name="HTML_USED" value="false" />
+      <option name="WIDTH" value="400" />
+      <option name="HEIGHT" value="300" />
+      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+      <option name="VM_PARAMETERS" />
+    </configuration>
+    <configuration name="&lt;template&gt;" type="JUnit" default="true" selected="false">
+      <option name="MAIN_CLASS_NAME" />
+      <option name="VM_PARAMETERS" value="-ea" />
+      <option name="PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
+    </configuration>
+    <configuration name="&lt;template&gt;" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
+      <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
+    </configuration>
+  </component>
+  <component name="ShelveChangesManager" show_recycled="false">
+    <option name="remove_strategy" value="false" />
+  </component>
+  <component name="SvnConfiguration" cleanupOnStartRun="true">
+    <configuration>$USER_HOME$/.subversion</configuration>
+    <supportedVersion>125</supportedVersion>
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="c84dce3b-09ff-4e88-a0cc-545c53252476" name="Default" comment="" />
+      <created>1496373366127</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1496373366127</updated>
+    </task>
+    <servers />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="1440" y="-158" width="1920" height="1058" extended-state="6" />
+    <editor active="true" />
+    <layout>
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3280255" sideWeight="0.45793396" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
+      <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.42356688" sideWeight="0.4339723" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" x="1540" y="-58" width="1720" height="858" />
+      <window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.42356688" sideWeight="0.5660277" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3280255" sideWeight="0.4888179" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3280255" sideWeight="0.48509052" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32863188" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.185836" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3280255" sideWeight="0.47390842" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24920128" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
+      <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39915073" sideWeight="0.86155486" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+    </layout>
+  </component>
+  <component name="Vcs.Log.UiProperties">
+    <option name="RECENTLY_FILTERED_USER_GROUPS">
+      <collection />
+    </option>
+    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
+      <collection />
+    </option>
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java</url>
+          <line>87</line>
+          <properties />
+          <option name="timeStamp" value="5" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java</url>
+          <line>79</line>
+          <properties />
+          <option name="timeStamp" value="22" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java</url>
+          <line>88</line>
+          <properties />
+          <option name="timeStamp" value="23" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java</url>
+          <line>89</line>
+          <properties />
+          <option name="timeStamp" value="24" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java</url>
+          <line>91</line>
+          <properties />
+          <option name="timeStamp" value="25" />
+        </line-breakpoint>
+      </breakpoints>
+      <breakpoints-dialog>
+        <breakpoints-dialog />
+      </breakpoints-dialog>
+      <option name="time" value="26" />
+    </breakpoint-manager>
+    <watches-manager />
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_fullscreen_login.xml" />
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_scrolling.xml" />
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_test.xml" />
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/testfullActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="266">
+          <caret line="130" column="0" selection-start-line="130" selection-start-column="0" selection-end-line="133" selection-end-column="9" />
+          <folding>
+            <element signature="e#2026#2340#0" expanded="false" />
+            <element signature="e#2339#2340#0" expanded="false" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_testfull.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/values-v11/styles.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/values-v14/ios_switch.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable/switch_thumb.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/values/styles.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="259">
+          <caret line="19" column="59" selection-start-line="19" selection-start-column="59" selection-end-line="19" selection-end-column="59" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="android-dummy:///Users/ray/Documents/code_ERPSuiteAndroid/RA Image//Theme Editor">
+      <provider selected="true" editor-type-id="themeEditor">
+        <state theme-name="AppBaseTheme" module-name="app" proportion="0.67" />
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/values/ios_switch.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="30">
+          <caret line="2" column="28" selection-start-line="2" selection-start-column="28" selection-end-line="2" selection-end-column="28" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/android/app/Activity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="171">
+          <caret line="5242" column="0" selection-start-line="5242" selection-start-column="0" selection-end-line="5242" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable-hdpi/imagebutton.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="285">
+          <caret line="19" column="11" selection-start-line="19" selection-start-column="11" selection-end-line="19" selection-end-column="11" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable/ic_settings_gray_36dp.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="30">
+          <caret line="2" column="29" selection-start-line="2" selection-start-column="29" selection-end-line="2" selection-end-column="38" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/android/os/Looper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="179">
+          <caret line="135" column="0" selection-start-line="135" selection-start-column="0" selection-end-line="135" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/java/net/HttpURLConnection.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="275" column="22" selection-start-line="275" selection-start-column="22" selection-end-line="275" selection-end-column="22" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://$USER_HOME$/Library/Android/sdk/platforms/android-25/optional/org.apache.http.legacy.jar!/org/apache/http/HttpStatus.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="260">
+          <caret line="39" column="8" selection-start-line="39" selection-start-column="8" selection-end-line="39" selection-end-column="8" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://$USER_HOME$/Library/Android/sdk/platforms/android-25/optional/org.apache.http.legacy.jar!/org/apache/http/client/HttpClient.class">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="105">
+          <caret line="19" column="0" selection-start-line="19" selection-start-column="0" selection-end-line="19" selection-end-column="11" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable/track_off.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="8" column="33" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="33" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable/track_on.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="120">
+          <caret line="8" column="33" selection-start-line="8" selection-start-column="33" selection-end-line="8" selection-end-column="33" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/drawable/thumb_on.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/build.gradle">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="30">
+          <caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_full_screen_login.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="1860">
+          <caret line="124" column="15" selection-start-line="124" selection-start-column="15" selection-end-line="124" selection-end-column="15" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_login.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="555">
+          <caret line="47" column="50" selection-start-line="47" selection-start-column="50" selection-end-line="47" selection-end-column="50" />
+          <folding>
+            <element signature="e#1615#1636#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/MainActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="379">
+          <caret line="372" column="0" selection-start-line="372" selection-start-column="0" selection-end-line="372" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/UploadService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="433">
+          <caret line="147" column="26" selection-start-line="147" selection-start-column="26" selection-end-line="147" selection-end-column="26" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/util/Crypto.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="405">
+          <caret line="32" column="21" selection-start-line="32" selection-start-column="21" selection-end-line="32" selection-end-column="21" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/java/net/URLConnection.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="251">
+          <caret line="1029" column="10" selection-start-line="1029" selection-start-column="10" selection-end-line="1029" selection-end-column="10" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/java/security/SecureRandom.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-54">
+          <caret line="226" column="14" selection-start-line="226" selection-start-column="14" selection-end-line="226" selection-end-column="14" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ServerSettingActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-426">
+          <caret line="151" column="19" selection-start-line="151" selection-start-column="19" selection-end-line="151" selection-end-column="19" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/RedAntApplication.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="252">
+          <caret line="94" column="8" selection-start-line="94" selection-start-column="8" selection-end-line="94" selection-end-column="8" />
+          <folding>
+            <element signature="e#1157#1158#0" expanded="false" />
+            <element signature="e#1192#1193#0" expanded="false" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/android/content/pm/PackageInfo.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="49" column="18" selection-start-line="49" selection-start-column="18" selection-end-line="49" selection-end-column="18" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/Library/Android/sdk/sources/android-25/android/os/AsyncTask.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="332">
+          <caret line="244" column="39" selection-start-line="244" selection-start-column="39" selection-end-line="244" selection-end-column="39" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="160">
+          <caret line="36" column="18" selection-start-line="36" selection-start-column="18" selection-end-line="36" selection-end-column="18" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/build/generated/source/r/debug/android/support/v7/appcompat/R.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="184">
+          <caret line="600" column="45" selection-start-line="600" selection-start-column="45" selection-end-line="600" selection-end-column="45" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/build/generated/source/r/debug/com/usai/redant/raimage/R.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="184">
+          <caret line="2445" column="45" selection-start-line="2445" selection-start-column="45" selection-end-line="2445" selection-end-column="45" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/HttpHelper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="201">
+          <caret line="40" column="55" selection-start-line="40" selection-start-column="55" selection-end-line="40" selection-end-column="55" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/Main2Activity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="180">
+          <caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/util/AES.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="246">
+          <caret line="216" column="17" selection-start-line="216" selection-start-column="17" selection-end-line="216" selection-end-column="17" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_main1.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout-port/activity_main.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_main2.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/util/Network.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="151">
+          <caret line="609" column="0" selection-start-line="609" selection-start-column="0" selection-end-line="609" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout-land/activity_main.xml">
+      <provider selected="true" editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_mode.xml">
+      <provider editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="75">
+          <caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/ModeActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="135">
+          <caret line="10" column="42" selection-start-line="10" selection-start-column="42" selection-end-line="10" selection-end-column="42" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_about.xml">
+      <provider editor-type-id="android-designer2">
+        <state />
+      </provider>
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/AndroidManifest.xml">
+      <provider editor-type-id="android-manifest">
+        <state />
+      </provider>
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="145">
+          <caret line="99" column="32" selection-start-line="99" selection-start-column="27" selection-end-line="99" selection-end-column="32" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/AboutActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="330">
+          <caret line="33" column="16" selection-start-line="33" selection-start-column="16" selection-end-line="33" selection-end-column="16" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/LoginActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="195">
+          <caret line="187" column="33" selection-start-line="187" selection-start-column="33" selection-end-line="187" selection-end-column="33" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="154">
+          <caret line="153" column="15" selection-start-line="153" selection-start-column="15" selection-end-line="153" selection-end-column="15" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+  </component>
+  <component name="masterDetails">
+    <states>
+      <state key="ScopeChooserConfigurable.UI">
+        <settings>
+          <splitter-proportions>
+            <option name="proportions">
+              <list>
+                <option value="0.20328283" />
+              </list>
+            </option>
+          </splitter-proportions>
+        </settings>
+      </state>
+    </states>
+  </component>
+</project>

+ 19 - 0
RA Image/RA Image.iml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id="RA Image" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="java-gradle" name="Java-Gradle">
+      <configuration>
+        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
+        <option name="BUILDABLE" value="false" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 123 - 0
RA Image/app/app.iml

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android-gradle" name="Android-Gradle">
+      <configuration>
+        <option name="GRADLE_PROJECT_PATH" value=":app" />
+      </configuration>
+    </facet>
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="SELECTED_BUILD_VARIANT" value="debug" />
+        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+        <afterSyncTasks>
+          <task>generateDebugSources</task>
+        </afterSyncTasks>
+        <option name="ALLOW_USER_CONFIGURATION" value="false" />
+        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
+    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
+      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" exported="" name="core-2.3.0" level="project" />
+    <orderEntry type="library" exported="" name="constraint-layout-solver-1.0.2" level="project" />
+    <orderEntry type="library" exported="" name="httpmime-4.1.1" level="project" />
+    <orderEntry type="library" exported="" name="constraint-layout-1.0.2" level="project" />
+    <orderEntry type="library" exported="" name="support-core-ui-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="bcprov-jdk15on-157" level="project" />
+    <orderEntry type="library" exported="" name="support-v4-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-media-compat-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-annotations-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="appcompat-v7-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-vector-drawable-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-compat-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="animated-vector-drawable-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="org.apache.http.legacy-android-25" level="project" />
+  </component>
+</module>

+ 36 - 0
RA Image/app/build.gradle

@@ -0,0 +1,36 @@
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 25
+    buildToolsVersion "25.0.3"
+
+    defaultConfig {
+        applicationId "com.usai.redant.raimage"
+        minSdkVersion 14
+        targetSdkVersion 25
+        versionCode 1
+        versionName "A151123"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled true
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
+        }
+    }
+}
+
+dependencies {
+    //    compile 'com.android.support:support-v4:18.0.0'
+    compile files('libs/core-2.3.0.jar')
+    compile files('libs/httpmime-4.1.1.jar')
+    compile files('libs/bcprov-jdk15on-157.jar')
+
+    //    compile 'org.bouncycastle.bcprov-jdk15on.1.57.org.bouncycastle:bcprov-jdk15on:1.57'
+    compile 'com.android.support:appcompat-v7:25.3.1'
+    compile 'com.android.support:support-v4:25.3.1'
+    compile 'com.android.support.constraint:constraint-layout:1.0.2'
+}
+android {
+    useLibrary 'org.apache.http.legacy'
+}

BIN
RA Image/app/libs/bcprov-jdk15on-157.jar


BIN
RA Image/app/libs/core-2.3.0.jar


BIN
RA Image/app/libs/httpmime-4.1.1.jar


+ 31 - 0
RA Image/app/proguard-project.txt

@@ -0,0 +1,31 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# 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 *;
+#}
+-dontwarn android.support.v4.** 
+
+
+# Remove all Verbose/Debug logging
+-optimizations code/removal/simple,code/removal/advanced
+-dontobfuscate
+-assumenosideeffects class android.util.Log {
+    public static *** d(...);
+    public static *** v(...);
+    public static *** i(...);
+}

+ 131 - 0
RA Image/app/src/main/AndroidManifest.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.usai.redant.raimage">
+
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+
+    <application
+        android:name=".RedAntApplication"
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme">
+        <activity
+            android:name=".MainActivity"
+            android:configChanges="orientation|keyboardHidden"
+            android:label="@string/app_name"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme">
+
+            <!--
+                 <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+            -->
+        </activity>
+        <activity
+            android:name=".CaptureActivity"
+            android:clearTaskOnLaunch="true"
+            android:label="Scan"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme"
+            android:windowSoftInputMode="stateAlwaysHidden">
+
+            <!--
+                 <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+            -->
+        </activity>
+        <activity
+            android:name=".LoginActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:windowSoftInputMode="stateHidden|adjustResize">
+
+            <!--
+                <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+            -->
+        </activity>
+        <activity
+            android:name=".UploadQueueActivity"
+            android:label="Upload queue"
+            android:screenOrientation="sensorLandscape"
+            android:theme="@style/CaptureTheme" />
+        <activity
+            android:name=".PreferencesActivity"
+            android:label="@string/preferences_name"
+            android:stateNotNeeded="true" />
+        <activity
+            android:name=".PhotoPreviewActivity"
+            android:label="Photo preview"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="stateHidden|adjustResize" />
+        <activity
+            android:name=".LockerActivity"
+            android:label="@string/title_activity_locker"
+            android:screenOrientation="portrait"
+            android:windowSoftInputMode="adjustResize|stateVisible" />
+
+        <receiver android:name=".BootReceiver">
+            <intent-filter android:priority="2147483647">
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
+            </intent-filter>
+        </receiver>
+
+        <service
+            android:name=".UploadService"
+            android:label="usai upload service" />
+
+        <activity
+            android:name=".AboutActivity"
+            android:label="@string/title_activity_about"
+            android:screenOrientation="sensorLandscape" />
+        <activity
+            android:name=".LicenseActivity"
+            android:label="@string/title_activity_license"
+            android:screenOrientation="sensorLandscape" />
+        <activity
+            android:name=".ServerSettingActivity"
+            android:label="@string/title_activity_service_setting"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name=".FullScreenLoginActivity"
+            android:label="@string/title_activity_full_screen_login">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".testfullActivity"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:label="@string/title_activity_testfull"
+            android:theme="@style/FullscreenTheme" />
+        <activity android:name=".ModeActivity"
+            android:theme="@style/Base.Theme.AppCompat.Light">
+
+        </activity>
+    </application>
+
+</manifest>

+ 112 - 0
RA Image/app/src/main/java/com/usai/redant/camera/AutoFocusManager.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.hardware.Camera;
+import android.os.AsyncTask;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.usai.redant.raimage.PreferencesActivity;
+
+final class AutoFocusManager implements Camera.AutoFocusCallback {
+
+  private static final String TAG = AutoFocusManager.class.getSimpleName();
+
+  private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
+  private static final Collection<String> FOCUS_MODES_CALLING_AF;
+  static {
+    FOCUS_MODES_CALLING_AF = new ArrayList<String>(2);
+    FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_AUTO);
+    FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_MACRO);
+  }
+
+  private boolean active;
+  private final boolean useAutoFocus;
+  private final Camera camera;
+  private AsyncTask<?,?,?> outstandingTask;
+
+  AutoFocusManager(Context context, Camera camera) {
+    this.camera = camera;
+    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+    String currentFocusMode = camera.getParameters().getFocusMode();
+    useAutoFocus =
+        sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
+        FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
+    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
+    start();
+  }
+
+  @Override
+  public synchronized void onAutoFocus(boolean success, Camera theCamera) {
+    if (active) {
+      outstandingTask = new AutoFocusTask();
+      outstandingTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+    }
+  }
+
+  synchronized void start() {
+    if (useAutoFocus) {
+      active = true;
+      try {
+        camera.autoFocus(this);
+      } catch (RuntimeException re) {
+        // Have heard RuntimeException reported in Android 4.0.x+; continue?
+        Log.w(TAG, "Unexpected exception while focusing", re);
+      }
+    }
+  }
+
+  synchronized void stop() {
+    if (useAutoFocus) {
+      try {
+        camera.cancelAutoFocus();
+      } catch (RuntimeException re) {
+        // Have heard RuntimeException reported in Android 4.0.x+; continue?
+        Log.w(TAG, "Unexpected exception while cancelling focusing", re);
+      }
+    }
+    if (outstandingTask != null) {
+      outstandingTask.cancel(true);
+      outstandingTask = null;
+    }
+    active = false;
+  }
+
+  private final class AutoFocusTask extends AsyncTask<Object,Object,Object> {
+    @Override
+    protected Object doInBackground(Object... voids) {
+      try {
+        Thread.sleep(AUTO_FOCUS_INTERVAL_MS);
+      } catch (InterruptedException e) {
+        // continue
+      }
+      synchronized (AutoFocusManager.this) {
+        if (active) {
+          start();
+        }
+      }
+      return null;
+    }
+  }
+
+}

+ 307 - 0
RA Image/app/src/main/java/com/usai/redant/camera/CameraConfigurationManager.java

@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.Point;
+import android.hardware.Camera;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.Display;
+import android.view.WindowManager;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import com.usai.redant.raimage.PreferencesActivity;
+
+/**
+ * A class which deals with reading, parsing, and setting the camera parameters which are used to
+ * configure the camera hardware.
+ */
+final class CameraConfigurationManager {
+
+  private static final String TAG = "CameraConfiguration";
+
+  // This is bigger than the size of a small screen, which is still supported. The routine
+  // below will still select the default (presumably 320x240) size for these. This prevents
+  // accidental selection of very low resolution on some devices.
+  private static final int MIN_PREVIEW_PIXELS = 480 * 320; // normal screen
+  //private static final float MAX_EXPOSURE_COMPENSATION = 1.5f;
+  //private static final float MIN_EXPOSURE_COMPENSATION = 0.0f;
+  private static final double MAX_ASPECT_DISTORTION = 0.15;
+
+  private final Context context;
+  private Point screenResolution;
+  private Point cameraResolution;
+
+  CameraConfigurationManager(Context context) {
+    this.context = context;
+  }
+
+  /**
+   * Reads, one time, values from the camera that are needed by the app.
+   */
+  void initFromCameraParameters(Camera camera) {
+    Camera.Parameters parameters = camera.getParameters();
+    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+    Display display = manager.getDefaultDisplay();
+    Point theScreenResolution = new Point();
+    display.getSize(theScreenResolution);
+    screenResolution = theScreenResolution;
+    Log.i(TAG, "Screen resolution: " + screenResolution);
+    cameraResolution = findBestPreviewSizeValue(parameters, screenResolution);
+    Log.i(TAG, "Camera resolution: " + cameraResolution);
+  }
+
+  void setDesiredCameraParameters(Camera camera, boolean safeMode) {
+    Camera.Parameters parameters = camera.getParameters();
+
+    if (parameters == null) {
+      Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration.");
+      return;
+    }
+
+    Log.i(TAG, "Initial camera parameters: " + parameters.flatten());
+
+    if (safeMode) {
+      Log.w(TAG, "In camera config safe mode -- most settings will not be honored");
+    }
+
+    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+    initializeTorch(parameters, prefs, safeMode);
+
+    String focusMode = null;
+    if (prefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)) {
+      if (safeMode || prefs.getBoolean(PreferencesActivity.KEY_DISABLE_CONTINUOUS_FOCUS, false)) {
+        focusMode = findSettableValue(parameters.getSupportedFocusModes(),
+                                      Camera.Parameters.FOCUS_MODE_AUTO);
+      } else {
+        focusMode = findSettableValue(parameters.getSupportedFocusModes(),
+                                      Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,
+                                      Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO,
+                                      Camera.Parameters.FOCUS_MODE_AUTO);
+      }
+    }
+    // Maybe selected auto-focus but not available, so fall through here:
+    if (!safeMode && focusMode == null) {
+      focusMode = findSettableValue(parameters.getSupportedFocusModes(),
+                                    Camera.Parameters.FOCUS_MODE_MACRO,
+                                    Camera.Parameters.FOCUS_MODE_EDOF);
+    }
+    if (focusMode != null) {
+      parameters.setFocusMode(focusMode);
+    }
+
+    if (prefs.getBoolean(PreferencesActivity.KEY_INVERT_SCAN, false)) {
+      String colorMode = findSettableValue(parameters.getSupportedColorEffects(),
+                                           Camera.Parameters.EFFECT_NEGATIVE);
+      if (colorMode != null) {
+        parameters.setColorEffect(colorMode);
+      }
+    }
+
+    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
+    camera.setParameters(parameters);
+
+    Camera.Parameters afterParameters = camera.getParameters();
+    Camera.Size afterSize = afterParameters.getPreviewSize();
+    if (afterSize!= null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
+      Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y +
+                 ", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
+      cameraResolution.x = afterSize.width;
+      cameraResolution.y = afterSize.height;
+    }
+  }
+
+  Point getCameraResolution() {
+    return cameraResolution;
+  }
+
+  Point getScreenResolution() {
+    return screenResolution;
+  }
+
+  boolean getTorchState(Camera camera) {
+    if (camera != null) {
+      Camera.Parameters parameters = camera.getParameters();
+      if (parameters != null) {
+        String flashMode = camera.getParameters().getFlashMode();
+        return flashMode != null &&
+            (Camera.Parameters.FLASH_MODE_ON.equals(flashMode) ||
+             Camera.Parameters.FLASH_MODE_TORCH.equals(flashMode));
+      }
+    }
+    return false;
+  }
+
+  void setTorch(Camera camera, boolean newSetting) {
+    Camera.Parameters parameters = camera.getParameters();
+    doSetTorch(parameters, newSetting, false);
+    camera.setParameters(parameters);
+  }
+
+  private void initializeTorch(Camera.Parameters parameters, SharedPreferences prefs, boolean safeMode) {
+    boolean currentSetting = FrontLightMode.readPref(prefs) == FrontLightMode.ON;
+    doSetTorch(parameters, currentSetting, safeMode);
+  }
+
+  private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
+    String flashMode;
+    if (newSetting) {
+      flashMode = findSettableValue(parameters.getSupportedFlashModes(),
+                                    Camera.Parameters.FLASH_MODE_TORCH,
+                                    Camera.Parameters.FLASH_MODE_ON);
+    } else {
+      flashMode = findSettableValue(parameters.getSupportedFlashModes(),
+                                    Camera.Parameters.FLASH_MODE_OFF);
+    }
+    if (flashMode != null) {
+      parameters.setFlashMode(flashMode);
+    }
+
+    /*
+    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+    if (!prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, false)) {
+      if (!safeMode) {
+        int minExposure = parameters.getMinExposureCompensation();
+        int maxExposure = parameters.getMaxExposureCompensation();
+        if (minExposure != 0 || maxExposure != 0) {
+          float step = parameters.getExposureCompensationStep();
+          int desiredCompensation;
+          if (newSetting) {
+            // Light on; set low exposue compensation
+            desiredCompensation = Math.max((int) (MIN_EXPOSURE_COMPENSATION / step), minExposure);
+          } else {
+            // Light off; set high compensation
+            desiredCompensation = Math.min((int) (MAX_EXPOSURE_COMPENSATION / step), maxExposure);
+          }
+          Log.i(TAG, "Setting exposure compensation to " + desiredCompensation + " / " + (step * desiredCompensation));
+          parameters.setExposureCompensation(desiredCompensation);
+        } else {
+          Log.i(TAG, "Camera does not support exposure compensation");
+        }
+      }
+    }
+     */
+  }
+
+  private Point findBestPreviewSizeValue(Camera.Parameters parameters, Point screenResolution) {
+
+    List<Camera.Size> rawSupportedSizes = parameters.getSupportedPreviewSizes();
+    if (rawSupportedSizes == null) {
+      Log.w(TAG, "Device returned no supported preview sizes; using default");
+      Camera.Size defaultSize = parameters.getPreviewSize();
+      return new Point(defaultSize.width, defaultSize.height);
+    }
+
+    // Sort by size, descending
+    List<Camera.Size> supportedPreviewSizes = new ArrayList<Camera.Size>(rawSupportedSizes);
+    Collections.sort(supportedPreviewSizes, new Comparator<Camera.Size>() {
+      @Override
+      public int compare(Camera.Size a, Camera.Size b) {
+        int aPixels = a.height * a.width;
+        int bPixels = b.height * b.width;
+        if (bPixels < aPixels) {
+          return -1;
+        }
+        if (bPixels > aPixels) {
+          return 1;
+        }
+        return 0;
+      }
+    });
+
+    if (Log.isLoggable(TAG, Log.INFO)) {
+      StringBuilder previewSizesString = new StringBuilder();
+      for (Camera.Size supportedPreviewSize : supportedPreviewSizes) {
+        previewSizesString.append(supportedPreviewSize.width).append('x')
+            .append(supportedPreviewSize.height).append(' ');
+      }
+      Log.i(TAG, "Supported preview sizes: " + previewSizesString);
+    }
+
+    double screenAspectRatio = (double) screenResolution.x / (double) screenResolution.y;
+
+    // Remove sizes that are unsuitable
+    Iterator<Camera.Size> it = supportedPreviewSizes.iterator();
+    while (it.hasNext()) {
+      Camera.Size supportedPreviewSize = it.next();
+      int realWidth = supportedPreviewSize.width;
+      int realHeight = supportedPreviewSize.height;
+      if (realWidth * realHeight < MIN_PREVIEW_PIXELS) {
+        it.remove();
+        continue;
+      }
+
+      boolean isCandidatePortrait = realWidth < realHeight;
+      int maybeFlippedWidth = isCandidatePortrait ? realHeight : realWidth;
+      int maybeFlippedHeight = isCandidatePortrait ? realWidth : realHeight;
+      double aspectRatio = (double) maybeFlippedWidth / (double) maybeFlippedHeight;
+      double distortion = Math.abs(aspectRatio - screenAspectRatio);
+      if (distortion > MAX_ASPECT_DISTORTION) {
+        it.remove(); 
+        continue;
+      }
+
+      if (maybeFlippedWidth == screenResolution.x && maybeFlippedHeight == screenResolution.y) {
+        Point exactPoint = new Point(realWidth, realHeight);
+        Log.i(TAG, "Found preview size exactly matching screen size: " + exactPoint);
+        return exactPoint;
+      }
+    }
+
+    // If no exact match, use largest preview size. This was not a great idea on older devices because
+    // of the additional computation needed. We're likely to get here on newer Android 4+ devices, where
+    // the CPU is much more powerful.
+    if (!supportedPreviewSizes.isEmpty()) {
+      Camera.Size largestPreview = supportedPreviewSizes.get(0);
+      Point largestSize = new Point(largestPreview.width, largestPreview.height);
+      Log.i(TAG, "Using largest suitable preview size: " + largestSize);
+      return largestSize;
+    }
+
+    // If there is nothing at all suitable, return current preview size
+    Camera.Size defaultPreview = parameters.getPreviewSize();
+    Point defaultSize = new Point(defaultPreview.width, defaultPreview.height);
+    Log.i(TAG, "No suitable preview sizes, using default: " + defaultSize);
+    return defaultSize;
+  }
+
+  private static String findSettableValue(Collection<String> supportedValues,
+                                          String... desiredValues) {
+    Log.i(TAG, "Supported values: " + supportedValues);
+    String result = null;
+    if (supportedValues != null) {
+      for (String desiredValue : desiredValues) {
+        if (supportedValues.contains(desiredValue)) {
+          result = desiredValue;
+          break;
+        }
+      }
+    }
+    Log.i(TAG, "Settable value: " + result);
+    return result;
+  }
+
+}

+ 311 - 0
RA Image/app/src/main/java/com/usai/redant/camera/CameraManager.java

@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera;
+
+import android.content.Context;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.hardware.Camera;
+
+import android.os.Handler;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import com.google.zxing.PlanarYUVLuminanceSource;
+import com.usai.redant.camera.open.OpenCameraInterface;
+
+import java.io.IOException;
+
+/**
+ * This object wraps the Camera service object and expects to be the only one talking to it. The
+ * implementation encapsulates the steps needed to take preview-sized images, which are used for
+ * both preview and decoding.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+public final class CameraManager {
+
+  private static final String TAG = CameraManager.class.getSimpleName();
+
+  private static final int MIN_FRAME_WIDTH = 240;
+  private static final int MIN_FRAME_HEIGHT = 240;
+  private static final int MAX_FRAME_WIDTH = 1200; // = 5/8 * 1920
+  private static final int MAX_FRAME_HEIGHT = 675; // = 5/8 * 1080
+
+  private final Context context;
+  private final CameraConfigurationManager configManager;
+  private Camera camera;
+  private AutoFocusManager autoFocusManager;
+  private Rect framingRect;
+  private Rect framingRectInPreview;
+  private boolean initialized;
+  private boolean previewing;
+  private int requestedFramingRectWidth;
+  private int requestedFramingRectHeight;
+  /**
+   * Preview frames are delivered here, which we pass on to the registered handler. Make sure to
+   * clear the handler so it will only receive one message.
+   */
+  private final PreviewCallback previewCallback;
+
+  public CameraManager(Context context) {
+    this.context = context;
+    this.configManager = new CameraConfigurationManager(context);
+    previewCallback = new PreviewCallback(configManager);
+  }
+
+  /**
+   * Opens the camera driver and initializes the hardware parameters.
+   *
+   * @param holder The surface object which the camera will draw preview frames into.
+   * @throws IOException Indicates the camera driver failed to open.
+   */
+  public synchronized void openDriver(SurfaceHolder holder) throws IOException {
+    Camera theCamera = camera;
+    if (theCamera == null) {
+      theCamera = OpenCameraInterface.open();
+      if (theCamera == null) {
+        throw new IOException();
+      }
+      camera = theCamera;
+    }
+    theCamera.setPreviewDisplay(holder);
+
+    if (!initialized) {
+      initialized = true;
+      configManager.initFromCameraParameters(theCamera);
+      if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
+        setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
+        requestedFramingRectWidth = 0;
+        requestedFramingRectHeight = 0;
+      }
+    }
+
+    Camera.Parameters parameters = theCamera.getParameters();
+    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
+    try {
+      configManager.setDesiredCameraParameters(theCamera, false);
+    } catch (RuntimeException re) {
+      // Driver failed
+      Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
+      Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
+      // Reset:
+      if (parametersFlattened != null) {
+        parameters = theCamera.getParameters();
+        parameters.unflatten(parametersFlattened);
+        try {
+          theCamera.setParameters(parameters);
+          configManager.setDesiredCameraParameters(theCamera, true);
+        } catch (RuntimeException re2) {
+          // Well, darn. Give up
+          Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
+        }
+      }
+    }
+
+  }
+
+  public synchronized boolean isOpen() {
+    return camera != null;
+  }
+
+  /**
+   * Closes the camera driver if still in use.
+   */
+  public synchronized void closeDriver() {
+    if (camera != null) {
+      camera.release();
+      camera = null;
+      // Make sure to clear these each time we close the camera, so that any scanning rect
+      // requested by intent is forgotten.
+      framingRect = null;
+      framingRectInPreview = null;
+    }
+  }
+
+  /**
+   * Asks the camera hardware to begin drawing preview frames to the screen.
+   */
+  public synchronized void startPreview() {
+    Camera theCamera = camera;
+    if (theCamera != null && !previewing) {
+      theCamera.startPreview();
+      previewing = true;
+      autoFocusManager = new AutoFocusManager(context, camera);
+    }
+  }
+
+  /**
+   * Tells the camera to stop drawing preview frames.
+   */
+  public synchronized void stopPreview() {
+    if (autoFocusManager != null) {
+      autoFocusManager.stop();
+      autoFocusManager = null;
+    }
+    if (camera != null && previewing) {
+      camera.stopPreview();
+      previewCallback.setHandler(null, 0);
+      previewing = false;
+    }
+  }
+
+  /**
+   * Convenience method for {@link com.usai.test1.android.CaptureActivity}
+   */
+  public synchronized void setTorch(boolean newSetting) {
+    if (newSetting != configManager.getTorchState(camera)) {
+      if (camera != null) {
+        if (autoFocusManager != null) {
+          autoFocusManager.stop();
+        }
+        configManager.setTorch(camera, newSetting);
+        if (autoFocusManager != null) {
+          autoFocusManager.start();
+        }
+      }
+    }
+  }
+
+  /**
+   * A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
+   * in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
+   * respectively.
+   *
+   * @param handler The handler to send the message to.
+   * @param message The what field of the message to be sent.
+   */
+  public synchronized void requestPreviewFrame(Handler handler, int message) {
+    Camera theCamera = camera;
+    if (theCamera != null && previewing) {
+      previewCallback.setHandler(handler, message);
+      theCamera.setOneShotPreviewCallback(previewCallback);
+    }
+  }
+
+  /**
+   * Calculates the framing rect which the UI should draw to show the user where to place the
+   * barcode. This target helps with alignment as well as forces the user to hold the device
+   * far enough away to ensure the image will be in focus.
+   *
+   * @return The rectangle to draw on screen in window coordinates.
+   */
+  public synchronized Rect getFramingRect() {
+    if (framingRect == null) {
+      if (camera == null) {
+        return null;
+      }
+      Point screenResolution = configManager.getScreenResolution();
+      if (screenResolution == null) {
+        // Called early, before init even finished
+        return null;
+      }
+
+      int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
+      int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT);
+
+      int leftOffset = (screenResolution.x - width) / 2;
+      int topOffset = (screenResolution.y - height) / 2;
+      framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
+      Log.d(TAG, "Calculated framing rect: " + framingRect);
+    }
+    return framingRect;
+  }
+  
+  private static int findDesiredDimensionInRange(int resolution, int hardMin, int hardMax) {
+    int dim = 5 * resolution / 8; // Target 5/8 of each dimension
+    if (dim < hardMin) {
+      return hardMin;
+    }
+    if (dim > hardMax) {
+      return hardMax;
+    }
+    return dim;
+  }
+
+  /**
+   * Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
+   * not UI / screen.
+   */
+  public synchronized Rect getFramingRectInPreview() {
+    if (framingRectInPreview == null) {
+      Rect framingRect = getFramingRect();
+      if (framingRect == null) {
+        return null;
+      }
+      Rect rect = new Rect(framingRect);
+      Point cameraResolution = configManager.getCameraResolution();
+      Point screenResolution = configManager.getScreenResolution();
+      if (cameraResolution == null || screenResolution == null) {
+        // Called early, before init even finished
+        return null;
+      }
+      rect.left = rect.left * cameraResolution.x / screenResolution.x;
+      rect.right = rect.right * cameraResolution.x / screenResolution.x;
+      rect.top = rect.top * cameraResolution.y / screenResolution.y;
+      rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
+      framingRectInPreview = rect;
+    }
+    return framingRectInPreview;
+  }
+
+  /**
+   * Allows third party apps to specify the scanning rectangle dimensions, rather than determine
+   * them automatically based on screen resolution.
+   *
+   * @param width The width in pixels to scan.
+   * @param height The height in pixels to scan.
+   */
+  public synchronized void setManualFramingRect(int width, int height) {
+    if (initialized) {
+      Point screenResolution = configManager.getScreenResolution();
+      if (width > screenResolution.x) {
+        width = screenResolution.x;
+      }
+      if (height > screenResolution.y) {
+        height = screenResolution.y;
+      }
+      int leftOffset = (screenResolution.x - width) / 2;
+      int topOffset = (screenResolution.y - height) / 2;
+      framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
+      Log.d(TAG, "Calculated manual framing rect: " + framingRect);
+      framingRectInPreview = null;
+    } else {
+      requestedFramingRectWidth = width;
+      requestedFramingRectHeight = height;
+    }
+  }
+
+  /**
+   * A factory method to build the appropriate LuminanceSource object based on the format
+   * of the preview buffers, as described by Camera.Parameters.
+   *
+   * @param data A preview frame.
+   * @param width The width of the image.
+   * @param height The height of the image.
+   * @return A PlanarYUVLuminanceSource instance.
+   */
+  public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
+    Rect rect = getFramingRectInPreview();
+    if (rect == null) {
+      return null;
+    }
+    // Go ahead and assume it's YUV rather than die.
+    return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
+                                        rect.width(), rect.height(), false);
+  }
+
+}

+ 43 - 0
RA Image/app/src/main/java/com/usai/redant/camera/FrontLightMode.java

@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera;
+
+import com.usai.redant.raimage.PreferencesActivity;
+
+import android.content.SharedPreferences;
+
+/**
+ * Enumerates settings of the prefernce controlling the front light.
+ */
+public enum FrontLightMode {
+
+  /** Always on. */
+  ON,
+  /** On only when ambient light is low. */
+  AUTO,
+  /** Always off. */
+  OFF;
+
+  private static FrontLightMode parse(String modeString) {
+    return modeString == null ? OFF : valueOf(modeString);
+  }
+
+  public static FrontLightMode readPref(SharedPreferences sharedPrefs) {
+    return parse(sharedPrefs.getString(PreferencesActivity.KEY_FRONT_LIGHT_MODE, null));
+  }
+
+}

+ 56 - 0
RA Image/app/src/main/java/com/usai/redant/camera/PreviewCallback.java

@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera;
+
+import android.graphics.Point;
+import android.hardware.Camera;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+final class PreviewCallback implements Camera.PreviewCallback {
+
+  private static final String TAG = PreviewCallback.class.getSimpleName();
+
+  private final CameraConfigurationManager configManager;
+  private Handler previewHandler;
+  private int previewMessage;
+
+  PreviewCallback(CameraConfigurationManager configManager) {
+    this.configManager = configManager;
+  }
+
+  void setHandler(Handler previewHandler, int previewMessage) {
+    this.previewHandler = previewHandler;
+    this.previewMessage = previewMessage;
+  }
+
+  @Override
+  public void onPreviewFrame(byte[] data, Camera camera) {
+    Point cameraResolution = configManager.getCameraResolution();
+    Handler thePreviewHandler = previewHandler;
+    if (cameraResolution != null && thePreviewHandler != null) {
+      Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x,
+          cameraResolution.y, data);
+      message.sendToTarget();
+      previewHandler = null;
+    } else {
+      Log.d(TAG, "Got preview callback, but no handler or resolution available");
+    }
+  }
+
+}

+ 62 - 0
RA Image/app/src/main/java/com/usai/redant/camera/open/OpenCameraInterface.java

@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.camera.open;
+
+import android.hardware.Camera;
+import android.util.Log;
+
+public final class OpenCameraInterface {
+
+  private static final String TAG = OpenCameraInterface.class.getName();
+
+  private OpenCameraInterface() {
+  }
+
+  /**
+   * Opens a rear-facing camera with {@link Camera#open(int)}, if one exists, or opens camera 0.
+   */
+  public static Camera open() {
+    
+    int numCameras = Camera.getNumberOfCameras();
+    if (numCameras == 0) {
+      Log.w(TAG, "No cameras!");
+      return null;
+    }
+
+    int index = 0;
+    while (index < numCameras) {
+      Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+      Camera.getCameraInfo(index, cameraInfo);
+      if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
+        break;
+      }
+      index++;
+    }
+    
+    Camera camera;
+    if (index < numCameras) {
+      Log.i(TAG, "Opening camera #" + index);
+      camera = Camera.open(index);
+    } else {
+      Log.i(TAG, "No camera facing back; returning camera #0");
+      camera = Camera.open(0);
+    }
+
+    return camera;
+  }
+
+}

+ 74 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/AboutActivity.java

@@ -0,0 +1,74 @@
+package com.usai.redant.raimage;
+
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+
+public class AboutActivity extends Activity
+{
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_about);
+		 TextView tv_ver = (TextView) findViewById(R.id.tv_version);
+
+		 TextView zxing = (TextView) findViewById(R.id.zxing);
+		 zxing.setOnClickListener(new OnClickListener()
+		{
+			
+			@Override
+			public void onClick(View v)
+			{
+				
+				Intent intent = new Intent();
+				intent.setClass(AboutActivity.this, LicenseActivity.class);
+				startActivity(intent);
+				
+				
+			}
+		});
+		
+		try
+		{
+			
+			tv_ver.setText(getText(R.string.str_ver)
+					+ RedAntApplication.getInstance()
+							.getPackageManager()
+							.getPackageInfo("com.usai.redant.photo", 0).versionName);
+		}
+		catch (NameNotFoundException e1)
+		{
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+	}
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		// Inflate the menu; this adds items to the action bar if it is present.
+//		getMenuInflater().inflate(R.menu.about, menu);
+//		return true;
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		// Handle action bar item clicks here. The action bar will
+//		// automatically handle clicks on the Home/Up button, so long
+//		// as you specify a parent activity in AndroidManifest.xml.
+//		int id = item.getItemId();
+//		if (id == R.id.action_settings)
+//		{
+//			return true;
+//		}
+//		return super.onOptionsItemSelected(item);
+//	}
+}

+ 87 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/AmbientLightManager.java

@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import com.usai.redant.camera.CameraManager;
+import com.usai.redant.camera.FrontLightMode;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.preference.PreferenceManager;
+
+/**
+ * Detects ambient light and switches on the front light when very dark, and off again when sufficiently light.
+ *
+ * @author Sean Owen
+ * @author Nikolaus Huber
+ */
+final class AmbientLightManager implements SensorEventListener {
+
+  private static final float TOO_DARK_LUX = 45.0f;
+  private static final float BRIGHT_ENOUGH_LUX = 450.0f;
+
+  private final Context context;
+  private CameraManager cameraManager;
+  private Sensor lightSensor;
+
+  AmbientLightManager(Context context) {
+    this.context = context;
+  }
+
+  void start(CameraManager cameraManager) {
+    this.cameraManager = cameraManager;
+    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+    if (FrontLightMode.readPref(sharedPrefs) == FrontLightMode.AUTO) {
+      SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
+      lightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
+      if (lightSensor != null) {
+        sensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL);
+      }
+    }
+  }
+
+  void stop() {
+    if (lightSensor != null) {
+      SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
+      sensorManager.unregisterListener(this);
+      cameraManager = null;
+      lightSensor = null;
+    }
+  }
+
+  @Override
+  public void onSensorChanged(SensorEvent sensorEvent) {
+    float ambientLightLux = sensorEvent.values[0];
+    if (cameraManager != null) {
+      if (ambientLightLux <= TOO_DARK_LUX) {
+        cameraManager.setTorch(true);
+      } else if (ambientLightLux >= BRIGHT_ENOUGH_LUX) {
+        cameraManager.setTorch(false);
+      }
+    }
+  }
+
+  @Override
+  public void onAccuracyChanged(Sensor sensor, int accuracy) {
+    // do nothing
+  }
+
+}

+ 128 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/BeepManager.java

@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.AssetFileDescriptor;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.os.Vibrator;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Manages beeps and vibrations for {@link CaptureActivity}.
+ */
+final class BeepManager implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener {
+
+  private static final String TAG = BeepManager.class.getSimpleName();
+
+  private static final float BEEP_VOLUME = 0.10f;
+  private static final long VIBRATE_DURATION = 200L;
+
+  private final Activity activity;
+  private MediaPlayer mediaPlayer;
+  private boolean playBeep;
+  private boolean vibrate;
+
+  BeepManager(Activity activity) {
+    this.activity = activity;
+    this.mediaPlayer = null;
+    updatePrefs();
+  }
+
+  synchronized void updatePrefs() {
+    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
+    playBeep = shouldBeep(prefs, activity);
+    vibrate = prefs.getBoolean(PreferencesActivity.KEY_VIBRATE, false);
+    if (playBeep && mediaPlayer == null) {
+      // The volume on STREAM_SYSTEM is not adjustable, and users found it too loud,
+      // so we now play on the music stream.
+      activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
+      mediaPlayer = buildMediaPlayer(activity);
+    }
+  }
+
+  synchronized void playBeepSoundAndVibrate() {
+	  Log.i(TAG,"playBeep=========>"+playBeep);
+	  Log.i(TAG,"mediaPlayer=========>"+mediaPlayer==null?"null":"ok");
+	  Log.i(TAG,"vibrate=========>"+vibrate);
+    if (playBeep && mediaPlayer != null) {
+      mediaPlayer.start();
+    }
+    if (vibrate) {
+      Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
+      vibrator.vibrate(VIBRATE_DURATION);
+    }
+  }
+
+  private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
+    boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, true);
+    if (shouldPlayBeep) {
+      // See if sound settings overrides this
+      AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
+      if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
+        shouldPlayBeep = false;
+      }
+    }
+    return shouldPlayBeep;
+  }
+
+  private MediaPlayer buildMediaPlayer(Context activity) {
+    MediaPlayer mediaPlayer = new MediaPlayer();
+    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+    mediaPlayer.setOnCompletionListener(this);
+    mediaPlayer.setOnErrorListener(this);
+
+    AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
+    try {
+      mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
+      file.close();
+      mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
+      mediaPlayer.prepare();
+    } catch (IOException ioe) {
+      Log.w(TAG, ioe);
+      mediaPlayer = null;
+    }
+    return mediaPlayer;
+  }
+
+  @Override
+  public void onCompletion(MediaPlayer mp) {
+    // When the beep has finished playing, rewind to queue up another one.      
+    mp.seekTo(0);
+  }
+
+  @Override
+  public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
+    if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
+      // we are finished, so put up an appropriate error toast if required and finish
+      activity.finish();
+    } else {
+      // possibly media player error, so release and recreate
+      mp.release();
+      mediaPlayer = null;
+      updatePrefs();
+    }
+    return true;
+  }
+
+}

+ 33 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/BootReceiver.java

@@ -0,0 +1,33 @@
+package com.usai.redant.raimage;
+
+
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class BootReceiver extends BroadcastReceiver {
+
+	// Context
+	public void UnlockReceiver(Context context) {
+
+	}
+
+	@Override
+	public void onReceive(Context context, Intent intent) {
+		// TODO Auto-generated method stub
+		if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
+			
+			Intent intentservice = new Intent();
+			intentservice.setClass(context, UploadService.class);
+			if (intent.getExtras() != null)
+				intentservice.putExtras(intent.getExtras());
+			intentservice.setAction(intent.getAction());
+			context.startService(intentservice);
+			
+			
+			// Log.e("hg","�յ��㲥");
+		} 
+	}
+
+}

+ 884 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/CaptureActivity.java

@@ -0,0 +1,884 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.DecodeHintType;
+import com.google.zxing.Result;
+import com.google.zxing.ResultPoint;
+import com.google.zxing.client.result.ResultParser;
+import com.usai.redant.camera.CameraManager;
+import com.usai.util.dbgUtil;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Intent;
+//import android.content.SharedPreferences;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.TextView;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * This activity opens the camera and does the actual scanning on a background
+ * thread. It draws a viewfinder to help the user place the barcode correctly,
+ * shows feedback as the image processing is happening, and then overlays the
+ * results when a scan is successful.
+ * 
+ * @author dswitkin@google.com (Daniel Switkin)
+ * @author Sean Owen
+ */
+public final class CaptureActivity extends Activity implements
+		SurfaceHolder.Callback
+{
+
+	private static final String			TAG	= CaptureActivity.class
+													.getSimpleName();
+
+	// private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L;
+	// private static final long BULK_MODE_SCAN_DELAY_MS = 1000L;
+
+	// private static final String[] ZXING_URLS = {
+	// "http://zxing.appspot.com/scan", "zxing://scan/" };
+
+	// public static final int HISTORY_REQUEST_CODE = 0x0000bacc;
+
+	// private static final Collection<ResultMetadataType>
+	// DISPLAYABLE_METADATA_TYPES =
+	// EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
+	// ResultMetadataType.SUGGESTED_PRICE,
+	// ResultMetadataType.ERROR_CORRECTION_LEVEL,
+	// ResultMetadataType.POSSIBLE_COUNTRY);
+
+	private CameraManager				cameraManager;
+	private CaptureActivityHandler		handler;
+	private Result						savedResultToShow;
+	private ViewfinderView				viewfinderView;
+	private TextView					statusView;
+	// private View resultView;
+	private Result						lastResult;
+	private boolean						hasSurface;
+	// private boolean copyToClipboard;
+	// private IntentSource source;
+	// private String sourceUrl;
+	// private ScanFromWebPageManager scanFromWebPageManager;
+	private Collection<BarcodeFormat>	decodeFormats;
+	private Map<DecodeHintType, ?>		decodeHints;
+	private String						characterSet;
+	// private HistoryManager historyManager;
+	private InactivityTimer				inactivityTimer;
+	private BeepManager					beepManager;
+	private AmbientLightManager			ambientLightManager;
+
+
+
+	ViewfinderView getViewfinderView()
+	{
+		return viewfinderView;
+	}
+
+	public Handler getHandler()
+	{
+		return handler;
+	}
+
+	CameraManager getCameraManager()
+	{
+		return cameraManager;
+	}
+
+	Button	swith_button;
+
+	@Override
+	public void onCreate(Bundle icicle)
+	{
+		dbgUtil.Logd(TAG, "==============>CaptureActivity created!");
+
+		super.onCreate(icicle);
+
+		Window window = getWindow();
+		window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+
+		setContentView(R.layout.capture);
+
+		swith_button = (Button) findViewById(R.id.btn_switch);
+		swith_button.setTag("false");
+		swith_button.setBackgroundColor(getResources().getColor(
+				R.color.message_fail));
+		swith_button.setOnClickListener(new OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+
+				// inactivityTimer.onPause();
+
+				if (Boolean.parseBoolean(v.getTag().toString()) == false)
+				{
+					// inactivityTimer.onResume();
+					v.setTag("true");
+					v.setBackgroundColor(getResources().getColor(
+							R.color.message_success));
+				}
+				else
+				{
+
+					// inactivityTimer.onPause();
+					v.setTag("false");
+					v.setBackgroundColor(getResources().getColor(
+							R.color.message_fail));
+				}
+
+			}
+		});
+
+		// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+		hasSurface = false;
+		// historyManager = new HistoryManager(this);
+		// historyManager.trimHistory();
+		inactivityTimer = new InactivityTimer(this);
+		beepManager = new BeepManager(this);
+		ambientLightManager = new AmbientLightManager(this);
+
+		// PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+
+
+		Log.d(TAG, "finish oncreate");
+	}
+	
+	@Override
+	protected void onResume()
+	{
+		super.onResume();
+
+		// CameraManager must be initialized here, not in onCreate(). This is
+		// necessary because we don't
+		// want to open the camera driver and measure the screen size if we're
+		// going to show the help on
+		// first launch. That led to bugs where the scanning rectangle was the
+		// wrong size and partially
+		// off screen.
+		cameraManager = new CameraManager(getApplication());
+
+		viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
+		viewfinderView.setCameraManager(cameraManager);
+
+		// resultView = findViewById(R.id.result_view);
+		statusView = (TextView) findViewById(R.id.status_view);
+
+		handler = null;
+		lastResult = null;
+
+		resetStatusView();
+
+		SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
+		SurfaceHolder surfaceHolder = surfaceView.getHolder();
+		if (hasSurface)
+		{
+			// The activity was paused but not stopped, so the surface still
+			// exists. Therefore
+			// surfaceCreated() won't be called, so init the camera here.
+			initCamera(surfaceHolder);
+		}
+		else
+		{
+			// Install the callback and wait for surfaceCreated() to init the
+			// camera.
+			surfaceHolder.addCallback(this);
+		}
+
+		beepManager.updatePrefs();
+		ambientLightManager.start(cameraManager);
+
+		inactivityTimer.onResume();
+
+		Intent intent = getIntent();
+
+		// SharedPreferences prefs =
+		// PreferenceManager.getDefaultSharedPreferences(this);
+		// copyToClipboard =
+		// prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true)
+		// && (intent == null ||
+		// intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true));
+
+		// source = IntentSource.NONE;
+		decodeFormats = null;
+		characterSet = null;
+
+		if (intent != null)
+		{
+
+			String action = intent.getAction();
+			// String dataString = intent.getDataString();
+
+			if (Intents.Scan.ACTION.equals(action))
+			{
+
+				// Scan the formats the intent requested, and return the result
+				// to the calling activity.
+				// source = IntentSource.NATIVE_APP_INTENT;
+				decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
+				decodeHints = DecodeHintManager.parseDecodeHints(intent);
+
+				if (intent.hasExtra(Intents.Scan.WIDTH)
+						&& intent.hasExtra(Intents.Scan.HEIGHT))
+				{
+					int width = intent.getIntExtra(Intents.Scan.WIDTH, 0);
+					int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);
+					if (width > 0 && height > 0)
+					{
+						cameraManager.setManualFramingRect(width, height);
+					}
+				}
+
+				String customPromptMessage = intent
+						.getStringExtra(Intents.Scan.PROMPT_MESSAGE);
+				if (customPromptMessage != null)
+				{
+					statusView.setText(customPromptMessage);
+				}
+
+			}
+			// else if (dataString != null &&
+			// dataString.contains("http://www.google") &&
+			// dataString.contains("/m/products/scan")) {
+			//
+			// // Scan only products and send the result to mobile Product
+			// Search.
+			// // source = IntentSource.PRODUCT_SEARCH_LINK;
+			// sourceUrl = dataString;
+			// decodeFormats = DecodeFormatManager.PRODUCT_FORMATS;
+			//
+			// }
+			// else if (isZXingURL(dataString)) {
+			//
+			// // Scan formats requested in query string (all formats if none
+			// specified).
+			// // If a return URL is specified, send the results there.
+			// Otherwise, handle it ourselves.
+			// source = IntentSource.ZXING_LINK;
+			// sourceUrl = dataString;
+			// Uri inputUri = Uri.parse(dataString);
+			// scanFromWebPageManager = new ScanFromWebPageManager(inputUri);
+			// decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
+			// // Allow a sub-set of the hints to be specified by the caller.
+			// decodeHints = DecodeHintManager.parseDecodeHints(inputUri);
+			//
+			// }
+
+			characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
+
+		}
+	}
+
+	// private static boolean isZXingURL(String dataString) {
+	// if (dataString == null) {
+	// return false;
+	// }
+	// for (String url : ZXING_URLS) {
+	// if (dataString.startsWith(url)) {
+	// return true;
+	// }
+	// }
+	// return false;
+	// }
+
+	@Override
+	protected void onPause()
+	{
+		if (handler != null)
+		{
+			handler.quitSynchronously();
+			handler = null;
+		}
+		inactivityTimer.onPause();
+		ambientLightManager.stop();
+		cameraManager.closeDriver();
+		if (!hasSurface)
+		{
+			SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
+			SurfaceHolder surfaceHolder = surfaceView.getHolder();
+			surfaceHolder.removeCallback(this);
+		}
+		super.onPause();
+	}
+
+	@Override
+	protected void onDestroy()
+	{
+		inactivityTimer.shutdown();
+		super.onDestroy();
+	}
+
+	@Override
+	public boolean onKeyDown(int keyCode, KeyEvent event)
+	{
+		switch (keyCode)
+		{
+		// case KeyEvent.KEYCODE_BACK:
+		// if (source == IntentSource.NATIVE_APP_INTENT) {
+		// setResult(RESULT_CANCELED);
+		// finish();
+		// return true;
+		// }
+		// if ((source == IntentSource.NONE || source ==
+		// IntentSource.ZXING_LINK) && lastResult != null) {
+		// restartPreviewAfterDelay(0L);
+		// return true;
+		// }
+		// break;
+			case KeyEvent.KEYCODE_FOCUS:
+			case KeyEvent.KEYCODE_CAMERA:
+				// Handle these events so they don't launch the Camera app
+				return true;
+				// Use volume up/down to turn on light
+			case KeyEvent.KEYCODE_VOLUME_DOWN:
+				cameraManager.setTorch(false);
+				return true;
+			case KeyEvent.KEYCODE_VOLUME_UP:
+				cameraManager.setTorch(true);
+				return true;
+		}
+		return super.onKeyDown(keyCode, event);
+	}
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		MenuInflater menuInflater = getMenuInflater();
+//		menuInflater.inflate(R.menu.capture, menu);
+//		return super.onCreateOptionsMenu(menu);
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		Intent intent = new Intent(Intent.ACTION_VIEW);
+//		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+//		switch (item.getItemId())
+//		{
+//		// case R.id.menu_share:
+//		// intent.setClassName(this, ShareActivity.class.getName());
+//		// startActivity(intent);
+//		// break;
+//		// case R.id.menu_history:
+//		// intent.setClassName(this, HistoryActivity.class.getName());
+//		// startActivityForResult(intent, HISTORY_REQUEST_CODE);
+//		// break;
+//			case R.id.menu_settings:
+//				intent.setClassName(this, PreferencesActivity.class.getName());
+//				startActivity(intent);
+//				break;
+//			// case R.id.menu_help:
+//			// intent.setClassName(this, HelpActivity.class.getName());
+//			// startActivity(intent);
+//			// break;
+//			default:
+//				return super.onOptionsItemSelected(item);
+//		}
+//		return true;
+//	}
+
+	// @Override
+	// public void onActivityResult(int requestCode, int resultCode, Intent
+	// intent) {
+	// if (resultCode == RESULT_OK) {
+	// // if (requestCode == HISTORY_REQUEST_CODE)
+	// // {
+	// // int itemNumber = intent.getIntExtra(Intents.History.ITEM_NUMBER, -1);
+	// // if (itemNumber >= 0) {
+	// // HistoryItem historyItem = historyManager.buildHistoryItem(itemNumber);
+	// // decodeOrStoreSavedBitmap(null, historyItem.getResult());
+	// // }
+	// // }
+	// }
+	// }
+
+	private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result)
+	{
+		// Bitmap isn't used yet -- will be used soon
+		if (handler == null)
+		{
+			savedResultToShow = result;
+		}
+		else
+		{
+			if (result != null)
+			{
+				savedResultToShow = result;
+			}
+			if (savedResultToShow != null)
+			{
+				Message message = Message.obtain(handler,
+						R.id.decode_succeeded, savedResultToShow);
+				handler.sendMessage(message);
+			}
+			savedResultToShow = null;
+		}
+	}
+
+	@Override
+	public void surfaceCreated(SurfaceHolder holder)
+	{
+		if (holder == null)
+		{
+			Log.d(TAG,
+					"*** WARNING *** surfaceCreated() gave us a null surface!");
+		}
+		if (!hasSurface)
+		{
+			hasSurface = true;
+			initCamera(holder);
+		}
+	}
+
+	@Override
+	public void surfaceDestroyed(SurfaceHolder holder)
+	{
+		hasSurface = false;
+	}
+
+	@Override
+	public void surfaceChanged(SurfaceHolder holder, int format, int width,
+			int height)
+	{
+
+	}
+
+	/**
+	 * A valid barcode has been found, so give an indication of success and show
+	 * the results.
+	 * 
+	 * @param rawResult
+	 *            The contents of the barcode.
+	 * @param scaleFactor
+	 *            amount by which thumbnail was scaled
+	 * @param barcode
+	 *            A greyscale bitmap of the camera data which was decoded.
+	 */
+	public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor)
+	{
+		String tag = swith_button.getTag().toString();
+		if (Boolean.parseBoolean(tag) == false)
+		{
+			restartPreviewAfterDelay(0L);
+			return;
+		}
+		inactivityTimer.onActivity();
+		lastResult = rawResult;
+		TextView debugTextView = (TextView) findViewById(R.id.textView1);
+		debugTextView.setText(rawResult.getText());
+		// ResultHandler resultHandler =
+		// ResultHandlerFactory.makeResultHandler(this, rawResult);
+		Log.i(TAG, "RESULT=========>" + rawResult.getText().toString());
+		// ParsedResult result = parseResult(rawResult);
+		Log.i(TAG, "HANDLER========>"
+				+ ResultParser.parseResult(rawResult).getType().toString());
+		boolean fromLiveScan = barcode != null;
+		if (fromLiveScan)
+		{
+			// historyManager.addHistoryItem(rawResult, resultHandler);
+			// Then not from history, so beep/vibrate and we have an image to
+			// draw on
+			beepManager.playBeepSoundAndVibrate();
+			// drawResultPoints(barcode, scaleFactor, rawResult);
+		}
+
+		Intent result = new Intent();
+		result.putExtra("pid", rawResult.getText());
+		setResult(Activity.RESULT_OK, result);
+		finish();
+		// restartPreviewAfterDelay(1000l);
+		// finish();
+		//
+		// switch (source) {
+		// case NATIVE_APP_INTENT:
+		// case PRODUCT_SEARCH_LINK:
+		// handleDecodeExternally(rawResult, resultHandler, barcode);
+		// break;
+		// case ZXING_LINK:
+		// if (scanFromWebPageManager == null ||
+		// !scanFromWebPageManager.isScanFromWebPage()) {
+		// handleDecodeInternally(rawResult, resultHandler, barcode);
+		// } else {
+		// handleDecodeExternally(rawResult, resultHandler, barcode);
+		// }
+		// break;
+		// case NONE:
+		// SharedPreferences prefs =
+		// PreferenceManager.getDefaultSharedPreferences(this);
+		// if (fromLiveScan &&
+		// prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
+		// Toast.makeText(getApplicationContext(),
+		// getResources().getString(R.string.msg_bulk_mode_scanned) + " (" +
+		// rawResult.getText() + ')',
+		// Toast.LENGTH_SHORT).show();
+		// // Wait a moment or else it will scan the same barcode continuously
+		// about 3 times
+		// restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
+		// } else {
+		// handleDecodeInternally(rawResult, resultHandler, barcode);
+		// }
+		// break;
+		// }
+	}
+
+	/**
+	 * Superimpose a line for 1D or dots for 2D to highlight the key features of
+	 * the barcode.
+	 * 
+	 * @param barcode
+	 *            A bitmap of the captured image.
+	 * @param scaleFactor
+	 *            amount by which thumbnail was scaled
+	 * @param rawResult
+	 *            The decoded results which contains the points to draw.
+	 */
+	// private void drawResultPoints(Bitmap barcode, float scaleFactor,
+	// Result rawResult)
+	// {
+	// ResultPoint[] points = rawResult.getResultPoints();
+	// if (points != null && points.length > 0)
+	// {
+	// Canvas canvas = new Canvas(barcode);
+	// Paint paint = new Paint();
+	// paint.setColor(getResources().getColor(R.color.result_points));
+	// if (points.length == 2)
+	// {
+	// paint.setStrokeWidth(4.0f);
+	// drawLine(canvas, paint, points[0], points[1], scaleFactor);
+	// }
+	// else if (points.length == 4
+	// && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult
+	// .getBarcodeFormat() == BarcodeFormat.EAN_13))
+	// {
+	// // Hacky special case -- draw two lines, for the barcode and
+	// // metadata
+	// drawLine(canvas, paint, points[0], points[1], scaleFactor);
+	// drawLine(canvas, paint, points[2], points[3], scaleFactor);
+	// }
+	// else
+	// {
+	// paint.setStrokeWidth(10.0f);
+	// for (ResultPoint point : points)
+	// {
+	// if (point != null)
+	// {
+	// canvas.drawPoint(scaleFactor * point.getX(),
+	// scaleFactor * point.getY(), paint);
+	// }
+	// }
+	// }
+	// }
+	// }
+
+	private static void drawLine(Canvas canvas, Paint paint, ResultPoint a,
+			ResultPoint b, float scaleFactor)
+	{
+		if (a != null && b != null)
+		{
+			canvas.drawLine(scaleFactor * a.getX(), scaleFactor * a.getY(),
+					scaleFactor * b.getX(), scaleFactor * b.getY(), paint);
+		}
+	}
+
+	// Put up our own UI for how to handle the decoded contents.
+	// private void handleDecodeInternally(Result rawResult, ResultHandler
+	// resultHandler, Bitmap barcode) {
+	// statusView.setVisibility(View.GONE);
+	// viewfinderView.setVisibility(View.GONE);
+	// // resultView.setVisibility(View.VISIBLE);
+	// Log.i(TAG, "RESULT=========>"+rawResult.getText().toString());
+	// Log.i(TAG, "HANDLER========>"+resultHandler.getType().toString());
+
+	// ImageView barcodeImageView = (ImageView)
+	// findViewById(R.id.barcode_image_view);
+	// if (barcode == null) {
+	// barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
+	// R.drawable.ic_launcher));
+	// } else {
+	// barcodeImageView.setImageBitmap(barcode);
+	// }
+	//
+	// TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
+	// formatTextView.setText(rawResult.getBarcodeFormat().toString());
+	//
+	// TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
+	// typeTextView.setText(resultHandler.getType().toString());
+	//
+	// DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT,
+	// DateFormat.SHORT);
+	// TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
+	// timeTextView.setText(formatter.format(new
+	// Date(rawResult.getTimestamp())));
+	//
+	//
+	// TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
+	// View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
+	// metaTextView.setVisibility(View.GONE);
+	// metaTextViewLabel.setVisibility(View.GONE);
+	// Map<ResultMetadataType,Object> metadata = rawResult.getResultMetadata();
+	// if (metadata != null) {
+	// StringBuilder metadataText = new StringBuilder(20);
+	// for (Map.Entry<ResultMetadataType,Object> entry : metadata.entrySet()) {
+	// if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
+	// metadataText.append(entry.getValue()).append('\n');
+	// }
+	// }
+	// if (metadataText.length() > 0) {
+	// metadataText.setLength(metadataText.length() - 1);
+	// metaTextView.setText(metadataText);
+	// metaTextView.setVisibility(View.VISIBLE);
+	// metaTextViewLabel.setVisibility(View.VISIBLE);
+	// }
+	// }
+	//
+	// TextView contentsTextView = (TextView)
+	// findViewById(R.id.contents_text_view);
+	// CharSequence displayContents = resultHandler.getDisplayContents();
+	// contentsTextView.setText(displayContents);
+	// // Crudely scale betweeen 22 and 32 -- bigger font for shorter text
+	// int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
+	// contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);
+	//
+	// TextView supplementTextView = (TextView)
+	// findViewById(R.id.contents_supplement_text_view);
+	// supplementTextView.setText("");
+	// supplementTextView.setOnClickListener(null);
+	// // if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
+	// // PreferencesActivity.KEY_SUPPLEMENTAL, true)) {
+	// // SupplementalInfoRetriever.maybeInvokeRetrieval(supplementTextView,
+	// // resultHandler.getResult(),
+	// // historyManager,
+	// // this);
+	// // }
+	//
+	// int buttonCount = resultHandler.getButtonCount();
+	// ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
+	// buttonView.requestFocus();
+	// for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
+	// TextView button = (TextView) buttonView.getChildAt(x);
+	// if (x < buttonCount) {
+	// button.setVisibility(View.VISIBLE);
+	// button.setText(resultHandler.getButtonText(x));
+	// button.setOnClickListener(new ResultButtonListener(resultHandler, x));
+	// } else {
+	// button.setVisibility(View.GONE);
+	// }
+	// }
+	//
+	// if (copyToClipboard && !resultHandler.areContentsSecure()) {
+	// ClipboardInterface.setText(displayContents, this);
+	// }
+	// }
+
+	// // Briefly show the contents of the barcode, then handle the result
+	// outside Barcode Scanner.
+	// private void handleDecodeExternally(Result rawResult, ResultHandler
+	// resultHandler, Bitmap barcode) {
+	//
+	// if (barcode != null) {
+	// viewfinderView.drawResultBitmap(barcode);
+	// }
+	//
+	// long resultDurationMS;
+	// if (getIntent() == null) {
+	// resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS;
+	// } else {
+	// resultDurationMS =
+	// getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
+	// DEFAULT_INTENT_RESULT_DURATION_MS);
+	// }
+	//
+	// if (resultDurationMS > 0) {
+	// String rawResultString = String.valueOf(rawResult);
+	// if (rawResultString.length() > 32) {
+	// rawResultString = rawResultString.substring(0, 32) + " ...";
+	// }
+	// statusView.setText(getString(resultHandler.getDisplayTitle()) + " : " +
+	// rawResultString);
+	// }
+	//
+	// if (copyToClipboard && !resultHandler.areContentsSecure()) {
+	// CharSequence text = resultHandler.getDisplayContents();
+	// ClipboardInterface.setText(text, this);
+	// }
+	//
+	// if (source == IntentSource.NATIVE_APP_INTENT) {
+	//
+	// // Hand back whatever action they requested - this can be changed to
+	// Intents.Scan.ACTION when
+	// // the deprecated intent is retired.
+	// Intent intent = new Intent(getIntent().getAction());
+	// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+	// intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
+	// intent.putExtra(Intents.Scan.RESULT_FORMAT,
+	// rawResult.getBarcodeFormat().toString());
+	// byte[] rawBytes = rawResult.getRawBytes();
+	// if (rawBytes != null && rawBytes.length > 0) {
+	// intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
+	// }
+	// Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
+	// if (metadata != null) {
+	// if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
+	// intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
+	// metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
+	// }
+	// Number orientation = (Number)
+	// metadata.get(ResultMetadataType.ORIENTATION);
+	// if (orientation != null) {
+	// intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
+	// }
+	// String ecLevel = (String)
+	// metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
+	// if (ecLevel != null) {
+	// intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
+	// }
+	// @SuppressWarnings("unchecked")
+	// Iterable<byte[]> byteSegments = (Iterable<byte[]>)
+	// metadata.get(ResultMetadataType.BYTE_SEGMENTS);
+	// if (byteSegments != null) {
+	// int i = 0;
+	// for (byte[] byteSegment : byteSegments) {
+	// intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i,
+	// byteSegment);
+	// i++;
+	// }
+	// }
+	// }
+	// sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS);
+	//
+	// } else if (source == IntentSource.PRODUCT_SEARCH_LINK) {
+	//
+	// // Reformulate the URL which triggered us into a query, so that the
+	// request goes to the same
+	// // TLD as the scan URL.
+	// int end = sourceUrl.lastIndexOf("/scan");
+	// String replyURL = sourceUrl.substring(0, end) + "?q=" +
+	// resultHandler.getDisplayContents() + "&source=zxing";
+	// sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
+	//
+	// } else if (source == IntentSource.ZXING_LINK) {
+	//
+	// if (scanFromWebPageManager != null &&
+	// scanFromWebPageManager.isScanFromWebPage()) {
+	// String replyURL = scanFromWebPageManager.buildReplyURL(rawResult,
+	// resultHandler);
+	// sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
+	// }
+	//
+	// }
+	// }
+
+	// private void sendReplyMessage(int id, Object arg, long delayMS) {
+	// if (handler != null) {
+	// Message message = Message.obtain(handler, id, arg);
+	// if (delayMS > 0L) {
+	// handler.sendMessageDelayed(message, delayMS);
+	// } else {
+	// handler.sendMessage(message);
+	// }
+	// }
+	// }
+
+	private void initCamera(SurfaceHolder surfaceHolder)
+	{
+		if (surfaceHolder == null)
+		{
+			throw new IllegalStateException("No SurfaceHolder provided");
+		}
+		if (cameraManager.isOpen())
+		{
+			Log.w(TAG,
+					"initCamera() while already open -- late SurfaceView callback?");
+			return;
+		}
+		try
+		{
+			cameraManager.openDriver(surfaceHolder);
+			// Creating the handler starts the preview, which can also throw a
+			// RuntimeException.
+			if (handler == null)
+			{
+				handler = new CaptureActivityHandler(this, decodeFormats,
+						decodeHints, characterSet, cameraManager);
+			}
+			decodeOrStoreSavedBitmap(null, null);
+		}
+		catch (IOException ioe)
+		{
+			Log.w(TAG, ioe);
+			displayFrameworkBugMessageAndExit();
+		}
+		catch (RuntimeException e)
+		{
+			// Barcode Scanner has seen crashes in the wild of this variety:
+			// java.?lang.?RuntimeException: Fail to connect to camera service
+			Log.w(TAG, "Unexpected error initializing camera", e);
+			displayFrameworkBugMessageAndExit();
+		}
+	}
+
+	private void displayFrameworkBugMessageAndExit()
+	{
+		AlertDialog.Builder builder = new AlertDialog.Builder(this);
+		builder.setTitle(getString(R.string.app_name));
+		builder.setMessage(getString(R.string.msg_camera_framework_bug));
+		builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
+		builder.setOnCancelListener(new FinishListener(this));
+		builder.show();
+	}
+
+	public void restartPreviewAfterDelay(long delayMS)
+	{
+		if (handler != null)
+		{
+			handler.sendEmptyMessageDelayed(R.id.decode_failed, delayMS);
+		}
+		resetStatusView();
+	}
+
+	private void resetStatusView()
+	{
+		// resultView.setVisibility(View.GONE);
+		statusView.setText(R.string.msg_default_status);
+		statusView.setVisibility(View.VISIBLE);
+		viewfinderView.setVisibility(View.VISIBLE);
+		lastResult = null;
+	}
+
+	public void drawViewfinder()
+	{
+		viewfinderView.drawViewfinder();
+	}
+}

+ 169 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/CaptureActivityHandler.java

@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.content.ActivityNotFoundException;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.graphics.BitmapFactory;
+import android.provider.Browser;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.DecodeHintType;
+import com.google.zxing.Result;
+import com.usai.redant.camera.CameraManager;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * This class handles all the messaging which comprises the state machine for capture.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+public final class CaptureActivityHandler extends Handler {
+
+  private static final String TAG = CaptureActivityHandler.class.getSimpleName();
+
+  private final CaptureActivity activity;
+  private final DecodeThread decodeThread;
+  private State state;
+  private final CameraManager cameraManager;
+
+  private enum State {
+    PREVIEW,
+    SUCCESS,
+    DONE
+  }
+
+  CaptureActivityHandler(CaptureActivity activity,
+                         Collection<BarcodeFormat> decodeFormats,
+                         Map<DecodeHintType,?> baseHints,
+                         String characterSet,
+                         CameraManager cameraManager) {
+    this.activity = activity;
+    decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
+        new ViewfinderResultPointCallback(activity.getViewfinderView()));
+    decodeThread.start();
+    state = State.SUCCESS;
+
+    // Start ourselves capturing previews and decoding.
+    this.cameraManager = cameraManager;
+    cameraManager.startPreview();
+    restartPreviewAndDecode();
+  }
+
+  @Override
+  public void handleMessage(Message message) {
+    switch (message.what) {
+      case R.id.restart_preview:
+        Log.d(TAG, "Got restart preview message");
+        restartPreviewAndDecode();
+        break;
+      case R.id.decode_succeeded:
+        Log.d(TAG, "Got decode succeeded message");
+        state = State.SUCCESS;
+        Bundle bundle = message.getData();
+        Bitmap barcode = null;
+        float scaleFactor = 1.0f;
+        if (bundle != null) {
+          byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
+          if (compressedBitmap != null) {
+            barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
+            // Mutable copy:
+            barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
+          }
+          scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);          
+        }
+        activity.handleDecode((Result) message.obj, barcode, scaleFactor);
+        break;
+      case R.id.decode_failed:
+        // We're decoding as fast as possible, so when one decode fails, start another.
+        state = State.PREVIEW;
+        cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
+        break;
+      case R.id.return_scan_result:
+        Log.d(TAG, "Got return scan result message");
+        activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
+        activity.finish();
+        break;
+      case R.id.launch_product_query:
+        Log.d(TAG, "Got product query message");
+        String url = (String) message.obj;
+
+        Intent intent = new Intent(Intent.ACTION_VIEW);
+        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+        intent.setData(Uri.parse(url));
+
+        ResolveInfo resolveInfo =
+            activity.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
+        String browserPackageName = null;
+        if (resolveInfo != null && resolveInfo.activityInfo != null) {
+          browserPackageName = resolveInfo.activityInfo.packageName;
+          Log.d(TAG, "Using browser in package " + browserPackageName);
+        }
+
+        // Needed for default Android browser / Chrome only apparently
+        if ("com.android.browser".equals(browserPackageName) || "com.android.chrome".equals(browserPackageName)) {
+          intent.setPackage(browserPackageName);
+          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+          intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
+        }
+
+        try {
+          activity.startActivity(intent);
+        } catch (ActivityNotFoundException ignored) {
+          Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
+        }
+        break;
+    }
+  }
+
+  public void quitSynchronously() {
+    state = State.DONE;
+    cameraManager.stopPreview();
+    Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
+    quit.sendToTarget();
+    try {
+      // Wait at most half a second; should be enough time, and onPause() will timeout quickly
+      decodeThread.join(500L);
+    } catch (InterruptedException e) {
+      // continue
+    }
+
+    // Be absolutely sure we don't send any queued up messages
+    removeMessages(R.id.decode_succeeded);
+    removeMessages(R.id.decode_failed);
+  }
+
+  private void restartPreviewAndDecode() {
+    if (state == State.SUCCESS) {
+      state = State.PREVIEW;
+      cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
+      activity.drawViewfinder();
+    }
+  }
+
+}

+ 101 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/DecodeFormatManager.java

@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import android.content.Intent;
+import android.net.Uri;
+import com.google.zxing.BarcodeFormat;
+
+final class DecodeFormatManager {
+
+  private static final Pattern COMMA_PATTERN = Pattern.compile(",");
+
+  static final Collection<BarcodeFormat> PRODUCT_FORMATS;
+  static final Collection<BarcodeFormat> ONE_D_FORMATS;
+  static final Collection<BarcodeFormat> QR_CODE_FORMATS = EnumSet.of(BarcodeFormat.QR_CODE);
+  static final Collection<BarcodeFormat> DATA_MATRIX_FORMATS = EnumSet.of(BarcodeFormat.DATA_MATRIX);
+  static {
+    PRODUCT_FORMATS = EnumSet.of(BarcodeFormat.UPC_A,
+                                 BarcodeFormat.UPC_E,
+                                 BarcodeFormat.EAN_13,
+                                 BarcodeFormat.EAN_8,
+                                 BarcodeFormat.RSS_14,
+                                 BarcodeFormat.RSS_EXPANDED);
+    ONE_D_FORMATS = EnumSet.of(BarcodeFormat.CODE_39,
+                               BarcodeFormat.CODE_93,
+                               BarcodeFormat.CODE_128,
+                               BarcodeFormat.ITF,
+                               BarcodeFormat.CODABAR);
+    ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
+  }
+
+  private DecodeFormatManager() {}
+
+  static Collection<BarcodeFormat> parseDecodeFormats(Intent intent) {
+    Iterable<String> scanFormats = null;
+    CharSequence scanFormatsString = intent.getStringExtra(Intents.Scan.FORMATS);
+    if (scanFormatsString != null) {
+      scanFormats = Arrays.asList(COMMA_PATTERN.split(scanFormatsString));
+    }
+    return parseDecodeFormats(scanFormats, intent.getStringExtra(Intents.Scan.MODE));
+  }
+
+  static Collection<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
+    List<String> formats = inputUri.getQueryParameters(Intents.Scan.FORMATS);
+    if (formats != null && formats.size() == 1 && formats.get(0) != null){
+      formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
+    }
+    return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
+  }
+
+  private static Collection<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats,
+                                                              String decodeMode) {
+    if (scanFormats != null) {
+      Collection<BarcodeFormat> formats = EnumSet.noneOf(BarcodeFormat.class);
+      try {
+        for (String format : scanFormats) {
+          formats.add(BarcodeFormat.valueOf(format));
+        }
+        return formats;
+      } catch (IllegalArgumentException iae) {
+        // ignore it then
+      }
+    }
+    if (decodeMode != null) {
+      if (Intents.Scan.PRODUCT_MODE.equals(decodeMode)) {
+        return PRODUCT_FORMATS;
+      }
+      if (Intents.Scan.QR_CODE_MODE.equals(decodeMode)) {
+        return QR_CODE_FORMATS;
+      }
+      if (Intents.Scan.DATA_MATRIX_MODE.equals(decodeMode)) {
+        return DATA_MATRIX_FORMATS;
+      }
+      if (Intents.Scan.ONE_D_MODE.equals(decodeMode)) {
+        return ONE_D_FORMATS;
+      }
+    }
+    return null;
+  }
+
+}

+ 121 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/DecodeHandler.java

@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.graphics.Bitmap;
+
+import com.google.zxing.BinaryBitmap;
+import com.google.zxing.DecodeHintType;
+import com.google.zxing.MultiFormatReader;
+import com.google.zxing.PlanarYUVLuminanceSource;
+import com.google.zxing.ReaderException;
+import com.google.zxing.Result;
+import com.google.zxing.common.HybridBinarizer;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.util.Log;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Map;
+
+final class DecodeHandler extends Handler {
+
+  private static final String TAG = DecodeHandler.class.getSimpleName();
+
+  private final CaptureActivity activity;
+  private final MultiFormatReader multiFormatReader;
+  private boolean running = true;
+
+  DecodeHandler(CaptureActivity activity, Map<DecodeHintType,Object> hints) {
+    multiFormatReader = new MultiFormatReader();
+    multiFormatReader.setHints(hints);
+    this.activity = activity;
+  }
+
+  @Override
+  public void handleMessage(Message message) {
+    if (!running) {
+      return;
+    }
+    switch (message.what) {
+      case R.id.decode:
+        decode((byte[]) message.obj, message.arg1, message.arg2);
+        break;
+      case R.id.quit:
+        running = false;
+        Looper.myLooper().quit();
+        break;
+    }
+  }
+
+  /**
+   * Decode the data within the viewfinder rectangle, and time how long it took. For efficiency,
+   * reuse the same reader objects from one decode to the next.
+   *
+   * @param data   The YUV preview frame.
+   * @param width  The width of the preview frame.
+   * @param height The height of the preview frame.
+   */
+  private void decode(byte[] data, int width, int height) {
+    long start = System.currentTimeMillis();
+    Result rawResult = null;
+    PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height);
+    if (source != null) {
+      BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
+      try {
+        rawResult = multiFormatReader.decodeWithState(bitmap);
+      } catch (ReaderException re) {
+        // continue
+      } finally {
+        multiFormatReader.reset();
+      }
+    }
+
+    Handler handler = activity.getHandler();
+    if (rawResult != null) {
+      // Don't log the barcode contents for security.
+      long end = System.currentTimeMillis();
+      Log.d(TAG, "Found barcode in " + (end - start) + " ms");
+      if (handler != null) {
+        Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult);
+        Bundle bundle = new Bundle();
+        bundleThumbnail(source, bundle);        
+        message.setData(bundle);
+        message.sendToTarget();
+      }
+    } else {
+      if (handler != null) {
+        Message message = Message.obtain(handler, R.id.decode_failed);
+        message.sendToTarget();
+      }
+    }
+  }
+
+  private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
+    int[] pixels = source.renderThumbnail();
+    int width = source.getThumbnailWidth();
+    int height = source.getThumbnailHeight();
+    Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
+    ByteArrayOutputStream out = new ByteArrayOutputStream();    
+    bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
+    bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
+    bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
+  }
+
+}

+ 236 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/DecodeHintManager.java

@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2013 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.google.zxing.DecodeHintType;
+
+/**
+ * @author Lachezar Dobrev
+ */
+final class DecodeHintManager {
+  
+  private static final String TAG = DecodeHintManager.class.getSimpleName();
+
+  // This pattern is used in decoding integer arrays.
+  private static final Pattern COMMA = Pattern.compile(",");
+
+  private DecodeHintManager() {}
+
+  /**
+   * <p>Split a query string into a list of name-value pairs.</p>
+   * 
+   * <p>This is an alternative to the {@link Uri#getQueryParameterNames()} and
+   * {@link Uri#getQueryParameters(String)}, which are quirky and not suitable
+   * for exist-only Uri parameters.</p>
+   * 
+   * <p>This method ignores multiple parameters with the same name and returns the
+   * first one only. This is technically incorrect, but should be acceptable due
+   * to the method of processing Hints: no multiple values for a hint.</p>
+   * 
+   * @param query query to split
+   * @return name-value pairs
+   */
+  private static Map<String,String> splitQuery(String query) {
+    Map<String,String> map = new HashMap<String,String>();
+    int pos = 0;
+    while (pos < query.length()) {
+      if (query.charAt(pos) == '&') {
+        // Skip consecutive ampersand separators.
+        pos ++;
+        continue;
+      }
+      int amp = query.indexOf('&', pos);
+      int equ = query.indexOf('=', pos);
+      if (amp < 0) {
+        // This is the last element in the query, no more ampersand elements.
+        String name;
+        String text;
+        if (equ < 0) {
+          // No equal sign
+          name = query.substring(pos);
+          name = name.replace('+', ' '); // Preemptively decode +
+          name = Uri.decode(name);
+          text = "";
+        } else {
+          // Split name and text.
+          name = query.substring(pos, equ);
+          name = name.replace('+', ' '); // Preemptively decode +
+          name = Uri.decode(name);
+          text = query.substring(equ + 1);
+          text = text.replace('+', ' '); // Preemptively decode +
+          text = Uri.decode(text);
+        }
+        if (!map.containsKey(name)) {
+          map.put(name, text);
+        }
+        break;
+      }
+      if (equ < 0 || equ > amp) {
+        // No equal sign until the &: this is a simple parameter with no value.
+        String name = query.substring(pos, amp);
+        name = name.replace('+', ' '); // Preemptively decode +
+        name = Uri.decode(name);
+        if (!map.containsKey(name)) {
+          map.put(name, "");
+        }
+        pos = amp + 1;
+        continue;
+      }
+      String name = query.substring(pos, equ);
+      name = name.replace('+', ' '); // Preemptively decode +
+      name = Uri.decode(name);
+      String text = query.substring(equ+1, amp);
+      text = text.replace('+', ' '); // Preemptively decode +
+      text = Uri.decode(text);
+      if (!map.containsKey(name)) {
+        map.put(name, text);
+      }
+      pos = amp + 1;
+    }
+    return map;
+  }
+
+  static Map<DecodeHintType,?> parseDecodeHints(Uri inputUri) {
+    String query = inputUri.getEncodedQuery();
+    if (query == null || query.isEmpty()) {
+      return null;
+    }
+
+    // Extract parameters
+    Map<String, String> parameters = splitQuery(query);
+
+    Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
+
+    for (DecodeHintType hintType: DecodeHintType.values()) {
+
+      if (hintType == DecodeHintType.CHARACTER_SET ||
+          hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
+          hintType == DecodeHintType.POSSIBLE_FORMATS) {
+        continue; // This hint is specified in another way
+      }
+
+      String parameterName = hintType.name();
+      String parameterText = parameters.get(parameterName);
+      if (parameterText == null) {
+        continue;
+      }
+      if (hintType.getValueType().equals(Object.class)) {
+        // This is an unspecified type of hint content. Use the value as is.
+        // TODO: Can we make a different assumption on this?
+        hints.put(hintType, parameterText);
+        continue;
+      }
+      if (hintType.getValueType().equals(Void.class)) {
+        // Void hints are just flags: use the constant specified by DecodeHintType
+        hints.put(hintType, Boolean.TRUE);
+        continue;
+      }
+      if (hintType.getValueType().equals(String.class)) {
+        // A string hint: use the decoded value.
+        hints.put(hintType, parameterText);
+        continue;
+      }
+      if (hintType.getValueType().equals(Boolean.class)) {
+        // A boolean hint: a few values for false, everything else is true.
+        // An empty parameter is simply a flag-style parameter, assuming true
+        if (parameterText.isEmpty()) {
+          hints.put(hintType, Boolean.TRUE);
+        } else if ("0".equals(parameterText) || 
+                   "false".equalsIgnoreCase(parameterText) || 
+                   "no".equalsIgnoreCase(parameterText)) {
+          hints.put(hintType, Boolean.FALSE);
+        } else {
+          hints.put(hintType, Boolean.TRUE);
+        }
+
+        continue;
+      }
+      if (hintType.getValueType().equals(int[].class)) {
+        // An integer array. Used to specify valid lengths.
+        // Strip a trailing comma as in Java style array initialisers.
+        if (!parameterText.isEmpty() && parameterText.charAt(parameterText.length() - 1) == ',') {
+          parameterText = parameterText.substring(0, parameterText.length() - 1);
+        }
+        String[] values = COMMA.split(parameterText);
+        int[] array = new int[values.length];
+        for (int i = 0; i < values.length; i++) {
+          try {
+            array[i] = Integer.parseInt(values[i]);
+          } catch (NumberFormatException ignored) {
+            Log.w(TAG, "Skipping array of integers hint " + hintType + " due to invalid numeric value: '" + values[i] + '\'');
+            array = null;
+            break;
+          }
+        }
+        if (array != null) {
+          hints.put(hintType, array);
+        }
+        continue;
+      } 
+      Log.w(TAG, "Unsupported hint type '" + hintType + "' of type " + hintType.getValueType());
+    }
+
+    Log.i(TAG, "Hints from the URI: " + hints);
+    return hints;
+  }
+
+  static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
+    Bundle extras = intent.getExtras();
+    if (extras == null || extras.isEmpty()) {
+      return null;
+    }
+    Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
+
+    for (DecodeHintType hintType: DecodeHintType.values()) {
+
+      if (hintType == DecodeHintType.CHARACTER_SET ||
+          hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
+          hintType == DecodeHintType.POSSIBLE_FORMATS) {
+        continue; // This hint is specified in another way
+      }
+
+      String hintName = hintType.name();
+      if (extras.containsKey(hintName)) {
+        if (hintType.getValueType().equals(Void.class)) {
+          // Void hints are just flags: use the constant specified by the DecodeHintType
+          hints.put(hintType, Boolean.TRUE);
+        } else {
+          Object hintData = extras.get(hintName);
+          if (hintType.getValueType().isInstance(hintData)) {
+            hints.put(hintType, hintData);
+          } else {
+            Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
+          }
+        }
+      }
+    }
+
+    Log.i(TAG, "Hints from the Intent: " + hints);
+    return hints;
+  }
+
+}

+ 104 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/DecodeThread.java

@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.DecodeHintType;
+import com.google.zxing.ResultPointCallback;
+
+import android.content.SharedPreferences;
+import android.os.Handler;
+import android.os.Looper;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * This thread does all the heavy lifting of decoding the images.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+final class DecodeThread extends Thread {
+
+  public static final String BARCODE_BITMAP = "barcode_bitmap";
+  public static final String BARCODE_SCALED_FACTOR = "barcode_scaled_factor";
+
+  private final CaptureActivity activity;
+  private final Map<DecodeHintType,Object> hints;
+  private Handler handler;
+  private final CountDownLatch handlerInitLatch;
+
+  DecodeThread(CaptureActivity activity,
+               Collection<BarcodeFormat> decodeFormats,
+               Map<DecodeHintType,?> baseHints,
+               String characterSet,
+               ResultPointCallback resultPointCallback) {
+
+    this.activity = activity;
+    handlerInitLatch = new CountDownLatch(1);
+
+    hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
+    if (baseHints != null) {
+      hints.putAll(baseHints);
+    }
+
+    // The prefs can't change while the thread is running, so pick them up once here.
+    if (decodeFormats == null || decodeFormats.isEmpty()) {
+      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
+      decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
+      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D, false)) {
+        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
+      }
+      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, false)) {
+        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
+      }
+      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, false)) {
+        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
+      }
+    }
+    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
+
+    if (characterSet != null) {
+      hints.put(DecodeHintType.CHARACTER_SET, characterSet);
+    }
+    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
+    Log.i("DecodeThread", "Hints: " + hints);
+  }
+
+  Handler getHandler() {
+    try {
+      handlerInitLatch.await();
+    } catch (InterruptedException ie) {
+      // continue?
+    }
+    return handler;
+  }
+
+  @Override
+  public void run() {
+    Looper.prepare();
+    handler = new DecodeHandler(activity, hints);
+    handlerInitLatch.countDown();
+    Looper.loop();
+  }
+
+}

+ 49 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/FinishListener.java

@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.app.Activity;
+import android.content.DialogInterface;
+
+/**
+ * Simple listener used to exit the app in a few cases.
+ *
+ * @author Sean Owen
+ */
+public final class FinishListener implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
+
+  private final Activity activityToFinish;
+
+  public FinishListener(Activity activityToFinish) {
+    this.activityToFinish = activityToFinish;
+  }
+
+  @Override
+  public void onCancel(DialogInterface dialogInterface) {
+    run();
+  }
+
+  @Override
+  public void onClick(DialogInterface dialogInterface, int i) {
+    run();
+  }
+
+  private void run() {
+    activityToFinish.finish();
+  }
+
+}

+ 533 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java

@@ -0,0 +1,533 @@
+package com.usai.redant.raimage;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.annotation.TargetApi;
+import android.app.ActionBar;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.app.Activity;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.Switch;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.usai.util.AES;
+import com.usai.util.Crypto;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class FullScreenLoginActivity extends Activity {
+
+
+    private UserLoginTask			mAuthTask	= null;
+//    ArrayAdapter<String> adapter		= null;
+
+    // Values for email and password at the time of the login attempt.
+    private String					m_sName;
+    private String					m_sPassword;
+
+    // UI references.
+    private EditText	m_etName;
+    private EditText m_etPassword;
+    private EditText	m_etServer;
+//    private View					mLoginFormView;
+    private View					mLoginStatusView;
+    private TextView				mLoginStatusMessageView;
+    private Switch m_swSave;
+    /**
+     * Represents an asynchronous login/registration task used to authenticate
+     * the user.
+     */
+    public class UserLoginTask extends AsyncTask<Void, Void, Boolean>
+    {
+        // int err_code = ERR_CODE_NONE;
+        JSONObject json	= null;
+
+        // int netconnect;
+
+        @Override
+        protected Boolean doInBackground(Void... params)
+        {
+
+            json = Network.Login(m_sName, m_sPassword);
+            try {
+                if (json.getInt("result") == Network.RESULT_TRUE)
+                    return true;
+                else
+                    return false;
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+
+        @Override
+        protected void onPostExecute(final Boolean success)
+        {
+            Log.i("onPostExecute", "entry");
+            mAuthTask = null;
+            showProgress(false);
+
+            if (success)
+            {
+                String encryptUser = "";
+                String encryptPass = "";
+                try
+                {
+                    encryptUser = AES.encrypt("usai2010", m_sName);
+                    encryptPass = AES.encrypt("usai2010", m_sPassword);
+                }
+                catch (Exception e1)
+                {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                }
+
+                /*SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this, null,
+                        true);
+                Cursor cursor = db.query("users", new String[] { "_id" },
+                        "name='" + encryptUser + "'", null, null, null, "_id",
+                        null);
+                if (cursor.moveToNext())
+                {
+                    int _id = cursor.getInt(0);
+                    String sql = "update users set pass='" + encryptPass
+                            + "' where _id=" + _id;
+                    db.execSQL(sql);
+                }
+                else
+                {
+                    String sql = "insert into users(name,pass) values('"
+                            + encryptUser + "','" + encryptPass + "')";
+                    db.execSQL(sql);
+                }
+                dbUtil.CloseCursor(cursor);
+                dbUtil.CloseDB(db);*/
+
+                SharedPreferences pref = RedAntApplication.getInstance()
+                        .getSharedPreferences("RA Image", 0);
+                SharedPreferences.Editor editor = pref.edit();
+
+                if (m_swSave.isChecked()&&!TextUtils.isEmpty(encryptPass)&&!TextUtils.isEmpty(encryptUser))
+                {
+                    editor.putString("user", encryptUser);
+                    editor.putString("password", encryptPass);
+                    editor.putBoolean("kepppass", true);
+                }
+                else
+                {
+                    editor.putString("user", null);
+                    editor.putString("password", null);
+                    editor.putBoolean("kepppass", false);
+                }
+
+                editor.commit();
+
+                RedAntApplication.user = m_sName;
+                RedAntApplication.password = m_sPassword;
+                Intent intent = new Intent();
+                intent.setClass(FullScreenLoginActivity.this, ModeActivity.class);
+
+                dbgUtil.fileLog("user "+m_sName+" login @server "+RedAntApplication.active_address);
+                startActivity(intent);
+                finish();
+            }
+            else
+            {
+                int result = 0;
+                try {
+                    result = json.getInt("result");
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    result = Network.RESULT_NET_ERROR;
+
+                }
+                switch (result)
+                {
+                    case Network.RESULT_NET_ERROR:
+                    case Network.RESULT_NET_NOTAVAILABLE:
+                    {
+                       /* SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this,
+                                null, true);
+
+                        String encryptUser = "";
+                        try
+                        {
+                            encryptUser = Crypto.encrypt("apexu", m_sName);
+                        }
+                        catch (Exception e1)
+                        {
+                            // TODO Auto-generated catch block
+                            e1.printStackTrace();
+                        }
+                        Cursor cursor = db.query("users", new String[] {
+                                        "pass", "_id" }, "name= '" + encryptUser + "'",
+                                null, null, null, "_id desc", null);
+                        if (cursor.moveToNext())
+                        {
+                            String pass = "";
+                            try
+                            {
+                                pass = Crypto.decrypt("apexp",
+                                        cursor.getString(0));
+                            }
+                            catch (Exception e)
+                            {
+                                // TODO Auto-generated catch block
+                                e.printStackTrace();
+                            }
+                            if (pass.equals(m_sPassword))
+                            {
+                                dbUtil.CloseCursor(cursor);
+                                dbUtil.CloseDB(db);
+                                RedAntApplication.user = m_sName;
+                                RedAntApplication.password = m_sPassword;
+                                Intent intent = new Intent();
+                                intent.setClass(LoginActivity.this,
+                                        MainActivity.class);
+                                dbgUtil.fileLog("user "+m_sName+" offline access @server "+RedAntApplication.active_address);
+                                startActivity(intent);
+                                finish();
+                            }
+                            else
+                            {
+                                // wrong password
+                                Toast toast = Toast.makeText(
+                                        getApplicationContext(),
+                                        getText(R.string.msg_user_wrong),
+                                        Toast.LENGTH_LONG);
+                                toast.setGravity(Gravity.CENTER, 0, 0);
+                                toast.show();
+                                m_etPassword
+                                        .setError(getString(R.string.error_incorrect_password));
+                                m_etPassword.requestFocus();
+                                dbUtil.CloseCursor(cursor);
+                                dbUtil.CloseDB(db);
+                            }
+                        }
+                        else*/
+                        {// user not exist
+                            Toast toast = Toast.makeText(
+                                    getApplicationContext(),
+                                    getText(R.string.msg_net_error),
+                                    Toast.LENGTH_LONG);
+                            toast.setGravity(Gravity.CENTER, 0, 0);
+                            toast.show();
+                            m_etPassword
+                                    .setError(null);
+                            m_etPassword.requestFocus();
+                          /*  dbUtil.CloseCursor(cursor);
+                            dbUtil.CloseDB(db);*/
+
+                        }
+
+                        break;
+                    }
+                    // case Network.RESULT_NET_ERROR:
+                    // {
+                    // Toast toast = Toast.makeText(getApplicationContext(),
+                    // getText(R.string.msg_net_error),
+                    // Toast.LENGTH_LONG);
+                    // toast.setGravity(Gravity.CENTER, 0, 0);
+                    // toast.show();
+                    // return;
+                    // }
+                    case Network.RESULT_FALSE:
+                    {
+                        Toast toast = Toast.makeText(getApplicationContext(),
+                                getText(R.string.msg_user_wrong),
+                                Toast.LENGTH_LONG);
+                        toast.setGravity(Gravity.CENTER, 0, 0);
+                        toast.show();
+                        m_etPassword
+                                .setError(getString(R.string.error_incorrect_password));
+                        m_etPassword.requestFocus();
+                        return;
+                    }
+
+                    default:
+                        break;
+                }
+
+            }
+        }
+
+        @Override
+        protected void onCancelled()
+        {
+            mAuthTask = null;
+            showProgress(false);
+        }
+    }
+
+
+    /**
+     * Shows the progress UI and hides the login form.
+     */
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+    private void showProgress(final boolean show)
+    {
+        // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
+        // for very easy animations. If available, use these APIs to fade-in
+        // the progress spinner.
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
+        {
+            int shortAnimTime = getResources().getInteger(
+                    android.R.integer.config_shortAnimTime);
+
+            mLoginStatusView.setVisibility(View.VISIBLE);
+            mLoginStatusView.animate().setDuration(shortAnimTime)
+                    .alpha(show ? 1 : 0)
+                    .setListener(new AnimatorListenerAdapter()
+                    {
+                        @Override
+                        public void onAnimationEnd(Animator animation)
+                        {
+                            mLoginStatusView.setVisibility(show ? View.VISIBLE
+                                    : View.GONE);
+                        }
+                    });
+
+//            mLoginFormView.setVisibility(View.VISIBLE);
+//            mLoginFormView.animate().setDuration(shortAnimTime)
+//                    .alpha(show ? 0 : 1)
+//                    .setListener(new AnimatorListenerAdapter()
+//                    {
+//                        @Override
+//                        public void onAnimationEnd(Animator animation)
+//                        {
+//                            mLoginFormView.setVisibility(show ? View.GONE
+//                                    : View.VISIBLE);
+//                        }
+//                    });
+        }
+        else
+        {
+            // The ViewPropertyAnimator APIs are not available, so simply show
+            // and hide the relevant UI components.
+            mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
+//            mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
+        }
+    }
+    /**
+     * Attempts to sign in or register the account specified by the login form.
+     * If there are form errors (invalid email, missing fields, etc.), the
+     * errors are presented and no actual login attempt is made.
+     */
+    public void attemptLogin()
+    {
+        if (mAuthTask != null)
+        {
+            return;
+        }
+
+        // Reset errors.
+        m_etName.setError(null);
+        m_etPassword.setError(null);
+
+        // Store values at the time of the login attempt.
+        m_sName = m_etName.getText().toString();
+        m_sPassword = m_etPassword.getText().toString();
+
+        boolean cancel = false;
+        View focusView = null;
+
+        // Check for a valid password.
+        if (TextUtils.isEmpty(m_sPassword))
+        {
+            m_etPassword.setError(getString(R.string.error_field_required));
+            focusView = m_etPassword;
+            cancel = true;
+        }
+        else if (m_sPassword.length() < 4)
+        {
+            m_etPassword.setError(getString(R.string.error_invalid_password));
+            focusView = m_etPassword;
+            cancel = true;
+        }
+
+        // Check for a valid user name.
+        if (TextUtils.isEmpty(m_sName))
+        {
+            m_etName.setError(getString(R.string.error_field_required));
+            focusView = m_etName;
+            cancel = true;
+        }
+        // else if (!m_sName.contains("@")) {
+        // m_etName.setError(getString(R.string.error_invalid_email));
+        // focusView = m_etName;
+        // cancel = true;
+        // }
+
+        if (cancel)
+        {
+            // There was an error; don't attempt login and focus the first
+            // form field with an error.
+            focusView.requestFocus();
+        }
+        else
+        {
+            // Show a progress spinner, and kick off a background task to
+            // perform the user login attempt.
+            mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
+            showProgress(true);
+            mAuthTask = new FullScreenLoginActivity.UserLoginTask();
+            mAuthTask.execute((Void) null);
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+        super.onActivityResult(requestCode, resultCode, data);
+
+        String server=data.getStringExtra("server");
+        m_etServer.setText(server);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_full_screen_login);
+
+        ActionBar actionBar = getActionBar();
+        if (actionBar != null) {
+            actionBar.hide();
+        }
+
+
+        TextView tv_ver = (TextView) findViewById(R.id.tv_ver);
+        try
+        {
+
+            tv_ver.setText(getText(R.string.str_ver)
+                    + RedAntApplication.getInstance()
+                    .getPackageManager()
+                    .getPackageInfo("com.usai.redant.raimage", 0).versionName);
+        }
+        catch (PackageManager.NameNotFoundException e1)
+        {
+            // TODO Auto-generated catch block
+            e1.printStackTrace();
+        }
+
+        m_etName = (EditText) findViewById(R.id.et_user);
+        m_etServer = (EditText) findViewById(R.id.et_server);
+        // m_etName.setText(m_sName);
+
+        m_etPassword = (EditText) findViewById(R.id.et_pwd);
+
+        m_swSave = (Switch) findViewById(R.id.sw_save);
+        SharedPreferences pref = RedAntApplication.getInstance()
+                .getSharedPreferences("RA Image", 0);
+        String u = pref.getString("user", null);
+        String p = pref.getString("password", null);
+        String s = pref.getString("aa", null);
+        if (u != null && p != null)
+        {
+            try
+            {
+                m_etName.setText(AES.decrypt("usai2010", u));
+                m_etPassword.setText(AES.decrypt("usai2010", p));
+                m_swSave.setChecked(true);
+            }
+            catch (Exception e)
+            {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        }
+
+        m_etServer.setText(s);
+
+        m_etPassword
+                .setOnEditorActionListener(new TextView.OnEditorActionListener()
+                {
+                    @Override
+                    public boolean onEditorAction(TextView textView, int id,
+                                                  KeyEvent keyEvent)
+                    {
+                        if (id == R.id.login
+                                || id == EditorInfo.IME_ACTION_DONE)
+                        {
+                            InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
+                                    .getSystemService(INPUT_METHOD_SERVICE);
+
+                            // EditText editText =
+                            // (EditText)findViewById(R.id.xxxx);
+                            inputMethodManager.hideSoftInputFromWindow(
+                                    m_etPassword.getWindowToken(), 0); // ����
+                            attemptLogin();
+                            return true;
+                        }
+                        return false;
+                    }
+                });
+
+//        mLoginFormView = findViewById(R.id.login_form);
+        mLoginStatusView = findViewById(R.id.login_status);
+        mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
+
+        findViewById(R.id.bt_login).setOnClickListener(
+                new View.OnClickListener()
+                {
+                    @Override
+                    public void onClick(View view)
+                    {
+
+                        attemptLogin();
+                    }
+                });
+
+
+        findViewById(R.id.bt_server).setOnClickListener(
+                new View.OnClickListener()
+                {
+                    @Override
+                    public void onClick(View view)
+                    {
+                        Intent intent = new Intent();
+                        intent.setClass(FullScreenLoginActivity.this,ServerSettingActivity.class);
+//                        startActivity(intent);
+
+//                        Intent intent = new Intent(MainActivity.this,
+//                                PhotoPreviewActivity.class);
+//                        intent.putExtra("pic_list", (Serializable) photoList);
+                        startActivityForResult(intent, 0);
+
+                    }
+                });
+
+
+        if(TextUtils.isEmpty(RedAntApplication.station_name))
+        {
+            Intent intent = new Intent();
+            intent.setClass(FullScreenLoginActivity.this,ServerSettingActivity.class);
+//            startActivity(intent);
+            startActivityForResult(intent, 0);
+        }
+    }
+}

+ 243 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/HttpHelper.java

@@ -0,0 +1,243 @@
+/*
+ * Copyright 2011 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.util.Log;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+/**
+ * Utility methods for retrieving content over HTTP using the more-supported {@code java.net} classes
+ * in Android.
+ */
+public final class HttpHelper {
+
+  private static final String TAG = HttpHelper.class.getSimpleName();
+
+  private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<String>(Arrays.asList(
+    "amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly",
+    "R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
+  ));
+
+  private HttpHelper() {
+  }
+  
+  public enum ContentType {
+    /** HTML-like content type, including HTML, XHTML, etc. */
+    HTML,
+    /** JSON content */
+    JSON,
+    /** XML */
+    XML,
+    /** Plain text content */
+    TEXT,
+  }
+
+  /**
+   * Downloads the entire resource instead of part.
+   *
+   * @see #downloadViaHttp(String, HttpHelper.ContentType, int)
+   */
+  public static CharSequence downloadViaHttp(String uri, ContentType type) throws IOException {
+    return downloadViaHttp(uri, type, Integer.MAX_VALUE);
+  }
+
+  /**
+   * @param uri URI to retrieve
+   * @param type expected text-like MIME type of that content
+   * @param maxChars approximate maximum characters to read from the source
+   * @return content as a {@code String}
+   * @throws IOException if the content can't be retrieved because of a bad URI, network problem, etc.
+   */
+  public static CharSequence downloadViaHttp(String uri, ContentType type, int maxChars) throws IOException {
+    String contentTypes;
+    switch (type) {
+      case HTML:
+        contentTypes = "application/xhtml+xml,text/html,text/*,*/*";
+        break;
+      case JSON:
+        contentTypes = "application/json,text/*,*/*";
+        break;
+      case XML:
+        contentTypes = "application/xml,text/*,*/*";
+        break;
+      case TEXT:
+      default:
+        contentTypes = "text/*,*/*";
+    }
+    return downloadViaHttp(uri, contentTypes, maxChars);
+  }
+
+  private static CharSequence downloadViaHttp(String uri, String contentTypes, int maxChars) throws IOException {
+    int redirects = 0;
+    while (redirects < 5) {
+      URL url = new URL(uri);
+      HttpURLConnection connection = safelyOpenConnection(url);
+      connection.setInstanceFollowRedirects(true); // Won't work HTTP -> HTTPS or vice versa
+      connection.setRequestProperty("Accept", contentTypes);
+      connection.setRequestProperty("Accept-Charset", "utf-8,*");
+      connection.setRequestProperty("User-Agent", "ZXing (Android)");
+      try {
+        int responseCode = safelyConnect(uri, connection);
+        switch (responseCode) {
+          case HttpURLConnection.HTTP_OK:
+            return consume(connection, maxChars);
+          case HttpURLConnection.HTTP_MOVED_TEMP:
+            String location = connection.getHeaderField("Location");
+            if (location != null) {
+              uri = location;
+              redirects++;
+              continue;
+            }
+            throw new IOException("No Location");
+          default:
+            throw new IOException("Bad HTTP response: " + responseCode);
+        }
+      } finally {
+        connection.disconnect();
+      }
+    }
+    throw new IOException("Too many redirects");
+  }
+
+  private static String getEncoding(URLConnection connection) {
+    String contentTypeHeader = connection.getHeaderField("Content-Type");
+    if (contentTypeHeader != null) {
+      int charsetStart = contentTypeHeader.indexOf("charset=");
+      if (charsetStart >= 0) {
+        return contentTypeHeader.substring(charsetStart + "charset=".length());
+      }
+    }
+    return "UTF-8";
+  }
+
+  private static CharSequence consume(URLConnection connection, int maxChars) throws IOException {
+    String encoding = getEncoding(connection);
+    StringBuilder out = new StringBuilder();
+    Reader in = null;
+    try {
+      in = new InputStreamReader(connection.getInputStream(), encoding);
+      char[] buffer = new char[1024];
+      int charsRead;
+      while (out.length() < maxChars && (charsRead = in.read(buffer)) > 0) {
+        out.append(buffer, 0, charsRead);
+      }
+    } finally {
+      if (in != null) {
+        try {
+          in.close();
+        } catch (IOException ioe) {
+          // continue
+        } catch (NullPointerException npe) {
+          // another apparent Android / Harmony bug; continue
+        }
+      }
+    }
+    return out;
+  }
+
+  public static URI unredirect(URI uri) throws IOException {
+    if (!REDIRECTOR_DOMAINS.contains(uri.getHost())) {
+      return uri;
+    }
+    URL url = uri.toURL();
+    HttpURLConnection connection = safelyOpenConnection(url);
+    connection.setInstanceFollowRedirects(false);
+    connection.setDoInput(false);
+    connection.setRequestMethod("HEAD");
+    connection.setRequestProperty("User-Agent", "ZXing (Android)");
+    try {
+      int responseCode = safelyConnect(uri.toString(), connection);
+      switch (responseCode) {
+        case HttpURLConnection.HTTP_MULT_CHOICE:
+        case HttpURLConnection.HTTP_MOVED_PERM:
+        case HttpURLConnection.HTTP_MOVED_TEMP:
+        case HttpURLConnection.HTTP_SEE_OTHER:
+        case 307: // No constant for 307 Temporary Redirect ?
+          String location = connection.getHeaderField("Location");
+          if (location != null) {
+            try {
+              return new URI(location);
+            } catch (URISyntaxException e) {
+              // nevermind
+            }
+          }
+      }
+      return uri;
+    } finally {
+      connection.disconnect();
+    }
+  }
+  
+  private static HttpURLConnection safelyOpenConnection(URL url) throws IOException {
+    URLConnection conn;
+    try {
+      conn = url.openConnection();
+    } catch (NullPointerException npe) {
+      // Another strange bug in Android?
+      Log.w(TAG, "Bad URI? " + url);
+      throw new IOException(npe);
+    }
+    if (!(conn instanceof HttpURLConnection)) {
+      throw new IOException();
+    }
+    return (HttpURLConnection) conn;
+  }
+
+  private static int safelyConnect(String uri, HttpURLConnection connection) throws IOException {
+    try {
+      connection.connect();
+    } catch (NullPointerException npe) {
+      // this is an Android bug: http://code.google.com/p/android/issues/detail?id=16895
+      throw new IOException(npe);
+    } catch (IllegalArgumentException iae) {
+      // Also seen this in the wild, not sure what to make of it. Probably a bad URL
+      throw new IOException(iae);
+    } catch (SecurityException se) {
+      // due to bad VPN settings?
+      Log.w(TAG, "Restricted URI? " + uri);
+      throw new IOException(se);
+    } catch (IndexOutOfBoundsException ioobe) {
+      // Another Android problem? https://groups.google.com/forum/?fromgroups#!topic/google-admob-ads-sdk/U-WfmYa9or0
+      throw new IOException(ioobe);
+    }
+    try {
+      return connection.getResponseCode();
+    } catch (NullPointerException npe) {
+      // this is maybe this Android bug: http://code.google.com/p/android/issues/detail?id=15554
+      throw new IOException(npe);
+    } catch (IllegalArgumentException iae) {
+      // Again seen this in the wild for bad header fields in the server response! or bad reads
+      Log.w(TAG, "Bad server status? " + uri);
+      throw new IOException(iae);
+    } catch (StringIndexOutOfBoundsException sioobe) {
+      // Another Android bug: https://code.google.com/p/android/issues/detail?id=18856
+      throw new IOException(sioobe);
+    }
+  }
+
+}

+ 116 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/InactivityTimer.java

@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2010 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.AsyncTask;
+import android.os.BatteryManager;
+import android.util.Log;
+
+/**
+ * Finishes an activity after a period of inactivity if the device is on battery power.
+ */
+final class InactivityTimer {
+
+  private static final String TAG = InactivityTimer.class.getSimpleName();
+
+  private static final long INACTIVITY_DELAY_MS = 5 * 60 * 1000L;
+
+  private final Activity activity;
+  private final BroadcastReceiver powerStatusReceiver;
+  private boolean registered;
+  private AsyncTask<?,?,?> inactivityTask;
+
+  InactivityTimer(Activity activity) {
+    this.activity = activity;
+    powerStatusReceiver = new PowerStatusReceiver();
+    registered = false;
+    onActivity();
+  }
+
+  synchronized void onActivity() {
+    cancel();
+    inactivityTask = new InactivityAsyncTask();
+    inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+  }
+
+  public synchronized void onPause() {
+    cancel();
+    if (registered) {
+      activity.unregisterReceiver(powerStatusReceiver);
+      registered = false;
+    } else {
+      Log.w(TAG, "PowerStatusReceiver was never registered?");
+    }
+  }
+
+  public synchronized void onResume() {
+    if (registered) {
+      Log.w(TAG, "PowerStatusReceiver was already registered?");
+    } else {
+      activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+      registered = true;
+    }
+    onActivity();
+  }
+
+  private synchronized void cancel() {
+    AsyncTask<?,?,?> task = inactivityTask;
+    if (task != null) {
+      task.cancel(true);
+      inactivityTask = null;
+    }
+  }
+
+  void shutdown() {
+    cancel();
+  }
+
+  private final class PowerStatusReceiver extends BroadcastReceiver {
+    @Override
+    public void onReceive(Context context, Intent intent){
+      if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
+        // 0 indicates that we're on battery
+        boolean onBatteryNow = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) <= 0;
+        if (onBatteryNow) {
+          InactivityTimer.this.onActivity();
+        } else {
+          InactivityTimer.this.cancel();
+        }
+      }
+    }
+  }
+
+  private final class InactivityAsyncTask extends AsyncTask<Object,Object,Object> {
+    @Override
+    protected Object doInBackground(Object... objects) {
+      try {
+        Thread.sleep(INACTIVITY_DELAY_MS);
+        Log.i(TAG, "Finishing activity due to inactivity");
+        activity.finish();
+      } catch (InterruptedException e) {
+        // continue without killing
+      }
+      return null;
+    }
+  }
+
+}

+ 261 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/Intents.java

@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+/**
+ * This class provides the constants to use when sending an Intent to Barcode Scanner.
+ * These strings are effectively API and cannot be changed.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+public final class Intents {
+  private Intents() {
+  }
+
+  public static final class Scan {
+    /**
+     * Send this intent to open the Barcodes app in scanning mode, find a barcode, and return
+     * the results.
+     */
+    public static final String ACTION = "com.google.zxing.client.android.SCAN";
+
+    /**
+     * By default, sending this will decode all barcodes that we understand. However it
+     * may be useful to limit scanning to certain formats. Use
+     * {@link android.content.Intent#putExtra(String, String)} with one of the values below.
+     *
+     * Setting this is effectively shorthand for setting explicit formats with {@link #FORMATS}.
+     * It is overridden by that setting.
+     */
+    public static final String MODE = "SCAN_MODE";
+
+    /**
+     * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get
+     * prices, reviews, etc. for products.
+     */
+    public static final String PRODUCT_MODE = "PRODUCT_MODE";
+
+    /**
+     * Decode only 1D barcodes.
+     */
+    public static final String ONE_D_MODE = "ONE_D_MODE";
+
+    /**
+     * Decode only QR codes.
+     */
+    public static final String QR_CODE_MODE = "QR_CODE_MODE";
+
+    /**
+     * Decode only Data Matrix codes.
+     */
+    public static final String DATA_MATRIX_MODE = "DATA_MATRIX_MODE";
+
+    /**
+     * Comma-separated list of formats to scan for. The values must match the names of
+     * {@link com.google.zxing.BarcodeFormat}s, e.g. {@link com.google.zxing.BarcodeFormat#EAN_13}.
+     * Example: "EAN_13,EAN_8,QR_CODE". This overrides {@link #MODE}.
+     */
+    public static final String FORMATS = "SCAN_FORMATS";
+
+    /**
+     * @see com.google.zxing.DecodeHintType#CHARACTER_SET
+     */
+    public static final String CHARACTER_SET = "CHARACTER_SET";
+
+    /**
+     * Optional parameters to specify the width and height of the scanning rectangle in pixels.
+     * The app will try to honor these, but will clamp them to the size of the preview frame.
+     * You should specify both or neither, and pass the size as an int.
+     */
+    public static final String WIDTH = "SCAN_WIDTH";
+    public static final String HEIGHT = "SCAN_HEIGHT";
+
+    /**
+     * Desired duration in milliseconds for which to pause after a successful scan before
+     * returning to the calling intent. Specified as a long, not an integer!
+     * For example: 1000L, not 1000.
+     */
+    public static final String RESULT_DISPLAY_DURATION_MS = "RESULT_DISPLAY_DURATION_MS";
+
+    /**
+     * Prompt to show on-screen when scanning by intent. Specified as a {@link String}.
+     */
+    public static final String PROMPT_MESSAGE = "PROMPT_MESSAGE";
+
+    /**
+     * If a barcode is found, Barcodes returns {@link android.app.Activity#RESULT_OK} to
+     * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)}
+     * of the app which requested the scan via
+     * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
+     * The barcodes contents can be retrieved with
+     * {@link android.content.Intent#getStringExtra(String)}. 
+     * If the user presses Back, the result code will be {@link android.app.Activity#RESULT_CANCELED}.
+     */
+    public static final String RESULT = "SCAN_RESULT";
+
+    /**
+     * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_FORMAT}
+     * to determine which barcode format was found.
+     * See {@link com.google.zxing.BarcodeFormat} for possible values.
+     */
+    public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT";
+
+    /**
+     * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_UPC_EAN_EXTENSION}
+     * to return the content of any UPC extension barcode that was also found. Only applicable
+     * to {@link com.google.zxing.BarcodeFormat#UPC_A} and {@link com.google.zxing.BarcodeFormat#EAN_13}
+     * formats.
+     */
+    public static final String RESULT_UPC_EAN_EXTENSION = "SCAN_RESULT_UPC_EAN_EXTENSION";
+
+    /**
+     * Call {@link android.content.Intent#getByteArrayExtra(String)} with {@link #RESULT_BYTES}
+     * to get a {@code byte[]} of raw bytes in the barcode, if available.
+     */
+    public static final String RESULT_BYTES = "SCAN_RESULT_BYTES";
+
+    /**
+     * Key for the value of {@link com.google.zxing.ResultMetadataType#ORIENTATION}, if available.
+     * Call {@link android.content.Intent#getIntArrayExtra(String)} with {@link #RESULT_ORIENTATION}.
+     */
+    public static final String RESULT_ORIENTATION = "SCAN_RESULT_ORIENTATION";
+
+    /**
+     * Key for the value of {@link com.google.zxing.ResultMetadataType#ERROR_CORRECTION_LEVEL}, if available.
+     * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_ERROR_CORRECTION_LEVEL}.
+     */
+    public static final String RESULT_ERROR_CORRECTION_LEVEL = "SCAN_RESULT_ERROR_CORRECTION_LEVEL";
+
+    /**
+     * Prefix for keys that map to the values of {@link com.google.zxing.ResultMetadataType#BYTE_SEGMENTS},
+     * if available. The actual values will be set under a series of keys formed by adding 0, 1, 2, ...
+     * to this prefix. So the first byte segment is under key "SCAN_RESULT_BYTE_SEGMENTS_0" for example.
+     * Call {@link android.content.Intent#getByteArrayExtra(String)} with these keys.
+     */
+    public static final String RESULT_BYTE_SEGMENTS_PREFIX = "SCAN_RESULT_BYTE_SEGMENTS_";
+
+    /**
+     * Setting this to false will not save scanned codes in the history. Specified as a {@code boolean}.
+     */
+    public static final String SAVE_HISTORY = "SAVE_HISTORY";
+
+    private Scan() {
+    }
+  }
+
+  public static final class History {
+
+    public static final String ITEM_NUMBER = "ITEM_NUMBER";
+
+    private History() {
+    }
+  }
+
+  public static final class Encode {
+    /**
+     * Send this intent to encode a piece of data as a QR code and display it full screen, so
+     * that another person can scan the barcode from your screen.
+     */
+    public static final String ACTION = "com.google.zxing.client.android.ENCODE";
+
+    /**
+     * The data to encode. Use {@link android.content.Intent#putExtra(String, String)} or
+     * {@link android.content.Intent#putExtra(String, android.os.Bundle)}, 
+     * depending on the type and format specified. Non-QR Code formats should
+     * just use a String here. For QR Code, see Contents for details.
+     */
+    public static final String DATA = "ENCODE_DATA";
+
+    /**
+     * The type of data being supplied if the format is QR Code. Use
+     * {@link android.content.Intent#putExtra(String, String)} with one of {@link Contents.Type}.
+     */
+    public static final String TYPE = "ENCODE_TYPE";
+
+    /**
+     * The barcode format to be displayed. If this isn't specified or is blank,
+     * it defaults to QR Code. Use {@link android.content.Intent#putExtra(String, String)}, where
+     * format is one of {@link com.google.zxing.BarcodeFormat}.
+     */
+    public static final String FORMAT = "ENCODE_FORMAT";
+
+    /**
+     * Normally the contents of the barcode are displayed to the user in a TextView. Setting this
+     * boolean to false will hide that TextView, showing only the encode barcode.
+     */
+    public static final String SHOW_CONTENTS = "ENCODE_SHOW_CONTENTS";
+
+    private Encode() {
+    }
+  }
+
+  public static final class SearchBookContents {
+    /**
+     * Use Google Book Search to search the contents of the book provided.
+     */
+    public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS";
+
+    /**
+     * The book to search, identified by ISBN number.
+     */
+    public static final String ISBN = "ISBN";
+
+    /**
+     * An optional field which is the text to search for.
+     */
+    public static final String QUERY = "QUERY";
+
+    private SearchBookContents() {
+    }
+  }
+
+  public static final class WifiConnect {
+    /**
+     * Internal intent used to trigger connection to a wi-fi network.
+     */
+    public static final String ACTION = "com.google.zxing.client.android.WIFI_CONNECT";
+
+    /**
+     * The network to connect to, all the configuration provided here.
+     */
+    public static final String SSID = "SSID";
+
+    /**
+     * The network to connect to, all the configuration provided here.
+     */
+    public static final String TYPE = "TYPE";
+
+    /**
+     * The network to connect to, all the configuration provided here.
+     */
+    public static final String PASSWORD = "PASSWORD";
+
+    private WifiConnect() {
+    }
+  }
+
+  public static final class Share {
+    /**
+     * Give the user a choice of items to encode as a barcode, then render it as a QR Code and
+     * display onscreen for a friend to scan with their phone.
+     */
+    public static final String ACTION = "com.google.zxing.client.android.SHARE";
+
+    private Share() {
+    }
+  }
+}

+ 63 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/LicenseActivity.java

@@ -0,0 +1,63 @@
+package com.usai.redant.raimage;
+
+import java.io.InputStream;
+
+import org.apache.http.util.EncodingUtils;
+
+
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.webkit.WebView;
+
+public class LicenseActivity extends Activity
+{
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_license);
+		WebView wv = (WebView) findViewById(R.id.webView1);
+		String content = "";
+		try
+		{
+			InputStream in = getResources().openRawResource(R.raw.license);
+			// 获取文件的字节数
+			int lenght = in.available();
+			// 创建byte数组
+			byte[] buffer = new byte[lenght];
+			// 将文件中的数据读到byte数组中
+			in.read(buffer);
+			content = EncodingUtils.getString(buffer, "UTF-8");
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+		wv.getSettings().setDefaultTextEncodingName("UTF-8");
+		wv.loadData(content, "text/html", null);		
+	}
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		// Inflate the menu; this adds items to the action bar if it is present.
+//		getMenuInflater().inflate(R.menu.license, menu);
+//		return true;
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		// Handle action bar item clicks here. The action bar will
+//		// automatically handle clicks on the Home/Up button, so long
+//		// as you specify a parent activity in AndroidManifest.xml.
+//		int id = item.getItemId();
+//		if (id == R.id.action_settings)
+//		{
+//			return true;
+//		}
+//		return super.onOptionsItemSelected(item);
+//	}
+}

+ 780 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/LockerActivity.java

@@ -0,0 +1,780 @@
+package com.usai.redant.raimage;
+
+import com.usai.util.Crypto;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Activity which displays a login screen to the user, offering registration as
+ * well.
+ */
+public class LockerActivity extends Activity
+{
+	// public static final int ERR_CODE_NONE = 0;
+	// public static final int ERR_CODE_NULLRETURN = 1;
+	// public static final int ERR_CODE_NONETWORK = 2;
+
+	/**
+	 * A dummy authentication store containing known user names and passwords.
+	 * TODO: remove after connecting to a real authentication system.
+	 */
+	// private static final String[] DUMMY_CREDENTIALS = new String[] {
+	// "foo@example.com:hello", "bar@example.com:world" };
+
+	/**
+	 * The default email to populate the email field with.
+	 */
+	// public static final String EXTRA_EMAIL =
+	// "com.example.android.authenticatordemo.extra.EMAIL";
+	// public static final String EXTRA_USER = "Login_User";
+
+	/**
+	 * Keep track of the login task to ensure we can cancel it if requested.
+	 */
+	private UserLoginTask	mAuthTask	= null;
+	ArrayAdapter<String>		adapter							= null;
+	// SQLiteDatabase m_db;
+	// Values for email and password at the time of the login attempt.
+	private String			m_sName;
+	private String			m_sPassword;
+
+	// UI references.
+	private AutoCompleteTextView		m_etName;
+	private EditText		m_etPassword;
+	private View			mLoginFormView;
+	private View			mLoginStatusView;
+	private TextView		mLoginStatusMessageView;
+
+//	@Override
+//	protected void onDestroy()
+//	{
+//		// TODO Auto-generated method stub
+////		dbUtil.CloseDB(m_db);
+////		super.onDestroy();
+//
+//	}
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.activity_locker);
+
+		// Set up the login form.
+		// m_sName = getIntent().getStringExtra(EXTRA_USER);
+		m_etName = (AutoCompleteTextView) findViewById(R.id.name);
+
+		// m_etName.setText(m_sName);
+
+		m_etPassword = (EditText) findViewById(R.id.password);
+		m_etPassword
+				.setOnEditorActionListener(new TextView.OnEditorActionListener()
+				{
+					@Override
+					public boolean onEditorAction(TextView textView, int id,
+							KeyEvent keyEvent)
+					{
+						if (id == R.id.login
+								|| id == EditorInfo.IME_ACTION_DONE)
+						{
+							InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
+									.getSystemService(INPUT_METHOD_SERVICE);
+
+							// EditText editText =
+							// (EditText)findViewById(R.id.xxxx);
+							inputMethodManager.hideSoftInputFromWindow(
+									m_etPassword.getWindowToken(), 0); // ����
+							attemptLogin();
+							return true;
+						}
+						return false;
+					}
+				});
+
+		mLoginFormView = findViewById(R.id.login_form);
+		mLoginStatusView = findViewById(R.id.login_status);
+		mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
+
+		findViewById(R.id.sign_in_button).setOnClickListener(
+				new View.OnClickListener()
+				{
+					@Override
+					public void onClick(View view)
+					{
+						attemptLogin();
+					}
+				});
+		adapter = new ArrayAdapter<String>(this,
+				android.R.layout.simple_list_item_1,
+				dbUtil.get_userlist());
+		m_etName.setAdapter(adapter);
+	}
+	@Override
+	public boolean onKeyDown(int keyCode, KeyEvent event)
+	{
+		if (keyCode == KeyEvent.KEYCODE_BACK)
+		{
+			// Intent myIntent = new Intent();
+			// myIntent = new Intent(EditActivity.this, tabActivity.class);
+			// startActivity(myIntent);
+			// this.finish();
+			return true;
+		}
+		return super.onKeyDown(keyCode, event);
+
+	}
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		super.onCreateOptionsMenu(menu);
+//		getMenuInflater().inflate(R.menu.login, menu);
+//		return true;
+//	}
+
+	/**
+	 * Attempts to sign in or register the account specified by the login form.
+	 * If there are form errors (invalid email, missing fields, etc.), the
+	 * errors are presented and no actual login attempt is made.
+	 */
+	public void attemptLogin()
+	{
+		if (mAuthTask != null)
+		{
+			return;
+		}
+
+		// Reset errors.
+		m_etName.setError(null);
+		m_etPassword.setError(null);
+
+		// Store values at the time of the login attempt.
+		m_sName = m_etName.getText().toString();
+		m_sPassword = m_etPassword.getText().toString();
+
+		boolean cancel = false;
+		View focusView = null;
+
+		// Check for a valid password.
+		if (TextUtils.isEmpty(m_sPassword))
+		{
+			m_etPassword.setError(getString(R.string.error_field_required));
+			focusView = m_etPassword;
+			cancel = true;
+		}
+		else if (m_sPassword.length() < 4)
+		{
+			m_etPassword.setError(getString(R.string.error_invalid_password));
+			focusView = m_etPassword;
+			cancel = true;
+		}
+
+		// Check for a valid user name.
+		if (TextUtils.isEmpty(m_sName))
+		{
+			m_etName.setError(getString(R.string.error_field_required));
+			focusView = m_etName;
+			cancel = true;
+		}
+		// else if (!m_sName.contains("@")) {
+		// m_etName.setError(getString(R.string.error_invalid_email));
+		// focusView = m_etName;
+		// cancel = true;
+		// }
+
+		if (cancel)
+		{
+			// There was an error; don't attempt login and focus the first
+			// form field with an error.
+			focusView.requestFocus();
+		}
+		else
+		{
+			// Show a progress spinner, and kick off a background task to
+			// perform the user login attempt.
+			mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
+			showProgress(true);
+			mAuthTask = new UserLoginTask();
+			mAuthTask.execute((Void) null);
+		}
+	}
+
+	/**
+	 * Shows the progress UI and hides the login form.
+	 */
+	@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+	private void showProgress(final boolean show)
+	{
+		// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
+		// for very easy animations. If available, use these APIs to fade-in
+		// the progress spinner.
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
+		{
+			int shortAnimTime = getResources().getInteger(
+					android.R.integer.config_shortAnimTime);
+
+			mLoginStatusView.setVisibility(View.VISIBLE);
+			mLoginStatusView.animate().setDuration(shortAnimTime)
+					.alpha(show ? 1 : 0)
+					.setListener(new AnimatorListenerAdapter()
+					{
+						@Override
+						public void onAnimationEnd(Animator animation)
+						{
+							mLoginStatusView.setVisibility(show ? View.VISIBLE
+									: View.GONE);
+						}
+					});
+
+			mLoginFormView.setVisibility(View.VISIBLE);
+			mLoginFormView.animate().setDuration(shortAnimTime)
+					.alpha(show ? 0 : 1)
+					.setListener(new AnimatorListenerAdapter()
+					{
+						@Override
+						public void onAnimationEnd(Animator animation)
+						{
+							mLoginFormView.setVisibility(show ? View.GONE
+									: View.VISIBLE);
+						}
+					});
+		}
+		else
+		{
+			// The ViewPropertyAnimator APIs are not available, so simply show
+			// and hide the relevant UI components.
+			mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
+			mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
+		}
+	}
+
+	/**
+	 * Represents an asynchronous login/registration task used to authenticate
+	 * the user.
+	 */
+	public class UserLoginTask extends AsyncTask<Void, Void, Boolean>
+	{
+		// int err_code = ERR_CODE_NONE;
+		int	verifyuser	= Network.RESULT_TRUE;
+
+		// int netconnect;
+
+		@Override
+		protected Boolean doInBackground(Void... params)
+		{
+
+			verifyuser = Network.VerifyUser(m_sName, m_sPassword);
+			if (verifyuser == Network.RESULT_TRUE)
+				return true;
+			else
+				return false;
+		}
+
+		@Override
+		protected void onPostExecute(final Boolean success)
+		{
+			Log.i("onPostExecute", "entry");
+			mAuthTask = null;
+			showProgress(false);
+
+			if (success)
+			{
+				String encryptUser="";
+				String encryptPass="";
+				try
+				{
+					encryptUser=Crypto.encrypt("apexu", m_sName);
+					encryptPass=Crypto.encrypt("apexp", m_sPassword);
+				}
+				catch (Exception e1)
+				{
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+
+				SQLiteDatabase db = dbUtil.OpenDB(LockerActivity.this, null,
+						true);
+				Cursor cursor = db
+						.query("users", new String[] { "_id" }, "name='"
+								+ encryptUser + "'", null, null, null, "_id", null);
+				if (cursor.moveToNext())
+				{
+					int _id = cursor.getInt(0);
+					String sql = "update users set pass='" + encryptPass
+							+ "' where _id=" + _id;
+					db.execSQL(sql);
+				}
+				else
+				{
+					String sql = "insert into users(name,pass) values('"
+							+ encryptUser + "','" + encryptPass + "')";
+					db.execSQL(sql);
+				}
+				dbUtil.CloseCursor(cursor);
+				dbUtil.CloseDB(db);
+
+				RedAntApplication.user = m_sName;
+				RedAntApplication.password = m_sPassword;
+				Intent intent = new Intent();
+				setResult(Activity.RESULT_OK, intent);
+				finish();
+			}
+			else
+			{
+				switch (verifyuser)
+				{
+					case Network.RESULT_NET_ERROR:
+					case Network.RESULT_NET_NOTAVAILABLE:
+					{
+						SQLiteDatabase db = dbUtil.OpenDB(LockerActivity.this,
+								null, true);
+
+						String encryptUser="";
+						try
+						{
+							encryptUser=Crypto.encrypt("apexu", m_sName);
+						}
+						catch (Exception e1)
+						{
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+						Cursor cursor = db.query("users", new String[] {
+								"pass", "_id" }, "name= '" + encryptUser + "'",
+								null, null, null, "_id desc", null);
+						if (cursor.moveToNext())
+						{
+							String pass="";
+							try
+							{
+								pass = Crypto.decrypt("apexp", cursor.getString(0));
+							}
+							catch (Exception e)
+							{
+								// TODO Auto-generated catch block
+								e.printStackTrace();
+							}
+							if (pass.equals(m_sPassword))
+							{
+								dbUtil.CloseCursor(cursor);
+								dbUtil.CloseDB(db);
+								RedAntApplication.user = m_sName;
+								RedAntApplication.password = m_sPassword;
+								Intent intent = new Intent();
+								setResult(Activity.RESULT_OK, intent);
+								finish();
+
+							}
+							else
+							{
+								// wrong password
+								Toast toast = Toast.makeText(getApplicationContext(),
+										getText(R.string.msg_user_wrong),
+										Toast.LENGTH_LONG);
+								toast.setGravity(Gravity.CENTER, 0, 0);
+								toast.show();
+								m_etPassword
+								.setError(getString(R.string.error_incorrect_password));
+						m_etPassword.requestFocus();
+								dbUtil.CloseCursor(cursor);
+								dbUtil.CloseDB(db);
+							}
+						}
+						else
+						{//wrong user
+							Toast toast = Toast.makeText(getApplicationContext(),
+									getText(R.string.msg_user_wrong),
+									Toast.LENGTH_LONG);
+							toast.setGravity(Gravity.CENTER, 0, 0);
+							toast.show();
+							m_etPassword
+							.setError(getString(R.string.error_incorrect_password));
+					m_etPassword.requestFocus();
+							dbUtil.CloseCursor(cursor);
+							dbUtil.CloseDB(db);
+
+						}
+
+						break;
+					}
+//					case Network.RESULT_NET_ERROR:
+//					{
+//						Toast toast = Toast.makeText(getApplicationContext(),
+//								getText(R.string.msg_net_error),
+//								Toast.LENGTH_LONG);
+//						toast.setGravity(Gravity.CENTER, 0, 0);
+//						toast.show();
+//						return;
+//					}
+					case Network.RESULT_FALSE:
+					{
+						Toast toast = Toast.makeText(getApplicationContext(),
+								getText(R.string.msg_user_wrong),
+								Toast.LENGTH_LONG);
+						toast.setGravity(Gravity.CENTER, 0, 0);
+						toast.show();
+						m_etPassword
+						.setError(getString(R.string.error_incorrect_password));
+				m_etPassword.requestFocus();
+						return;
+					}
+
+					default:
+						break;
+				}
+
+
+			}
+		}
+
+		@Override
+		protected void onCancelled()
+		{
+			mAuthTask = null;
+			showProgress(false);
+		}
+	}	
+	
+//	/**
+//	 * A dummy authentication store containing known user names and passwords.
+//	 * TODO: remove after connecting to a real authentication system.
+//	 */
+//	// private static final String[] DUMMY_CREDENTIALS = new String[] {
+//	// "foo@example.com:hello", "bar@example.com:world" };
+//
+//	/**
+//	 * The default email to populate the email field with.
+//	 */
+//	public static final String	EXTRA_EMAIL	= "com.example.android.authenticatordemo.extra.EMAIL";
+//
+//	/**
+//	 * Keep track of the login task to ensure we can cancel it if requested.
+//	 */
+//	private UserLoginTask		mAuthTask	= null;
+//	ArrayAdapter<String>		adapter							= null;
+//	SQLiteDatabase				m_db;
+//	// Values for email and password at the time of the login attempt.
+//	private String				m_sName;
+//	private String				m_sPassword;
+//
+//	// UI references.
+//	private AutoCompleteTextView			m_etName;
+//	private EditText			m_etPassword;
+//	private View				mLoginFormView;
+//	private View				mLoginStatusView;
+//	private TextView			mLoginStatusMessageView;
+//
+//	@Override
+//	protected void onCreate(Bundle savedInstanceState)
+//	{
+//		super.onCreate(savedInstanceState);
+//		setContentView(R.layout.activity_locker);
+//
+//		// Set up the login form.
+//		// m_sName = getIntent().getStringExtra(EXTRA_USER);
+//		m_etName = (AutoCompleteTextView) findViewById(R.id.name);
+//
+//		// m_etName.setText(m_sName);
+//
+//		m_etPassword = (EditText) findViewById(R.id.password);
+//		m_etPassword
+//				.setOnEditorActionListener(new TextView.OnEditorActionListener()
+//				{
+//					@Override
+//					public boolean onEditorAction(TextView textView, int id,
+//							KeyEvent keyEvent)
+//					{
+//						Log.d("onEditorAction", "id=" + id + " keyevent="
+//								+ keyEvent);
+//						if (id == R.id.locker
+//								|| id == EditorInfo.IME_ACTION_DONE)
+//						{
+//							attemptLogin();
+//							return true;
+//						}
+//						return false;
+//					}
+//				});
+//
+//		mLoginFormView = findViewById(R.id.login_form);
+//		mLoginStatusView = findViewById(R.id.login_status);
+//		mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
+//
+//		findViewById(R.id.sign_in_button).setOnClickListener(
+//				new View.OnClickListener()
+//				{
+//					@Override
+//					public void onClick(View view)
+//					{
+//						attemptLogin();
+//					}
+//				});
+//		
+//		adapter = new ArrayAdapter<String>(this,
+//				android.R.layout.simple_list_item_1,
+//				dbUtil.get_userlist());
+//		m_etName.setAdapter(adapter);
+//	}
+//
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		super.onCreateOptionsMenu(menu);
+//		getMenuInflater().inflate(R.menu.locker, menu);
+//		return true;
+//	}
+//
+//	@Override
+//	public boolean onKeyDown(int keyCode, KeyEvent event)
+//	{
+//		if (keyCode == KeyEvent.KEYCODE_BACK)
+//		{
+//			// Intent myIntent = new Intent();
+//			// myIntent = new Intent(EditActivity.this, tabActivity.class);
+//			// startActivity(myIntent);
+//			// this.finish();
+//			return true;
+//		}
+//		return super.onKeyDown(keyCode, event);
+//
+//	}
+//
+//	/**
+//	 * Attempts to sign in or register the account specified by the login form.
+//	 * If there are form errors (invalid email, missing fields, etc.), the
+//	 * errors are presented and no actual login attempt is made.
+//	 */
+//	public void attemptLogin()
+//	{
+//		if (mAuthTask != null)
+//		{
+//			return;
+//		}
+//
+//		// Reset errors.
+//		m_etName.setError(null);
+//		m_etPassword.setError(null);
+//
+//		// Store values at the time of the login attempt.
+//		m_sName = m_etName.getText().toString();
+//		m_sPassword = m_etPassword.getText().toString();
+//
+//		boolean cancel = false;
+//		View focusView = null;
+//
+//		// Check for a valid password.
+//		if (TextUtils.isEmpty(m_sPassword))
+//		{
+//			m_etPassword.setError(getString(R.string.error_field_required));
+//			focusView = m_etPassword;
+//			cancel = true;
+//		}
+//		else if (m_sPassword.length() < 4)
+//		{
+//			m_etPassword.setError(getString(R.string.error_invalid_password));
+//			focusView = m_etPassword;
+//			cancel = true;
+//		}
+//
+//		// Check for a valid user name.
+//		if (TextUtils.isEmpty(m_sName))
+//		{
+//			m_etName.setError(getString(R.string.error_field_required));
+//			focusView = m_etName;
+//			cancel = true;
+//		}
+//		// else if (!m_sName.contains("@")) {
+//		// m_etName.setError(getString(R.string.error_invalid_email));
+//		// focusView = m_etName;
+//		// cancel = true;
+//		// }
+//
+//		if (cancel)
+//		{
+//			// There was an error; don't attempt login and focus the first
+//			// form field with an error.
+//			focusView.requestFocus();
+//		}
+//		else
+//		{
+//			// Show a progress spinner, and kick off a background task to
+//			// perform the user login attempt.
+//			mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
+//			showProgress(true);
+//			mAuthTask = new UserLoginTask();
+//			mAuthTask.execute((Void) null);
+//		}
+//	}
+//
+//	/**
+//	 * Shows the progress UI and hides the login form.
+//	 */
+//	@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+//	private void showProgress(final boolean show)
+//	{
+//		// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
+//		// for very easy animations. If available, use these APIs to fade-in
+//		// the progress spinner.
+//		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
+//		{
+//			int shortAnimTime = getResources().getInteger(
+//					android.R.integer.config_shortAnimTime);
+//
+//			mLoginStatusView.setVisibility(View.VISIBLE);
+//			mLoginStatusView.animate().setDuration(shortAnimTime)
+//					.alpha(show ? 1 : 0)
+//					.setListener(new AnimatorListenerAdapter()
+//					{
+//						@Override
+//						public void onAnimationEnd(Animator animation)
+//						{
+//							mLoginStatusView.setVisibility(show ? View.VISIBLE
+//									: View.GONE);
+//						}
+//					});
+//
+//			mLoginFormView.setVisibility(View.VISIBLE);
+//			mLoginFormView.animate().setDuration(shortAnimTime)
+//					.alpha(show ? 0 : 1)
+//					.setListener(new AnimatorListenerAdapter()
+//					{
+//						@Override
+//						public void onAnimationEnd(Animator animation)
+//						{
+//							mLoginFormView.setVisibility(show ? View.GONE
+//									: View.VISIBLE);
+//						}
+//					});
+//		}
+//		else
+//		{
+//			// The ViewPropertyAnimator APIs are not available, so simply show
+//			// and hide the relevant UI components.
+//			mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
+//			mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
+//		}
+//	}
+//
+//	/**
+//	 * Represents an asynchronous login/registration task used to authenticate
+//	 * the user.
+//	 */
+//	public class UserLoginTask extends AsyncTask<Void, Void, Boolean>
+//	{
+//		@Override
+//		protected Boolean doInBackground(Void... params)
+//		{
+//
+//			m_db = dbUtil.OpenDB(LockerActivity.this, null, true);
+//
+//			Cursor cursor = m_db.query("users", new String[] { "pass", "_id" },
+//					"name= '" + m_sName + "'", null, null, null, "_id desc",
+//					null);
+//			if (cursor.moveToNext())
+//			{
+//				// user exist in local db;
+//				// Log.d(TAG, "USER "+m_sName+" exist!");
+//				String pass = cursor.getString(0);
+//				if (pass.equals(m_sPassword))
+//					return true;
+//				else
+//				{
+//					return false;// wrong password
+//				}
+//			}
+//			else
+//			{
+//				// user not exist in local db;
+//				try
+//				{
+//					// Simulate network access.
+//					Thread.sleep(2000);
+//				}
+//				catch (InterruptedException e)
+//				{
+//					return false;
+//				}
+//				// TODO: register the new account here.
+//				// online check user here;
+//				if (true)// check pass create user in local db;
+//				{
+//					ContentValues cv = new ContentValues();
+//					cv.put("name", m_sName);
+//					cv.put("pass", m_sPassword);
+//
+//					m_db.insert("users", null, cv);
+//
+//					return true;
+//
+//				}
+//				else
+//				{
+//					// no user exist on the server;
+//					return false;
+//				}
+//			}
+//		}
+//
+//		@Override
+//		protected void onPostExecute(final Boolean success)
+//		{
+//			mAuthTask = null;
+//			showProgress(false);
+//
+//			if (success)
+//			{
+//
+//				// SharedPreferences.Editor editor = RunOnce.edit();
+//				// editor.putBoolean("FirstRun"+globalUtil.getVerName(this),
+//				// false);
+//				// // Don't forget to commit your edits!!!
+//				// editor.commit();
+//
+//				Intent intent = new Intent();
+//				intent.putExtra("user", m_sName);
+//				/*
+//				 * ����setResult������ʾ�ҽ�Intent���󷵻ظ�֮ǰ���Ǹ�Activity�������Ϳ���
+//				 * ��onActivityResult�����еõ�Intent����
+//				 */
+//				setResult(Activity.RESULT_OK, intent);
+//				finish();
+//			}
+//			else
+//			{
+//				m_etPassword
+//						.setError(getString(R.string.error_incorrect_password));
+//				m_etPassword.requestFocus();
+//			}
+//		}
+//
+//		@Override
+//		protected void onCancelled()
+//		{
+//			mAuthTask = null;
+//			showProgress(false);
+//		}
+//	}
+}

+ 540 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/LoginActivity.java

@@ -0,0 +1,540 @@
+package com.usai.redant.raimage;
+
+import com.usai.util.Crypto;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
+//import com.example.com.apex.usa.test1.R.id;
+//import com.example.com.apex.usa.test1.R.layout;
+//import com.example.com.apex.usa.test1.R.menu;
+//import com.example.com.apex.usa.test1.R.string;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Activity which displays a login screen to the user, offering registration as
+ * well.
+ */
+public class LoginActivity extends Activity
+{
+
+	// public static final int ERR_CODE_NONE = 0;
+	// public static final int ERR_CODE_NULLRETURN = 1;
+	// public static final int ERR_CODE_NONETWORK = 2;
+
+	/**
+	 * A dummy authentication store containing known user names and passwords.
+	 * TODO: remove after connecting to a real authentication system.
+	 */
+	// private static final String[] DUMMY_CREDENTIALS = new String[] {
+	// "foo@example.com:hello", "bar@example.com:world" };
+
+	/**
+	 * The default email to populate the email field with.
+	 */
+	// public static final String EXTRA_EMAIL =
+	// "com.example.android.authenticatordemo.extra.EMAIL";
+	// public static final String EXTRA_USER = "Login_User";
+
+	/**
+	 * Keep track of the login task to ensure we can cancel it if requested.
+	 */
+	private UserLoginTask			mAuthTask	= null;
+	ArrayAdapter<String>			adapter		= null;
+	// SQLiteDatabase m_db;
+	// Values for email and password at the time of the login attempt.
+	private String					m_sName;
+	private String					m_sPassword;
+
+	// UI references.
+	private AutoCompleteTextView	m_etName;
+	private EditText				m_etPassword;
+	private View					mLoginFormView;
+	private View					mLoginStatusView;
+	private TextView				mLoginStatusMessageView;
+	private CheckBox				m_cbSave;
+
+	// @Override
+	// protected void onDestroy()
+	// {
+	// // TODO Auto-generated method stub
+	// // dbUtil.CloseDB(m_db);
+	// // super.onDestroy();
+	//
+	// }
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.activity_login);
+
+		// Set up the login form.
+		// m_sName = getIntent().getStringExtra(EXTRA_USER);
+		m_etName = (AutoCompleteTextView) findViewById(R.id.name);
+
+		// m_etName.setText(m_sName);
+
+		m_etPassword = (EditText) findViewById(R.id.password);
+
+		m_cbSave = (CheckBox) findViewById(R.id.cb_save);
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("POP", 0);
+		String u = pref.getString("user", null);
+		String p = pref.getString("password", null);
+		if (u != null && p != null)
+		{
+			try
+			{
+				m_etName.setText(Crypto.decrypt("apexu", u));
+				m_etPassword.setText(Crypto.decrypt("apexp", p));
+				m_cbSave.setChecked(true);
+			}
+			catch (Exception e)
+			{
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+		}
+
+		m_etPassword
+				.setOnEditorActionListener(new TextView.OnEditorActionListener()
+				{
+					@Override
+					public boolean onEditorAction(TextView textView, int id,
+							KeyEvent keyEvent)
+					{
+						if (id == R.id.login
+								|| id == EditorInfo.IME_ACTION_DONE)
+						{
+							InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
+									.getSystemService(INPUT_METHOD_SERVICE);
+
+							// EditText editText =
+							// (EditText)findViewById(R.id.xxxx);
+							inputMethodManager.hideSoftInputFromWindow(
+									m_etPassword.getWindowToken(), 0); // ����
+							attemptLogin();
+							return true;
+						}
+						return false;
+					}
+				});
+
+		mLoginFormView = findViewById(R.id.login_form);
+		mLoginStatusView = findViewById(R.id.login_status);
+		mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
+
+		findViewById(R.id.sign_in_button).setOnClickListener(
+				new View.OnClickListener()
+				{
+					@Override
+					public void onClick(View view)
+					{
+						attemptLogin();
+					}
+				});
+		adapter = new ArrayAdapter<String>(this,
+				android.R.layout.simple_list_item_1, dbUtil.get_userlist());
+		m_etName.setAdapter(adapter);
+		
+		if(TextUtils.isEmpty(RedAntApplication.station_name))
+		{
+			Intent intent = new Intent();
+			intent.setClass(LoginActivity.this,ServerSettingActivity.class);
+			startActivity(intent);			
+		}
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		super.onCreateOptionsMenu(menu);
+		getMenuInflater().inflate(R.menu.login, menu);
+		return true;
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_about:
+			{
+				Intent intent = new Intent();
+				intent.setClass(LoginActivity.this, AboutActivity.class);
+				startActivity(intent);
+
+			}
+				break;
+			case R.id.action_server_settings:
+			{
+				Intent intent = new Intent();
+				intent.setClass(LoginActivity.this,ServerSettingActivity.class);
+				startActivity(intent);
+
+			}
+				break;
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	/**
+	 * Attempts to sign in or register the account specified by the login form.
+	 * If there are form errors (invalid email, missing fields, etc.), the
+	 * errors are presented and no actual login attempt is made.
+	 */
+	public void attemptLogin()
+	{
+		if (mAuthTask != null)
+		{
+			return;
+		}
+
+		// Reset errors.
+		m_etName.setError(null);
+		m_etPassword.setError(null);
+
+		// Store values at the time of the login attempt.
+		m_sName = m_etName.getText().toString();
+		m_sPassword = m_etPassword.getText().toString();
+
+		boolean cancel = false;
+		View focusView = null;
+
+		// Check for a valid password.
+		if (TextUtils.isEmpty(m_sPassword))
+		{
+			m_etPassword.setError(getString(R.string.error_field_required));
+			focusView = m_etPassword;
+			cancel = true;
+		}
+		else if (m_sPassword.length() < 4)
+		{
+			m_etPassword.setError(getString(R.string.error_invalid_password));
+			focusView = m_etPassword;
+			cancel = true;
+		}
+
+		// Check for a valid user name.
+		if (TextUtils.isEmpty(m_sName))
+		{
+			m_etName.setError(getString(R.string.error_field_required));
+			focusView = m_etName;
+			cancel = true;
+		}
+		// else if (!m_sName.contains("@")) {
+		// m_etName.setError(getString(R.string.error_invalid_email));
+		// focusView = m_etName;
+		// cancel = true;
+		// }
+
+		if (cancel)
+		{
+			// There was an error; don't attempt login and focus the first
+			// form field with an error.
+			focusView.requestFocus();
+		}
+		else
+		{
+			// Show a progress spinner, and kick off a background task to
+			// perform the user login attempt.
+			mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
+			showProgress(true);
+			mAuthTask = new UserLoginTask();
+			mAuthTask.execute((Void) null);
+		}
+	}
+
+	/**
+	 * Shows the progress UI and hides the login form.
+	 */
+	@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+	private void showProgress(final boolean show)
+	{
+		// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
+		// for very easy animations. If available, use these APIs to fade-in
+		// the progress spinner.
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
+		{
+			int shortAnimTime = getResources().getInteger(
+					android.R.integer.config_shortAnimTime);
+
+			mLoginStatusView.setVisibility(View.VISIBLE);
+			mLoginStatusView.animate().setDuration(shortAnimTime)
+					.alpha(show ? 1 : 0)
+					.setListener(new AnimatorListenerAdapter()
+					{
+						@Override
+						public void onAnimationEnd(Animator animation)
+						{
+							mLoginStatusView.setVisibility(show ? View.VISIBLE
+									: View.GONE);
+						}
+					});
+
+			mLoginFormView.setVisibility(View.VISIBLE);
+			mLoginFormView.animate().setDuration(shortAnimTime)
+					.alpha(show ? 0 : 1)
+					.setListener(new AnimatorListenerAdapter()
+					{
+						@Override
+						public void onAnimationEnd(Animator animation)
+						{
+							mLoginFormView.setVisibility(show ? View.GONE
+									: View.VISIBLE);
+						}
+					});
+		}
+		else
+		{
+			// The ViewPropertyAnimator APIs are not available, so simply show
+			// and hide the relevant UI components.
+			mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
+			mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
+		}
+	}
+
+	/**
+	 * Represents an asynchronous login/registration task used to authenticate
+	 * the user.
+	 */
+	public class UserLoginTask extends AsyncTask<Void, Void, Boolean>
+	{
+		// int err_code = ERR_CODE_NONE;
+		int	verifyuser	= Network.RESULT_TRUE;
+
+		// int netconnect;
+
+		@Override
+		protected Boolean doInBackground(Void... params)
+		{
+
+			verifyuser = Network.VerifyUser(m_sName, m_sPassword);
+			if (verifyuser == Network.RESULT_TRUE)
+				return true;
+			else
+				return false;
+		}
+
+		@Override
+		protected void onPostExecute(final Boolean success)
+		{
+			Log.i("onPostExecute", "entry");
+			mAuthTask = null;
+			showProgress(false);
+
+			if (success)
+			{
+				String encryptUser = "";
+				String encryptPass = "";
+				try
+				{
+					encryptUser = Crypto.encrypt("apexu", m_sName);
+					encryptPass = Crypto.encrypt("apexp", m_sPassword);
+				}
+				catch (Exception e1)
+				{
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+
+				SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this, null,
+						true);
+				Cursor cursor = db.query("users", new String[] { "_id" },
+						"name='" + encryptUser + "'", null, null, null, "_id",
+						null);
+				if (cursor.moveToNext())
+				{
+					int _id = cursor.getInt(0);
+					String sql = "update users set pass='" + encryptPass
+							+ "' where _id=" + _id;
+					db.execSQL(sql);
+				}
+				else
+				{
+					String sql = "insert into users(name,pass) values('"
+							+ encryptUser + "','" + encryptPass + "')";
+					db.execSQL(sql);
+				}
+				dbUtil.CloseCursor(cursor);
+				dbUtil.CloseDB(db);
+
+				SharedPreferences pref = RedAntApplication.getInstance()
+						.getSharedPreferences("POP", 0);
+				SharedPreferences.Editor editor = pref.edit();
+
+				if (m_cbSave.isChecked()&&!TextUtils.isEmpty(encryptPass)&&!TextUtils.isEmpty(encryptUser))
+				{
+					editor.putString("user", encryptUser);
+					editor.putString("password", encryptPass);
+					editor.putBoolean("kepppass", true);
+				}
+				else
+				{
+					editor.putString("user", null);
+					editor.putString("password", null);
+					editor.putBoolean("kepppass", false);
+				}
+
+				editor.commit();
+
+				RedAntApplication.user = m_sName;
+				RedAntApplication.password = m_sPassword;
+				Intent intent = new Intent();
+				intent.setClass(LoginActivity.this, MainActivity.class);
+
+				dbgUtil.fileLog("user "+m_sName+" login @server "+RedAntApplication.active_address);
+				startActivity(intent);
+				finish();
+			}
+			else
+			{
+				switch (verifyuser)
+				{
+					case Network.RESULT_NET_ERROR:
+					case Network.RESULT_NET_NOTAVAILABLE:
+					{
+						SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this,
+								null, true);
+
+						String encryptUser = "";
+						try
+						{
+							encryptUser = Crypto.encrypt("apexu", m_sName);
+						}
+						catch (Exception e1)
+						{
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+						Cursor cursor = db.query("users", new String[] {
+								"pass", "_id" }, "name= '" + encryptUser + "'",
+								null, null, null, "_id desc", null);
+						if (cursor.moveToNext())
+						{
+							String pass = "";
+							try
+							{
+								pass = Crypto.decrypt("apexp",
+										cursor.getString(0));
+							}
+							catch (Exception e)
+							{
+								// TODO Auto-generated catch block
+								e.printStackTrace();
+							}
+							if (pass.equals(m_sPassword))
+							{
+								dbUtil.CloseCursor(cursor);
+								dbUtil.CloseDB(db);
+								RedAntApplication.user = m_sName;
+								RedAntApplication.password = m_sPassword;
+								Intent intent = new Intent();
+								intent.setClass(LoginActivity.this,
+										MainActivity.class);
+								dbgUtil.fileLog("user "+m_sName+" offline access @server "+RedAntApplication.active_address);
+								startActivity(intent);
+								finish();
+							}
+							else
+							{
+								// wrong password
+								Toast toast = Toast.makeText(
+										getApplicationContext(),
+										getText(R.string.msg_user_wrong),
+										Toast.LENGTH_LONG);
+								toast.setGravity(Gravity.CENTER, 0, 0);
+								toast.show();
+								m_etPassword
+										.setError(getString(R.string.error_incorrect_password));
+								m_etPassword.requestFocus();
+								dbUtil.CloseCursor(cursor);
+								dbUtil.CloseDB(db);
+							}
+						}
+						else
+						{// user not exist
+							Toast toast = Toast.makeText(
+									getApplicationContext(),
+									getText(R.string.msg_net_error),
+									Toast.LENGTH_LONG);
+							toast.setGravity(Gravity.CENTER, 0, 0);
+							toast.show();
+							m_etPassword
+									.setError(getString(R.string.error_incorrect_password));
+							m_etPassword.requestFocus();
+							dbUtil.CloseCursor(cursor);
+							dbUtil.CloseDB(db);
+
+						}
+
+						break;
+					}
+					// case Network.RESULT_NET_ERROR:
+					// {
+					// Toast toast = Toast.makeText(getApplicationContext(),
+					// getText(R.string.msg_net_error),
+					// Toast.LENGTH_LONG);
+					// toast.setGravity(Gravity.CENTER, 0, 0);
+					// toast.show();
+					// return;
+					// }
+					case Network.RESULT_FALSE:
+					{
+						Toast toast = Toast.makeText(getApplicationContext(),
+								getText(R.string.msg_user_wrong),
+								Toast.LENGTH_LONG);
+						toast.setGravity(Gravity.CENTER, 0, 0);
+						toast.show();
+						m_etPassword
+								.setError(getString(R.string.error_incorrect_password));
+						m_etPassword.requestFocus();
+						return;
+					}
+
+					default:
+						break;
+				}
+
+			}
+		}
+
+		@Override
+		protected void onCancelled()
+		{
+			mAuthTask = null;
+			showProgress(false);
+		}
+	}
+}

+ 904 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/MainActivity.java

@@ -0,0 +1,904 @@
+package com.usai.redant.raimage;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.media.ThumbnailUtils;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class MainActivity extends Activity
+{
+	// static final int ACTIVITY_CAMERA = 0;
+	// static final int ACTIVITY_VIEW = 1;
+	// static final String serverurl = "http://192.168.23.1/xampp/";
+	static final String	TAG						= "MainActivity";
+	static final int	REQUEST_TAKE_PHOTO		= 1;
+	static final int	REQUEST_PREVIEW			= 4;
+	static final int	REQUEST_SCAN_BARCODE	= 2;
+	static final int	REQUEST_LOCKER			= 3;
+	// HashMap<String, String> hashMap = new HashMap<String, String>();
+
+	// ArrayList<String> pic_file = new ArrayList<String>();
+	// ArrayList<bitmap>
+	// ArrayList<>
+	// private String thumbpath = null;
+	private int			iwidth					= 640;
+	private int			iheight					= 480;
+	private File		photoFile				= null;
+	Bitmap				thumbBitmap				= null;
+	// private int iPhotoCount = 0;
+	public String		LastFileName			= "";
+	private boolean		m_blocked				= false;
+	TextView			m_tvalert;
+	// private String user;
+	// private String password;
+	// String m_sName;
+	// String m_sPassword;
+	ArrayList<String>	photoList				= new ArrayList<String>();
+
+	// @Override
+	// protected void onResume()
+	// {
+	// //sendBroadcast(new Intent("REDANT.POP.REQUEST_LOCATION_CHANGED"));
+	// super.onResume();
+	// }
+
+	private void StartCamera()
+	{
+		Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+		// Ensure that there's a camera activity to handle the intent
+
+		if (takePictureIntent.resolveActivity(getPackageManager()) != null)
+		{
+			// Create the File where the photo should go
+			// File photoFile = null;
+			if (photoFile != null)
+				photoFile = null;
+			try
+			{
+				photoFile = createImageFile();
+			}
+			catch (IOException ex)
+			{
+				// Error occurred while creating the File
+				// ...
+			}
+			// Continue only if the File was successfully created
+			Log.i(TAG, photoFile.toString());
+			if (photoFile != null)
+			{
+				Log.i(TAG, "start system camera====================>");
+				takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
+						Uri.fromFile(photoFile));
+				startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
+			}
+		}
+	}
+
+	@Override
+	public boolean onKeyDown(int keyCode, KeyEvent event)
+	{
+		if (keyCode == KeyEvent.KEYCODE_BACK)
+		{
+			dbgUtil.fileLog("back button click , clear&exit");
+			clear();
+
+		}
+		return super.onKeyDown(keyCode, event);
+
+	}
+
+	@Override
+	protected void onResume()
+	{
+		sendBroadcast(new Intent("REDANT.POP.GPS_ON"));
+		super.onResume();
+	}
+
+	@Override
+	protected void onPause()
+	{
+		sendBroadcast(new Intent("REDANT.POP.GPS_OFF"));
+		// TODO Auto-generated method stub
+		super.onPause();
+	}
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		Log.d(TAG, "=======================>MainActivity Created!");
+		super.onCreate(savedInstanceState);
+		
+		setContentView(R.layout.activity_main1);
+
+		setTitle(getTitle() + "(" + RedAntApplication.station_name + ")");
+		ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+		thumbsImageView.setOnClickListener(new View.OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+				if (photoList.size() < 1)
+					return;
+
+				Intent intent = new Intent(MainActivity.this,
+						PhotoPreviewActivity.class);
+				intent.putExtra("pic_list", (Serializable) photoList);
+				startActivityForResult(intent, REQUEST_PREVIEW);
+
+			}
+		});
+		// m_sName = intent.getStringExtra("user");
+		// m_sPassword = intent.getStringExtra("password");
+
+		Log.d(TAG, "user=" + RedAntApplication.user + ",password="
+				+ RedAntApplication.password);
+		IntentFilter msgFilter = new IntentFilter();
+		Intent intent = getIntent();
+		msgFilter.addAction("android.intent.action.SCREEN_OFF");
+		msgFilter.addAction("REDANT.POP.STATION_CHANGE");
+		msgFilter.addAction("REDANT.POP.STATION_NOT_CHANGE");
+		msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE");
+		msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR");
+		msgFilter.addAction("REDANT.POP.CLEAR_UPLOAD_QUEUE");
+		msgFilter.setPriority(2147483647);
+		registerReceiver(MainActivityReceiver, msgFilter);
+		Log.d(TAG, "=======================>msgFilter registed!");
+		if (savedInstanceState != null)
+		{
+			thumbBitmap = getBitmap(savedInstanceState
+					.getByteArray("thumbBitmap"));
+			photoList.clear();
+			// ArrayList list = (ArrayList)
+			// Arrays.asList(savedInstanceState.getStringArray("arrayLabel"));
+			photoList = savedInstanceState.getStringArrayList("photoList");
+			
+			TextView pidval = (TextView) findViewById(R.id.pidval);
+			pidval.setText(savedInstanceState.getString("PIID"));
+			// photoList = A
+			// savedInstanceState.getStringArrayList("photoList");
+			photoFile = (File) savedInstanceState.getSerializable("photoFile");
+
+			if (thumbBitmap != null)
+			{
+				thumbsImageView.setImageBitmap(thumbBitmap);
+				// Log.d(TAG, "load thumbpath==" + thumbpath);
+			}
+			// photoFile.delete();
+			TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+			countTextView.setText(photoList.size() + " Photos");
+
+		}
+
+		ImageButton ibtnscan = (ImageButton) findViewById(R.id.ibtnScan);
+		ibtnscan.setOnClickListener(new View.OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+				Log.d(TAG, "==============>Click Scan button");
+				Intent intent = new Intent();
+
+				intent.setClass(MainActivity.this, CaptureActivity.class);
+				startActivityForResult(intent, REQUEST_SCAN_BARCODE);
+			}
+		});
+
+		ImageButton captureButton = (ImageButton) findViewById(R.id.ibtnCapture);
+		captureButton.setOnClickListener(new View.OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+
+				StartCamera();
+			}
+		});
+		ImageButton uploadButton = (ImageButton) findViewById(R.id.ibtnOk);
+		uploadButton.setOnClickListener(new View.OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+
+				sendBroadcast(new Intent("REDANT.POP.REQUEST_LOCATION"));
+				return;
+
+			}
+		});
+
+		m_tvalert = (TextView) findViewById(R.id.tvalert);
+		m_tvalert.setSelected(true);
+
+		// Intent intent = ;
+		sendBroadcast(new Intent("REDANT.POP.MODIFY_QUEUE"));
+		updateUploadButton();
+	}
+
+	@Override
+	protected void onDestroy()
+	{
+	//	sendBroadcast(new Intent("REDANT.POP.GPS_OFF"));
+		Log.d(TAG, "=======================>MainActivity Destroyed!");
+		unregisterReceiver(MainActivityReceiver);
+		Log.d(TAG, "=======================>msgFilter unregisted!");
+		super.onDestroy();
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.main, menu);
+		return true;
+	}
+
+	private File createImageFile() throws IOException
+	{
+		// Create an image file name
+		String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
+				.format(new Date());
+		String imageFileName = "JPEG_" + timeStamp + "_";
+		File storageDir = new File(Environment.getExternalStorageDirectory()
+				.getPath() + "/redant/pop/temp/");
+
+		File dir1 = new File(Environment.getExternalStorageDirectory()
+				.getPath() + "/redant");
+		File dir2 = new File(Environment.getExternalStorageDirectory()
+				.getPath() + "/redant/pop");
+		File dir3 = new File(Environment.getExternalStorageDirectory()
+				.getPath() + "/redant/pop/temp");
+
+		
+		if (!dir1.exists())
+		{
+			boolean b = dir1.mkdir();
+		}
+		if (!dir2.exists())
+		{
+			boolean b = dir2.mkdir();
+		}
+		if (!dir3.exists())
+		{
+			boolean b = dir3.mkdir();
+		}
+		// Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
+		// Log.d(TAG, "DIR:" + storageDir);
+		LastFileName = storageDir + imageFileName + ".jpg";
+		Log.d(TAG, "File:" + LastFileName);
+		File image = File.createTempFile(imageFileName, /* prefix */
+				".jpg", /* suffix */
+				storageDir /* directory */
+		);
+
+		// Save a file: path for use with ACTION_VIEW intents
+		// mCurrentPhotoPath = "file:" + image.getAbsolutePath();
+		return image;
+	}
+
+	boolean createDir(String path)
+	{
+		Log.i(TAG, "readFile:createDir=" + path);
+		boolean ret = false;
+		try
+		{
+			File file = new File(path);
+			if (!file.exists())
+				file.mkdirs();
+			if (!file.isDirectory())
+			{
+				ret = file.mkdirs();
+			}
+		}
+		catch (Exception e)
+		{
+			Log.d(TAG, e.toString());
+		}
+		return ret;
+	}
+
+	void updateUploadButton()
+	{
+		TextView pidval = (TextView) findViewById(R.id.pidval);
+		ImageButton ibtnUpload = (ImageButton) findViewById(R.id.ibtnOk);
+		if (photoList.size() > 0 && pidval.getText().length() > 0)
+		{
+			ibtnUpload.setVisibility(View.VISIBLE);
+
+		}
+		else
+		{
+			ibtnUpload.setVisibility(View.INVISIBLE);
+
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see android.app.Activity#onActivityResult(int, int,
+	 * android.content.Intent)
+	 */
+	@Override
+	public void onActivityResult(int requestCode, int resultCode, Intent data)
+	{
+
+		if (requestCode == REQUEST_TAKE_PHOTO)
+			// ������������յ�ͼƬ
+			if (resultCode == Activity.RESULT_OK) // ��������
+
+			{
+
+				Log.d(TAG, photoFile.toString());
+				photoList.add(photoFile.toString());
+
+				StartCamera();
+				// iPhotoCount++;
+				super.onActivityResult(requestCode, resultCode, data);
+
+			}
+			else
+			{
+
+				ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+
+				if (photoList.size() > 0)
+				{
+					thumbBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory
+							.decodeFile(photoList.get(photoList.size() - 1)),
+							iwidth, iheight);
+					if (thumbBitmap != null)
+						thumbsImageView.setImageBitmap(thumbBitmap);
+				}
+
+				photoFile.delete();
+				TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+				countTextView.setText(photoList.size() + " Photos");
+				// ImageButton ibtnUpload = (ImageButton)
+				// findViewById(R.id.ibtnOk);
+				updateUploadButton();
+
+			}
+
+		else if (requestCode == REQUEST_LOCKER)
+		{
+			if (resultCode == Activity.RESULT_OK)
+				m_blocked = false;
+		}
+		else if (requestCode == REQUEST_PREVIEW)
+		{
+			for (int i = 0; i < photoList.size(); i++)
+			{
+				File file = new File(photoList.get(i));
+				if (!file.exists())
+				{
+					photoList.remove(i);
+					i--;
+				}
+			}
+			TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+			countTextView.setText(photoList.size() + " Photos");
+			if (photoList.size() == 0)
+			{
+				ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+				thumbsImageView.setImageResource(R.drawable.no_pic);
+				thumbBitmap = null;
+			}
+		}
+		else if (requestCode == REQUEST_SCAN_BARCODE)
+		{
+			if (resultCode == Activity.RESULT_OK)
+			{
+				Bundle bundle = data.getExtras();
+				String pid = bundle.getString("pid");
+				Log.d(TAG,
+						"REQUEST_SCAN_BARCODE==========>pid="
+								+ bundle.getString("pid"));
+				TextView pidval = (TextView) findViewById(R.id.pidval);
+				pidval.setText(pid);
+				updateUploadButton();
+			}
+		}
+		super.onActivityResult(requestCode, resultCode, data);
+	}
+
+	public void saveMyBitmap(String bitName, Bitmap mBitmap)
+	{
+		File f = new File("/sdcard/" + bitName + ".png");
+		try
+		{
+			f.createNewFile();
+		}
+		catch (IOException e)
+		{
+			// TODO Auto-generated catch block
+			// DebugMessage.put("�ڱ���ͼƬʱ����" + e.toString());
+		}
+		FileOutputStream fOut = null;
+		try
+		{
+			fOut = new FileOutputStream(f);
+		}
+		catch (FileNotFoundException e)
+		{
+			e.printStackTrace();
+		}
+		mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
+		try
+		{
+			fOut.flush();
+		}
+		catch (IOException e)
+		{
+			e.printStackTrace();
+		}
+		try
+		{
+			fOut.close();
+		}
+		catch (IOException e)
+		{
+			e.printStackTrace();
+		}
+	}
+
+	// boolean confirm_upload()
+	// {
+	// boolean bret = false;
+	// final Boolean b;
+	//
+	// return bret;
+	// }
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_clear:
+				dbgUtil.fileLog("menu item clear click , clear...");
+				clear();
+				break;
+			case R.id.action_type_pid:
+			{
+				final View edit = new EditText(this);
+				new AlertDialog.Builder(this)
+						.setIconAttribute(android.R.attr.alertDialogIcon)
+						.setTitle(R.string.title_input_pid)
+						.setView(edit)
+						.setPositiveButton(android.R.string.ok,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(DialogInterface dialog,
+											int whichButton)
+									{
+										String pid = ((EditText) edit)
+												.getText().toString();
+										TextView pidval = (TextView) findViewById(R.id.pidval);
+										pidval.setText(pid);
+										updateUploadButton();
+
+										/* User clicked OK so do some stuff */
+									}
+								})
+						.setNegativeButton(android.R.string.cancel,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(DialogInterface dialog,
+											int whichButton)
+									{
+										updateUploadButton();
+										/* User clicked cancel so do some stuff */
+									}
+								}).create().show();
+			}
+				break;
+			case R.id.action_server_settings:
+			{
+				Intent intent = new Intent();
+				intent.setClass(MainActivity.this, ServerSettingActivity.class);
+				startActivity(intent);
+
+			}
+				break;
+			case R.id.action_view_queue:
+			{
+				Intent intent = new Intent();
+				intent.setClass(MainActivity.this, UploadQueueActivity.class);
+				startActivity(intent);
+				break;
+			}
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	@Override
+	protected void onSaveInstanceState(Bundle outState)
+	{
+		// TODO Auto-generated method stub
+		super.onSaveInstanceState(outState);
+		if (photoFile != null)
+			outState.putSerializable("photoFile", photoFile);
+
+		if (thumbBitmap != null)
+			outState.putByteArray("thumbBitmap", getBytes(thumbBitmap));// ("thumbBitmap",
+																		// (Object)thumbBitmap);
+																		// outState.putString("thumbpath",
+																		// thumbpath);
+		// outState.putString("m_sName", m_sName);
+		// outState.putString("m_sPassword", m_sPassword);
+
+		outState.putStringArrayList("photoList", photoList);
+		// Log.d(TAG, "save thumbpath==" + thumbpath);
+		//outState.putInt("iPhotoCount", photoList.size());
+		TextView pidval = (TextView) findViewById(R.id.pidval);
+		outState.putString("PIID", pidval.getText().toString());
+	}
+
+	public static byte[] getBytes(Bitmap bitmap)
+	{
+		// ʵ�����ֽ����������
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		bitmap.compress(Bitmap.CompressFormat.PNG, 0, baos);// ѹ��λͼ
+		return baos.toByteArray();// ���������ֽ�����
+	}
+
+	public static Bitmap getBitmap(byte[] data)
+	{
+		if (data == null)
+			return null;
+		return BitmapFactory.decodeByteArray(data, 0, data.length);// ���ֽ��������λͼ
+	}
+
+	private void clear()
+	{
+		for (int i = 0; i < photoList.size(); i++)
+		{
+
+			
+			
+			
+			
+			String timeStamp = new SimpleDateFormat("yyyy_MM_dd")
+			.format(new Date());
+			
+			File storageDir = new File(Environment.getExternalStorageDirectory()
+					.getPath() + "/redant/pop/clear/"+timeStamp);
+			
+			if (!storageDir.exists())
+				storageDir.mkdirs();
+
+//			File dir1 = new File(Environment.getExternalStorageDirectory()
+//					.getPath() + "/redant");
+//			File dir2 = new File(Environment.getExternalStorageDirectory()
+//					.getPath() + "/redant/pop");
+//			File dir3 = new File(Environment.getExternalStorageDirectory()
+//					.getPath() + "/redant/pop/clear");
+//
+//			
+//			if (!dir1.exists())
+//			{
+//				boolean b = dir1.mkdir();
+//			}
+//			if (!dir2.exists())
+//			{
+//				boolean b = dir2.mkdir();
+//			}
+//			if (!dir3.exists())
+//			{
+//				boolean b = dir3.mkdir();
+//			}
+//			
+//			if (!storageDir.exists())
+//			{
+//				boolean b = storageDir.mkdir();
+//			}
+			
+			File srcFile = new File(photoList.get(i));
+		//	file.delete();
+			dbgUtil.fileLog("move file "+srcFile.getName()+" to "+Environment.getExternalStorageDirectory()
+					.getPath() + "/redant/pop/clear/"+timeStamp + File.separator);
+			srcFile.renameTo(new File(Environment.getExternalStorageDirectory()
+					.getPath() + "/redant/pop/clear/"+timeStamp + File.separator + srcFile.getName()));  
+			
+			
+
+//			// Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
+//			// Log.d(TAG, "DIR:" + storageDir);
+//			LastFileName = storageDir + imageFileName + ".jpg";
+//			Log.d(TAG, "File:" + LastFileName);
+//			File image = File.createTempFile(imageFileName, /* prefix */
+//					".jpg", /* suffix */
+//					storageDir /* directory */
+//			);
+			
+			
+		}
+		photoList.clear();
+		TextView pidval = (TextView) findViewById(R.id.pidval);
+		pidval.setText("");
+		updateUploadButton();
+		ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+		thumbsImageView.setImageResource(R.drawable.no_pic);
+		thumbBitmap = null;
+		TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+		countTextView.setText("no photo");
+
+	}
+
+	private void clearfornew()
+	{
+
+		photoList.clear();
+		TextView pidval = (TextView) findViewById(R.id.pidval);
+		pidval.setText("");
+		updateUploadButton();
+		ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+		thumbsImageView.setImageResource(R.drawable.no_pic);
+		thumbBitmap = null;
+		TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+		countTextView.setText("no photo");
+
+	}
+
+	private final BroadcastReceiver	MainActivityReceiver	= new BroadcastReceiver()
+															{
+
+																public void onReceive(
+																		Context context,
+																		Intent intent)
+																{
+																	String action = intent
+																			.getAction();
+																	// 如果捕捉到的action是ACTION_BATTERY_CHANGED
+
+																	if ("REDANT.POP.USER_CHECK_FAILED"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_fail));
+																		m_tvalert
+																				.setText("Upload failed:user verify failure.");
+
+																	}
+																	else if ("REDANT.POP.STATION_NOT_CHANGE"
+																			.equals(action))
+																	{
+																		new AlertDialog.Builder(
+																				MainActivity.this)
+																				.setIconAttribute(
+																						android.R.attr.alertDialogIcon)
+																				.setTitle(
+																						R.string.confirm_to_upload)
+																				.setMessage(
+																						"Upload to station "
+																								+ RedAntApplication.station_name)
+																				.setPositiveButton(
+																						android.R.string.ok,
+																						new DialogInterface.OnClickListener()
+																						{
+																							public void onClick(
+																									DialogInterface dialog,
+																									int whichButton)
+																							{
+
+																								SQLiteDatabase db = dbUtil
+																										.OpenDB(MainActivity.this,
+																												null,
+																												true);
+																								TextView pidval = (TextView) findViewById(R.id.pidval);
+																								String pid = pidval
+																										.getText()
+																										.toString();
+																								for (int i = 0; i < photoList
+																										.size(); i++)
+																								{
+
+																									ContentValues cv = new ContentValues();
+																									cv.put("picker",
+																											RedAntApplication.user);
+																									cv.put("server",
+																											RedAntApplication.active_address);
+																									cv.put("err_code",
+																											Network.STATUS_WAIT);
+																									cv.put("pid",
+																											pid);
+																									cv.put("local_path",
+																											photoList
+																													.get(i));
+																									db.insert(
+																											"pics",
+																											null,
+																											cv);
+
+																								}
+																								dbUtil.CloseDB(db);
+																								// new
+																								// UploadTask().execute((Void)
+																								// null);
+																								clearfornew();
+																								sendBroadcast(new Intent(
+																										"REDANT.POP.RESET_LOCATION"));
+																								Intent intent = new Intent(
+																										"REDANT.POP.MODIFY_QUEUE");
+																								sendBroadcast(intent);
+
+
+																							}
+																						})
+																				.setNegativeButton(
+																						android.R.string.cancel,
+																						new DialogInterface.OnClickListener()
+																						{
+																							public void onClick(
+																									DialogInterface dialog,
+																									int whichButton)
+																							{
+																								// debug
+																								// update_location();
+																							}
+																						})
+																				.create()
+																				.show();
+
+																	}
+																	else if ("REDANT.POP.STATION_CHANGE"
+																			.equals(action))
+																	{
+																		
+																		sendBroadcast(new Intent(
+																				"REDANT.POP.RESET_LOCATION"));
+																		new AlertDialog.Builder(
+																				MainActivity.this)
+																				.setIconAttribute(
+																						android.R.attr.alertDialogIcon)
+																				.setTitle(
+																						R.string.location_changed)
+																				.setMessage(
+																						"We have detected that your position has changed,do you want to modify the server setting? ")
+																				.setPositiveButton(
+																						android.R.string.ok,
+																						new DialogInterface.OnClickListener()
+																						{
+																							public void onClick(
+																									DialogInterface dialog,
+																									int whichButton)
+																							{
+
+																								Intent intent = new Intent();
+																								intent.setClass(
+																										MainActivity.this,
+																										ServerSettingActivity.class);
+																								startActivity(intent);
+																							}
+																						})
+																				.setNegativeButton(
+																						android.R.string.cancel,
+																						new DialogInterface.OnClickListener()
+																						{
+																							public void onClick(
+																									DialogInterface dialog,
+																									int whichButton)
+																							{
+
+																								// debug
+																								// update_location();
+																							}
+																						})
+																				.create()
+																				.show();
+
+																	}
+																	else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_success));
+																		m_tvalert
+																				.setText("Upload successes!");
+
+																	}
+																	else if ("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_fail));
+																		m_tvalert
+																				.setText("Upload finish with some error!");
+
+																	}
+																	else if ("REDANT.POP.CLEAR_UPLOAD_QUEUE"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_success));
+																		m_tvalert
+																				.setText("Error Cleared.");
+
+																	}
+																	else if (action
+																			.equals(Intent.ACTION_SCREEN_OFF))
+																	{
+																		Log.d("hg",
+																				"�յ��㲥!!!=======>m_blocked="
+																						+ m_blocked);
+																		if (m_blocked == true)
+																			return;
+
+																		SharedPreferences pref = RedAntApplication
+																				.getInstance()
+																				.getSharedPreferences(
+																						"POP",
+																						0);
+																		boolean autologin = pref
+																				.getBoolean(
+																						"kepppass",
+																						false);
+																		if (autologin)
+																			return;
+
+																		Intent activityintent = new Intent();
+																		activityintent
+																				.setClass(
+																						MainActivity.this,
+																						LockerActivity.class);
+																		startActivityForResult(
+																				activityintent,
+																				REQUEST_LOCKER);
+																		Log.d(TAG,
+																				"===================>start locker");
+																		m_blocked = true;
+																	}
+																}
+															};
+
+}

+ 13 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/ModeActivity.java

@@ -0,0 +1,13 @@
+package com.usai.redant.raimage;
+
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+
+public class ModeActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_mode);
+    }
+}

+ 202 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/PhotoPreviewActivity.java

@@ -0,0 +1,202 @@
+package com.usai.redant.raimage;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.media.ThumbnailUtils;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.animation.AnimationUtils;
+import android.widget.HorizontalScrollView;
+import android.widget.ImageSwitcher;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ViewSwitcher;
+import android.widget.Gallery.LayoutParams;
+
+public class PhotoPreviewActivity extends Activity implements
+		ViewSwitcher.ViewFactory
+{
+	private ImageSwitcher	mSwitcher;
+
+	View					current_view	= null;
+	ArrayList<String>		pic_file;
+
+//	
+//
+//	@Override
+//	protected void onDestroy()
+//	{
+//		Intent intent = new Intent();
+//		setResult(Activity.RESULT_OK, intent);
+//		super.onDestroy();
+//	}
+
+	@Override
+	public void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		// requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+		setContentView(R.layout.activity_photo_preview);
+
+		mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
+		mSwitcher.setFactory(this);
+		mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
+				android.R.anim.fade_in));
+		mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
+				android.R.anim.fade_out));
+
+		pic_file = (ArrayList<String>) getIntent().getSerializableExtra(
+				"pic_list");
+
+		findViewById(R.id.hsv);
+		HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv);
+
+		LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout);
+
+		for (int i = 0; i < pic_file.size(); i++)
+		{
+			ImageView imgview = new ImageView(this);
+			//
+			// Bitmap thumb = thumbs.get(i);
+			// if (thumb == null)
+			// {
+			Log.d("getView", "create thumb position:" + i);
+
+			// thumbs.put(i, thumb);
+			// }
+			// Thread thread = new Thread()
+
+			// i.setImageResource(mThumbIds[position]);
+			imgview.setAdjustViewBounds(true);
+			LinearLayout.LayoutParams searchParams = new LinearLayout.LayoutParams(
+					LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1);
+			searchParams.leftMargin = 40;
+			searchParams.topMargin = 10;
+			searchParams.bottomMargin = 10;
+			imgview.setScaleType(ImageView.ScaleType.FIT_CENTER);
+			imgview.setLayoutParams(searchParams);
+			imgview.setBackgroundResource(R.drawable.picture_frame);
+			imgview.setTag(i);
+			Loadtask t = new Loadtask();
+			t.execute(imgview, null);
+			imgview.setOnClickListener(new OnClickListener()
+			{
+
+				@Override
+				public void onClick(View v)
+				{
+					current_view = v;
+					Integer idx = (Integer) v.getTag();
+					mSwitcher.setImageURI(Uri.fromFile(new File(pic_file
+							.get(idx))));
+
+					// v.setSelected(true);
+					// TODO Auto-generated method stub
+
+				}
+			});
+
+			ll.addView(imgview);
+
+			if (i == 0)
+				current_view = imgview;
+
+		}
+		mSwitcher.setImageURI(Uri.fromFile(new File(pic_file.get(0))));
+		// hsv.inflate(context, resource, root)
+
+		// Gallery g = (Gallery) findViewById(R.id.gallery);
+		// g.setAdapter(new ImageAdapter(this));
+		// g.setOnItemSelectedListener(this);
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.preview, menu);
+		return true;
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_delete:
+			{
+				LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout);
+				// ImageView iv= (ImageView) ll.findViewWithTag(current_path);
+				ll.removeView(current_view);
+				mSwitcher.setImageURI(null);
+				Integer idx = (Integer) current_view.getTag();
+				new File(pic_file.get(idx)).delete();
+				current_view = null;
+				// // pic_file.remove(idx);
+			}
+				break;
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	public View makeView()
+	{
+		ImageView i = new ImageView(this);
+		i.setBackgroundColor(0xFF000000);
+		i.setScaleType(ImageView.ScaleType.FIT_CENTER);
+		i.setLayoutParams(new ImageSwitcher.LayoutParams(
+				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
+		return i;
+	}
+
+	// HashMap<Integer, Bitmap> thumbs = new HashMap<Integer, Bitmap>();
+	// private Integer[] mThumbIds = {
+	// };
+
+	// private Integer[] mImageIds = {
+	// };
+	public class Loadtask extends AsyncTask<ImageView, Integer, Boolean>
+	{
+		// int err_code = ERR_CODE_NONE;
+		ImageView	iv		= null;
+		Bitmap		thumb	= null;
+
+		// int netconnect;
+
+		@Override
+		protected Boolean doInBackground(ImageView... params)
+		{
+			iv = params[0];
+			Integer idx = (Integer) iv.getTag();
+			thumb = ThumbnailUtils.extractThumbnail(
+					BitmapFactory.decodeFile(pic_file.get(idx)), 160, 120);
+			return true;
+		}
+
+		@Override
+		protected void onPostExecute(final Boolean success)
+		{
+			iv.setImageBitmap(thumb);
+		}
+
+		@Override
+		protected void onCancelled()
+		{
+
+		}
+	}
+}

+ 56 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/PreferencesActivity.java

@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * The main settings activity.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ * @author Sean Owen
+ */
+public final class PreferencesActivity extends Activity {
+
+  public static final String KEY_DECODE_1D = "preferences_decode_1D";
+  public static final String KEY_DECODE_QR = "preferences_decode_QR";
+  public static final String KEY_DECODE_DATA_MATRIX = "preferences_decode_Data_Matrix";
+  public static final String KEY_CUSTOM_PRODUCT_SEARCH = "preferences_custom_product_search";
+
+  public static final String KEY_PLAY_BEEP = "preferences_play_beep";
+  public static final String KEY_VIBRATE = "preferences_vibrate";
+  public static final String KEY_COPY_TO_CLIPBOARD = "preferences_copy_to_clipboard";
+  public static final String KEY_FRONT_LIGHT_MODE = "preferences_front_light_mode";
+  public static final String KEY_BULK_MODE = "preferences_bulk_mode";
+  public static final String KEY_REMEMBER_DUPLICATES = "preferences_remember_duplicates";
+  public static final String KEY_SUPPLEMENTAL = "preferences_supplemental";
+  public static final String KEY_AUTO_FOCUS = "preferences_auto_focus";
+  public static final String KEY_INVERT_SCAN = "preferences_invert_scan";  
+  public static final String KEY_SEARCH_COUNTRY = "preferences_search_country";
+
+  public static final String KEY_DISABLE_CONTINUOUS_FOCUS = "preferences_disable_continuous_focus";
+  //public static final String KEY_DISABLE_EXPOSURE = "preferences_disable_exposure";
+
+  @Override
+  protected void onCreate(Bundle icicle) {
+    super.onCreate(icicle);
+    getFragmentManager().beginTransaction().replace(android.R.id.content, new PreferencesFragment()).commit();
+
+  }
+
+}

+ 71 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/PreferencesFragment.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2013 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceScreen;
+
+public final class PreferencesFragment 
+    extends PreferenceFragment 
+    implements SharedPreferences.OnSharedPreferenceChangeListener {
+  
+  private CheckBoxPreference decode1D;
+  private CheckBoxPreference decodeQR;
+  private CheckBoxPreference decodeDataMatrix;
+  
+  @Override
+  public void onCreate(Bundle icicle) {
+    super.onCreate(icicle);
+    addPreferencesFromResource(R.xml.preferences);
+    
+    PreferenceScreen preferences = getPreferenceScreen();
+    preferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+    decode1D = (CheckBoxPreference) preferences.findPreference(PreferencesActivity.KEY_DECODE_1D);
+    decodeQR = (CheckBoxPreference) preferences.findPreference(PreferencesActivity.KEY_DECODE_QR);
+    decodeDataMatrix = (CheckBoxPreference) preferences.findPreference(PreferencesActivity.KEY_DECODE_DATA_MATRIX);
+    disableLastCheckedPref();
+  }
+  
+  @Override
+  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+    disableLastCheckedPref();
+  }
+
+  private void disableLastCheckedPref() {
+    Collection<CheckBoxPreference> checked = new ArrayList<CheckBoxPreference>(3);
+    if (decode1D.isChecked()) {
+      checked.add(decode1D);
+    }
+    if (decodeQR.isChecked()) {
+      checked.add(decodeQR);
+    }
+    if (decodeDataMatrix.isChecked()) {
+      checked.add(decodeDataMatrix);
+    }
+    boolean disable = checked.size() < 2;
+    CheckBoxPreference[] checkBoxPreferences = {decode1D, decodeQR, decodeDataMatrix};
+    for (CheckBoxPreference pref : checkBoxPreferences) {
+      pref.setEnabled(!(disable && checked.contains(pref)));
+    }
+  }
+}

+ 111 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/RedAntApplication.java

@@ -0,0 +1,111 @@
+package com.usai.redant.raimage;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import android.app.AlarmManager;
+import android.app.Application;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.SystemClock;
+import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class RedAntApplication extends Application
+{
+    private static RedAntApplication instance;  
+    public static ReadWriteLock lock = new ReentrantReadWriteLock(true);  
+    public static ReadWriteLock loglock = new ReentrantReadWriteLock(true);  
+    public static Lock logwritelock   = loglock.writeLock();   
+    public static Lock writeLock   = lock.writeLock();   
+    public static String user;
+    public static String password;
+    public static String active_address;
+    public static String station_name;
+	public static String device_id;
+    public static RedAntApplication getInstance() {  
+        return instance;  
+    }  
+    
+	public static void startalarm()
+	{
+
+		Intent iAlarm = new Intent("REDANT.POP.RETRY_UPLOAD");
+		//iAlarm.putExtra("caller", caller);
+//		iAlarm.setAction("com.usai.apex.push");
+		PendingIntent sender = PendingIntent.getBroadcast(getInstance(), 0,
+				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+
+		long firstime = SystemClock.elapsedRealtime();
+//		UpdateLastAlermTime();
+		AlarmManager am = (AlarmManager) getInstance().getSystemService(
+				Context.ALARM_SERVICE);
+
+		// 5分钟一个周期,不停的发送广播
+		am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,
+				300 * 1000, sender);
+		Log.d("redant pop","start alarm");
+	}
+
+	public static void cancelalarm()
+	{
+
+		// 启动完成
+		Intent iAlarm = new Intent("REDANT.POP.RETRY_UPLOAD");
+//		iAlarm.setAction("com.usai.apex.push");
+		PendingIntent sender = PendingIntent.getBroadcast(getInstance(), 0,
+				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+
+		AlarmManager am = (AlarmManager) getInstance().getSystemService(
+				Context.ALARM_SERVICE);
+
+		am.cancel(sender);
+		Log.d("redant pop","cancel alarm");
+	}
+    @Override  
+    public void onCreate() {  
+        // TODO Auto-generated method stub  
+        super.onCreate();  
+        instance = this;
+
+
+
+//		TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
+//		String DEVICE_ID = tm.getDeviceId();
+//		if(TextUtils.isEmpty(RedAntApplication.user))
+//			DEVICE_ID= Settings.System.getString(getContentResolver(), Settings.System.ANDROID_ID);
+
+
+		device_id=Settings.Secure.getString(getContentResolver(),Settings.Secure.ANDROID_ID);
+        
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("RA Image", 0);
+
+		String aa = pref.getString("aa", null);
+		String name = pref.getString("station name", null);
+		if(!TextUtils.isEmpty(aa))
+			active_address = aa;
+		if(!TextUtils.isEmpty(name))
+			station_name = name;
+        
+        
+		Intent intentservice = new Intent();
+		intentservice.setClass( this, UploadService.class);
+//		if (intent.getExtras() != null)
+//			intentservice.putExtras(intent.getExtras());
+//		intentservice.setAction(intent.getAction());
+		startService(intentservice);
+		
+
+
+
+
+		
+		
+    }  
+}

+ 267 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/ServerSettingActivity.java

@@ -0,0 +1,267 @@
+package com.usai.redant.raimage;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.RadioGroup;
+import android.widget.Toast;
+
+public class ServerSettingActivity extends Activity
+{
+	static final int	REQUEST_SCAN_BARCODE	= 2;
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_service_setting);
+
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("RA Image", 0);
+
+		String ia = pref.getString("ia", null);
+		String ea = pref.getString("ea", null);
+		String aa = pref.getString("aa", null);
+		String station_name = pref.getString("station name", null);
+		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
+
+		if (!TextUtils.isEmpty(aa) && aa.equals(ia))
+			rg.check(R.id.radio0);
+
+		if (!TextUtils.isEmpty(aa) && aa.equals(ea))
+			rg.check(R.id.radio1);
+
+		EditText et_ia = (EditText) findViewById(R.id.et_ia);
+		EditText et_ea = (EditText) findViewById(R.id.et_ea);
+		EditText et_name = (EditText) findViewById(R.id.et_name);
+		et_ea.setText(ea);
+		et_ia.setText(ia);
+		et_name.setText(station_name);
+
+		ImageButton ibtn = (ImageButton) findViewById(R.id.ibtn_scan);
+		ibtn.setOnClickListener(new OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v)
+			{
+			//	Log.d(TAG, "==============>Click Scan button");
+				Intent intent = new Intent();
+
+				intent.setClass(ServerSettingActivity.this,
+						CaptureActivity.class);
+				startActivityForResult(intent, REQUEST_SCAN_BARCODE);
+
+			}
+		});
+	}
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.server_setting, menu);
+		return true;
+	}
+
+	@Override
+	public void onActivityResult(int requestCode, int resultCode, Intent data)
+	{
+
+		if (requestCode == REQUEST_SCAN_BARCODE)
+		{
+			if (resultCode == Activity.RESULT_OK)
+			{
+				Bundle bundle = data.getExtras();
+				String jstr = bundle.getString("pid");
+				
+				if (jstr == null || jstr.length() <= 0)
+				{
+					//Log.d(TAG, "json is wrong");
+					toast();
+					return ;//Network.RESULT_NET_ERROR;
+				}	
+				String address[]=jstr.split(";");
+				if (address.length<3)
+				{
+					toast();
+					return;
+				}
+				EditText et_ia = (EditText) findViewById(R.id.et_ia);
+				EditText et_ea = (EditText) findViewById(R.id.et_ea);
+				EditText et_name = (EditText) findViewById(R.id.et_name);
+				et_ea.setText(address[2].trim());
+				et_ia.setText(address[1].trim());
+				et_name.setText(address[0].trim());
+//				JSONObject jsobj;
+//				try
+//				{
+//					jsobj = new JSONObject(jstr);
+//					if (jsobj.length() > 0)
+//					{
+//						String name = jsobj.getString("name");
+//						String ia = jsobj.getString("ia");
+//						String ea = jsobj.getString("ea");
+//						EditText et_ia = (EditText) findViewById(R.id.et_ia);
+//						EditText et_ea = (EditText) findViewById(R.id.et_ea);
+//						et_ea.setText(ea);
+//						et_ia.setText(ia);
+////						int iresult = jsobj.getInt("result");
+////						if (iresult == Network.AP_USER_AUTH)
+////						{
+////							return ;//RESULT_TRUE;
+////						}
+////
+////						else
+////						{
+////
+////							return ;//RESULT_FALSE;
+////						}
+//					}
+//					return ;
+//				}
+//				catch (JSONException e)
+//				{
+//					// TODO Auto-generated catch block
+//					e.printStackTrace();
+//					return ;
+//				}
+				//Log.d(TAG,
+//						"REQUEST_SCAN_BARCODE==========>pid="
+//								+ bundle.getString("pid"));
+//				TextView pidval = (TextView) findViewById(R.id.pidval);
+//				pidval.setText(pid);
+//				updateUploadButton();
+			}
+		}
+		super.onActivityResult(requestCode, resultCode, data);
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// Handle action bar item clicks here. The action bar will
+		// automatically handle clicks on the Home/Up button, so long
+		// as you specify a parent activity in AndroidManifest.xml.
+		int id = item.getItemId();
+		if (id == R.id.action_save)
+		{
+			EditText et_ia = (EditText) findViewById(R.id.et_ia);
+			EditText et_ea = (EditText) findViewById(R.id.et_ea);
+			EditText et_name = (EditText) findViewById(R.id.et_name);
+			String ia = et_ia.getText().toString();
+			String ea = et_ea.getText().toString();
+			String name = et_name.getText().toString();
+			if (TextUtils.isEmpty(ia) && TextUtils.isEmpty(ea))
+			{
+				showdialog("Active server address can not be empty!");
+				return true;
+			}
+
+			SharedPreferences pref = RedAntApplication.getInstance()
+					.getSharedPreferences("RA Image", 0);
+			SharedPreferences.Editor editor = pref.edit();
+			if (TextUtils.isEmpty(name))
+			{
+				showdialog("Station name can not be empty!");
+				return true;
+			}
+			else {
+				
+				editor.putString("station name", name);
+			}
+			if (!TextUtils.isEmpty(ia))
+			{
+
+				if (!ia.substring(ia.length() - 1).equals("/"))
+					ia = ia + "/";
+				editor.putString("ia", ia);
+			}
+			if (!TextUtils.isEmpty(ea))
+			{
+				if (!ea.substring(ea.length() - 1).equals("/"))
+					ea = ea + "/";
+				editor.putString("ea", ea);
+			}
+			RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
+			if (rg.getCheckedRadioButtonId() == R.id.radio0)
+			{
+				if (!TextUtils.isEmpty(ia))
+				{
+					editor.putString("aa", ia);
+					RedAntApplication.active_address = ia;
+				}
+				else
+				{
+					showdialog("Active server address can not be empty!");
+					return true;
+				}
+			}
+			else
+			{
+				if (!TextUtils.isEmpty(ea))
+				{
+					editor.putString("aa", ea);
+					RedAntApplication.active_address = ea;
+				}
+				else
+				{
+					showdialog("Active server address can not be empty!");
+					return true;
+				}
+			}
+			RedAntApplication.station_name = name;
+
+			editor.remove("Lat");
+			editor.remove("Lon");
+			editor.commit();
+			//sendBroadcast(new Intent("REDANT.POP.RESET_LOCATION"));
+
+
+			String result = pref.getString("aa","");
+			Intent intent = new Intent();
+			intent.putExtra("server", result);
+                /*
+                 * 调用setResult方法表示我将Intent对象返回给之前的那个Activity,这样就可以在onActivityResult方法中得到Intent对象,
+                 */
+			setResult(1001, intent);
+			finish();
+			return true;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	private void toast()
+	{
+		Toast toast = Toast.makeText(this,"Wrong server setting format",
+				Toast.LENGTH_LONG);
+		toast.setGravity(Gravity.CENTER, 0, 0);
+		toast.show();
+	}
+	private void showdialog(String msg)
+	{
+		new AlertDialog.Builder(ServerSettingActivity.this)
+				.setIcon(android.R.drawable.ic_dialog_info).setTitle("Error!")
+				.setMessage(msg)
+				.setPositiveButton("OK", new DialogInterface.OnClickListener()
+				{
+					public void onClick(DialogInterface dialog, int whichButton)
+					{
+
+						// finish();
+						/* User clicked OK so do some stuff */
+					}
+				}).show();
+	}
+}

+ 439 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/UploadQueueActivity.java

@@ -0,0 +1,439 @@
+package com.usai.redant.raimage;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
+
+import android.app.AlertDialog;
+import android.app.ListActivity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.SimpleCursorAdapter;
+import android.widget.TextView;
+
+public class UploadQueueActivity extends ListActivity
+{
+	private SQLiteDatabase m_db = null;
+	private Cursor m_cursor = null;
+	RecordsAdapter m_listadapter;
+	private TextView					m_tvalert;
+	Timer timer = new Timer();
+	TimerTask task = new TimerTask()
+	{
+		boolean change = false;
+		public void run()
+		{
+		 
+			runOnUiThread(new Runnable()
+			{
+				public void run()
+				{
+					if (change)
+					{
+						change = false;
+						m_tvalert.setTextColor(Color.TRANSPARENT); // 这个是透明,=看不到文字
+					}
+					else
+					{
+						change = true;
+						m_tvalert.setTextColor(getResources().getColor(
+								R.color.message_success));
+					}
+				}
+			});
+		}
+	};
+	public class RecordsAdapter extends SimpleCursorAdapter
+	{
+
+
+		public RecordsAdapter(Context context, int layout, Cursor c,
+				String[] from, int[] to)
+		{
+			
+			super(context, layout, c, from, to);
+			// TODO Auto-generated constructor stub
+		}
+
+		
+
+		@Override
+		public void bindView(View view, Context context, Cursor cursor)
+		{
+			 String path = cursor.getString(3);
+			 int err_code = cursor.getInt(1);
+
+			File f = new File(path);
+			final String filename=f.getName();
+		
+			final TextView filetext = (TextView) view.findViewById(R.id.filename);
+			filetext.setText(filename);
+			
+			final TextView err_codetext = (TextView) view.findViewById(R.id.err_code);
+			switch (err_code)
+			{
+				case Network.RESULT_LOCALFILE_ERROR:
+					err_codetext.setText("Local file error.");
+					break;
+				case Network.RESULT_NET_ERROR:
+					err_codetext.setText("Network error.");
+					break;
+				case Network.RESULT_USERAUTH_ERROR:
+					err_codetext.setText("User authorization error.");
+					break;
+				case Network.RESULT_ERROR:
+					err_codetext.setText("Unknown error.");
+					break;
+				case Network.RESULT_FALSE:
+					err_codetext.setText("Upload failed.");
+					break;
+				case Network.STATUS_WAIT:
+					err_codetext.setText("Wait for upload.");
+					break;
+			
+				default:
+					break;
+			}
+			super.bindView(view, context, cursor);
+
+	
+
+		}
+
+	}
+
+	@Override
+	protected void onDestroy()
+	{
+		unregisterReceiver(UploadQueueReceiver);
+		dbUtil.CloseDB(m_db);
+		super.onDestroy();
+	}
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.uploadqueue, menu);
+		return true;
+	}
+	
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_clearfailed:
+				dbgUtil.fileLog("menu item clear click , clear...");
+			//	clear();
+				
+				
+				new AlertDialog.Builder(
+						UploadQueueActivity.this)
+						.setIconAttribute(
+								android.R.attr.alertDialogIcon)
+						.setTitle(
+								R.string.confirm_to_delete)
+						.setMessage(
+								"Are you sure to clear error records?")
+						.setPositiveButton(
+								android.R.string.ok,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(
+											DialogInterface dialog,
+											int whichButton)
+									{
+										
+										SQLiteDatabase dbr = dbUtil.OpenDB(UploadQueueActivity.this, null, false);
+										Cursor cursor = dbr.query("pics", new String[] { "_id", 
+												"local_path" }, "try_count>=3", null, null, null, "_id", null);
+										while (cursor.moveToNext())
+										{
+											int _id = cursor.getInt(0);
+											String path = cursor.getString(1);
+											
+											
+											RedAntApplication.writeLock.lock();
+
+											// write sql process
+											SQLiteDatabase dbw = dbUtil.OpenDB(UploadQueueActivity.this,
+													null, true);
+											dbw.execSQL("delete from pics where _id= "+_id);
+
+											String timeStamp = new SimpleDateFormat("yyyy_MM_dd")
+													.format(new Date());
+
+											File storageDir = new File(Environment
+													.getExternalStorageDirectory().getPath()
+													+ "/redant/pop/done/" + timeStamp);
+
+											if (!storageDir.exists())
+												storageDir.mkdirs();
+
+											File pic = new File(path);
+											
+											pic.delete();
+											dbUtil.CloseDB(dbw);
+											RedAntApplication.writeLock.unlock();
+											
+										}
+										
+										dbUtil.CloseCursor(cursor);
+										dbUtil.CloseDB(dbr);
+
+										sendBroadcast(new Intent("REDANT.POP.UPDATE_QUEUE_VIEW"));
+										sendBroadcast(new Intent("REDANT.POP.CLEAR_UPLOAD_QUEUE"));
+									}
+								})
+						.setNegativeButton(
+								android.R.string.cancel,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(
+											DialogInterface dialog,
+											int whichButton)
+									{
+										// debug
+										// update_location();
+									}
+								})
+						.create()
+						.show();
+				break;
+
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+//		user = ApexTrackingApplication.get_user();
+//		
+//		password = ApexTrackingApplication.get_pass();
+//		function_name = getIntent().getStringExtra("function_name");
+		setContentView(R.layout.activity_search);
+		m_db = dbUtil.OpenDB(this, null, true);
+		// m_TextView = (TextView) findViewById(R.id.summarytext);
+		// m_TextView.setText(getString(m_Activityinfo.TextViewValue));
+		// m_ListView = (ListView) findViewById(android.R.id.list);
+		m_cursor = m_db.query("pics", new String[] { "picker",
+				"err_code", "pid", "local_path","_id" }, null, null, null, null,
+				"_id", null);
+		startManagingCursor(m_cursor);
+		m_listadapter = new RecordsAdapter(this,
+		// Use a template that displays a text view
+				R.layout.search_lvitem_edit,
+				// Give the cursor to the list adatper
+				m_cursor,
+				// Map the NAME column in the people database to...
+				new String[] { "pid",  "picker" },
+				// The "text1" view defined in the XML template
+				new int[] { R.id.pidval, R.id.picker });
+		setListAdapter(m_listadapter);
+//		Button btnok = (Button) findViewById(R.id.btnok);
+//		btnok.setOnClickListener(this);
+//		Button btncancel = (Button) findViewById(R.id.btncancel);
+//		btncancel.setOnClickListener(this);
+//
+//		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
+
+//		String vername;
+//		try
+//		{
+//			vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
+//			boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
+//					+ "_search", true);
+//			if (bFirstRun)
+//			{
+//				SharedPreferences.Editor editor = RunOnce.edit();
+//				editor.putBoolean("FirstRun" + vername + "_search", false);
+//				// Don't forget to commit your edits!!!
+//				editor.commit();
+//				Intent intent = new Intent();
+//				intent.setClass(this, HelpActivity.class);
+//				intent.putExtra("caller", "search");
+//				startActivity(intent);
+//
+//			}
+//		}
+//		catch (NameNotFoundException e)
+//		{
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+		// initlist();
+
+		// m_ListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+
+		// m_listadapter = new FieldsAdapter(this, data, resource, from, to);
+
+		// m_listadapter = new RecordsAdapter(this,
+		// // Use a template that displays a text view
+		// m_iListItemID,
+		// // Give the cursor to the list adatper
+		// m_cursor,
+		// // Map the NAME column in the people database to...
+		// m_sDispFields,
+		// // The "text1" view defined in the XML template
+		// m_iViewIDs);
+		IntentFilter msgFilter = new IntentFilter();
+		
+		msgFilter.addAction("REDANT.POP.UPDATE_QUEUE_VIEW");
+		msgFilter.addAction("REDANT.POP.UPLOAD_STATE_TRUE");
+		msgFilter.addAction("REDANT.POP.UPLOAD_STATE_FALSE");
+		msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE");
+		
+		registerReceiver(UploadQueueReceiver, msgFilter);
+		
+		m_tvalert = (TextView) findViewById(R.id.tvalert);
+		m_tvalert.setSelected(true);
+
+		
+		//timer.schedule(task, 1, 300); // 参数分别是delay(多长时间后执行),duration(执行间隔)
+		sendBroadcast(new Intent("REDANT.POP.QUERY_UPLOAD_STATE"));
+		
+	}
+
+//	private void RefreshList()
+//	{
+//		// if (dbUtil.isRecordExist(m_db,
+//		// "user_numberlist","type = "+m_Activityinfo.NumberType))
+//		// {
+//		// m_TextView.setVisibility(ListView.INVISIBLE);
+//		// m_ListView.setVisibility(ListView.VISIBLE);
+//		//
+//		// }
+//		// else
+//		// {
+//		// m_TextView.setVisibility(ListView.VISIBLE);
+//		// m_ListView.setVisibility(ListView.INVISIBLE);
+//		// }
+//		hashMap.clear();
+//		m_cursor.requery();
+//	}
+
+	// private void initlist()
+	// {
+	// m_ListView = (ListView) findViewById(android.R.id.list);
+	// ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String,
+	// Object>>();
+	// HashMap<String, Object> map = null;
+	//
+	// String[] strings = { "alias", "type", "name" };// Map的key集合数组
+	// int[] ids = { R.id.aliasName, R.id.tv_type };// 对应布局文件的id
+	// SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,
+	// R.layout.search_lvitem_edit, strings, ids);
+	//
+	// // listView1.setAdapter(simpleAdapter);//绑定适配器
+	// setListAdapter(simpleAdapter);
+	// }
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		// Inflate the menu; this adds items to the action bar if it is present.
+//		getMenuInflater().inflate(R.menu.search, menu);
+//		return true;
+//	}
+
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		Intent intent = new Intent();
+//		switch (item.getItemId())
+//		{
+//		case R.id.action_custom_fields:
+//			intent.setClass(this, CustomizeFieldsActivity.class);
+//			intent.putExtra("user", user);
+//			// intent.putExtra("password", password);
+//			intent.putExtra("function_name", function_name);
+//			intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
+//			startActivity(intent);
+//			break;
+//		case R.id.action_help:
+//			// Intent intent = new Intent();
+//			intent.setClass(this, HelpActivity.class);
+//			intent.putExtra("caller", "search");
+//			// // intent.putExtra("password", password);
+//			// intent.putExtra("function_name", function_name);
+//			// intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
+//			startActivity(intent);
+//			break;
+//		default:
+//			break;
+//		}
+//		return super.onOptionsItemSelected(item);
+//	}
+	private final BroadcastReceiver	UploadQueueReceiver	= new BroadcastReceiver()
+	{
+
+		public void onReceive(
+				Context context,
+				Intent intent)
+		{
+			String action = intent
+					.getAction();
+			// 如果捕捉到的action是ACTION_BATTERY_CHANGED
+
+			if ("REDANT.POP.UPDATE_QUEUE_VIEW"
+					.equals(action))
+			{
+				m_cursor.requery();
+				
+
+			}
+			else if ("REDANT.POP.UPLOAD_STATE_FALSE"
+					.equals(action))
+			{
+				timer.cancel();
+				m_tvalert.setText("");
+//				m_tvalert.setTextColor(getResources().getColor(
+//						R.color.message_success));
+				
+				
+				
+			}
+			else if ("REDANT.POP.UPLOAD_STATE_TRUE"
+					.equals(action))
+			{
+				m_tvalert.setText("Uploading ...");
+				timer.schedule(task, 1, 300);
+				
+				
+			}
+			else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
+					.equals(action))
+			{
+				timer.cancel();
+				m_tvalert.setText("Finish upload.");
+				m_tvalert.setTextColor(getResources().getColor(
+						R.color.message_success));
+				
+				
+			}
+			
+		}
+	};
+	
+}

+ 649 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/UploadService.java

@@ -0,0 +1,649 @@
+package com.usai.redant.raimage;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.usai.util.Crypto;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
+
+import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.IBinder;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class UploadService extends Service
+{
+
+	private UploadThread	uploadThread;
+
+	private boolean			queue_changed	= false;
+	LocationManager			locationManager;
+	LocationListener		locationListener;
+
+	// private boolean location_changed = false;
+
+	@Override
+	public IBinder onBind(Intent intent)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void onCreate()
+	{
+
+		Log.d("", "create upload Service!!!");
+		if (uploadThread == null)
+		{
+			uploadThread = new UploadThread();
+			Log.d("", "create upload thread!!!");
+			// upleadThread.start();
+
+		}
+
+		IntentFilter msgFilter = new IntentFilter();
+
+		msgFilter.addAction("REDANT.POP.MODIFY_QUEUE");
+		msgFilter.addAction("REDANT.POP.GPS_ON");
+		msgFilter.addAction("REDANT.POP.GPS_OFF");
+		msgFilter.addAction("REDANT.POP.REQUEST_LOCATION");
+		msgFilter.addAction("REDANT.POP.RESET_LOCATION");
+		msgFilter.addAction("REDANT.POP.QUERY_UPLOAD_STATE");
+		msgFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
+		msgFilter.addAction("REDANT.POP.RETRY_UPLOAD");
+		
+		registerReceiver(uploadReceiver, msgFilter);
+		// registerReceiver(uploadReceiver,
+		// new IntentFilter("modify upload queue"));
+
+		locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+
+		locationListener = new LocationListener()
+		{
+
+			// Provider的状态在可用、暂时不可用和无服务三个状态直接切换时触发此函数
+			@Override
+			public void onStatusChanged(String provider, int status,
+					Bundle extras)
+			{
+
+			}
+
+			// Provider被enable时触发此函数,比如GPS被打开
+			@Override
+			public void onProviderEnabled(String provider)
+			{
+
+			}
+
+			// Provider被disable时触发此函数,比如GPS被关闭
+			@Override
+			public void onProviderDisabled(String provider)
+			{
+
+			}
+
+			// 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
+			@Override
+			public void onLocationChanged(Location location)
+			{
+				// if (location != null)
+				// {
+				// location_changed = true;
+				// Log.d("Map",
+				// "Location changed : Lat: " + location.getLatitude()
+				// + " Lng: " + location.getLongitude());
+				// }
+			}
+		};
+
+		super.onCreate();
+
+	}
+
+	void gps_off()
+	{
+		locationManager.removeUpdates(locationListener);
+	}
+
+	void gps_on()
+	{
+		if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
+		{
+
+			locationManager.requestLocationUpdates(
+					LocationManager.GPS_PROVIDER, 60 * 1000, 50,
+					locationListener);
+
+		}
+		else if (locationManager
+				.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
+		{
+
+			locationManager.requestLocationUpdates(
+					LocationManager.NETWORK_PROVIDER, 30 * 1000, 50,
+					locationListener);
+
+		}
+	}
+
+	void update_location()
+	{
+
+		Location location = null;
+		if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
+		{
+
+			location = locationManager
+					.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+
+		}
+		else if (locationManager
+				.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
+		{
+
+			location = locationManager
+					.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
+
+		}
+
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("RA Image", 0);
+
+		SharedPreferences.Editor editor = pref.edit();
+		if (location != null)
+		{
+
+			editor.putFloat("Lat", (float) location.getLatitude());
+			editor.putFloat("Lon", (float) location.getLongitude());
+
+		}
+		editor.commit();
+
+	}
+
+	void check_location()
+	{
+
+		Location location = null;
+		if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
+		{
+
+			location = locationManager
+					.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+
+		}
+		else if (locationManager
+				.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
+		{
+
+			location = locationManager
+					.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
+
+		}
+
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("RA Image", 0);
+		double lat = pref.getFloat("Lat", 9999);
+		double lon = pref.getFloat("Lon", 9999);
+
+		// SharedPreferences.Editor editor = pref.edit();
+		if (location != null)
+		{
+			float[] result = new float[1];
+			if (lat != 9999 && lon != 9999)
+			{
+				Location.distanceBetween(lat, lon, location.getLatitude(),
+						location.getLongitude(), result);
+				if (result[0] > 1000)
+				{
+					sendBroadcast(new Intent("REDANT.POP.STATION_CHANGE"));
+					return;
+				}
+				else
+				{
+					sendBroadcast(new Intent("REDANT.POP.STATION_NOT_CHANGE"));
+					return;
+				}
+			}
+			sendBroadcast(new Intent("REDANT.POP.STATION_NOT_CHANGE"));
+			return;
+			// new Location();
+			//
+			// Location.distanceBetween(lat, lon, endLatitude, endLongitude,
+			// results)
+			//
+			// editor.putFloat("Lat", (float) location.getLatitude());
+			// editor.putFloat("Lon", (float) location.getLongitude());
+
+		}
+		else
+		{
+			sendBroadcast(new Intent("REDANT.POP.STATION_NOT_CHANGE"));
+			return;
+		}
+		// editor.commit();
+
+		// Log.d("location:", "lat:" + latitude + "lon:" + longitude);
+	}
+
+	// void loadlist()
+	// {
+	//
+	// }
+
+	public class UploadThread extends Thread
+	{
+		@Override
+		public void run()
+		{
+
+			Log.d("", "upload thread running");
+
+			super.run();
+			doupload();
+			Log.d("", "upload thread stop");
+
+		}
+
+		private void doupload()
+		{
+			boolean error = false;
+			boolean didupload = false;
+			// int verifyresult = Network.VerifyUser(RedAntApplication.user,
+			// RedAntApplication.password);
+			// if (verifyresult == Network.RESULT_TRUE)
+			// {
+			SQLiteDatabase dbr = dbUtil.OpenDB(UploadService.this, null, false);
+			Cursor cursor = dbr.query("pics", new String[] { "_id", "pid",
+					"local_path", "picker", "server" }, "err_code!="
+					+ Network.AP_UPLOAD_SUCCESS+" and err_code!="+ Network.RESULT_LOCALFILE_ERROR+" and try_count<3 ", null, null, null, "_id", null);
+			while (cursor.moveToNext())
+			{
+				didupload = true;
+				if (queue_changed)
+				{
+					queue_changed = false;
+					dbUtil.CloseCursor(cursor);
+					cursor = dbr.query("pics", new String[] { "_id", "pid",
+							"local_path", "picker", "server" }, "err_code!="
+							+ Network.AP_UPLOAD_SUCCESS+" and err_code!="+ Network.RESULT_LOCALFILE_ERROR +" and try_count<3 ", null, null, null,
+							"_id", null);
+					if (!cursor.moveToNext())
+						break;
+
+				}
+				int _id = cursor.getInt(0);
+				String pid = cursor.getString(1);
+				String path = cursor.getString(2);
+				String picker = cursor.getString(3);
+				String server = cursor.getString(4);
+
+				String encryptUser = "";
+
+				try
+				{
+					encryptUser = Crypto.encrypt("apexu", picker);
+
+				}
+				catch (Exception e1)
+				{
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+
+				Cursor cursor_user = dbr.query("users",
+						new String[] { "pass" }, "name='" + encryptUser + "'",
+						null, null, null, "_id", null);
+				String pass = "";
+				if (cursor_user.moveToNext())
+					pass = cursor_user.getString(0);
+				try
+				{
+					pass = Crypto.decrypt("apexp", pass);
+				}
+				catch (Exception e)
+				{
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+
+				int uploadresult = Network.UploadImage(path, picker, pass, pid,
+						server);
+				if (uploadresult == Network.RESULT_TRUE)
+				{
+				
+					RedAntApplication.writeLock.lock();
+
+					// write sql process
+					SQLiteDatabase dbw = dbUtil.OpenDB(UploadService.this,
+							null, true);
+					// String sql = "update pics set err_code ="
+					// + Network.AP_UPLOAD_SUCCESS + " where _id="
+					// + _id;
+					String sql = "delete from pics  where _id=" + _id;
+					dbw.execSQL(sql);
+
+					String timeStamp = new SimpleDateFormat("yyyy_MM_dd")
+							.format(new Date());
+
+					File storageDir = new File(Environment
+							.getExternalStorageDirectory().getPath()
+							+ "/redant/pop/done/" + timeStamp);
+
+					if (!storageDir.exists())
+						storageDir.mkdirs();
+
+					File pic = new File(path);
+					// pic.delete();
+
+					dbUtil.CloseDB(dbw);
+					RedAntApplication.writeLock.unlock();
+					dbgUtil.fileLog("upload success move file "
+							+ pic.getName()
+							+ " to "
+							+ Environment.getExternalStorageDirectory()
+									.getPath() + "/redant/pop/done/"
+							+ timeStamp + File.separator);
+					pic.renameTo(new File(Environment
+							.getExternalStorageDirectory().getPath()
+							+ "/redant/pop/done/"
+							+ timeStamp
+							+ File.separator
+							+ pic.getName()));
+					
+
+				}
+				else
+				{
+					error = true;
+					RedAntApplication.writeLock.lock();
+
+					{
+						// write sql process
+						SQLiteDatabase dbw = dbUtil.OpenDB(UploadService.this,
+								null, true);
+						String sql = "update pics set err_code ="
+								+ uploadresult + ", try_count = try_count+1 where _id=" + _id;
+
+						dbw.execSQL(sql);
+						dbUtil.CloseDB(dbw);
+					}
+					RedAntApplication.writeLock.unlock();
+					dbgUtil.fileLog("upload failed pid:" + pid + " file:"
+							+ path + " server:" + server + " err_code:"
+							+ uploadresult);
+					
+				}
+
+				sendBroadcast(new Intent("REDANT.POP.UPDATE_QUEUE_VIEW"));
+			}
+
+			dbUtil.CloseCursor(cursor);
+			dbUtil.CloseDB(dbr);
+
+			// }
+			// else
+			// {
+			// Log.d("upload thread", "user check failed!");
+			//
+			// sendBroadcast(new Intent("REDANT.POP.USER_CHECK_FAILED"));
+			// }
+
+			if (queue_changed)
+			{
+				queue_changed = false;
+				doupload();
+			}
+			if (didupload)
+			{
+				if (error)
+				{
+					sendBroadcast(new Intent(
+							"REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"));
+					RedAntApplication.startalarm();
+				}
+				else
+				{
+					sendBroadcast(new Intent("REDANT.POP.FINISH_UPLOAD_QUEUE"));
+					RedAntApplication.cancelalarm();
+				}
+			}
+		}
+	}
+
+	private BroadcastReceiver	uploadReceiver	= new BroadcastReceiver()
+												{
+
+													public void onReceive(
+															Context context,
+															Intent intent)
+													{
+														String action = intent
+																.getAction();
+														// 如果捕捉到的action是ACTION_BATTERY_CHANGED
+
+														if ("REDANT.POP.REQUEST_LOCATION"
+																.equals(action))
+														{
+															check_location();
+															// if
+															// (location_changed)
+															// sendBroadcast(new
+															// Intent(
+															// "REDANT.POP.CHANGE_STATION"));
+
+														}
+														else if ("REDANT.POP.RETRY_UPLOAD"
+																.equals(action))
+														{
+															if (uploadThread != null)
+															{
+																if (uploadThread
+																		.isAlive())
+																{
+
+																	Log.d("uploadReceiver",
+																			"upload thread alive");
+																}
+																else
+																{
+																	Log.d("uploadReceiver",
+																			"start upload thread");
+																	uploadThread = new UploadThread();
+																	uploadThread
+																			.start();
+																}
+															}
+														}
+														else if ("REDANT.POP.GPS_ON"
+																.equals(action))
+														{
+															gps_on();
+														}
+														else if ("REDANT.POP.GPS_OFF"
+																.equals(action))
+														{
+
+															gps_off();
+														}
+														else if ("REDANT.POP.RESET_LOCATION"
+																.equals(action))
+														{
+															update_location();
+															// location_changed
+															// = false;
+														}
+														else if ("REDANT.POP.MODIFY_QUEUE"
+																.equals(action))
+														{
+															Log.d("uploadservice",
+																	"recieve upload queue change");
+															// update_location();
+															if (uploadThread != null)
+															{
+																if (uploadThread
+																		.isAlive())
+																{
+
+																	Log.d("uploadReceiver",
+																			"upload thread alive");
+																}
+																else
+																{
+																	Log.d("uploadReceiver",
+																			"start upload thread");
+																	uploadThread = new UploadThread();
+																	uploadThread
+																			.start();
+																}
+															}
+														}
+														else if ("REDANT.POP.QUERY_UPLOAD_STATE"
+																.equals(action))
+														{
+															if (uploadThread
+																	.isAlive())
+															{
+																sendBroadcast(new Intent(
+																		"REDANT.POP.UPLOAD_STATE_TRUE"));
+															}
+															else
+															{
+																sendBroadcast(new Intent(
+																		"REDANT.POP.UPLOAD_STATE_FALSE"));
+															}
+														}
+														else if (intent
+																.getAction()
+																.equals(ConnectivityManager.CONNECTIVITY_ACTION))
+														{
+
+															ConnectivityManager connManager = (ConnectivityManager) context
+																	.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+															NetworkInfo networkInfo = connManager
+																	.getActiveNetworkInfo();
+															if (networkInfo == null)
+															{
+																dbgUtil.Logd(
+																		"Current Network info",
+																		"can not get Active NetworkInfo!");
+																return;
+															}
+															NetworkInfo.State netState = networkInfo
+																	.getState();
+															if (netState != NetworkInfo.State.CONNECTED)
+															{
+																dbgUtil.Logd(
+																		"Current Network info",
+																		"not Connected!State="
+																				+ netState);
+																return;
+															}
+															int iconntype = -1;
+															iconntype = networkInfo
+																	.getType();
+															SharedPreferences pref = RedAntApplication
+																	.getInstance()
+																	.getSharedPreferences(
+																			"POP",
+																			0);
+
+															String aa = pref
+																	.getString(
+																			"aa",
+																			null);
+															String ea = pref
+																	.getString(
+																			"ea",
+																			null);
+															if (iconntype == ConnectivityManager.TYPE_WIFI)
+															{
+																if (!TextUtils
+																		.isEmpty(aa))
+																	RedAntApplication.active_address = aa;
+															}
+															else
+															{
+																if (!TextUtils
+																		.isEmpty(ea))
+																	RedAntApplication.active_address = ea;
+															}
+															// boolean
+															// bUseMobileNetwork
+															// =
+															// context.getSharedPreferences(
+															// "PhoneAsstPref",
+															// 0).getBoolean("UseMobileNetwork",
+															// false);
+															//
+															// if
+															// (bUseMobileNetwork
+															// == false
+															// && iconntype !=
+															// ConnectivityManager.TYPE_WIFI
+															// && iconntype !=
+															// 9/* earthnet */)
+															// {
+															// dbgUtil.Log(Log.DEBUG,
+															// "Current Network info",
+															// "not allowed!Connection type="
+															// +
+															// networkInfo.getTypeName());
+															// return false;
+															// }
+															boolean bavailable = networkInfo
+																	.isAvailable();
+															String strtype = networkInfo
+																	.getTypeName();
+
+															dbgUtil.Logd(
+																	"Current Network info",
+																	" type = "
+																			+ strtype
+																			+ " abailable = "
+																			+ bavailable
+																			+ " state "
+																			+ netState);
+															if (bavailable)
+															{
+																if (uploadThread
+																		.isAlive())
+																{
+
+																	Log.d("uploadReceiver",
+																			"upload thread alive");
+																}
+																else
+																{
+																	Log.d("uploadReceiver",
+																			"start upload thread");
+																	uploadThread = new UploadThread();
+																	uploadThread
+																			.start();
+																}
+															}
+
+														}
+													}
+												};
+}

+ 35 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/ViewfinderResultPointCallback.java

@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import com.google.zxing.ResultPoint;
+import com.google.zxing.ResultPointCallback;
+
+final class ViewfinderResultPointCallback implements ResultPointCallback {
+
+  private final ViewfinderView viewfinderView;
+
+  ViewfinderResultPointCallback(ViewfinderView viewfinderView) {
+    this.viewfinderView = viewfinderView;
+  }
+
+  @Override
+  public void foundPossibleResultPoint(ResultPoint point) {
+    viewfinderView.addPossibleResultPoint(point);
+  }
+
+}

+ 187 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/ViewfinderView.java

@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2008 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.usai.redant.raimage;
+
+import com.google.zxing.ResultPoint;
+import com.usai.redant.camera.CameraManager;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This view is overlaid on top of the camera preview. It adds the viewfinder rectangle and partial
+ * transparency outside it, as well as the laser scanner animation and result points.
+ *
+ * @author dswitkin@google.com (Daniel Switkin)
+ */
+public final class ViewfinderView extends View {
+
+  private static final int[] SCANNER_ALPHA = {0, 64, 128, 192, 255, 192, 128, 64};
+  private static final long ANIMATION_DELAY = 80L;
+  private static final int CURRENT_POINT_OPACITY = 0xA0;
+  private static final int MAX_RESULT_POINTS = 20;
+  private static final int POINT_SIZE = 6;
+
+  private CameraManager cameraManager;
+  private final Paint paint;
+  private Bitmap resultBitmap;
+  private final int maskColor;
+  private final int resultColor;
+  private final int laserColor;
+  private final int resultPointColor;
+  private int scannerAlpha;
+  private List<ResultPoint> possibleResultPoints;
+  private List<ResultPoint> lastPossibleResultPoints;
+
+  // This constructor is used when the class is built from an XML resource.
+  public ViewfinderView(Context context, AttributeSet attrs) {
+    super(context, attrs);
+
+    // Initialize these once for performance rather than calling them every time in onDraw().
+    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
+    Resources resources = getResources();
+    maskColor = resources.getColor(R.color.viewfinder_mask);
+    resultColor = resources.getColor(R.color.result_view);
+    laserColor = resources.getColor(R.color.viewfinder_laser);
+    resultPointColor = resources.getColor(R.color.possible_result_points);
+    scannerAlpha = 0;
+    possibleResultPoints = new ArrayList<ResultPoint>(5);
+    lastPossibleResultPoints = null;
+  }
+
+  public void setCameraManager(CameraManager cameraManager) {
+    this.cameraManager = cameraManager;
+  }
+
+  @Override
+  public void onDraw(Canvas canvas) {
+    if (cameraManager == null) {
+      return; // not ready yet, early draw before done configuring
+    }
+    Rect frame = cameraManager.getFramingRect();
+    Rect previewFrame = cameraManager.getFramingRectInPreview();    
+    if (frame == null || previewFrame == null) {
+      return;
+    }
+    int width = canvas.getWidth();
+    int height = canvas.getHeight();
+
+    // Draw the exterior (i.e. outside the framing rect) darkened
+    paint.setColor(resultBitmap != null ? resultColor : maskColor);
+    canvas.drawRect(0, 0, width, frame.top, paint);
+    canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
+    canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1, paint);
+    canvas.drawRect(0, frame.bottom + 1, width, height, paint);
+
+    if (resultBitmap != null) {
+      // Draw the opaque result bitmap over the scanning rectangle
+      paint.setAlpha(CURRENT_POINT_OPACITY);
+      canvas.drawBitmap(resultBitmap, null, frame, paint);
+    } else {
+
+      // Draw a red "laser scanner" line through the middle to show decoding is active
+      paint.setColor(laserColor);
+      paint.setAlpha(SCANNER_ALPHA[scannerAlpha]);
+      scannerAlpha = (scannerAlpha + 1) % SCANNER_ALPHA.length;
+      int middle = frame.height() / 2 + frame.top;
+      canvas.drawRect(frame.left + 2, middle - 1, frame.right - 1, middle + 2, paint);
+      
+      float scaleX = frame.width() / (float) previewFrame.width();
+      float scaleY = frame.height() / (float) previewFrame.height();
+
+      List<ResultPoint> currentPossible = possibleResultPoints;
+      List<ResultPoint> currentLast = lastPossibleResultPoints;
+      int frameLeft = frame.left;
+      int frameTop = frame.top;
+      if (currentPossible.isEmpty()) {
+        lastPossibleResultPoints = null;
+      } else {
+        possibleResultPoints = new ArrayList<ResultPoint>(5);
+        lastPossibleResultPoints = currentPossible;
+        paint.setAlpha(CURRENT_POINT_OPACITY);
+        paint.setColor(resultPointColor);
+        synchronized (currentPossible) {
+          for (ResultPoint point : currentPossible) {
+            canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
+                              frameTop + (int) (point.getY() * scaleY),
+                              POINT_SIZE, paint);
+          }
+        }
+      }
+      if (currentLast != null) {
+        paint.setAlpha(CURRENT_POINT_OPACITY / 2);
+        paint.setColor(resultPointColor);
+        synchronized (currentLast) {
+          float radius = POINT_SIZE / 2.0f;
+          for (ResultPoint point : currentLast) {
+            canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
+                              frameTop + (int) (point.getY() * scaleY),
+                              radius, paint);
+          }
+        }
+      }
+
+      // Request another update at the animation interval, but only repaint the laser line,
+      // not the entire viewfinder mask.
+      postInvalidateDelayed(ANIMATION_DELAY,
+                            frame.left - POINT_SIZE,
+                            frame.top - POINT_SIZE,
+                            frame.right + POINT_SIZE,
+                            frame.bottom + POINT_SIZE);
+    }
+  }
+
+  public void drawViewfinder() {
+    Bitmap resultBitmap = this.resultBitmap;
+    this.resultBitmap = null;
+    if (resultBitmap != null) {
+      resultBitmap.recycle();
+    }
+    invalidate();
+  }
+
+  /**
+   * Draw a bitmap with the result points highlighted instead of the live scanning display.
+   *
+   * @param barcode An image of the decoded barcode.
+   */
+  public void drawResultBitmap(Bitmap barcode) {
+    resultBitmap = barcode;
+    invalidate();
+  }
+
+  public void addPossibleResultPoint(ResultPoint point) {
+    List<ResultPoint> points = possibleResultPoints;
+    synchronized (points) {
+      points.add(point);
+      int size = points.size();
+      if (size > MAX_RESULT_POINTS) {
+        // trim it
+        points.subList(0, size - MAX_RESULT_POINTS / 2).clear();
+      }
+    }
+  }
+
+}

+ 163 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/testfullActivity.java

@@ -0,0 +1,163 @@
+package com.usai.redant.raimage;
+
+import android.annotation.SuppressLint;
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.MotionEvent;
+import android.view.View;
+
+/**
+ * An example full-screen activity that shows and hides the system UI (i.e.
+ * status bar and navigation/system bar) with user interaction.
+ */
+public class testfullActivity extends Activity {
+    /**
+     * Whether or not the system UI should be auto-hidden after
+     * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
+     */
+    private static final boolean AUTO_HIDE = true;
+
+    /**
+     * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
+     * user interaction before hiding the system UI.
+     */
+    private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
+
+    /**
+     * Some older devices needs a small delay between UI widget updates
+     * and a change of the status and navigation bar.
+     */
+    private static final int UI_ANIMATION_DELAY = 300;
+    private final Handler mHideHandler = new Handler();
+    private View mContentView;
+    private final Runnable mHidePart2Runnable = new Runnable() {
+        @SuppressLint("InlinedApi")
+        @Override
+        public void run() {
+            // Delayed removal of status and navigation bar
+
+            // Note that some of these constants are new as of API 16 (Jelly Bean)
+            // and API 19 (KitKat). It is safe to use them, as they are inlined
+            // at compile-time and do nothing on earlier devices.
+            mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
+                    | View.SYSTEM_UI_FLAG_FULLSCREEN
+                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
+        }
+    };
+    private View mControlsView;
+    private final Runnable mShowPart2Runnable = new Runnable() {
+        @Override
+        public void run() {
+            // Delayed display of UI elements
+            ActionBar actionBar = getActionBar();
+            if (actionBar != null) {
+                actionBar.show();
+            }
+            mControlsView.setVisibility(View.VISIBLE);
+        }
+    };
+    private boolean mVisible;
+    private final Runnable mHideRunnable = new Runnable() {
+        @Override
+        public void run() {
+            hide();
+        }
+    };
+    /**
+     * Touch listener to use for in-layout UI controls to delay hiding the
+     * system UI. This is to prevent the jarring behavior of controls going away
+     * while interacting with activity UI.
+     */
+    private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
+        @Override
+        public boolean onTouch(View view, MotionEvent motionEvent) {
+            if (AUTO_HIDE) {
+                delayedHide(AUTO_HIDE_DELAY_MILLIS);
+            }
+            return false;
+        }
+    };
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_testfull);
+
+        mVisible = true;
+        mControlsView = findViewById(R.id.fullscreen_content_controls);
+        mContentView = findViewById(R.id.fullscreen_content);
+
+
+        // Set up the user interaction to manually show or hide the system UI.
+        mContentView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                toggle();
+            }
+        });
+
+        // Upon interacting with UI controls, delay any scheduled hide()
+        // operations to prevent the jarring behavior of controls going away
+        // while interacting with the UI.
+        findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
+    }
+
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+
+        // Trigger the initial hide() shortly after the activity has been
+        // created, to briefly hint to the user that UI controls
+        // are available.
+        delayedHide(100);
+    }
+
+    private void toggle() {
+        if (mVisible) {
+            hide();
+        } else {
+            show();
+        }
+    }
+
+    private void hide() {
+        // Hide UI first
+        ActionBar actionBar = getActionBar();
+        if (actionBar != null) {
+            actionBar.hide();
+        }
+        mControlsView.setVisibility(View.GONE);
+        mVisible = false;
+
+        // Schedule a runnable to remove the status and navigation bar after a delay
+        mHideHandler.removeCallbacks(mShowPart2Runnable);
+        mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
+    }
+
+    @SuppressLint("InlinedApi")
+    private void show() {
+        // Show the system bar
+        mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+        mVisible = true;
+
+        // Schedule a runnable to display UI elements after a delay
+        mHideHandler.removeCallbacks(mHidePart2Runnable);
+        mHideHandler.postDelayed(mShowPart2Runnable, UI_ANIMATION_DELAY);
+    }
+
+    /**
+     * Schedules a call to hide() in [delay] milliseconds, canceling any
+     * previously scheduled calls.
+     */
+    private void delayedHide(int delayMillis) {
+        mHideHandler.removeCallbacks(mHideRunnable);
+        mHideHandler.postDelayed(mHideRunnable, delayMillis);
+    }
+}

+ 242 - 0
RA Image/app/src/main/java/com/usai/util/AES.java

@@ -0,0 +1,242 @@
+package com.usai.util;
+
+import android.util.Base64;
+import android.util.Log;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Security;
+import java.util.Arrays;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+import static android.content.ContentValues.TAG;
+
+/**
+ * Created by ray on 07/06/2017.
+ * AES128 算法
+ *
+ * CBC 模式
+ *
+ * PKCS7Padding 填充模式
+ *
+ * CBC模式需要添加一个参数iv
+ *
+ * 介于java 不支持PKCS7Padding,只支持PKCS5Padding 但是PKCS7Padding 和 PKCS5Padding 没有什么区别
+ * 要实现在java端用PKCS7Padding填充,需要用到bouncycastle组件来实现
+ */
+
+public class AES {
+    // 算法名称
+    final static String KEY_ALGORITHM = "AES";
+    // 加解密算法/模式/填充方式
+    final static String algorithmStr = "AES/CBC/PKCS7Padding";
+    //
+//    private Key key;
+//    private Cipher cipher;
+//    boolean isInited = false;
+
+    static byte[] iv = new byte[16];//{ 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x30, 0x37, 0x30, 0x38 };
+//    private static void init(byte[] keyBytes) {
+//
+//        // 如果密钥不足16位,那么就补足.  这个if 中的内容很重要
+//        int base = 16;
+//        if (keyBytes.length % base != 0) {
+//            int groups = keyBytes.length / base + (keyBytes.length % base != 0 ? 1 : 0);
+//            byte[] temp = new byte[groups * base];
+//            Arrays.fill(temp, (byte) 0);
+//            System.arraycopy(keyBytes, 0, temp, 0, keyBytes.length);
+//            keyBytes = temp;
+//        }
+//        // 初始化
+//        Security.addProvider(new BouncyCastleProvider());
+//        // 转化成JAVA的密钥格式
+//        key = new SecretKeySpec(keyBytes, KEY_ALGORITHM);
+//        try {
+//            // 初始化cipher
+//            cipher = Cipher.getInstance(algorithmStr, "BC");
+//        } catch (NoSuchAlgorithmException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        } catch (NoSuchPaddingException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        } catch (NoSuchProviderException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+//    }
+
+    private static String toHex(byte[] buf)
+    {
+        if (buf == null)
+            return "";
+        StringBuffer result = new StringBuffer(2 * buf.length);
+        for (int i = 0; i < buf.length; i++)
+        {
+            appendHex(result, buf[i]);
+        }
+        return result.toString();
+    }
+    private static void appendHex(StringBuffer sb, byte b)
+    {
+        sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f));
+    }
+    private final static String HEX = "0123456789ABCDEF";
+
+    public static String encrypt(String key,String content)
+    {
+        byte[] result=encrypt(content.getBytes(),key.getBytes());
+        Log.d(TAG, "encrypt: "+toHex(result));
+        return Base64.encodeToString(result,Base64.DEFAULT);
+    }
+
+    public static String decrypt(String key,String content)
+    {
+        byte[] buffer =Base64.decode(content, Base64.DEFAULT);
+
+        byte[] result = decrypt(buffer,key.getBytes());
+
+        return new String(result);
+    }
+
+    /**
+     * 加密方法
+     *
+     * @param content
+     *            要加密的字符串
+     * @param keyBytes
+     *            加密密钥
+     * @return
+     */
+    private static byte[] encrypt(byte[] content, byte[] keyBytes) {
+        byte[] encryptedText = null;
+//        init(keyBytes);
+
+     Key key;
+     Cipher cipher;
+        // 如果密钥不足16位,那么就补足.  这个if 中的内容很重要
+        int base = 16;
+        if (keyBytes.length % base != 0) {
+            int groups = keyBytes.length / base + (keyBytes.length % base != 0 ? 1 : 0);
+            byte[] temp = new byte[groups * base];
+            Arrays.fill(temp, (byte) 0);
+            System.arraycopy(keyBytes, 0, temp, 0, keyBytes.length);
+            keyBytes = temp;
+        }
+        // 初始化
+        Security.addProvider(new BouncyCastleProvider());
+        // 转化成JAVA的密钥格式
+        key = new SecretKeySpec(keyBytes, KEY_ALGORITHM);
+        try {
+            // 初始化cipher
+            cipher = Cipher.getInstance(algorithmStr, "BC");
+
+
+            cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv));
+            encryptedText = cipher.doFinal(content);
+
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (NoSuchProviderException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (BadPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidKeyException e) {
+            e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+            e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e) {
+            e.printStackTrace();
+        }
+
+
+//        System.out.println("IV:" + new String(iv));
+//        try {
+//
+//        } catch (Exception e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+        return encryptedText;
+    }
+    /**
+     * 解密方法
+     *
+     * @param encryptedData
+     *            要解密的字符串
+     * @param keyBytes
+     *            解密密钥
+     * @return
+     */
+    private static byte[] decrypt(byte[] encryptedData, byte[] keyBytes) {
+        byte[] encryptedText = null;
+//        init(keyBytes);
+
+        Key key;
+        Cipher cipher;
+                // 如果密钥不足16位,那么就补足.  这个if 中的内容很重要
+        int base = 16;
+        if (keyBytes.length % base != 0) {
+            int groups = keyBytes.length / base + (keyBytes.length % base != 0 ? 1 : 0);
+            byte[] temp = new byte[groups * base];
+            Arrays.fill(temp, (byte) 0);
+            System.arraycopy(keyBytes, 0, temp, 0, keyBytes.length);
+            keyBytes = temp;
+        }
+        // 初始化
+        Security.addProvider(new BouncyCastleProvider());
+        // 转化成JAVA的密钥格式
+        key = new SecretKeySpec(keyBytes, KEY_ALGORITHM);
+        try {
+            // 初始化cipher
+            cipher = Cipher.getInstance(algorithmStr, "BC");
+            cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
+            encryptedText = cipher.doFinal(encryptedData);
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (NoSuchPaddingException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (NoSuchProviderException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (BadPaddingException e) {
+            e.printStackTrace();
+        } catch (InvalidKeyException e) {
+            e.printStackTrace();
+        } catch (IllegalBlockSizeException e) {
+            e.printStackTrace();
+        } catch (InvalidAlgorithmParameterException e) {
+            e.printStackTrace();
+        }
+
+//        System.out.println("IV:" + new String(iv));
+//        try {
+//
+//        } catch (Exception e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+
+        return encryptedText;
+    }
+
+
+}

+ 133 - 0
RA Image/app/src/main/java/com/usai/util/Crypto.java

@@ -0,0 +1,133 @@
+package com.usai.util;
+
+import java.security.SecureRandom;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * Usage:
+ * 
+ * <pre>
+ * String crypto = Crypto.encrypt(masterpassword, cleartext) 
+ * ... 
+ * String cleartext = Crypto.decrypt(masterpassword, crypto)
+ * </pre>
+ * 
+ * @author ferenc.hechler
+ */
+public class Crypto
+{
+//    public static SecretKeySpec setSecretKey(String password) throws Exception {
+//        SecretKeySpec key = null;
+//        KeyGenerator kgen = KeyGenerator.getInstance(ALGORITHM);
+//        SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto");
+//        sr.setSeed(password.getBytes());
+//        kgen.init(128, sr);
+//        SecretKey secretKey = kgen.generateKey();
+//        byte[] enCodeFormat = secretKey.getEncoded();
+//        key = new SecretKeySpec(enCodeFormat, SecretKeySpec.ALGORITHM);
+//
+//        return key;
+//    }
+
+	public static String encrypt(String seed, String cleartext)
+			throws Exception
+	{
+		byte[] rawKey = getRawKey(seed.getBytes());
+		byte[] result = encrypt(rawKey, cleartext.getBytes());
+		return toHex(result);
+	}
+
+	public static String decrypt(String seed, String encrypted)
+			throws Exception
+	{
+		byte[] rawKey = getRawKey(seed.getBytes());
+		byte[] enc = toByte(encrypted);
+		byte[] result = decrypt(rawKey, enc);
+		return new String(result);
+	}
+
+	private static byte[] getRawKey(byte[] seed) throws Exception
+	{
+		
+        KeyGenerator kgen = KeyGenerator.getInstance("AES");
+        SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto");
+        sr.setSeed(seed);
+        kgen.init(128, sr);
+        SecretKey secretKey = kgen.generateKey();	
+        byte[] enCodeFormat = secretKey.getEncoded();
+//        key = new SecretKeySpec(enCodeFormat, SecretKeySpec.ALGORITHM);
+        return enCodeFormat;
+//
+//        return key;	
+//		KeyGenerator kgen = KeyGenerator.getInstance("AES");
+//		SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
+//		sr.setSeed(seed);
+//		kgen.init(128, sr); // 192 and 256 bits may not be available
+//		SecretKey skey = kgen.generateKey();
+//		byte[] raw = skey.getEncoded();
+//		return raw;
+	}
+
+	private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception
+	{
+		SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+		Cipher cipher = Cipher.getInstance("AES");
+		cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+		byte[] encrypted = cipher.doFinal(clear);
+		return encrypted;
+	}
+
+	private static byte[] decrypt(byte[] raw, byte[] encrypted)
+			throws Exception
+	{
+		SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+		Cipher cipher = Cipher.getInstance("AES");
+		cipher.init(Cipher.DECRYPT_MODE, skeySpec);
+		byte[] decrypted = cipher.doFinal(encrypted);
+		return decrypted;
+	}
+
+	public static String toHex(String txt)
+	{
+		return toHex(txt.getBytes());
+	}
+
+	public static String fromHex(String hex)
+	{
+		return new String(toByte(hex));
+	}
+
+	public static byte[] toByte(String hexString)
+	{
+		int len = hexString.length() / 2;
+		byte[] result = new byte[len];
+		for (int i = 0; i < len; i++)
+			result[i] = Integer.valueOf(hexString.substring(2 * i, 2 * i + 2),
+					16).byteValue();
+		return result;
+	}
+
+	public static String toHex(byte[] buf)
+	{
+		if (buf == null)
+			return "";
+		StringBuffer result = new StringBuffer(2 * buf.length);
+		for (int i = 0; i < buf.length; i++)
+		{
+			appendHex(result, buf[i]);
+		}
+		return result.toString();
+	}
+
+	private final static String HEX = "0123456789ABCDEF";
+
+	private static void appendHex(StringBuffer sb, byte b)
+	{
+		sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f));
+	}
+
+}

+ 43 - 0
RA Image/app/src/main/java/com/usai/util/MD5.java

@@ -0,0 +1,43 @@
+package com.usai.util;
+
+import java.security.MessageDigest;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+public class MD5 {
+    private static final char HEX_DIGITS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+'A', 'B', 'C', 'D', 'E', 'F' };
+
+    public static void main(String[] args)
+    {
+        System.out.println(md5sum("/init.rc"));
+    }
+
+    public static String toHexString(byte[] b) {
+        StringBuilder sb = new StringBuilder(b.length * 2);
+        for (int i = 0; i < b.length; i++) {
+            sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]);
+            sb.append(HEX_DIGITS[b[i] & 0x0f]);
+        }
+        return sb.toString();
+    }
+
+    public static String md5sum(String filename) {
+        InputStream fis;
+        byte[] buffer = new byte[1024];
+        int numRead = 0;
+        MessageDigest md5;
+        try{
+            fis = new FileInputStream(filename);
+            md5 = MessageDigest.getInstance("MD5");
+            while((numRead=fis.read(buffer)) > 0) {
+                md5.update(buffer,0,numRead);
+            }
+            fis.close();
+            return toHexString(md5.digest());  
+        } catch (Exception e) {
+            System.out.println("error");
+            return null;
+        }
+    }
+}

+ 1256 - 0
RA Image/app/src/main/java/com/usai/util/Network.java

@@ -0,0 +1,1256 @@
+package com.usai.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.util.Set;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.conn.HttpHostConnectException;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.mime.HttpMultipartMode;
+import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.protocol.HTTP;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.usai.redant.raimage.RedAntApplication;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import static android.R.attr.key;
+import static android.R.attr.parentActivityName;
+import static android.R.attr.tag;
+
+public class Network
+{
+	private static final int	REQUEST_TIMEOUT					= 15 * 1000;			// request
+																						// time
+																						// out
+																						// 20
+																						// secs
+	private static final int	SO_TIMEOUT						= 15 * 1000;			// so
+																						// time
+																						// out
+																						// 20
+																						// secs;
+	public static int			AP_USER_AUTH					= 1;
+	public static int			AP_USER_NOT_AUTH				= 2;
+	public static int			AP_USER_NOT_EXIST				= 3;
+	public static int			AP_UPLOAD_SUCCESS				= 4;
+	public static int			AP_UPLOAD_FAIL					= 5;
+	//
+	// public static final int RESULT_FALSE = 0;
+	// public static final int RESULT_TRUE = 1;
+	// public static final int RESULT_NET_ERROR = 3;
+	// public static final int RESULT_ERROR = 5;
+	// public static final int RESULT_LOCALFILE_ERROR= 7;
+	// public static final int RESULT_USERAUTH_ERROR = 9;
+
+	public static int			AP_MESSAGE_NEW					= 5;
+	public static int			AP_MESSAGE_NONE					= 6;
+	//
+	public static final int		RESULT_FALSE					= 0;
+	public static final int		RESULT_TRUE						= 2;
+	public static final int		RESULT_NET_ERROR				= -3;
+	public static final int		RESULT_NET_NOTAVAILABLE			= -4;
+	public static final int		RESULT_ERROR					= -5;
+	public static final int		RESULT_LOCALFILE_ERROR			= -7;
+	public static final int		RESULT_USERAUTH_ERROR			= -9;
+	public static final int		RESULT_UPDATE_USERAUTH_ERROR	= -11;
+	public static final int		RESULT_SESSION_EXPIRED			= -13;
+	public static final int		RESULT_VER_LOW					= -15;
+	public static final int		STATUS_WAIT						= -17;
+	static String				URL_UPLOAD_PHOTO				= "handset.php";
+	@Deprecated
+	static String				URL_VERIFY_USER					= "handset_login.php";
+	static String				URL_LOGIN					= "index.php?_action=handset_new ";
+
+	public static class SSLSocketFactoryEx extends SSLSocketFactory
+	{
+
+		SSLContext	sslContext	= SSLContext.getInstance("TLS");
+
+		public SSLSocketFactoryEx(KeyStore truststore)
+				throws NoSuchAlgorithmException, KeyManagementException,
+				KeyStoreException, UnrecoverableKeyException
+		{
+			super(truststore);
+
+			TrustManager tm = new X509TrustManager()
+			{
+				public java.security.cert.X509Certificate[] getAcceptedIssuers()
+				{
+					return null;
+				}
+
+				@Override
+				public void checkClientTrusted(
+						java.security.cert.X509Certificate[] chain,
+						String authType)
+						throws java.security.cert.CertificateException
+				{
+				}
+
+				@Override
+				public void checkServerTrusted(
+						java.security.cert.X509Certificate[] chain,
+						String authType)
+						throws java.security.cert.CertificateException
+				{
+				}
+			};
+			sslContext.init(null, new TrustManager[] { tm }, null);
+		}
+
+		@Override
+		public Socket createSocket(Socket socket, String host, int port,
+				boolean autoClose) throws IOException, UnknownHostException
+		{
+			return sslContext.getSocketFactory().createSocket(socket, host,
+					port, autoClose);
+		}
+
+		@Override
+		public Socket createSocket() throws IOException
+		{
+			return sslContext.getSocketFactory().createSocket();
+		}
+	}
+
+/*	private static HttpURLConnection getNewHttpConnection()
+{
+
+
+
+}*/
+	private static HttpClient getNewHttpClient()
+	{
+		try
+		{
+			KeyStore trustStore = KeyStore.getInstance(KeyStore
+					.getDefaultType());
+			trustStore.load(null, null);
+
+			SSLSocketFactory sf = new SSLSocketFactoryEx(trustStore);
+			sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+
+			HttpParams params = new BasicHttpParams();
+			HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+			HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
+			HttpConnectionParams.setConnectionTimeout(params, REQUEST_TIMEOUT);
+			HttpConnectionParams.setSoTimeout(params, SO_TIMEOUT);
+			SchemeRegistry registry = new SchemeRegistry();
+			registry.register(new Scheme("http", PlainSocketFactory
+					.getSocketFactory(), 80));
+			registry.register(new Scheme("https", sf, 443));
+
+			ClientConnectionManager ccm = new ThreadSafeClientConnManager(
+					params, registry);
+
+			return new DefaultHttpClient(ccm, params);
+		}
+		catch (Exception e)
+		{
+			dbgUtil.fileLog(e.toString());
+			return new DefaultHttpClient();
+		}
+	}
+	private static String createPostParameters(Bundle parms) throws UnsupportedEncodingException {
+		StringBuilder result = new StringBuilder();
+		boolean first = true;
+		for(String key : parms.keySet()){
+			if (first)
+				first = false;
+			else
+				result.append("&");
+
+			result.append(URLEncoder.encode(key, "UTF-8"));
+			result.append("=");
+			result.append(URLEncoder.encode(parms.get(key).toString(), "UTF-8"));
+		}
+
+		return result.toString();
+	}
+	public static String getJson(String url, Bundle parms)
+	{
+		String TAG = "net_dbg@GetJson";
+		Log.d(TAG, "entry");
+		String ret=null;
+
+		HttpURLConnection connection = null;
+
+		try {
+
+
+			URL _url;
+			_url = new URL(url);
+			connection = (HttpURLConnection) _url.openConnection();
+			// 设置请求方式
+			connection.setRequestMethod("POST");
+			// 设置编码格式
+			connection.setRequestProperty("Charset", "UTF-8");
+			// 传递自定义参数
+//			connection.setRequestProperty("MyProperty", "this is me!");
+
+			if(!TextUtils.isEmpty(RedAntApplication.user))
+				parms.putString("user", AES.encrypt("usai", RedAntApplication.user));
+			if(!TextUtils.isEmpty(RedAntApplication.password))
+				parms.putString("password", AES.encrypt("usai", RedAntApplication.password));
+
+			parms.putString("app_ver", RedAntApplication.getInstance()
+					.getPackageManager()
+					.getPackageInfo("com.usai.redant.raimage", 0).versionName);
+			parms.putInt("app_short_ver", RedAntApplication.getInstance()
+					.getPackageManager()
+					.getPackageInfo("com.usai.redant.raimage", 0).versionCode);
+
+			parms.putString("deviceid",RedAntApplication.device_id);
+
+
+
+
+			Set<String> keys = parms.keySet();
+			Log.d(TAG, "================parms============");
+			for (String key : keys)
+			{
+				if (key.contains("_file"))
+				{
+					;
+				}
+				else
+				{
+//					connection.setRequestProperty(key, parms.get(key).toString());
+					Log.d(TAG, "key=" + key + "    val="
+							+ parms.get(key).toString());
+				}
+//					reqEntity.addPart(key, new StringBody());
+
+			}
+			Log.d(TAG, "================parms============");
+
+			Log.d(TAG,"URL: "+url);
+			// 设置容许输出
+			connection.setDoInput(true);
+			connection.setDoOutput(true);
+
+
+			OutputStream os = connection.getOutputStream();
+			BufferedWriter writer = new BufferedWriter(
+					new OutputStreamWriter(os, "UTF-8"));
+			writer.write(createPostParameters(parms));
+
+			writer.flush();
+			writer.close();
+			os.close();
+
+		/*// 上传一张图片
+		FileInputStream file = new FileInputStream(Environment.getExternalStorageDirectory().getPath()
+				+ "/Pictures/Screenshots/Screenshot_2015-12-19-08-40-18.png");
+		OutputStream os = connection.getOutputStream();
+		int count = 0;
+		while((count=file.read()) != -1){
+			os.write(count);
+		}
+		os.flush();
+		os.close();
+*/
+			// 获取返回数据
+			if(connection.getResponseCode() == 200){
+				InputStream is = connection.getInputStream();
+
+				BufferedReader br = new BufferedReader(
+						new InputStreamReader(is, "utf-8"), 8);
+				StringBuilder sb = new StringBuilder();
+				String line = null;
+				while ((line = br.readLine()) != null)
+				{
+					sb.append(line + "\n");
+				}
+
+				Log.d(TAG, "Response: content begin");
+				Log.d(TAG, sb.toString());
+				Log.d(TAG, "Response: content end");
+
+				if (sb.length() <= 0)
+				{
+
+					ret= null;
+				}
+				ret= sb.toString();
+
+//				Message msg = Message.obtain();
+//				msg.what = 0;
+//				postHandler.sendMessage(msg);
+			}
+
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+			dbgUtil.fileLog(e.toString());
+			Log.e(TAG, e.toString());
+
+		} catch (ProtocolException e) {
+			e.printStackTrace();
+			dbgUtil.fileLog(e.toString());
+			Log.e(TAG, e.toString());
+
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+			dbgUtil.fileLog(e.toString());
+			Log.e(TAG, e.toString());
+
+		} catch (IOException e) {
+			e.printStackTrace();
+			dbgUtil.fileLog(e.toString());
+			Log.e(TAG, e.toString());
+
+		} catch (PackageManager.NameNotFoundException e) {
+			e.printStackTrace();
+		} finally {
+
+			if(connection!=null){
+				connection.disconnect();
+			}
+		}
+		return ret;
+
+	}
+	@Deprecated
+	public static String getJson_d(String url, Bundle parms)
+	{
+		String TAG = "net_dbg@GetJson";
+		Log.d(TAG, "entry");
+
+		// parms.putString("sessionid",
+		// ApexTrackingApplication.get_sessionid());
+
+		// if (true)
+		// return fakegetJson(url);
+		try
+		{
+			// BasicHttpParams httpParams = new BasicHttpParams();
+			// HttpConnectionParams.setConnectionTimeout(httpParams,
+			// REQUEST_TIMEOUT);
+			// HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
+			HttpClient client = getNewHttpClient();// new
+													// DefaultHttpClient(httpParams);
+			HttpPost post = new HttpPost(url);
+			MultipartEntity reqEntity = new MultipartEntity(
+					HttpMultipartMode.BROWSER_COMPATIBLE);
+
+			Set<String> keys = parms.keySet();
+			Log.d(TAG, "================parms============");
+			for (String key : keys)
+			{
+				if (key.contains("_file"))
+				{
+					;
+				}
+				else
+					reqEntity.addPart(key, new StringBody(parms.get(key)
+							.toString()));
+				Log.d(TAG, "key=" + key + "    val="
+						+ parms.get(key).toString());
+			}
+			Log.d(TAG, "================parms============");
+
+			post.setEntity(reqEntity);
+			HttpResponse response = client.execute(post);
+			int statucode = response.getStatusLine().getStatusCode();
+			if (statucode == HttpStatus.SC_OK)
+			{
+				HttpEntity resEntity = response.getEntity();
+				if (resEntity != null)
+				{
+					Log.d(TAG,
+							"Response: content len==>"
+									+ resEntity.getContentLength());
+					InputStream is = resEntity.getContent();
+					try
+					{
+
+						BufferedReader br = new BufferedReader(
+								new InputStreamReader(is, "utf-8"), 8);
+						StringBuilder sb = new StringBuilder();
+						String line = null;
+						while ((line = br.readLine()) != null)
+						{
+							sb.append(line + "\n");
+						}
+
+						Log.d(TAG, "Response: content begin");
+						Log.d(TAG, sb.toString());
+						Log.d(TAG, "Response: content end");
+
+						if (sb.length() <= 0)
+						{
+
+							return null;
+						}
+						return sb.toString();
+
+					}
+					catch (Exception e)
+					{
+						dbgUtil.fileLog(e.toString());
+						Log.e(TAG, e.toString());
+						return null;
+						// TODO: handle exception
+					}
+					finally
+					{
+						is.close();
+
+					}
+
+				}
+				else
+				{
+					/*
+					 * resEntity is null
+					 */
+					Log.d(TAG, "RESPONSE ENTITY IS NULL");
+					return null;
+				}
+
+			}
+			else
+			{
+				/*
+				 * Http error; out put error code;
+				 */
+				Log.d(TAG, "HTTP " + statucode);
+
+				HttpEntity resEntity = response.getEntity();
+				if (resEntity != null)
+				{
+
+					InputStream is = resEntity.getContent();
+					try
+					{
+
+						BufferedReader br = new BufferedReader(
+								new InputStreamReader(is, "utf-8"), 8);
+						StringBuilder sb = new StringBuilder();
+						String line = null;
+						while ((line = br.readLine()) != null)
+						{
+							sb.append(line + "\n");
+						}
+
+						Log.d(TAG, "Response: content begin");
+						Log.d(TAG, sb.toString());
+						Log.d(TAG, "Response: content end");
+						return null;
+					}
+					catch (Exception e)
+					{
+						dbgUtil.fileLog(e.toString());
+						Log.e(TAG, e.toString());
+						return null;
+						// TODO: handle exception
+					}
+					finally
+					{
+						is.close();
+
+					}
+
+				}
+				else
+				{
+					/*
+					 * resEntity is null
+					 */
+					Log.e(TAG, "RESPONSE ENTITY IS NULL");
+					return null;
+				}
+			}
+
+		}
+		catch (ConnectTimeoutException e)
+		{
+			Log.d(TAG, "request time out");
+			dbgUtil.fileLog(e.toString());
+			return null;
+
+		}
+		catch (SocketTimeoutException e)
+		{
+			Log.d(TAG, "socket time out");
+			dbgUtil.fileLog(e.toString());
+			return null;
+		}
+		catch (UnknownHostException e)
+		{
+			Log.d(TAG, e.toString());
+			dbgUtil.fileLog(e.toString());
+			return null;
+		}
+		catch (HttpHostConnectException e)
+		{
+			Log.d(TAG, e.toString());
+			dbgUtil.fileLog(e.toString());
+			return null;
+		}
+		catch (Exception e)
+		{
+			Log.d(TAG, e.toString());
+			dbgUtil.fileLog(e.toString());
+			return null;
+		}
+
+	}
+
+	public static boolean NetworkIsAvailable()// Context context)
+	{
+		String TAG = "net_dbg@CheckNetwork";
+
+		ConnectivityManager connManager = (ConnectivityManager) RedAntApplication
+				.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
+		// .getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
+		if (networkInfo == null)
+		{
+			Log.d(TAG, "can not get Active NetworkInfo!");
+			// dbgUtil.Log(Log.DEBUG, "Current Network info",
+			// "can not get Active NetworkInfo!");
+			return false;
+		}
+		NetworkInfo.State netState = networkInfo.getState();
+		if (netState != NetworkInfo.State.CONNECTED)
+		{
+			Log.d(TAG, "not Connected!State=" + netState);
+			// dbgUtil.Log(Log.DEBUG, "Current Network info",
+			// "not Connected!State=" + netState);
+			return false;
+		}
+
+		boolean bavailable = networkInfo.isAvailable();
+		String strtype = networkInfo.getTypeName();
+
+		Log.d(TAG, " type = " + strtype + " abailable = " + bavailable
+				+ " state " + netState);
+
+		return bavailable;
+	}
+	public static JSONObject Login(String user, String password) {
+		String TAG = "net_dbg@get_Auth";
+		Log.d(TAG, "u:" + user + ";p:" + password);
+		if (!Network.NetworkIsAvailable())
+		{
+
+			Log.d(TAG, "network not available!");
+			try {
+				return new JSONObject("{result:" + Network.RESULT_NET_NOTAVAILABLE+ "}");
+			} catch (JSONException e) {
+				e.printStackTrace();
+			}
+
+		}
+
+
+		Bundle parms = new Bundle();
+		try {
+
+			parms.putString("user", AES.encrypt("usai", user));
+			parms.putString("password", AES.encrypt("usai", password));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		parms.putString("_operate","handset_login");
+		// parms.putString("action", "handset_login");
+		// int ver = ApexTrackingApplication
+		// .get_instance()
+		// .getSharedPreferences(name + "_Apex_auth", Context.MODE_PRIVATE)
+		// .getInt("AuthInfoVer", 0);
+		// parms.putString("auth_ver", ver + "");
+		String jstr = getJson(RedAntApplication.active_address
+				+ Network.URL_LOGIN, parms);
+		/*
+		 * error occur while get authorization info from server. include can not
+		 * reach server , wrong parms ,server get wrong , etc.
+		 */
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			try {
+				return new JSONObject("{result:" + Network.RESULT_NET_ERROR+ "}");
+			} catch (JSONException e) {
+				e.printStackTrace();
+			}
+
+		}
+		JSONObject jsobj;
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				return jsobj;
+			}
+			try {
+				return new JSONObject("{result:" + Network.RESULT_NET_ERROR+ "}");
+			} catch (JSONException e) {
+				e.printStackTrace();
+			}
+
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			dbgUtil.fileLog(e.toString());
+			e.printStackTrace();
+//			try {
+//				return new JSONObject("{result:" + Network.RESULT_NET_ERROR+ "}");
+//			} catch (JSONException e1) {
+//				e.printStackTrace();
+//			}
+			return null;
+		}
+
+//		JSONObject ret =new JSONObject();
+//		ret.put("result",Network.RESULT_NET_ERROR);
+		return null;
+	}
+	@Deprecated
+	public static int VerifyUser(String user, String password)
+	{
+		String TAG = "net_dbg@get_Auth";
+		Log.d(TAG, "u:" + user + ";p:" + password);
+		if (!Network.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return Network.RESULT_NET_NOTAVAILABLE; // network not available
+		}
+		Bundle parms = new Bundle();
+		parms.putString("user", user);
+		parms.putString("password", password);
+		// parms.putString("action", "handset_login");
+		// int ver = ApexTrackingApplication
+		// .get_instance()
+		// .getSharedPreferences(name + "_Apex_auth", Context.MODE_PRIVATE)
+		// .getInt("AuthInfoVer", 0);
+		// parms.putString("auth_ver", ver + "");
+		String jstr = getJson(RedAntApplication.active_address
+				+ Network.URL_VERIFY_USER, parms);
+		/*
+		 * error occur while get authorization info from server. include can not
+		 * reach server , wrong parms ,server get wrong , etc.
+		 */
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return Network.RESULT_NET_ERROR;
+		}
+		JSONObject jsobj;
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == Network.AP_USER_AUTH)
+				{
+					return RESULT_TRUE;
+				}
+
+				else
+				{
+
+					return RESULT_FALSE;
+				}
+			}
+			return RESULT_NET_ERROR;
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			dbgUtil.fileLog(e.toString());
+			e.printStackTrace();
+			return RESULT_NET_ERROR;
+		}
+
+		// return parse_authinfo(jstr, name, password);
+		// if(true)
+		// return RESULT_TRUE;
+		// String TAG = "net_dbg@VerifyUser";
+		// Log.d(TAG, "entry");
+		// try
+		// {
+		// BasicHttpParams httpParams = new BasicHttpParams();
+		// HttpConnectionParams.setConnectionTimeout(httpParams,
+		// REQUEST_TIMEOUT);
+		// HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
+		// HttpClient client = new DefaultHttpClient(httpParams);
+		// HttpPost post = new HttpPost(URL_VERIFY_USER);
+		// MultipartEntity reqEntity = new MultipartEntity(
+		// HttpMultipartMode.BROWSER_COMPATIBLE);
+		// reqEntity.addPart("user", new StringBody(user));
+		// reqEntity.addPart("password", new StringBody(password));
+		//
+		// post.setEntity(reqEntity);
+		// HttpResponse response = client.execute(post);
+		// int statucode = response.getStatusLine().getStatusCode();
+		// if (statucode == HttpStatus.SC_OK)
+		// {
+		// HttpEntity resEntity = response.getEntity();
+		// if (resEntity != null)
+		// {
+		// Log.d(TAG,
+		// "Response: content len==>"
+		// + resEntity.getContentLength());
+		// InputStream is = resEntity.getContent();
+		// try
+		// {
+		//
+		// BufferedReader br = new BufferedReader(
+		// new InputStreamReader(is, "utf-8"), 8);
+		// StringBuilder sb = new StringBuilder();
+		// String line = null;
+		// while ((line = br.readLine()) != null)
+		// {
+		// sb.append(line + "\n");
+		// }
+		//
+		// Log.d(TAG, "Response: content begin");
+		// Log.d(TAG, sb.toString());
+		// Log.d(TAG, "Response: content end");
+		//
+		// if (sb.length()<=0)
+		// {
+		//
+		// return RESULT_NET_ERROR;
+		// }
+		// JSONObject obj = new JSONObject(sb.toString());
+		// if (obj.length() > 0)
+		// {
+		// // JSONObject obj = array.getJSONObject(0);
+		// try
+		// {
+		// int verifyresult = Integer.parseInt(obj
+		// .getString("result"));
+		// if (verifyresult == Network.AP_USER_AUTH)
+		// {
+		// return RESULT_TRUE;
+		// }
+		// else
+		// {
+		// return RESULT_FALSE;
+		// }
+		// }
+		// catch (Exception e)
+		// {
+		// Log.e(TAG, e.toString());
+		// return RESULT_ERROR;
+		// }
+		// }
+		// }
+		// catch (Exception e)
+		// {
+		// Log.e(TAG, e.toString());
+		// return RESULT_ERROR;
+		// // TODO: handle exception
+		// }
+		// finally
+		// {
+		// is.close();
+		//
+		// }
+		//
+		// }
+		// else
+		// {
+		// /*
+		// * resEntity is null
+		// */
+		// Log.d(TAG, "RESPONSE ENTITY IS NULL");
+		// return RESULT_NET_ERROR;
+		// }
+		//
+		// }
+		// else
+		// {
+		// /*
+		// * Http error; out put error code;
+		// */
+		// Log.d(TAG, "HTTP " + statucode);
+		//
+		// HttpEntity resEntity = response.getEntity();
+		// if (resEntity != null)
+		// {
+		//
+		// InputStream is = resEntity.getContent();
+		// try
+		// {
+		//
+		// BufferedReader br = new BufferedReader(
+		// new InputStreamReader(is, "utf-8"), 8);
+		// StringBuilder sb = new StringBuilder();
+		// String line = null;
+		// while ((line = br.readLine()) != null)
+		// {
+		// sb.append(line + "\n");
+		// }
+		//
+		// Log.d(TAG, "Response: content begin");
+		// Log.d(TAG, sb.toString());
+		// Log.d(TAG, "Response: content end");
+		// return RESULT_ERROR;
+		// }
+		// catch (Exception e)
+		// {
+		// Log.e(TAG, e.toString());
+		// return RESULT_ERROR;
+		// // TODO: handle exception
+		// }
+		// finally
+		// {
+		// is.close();
+		//
+		// }
+		//
+		// }
+		// else
+		// {
+		// /*
+		// * resEntity is null
+		// */
+		// Log.e(TAG, "RESPONSE ENTITY IS NULL");
+		// return RESULT_NET_ERROR;
+		// }
+		// }
+		//
+		// }
+		// catch (ConnectTimeoutException e)
+		// {
+		// Log.d(TAG, "request time out");
+		// return RESULT_NET_ERROR;
+		//
+		// }
+		// catch (Exception e)
+		// {
+		// Log.d(TAG, e.toString());
+		// return RESULT_ERROR;
+		// }
+		// return RESULT_ERROR;
+	}
+
+	public static int UploadImage(String path, String user, String password,
+			String pid,String server)
+	{
+
+		Bitmap source = BitmapFactory.decodeFile(path);
+
+		int originWidth = source.getWidth();
+		int originHeight = source.getHeight();
+
+		int width = originWidth, height = originHeight;
+
+		if (originHeight > 1024 || originWidth > 1024)
+		{
+			if (originWidth > originHeight)
+			{
+				width = 1024;
+				height = originHeight * 1024 / originWidth;
+
+			}
+			else
+			{
+
+				height = 1024;
+				width = originWidth * 1024 / originHeight;
+
+			}
+		}
+		Bitmap scaled = Bitmap.createScaledBitmap(source, width, height, true);
+		OutputStream fOutputStream = null;
+		String scaledPath = path.replace(".jpg", "_scaled.jpg");
+		File file = new File(scaledPath);
+		try
+		{
+			fOutputStream = new FileOutputStream(file);
+
+			scaled.compress(Bitmap.CompressFormat.JPEG, 95, fOutputStream);
+
+			fOutputStream.flush();
+			fOutputStream.close();
+
+			// MediaStore.Images.Media.insertImage(RedAntApplication.getInstance().getContentResolver(),
+			// file.getAbsolutePath(), file.getName(), file.getName());
+		}
+		catch (FileNotFoundException e)
+		{
+			e.printStackTrace();
+
+			dbgUtil.fileLog(e.toString());
+			return RESULT_LOCALFILE_ERROR;
+		}
+		catch (IOException e)
+		{
+			e.printStackTrace();
+
+			dbgUtil.fileLog(e.toString());
+			return RESULT_LOCALFILE_ERROR;
+		}
+		int ret = UploadFile(scaledPath, user, password, pid,server);
+		file.delete();
+		return ret;
+
+	}
+
+	public static int UploadFile(String path, String user, String password,
+			String pid,String server)
+	{
+		String TAG = "net_dbg@UploadFile";
+		Log.d(TAG, "entry");
+
+		Log.d(TAG, "sourcefile:" + path);
+		File file = new File(path);
+
+		if (file.exists() == false)
+		{
+			dbgUtil.fileLog("file "+ path +" not found!");
+			return RESULT_LOCALFILE_ERROR;
+		}
+		String md5 = MD5.md5sum(path);
+		Log.d(TAG, "MD5:" + md5);
+		if (md5 == null)
+		{
+			Log.d(TAG, "md5 sum failed");
+			dbgUtil.fileLog("md5 sum failed");
+			return RESULT_LOCALFILE_ERROR;
+
+		}
+		try
+		{
+			BasicHttpParams httpParams = new BasicHttpParams();
+			HttpConnectionParams.setConnectionTimeout(httpParams,
+					REQUEST_TIMEOUT);
+			HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
+			HttpClient client = new DefaultHttpClient(httpParams);
+			HttpPost post = new HttpPost(server
+					+ URL_UPLOAD_PHOTO);
+			MultipartEntity reqEntity = new MultipartEntity(
+					HttpMultipartMode.BROWSER_COMPATIBLE);
+			reqEntity.addPart("user", new StringBody(user));
+			reqEntity.addPart("password", new StringBody(password));
+			reqEntity.addPart("pid", new StringBody(pid));
+			reqEntity.addPart("md5", new StringBody(md5));
+
+			FileBody bin = new FileBody(file);
+			reqEntity.addPart("imagefile", bin);
+			post.setEntity(reqEntity);
+			HttpResponse response = client.execute(post);
+			int statucode = response.getStatusLine().getStatusCode();
+			if (statucode == HttpStatus.SC_OK)
+			{
+				HttpEntity resEntity = response.getEntity();
+				if (resEntity != null)
+				{
+					Log.d(TAG,
+							"Response: content len==>"
+									+ resEntity.getContentLength());
+					InputStream is = resEntity.getContent();
+					try
+					{
+
+						BufferedReader br = new BufferedReader(
+								new InputStreamReader(is, "utf-8"), 8);
+						StringBuilder sb = new StringBuilder();
+						String line = null;
+						while ((line = br.readLine()) != null)
+						{
+							sb.append(line + "\n");
+						}
+
+						Log.d(TAG, "Response: content begin");
+						Log.d(TAG, sb.toString());
+						Log.d(TAG, "Response: content end");
+
+						if (sb.length() <= 0)
+						{
+
+							return RESULT_NET_ERROR;
+						}
+						JSONObject obj = new JSONObject(sb.toString());
+						if (obj.length() > 0)
+						{
+							// JSONObject obj = array.getJSONObject(0);
+							try
+							{
+								int uploadresult = Integer.parseInt(obj
+										.getString("result"));
+								if (uploadresult == Network.AP_UPLOAD_SUCCESS)
+								{
+									return RESULT_TRUE;
+								}
+								else if (uploadresult == Network.AP_USER_NOT_AUTH)
+								{
+									Log.d(TAG, "RESULT_ERR_USERAUTH");
+									return RESULT_USERAUTH_ERROR;
+								}
+								else
+								{
+									return RESULT_FALSE;
+								}
+							}
+							catch (Exception e)
+							{
+								Log.e(TAG, e.toString()+1);
+								dbgUtil.fileLog(e.toString());
+								return RESULT_FALSE;
+							}
+						}
+					}
+					catch (Exception e)
+					{
+						Log.e(TAG, e.toString());
+						dbgUtil.fileLog(e.toString());
+						return RESULT_NET_ERROR;
+						// TODO: handle exception
+					}
+					finally
+					{
+						is.close();
+
+					}
+
+				}
+				else
+				{
+					/*
+					 * resEntity is null
+					 */
+					Log.d(TAG, "RESPONSE ENTITY IS NULL");
+					return RESULT_NET_ERROR;
+				}
+
+			}
+			else
+			{
+				/*
+				 * Http error; out put error code;
+				 */
+				Log.d(TAG, "HTTP " + statucode);
+
+				HttpEntity resEntity = response.getEntity();
+				if (resEntity != null)
+				{
+
+					InputStream is = resEntity.getContent();
+					try
+					{
+
+						BufferedReader br = new BufferedReader(
+								new InputStreamReader(is, "utf-8"), 8);
+						StringBuilder sb = new StringBuilder();
+						String line = null;
+						while ((line = br.readLine()) != null)
+						{
+							sb.append(line + "\n");
+						}
+
+						Log.d(TAG, "Response: content begin");
+						Log.d(TAG, sb.toString());
+						Log.d(TAG, "Response: content end");
+						return RESULT_NET_ERROR;
+					}
+					catch (Exception e)
+					{
+						Log.e(TAG, e.toString());
+						dbgUtil.fileLog(e.toString());
+						return RESULT_NET_ERROR;
+						
+						// TODO: handle exception
+					}
+					finally
+					{
+						is.close();
+
+					}
+
+				}
+				else
+				{
+					/*
+					 * resEntity is null
+					 */
+					Log.e(TAG, "RESPONSE ENTITY IS NULL");
+					return RESULT_NET_ERROR;
+				}
+			}
+
+		}
+		catch (ConnectTimeoutException e)
+		{
+			Log.d(TAG, "request time out");
+			dbgUtil.fileLog(e.toString());
+			return RESULT_NET_ERROR;
+
+		}
+		catch (SocketTimeoutException e)
+		{
+			Log.d(TAG, "socket time out");
+			dbgUtil.fileLog(e.toString());
+			return RESULT_NET_ERROR;
+		}
+		catch (UnknownHostException e)
+		{
+			Log.d(TAG, e.toString());
+			dbgUtil.fileLog(e.toString());
+			return RESULT_NET_ERROR;
+		}
+		catch (HttpHostConnectException e)
+		{
+			Log.d(TAG, e.toString());
+			dbgUtil.fileLog(e.toString());
+			return RESULT_NET_ERROR;
+		}
+		catch (Exception e)
+		{
+			Log.d(TAG, e.toString()+" RESULT_ERROR!!");
+			dbgUtil.fileLog(e.toString());
+			return RESULT_ERROR;
+		}
+
+		return RESULT_FALSE;
+
+		// try
+		// {
+		// HttpClient client = new DefaultHttpClient();
+		// HttpPost post = new HttpPost(url);
+		// MultipartEntity reqEntity = new MultipartEntity(
+		// HttpMultipartMode.BROWSER_COMPATIBLE);
+		// reqEntity.addPart("user", new StringBody(user));
+		// reqEntity.addPart("password", new StringBody(password));
+		// reqEntity.addPart("pid", new StringBody(pid));
+		// FileBody bin = new FileBody(file);
+		// reqEntity.addPart("imagefile", bin);
+		// post.setEntity(reqEntity);
+		// HttpResponse response = client.execute(post);
+		// HttpEntity resEntity = response.getEntity();
+		// if (resEntity != null)
+		// {
+		//
+		// String result = EntityUtils.toString(resEntity);
+		// Log.d(TAG, "Response:" + result);
+		// return Integer.parseInt(result);
+		// // if(Boolean.parseBoolean(result)==true)
+		// // return true;
+		// // else
+		// // return false;
+		// }
+		//
+		// }
+		// catch (Exception e)
+		// {
+		// e.printStackTrace();
+		// }
+		// return 0;
+	}
+
+	public static boolean NetworkIsAvailable(Context context)
+	{
+		String TAG = "net_dbg@CheckNetwork";
+		ConnectivityManager connManager = (ConnectivityManager) context
+				.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
+		if (networkInfo == null)
+		{
+			Log.d(TAG, "can not get Active NetworkInfo!");
+			// dbgUtil.Log(Log.DEBUG, "Current Network info",
+			// "can not get Active NetworkInfo!");
+			return false;
+		}
+		NetworkInfo.State netState = networkInfo.getState();
+		if (netState != NetworkInfo.State.CONNECTED)
+		{
+			Log.d(TAG, "not Connected!State=" + netState);
+			// dbgUtil.Log(Log.DEBUG, "Current Network info",
+			// "not Connected!State=" + netState);
+			return false;
+		}
+		// int iconntype = -1;
+		// iconntype = networkInfo.getType();
+
+		// boolean bUseMobileNetwork = context.getSharedPreferences(
+		// "PhoneAsstPref", 0).getBoolean("UseMobileNetwork", false);
+		//
+		// if (bUseMobileNetwork == false
+		// && iconntype != ConnectivityManager.TYPE_WIFI && iconntype != 9/*
+		// earthnet */)
+		// {
+		// Log.d(TAG,);
+		// dbgUtil.Log(Log.DEBUG, "Current Network info",
+		// "not allowed!Connection type=" + networkInfo.getTypeName());
+		// return false;
+		// }
+		boolean bavailable = networkInfo.isAvailable();
+		String strtype = networkInfo.getTypeName();
+
+		Log.d(TAG, " type = " + strtype + " abailable = " + bavailable
+				+ " state " + netState);
+		// dbgUtil.Log(Log.INFO, "Current Network info", " type = " + strtype
+		// + " abailable = " + bavailable + " state " + netState);
+		return bavailable;
+	}
+
+}

+ 68 - 0
RA Image/app/src/main/java/com/usai/util/SqlOpenHelper.java

@@ -0,0 +1,68 @@
+package com.usai.util;
+
+//import android.R.array;
+import java.util.ArrayList;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabase.CursorFactory;
+import android.database.sqlite.SQLiteOpenHelper;
+
+public class SqlOpenHelper extends SQLiteOpenHelper{
+
+	private ArrayList<String> initSQL = new ArrayList<String>();
+	public void addInitSQL(String sql)
+	{
+		initSQL.add(sql);
+		
+	}
+	public int get_RecordCount(String tablename)
+	{
+		return 0;
+		
+	}
+	public SQLiteDatabase OpenDB(boolean writable)
+	{
+		if (writable)
+			return getWritableDatabase();
+		else
+			return getReadableDatabase();
+	}
+	
+	private void initDB(SQLiteDatabase db)
+	{
+		for(int i=0;i<initSQL.size();i++)
+		{
+			db.execSQL(initSQL.get(i));
+		}
+	
+		
+	}
+	public SqlOpenHelper(Context context, String name, CursorFactory factory,
+			int version) {
+		super(context, name, factory, version);
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void onCreate(SQLiteDatabase db) {
+		// TODO Auto-generated method stub
+		initDB(db);
+		
+	}
+
+	@Override
+	public void onOpen(SQLiteDatabase db) {
+		// TODO Auto-generated method stub
+		super.onOpen(db);
+	}
+
+	@Override
+	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+		// TODO Auto-generated method stub
+		db.execSQL("ALTER TABLE pics ADD try_count INTEGER DEFAULT (0)");
+//		String sql="alter table pics add field try_count INTEGER";
+		
+	}
+
+}

+ 536 - 0
RA Image/app/src/main/java/com/usai/util/dbUtil.java

@@ -0,0 +1,536 @@
+package com.usai.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.usai.redant.raimage.RedAntApplication;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabase.CursorFactory;
+import android.database.sqlite.SQLiteException;
+import android.net.Uri;
+import android.util.Log;
+
+public class dbUtil
+{
+
+	// public static final String ZONECODE
+	// public static final int FILTER_TYPE_MSG = 0;
+	// public static final int FILTER_TYPE_BOTH = 1;
+	// public static final int FILTER_TYPE_CALL = 2;
+
+	// public static final int RECORD_TYPE_CALL = 2;
+	// public static final int RECORD_TYPE_MSG = 1;
+	//
+	// public static final int NUMBER_TYPE_NULL = 0;
+	// public static final int NUMBER_TYPE_NORMAL = 1;
+	// public static final int NUMBER_TYPE_BLACK = 2;
+	// public static final int NUMBER_TYPE_WHITE = 3;
+	// public static final int NUMBER_TYPE_GRAY = 4;
+	// public static final int NUMBER_TYPE_UNKNOWN = 7;
+
+	// public static final int NUMBER_TYPE_CONTACT = 5;
+	// public static final int NUMBER_TYPE_SUSPECT = 6;
+
+	// public static final int FILTER_SOURCE_BLACKLIST = 0;
+	// public static final int FILTER_SOURCE_SINGLERING = 1;
+	// public static final int FILTER_SOURCE_KEYWORDS = 2;
+	// public static final int FILTER_SOURCE_NONUMBER = 3;
+
+	// public static void AddNumberToBlacklist(Context context, String Number) {
+	// SQLiteDatabase db;
+	// db = dbUtil.OpenDB(context, null, true);
+	// boolean bexist = isRecordExist(db, "user_numberlist", "number = '"
+	// + Number + "'");
+	// if (bexist == false) {
+	// ContentValues cv = new ContentValues();
+	// cv.put("number", Number);
+	// cv.put("type", dbUtil.NUMBER_TYPE_BLACK);
+	// cv.put("burntype", 3);
+	// cv.put("cimm", PhoneNumberUtils.toCallerIDMinMatch(Number));
+	// db.insert("user_numberlist", null, cv);
+	// }
+	// dbUtil.CloseDB(db);
+	// }
+
+	// public static int KeywordsFilter(Context context, String Msg) {
+	// int ret = -1;
+	// boolean bKeywordsFilter = context.getSharedPreferences("PhoneAsstPref",
+	// 0).getBoolean("KeywordsFilterPref", false);
+	//
+	// // = context.getSharedPreferences("PhoneAsstPref", 0)
+	// // .getBoolean("BlockUnknownNumber", false);
+	// if (bKeywordsFilter == false)
+	// return ret;
+	// SQLiteDatabase db = dbUtil.OpenDB(context, null, true);
+	//
+	// Cursor cursor = null;
+	// try {
+	//
+	// cursor = db.query("user_keywords", new String[] { "_id", "words" },
+	// null, null, null, null, "level desc", null);
+	//
+	// while (cursor.moveToNext()) {
+	// String keywords = cursor.getString(1);
+	// String[] spliter = keywords.split(" ");
+	//
+	// if (spliter.length == 0)
+	// continue;
+	//
+	// int ifound = spliter.length; // 关键字个数
+	// for (int idx = 0; idx < spliter.length; idx++) {
+	// // 兼容以前版本关键字有多空格情况;
+	// if (spliter[idx].equals("")) {
+	// ifound--; // 排除误计算的空数量
+	// continue;
+	// }
+	//
+	// if (Msg.indexOf(spliter[idx]) != -1) {
+	// ifound--;
+	// }
+	// }
+	// if (ifound == 0) {
+	// int id = cursor.getInt(0);
+	// db.execSQL("update " + "user_keywords"
+	// + " set level = level+1 where _id=" + id);
+	// ret = id;
+	// break;// break while
+	// }
+	//
+	// }
+	// } catch (SQLiteException e) {
+	// dbgUtil.Log(Log.ERROR, "sql_err", e.toString());
+	// } finally {
+	// dbUtil.CloseCursor(cursor);
+	// dbUtil.CloseDB(db);
+	// }
+	// return ret;
+	// }
+
+	// public static final int NUMBER_TYPE_UNKNOWN = 5;//no number ,hide number
+	// ect;
+	public static boolean isContentExist(Context context, Uri uri, String where)
+	{
+		boolean ret;
+		Cursor cursor = context.getContentResolver().query(uri, null, where,
+				null, null);
+		dbgUtil.dbgCursorInfo(cursor, context);
+		if (cursor.moveToNext())
+			ret = true;
+		else
+			ret = false;
+
+		dbUtil.CloseCursor(cursor);
+		return ret;
+	}
+
+	// public static int query_NumberType(SQLiteDatabase db, String number) {
+	// String cimm = PhoneNumberUtils.toCallerIDMinMatch(number);
+	// int ret = -1;
+	// Cursor cursor = db.query("user_numberlist", new String[] { "type",
+	// "number" }, "cimm = '" + cimm + "'", null, null, null, null);
+	// while (cursor.moveToNext()) {
+	// if (PhoneNumberUtils.compare(number, cursor.getString(1))) {
+	// dbgUtil.Log(
+	// Log.ERROR,
+	// "QUERY FROM user_numberlist",
+	// number + "=" + cursor.getString(1) + "type="
+	// + cursor.getInt(0));
+	// ret = cursor.getInt(0);
+	// break;
+	// }
+	// }
+	// CloseCursor(cursor);
+	// return ret;
+	// }
+
+	// static boolean isContact(Context context, String number) {
+	// // String cimm=PhoneNumberUtils.toCallerIDMinMatch(number);
+	// return dbUtil.isContentExist(context,
+	// // ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
+	// Uri.withAppendedPath(
+	// ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
+	// Uri.encode(number)),
+	// // ContactsContract.CommonDataKinds.Phone.NUMBER + "= '" +
+	// // number+ "'");
+	// /* "min_match = '" + cimm+ "'" */null);
+	// }
+
+	// static boolean isSuspect(SQLiteDatabase db, String number) {
+	// return dbUtil.isRecordExist(db, "user_suspectlist", "number = '"
+	// + number + "'");
+	// }
+
+	// public static int get_CallNumberType_old(Context context,
+	// String incomingNumber)
+	// {
+	// int type = NUMBER_TYPE_NULL;
+	// SQLiteDatabase db = dbUtil.OpenDB(context, null, true);
+	//
+	// boolean bBlockUnknown = context
+	// .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// "BlockUnknownNumber", false);
+	// boolean bignorcontact = context
+	// .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// "IgnoreContact", false);
+
+	// if ((incomingNumber == null || incomingNumber.equals("")))
+	// if (bBlockUnknown)
+	// type = NUMBER_TYPE_BLACK;
+	// else
+	// type = NUMBER_TYPE_NORMAL;
+	// else
+	// {
+	// type = query_NumberType(db, incomingNumber);
+	// if (type == NUMBER_TYPE_WHITE)
+	// {
+	//
+	// }
+	// else
+	// if (bignorcontact && isContact(context, incomingNumber))
+	// {
+	// type = NUMBER_TYPE_CONTACT;
+	// dbgUtil.Log(Log.ERROR,null, "number type contact");
+	// }
+	// else
+	// if (type == NUMBER_TYPE_BLACK)
+	// {
+	// }
+	// else
+	// if (dbUtil.isRecordExist(db, "user_suspectlist",
+	// "number = '" + incomingNumber + "'"))
+	// {
+	// type = NUMBER_TYPE_SUSPECT;
+	// }
+	// else
+	// {
+	// type = NUMBER_TYPE_NORMAL;
+	//
+	// }
+	// }
+	// dbUtil.CloseDB(db);
+	//
+	// dbgUtil.Log(Log.ERROR,"get_CallNumberType",
+	// "number="+incomingNumber+" type="+type);
+	// return type;
+	//
+	// }
+
+	// public static NumberInfo get_NumberInfo(Context context,
+	// String incomingNumber)
+	// {
+	// NumberInfo numberInfo = new NumberInfo();
+	// numberInfo.incomingNumber = incomingNumber;
+	// SQLiteDatabase db = dbUtil.OpenDB(context, null, true);
+	//
+	// // boolean bBlockUnknown = context
+	// // .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// // "BlockUnknownNumber", false);
+	// // boolean bignorcontact = context
+	// // .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// // "IgnoreContact", false);
+	//
+	// // int type = NUMBER_TYPE_NULL;
+	// if (incomingNumber == null || incomingNumber.length() < 3)
+	// {
+	// numberInfo.BaseType = NUMBER_TYPE_UNKNOWN;
+	// }
+	// else
+	// {
+	// numberInfo.BaseType = query_NumberType(db, incomingNumber);
+	// if (numberInfo.BaseType == -1)// not in user_numberlist;
+	// {
+	// numberInfo.BaseType = NUMBER_TYPE_NORMAL;
+	//
+	// // else
+	// // if (isSuspect(db, incomingNumber))
+	// // {
+	// // type = NUMBER_TYPE_SUSPECT;
+	// //
+	// // }
+	// // else
+	// // {
+	// // type = NUMBER_TYPE_NORMAL;
+	// // }
+	// }
+	// if (isContact(context, incomingNumber))
+	// {
+	// numberInfo.isContact = true;
+	// // type = NUMBER_TYPE_CONTACT;
+	// }
+	// if (isSuspect(db, incomingNumber))
+	// {
+	// numberInfo.isSuspect = true;
+	//
+	// }
+	//
+	// // else
+	// // if (type == NUMBER_TYPE_BLACK)
+	// // {
+	// // if (isContact(context, incomingNumber))
+	// // {
+	// // type = NUMBER_TYPE_CONTACT;
+	// // }
+	// // }
+	// }
+	// dbUtil.CloseDB(db);
+	//
+	// dbgUtil.Log(Log.ERROR, "get_NumberInfo", "number=" + incomingNumber
+	// + " type=" + numberInfo.BaseType);
+	// return numberInfo;
+	//
+	// }
+
+	// public static int get_SmsNumberType(Context context, String
+	// incomingNumber)
+	// {
+	// SQLiteDatabase db = dbUtil.OpenDB(context, null, false);
+	//
+	// boolean bBlockUnknown = context
+	// .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// "BlockUnknownNumber", false);
+	// boolean bignorcontact = context
+	// .getSharedPreferences("PhoneAsstPref", 0).getBoolean(
+	// "IgnoreContact", false);
+	//
+	// int type = NUMBER_TYPE_NULL;
+	// if ((incomingNumber == null || incomingNumber.equals("")))
+	// if (bBlockUnknown)
+	// type = NUMBER_TYPE_BLACK;
+	// else
+	// type = NUMBER_TYPE_NORMAL;
+	// else
+	// {
+	// type = query_NumberType(db, incomingNumber);
+	// if (type == NUMBER_TYPE_WHITE)
+	// {
+	//
+	// }
+	// else
+	// if (bignorcontact && isContact(context, incomingNumber))
+	// {
+	// type = NUMBER_TYPE_CONTACT;
+	// dbgUtil.Log(Log.ERROR, null, "number type contact");
+	// }
+	// else
+	// if (type == NUMBER_TYPE_BLACK)
+	// {
+	// }
+	// else
+	// {
+	// type = NUMBER_TYPE_NORMAL;
+	//
+	// }
+	// }
+	// dbUtil.CloseDB(db);
+	//
+	// return type;
+	//
+	// }
+
+	public static void CloseDB(SQLiteDatabase db)
+	{
+		if (db == null)
+			return;
+		if (db.isOpen() == false)
+			return;
+		db.close();
+		return;
+
+	}
+
+	public static void CloseCursor(Cursor c)
+	{
+		if (c == null)
+			return;
+		if (c.isClosed())
+			return;
+		c.close();
+		return;
+
+	}
+
+	public static SQLiteDatabase OpenDB(Context context, CursorFactory factory,
+			boolean writable)
+	{
+
+		SqlOpenHelper dbHelper = new SqlOpenHelper(context, "redantpop.db",
+				factory, 2);
+		dbHelper.addInitSQL("create table users (" + "_id INTEGER PRIMARY KEY,"
+				+ "name varchar(20)," + "pass varchar(20))");
+
+		// dbHelper.addInitSQL("create table scan_records ("
+		// + "_id INTEGER PRIMARY KEY," + "submit BOOLEAN DEFAULT (0),"
+		// + "picker VARCHAR(20)," + "pid varchar(20))");
+
+		dbHelper.addInitSQL("create table pics (" + "_id INTEGER PRIMARY KEY,"
+				+ "picker varchar(20)," + "server varchar(20),"+ "err_code INTEGER ,"
+				+ "pid varchar(20),"+ "try_count INTEGER DEFAULT (0)," + "local_path varchar(256))");
+		
+//		dbHelper.addInitSQL("create table pids (" + "_id INTEGER PRIMARY KEY,"
+//				+ "picker varchar(20)," + "err_code INTEGER ,"
+//				+ "pid varchar(20))");
+
+		SQLiteDatabase db = dbHelper.OpenDB(writable);
+		return db;
+	}
+
+	public static void removeRecords(SQLiteDatabase db, String table,
+			String whereclause)
+	{
+		db.execSQL("delete from " + table + " where " + whereclause);
+	}
+
+	public static long addRecordsFromCursor(SQLiteDatabase db,
+			String tablename, Cursor source, String[] from, String[] to,
+			boolean dumpPrimaryKey, boolean dumpOneRecord)
+	{
+		int ret = -1;
+		ContentValues cv = new ContentValues();
+
+		if (from == null)
+			from = source.getColumnNames();
+
+		if (to == null)
+			to = source.getColumnNames();
+
+		if (from.length != to.length)// 字段数不匹配
+			return ret;
+
+		while (source.moveToNext())
+		{
+
+			for (int i = 0; i < from.length; i++)
+			{
+				if (from[i].equals("_id"))
+				{
+					if (dumpPrimaryKey)
+						cv.put(to[i], source.getInt(i));
+				}
+				else
+				{
+					cv.put(to[i], source.getString(i));
+				}
+
+			}
+			db.insert(tablename, null, cv);
+
+			if (dumpOneRecord)
+				break;
+		}
+
+		ret = 1;
+		return ret;
+
+	}
+
+	// public static long addRecord(SQLiteDatabase db, String table,
+	// ContentValues record)
+	// {
+	// long ret = -1;
+	// try
+	// {
+	// ret = db.insert(table, null, record);
+	// }
+	// catch (SQLiteException e)
+	// {
+	// dbgUtil.Log(Log.ERROR,"sql_err", e.toString());
+	//
+	// }
+	// return ret;
+	// }
+	public static List<String> get_userlist()
+	{
+		List<String> ret = new ArrayList<String>();
+		SQLiteDatabase db = OpenDB(RedAntApplication.getInstance()
+				.getApplicationContext(), null, false);
+		Cursor cursor = db.query(
+				"users",
+				new String[] { "name" },
+				null, null, null,
+				null, "name desc", null);
+
+		while (cursor.moveToNext())
+		{
+			String user="";
+			try
+			{
+				user = Crypto.decrypt("apexu", cursor.getString(0));
+			}
+			catch (Exception e)
+			{
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			ret.add(user);
+
+		}
+
+		CloseCursor(cursor);
+		CloseDB(db);
+		return ret;
+	}
+	public static boolean isTableEmpty(SQLiteDatabase db, String table)
+	{
+		boolean ret = true;
+
+		Cursor cursor = null;
+		try
+		{
+
+			cursor = db.query(table, new String[] { "*" }, null, null, null,
+					null, null, "1");
+			if (cursor.moveToNext())
+			{
+				// cursor.close();
+				ret = false;
+			}
+			else
+				ret = true;
+		}
+		catch (SQLiteException e)
+		{
+			Log.e("sql_err", e.toString());
+		}
+		finally
+		{
+			dbUtil.CloseCursor(cursor);
+		}
+		return ret;
+	}
+
+	public static boolean isRecordExist(SQLiteDatabase db, String table,
+			String where)
+	{
+		boolean ret = false;
+		Cursor cursor = null;
+		try
+		{
+
+			cursor = db.query(table, new String[] { "_id" }, where, null, null,
+					null, null, null);
+			if (cursor.moveToNext())
+				ret = true;
+			else
+				ret = false;
+		}
+		catch (SQLiteException e)
+		{
+			Log.e("sql_err", e.toString());
+
+		}
+		finally
+		{
+
+			dbUtil.CloseCursor(cursor);
+		}
+		return ret;
+
+	}
+
+	// if(isTableEmpty(db,"block_records"))
+
+}

+ 240 - 0
RA Image/app/src/main/java/com/usai/util/dbgUtil.java

@@ -0,0 +1,240 @@
+package com.usai.util;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import com.usai.redant.raimage.RedAntApplication;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.os.Environment;
+import android.util.Log;
+
+public class dbgUtil
+{
+	// static boolean ENABLE_DEBUG = true;
+	// static boolean ENABLE_SQL_DEBUG = true;
+	// final int DEBUG_LEVEL_NONE = 8;
+	// static int DEBUG_LEVEL = Log.VERBOSE;
+
+	// private static boolean m_dbgFlag = true;
+	/*
+	 * public dbgUtil(Context context) {
+	 * 
+	 * m_dbgFlag = Boolean.parseBoolean(context.getString(R.string.flag_debug));
+	 * 
+	 * }
+	 * 
+	 * public dbgUtil(Context context) { m_dbgFlag =
+	 * Boolean.parseBoolean(context.getString(R.string.flag_debug)); return
+	 * this; }
+	 */
+	public static void fileLog(String content)
+	{
+		
+		File dir = new File(Environment.getExternalStorageDirectory().getPath()
+				+ "/redant/pop");
+		if (!dir.exists())
+			dir.mkdirs();
+
+		Calendar c = Calendar.getInstance();
+		c.add(Calendar.MONDAY, -1);
+
+		String newtime = new SimpleDateFormat("yyyy-MM-dd").format(c
+				.getTimeInMillis());
+
+		File[] f = dir.listFiles();
+		for (int i = 0; i < f.length; i++)
+		{
+			if(!f[i].isFile())
+				continue;
+			String n = f[i].getName();
+			if ((n != null) && (n.length() > 0))
+			{
+				int dot = n.lastIndexOf('.');
+				if ((dot > -1) && (dot < (n.length())))
+				{
+					n = n.substring(0, dot);
+				}
+				if(newtime.compareTo(n)>0)
+					f[i].delete();
+				
+
+
+			}
+		}
+
+		// dir.listfiles
+
+		String file = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+		String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
+				.format(new Date());
+
+		FileOutputStream outputStream = null;
+		// try
+		// {
+
+		// dir.createNewFile()
+		File logfile = new File(Environment.getExternalStorageDirectory()
+				.getPath() + "/redant/pop/" + file + ".log");
+
+		// int mode = Application.MODE_APPEND;
+		if (!logfile.exists())
+		{
+			// mode = Application.MODE_PRIVATE;
+			try
+			{
+				logfile.createNewFile();
+			}
+			catch (IOException e)
+			{
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		// outputStream
+		// =RedAntApplication.getInstance().openFileOutput("pop.log", mode);
+
+		String logtextString = timeStamp + "   " + content;
+
+		FileWriter fw = null;
+		BufferedWriter bw = null;
+		String datetime = "";
+		try
+		{
+			RedAntApplication.loglock.writeLock().lock();
+
+			fw = new FileWriter(Environment.getExternalStorageDirectory()
+					.getPath() + "/redant/pop/" + file + ".log", true);//
+			// 创建FileWriter对象,用来写入字符流
+			bw = new BufferedWriter(fw); // 将缓冲对文件的输出
+			// String myreadline = datetime + "[]" + str;
+
+			bw.write(logtextString + "\n"); // 写入文件
+			bw.newLine();
+			bw.flush(); // 刷新该流的缓冲
+			bw.close();
+			fw.close();
+			RedAntApplication.loglock.writeLock().unlock();
+		}
+		catch (IOException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			try
+			{
+				bw.close();
+				fw.close();
+			}
+			catch (IOException e1)
+			{
+				// TODO Auto-generated catch block
+			}
+		}
+
+	}
+
+	public static void Logd(String tag, String msg)
+	{
+		String pos = getTracePos();
+		Log.d(tag, msg + pos);
+	}
+
+	// public static void Log(int type, String tag, String msg)
+	// {
+	// // if (ENABLE_DEBUG == false)
+	// // return;
+	// // if (type < DEBUG_LEVEL)
+	// // return;
+	// String pos= getTracePos();
+	// switch (type)
+	// {
+	// case Log.ASSERT:
+	// Log.wtf(tag, msg+pos);
+	// break;
+	// case Log.DEBUG:
+	// Log.d(tag, msg+pos);
+	// break;
+	// case Log.ERROR:
+	// Log.e(tag, msg+pos);
+	// break;
+	// case Log.INFO:
+	// Log.i(tag, msg+pos);
+	// break;
+	// case Log.VERBOSE:
+	// Log.v(tag, msg+pos);
+	// break;
+	// case Log.WARN:
+	// Log.w(tag, msg+pos);
+	// break;
+	// default:
+	// Log.wtf("dbgUtil", "LOG TYPE ERROR!"+pos);
+	// break;
+	// }
+	//
+	// }
+
+	private static String getTracePos()
+	{
+		// StackTraceElement[] elements =
+		// Thread.currentThread().getStackTrace();
+		StackTraceElement element = Thread.currentThread().getStackTrace()[4];
+
+		return " at " + element.getClassName() + "." + element.getMethodName()
+				+ "(" + element.getFileName() + ":" + element.getLineNumber()
+				+ ")";
+	}
+
+	public static void dbgCursorInfo(Cursor cursor, Context context/*
+																	 * , String
+																	 * TracePos
+																	 */)
+	{
+		// if (ENABLE_SQL_DEBUG == false)
+		// return;
+
+		// ----------------------debug cursor-----------------------------------
+		Log.d("sql_dbg@dbgCursorInfo",
+				getTracePos() + "Cursor size:	" + cursor.getCount()
+						+ ";	columns count:	" + cursor.getColumnCount() + ";");
+		// dbgUtil.Log(Log.DEBUG,"sql_dbg", getTracePos() + "Cursor size:	" +
+		// cursor.getCount()
+		// + ";	columns count:	" + cursor.getColumnCount() + ";");
+		for (int i = 0; i < cursor.getColumnCount(); i++)
+		{
+			Log.d("sql_dbg@dbgCursorInfo", "column idx:	" + i
+					+ ";		column name:	" + cursor.getColumnName(i) + ";");
+			// dbgUtil.Log(Log.DEBUG,"sql_dbg",
+			// "column idx:	" + i + ";		column name:	"
+			// + cursor.getColumnName(i) + ";");
+		}
+		// ----------------------debug cursor-----------------------------------
+
+	}
+	// public static void dbgCursorMoreInfo(Cursor cursor /*, String TracePos*/)
+	// {
+	// if(Boolean.parseBoolean(context.getString(R.string.flag_debug))==false)
+	// return;
+	//
+	//
+	// //----------------------debug cursor-----------------------------------
+	// dbgUtil.Log(Log.DEBUG,"sql_dbg",Log.getStackTraceString(new Throwable())
+	// +"Cursor size:	"+cursor.getCount()
+	// +";	columns count:	"+cursor.getColumnCount()
+	// +";");
+	// for (int i =0;i<cursor.getColumnCount();i++)
+	// {
+	// dbgUtil.Log(Log.DEBUG,"sql_dbg","column idx:	"+i
+	// +";		column name:	"+cursor.getColumnName(i)
+	// +";");
+	// }
+	// //----------------------debug cursor-----------------------------------
+	//
+	// }
+}

+ 8 - 0
RA Image/app/src/main/java/com/usai/util/package-info.java

@@ -0,0 +1,8 @@
+/**
+ * 
+ */
+/**
+ * @author Ray
+ *
+ */
+package com.usai.util;

BIN
RA Image/app/src/main/res/drawable-hdpi/bar2.png


BIN
RA Image/app/src/main/res/drawable-hdpi/ic_action_camera.png


BIN
RA Image/app/src/main/res/drawable-hdpi/ic_action_upload.png


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


+ 20 - 0
RA Image/app/src/main/res/drawable-hdpi/imagebutton.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true">
+           <shape android:shape="rectangle" >
+            <!-- 填充的颜色 -->
+            <solid android:color="#33C0C0C0" />
+            <!-- 设置按钮的四个角为弧形 -->
+            <!-- android:radius 弧形的半径 -->
+            <corners android:radius="15dip" />
+            <!-- padding:Button里面的文字与Button边界的间隔 -->
+            <padding android:bottom="0dp" android:left="0dp" android:right="0dp" android:top="0dp" />
+        </shape>
+    </item>
+    <item android:state_pressed="false">
+     <shape android:shape="rectangle">
+            <solid android:color="#33808080" />
+            <corners android:radius="15dip" />
+         </shape>
+    </item> 
+</selector>

BIN
RA Image/app/src/main/res/drawable-hdpi/no_pic.png


BIN
RA Image/app/src/main/res/drawable-hdpi/picture_frame.png


BIN
RA Image/app/src/main/res/drawable-mdpi/ic_launcher.png


BIN
RA Image/app/src/main/res/drawable-xhdpi/ic_launcher.png


BIN
RA Image/app/src/main/res/drawable-xxhdpi/ic_launcher.png


BIN
RA Image/app/src/main/res/drawable-xxhdpi/red_ant_logo.png


+ 4 - 0
RA Image/app/src/main/res/drawable/ic_settings_gray_36dp.xml

@@ -0,0 +1,4 @@
+<vector android:height="36dp" android:viewportHeight="24.0"
+    android:viewportWidth="24.0" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="#FF636363" android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>

+ 28 - 0
RA Image/app/src/main/res/drawable/round_button.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!-- 按壓時 -->
+    <item android:state_pressed="true">
+        <!--rectangle 長方形 可以畫出直角形,圓角形,弧形等-->
+        <shape android:shape="rectangle">
+            <!--設定圓角,當設置的圓角半徑很大,就可變成弧形邊了-->
+            <corners android:radius="45dip" />
+            <!--邊框-->
+            <!--<stroke android:width="1dip" android:color="#538394" />-->
+            <!--漸層顏色-->
+            <!--<gradient android:angle="-90" android:endColor="#017DAB" android:startColor="#0099CC" />-->
+            <solid android:color="#99FFFFFF" />
+        </shape>
+    </item>
+
+    <!-- 預設時 -->
+    <item android:color="@android:color/black">
+        <shape android:shape="rectangle">
+            <corners android:radius="45dip" />
+            <!--<stroke android:width="1dip" android:color="#071E54" />-->
+            <!--<gradient android:angle="-90" android:endColor="#1D2C50" android:startColor="#0E2252" />-->
+            <solid android:color="#99FFFFFF" />
+        </shape>
+    </item>
+
+</selector>

+ 9 - 0
RA Image/app/src/main/res/drawable/switch_thumb.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!--<item android:state_pressed="true" android:drawable="@drawable/thumb_on"/>-->
+    <item android:state_checked="true" android:drawable="@drawable/thumb_on"/>
+
+    <item android:drawable="@drawable/thumb_off"/>
+
+</selector>

+ 8 - 0
RA Image/app/src/main/res/drawable/switch_track.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!--<item android:state_focused="true" android:drawable="@drawable/track_on"/>-->
+    <item android:state_checked="true" android:drawable="@drawable/track_on"/>
+    <item android:drawable="@drawable/track_off"/>
+
+</selector>

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff