Ray Zhang 7 лет назад
Родитель
Сommit
731259cd76
100 измененных файлов с 0 добавлено и 23659 удалено
  1. 0 150
      Apex Mobile/app/app.iml
  2. 0 66
      Apex Mobile/app/build.gradle
  3. BIN
      Apex Mobile/app/libs/BaiduLBS_Android.jar
  4. BIN
      Apex Mobile/app/libs/arm64-v8a/libBaiduMapSDK_base_v4_5_2.so
  5. BIN
      Apex Mobile/app/libs/arm64-v8a/libBaiduMapSDK_map_v4_5_2.so
  6. BIN
      Apex Mobile/app/libs/arm64-v8a/liblocSDK7a.so
  7. BIN
      Apex Mobile/app/libs/armeabi-v7a/libBaiduMapSDK_base_v4_5_2.so
  8. BIN
      Apex Mobile/app/libs/armeabi-v7a/libBaiduMapSDK_map_v4_5_2.so
  9. BIN
      Apex Mobile/app/libs/armeabi-v7a/liblocSDK7a.so
  10. BIN
      Apex Mobile/app/libs/armeabi/libBaiduMapSDK_base_v4_5_2.so
  11. BIN
      Apex Mobile/app/libs/armeabi/libBaiduMapSDK_map_v4_5_2.so
  12. BIN
      Apex Mobile/app/libs/armeabi/liblocSDK7a.so
  13. BIN
      Apex Mobile/app/libs/bcprov-jdk15on-157.jar
  14. BIN
      Apex Mobile/app/libs/core-2.3.0.jar
  15. BIN
      Apex Mobile/app/libs/httpmime-4.1.1.jar
  16. BIN
      Apex Mobile/app/libs/x86/libBaiduMapSDK_base_v4_5_2.so
  17. BIN
      Apex Mobile/app/libs/x86/libBaiduMapSDK_map_v4_5_2.so
  18. BIN
      Apex Mobile/app/libs/x86/liblocSDK7a.so
  19. BIN
      Apex Mobile/app/libs/x86_64/libBaiduMapSDK_base_v4_5_2.so
  20. BIN
      Apex Mobile/app/libs/x86_64/libBaiduMapSDK_map_v4_5_2.so
  21. BIN
      Apex Mobile/app/libs/x86_64/liblocSDK7a.so
  22. 0 21
      Apex Mobile/app/lint.xml
  23. 0 40
      Apex Mobile/app/proguard-project.txt
  24. 0 355
      Apex Mobile/app/src/main/AndroidManifest.xml
  25. BIN
      Apex Mobile/app/src/main/ic_launcher-web.png
  26. 0 167
      Apex Mobile/app/src/main/java/com/usai/Contacts/Contact.java
  27. 0 475
      Apex Mobile/app/src/main/java/com/usai/Contacts/ContactsManager.java
  28. 0 154
      Apex Mobile/app/src/main/java/com/usai/apex/AboutActivity.java
  29. 0 362
      Apex Mobile/app/src/main/java/com/usai/apex/Alarmreceiver.java
  30. 0 497
      Apex Mobile/app/src/main/java/com/usai/apex/AnnouncementActivity.java
  31. 0 219
      Apex Mobile/app/src/main/java/com/usai/apex/ApexActivity.java
  32. 0 51
      Apex Mobile/app/src/main/java/com/usai/apex/ApexBackgroundService.java
  33. 0 88
      Apex Mobile/app/src/main/java/com/usai/apex/ApexHistoryActivity.java
  34. 0 25
      Apex Mobile/app/src/main/java/com/usai/apex/ApexPushService.java
  35. 0 508
      Apex Mobile/app/src/main/java/com/usai/apex/ApexTrackingApplication.java
  36. 0 700
      Apex Mobile/app/src/main/java/com/usai/apex/BaiduMapFragment.java
  37. 0 97
      Apex Mobile/app/src/main/java/com/usai/apex/BootBroadcastReceiver.java
  38. 0 370
      Apex Mobile/app/src/main/java/com/usai/apex/ChangePasswordActivity.java
  39. 0 166
      Apex Mobile/app/src/main/java/com/usai/apex/ContainerSearchActivity.java
  40. 0 330
      Apex Mobile/app/src/main/java/com/usai/apex/CustomizeFieldsActivity.java
  41. 0 607
      Apex Mobile/app/src/main/java/com/usai/apex/DetailActivity.java
  42. 0 1726
      Apex Mobile/app/src/main/java/com/usai/apex/DetailFragment.java
  43. 0 25
      Apex Mobile/app/src/main/java/com/usai/apex/DocumentsActivity.java
  44. 0 86
      Apex Mobile/app/src/main/java/com/usai/apex/DocumentsFragment.java
  45. 0 282
      Apex Mobile/app/src/main/java/com/usai/apex/DragListView.java
  46. 0 411
      Apex Mobile/app/src/main/java/com/usai/apex/FunctionSelectActivity.java
  47. 0 48
      Apex Mobile/app/src/main/java/com/usai/apex/HelpActivity.java
  48. 0 312
      Apex Mobile/app/src/main/java/com/usai/apex/InnerMapActivity.java
  49. 0 31
      Apex Mobile/app/src/main/java/com/usai/apex/InnerToolsActivity.java
  50. 0 540
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPICell.java
  51. 0 67
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIDot.java
  52. 0 47
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIItemButton.java
  53. 0 47
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIListView.java
  54. 0 53
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPISwipeRefresh.java
  55. 0 88
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIViewPager.java
  56. 0 711
      Apex Mobile/app/src/main/java/com/usai/apex/KPI/PieChartView.java
  57. 0 70
      Apex Mobile/app/src/main/java/com/usai/apex/LicenseActivity.java
  58. 0 203
      Apex Mobile/app/src/main/java/com/usai/apex/LocalDocumentActivity.java
  59. 0 29
      Apex Mobile/app/src/main/java/com/usai/apex/LocationDetail.java
  60. 0 171
      Apex Mobile/app/src/main/java/com/usai/apex/LocationDetailActivity.java
  61. 0 370
      Apex Mobile/app/src/main/java/com/usai/apex/MessageActivity.java
  62. 0 424
      Apex Mobile/app/src/main/java/com/usai/apex/MessageDetailActivity.java
  63. 0 646
      Apex Mobile/app/src/main/java/com/usai/apex/Result/AMResultActivity.java
  64. 0 348
      Apex Mobile/app/src/main/java/com/usai/apex/Result/PullRefreshListView.java
  65. 0 1361
      Apex Mobile/app/src/main/java/com/usai/apex/Result/SearchResultActivity.java
  66. 0 871
      Apex Mobile/app/src/main/java/com/usai/apex/ResultActivity.java
  67. 0 424
      Apex Mobile/app/src/main/java/com/usai/apex/RetrievePasswordActivity.java
  68. 0 412
      Apex Mobile/app/src/main/java/com/usai/apex/SearchActivity.java
  69. 0 161
      Apex Mobile/app/src/main/java/com/usai/apex/SearchHistoryActivity.java
  70. 0 702
      Apex Mobile/app/src/main/java/com/usai/apex/SearchListActivity.java
  71. 0 78
      Apex Mobile/app/src/main/java/com/usai/apex/SearchResult.java
  72. 0 174
      Apex Mobile/app/src/main/java/com/usai/apex/SegmentView.java
  73. 0 79
      Apex Mobile/app/src/main/java/com/usai/apex/ServiceLocationFragment.java
  74. 0 371
      Apex Mobile/app/src/main/java/com/usai/apex/SettingsActivity.java
  75. 0 735
      Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java
  76. 0 71
      Apex Mobile/app/src/main/java/com/usai/apex/TestActivity.java
  77. 0 57
      Apex Mobile/app/src/main/java/com/usai/apex/TestAppComActivity.java
  78. 0 45
      Apex Mobile/app/src/main/java/com/usai/apex/ViewPagerAdapter.java
  79. 0 87
      Apex Mobile/app/src/main/java/com/usai/apex/WebActivity.java
  80. 0 133
      Apex Mobile/app/src/main/java/com/usai/apex/actionSheet/ActionSheet.java
  81. 0 594
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultActivity.java
  82. 0 176
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultAdapter.java
  83. 0 497
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultPresenter.java
  84. 0 53
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultAdditionView.java
  85. 0 70
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultDocumentCell.java
  86. 0 165
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultShipCell.java
  87. 0 50
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultBaseModel.java
  88. 0 36
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultDocumentModel.java
  89. 0 116
      Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultShipModel.java
  90. 0 318
      Apex Mobile/app/src/main/java/com/usai/apex/base/BaseObject.java
  91. 0 176
      Apex Mobile/app/src/main/java/com/usai/apex/button/RAButton.java
  92. 0 94
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/BottomNavigationViewHelper.java
  93. 0 355
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/HistoryFragment.java
  94. 0 230
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/HomeFragment.java
  95. 0 749
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/KPIFragment.java
  96. 0 477
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/LoginFragment.java
  97. 0 167
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/MyFragment.java
  98. 0 934
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/NewDetailActivity.java
  99. 0 30
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/NoScrollViewPager.java
  100. 0 428
      Apex Mobile/app/src/main/java/com/usai/apex/mainframe/RecentFragment.java

+ 0 - 150
Apex Mobile/app/app.iml

@@ -1,150 +0,0 @@
-<?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">
-    <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/apt/debug" isTestSource="false" generated="true" />
-      <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/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/apt/androidTest/debug" isTestSource="true" generated="true" />
-      <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/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$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
-      <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/androidTestDebug/res" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/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/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" />
-      <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" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res_stripped" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
-      <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/reports" />
-      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
-    </content>
-    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.0.2@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:transition-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.github.barteksc:pdfium-android-1.8.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-location-license-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-maps-license-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/Apex Mobile/app/libs/BaiduLBS_Android.jar:unspecified@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-license-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/Apex Mobile/app/libs/bcprov-jdk15on-157.jar:unspecified@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-1.0.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:design-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-license-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/Apex Mobile/app/libs/core-2.3.0.jar:unspecified@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-license-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-location-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.github.barteksc:android-pdf-viewer-3.0.0-beta.5" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/Apex Mobile/app/libs/httpmime-4.1.1.jar:unspecified@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-maps-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-11.4.2" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.http.legacy-android-27" level="project" />
-  </component>
-</module>

+ 0 - 66
Apex Mobile/app/build.gradle

@@ -1,66 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
-    signingConfigs {
-    }
-    compileSdkVersion 26
-
-    defaultConfig {
-        applicationId "com.usai.apex"
-        minSdkVersion 23
-        targetSdkVersion 26
-//        multiDexEnabled true
-
-//        ndk {
-//            abiFilters  "armeabi-v7a"  // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉)
-//        }
-    }
-    buildTypes {
-        release {
-
-            ndk {
-                abiFilters "armeabi-v7a"
-                // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉)
-            }
-
-            minifyEnabled true
-            zipAlignEnabled true
-            shrinkResources true
-            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
-        }
-        debug {
-//            minifyEnabled true
-//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
-        }
-    }
-    sourceSets {
-        main {
-            jniLibs.srcDir 'libs'
-            //说明so的路径为该libs路径,关联所有地图SDK的so文件
-        }
-    }
-
-}
-
-dependencies {
-    //    compile 'com.android.support:support-v4:19.1.0'
-
-    implementation files('libs/bcprov-jdk15on-157.jar')
-    api 'com.android.support:appcompat-v7:26.1.0'
-    api 'com.android.support:support-v4:26.1.0'
-    api 'com.android.support.constraint:constraint-layout:1.1.3'
-    api 'com.android.support:design:26.1.0'
-    //    compile 'com.android.support:recyclerview-v7:26.1.0'
-//    compile 'com.google.android.gms:play-services:11.0.4'
-    api 'com.google.android.gms:play-services-maps:11.4.2'
-    api 'com.google.android.gms:play-services-location:11.4.2'
-    //    compile files('libs/baidumapapi_base_v3_7_1.jar')
-    //    compile files('libs/baidumapapi_map_v3_7_1.jar')
-    implementation files('libs/httpmime-4.1.1.jar')
-    implementation files('libs/core-2.3.0.jar')
-    api 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
-    implementation files('libs/BaiduLBS_Android.jar')
-}
-android {
-    useLibrary 'org.apache.http.legacy'
-}

BIN
Apex Mobile/app/libs/BaiduLBS_Android.jar


BIN
Apex Mobile/app/libs/arm64-v8a/libBaiduMapSDK_base_v4_5_2.so


BIN
Apex Mobile/app/libs/arm64-v8a/libBaiduMapSDK_map_v4_5_2.so


BIN
Apex Mobile/app/libs/arm64-v8a/liblocSDK7a.so


BIN
Apex Mobile/app/libs/armeabi-v7a/libBaiduMapSDK_base_v4_5_2.so


BIN
Apex Mobile/app/libs/armeabi-v7a/libBaiduMapSDK_map_v4_5_2.so


BIN
Apex Mobile/app/libs/armeabi-v7a/liblocSDK7a.so


BIN
Apex Mobile/app/libs/armeabi/libBaiduMapSDK_base_v4_5_2.so


BIN
Apex Mobile/app/libs/armeabi/libBaiduMapSDK_map_v4_5_2.so


BIN
Apex Mobile/app/libs/armeabi/liblocSDK7a.so


BIN
Apex Mobile/app/libs/bcprov-jdk15on-157.jar


BIN
Apex Mobile/app/libs/core-2.3.0.jar


BIN
Apex Mobile/app/libs/httpmime-4.1.1.jar


BIN
Apex Mobile/app/libs/x86/libBaiduMapSDK_base_v4_5_2.so


BIN
Apex Mobile/app/libs/x86/libBaiduMapSDK_map_v4_5_2.so


BIN
Apex Mobile/app/libs/x86/liblocSDK7a.so


BIN
Apex Mobile/app/libs/x86_64/libBaiduMapSDK_base_v4_5_2.so


BIN
Apex Mobile/app/libs/x86_64/libBaiduMapSDK_map_v4_5_2.so


BIN
Apex Mobile/app/libs/x86_64/liblocSDK7a.so


+ 0 - 21
Apex Mobile/app/lint.xml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<lint>
-    <issue id="ContentDescription" severity="ignore" />
-    <issue id="ExtraTranslation" severity="warning" />
-    <issue id="HardcodedDebugMode">
-        <ignore path="AndroidManifest.xml" />
-    </issue>
-    <issue id="HardcodedText">
-        <ignore path="res/layout/fragment_direct_tracking.xml" />
-    </issue>
-    <issue id="MissingTranslation" severity="warning" />
-    <issue id="TextFields">
-        <ignore path="res/layout/fragment_direct_tracking.xml" />
-    </issue>
-    <issue id="UselessParent">
-        <ignore path="res/layout/fragment_direct_tracking.xml" />
-    </issue>
-    <issue id="ValidFragment">
-        <ignore path="src/com/usai/apex/DetailFragment.java" />
-    </issue>
-</lint>

+ 0 - 40
Apex Mobile/app/proguard-project.txt

@@ -1,40 +0,0 @@
-# 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 *;
-#}
-#-libraryjars   /libs/android-support-v4.jar
-#-libraryjars   /libs/httpmime-4.1.1.jar
-
--dontwarn android.support.v4.** 
--dontwarn com.google.android.gms.** 
--dontwarn javax.naming.**
-
-# 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(...);
-}
-
-
--keep class com.baidu.** {*;}
-#-keep class com.baidu.mapapi.** {*;}
--keep class vi.com.gdi.bgl.** {*;}

+ 0 - 355
Apex Mobile/app/src/main/AndroidManifest.xml

@@ -1,355 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.usai.apex"
-          android:versionCode="17"
-          android:versionName="A180723"> <!-- Copied from Google Maps Library/AndroidManifest.xml. -->
-  <!--  <uses-sdk android:targetSdkVersion="18"/>-->
-
-    <!-- 写联系人权限 -->
-    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
-    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
-    <!--
-         <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
-    <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
-    -->
-    <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.READ_CONTACTS"/>
-    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
-    <!-- External storage for caching. -->
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-    <!-- My Location -->
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
-    <!-- Maps API needs OpenGL ES 2.0. -->
-    <uses-feature
-        android:glEsVersion="0x00020000"
-        android:required="true"/>
-    <!-- End of copy. -->
-
-
-    <!-- Baidu Map API -->
-
-    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-    <!-- <uses-permission android:name="android.permission.WRITE_SETTINGS" /> -->
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
-
-    <!--
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-
-    <permission android:name="android.permission.BAIDU_LOCATION_SERVICE" >
-    </permission>
-
-    <uses-permission android:name="android.permission.BAIDU_LOCATION_SERVICE" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.INTERNET" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" >
-    </uses-permission>
-    -->
-    <!-- <uses-permission android:name="android.permission.WRITE_APN_SETTINGS"></uses-permission> -->
-    <!--
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
-    </uses-permission>
-    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-   
-    <uses-permission android:name="android.permission.ACCESS_GPS" />
-    -->
-    <!--
-    <uses-permission android:name="android.permission.CALL_PHONE" />
-    <uses-permission android:name="android.permission.READ_SMS" />
-    <uses-permission android:name="android.permission.SEND_SMS" />
-    -->
-    <!-- SDK1.5需要android.permission.GET_TASKS权限判断本程序是否为当前运行的应用? -->
-    <!--
-        <uses-permission android:name="android.permission.GET_TASKS" />
-     <uses-permission android:name="android.permission.CAMERA" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.RECORD_AUDIO" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
-    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
-    -->
-    <!-- 来电消音 -->
-    <!--
-    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" >
-    </uses-permission>
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-    -->
-    <application
-        android:name=".ApexTrackingApplication"
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:screenOrientation="portrait"
-        android:theme="@style/FixedActionbarTheme">
-        <provider
-            android:name="android.support.v4.content.FileProvider"
-            android:authorities="com.usai.apex.fileprovider"
-            android:exported="false"
-            android:grantUriPermissions="true">
-            <meta-data
-                android:name="android.support.FILE_PROVIDER_PATHS"
-                android:resource="@xml/download_dir"/>
-        </provider>
-
-        <!-- release key -->
-        <meta-data
-            android:name="com.google.android.maps.v2.API_KEY"
-            android:value="AIzaSyDdbk58Lx6QzaXcB_hNpSHVp3l_CJeNpoo"/>
-        <meta-data
-            android:name="com.baidu.lbsapi.API_KEY"
-            android:value="nqBQoSDbxrslhuzW91uViQX7"/>
-        <meta-data
-            android:name="com.google.android.gms.version"
-            android:value="@integer/google_play_services_version"/>
-
-        <!-- debug key -->
-
-
-        <!-- <meta-data -->
-        <!-- android:name="com.google.android.maps.v2.API_KEY" -->
-        <!-- android:value="AIzaSyD6Snyg2SDUGtkC3sOAr979__IDCZnGGuU" /> -->
-        <!-- <meta-data -->
-        <!-- android:name="com.baidu.lbsapi.API_KEY" -->
-        <!-- android:value="tznWFxd3RvSoul1TGQp6GSzo" /> -->
-        <!-- <meta-data -->
-        <!-- android:name="com.google.android.gms.version" -->
-        <!-- android:value="@integer/google_play_services_version" /> -->
-
-        <activity
-            android:name=".DetailActivity"
-            android:label="@string/title_activity_detail"
-            android:screenOrientation="portrait"
-            android:theme="@style/DetailActionbarTheme">
-
-            <!--
-                 <meta-data
-                android:name="android.support.PARENT_ACTIVITY"
-                android:value="android.support.v4.app.FragmentActivity" />
-
-           
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name=".ApexActivity"
-            android:label="@string/title_activity_apex"
-            android:logo="@drawable/apexlogo_2"
-            android:screenOrientation="portrait"
-            android:windowSoftInputMode="adjustPan"/>
-        <!--
-             <activity
-            android:name="com.usai.apex.LoginFragment"
-            android:label="@string/title_activity_login"
-            android:windowSoftInputMode="adjustResize|stateVisible" >
-        </activity>
-        <activity
-            android:name="com.usai.apex.DirectTrackingFragment"
-            android:label="@string/title_activity_direct_tracking" >
-        </activity>
-        -->
-        <!-- android:launchMode="singleTask" -->
-        <activity
-            android:name=".mainframe.RootActivity"
-            android:configChanges="fontScale"
-            android:launchMode="singleTop"
-            android:screenOrientation="portrait"
-            android:theme="@style/ToolbarTheme">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <action android:name="android.intent.action.VIEW"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
-            </intent-filter>
-        </activity>
-        <activity
-            android:name=".FunctionSelectActivity"
-            android:label="@string/title_activity_function_select"
-            android:launchMode="singleTop"
-            android:logo="@drawable/apexlogo_2"
-            android:screenOrientation="portrait">
-
-            <!-- <intent-filter> -->
-            <!-- <action android:name="android.intent.action.MAIN" /> -->
-
-
-            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
-            <!-- </intent-filter> -->
-        </activity>
-        <activity
-            android:name=".SearchActivity"
-            android:label="@string/title_activity_search"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".AnnouncementActivity"
-            android:label="@string/title_activity_announcements"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".CustomizeFieldsActivity"
-            android:label="@string/title_activity_customize_fields"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".ResultActivity"
-            android:label="@string/title_activity_result"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".LocationDetailActivity"
-            android:label="@string/title_activity_location_detail"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".InnerMapActivity"
-            android:label="@string/title_activity_inner_map"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".HelpActivity"
-            android:label="@string/title_activity_help"
-            android:screenOrientation="portrait"
-            android:theme="@android:style/Theme.Holo.NoActionBar"/>
-        <activity
-            android:name=".SearchListActivity"
-            android:label="@string/title_activity_search_list"
-            android:screenOrientation="portrait"
-            android:theme="@style/SearchActionbarTheme"
-            android:windowSoftInputMode="adjustUnspecified|stateHidden"/>
-        <activity
-            android:name=".RetrievePasswordActivity"
-            android:label="@string/title_activity_retrieve_password"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".MessageActivity"
-            android:label="@string/title_activity_message"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".SearchHistoryActivity"
-            android:label="@string/title_activity_search_history"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".ChangePasswordActivity"
-            android:label="Change Password"
-            android:screenOrientation="portrait"
-            android:windowSoftInputMode="adjustResize|stateVisible"/>
-        <activity
-            android:name=".AboutActivity"
-            android:label="@string/title_activity_about"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".WebActivity"
-            android:label="@string/title_activity_web"
-            android:screenOrientation="portrait"/>
-
-        <receiver
-            android:name=".BootBroadcastReceiver"
-            android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
-            <intent-filter>
-                <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
-                <action android:name="android.intent.action.BOOT_COMPLETED"/>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
-            </intent-filter>
-        </receiver>
-        <receiver android:name=".Alarmreceiver">
-            <intent-filter>
-                <action android:name="com.usai.apex.push"/>
-                <action android:name="com.usai.apex.push.cancel"/>
-            </intent-filter>
-        </receiver>
-
-        <activity
-            android:name=".MessageDetailActivity"
-            android:label="@string/title_activity_message_detail"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".InnerToolsActivity"
-            android:label="@string/title_activity_inner_tools"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".DocumentsActivity"
-            android:label="@string/title_activity_documents"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".LocalDocumentActivity"
-            android:label="@string/title_activity_localdocuments"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".ApexHistoryActivity"
-            android:label="@string/title_activity_apexhistory"
-            android:screenOrientation="portrait"/>
-        <activity
-            android:name=".SettingsActivity"
-            android:label="@string/title_activity_settings"
-            android:screenOrientation="portrait"/>
-
-        <service
-            android:name=".ApexBackgroundService"
-            android:label="Apex Mobile Background Service"/>
-        <service
-            android:name="com.baidu.location.f"
-            android:enabled="true"
-            android:process=":remote">
-            <intent-filter>
-                <action android:name="com.baidu.location.service_v2.2">
-                </action>
-            </intent-filter>
-        </service>
-
-        <activity
-            android:name=".saved.CheckSavedActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/FixedActionbarTheme"/>
-
-        <activity
-            android:name=".TestAppComActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/FixedActionbarTheme">
-
-            <!-- <intent-filter> -->
-            <!-- <action android:name="android.intent.action.MAIN" /> -->
-
-
-            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->
-            <!-- </intent-filter> -->
-        </activity>
-        <activity
-            android:name=".Result.AMResultActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/ResultActionbarTheme"/>
-        <activity
-            android:name=".Result.SearchResultActivity"
-            android:screenOrientation="portrait"/>
-        <activity android:name=".ContainerSearchActivity"/>
-        <activity
-            android:name=".pdf.PDFPreviewActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/ResultActionbarTheme"/>
-        <activity android:name=".LicenseActivity"/>
-        <activity android:name=".TestActivity"/>
-        <activity
-            android:name=".mainframe.NewDetailActivity"
-            android:screenOrientation="portrait"
-            android:theme="@style/DetailActionbarTheme"/>
-        <activity android:name=".apexResult.ApexResultActivity"
-                  android:theme="@style/ResultActionbarTheme">
-        </activity>
-
-    </application>
-
-</manifest>

BIN
Apex Mobile/app/src/main/ic_launcher-web.png


+ 0 - 167
Apex Mobile/app/src/main/java/com/usai/Contacts/Contact.java

@@ -1,167 +0,0 @@
-package com.usai.Contacts;
-
-import android.graphics.Bitmap;
-import android.provider.ContactsContract;
-
-import java.io.ByteArrayOutputStream;
-
-public class Contact {
-
-    public static final String NUMBER_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
-    public static final String NUMBER_TYPE_FAX_WORK = String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK);
-    public static final String EMAIL_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.Email.TYPE_WORK);
-    public static final String WEB_TYPE_HOMEPAGE = String.valueOf(ContactsContract.CommonDataKinds.Website.TYPE_HOMEPAGE);
-    public static final String POSTAL_TYPE_WORK = String.valueOf(ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
-
-    private String id;
-    private String name;
-    private String number;
-    private String numberType;
-    private String fax;
-    private String faxType;
-    private String email;
-    private String emailType;
-    private String homePage;
-    private String homePageType;
-    private String address;
-    private String addressType;
-    private Bitmap photo;
-
-
-    public Contact(){
-    }
-
-    public Contact(Contact contact){
-        copyContact(contact);
-    }
-
-    public void copyContact(Contact contact) {
-        this.name = contact.getName();
-        this.number = contact.getNumber();
-        this.numberType = contact.getNumberType();
-        this.email = contact.getEmail();
-        this.emailType = contact.getEmailType();
-        this.fax = contact.getFax();
-        this.faxType = contact.getFaxType();
-        this.homePage = contact.getHomePage();
-        this.homePageType = contact.getHomePageType();
-        this.address = contact.getAddress();
-        this.addressType = contact.getAddressType();
-        this.photo = contact.getPhoto();
-    }
-
-    public String getEmail() {
-        return email;
-    }
-    public String getEmailType() {
-        if (emailType == null) {
-            return EMAIL_TYPE_WORK;
-        }
-        return emailType;
-    }
-    public String getId() {
-        return id;
-    }
-    public String getName() {
-        return name;
-    }
-    public String getNumber() {
-        return number;
-    }
-    public String getNumberType() {
-        if (numberType == null) {
-            return NUMBER_TYPE_WORK;
-        }
-        return numberType;
-    }
-    public String getFax() {
-        return fax;
-    }
-    public String getFaxType() {
-        if (faxType == null) {
-            return NUMBER_TYPE_FAX_WORK;
-        }
-        return faxType;
-    }
-    public String getAddress() {
-        return address;
-    }
-
-    public String getAddressType() {
-        if (addressType == null) {
-            return POSTAL_TYPE_WORK;
-        }
-        return addressType;
-    }
-
-    public String getHomePage() {
-        if (homePage == null) {
-            return WEB_TYPE_HOMEPAGE;
-        }
-        return homePage;
-    }
-
-    public String getHomePageType() {
-        return homePageType;
-    }
-
-    public Bitmap getPhoto() {
-        return photo;
-    }
-
-    public byte[] getPhotoData() {
-        if (photo == null) {
-            return null;
-        }
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        photo.compress(Bitmap.CompressFormat.PNG, 100, baos);
-        byte[] data = baos.toByteArray();
-        return data;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-    public void setEmailType(String emailType) {
-        this.emailType = emailType;
-    }
-    public void setId(String id) {
-        this.id = id;
-    }
-    public void setName(String name) {
-        this.name = name;
-    }
-    public void setNumber(String number) {
-        this.number = number;
-    }
-    public void setNumberType(String numberType) {
-        this.numberType = numberType;
-    }
-
-    public void setFax(String fax) {
-        this.fax = fax;
-    }
-    public void setFaxType(String faxType) {
-        this.faxType = faxType;
-    }
-
-    public void setHomePage(String homePage) {
-        this.homePage = homePage;
-    }
-
-    public void setHomePageType(String homePageType) {
-        this.homePageType = homePageType;
-    }
-
-    public void setAddress(String address) {
-        this.address = address;
-    }
-
-    public void setAddressType(String addressType) {
-        this.addressType = addressType;
-    }
-
-    public void setPhoto(Bitmap photo) {
-        this.photo = photo;
-    }
-}

+ 0 - 475
Apex Mobile/app/src/main/java/com/usai/Contacts/ContactsManager.java

@@ -1,475 +0,0 @@
-package com.usai.Contacts;
-
-import android.content.ContentProviderOperation;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.net.Uri;
-import android.provider.ContactsContract;
-import android.util.Log;
-
-import java.util.ArrayList;
-
-public class ContactsManager {
-
-    private ContentResolver contentResolver;
-    private static final String TAG = "ContactsManager";
-
-
-    private static final String COLUMN_CONTACT_ID =
-            ContactsContract.Data.CONTACT_ID;
-    private static final String COLUMN_RAW_CONTACT_ID =
-            ContactsContract.Data.RAW_CONTACT_ID;
-    private static final String COLUMN_MIMETYPE =
-            ContactsContract.Data.MIMETYPE;
-    private static final String COLUMN_NAME =
-            ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME;
-    private static final String COLUMN_NUMBER =
-            ContactsContract.CommonDataKinds.Phone.NUMBER;
-    private static final String COLUMN_NUMBER_TYPE =
-            ContactsContract.CommonDataKinds.Phone.TYPE;
-    private static final String COLUMN_EMAIL =
-            ContactsContract.CommonDataKinds.Email.DATA;
-    private static final String COLUMN_EMAIL_TYPE =
-            ContactsContract.CommonDataKinds.Email.TYPE;
-
-    private static final String COLUMN_WEB =
-            ContactsContract.CommonDataKinds.Website.DATA;
-    private static final String COLUMN_WEB_TYPE =
-            ContactsContract.CommonDataKinds.Website.TYPE;
-
-    private static final String COLUMN_POSTAL =
-            ContactsContract.CommonDataKinds.StructuredPostal.DATA;
-    private static final String COLUMN_POSTAL_TYPE =
-            ContactsContract.CommonDataKinds.StructuredPostal.TYPE;
-
-    private static final String COLUMN_PHOTO =
-            ContactsContract.CommonDataKinds.Photo.PHOTO;
-
-
-    private static final String MIMETYPE_STRING_NAME =
-            ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE;
-    private static final String MIMETYPE_STRING_PHONE =
-            ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE;
-    private static final String MIMETYPE_STRING_EMAIL =
-            ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE;
-    private static final String MIMETYPE_STRING_WEB =
-            ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE;
-    private static final String MIMETYPE_STRING_ADDRESS =
-            ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE;
-    private static final String MIMETYPE_STRING_PHOTO =
-            ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE;
-
-    public ContactsManager(ContentResolver contentResolver) {
-        this.contentResolver = contentResolver;
-    }
-
-
-    public Contact searchContact(String name) {
-        Log.w(TAG, "**search start**");
-        Contact contact = new Contact();
-        contact.setName(name);
-        Log.d(TAG, "search name: " + contact.getName());
-        String id = getContactID(contact.getName());
-        contact.setId(id);
-
-        if(id.equals("0")) {
-            Log.d(TAG, contact.getName() + " not exist. exit.");
-        } else {
-            Log.d(TAG, "find id: " + id);
-            //Fetch Phone Number
-            Cursor cursor = contentResolver.query(
-                    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
-                    new String[]{COLUMN_NUMBER, COLUMN_NUMBER_TYPE},
-                    COLUMN_CONTACT_ID + "='" + id + "'", null, null);
-            while(cursor.moveToNext()) {
-                contact.setNumber(cursor.getString(cursor.getColumnIndex(COLUMN_NUMBER)));
-                contact.setNumberType(cursor.getString(cursor.getColumnIndex(COLUMN_NUMBER_TYPE)));
-                Log.d(TAG, "find number: " + contact.getNumber());
-                Log.d(TAG, "find numberType: " + contact.getNumberType());
-            }
-            //cursor.close();
-
-            //Fetch email
-            cursor = contentResolver.query(
-                    ContactsContract.CommonDataKinds.Email.CONTENT_URI,
-                    new String[]{COLUMN_EMAIL, COLUMN_EMAIL_TYPE},
-                    COLUMN_CONTACT_ID + "='" + id + "'", null, null);
-            while(cursor.moveToNext()) {
-                contact.setEmail(cursor.getString(cursor.getColumnIndex(COLUMN_EMAIL)));
-                contact.setEmailType(cursor.getString(cursor.getColumnIndex(COLUMN_EMAIL_TYPE)));
-                Log.d(TAG, "find email: " + contact.getEmail());
-                Log.d(TAG, "find emailType: " + contact.getEmailType());
-            }
-            cursor.close();
-        }
-        Log.w(TAG, "**search end**");
-        return contact;
-    }
-
-
-    public String getContactID(String name) {
-        String id = "0";
-
-        String searchName = name;
-        Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_FILTER_URI, searchName);
-
-        //  Uri uri2 = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, phoneNumber); 根据电话号码查找联系人
-
-        String[] projection = new String[]{ContactsContract.Contacts._ID};
-        Cursor cursor = contentResolver.query(uri, projection, null, null, null);
-
-        if (cursor.moveToFirst()) {
-            id = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
-        }
-        return id;
-    }
-//    public String getContactID(String name) {
-//        String id = "0";
-//
-//
-////        ContactsContract.Contacts.DISPLAY_NAME_ALTERNATIVE
-//
-//        Cursor cursor = contentResolver.query(
-//                ContactsContract.Contacts.CONTENT_URI,
-//                new String[]{ContactsContract.Contacts._ID},
-//                ContactsContract.Contacts.DISPLAY_NAME_ALTERNATIVE +
-//                        "='" + name + "'", null, null);
-//        if(cursor.moveToNext()) {
-//            id = cursor.getString(cursor.getColumnIndex(
-//                    ContactsContract.Contacts._ID));
-//        }
-//        return id;
-//    }
-
-    public boolean contactExist(String name) {
-        if (name == null) {
-            return false;
-        }
-        String id = getContactID(name);
-        if(!id.equals("0")) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-
-    public void addContact(Contact contact,boolean checkExist) {
-        Log.w(TAG, "**add start**");
-
-        if (checkExist) {
-            String id = getContactID(contact.getName());
-            if(!id.equals("0")) {
-                Log.d(TAG, "contact already exist. exit.");
-            } else if(contact.getName().trim().equals("")){
-                Log.d(TAG, "contact name is empty. exit.");
-            } else {
-                addContact(contact);
-            }
-        } else {
-            addContact(contact);
-        }
-
-        Log.w(TAG, "**add end**");
-
-    }
-
-    private void addContact(Contact contact) {
-
-        ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
-
-        ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
-                .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
-                .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
-                .build());
-        ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_NAME)
-                .withValue(COLUMN_NAME, contact.getName())
-                .build());
-        Log.d(TAG, "add name: " + contact.getName());
-
-        // photo
-        ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_PHOTO)
-                .withValue(COLUMN_PHOTO, contact.getPhotoData())
-                .build());
-
-        // web
-        ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_WEB)
-                .withValue(COLUMN_WEB,contact.getHomePage())
-                .withValue(COLUMN_WEB_TYPE, contact.getHomePage())
-                .build());
-
-        // postal
-        ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_ADDRESS)
-                .withValue(COLUMN_POSTAL,contact.getAddress())
-                .withValue(COLUMN_POSTAL_TYPE, contact.getAddressType())
-                .build());
-
-        if(!contact.getNumber().trim().equals("")) {
-            ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                    .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                    .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_PHONE)
-                    .withValue(COLUMN_NUMBER, contact.getNumber())
-                    .withValue(COLUMN_NUMBER_TYPE, contact.getNumberType())
-                    .build());
-            Log.d(TAG, "add number: " + contact.getNumber());
-        }
-
-        if(!contact.getFax().trim().equals("")) {
-            ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                    .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                    .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_PHONE)
-                    .withValue(COLUMN_NUMBER, contact.getFax())
-                    .withValue(COLUMN_NUMBER_TYPE, contact.getFaxType())
-                    .build());
-            Log.d(TAG, "add fax: " + contact.getFax());
-        }
-
-        if(!contact.getEmail().trim().equals("")) {
-            ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
-                    .withValueBackReference(COLUMN_RAW_CONTACT_ID, 0)
-                    .withValue(COLUMN_MIMETYPE, MIMETYPE_STRING_EMAIL)
-                    .withValue(COLUMN_EMAIL, contact.getEmail())
-                    .withValue(COLUMN_EMAIL_TYPE, contact.getEmailType())
-                    .build());
-            Log.d(TAG, "add email: " + contact.getEmail());
-        }
-
-        try {
-            contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
-            Log.d(TAG, "add contact success.");
-        } catch (Exception e) {
-            Log.d(TAG, "add contact failed.");
-            Log.e(TAG, e.getMessage());
-        }
-    }
-
-
-    public void deleteContact(Contact contact) {
-        Log.w(TAG, "**delete start**");
-        ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
-
-        String id = getContactID(contact.getName());
-        //delete contact
-        ops.add(ContentProviderOperation.newDelete(ContactsContract.RawContacts.CONTENT_URI)
-                .withSelection(ContactsContract.RawContacts.CONTACT_ID+"="+id, null)
-                .build());
-        //delete contact information such as phone number,email
-        ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI)
-                .withSelection(COLUMN_CONTACT_ID + "=" + id, null)
-                .build());
-        Log.d(TAG, "delete contact: " + contact.getName());
-
-        try {
-            contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
-            Log.d(TAG, "delete contact success");
-        } catch (Exception e) {
-            Log.d(TAG, "delete contact failed");
-            Log.e(TAG, e.getMessage());
-        }
-        Log.w(TAG, "**delete end**");
-    }
-
-
-    public void updateContact(Contact contactOld, Contact contactNew) {
-        Log.w(TAG, "**update start**");
-        String id = getContactID(contactOld.getName());
-        if(id.equals("0")) {
-            Log.d(TAG, contactOld.getName()+" not exist.");
-        }/* else if(contactNew.getName().trim().equals("")){
-            Log.d(TAG, "contact name is empty. exit.");
-        } else if(!getContactID(contactNew.getName()).equals("0")){
-            Log.d(TAG, "new contact name already exist. exit.");
-        }*/ else {
-
-            ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
-
-            //update name
-//            ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-//                    .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=?",
-//                            new String[]{id, MIMETYPE_STRING_NAME})
-//                    .withValue(COLUMN_NAME, contactNew.getName())
-//                    .build());
-            Log.d(TAG, "update name: " + contactNew.getName());
-
-            // photo
-            ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                    .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=?",
-                            new String[]{id, MIMETYPE_STRING_PHOTO})
-                    .withValue(COLUMN_PHOTO, contactNew.getPhotoData())
-                    .build());
-
-            // web
-            ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                    .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=?",
-                            new String[]{id, MIMETYPE_STRING_WEB})
-                    .withValue(COLUMN_WEB,contactNew.getHomePage())
-                    .withValue(COLUMN_WEB_TYPE, contactNew.getHomePage())
-                    .build());
-
-            // postal
-            ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                    .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=?",
-                            new String[]{id, MIMETYPE_STRING_ADDRESS})
-                    .withValue(COLUMN_POSTAL,contactNew.getAddress())
-                    .withValue(COLUMN_POSTAL_TYPE, contactNew.getAddressType())
-                    .build());
-
-            //update number
-            if(!contactNew.getNumber().trim().equals("")) {
-                ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                        .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=? AND " + COLUMN_NUMBER_TYPE + "=?",
-                                new String[]{id, MIMETYPE_STRING_PHONE,contactNew.getNumberType()})
-                        .withValue(COLUMN_NUMBER, contactNew.getNumber())
-                        .withValue(COLUMN_NUMBER_TYPE, contactNew.getNumberType())
-                        .build());
-                Log.d(TAG, "update number: " + contactNew.getNumber());
-            }
-
-            // fax
-            if(!contactNew.getNumber().trim().equals("")) {
-                ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                        .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=? AND " + COLUMN_NUMBER_TYPE + "=?",
-                                new String[]{id, MIMETYPE_STRING_PHONE,contactNew.getFaxType()})
-                        .withValue(COLUMN_NUMBER, contactNew.getFax())
-                        .withValue(COLUMN_NUMBER_TYPE, contactNew.getFaxType())
-                        .build());
-                Log.d(TAG, "update fax: " + contactNew.getNumber());
-            }
-
-
-            //update email if mail
-            if(!contactNew.getEmail().trim().equals("")) {
-                ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
-                        .withSelection(COLUMN_CONTACT_ID + "=? AND " + COLUMN_MIMETYPE + "=?",
-                                new String[]{id, MIMETYPE_STRING_EMAIL})
-                        .withValue(COLUMN_EMAIL, contactNew.getEmail())
-                        .withValue(COLUMN_EMAIL_TYPE, contactNew.getEmailType())
-                        .build());
-                Log.d(TAG, "update email: " + contactNew.getEmail());
-            }
-
-            try {
-                contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
-                Log.d(TAG, "update success");
-            } catch (Exception e) {
-                Log.d(TAG, "update failed");
-                Log.e(TAG, e.getMessage());
-            }
-        }
-        Log.w(TAG, "**update end**");
-    }
-
-
-    public Uri getContactUri(String contactId, Context context)  {
-
-        if (context == null || contactId == null) {
-            return null;
-        }
-
-        //获取联系人信息的Uri
-        Uri uri = ContactsContract.Contacts.CONTENT_URI;
-        //获取ContentResolver
-        ContentResolver contentResolver = context.getContentResolver();
-        //查询数据,返回Cursor
-        Cursor cursor = contentResolver.query(uri, null, null, null, null);
-
-
-        while (cursor.moveToNext()) {
-
-            //获取联系人的ID
-            String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
-            //获取联系人的姓名
-            String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
-
-            String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
-
-            if (id != null && id.equals(contactId)) {
-
-                return ContactsContract.Contacts.getLookupUri(Integer.valueOf(contactId), lookupKey);
-
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @brief 显示联系人编辑界面
-     * */
-    public void editContact(String contactId,Context context) {
-
-        if (context == null || contactId == null) {
-            return ;
-        }
-
-        Uri uri = getContactUri(contactId,context);
-        if (uri != null) {
-
-            Intent editIntent = new Intent(Intent.ACTION_EDIT);
-            editIntent.setDataAndType(uri,ContactsContract.Contacts.CONTENT_ITEM_TYPE);
-//            editIntent.putExtra("finishActivityOnSaveCompleted", true);
-            context.startActivity(editIntent);
-
-        } else {
-
-        }
-    }
-
-    /**
-     * @brief 新建联系人显示编辑界面
-     * */
-    public void insertContact(Contact contact,Context context) {
-
-        if (context == null) {
-            return;
-        }
-
-        Intent intent = new Intent(ContactsContract.Intents.Insert.ACTION);
-        intent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
-
-        intent.putExtra(ContactsContract.Intents.Insert.NAME, contact.getName());
-
-        intent.putExtra(ContactsContract.Intents.Insert.PHONE, contact.getNumber());
-        intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
-
-        intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE, contact.getFax());
-        intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK);
-
-        intent.putExtra(ContactsContract.Intents.Insert.EMAIL, contact.getEmail());
-        intent.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, ContactsContract.CommonDataKinds.Email.TYPE_WORK);
-
-        intent.putExtra(ContactsContract.Intents.Insert.POSTAL, contact.getAddress());
-        intent.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
-
-        // Insert中没有的类型,通过Data写入
-        ArrayList<ContentValues> data = new ArrayList<ContentValues>();
-
-        ContentValues row1 = new ContentValues();
-        row1.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
-        row1.put(ContactsContract.CommonDataKinds.Website.DATA, contact.getHomePage());
-        data.add(row1);
-
-        ContentValues row2 = new ContentValues();
-        row2.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE);
-        row2.put(ContactsContract.CommonDataKinds.Photo.PHOTO, contact.getPhotoData());
-        data.add(row2);
-
-//		Intent intent = new Intent(Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI);
-
-        intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, data);
-
-        context.startActivity(intent);
-
-    }
-}
-

+ 0 - 154
Apex Mobile/app/src/main/java/com/usai/apex/AboutActivity.java

@@ -1,154 +0,0 @@
-package com.usai.apex;
-
-import android.content.Intent;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.TextView;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class AboutActivity extends AppCompatActivity
-{
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText("About");
-		setTitle("About");
-
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("AboutActivity", "onCreate");
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_about);
-
-		setCustomActionBar();
-		final TextView tv_ver = (TextView) findViewById(R.id.about_ver_value_tv);
-
-
-		TextView tv_pdfpreview = (TextView) findViewById(R.id.tv_androidpdfviewer);
-		tv_pdfpreview.setOnClickListener(new View.OnClickListener() {
-			@Override
-			public void onClick(View v) {
-
-				InputStream is = getResources().openRawResource(R.raw.license_androidpdfviewer);//把文件转换为输入流
-				StringBuffer response = new StringBuffer();                //创建StringBuffer实例
-				BufferedReader br = new BufferedReader(new InputStreamReader(is));  //根据is创建缓冲字符输入流
-				String s = null;                            //创建s变量
-				try {                            //try语句捕获异常
-					while ((s = br.readLine()) != null) {       //把这一行的值赋值给变量s,并判断是否有值
-						response.append(s);                        //把值添加进StringBuffer
-						response.append("\n");                 //再添加一个换行符
-					}
-				} catch (IOException e) {
-					// TODO Auto-generated catch block          //catch异常处理
-					e.printStackTrace();       //得到错误的实例, 调用方法在命令行打印程序出错的位置及原因
-				} finally {              //finally try语句大多数情况下都会执行的代码块
-					try {
-						if (is != null) {      //如果文件输入流不为空
-							is.close();            //调用close函数关掉输入流
-						}
-						if (br != null) {      //如果缓冲字符输入流不为空
-							br.close();            //调用close函数关掉缓冲字符输入流
-						}
-					} catch (IOException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
-				}
-
-				Intent intent = new Intent();
-				intent.setClass(AboutActivity.this, LicenseActivity.class);
-
-				intent.putExtra("function_name", "barteksc/AndroidPdfViewer");
-
-				intent.putExtra("content", response.toString());
-
-
-				startActivity(intent);
-			}
-		});
-		// String str =
-		// "<a href='https://ra.apexshipping.com/main.php?action=handset_search&action_type=download_doc&sessionid=hjqvgilu0o64d22qfqgat1afk2&url=QVRwVUswa3ZFNlBFTzhLbFpYcC9rVEhSZ1h0MGd6ekpwZ2ZqTkhXNnN2SytGM0FhRkhyNG5QbkdtV2tPMXZrK2p3' target=_blank>A1303540085F.pdf</a>";
-
-//		WebView wv = (WebView) findViewById(R.id.webView1);
-//		String content = "";
-//		try
-//		{
-//			InputStream in = getResources().openRawResource(R.raw.about);
-//			// 获取文件的字节数
-//			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);
-//
-
-		try
-		{
-
-			tv_ver.setText(ApexTrackingApplication.get_instance()
-							.getPackageManager()
-							.getPackageInfo("com.usai.apex", 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;
-	// }
-
-}

+ 0 - 362
Apex Mobile/app/src/main/java/com/usai/apex/Alarmreceiver.java

@@ -1,362 +0,0 @@
-package com.usai.apex;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-//import com.usai.util.Crypto;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-import com.usai.util.dbgUtil;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.AsyncTask;
-import android.os.Parcelable;
-import android.os.SystemClock;
-import android.util.Log;
-
-public class Alarmreceiver extends BroadcastReceiver
-{
-	private SearchTask	m_task	= null;
-
-	public void checkpush(Context context)
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask(context);
-
-		// TextView text_page = (TextView) view_page_footer
-		// .findViewById(R.id.text_page);
-		// text_page.setText("Loading...");
-		// text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int		errorcode;
-		String	content	= null;
-		Context	mcontext;
-
-		public SearchTask(Context context)
-		{
-			mcontext = context;
-		}
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr = "";
-			jstr = Network.check_push();
-			// if (module_name.equals("Announcements"))
-			// jstr = Network.get_announcements(lastid, limit);
-			// else
-			// jstr = Network.get_marketnews(lastid, limit);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			content = jstr;
-			return true;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-			String tag = "onPostExec@Alarmreceiver";
-			Log.i( tag, "entry");
-			m_task = null;
-			// showProgress(false);
-
-			// switch (errorcode)
-			// {
-			// // case Network.RESULT_NET_NOTAVAILABLE:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_connection_none),
-			// // Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			// // case Network.RESULT_NET_ERROR:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			// // case Network.RESULT_ERROR:
-			// // // case Network.RESULT_RESPONSE_NULL:
-			// // {
-			// // Toast toast = Toast.makeText(
-			// // ApexTrackingApplication.get_instance(),
-			// // getText(R.string.msg_net_resulterror),
-			// // Toast.LENGTH_LONG);
-			// // toast.setGravity(Gravity.CENTER, 0, 0);
-			// // toast.show();
-			// // break;
-			// // }
-			//
-			// default:
-			// break;
-			// }
-
-			if (success)
-			{
-				JSONObject jsobj;
-				//
-				// array = new JSONArray(json);
-				try
-				{
-					jsobj = new JSONObject(content);
-
-					String message = jsobj.getString("message");
-					String date = jsobj.getString("date");
-					String s_id = jsobj.getString("s_id");
-					String e_id = jsobj.getString("e_id");
-					int count = jsobj.getInt("count");
-					SQLiteDatabase db = dbUtil.OpenDB(
-							ApexTrackingApplication.get_instance(), null, true);
-					db.execSQL("insert into push_message(s_id,e_id,msgcount,message,h_time,user,create_time,read) values('"
-							+ s_id
-							+ "','"
-							+ e_id
-							+ "',"
-							+ count
-							+ ",'"
-							+ message
-							+ "','"
-							+ date
-							+ "','"
-							+ ApexTrackingApplication.get_user()
-							+ "',"
-							+ System.currentTimeMillis() + ",0)");
-					dbUtil.CloseDB(db);
-
-					boolean bnotify = mcontext.getSharedPreferences("setting",
-							0).getBoolean("notifications_new_message", true);
-					if (bnotify)
-					{
-
-						boolean bsound = mcontext.getSharedPreferences(
-								"setting", 0).getBoolean(
-								"notifications_new_message_sound", true);
-						boolean bvibrate = mcontext.getSharedPreferences(
-								"setting", 0).getBoolean(
-								"notifications_new_message_vibrate", true);
-						NotificationManager nManager = (NotificationManager) mcontext
-								.getSystemService(Context.NOTIFICATION_SERVICE);
-
-//						Notification notification = new Notification(
-//								R.drawable.ic_launcher,
-//								mcontext.getString(R.string.str_notification_title),
-//								System.currentTimeMillis());
-						Intent intent = new Intent(mcontext,
-								FunctionSelectActivity.class);
-						intent.putExtra("launcher", "notification");
-
-						PendingIntent pintent = PendingIntent.getActivity(
-								mcontext, 0, intent,
-								PendingIntent.FLAG_UPDATE_CURRENT);
-
-
-						Notification.Builder builder = new Notification.Builder(mcontext);//新建Notification.Builder对象
-						String ntitle = "";
-						int number = ApexTrackingApplication.ncount++;
-						if (number > 1)
-							ntitle=number
-									+ " "
-									+ ApexTrackingApplication
-									.get_instance()
-									.getString(
-											R.string.str_mnotification_title);
-						else
-							ntitle = ApexTrackingApplication
-									.get_instance()
-									.getString(
-											R.string.str_notification_title);
-
-						builder.setContentTitle(ntitle);//设置标题
-						builder.setContentText(ApexTrackingApplication
-								.get_instance()
-								.getString(
-										R.string.str_notification_text)
-								+ date);//设置内容
-						builder.setSmallIcon(R.drawable.ic_launcher);//设置图片
-						builder.setContentIntent(pintent);//执行intent
-						Notification notification = builder.getNotification();//将builder对象转换为普通的notifications
-
-						if (bsound && bvibrate)
-							notification.defaults = Notification.DEFAULT_ALL;
-						else if (bsound)
-							notification.defaults = Notification.DEFAULT_SOUND
-									| Notification.DEFAULT_LIGHTS;
-						else if (bvibrate)
-							notification.defaults = Notification.DEFAULT_VIBRATE
-									| Notification.DEFAULT_LIGHTS;
-						notification.flags = Notification.FLAG_AUTO_CANCEL;
-						notification.number = number;
-//						if (notification.number > 1)
-//							notification
-//									.setLatestEventInfo(
-//											mcontext,
-//											notification.number
-//													+ " "
-//													+ ApexTrackingApplication
-//															.get_instance()
-//															.getString(
-//																	R.string.str_mnotification_title),
-//											ApexTrackingApplication
-//													.get_instance()
-//													.getString(
-//															R.string.str_notification_text)
-//													+ date, pintent);
-//						else
-//							notification
-//									.setLatestEventInfo(
-//											mcontext,
-//
-//											ApexTrackingApplication
-//													.get_instance()
-//													.getString(
-//															R.string.str_notification_text)
-//													+ date, pintent);
-						nManager.notify(R.layout.activity_apex, notification);
-					}
-
-					// Intent intenticon = new Intent();
-					// intenticon.setClass(ApexTrackingApplication
-					// .get_instance(), FunctionSelectActivity.class);
-					// Intent addShortcut = new
-					// Intent("com.android.launcher.action.INSTALL_SHORTCUT");
-					// Parcelable icon =
-					// Intent.ShortcutIconResource.fromContext(mcontext,
-					// R.drawable.ic_launcher_new);
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
-					// ApexTrackingApplication
-					// .get_instance().getString(R.string.app_name));
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,
-					// intent);
-					// addShortcut.putExtra("duplicate", 0);
-					// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
-					// icon);
-					// ApexTrackingApplication
-					// .get_instance().sendBroadcast(addShortcut);
-
-					// notification
-
-				}
-				catch (JSONException e)
-				{
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-				// if (bfinish)
-				// {
-				// // getListView().removeFooterView(view_page_footer);
-				// // Toast.makeText(AnnouncementActivity.this, "Load all!",
-				// // Toast.LENGTH_LONG).show();
-				//
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("No more items");
-				// tv.setEnabled(false);
-				// }
-				// else
-				// {
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("More...");
-				// tv.setEnabled(true);
-				// }
-				// adapter.notifyDataSetChanged();
-				// // getListAdapter().notifyDataSetChanged;
-				// // BaseAdapter mJson = null;
-				// // mJson.notifyDataSetChanged();
-			}
-
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	@Override
-	public void onReceive(Context context, Intent intent)
-	{
-		String tag = "onReceive@Alarmreceiver";
-		if (intent.getAction().equals("com.usai.apex.push"))
-		{
-
-			// Bundle b = intent.getExtras();
-			// Set<String> keySet = b.keySet();
-			// for(String key : keySet) {
-			// Log.e(tag, key);
-			// }
-			// String s =b.getString("caller");
-			Log.i( tag, "receive alarm broadcast caller =="
-					+ intent.getStringExtra("caller"));
-
-			if (SystemClock.elapsedRealtime()
-					- ApexTrackingApplication.getLastCheckMessageTime() > 120000)
-			{
-				Log.i(tag, "check messsage");
-				ApexTrackingApplication.UpdateLastCheckMessageTime();
-				checkpush(context);
-
-			}
-			// Intent i = new Intent();
-			// i.setClass(context, DaemonService.class);
-			// // 启动service
-			// // 多次调用startService并不会启动多个service 而是会多次调用onStart
-			// context.startService(i);
-		}
-		else if (intent.getAction().equals("com.usai.apex.push.cancel"))
-		{
-			if (m_task != null)
-				m_task.cancel(true);
-			NotificationManager nManager = (NotificationManager) context
-					.getSystemService(Context.NOTIFICATION_SERVICE);
-			nManager.cancel(R.layout.activity_apex);
-			ApexTrackingApplication.cancelalarm();
-			// ApexTrackingApplication.put_password("");
-			// ApexTrackingApplication.put_sessionid("");
-			// ApexTrackingApplication.put_user("");
-			ApexTrackingApplication.logout();
-
-		}
-	}
-
-}

+ 0 - 497
Apex Mobile/app/src/main/java/com/usai/apex/AnnouncementActivity.java

@@ -1,497 +0,0 @@
-package com.usai.apex;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Base64;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.util.Network;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AnnouncementActivity extends AppCompatActivity
-{
-	String				lastid			= "";
-	int					limit			= 10;
-	private SearchTask	m_task			= null;
-	SearchResult		searchresult	= new SearchResult();
-	BaseAdapter			adapter			= null;
-	View				view_page_footer;
-
-	String				module_name		= "";
-
-	ListView mList;
-	ListAdapter mAdapter;
-
-
-	public void setListAdapter(ListAdapter adapter) {
-		synchronized (this) {
-
-			mAdapter = adapter;
-			mList.setAdapter(adapter);
-		}
-	}
-	public ListView getListView() {
-
-		return mList;
-	}
-	public void requestdata()
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask();
-
-		TextView text_page = (TextView) view_page_footer
-				.findViewById(R.id.text_page);
-		text_page.setText("Loading...");
-		text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-
-	protected void onListItemClick(ListView l, View v, int position, long id)
-	{
-		// TODO Auto-generated method stub
-
-
-		// Log.i("FragmentList", "Item clicked: " + id);
-		Intent intent = new Intent();
-		intent.putExtra("url", searchresult.getData().get(position).get("url")
-				.toString());
-		intent.putExtra("title", searchresult.getData().get(position).get("title")
-				.toString());
-		intent.setClass(this, WebActivity.class);
-		startActivity(intent);
-	}
-
-	@Override
-	public void onDestroy()
-	{
-		if (m_task != null)
-			m_task.cancel(false);
-		super.onDestroy();
-	}
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item)
-    {
-        Intent intent = new Intent();
-        switch (item.getItemId())
-        {
-            case android.R.id.home:
-                finish();
-                break;
-
-            default:
-                break;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText(getIntent().getStringExtra("module_name"));
-		setTitle(getIntent().getStringExtra("module_name"));
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-
-		// setTitle("Booking Result");
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_announcements);
-
-		setCustomActionBar();
-
-		adapter = new AnnouncementAdapter(searchresult, this);
-
-		module_name = getIntent().getStringExtra("module_name");
-
-		setTitle(module_name);
-
-		mList = findViewById(android.R.id.list);
-		mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-//				super.onListItemClick(parent, view, position, id);
-				AnnouncementActivity.this.onListItemClick((ListView) parent,view,position,id);
-			}
-		});
-		view_page_footer = LayoutInflater.from(this).inflate(
-				R.layout.view_page_footer, null);
-		getListView().addFooterView(view_page_footer);// 添加底部视图
-		TextView text_page = (TextView) view_page_footer
-				.findViewById(R.id.text_page);
-		text_page.setOnClickListener(new View.OnClickListener()
-		{
-			// 点击按钮 追加数据 并通知适配器
-			@Override
-			public void onClick(View v)
-			{
-				// TODO Auto-generated method stub
-				// TextView tv = (TextView) v;
-				// tv.setText("Loading...");
-				requestdata();
-				// tv.setText("下一页");
-				// adapter.notifyDataSetChanged();
-			}
-		});
-
-		setListAdapter(adapter);
-		// this.getListView().setBackgroundColor(Color.WHITE);
-		requestdata();
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int		errorcode;
-		boolean	bfinish	= false;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr;
-			if (module_name.equals("Announcements"))
-				jstr = Network.get_announcements(lastid, limit);
-			else
-				jstr = Network.get_marketnews(lastid, limit);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				int count = jsobj.getInt("total");
-				if (count < limit)
-					bfinish = true;
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-					searchresult.add_records(objrecords.toString(), count);
-				errorcode = Network.RESULT_TRUE;
-
-				return true;
-
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-			String tag = "onPostExecute@AnnouncementActivity";
-			Log.d("onPostExecute", "entry");
-			m_task = null;
-			// showProgress(false);
-
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-
-				if (bfinish)
-				{
-					// getListView().removeFooterView(view_page_footer);
-					// Toast.makeText(AnnouncementActivity.this, "Load all!",
-					// Toast.LENGTH_LONG).show();
-
-					TextView tv = (TextView) view_page_footer
-							.findViewById(R.id.text_page);
-					tv.setText("No more items");
-					tv.setEnabled(false);
-				}
-				else
-				{
-					TextView tv = (TextView) view_page_footer
-							.findViewById(R.id.text_page);
-					tv.setText("More...");
-					tv.setEnabled(true);
-				}
-				adapter.notifyDataSetChanged();
-				// getListAdapter().notifyDataSetChanged;
-				// BaseAdapter mJson = null;
-				// mJson.notifyDataSetChanged();
-			}
-			else
-			{
-				TextView tv = (TextView) view_page_footer
-						.findViewById(R.id.text_page);
-				tv.setText("More...");
-				tv.setEnabled(true);
-			}
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	private class SearchResult
-	{
-		List<Map<String, Object>>	datalist	= new ArrayList<Map<String, Object>>();
-
-		public int get_count()
-		{
-			return datalist.size();
-		}
-
-		public void add_records(String source, int count)
-		{
-			JSONObject objrecords;
-			try
-			{
-				objrecords = new JSONObject(source);
-
-				for (int i = 0; i < count; i++)
-				{
-					// offset++;
-					JSONObject objrec = objrecords.getJSONObject("record" + i);
-					String title = objrec.getString("title");
-					String content = objrec.getString("content");
-					String image = objrec.getString("image");
-					String id = objrec.getString("id");
-					String url = objrec.getString("url");
-					lastid = id;
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("title", title);
-					map.put("content", content);
-					map.put("image", image);
-					map.put("id", id);
-					map.put("url", url);
-					datalist.add(map);
-
-					// Iterator<?> it = rec.keys();
-					// HashMap<String, String> record = new HashMap<String,
-					// String>();
-					// while (it.hasNext()) // loop for each function
-					// {
-					// String field_name = (String) it.next();
-					// String val = rec.getString(field_name)
-					// .replace("\n", "");
-					// record.put(field_name, val);
-					// }
-					// records.add(record);
-
-				}
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-
-		}
-
-		public List<Map<String, Object>> getData()
-		{
-
-			return datalist;
-		}
-	}
-
-	private class AnnouncementAdapter extends BaseAdapter
-	{
-		private LayoutInflater	mInflater;	// 动态布局映射
-		private SearchResult	result;
-
-		// private Context context;
-		// private int i = 0;
-		public AnnouncementAdapter(SearchResult result, Context context)
-		{
-			this.result = result;
-			// this.context = context;
-			this.mInflater = LayoutInflater.from(context);
-		}
-
-		@Override
-		public int getCount()
-		{
-			// TODO Auto-generated method stub
-			return result.get_count();
-		}
-
-		@Override
-		public Object getItem(int position)
-		{
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public long getItemId(int position)
-		{
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent)
-		{
-			// TODO Auto-generated method stub
-			convertView = mInflater.inflate(R.layout.announcement_cell, null);// 根据布局文件实例化view
-
-			TextView title = (TextView) convertView.findViewById(R.id.tv_title);// 找某个控件
-			title.setText(result.getData().get(position).get("title")
-					.toString());// 给该控件设置数据(数据从集合类中来)
-			TextView content = (TextView) convertView
-					.findViewById(R.id.tv_content);
-			content.setText(result.getData().get(position).get("content")
-					.toString());
-            ImageView iv_thumb = (ImageView) convertView
-                    .findViewById(R.id.iv_thumb);
-			if (result.getData().get(position).get("image").toString().length() > 0)
-			{
-				byte[] gzipBuff = Base64.decode(result.getData().get(position)
-						.get("image").toString(), 0);
-
-				ByteArrayInputStream memstream = new ByteArrayInputStream(
-						gzipBuff, 0, gzipBuff.length);
-
-				ByteArrayOutputStream baos = new ByteArrayOutputStream(
-						gzipBuff.length);
-
-				try
-				{
-					baos.write(gzipBuff);
-
-					Bitmap bmp = BitmapFactory.decodeStream(memstream);
-
-					// ImageView image = new ImageView(this);
-
-					iv_thumb.setImageBitmap(bmp);
-				}
-				catch (IOException e)
-				{
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-			else
-            {
-                if(module_name.equals("Market News"))
-                {
-                    iv_thumb.setImageResource(R.drawable.rect_market_news);
-                }
-                else
-                {
-                    iv_thumb.setImageResource(R.drawable.mode_announcement);
-
-                }
-            }
-			// img.setBackgroundResource((Integer)jObject.get("img"));
-
-			return convertView;
-		}
-	}
-}

+ 0 - 219
Apex Mobile/app/src/main/java/com/usai/apex/ApexActivity.java

@@ -1,219 +0,0 @@
-package com.usai.apex;
-
-//import com.google.android.gms.maps.SupportMapFragment;
-
-import android.app.ActionBar;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Bundle;
-//import android.app.Fragment;
-//import android.app.FragmentTransaction;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.widget.TabHost;
-
-import com.usai.apex.mainframe.LoginFragment;
-import com.usai.apex.mainframe.ToolsFragment;
-
-public class ApexActivity extends FragmentActivity /*
-													 * implements
-													 * OnTabChangeListener
-													 */
-{
-	boolean	m_bhasgoogleframework	= false;
-
-	@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);
-			finish();
-			
-			return false;
-		}
-		return super.onKeyDown(keyCode, event);
-	}
-
-	TabHost	mTabHost;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("ApexActivity", "onCreate");
-
-		// ApexTrackingApplication.get_instance()
-		// .getPackageManager().
-		PackageInfo packageInfo;
-		try
-		{
-			packageInfo = this.getPackageManager().getPackageInfo(
-					"com.google.android.gms", 0);
-
-		}
-		catch (NameNotFoundException e)
-		{
-			packageInfo = null;
-			e.printStackTrace();
-		}
-		if (packageInfo == null)
-		{
-			m_bhasgoogleframework = false;
-			System.out.println("没有安装");
-		}
-		else
-		{
-			m_bhasgoogleframework = true;
-			System.out.println("已经安装");
-		}
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_apex);
-		ActionBar bar = getActionBar();
-		bar.setTitle("");
-		setupTabs();
-
-	}
-
-	// @Override
-	// public boolean onCreateOptionsMenu(Menu menu) {
-	// // Inflate the menu; this adds items to the action bar if it is present.
-	// getMenuInflater().inflate(R.menu.apex, menu);
-	// return true;
-	// }
-	//
-	// @Override
-	// public boolean onOptionsItemSelected(MenuItem item) {
-	// switch (item.getItemId()) {
-	// case R.id.forget_password:
-	// Intent intent = new Intent();
-	// intent.setClass(this, RetrievePasswordActivity.class);
-	// startActivity(intent);
-	//
-	// break;
-	// default:
-	// break;
-	//
-	// }
-	// return super.onOptionsItemSelected(item);
-	// }
-
-	private void setupTabs()
-	{
-		mTabHost = (TabHost) this.findViewById(R.id.tabhost);
-
-		mTabHost.setup();
-		// // ��ɵײ��Զ�����ʽ�İ�ť
-		// String[] title = new String[] { "Login", "Not login" };
-		// int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.action_sign_in_short)).setIndicator(getString(R.string.action_sign_in_short))
-				.setContent(R.id.tab1));
-		// mTabHost.addTab(mTabHost.newTabSpec("test").setIndicator("test").setContent(R.id.tabtest));
-
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.str_tool)).setIndicator(getString(R.string.str_tool))
-				.setContent(R.id.tab2));
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.str_location))
-				.setIndicator(getString(R.string.str_location)).setContent(R.id.tab3));
-
-		// Instantiate a new fragment.
-		Fragment loginFragment = new LoginFragment();
-		Fragment toolsFragment = new ToolsFragment();
-		Fragment slFragment;
-//		 m_bhasgoogleframework=false;
-		if (m_bhasgoogleframework)
-			slFragment = new ServiceLocationFragment();
-		else
-			slFragment = new BaiduMapFragment();
-		// Add the fragment to the activity, pushing this transaction
-		// on to the back stack.
-
-		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-		ft.replace(R.id.tab1, loginFragment);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("Login");
-
-		ft.replace(R.id.tab2, toolsFragment);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("Tools");		
-		
-		
-		// ft.replace(R.id.tab2, dtFragement);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("Tracking");
-		// Fragment test = new ServiceLocationFragment();
-		// ft.replace(R.id.tabtest, (Fragment) test);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("test");
-
-		ft.replace(R.id.tab3, (Fragment) slFragment);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("Location");
-
-		ft.commit();
-
-		// if (manager.findFragmentByTag(tabId) == null)
-		// {
-		// FragmentTransaction trans = manager.beginTransaction();
-		// trans.replace(contentViewID, frag, tabId);
-		// trans.commit();
-		// }
-		// for (int i = 0; i < title.length; i++) {
-		// Button button = new Button(this);
-		// button.setText(title[i]);
-		// button.setBackgroundDrawable(this.getResources().getDrawable(
-		// R.drawable.tab_lable)); //�Զ��尴ť��ʽ
-		// mTabHost.addTab(mTabHost.newTabSpec(title[i]).setIndicator(button)
-		// .setContent(tabIds[i]));
-		// }
-
-		// mTabHost.setOnTabChangedListener(this);
-	}
-
-	// @Override
-	// public void onTabChanged(String tabId)
-	// {
-	// TODO Auto-generated method stub
-	// Fragment frag = null;
-	// int contentViewID = 0;
-	// if (tabId.equals("Login")) {
-	// frag = new LoginFragment();
-	// //�Զ���̳�Fragment��UI������һ���򵥵���ʾ�ı�����Ŀؼ���
-	// contentViewID = R.id.tab1;
-	// } else if (tabId.equals("Not login")) {
-	// frag = new DirectTrackingFragment();
-	// contentViewID = R.id.tab2;
-	// }
-	// if (frag == null)
-	// return;
-	//
-	// FragmentManager manager = this.getFragmentManager();
-	//
-	// if (manager.findFragmentByTag(tabId) == null) {
-	// FragmentTransaction trans = manager.beginTransaction();
-	// trans.replace(contentViewID, frag, tabId);
-	// trans.commit();
-	// }
-	// }
-	// public class LoginFragment extends Fragment implements OnClickListener{
-	// @Override
-	// public View onCreateView(LayoutInflater inflater, ViewGroup container,
-	// Bundle savedInstanceState) {
-	// View view = inflater.inflate(R.layout.activity_login, null);
-	// Button btn = (Button)view.findViewById(R.id.sign_in_button);
-	// btn.setOnClickListener(this);
-	// return view;
-	// }
-	//
-	// @Override
-	// public void onClick(View v)
-	// {
-	// // TODO Auto-generated method stub
-	//
-	// }
-	// }
-}

+ 0 - 51
Apex Mobile/app/src/main/java/com/usai/apex/ApexBackgroundService.java

@@ -1,51 +0,0 @@
-package com.usai.apex;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-import android.util.Log;
-
-public class ApexBackgroundService extends Service
-{
-
-	ApexTrackingApplication app = null;
-	
-	
-	
-	@Override
-	public void onCreate()
-	{
-		app = ApexTrackingApplication.get_instance();
-
-		super.onCreate();
-	}
-
-
-
-	@Override
-	public void onStart(Intent intent, int startId)
-	{
-		if(app==null)
-			Log.e("service start","app is null");
-		super.onStart(intent, startId);
-	}
-
-
-
-	@Override
-	public int onStartCommand(Intent intent, int flags, int startId)
-	{
-
-		return super.onStartCommand(intent, flags, startId);
-	}
-
-
-
-	@Override
-	public IBinder onBind(Intent intent)
-	{
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

+ 0 - 88
Apex Mobile/app/src/main/java/com/usai/apex/ApexHistoryActivity.java

@@ -1,88 +0,0 @@
-package com.usai.apex;
-
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.webkit.WebView;
-import android.widget.TextView;
-
-import org.apache.http.util.EncodingUtils;
-
-import java.io.InputStream;
-
-public class ApexHistoryActivity extends AppCompatActivity
-{
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText("Apex History");
-		setTitle("Apex History");
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("AboutActivity", "onCreate");
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_history);
-
-		setCustomActionBar();
-		WebView wv = (WebView) findViewById(R.id.webView1);
-
-		wv.setBackgroundColor(Color.TRANSPARENT); // 设置背景色
-//		wv.getBackground().setAlpha(); // 设置填充透明度 范围:0-255
-
-		String content = "";
-		try
-		{
-			InputStream in = getResources().openRawResource(R.raw.about);
-			// 获取文件的字节数
-			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);
-		
-	}
-}

+ 0 - 25
Apex Mobile/app/src/main/java/com/usai/apex/ApexPushService.java

@@ -1,25 +0,0 @@
-package com.usai.apex;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-
-public class ApexPushService extends Service
-{
-
-	
-//	@Override
-//	public void onCreate()
-//	{
-//		
-//		super.onCreate();
-//	}
-
-	@Override
-	public IBinder onBind(Intent intent)
-	{
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

+ 0 - 508
Apex Mobile/app/src/main/java/com/usai/apex/ApexTrackingApplication.java

@@ -1,508 +0,0 @@
-package com.usai.apex;
-
-import android.app.Activity;
-import android.app.AlarmManager;
-import android.app.AlertDialog;
-import android.app.Application;
-import android.app.DownloadManager;
-import android.app.PendingIntent;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.usai.util.AES;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-
-public class ApexTrackingApplication extends Application
-{
-
-	static final String						TAG				= "ApexTrackingApplication";
-	private static ApexTrackingApplication	instance;
-//	private static String					m_sessionid		= "";
-	private static String					m_user			= "";
-	private static String					m_password		= "";
-	public static int						ncount			= 1;
-
-	public static boolean					m_bauthorized	= false;
-	private boolean 							personMode 		= false;
-
-	public boolean shouldCheckCache = false;
-
-	public boolean homeactive=false;
-	public boolean historyactive=false;
-	public boolean recentactive=false;
-	private static long LastAlermTime = -120000;
-	
-	public static void UpdateLastCheckMessageTime()
-	{
-		LastAlermTime = SystemClock.elapsedRealtime();
-	}
-	public static long getLastCheckMessageTime()
-	{
-		return LastAlermTime;
-	}
-
-	public void setPersonMode(boolean personMode) {
-		this.personMode = personMode;
-	}
-
-	public boolean getPersonMode() {
-		return this.personMode;
-	}
-
-	public static ApexTrackingApplication getInstance() {
-		return instance;
-	}
-	@Override
-	public void onCreate()
-	{
-
-		// TODO Auto-generated method stub
-		Log.d(TAG, "onCreate");
-		super.onCreate();
-
-
-		registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
-			@Override
-			public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
-				mCurrentActivity = activity;
-				Resources res = ApexTrackingApplication.getInstance().getResources();
-				Configuration config = new Configuration();
-				config.setToDefaults();
-				res.updateConfiguration(config, res.getDisplayMetrics());
-			}
-
-			@Override
-			public void onActivityStarted(Activity activity) {
-
-//				// 加载系统默认设置,字体不随用户设置变化
-//				Resources res = ApexTrackingApplication.getInstance().getResources();
-//				Configuration config = new Configuration();
-//				config.setToDefaults();
-//				res.updateConfiguration(config, res.getDisplayMetrics());
-
-
-			}
-
-			// ...
-			@Override
-			public void onActivityResumed(Activity activity) {
-//				if (isBackground) {
-//					isBackground = false;
-//					notifyForeground();
-//				}
-				mCurrentActivity = activity;
-			}
-
-			@Override
-			public void onActivityPaused(Activity activity) {
-
-			}
-
-			@Override
-			public void onActivityStopped(Activity activity) {
-
-			}
-
-			@Override
-			public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
-
-			}
-
-			@Override
-			public void onActivityDestroyed(Activity activity) {
-
-			}
-			// ...
-		});
-
-		// 加载系统默认设置,字体不随用户设置变化
-		Resources res = super.getResources();
-		Configuration config = new Configuration();
-		config.setToDefaults();
-		res.updateConfiguration(config, res.getDisplayMetrics());
-
-		instance = this;
-
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		boolean autologin = pref.getBoolean("autologin", false);
-		if (autologin == true)
-		{
-
-			String u = pref.getString("user", "");
-			String p = pref.getString("password", "");
-//			String s = pref.getString("sessionid", "");
-
-			try
-			{
-				if (!TextUtils.isEmpty(u))
-					m_user = AES.decrypt("apexu", u);
-				if (!TextUtils.isEmpty(p))
-					m_password = AES.decrypt("apexp", p);
-//				if (!TextUtils.isEmpty(s))
-//					m_sessionid = AES.decrypt("apexp", s);
-			}
-			catch (Exception e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-		dbUtil.cleanhistory();
-
-		// Intent serviceintent = new Intent();
-		// serviceintent.setClass(this, ApexPushService.class);
-		//
-		//
-		// startService(serviceintent);
-
-		createAppStorageDir();
-	}
-
-	private static final int HandlerMsgTypeCheckUpdate = 0;
-	private Handler handler = new CheckUpdateHandler(this);
-	private Activity mCurrentActivity;
-
-	private static final class CheckUpdateHandler extends Handler {
-
-        WeakReference<ApexTrackingApplication> mWeakApp;
-
-        public CheckUpdateHandler(ApexTrackingApplication application) {
-            mWeakApp = new WeakReference<> (application);
-        }
-
-        @Override
-        public void handleMessage(Message msg) {
-            super.handleMessage(msg);
-            switch (msg.what) {
-                case HandlerMsgTypeCheckUpdate: {
-
-                    final ApexTrackingApplication app = mWeakApp.get();
-                    if (app == null) {
-                        return;
-                    }
-
-                    app.dismissProgressDialog();
-
-                    if (msg.obj == null) {
-
-                    } else {
-
-                        try {
-                            JSONObject jsonObject = new JSONObject((String) msg.obj);
-
-                            final String ver = jsonObject.optString("ver");
-                            final String url = jsonObject.optString("url");
-                            int result = jsonObject.optInt("result",0);
-                            String log = jsonObject.optString("change_log");
-                            if (log == null) {
-                            	log = "";
-							}
-                            if (result == 2 && ver != null && url != null) {
-
-                                new AlertDialog.Builder(app.mCurrentActivity)
-										.setTitle("New version " + ver +" is available")
-                                        .setMessage("Change log:\n\n" + log + "\n\nDo you want to update to the latest version?\n")
-                                        .setPositiveButton("Download", new DialogInterface.OnClickListener() {
-                                            @Override
-                                            public void onClick(DialogInterface dialog, int which) {
-                                                app.downloadNewVersionApp(url,ver);
-                                            }
-                                        })
-                                        .setNegativeButton("Later",null)
-                                        .show();
-
-                            } else {
-                                if (!app.mSilence) {
-									new AlertDialog.Builder(app.mCurrentActivity)
-											.setTitle("Check update")
-											.setMessage("you are up to date.")
-											.setNegativeButton("Ok",null)
-											.show();
-								}
-                            }
-
-                        } catch (JSONException e) {
-                            e.printStackTrace();
-                        }
-
-                    }
-
-                    app.mSilence = true;
-                }
-                break;
-
-            }
-        }
-    }
-
-	private void downloadNewVersionApp(String url,String ver) {
-
-	    String appName = RAUtil.getApplicationName(this);
-
-	    if (url == null || appName == null || ver == null) {
-	        return;
-        }
-
-//        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
-//
-//        request.setDestinationInExternalPublicDir("/download/", appName + " " + ver + ".apk");
-//
-//        DownloadManager downloadManager= (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
-//
-//        downloadManager.enqueue(request);
-
-
-        DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
-        DownloadManager.Request request = new DownloadManager.Request(
-                Uri.parse(url));
-
-        request.setDescription("更新APP");
-        request.allowScanningByMediaScanner();// 设置可以被扫描到
-        request.setVisibleInDownloadsUi(true);// 设置下载可见
-        request.setNotificationVisibility(
-                DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);//下载完成后通知栏任然可见
-        String fileName = url.substring(url.lastIndexOf("/"));// 解析fileName
-        request.setDestinationInExternalPublicDir(
-                Environment.DIRECTORY_DOWNLOADS, fileName);// 设置下载位置,sdcard/Download/fileName
-        long refernece = manager.enqueue(request);// 加入下载并取得下载ID
-        SharedPreferences sPreferences = getSharedPreferences(
-                "downloadplato", 0);
-        sPreferences.edit().putLong("plato", refernece).commit();//保存此次下载ID
-    }
-
-    private boolean mSilence = true;
-	public void checkUpdate(boolean silence,String alertMsg) {
-		if (!silence) {
-			showProgressDialog(alertMsg);
-		}
-		mSilence = silence;
-		new Thread(new Runnable() {
-			@Override
-			public void run() {
-
-				String jsonStr = Network.checkUpdate(instance);
-				Message msg = new Message();
-				msg.what = HandlerMsgTypeCheckUpdate;
-				msg.obj = jsonStr;
-				handler.sendMessage(msg);
-
-			}
-		}).start();
-
-	}
-
-	private ProgressDialog mProgressDialog;
-
-	public void showProgressDialog(String msg) {
-
-		if (mProgressDialog == null) {
-			mProgressDialog = new ProgressDialog(mCurrentActivity);
-			mProgressDialog.setCancelable(false);
-
-		}
-
-        mProgressDialog.setMessage(msg);
-		mProgressDialog.show();
-	}
-
-	public void dismissProgressDialog() {
-		if (mProgressDialog != null && mProgressDialog.isShowing()) {
-			mProgressDialog.dismiss();
-		}
-	}
-
-	public void createAppStorageDir() {
-		String documentDir = getDocumentDir();
-		File docDir = new File(documentDir);
-		docDir.mkdirs();
-
-	}
-
-	public String getDocumentDir() {
-//		return RAUtil.SDCardRoot() + RAUtil.getApplicationName(getApplicationContext()) + File.separator +"Document";
-		return RAUtil.SDCardRoot() + RAUtil.getApplicationName(getApplicationContext());
-	}
-
-	// @Override
-	// protected void finalize() throws Throwable
-	// {
-	// NotificationManager nManager = (NotificationManager)
-	// instance.getSystemService(
-	// Context.NOTIFICATION_SERVICE);
-	// nManager.cancel(R.layout.activity_apex);
-	// super.finalize();
-	// }
-
-	public static ApexTrackingApplication get_instance()
-	{
-		return instance;
-	}
-
-	public static void startalarm(String caller)
-	{
-		// 新版暂时停用通知
-		if(true)
-			return;
-		SharedPreferences pref = get_instance()
-				.getSharedPreferences("Apex", 0);
-		boolean autologin = pref.getBoolean("autologin", false);
-		if (autologin == false)
-			return;
-		// 启动完成
-		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
-		iAlarm.putExtra("caller", caller);
-		iAlarm.setAction("com.usai.apex.push");
-		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
-				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-		long firstime = SystemClock.elapsedRealtime();
-//		UpdateLastAlermTime();
-		AlarmManager am = (AlarmManager) get_instance().getSystemService(
-				Context.ALARM_SERVICE);
-
-		// 5分钟一个周期,不停的发送广播
-		am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,
-				300 * 1000, sender);
-	}
-
-	public static void cancelalarm()
-	{
-
-		// 启动完成
-		Intent iAlarm = new Intent(get_instance(), Alarmreceiver.class);
-		iAlarm.setAction("com.usai.apex.push");
-		PendingIntent sender = PendingIntent.getBroadcast(get_instance(), 0,
-				iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-		AlarmManager am = (AlarmManager) get_instance().getSystemService(
-				Context.ALARM_SERVICE);
-
-		am.cancel(sender);
-	}
-
-	public static void logout()
-	{
-		ncount = 1;
-		cancelalarm();
-//		m_sessionid = "";
-		m_user = "";
-		m_password = "";
-		m_bauthorized = false;
-		get_instance().setPersonMode(false);
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		SharedPreferences.Editor editor = pref.edit();
-
-		editor.putBoolean("autologin", false);
-		editor.commit();
-
-	}
-
-	public static void SetAuthorizeStatus(boolean bauthorized)
-	{
-		m_bauthorized = bauthorized;
-	}
-	public static void login(String sid, String user, String pass)
-	{
-//		m_sessionid = sid;
-		m_user = user;
-		m_password = pass;
-		m_bauthorized = true;
-		
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		SharedPreferences.Editor editor = pref.edit();
-		try
-		{
-
-			editor.putString("user", AES.encrypt("apexu", m_user));
-			editor.putString("password", AES.encrypt("apexp", m_password));
-			editor.putBoolean("autologin", true);
-//			editor.putString("sessionid", AES.encrypt("apexp", m_sessionid));
-
-		}
-		catch (Exception e)
-		{
-			editor.putString("user", null);
-			editor.putString("password", null);
-//			editor.putString("m_sessionid", null);
-			editor.putBoolean("autologin", false);
-			m_bauthorized=false;
-			e.printStackTrace();
-		}
-		editor.commit();
-
-		startalarm("app Login");
-	}
-
-	// public static void put_sessionid(String id)
-	// {
-	//
-	// Log.e(TAG, "put_sessionid");
-	// m_sessionid = id;
-	// }
-
-	// public static void put_authorization(boolean bauth)
-	// {
-	//
-	// m_bauthorized = bauth;
-	// }
-
-	public static boolean get_authorization()
-	{
-
-		return m_bauthorized;
-	}
-
-	// public static void put_user(String user)
-	// {
-	//
-	// m_user = user;
-	// }
-	//
-	// public static void put_password(String pass)
-	// {
-	//
-	// m_password = pass;
-	// }
-
-//	public static String get_sessionid()
-//	{
-//		Log.d(TAG, "get_sessionid");
-//		return m_sessionid;
-//	}
-
-	public static String get_user()
-	{
-		Log.d(TAG, "get_user");
-		return m_user.toLowerCase();
-	}
-
-	public static String get_pass()
-	{
-		Log.d(TAG, "get_pass");
-		return m_password;
-	}
-}

+ 0 - 700
Apex Mobile/app/src/main/java/com/usai/apex/BaiduMapFragment.java

@@ -1,700 +0,0 @@
-package com.usai.apex;
-
-//import com.google.android.gms.maps.SupportMapFragment;
-
-//import baidumapsdk.demo.DemoApplication;
-//import baidumapsdk.demo.DemoApplication.MyGeneralListener;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-//import baidumapsdk.demo.R;
-
-
-import com.baidu.location.BDLocation;
-import com.baidu.location.BDLocationListener;
-import com.baidu.location.LocationClient;
-import com.baidu.location.LocationClientOption;
-import com.baidu.mapapi.BMapManager;
-import com.baidu.mapapi.SDKInitializer;
-import com.baidu.mapapi.map.BaiduMap.OnMapClickListener;
-import com.baidu.mapapi.map.BitmapDescriptor;
-import com.baidu.mapapi.map.BitmapDescriptorFactory;
-import com.baidu.mapapi.map.InfoWindow;
-import com.baidu.mapapi.map.MapPoi;
-import com.baidu.mapapi.map.MapStatusUpdate;
-import com.baidu.mapapi.map.MapStatusUpdateFactory;
-//import com.baidu.mapapi.MKGeneralListener;
-//import com.baidu.mapapi.map.ItemizedOverlay;
-//import com.baidu.mapapi.map.MKEvent;
-//import com.baidu.mapapi.map.MapController;
-import com.baidu.mapapi.map.MapView;
-import com.baidu.mapapi.map.Marker;
-import com.baidu.mapapi.map.MarkerOptions;
-//import com.baidu.mapapi.map.OverlayItem;
-//import com.baidu.mapapi.map.PopupClickListener;
-//import com.baidu.mapapi.map.PopupOverlay;
-import com.baidu.mapapi.map.MyLocationData;
-import com.baidu.mapapi.map.SupportMapFragment;
-import com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener;
-import com.baidu.mapapi.map.InfoWindow.OnInfoWindowClickListener;
-import com.baidu.mapapi.model.LatLng;
-//import com.baidu.platform.comapi.basestruct.GeoPoint;
-import com.usai.util.Network;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.location.LocationListener;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class BaiduMapFragment extends Fragment implements BDLocationListener
-{
-	private SearchTask				m_task				= null;
-	String							fragment_content	= null;
-	private MapView					mMapView			= null;
-	// private MyOverlay mOverlay = null;
-	// private OverlayItem mCurItem = null;
-	// private Button button = null;
-	// private ArrayList<OverlayItem> mItems = null;
-	// private PopupOverlay pop = null;
-	SupportMapFragment				fragment;
-	BMapManager						mBMapManager		= null;
-	public static boolean			m_bKeyRight			= true;
-	HashMap<String, LocationDetail>	marker_detail		= new HashMap<String, LocationDetail>();
-
-	// OverlayItem m_curitem = null;
-	/*
-	 * public class MyOverlay extends ItemizedOverlay {
-	 * 
-	 * public MyOverlay(Drawable defaultMarker, MapView mapView) {
-	 * super(defaultMarker, mapView); }
-	 * 
-	 * @Override public boolean onTap(int index) {
-	 * Log.d("baidumap...................", "ontap"); View viewCache =
-	 * getActivity().getLayoutInflater().inflate( R.layout.marker_view, null);
-	 * 
-	 * TextView tv_title = (TextView) viewCache .findViewById(R.id.tv_title);
-	 * TextView tv_info = (TextView) viewCache.findViewById(R.id.tv_info);
-	 * 
-	 * OverlayItem item = getItem(index);
-	 * 
-	 * tv_title.setText(item.getTitle()); tv_info.setText(item.getSnippet());
-	 * m_curitem = item; pop.showPopup(viewCache, item.getPoint(), 32); return
-	 * true; }
-	 * 
-	 * @Override public boolean onTap(GeoPoint pt, MapView mMapView) {
-	 * Log.d("baidu map demo ", "hide pop"); if (pop != null) {
-	 * 
-	 * pop.hidePop(); // mMapView.removeView(button); } return false; }
-	 * 
-	 * }
-	 */
-
-	void AddMarker()
-	{
-
-		if (mMapView == null)
-		{
-
-			Log.d("onResume", "get map from fragment");
-			mMapView = fragment.getMapView();
-			if (mMapView == null)
-				return;
-		}
-
-		try
-		{
-			JSONObject jsobj = new JSONObject(fragment_content);
-
-			int count = jsobj.getInt("total");
-
-			JSONObject objrecords = jsobj.getJSONObject("records");
-			// mOverlay = new MyOverlay(getResources().getDrawable(
-			// R.drawable.ic_marker), mMapView);
-			BitmapDescriptor icon = BitmapDescriptorFactory
-					.fromResource(R.drawable.ic_marker);
-			for (int i = 0; i < count; i++)
-			{
-				// offset++;
-
-				JSONObject objrec = objrecords.getJSONObject("record" + i);
-				String area = objrec.getString("area");
-				String company = objrec.getString("company");
-				String city = objrec.getString("city");
-				String longitude = objrec.getString("longitude");
-				String latitude = objrec.getString("latitude");
-				String address = objrec.getString("address");
-				String telephone = objrec.getString("telephone");
-				String fax = objrec.getString("fax");
-				String contact = objrec.getString("contact");
-				String email = objrec.getString("email");
-
-				LocationDetail detail = new LocationDetail(company, address,
-						telephone, fax, contact, email);
-				marker_detail.put(company, detail);
-
-				Bundle extrainfo = new Bundle();
-				extrainfo.putString("company", company);
-				extrainfo.putSerializable("detail", detail);
-				extrainfo.putSerializable("city", city);
-				extrainfo.putSerializable("area", area);
-				// // 准备overlay 数据
-				//
-				// GeoPoint p1 = new GeoPoint(
-				// (int) (Double.parseDouble(latitude) * 1E6),
-				// (int) (Double.parseDouble(longitude) * 1E6));
-				// OverlayItem item1 = new OverlayItem(p1, company, city + "\n"
-				// + area);
-				//
-				// //
-				// // * 将item 添加到overlay中 注意: 同一个itme只能add一次
-				// //
-				// mOverlay.addItem(item1);
-				LatLng llA = new LatLng(Double.parseDouble(latitude),
-						Double.parseDouble(longitude));
-
-				MarkerOptions markeroption = new MarkerOptions().position(llA)
-						.icon(icon).zIndex(9).title(company)
-						.extraInfo(extrainfo).draggable(true);
-
-				// if (animationBox.isChecked()) {
-				// //掉下动画
-				// ooA.animateType(MarkerAnimateType.drop);
-				// }
-				Marker mMarkerA = (Marker) (mMapView.getMap()
-						.addOverlay(markeroption));
-
-			}
-			//
-			// * 保存所有item,以便overlay在reset后重新添加
-			//
-			// mItems = new ArrayList<OverlayItem>();
-			// mItems.addAll(mOverlay.getAllItem());
-			// //
-			// // * 将overlay 添加至MapView中
-			// //
-			// mMapView.getOverlays().add(mOverlay);
-			// //
-			// // * 刷新地图
-			// //
-			// mMapView.refresh();
-			// PopupClickListener popListener = new PopupClickListener()
-			// {
-			// @Override
-			// public void onClickedPopup(int index)
-			// {
-			// Log.d("baidu map.......", "popup on click");
-			// pop.hidePop();
-			//
-			// mMapView.refresh();
-			// Intent intent = new Intent();
-			// intent.setClass(getActivity(), LocationDetailActivity.class);
-			//
-			// String markertext = m_curitem.getTitle();
-			//
-			// intent.putExtra("detail", marker_detail.get(markertext));
-			// // // intent.putExtra("password", password);
-			// // intent.putExtra("function_name", function_name);
-			// // intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-			// startActivity(intent);
-			//
-			// }
-			// };
-			// pop = new PopupOverlay(mMapView, popListener);
-		}
-		catch (JSONException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	public void requestloactions()
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-
-		if (fragment_content != null)
-		{
-			// LayoutInflater inflater = (LayoutInflater)
-			// ApexTrackingApplication
-			// .get_instance().getSystemService(
-			// Context.LAYOUT_INFLATER_SERVICE);
-			// init(fragment_content,inflater);
-			return;
-		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask();
-
-		// TextView text_page = (TextView) view_page_footer
-		// .findViewById(R.id.text_page);
-		// text_page.setText("Loading...");
-		// text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-
-	private LocationClient mLocationClient;
-
-	private void initLocation() {
-		//定位客户端的设置
-		mLocationClient = new LocationClient(getContext());
-
-		//注册监听
-		mLocationClient.registerLocationListener(this);
-
-		//配置定位
-		LocationClientOption option = new LocationClientOption();
-		option.setCoorType("bd09ll");//坐标类型
-		option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
-		option.setOpenGps(true);//打开Gps
-		option.setScanSpan(1000);//1000毫秒定位一次
-		option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
-		mLocationClient.setLocOption(option);
-	}
-
-	@Override
-	public void onReceiveLocation(BDLocation bdLocation) {
-
-		//将获取的location信息给百度map
-		MyLocationData data = new MyLocationData.Builder()
-				.accuracy(bdLocation.getRadius())
-				// 此处设置开发者获取到的方向信息,顺时针0-360
-				.direction(100)
-				.latitude(bdLocation.getLatitude())
-				.longitude(bdLocation.getLongitude())
-				.build();
-
-		if (fragment != null) {
-			fragment.getMapView().getMap().setMyLocationData(data);
-		}
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int	errorcode;
-
-		// boolean bfinish = false;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr = Network.get_servicelocation();
-
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				int count = jsobj.getInt("total");
-				// if (count < limit)
-				// bfinish = true;
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-				{
-					fragment_content = jstr;
-					errorcode = Network.RESULT_TRUE;
-
-					return true;
-				}
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-			String tag = "onPostExecute@BaiduMapFragment";
-			Log.d(tag, "entry");
-			m_task = null;
-			// showProgress(false);
-
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-				AddMarker();
-
-				mMapView.getMap().setOnMapClickListener( new OnMapClickListener()
-				{
-					
-					@Override
-					public boolean onMapPoiClick(MapPoi arg0)
-					{
-						mMapView.getMap().hideInfoWindow();
-						return false;
-					}
-					
-					@Override
-					public void onMapClick(LatLng arg0)
-					{
-						mMapView.getMap().hideInfoWindow();
-						
-					}
-				});
-				mMapView.getMap().setOnMarkerClickListener(
-						new OnMarkerClickListener()
-						{
-							public boolean onMarkerClick(final Marker marker)
-							{
-								// Button button = new
-								// Button(getActivity().getApplicationContext());
-								// button.setBackgroundResource(R.drawable.popup);
-
-								View viewCache = getActivity()
-										.getLayoutInflater().inflate(
-												R.layout.marker_view, null);
-
-								TextView tv_title = (TextView) viewCache
-										.findViewById(R.id.tv_title);
-								TextView tv_info = (TextView) viewCache
-										.findViewById(R.id.tv_info);
-
-								final String title = marker.getTitle();
-
-								Bundle bundle = marker.getExtraInfo();
-
-								final LocationDetail detail = (LocationDetail) bundle
-										.getSerializable("detail");
-								String city = bundle.getString("city");
-								String area = bundle.getString("area");
-								// OverlayItem item = getItem(index);
-
-								// marker.get
-
-								tv_title.setText(title);
-								tv_info.setText(city + "\n" + area);
-								// m_curitem = item;
-								// pop.showPopup(viewCache, item.getPoint(),
-								// 32);
-								OnInfoWindowClickListener listener = null;
-								if (true)
-								{
-									// button.setText("更改位置");
-									listener = new OnInfoWindowClickListener()
-									{
-										public void onInfoWindowClick()
-										{
-
-											mMapView.getMap().hideInfoWindow();
-
-											Log.d("baidu map.......",
-													"popup on click");
-											
-
-//											mMapView.refresh();
-											Intent intent = new Intent();
-											intent.setClass(
-													getActivity(),
-													LocationDetailActivity.class);
-
-											String markertext = title;
-
-											intent.putExtra("detail",
-													detail);
-											// // intent.putExtra("password",
-											// password);
-											// intent.putExtra("function_name",
-											// function_name);
-											// intent.putExtra("behavior",
-											// Network.BEHAVIOR_SEARCH);
-//											startActivity(intent);
-
-                                            LocationDetail detail = marker_detail.get(markertext);
-
-                                            if (markerClickListener != null) {
-                                                markerClickListener.markerClicked(detail);
-                                            }
-
-										}
-									};
-									LatLng ll = marker.getPosition();
-									InfoWindow mInfoWindow = new InfoWindow(
-											BitmapDescriptorFactory
-													.fromView(viewCache), ll,
-											-100, listener);
-									mMapView.getMap().showInfoWindow(
-											mInfoWindow);
-								}
-								// else if (marker == mMarkerB) {
-								// button.setText("更改图标");
-								// button.setOnClickListener(new
-								// OnClickListener() {
-								// public void onClick(View v) {
-								// marker.setIcon(bd);
-								// mBaiduMap.hideInfoWindow();
-								// }
-								// });
-								// LatLng ll = marker.getPosition();
-								// mInfoWindow = new InfoWindow(button, ll,
-								// -47);
-								// mBaiduMap.showInfoWindow(mInfoWindow);
-								// } else if (marker == mMarkerC) {
-								// button.setText("删除");
-								// button.setOnClickListener(new
-								// OnClickListener() {
-								// public void onClick(View v) {
-								// marker.remove();
-								// mBaiduMap.hideInfoWindow();
-								// }
-								// });
-								// LatLng ll = marker.getPosition();
-								// mInfoWindow = new InfoWindow(button, ll,
-								// -47);
-								// mBaiduMap.showInfoWindow(mInfoWindow);
-								// }
-								return true;
-							}
-						});
-				//
-				// if (bfinish)
-				// {
-				// // getListView().removeFooterView(view_page_footer);
-				// // Toast.makeText(AnnouncementActivity.this, "Load all!",
-				// // Toast.LENGTH_LONG).show();
-				//
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("No more items");
-				// tv.setEnabled(false);
-				// }
-				// else
-				// {
-				// TextView tv = (TextView) view_page_footer
-				// .findViewById(R.id.text_page);
-				// tv.setText("More...");
-				// tv.setEnabled(true);
-				// }
-				// adapter.notifyDataSetChanged();
-				// // getListAdapter().notifyDataSetChanged;
-				// // BaseAdapter mJson = null;
-				// // mJson.notifyDataSetChanged();
-			}
-
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	public void initEngineManager(Context context)
-	{
-
-		SDKInitializer.initialize(ApexTrackingApplication.get_instance());
-		// String strKey = ApexTrackingApplication.get_instance().getString(
-		// R.string.baidu_key);
-		// if (mBMapManager == null)
-		// {
-		// mBMapManager = new BMapManager(context);
-		// }
-		//
-		// if (!mBMapManager.init(strKey, new MyGeneralListener()))
-		// {
-		// // Toast.makeText(getActivity().getApplicationContext(),
-		// // "BMapManager  初始化错误!", Toast.LENGTH_LONG).show();
-		// }
-	}
-
-	/*
-	 * // 常用事件监听,用来处理通常的网络错误,授权验证错误等 static class MyGeneralListener implements
-	 * MKGeneralListener {
-	 * 
-	 * @Override public void onGetNetworkState(int iError) { if (iError ==
-	 * MKEvent.ERROR_NETWORK_CONNECT) { // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(),
-	 * "您的网络出错啦!", // Toast.LENGTH_LONG).show(); } else if (iError ==
-	 * MKEvent.ERROR_NETWORK_DATA) { // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(),
-	 * "输入正确的检索条件!", // Toast.LENGTH_LONG).show(); } // ... }
-	 * 
-	 * @Override public void onGetPermissionState(int iError) { // 非零值表示key验证未通过
-	 * if (iError != 0) { // 授权Key错误: // Toast.makeText( //
-	 * ApexTrackingApplication.get_instance() // .getApplicationContext(), //
-	 * "请在 DemoApplication.java文件输入正确的授权Key,并检查您的网络连接是否正常!error: " // + iError,
-	 * Toast.LENGTH_LONG).show(); m_bKeyRight = false; } else { m_bKeyRight =
-	 * true; // Toast.makeText( // ApexTrackingApplication.get_instance() //
-	 * .getApplicationContext(), "key认证成功", // Toast.LENGTH_LONG).show(); } } }
-	 */
-	@Override
-	public void onActivityCreated(Bundle savedInstanceState)
-	{
-
-		super.onActivityCreated(savedInstanceState);
-		initEngineManager(getActivity().getApplicationContext());
-
-		FragmentManager fm = getChildFragmentManager();
-		fragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
-
-		if (fragment == null)
-		{
-
-			Log.d("onActivityCreated", "create support map fragment");
-			fragment = SupportMapFragment.newInstance();
-			;// .newInstance();
-			fm.beginTransaction().replace(R.id.map, fragment).commit();
-		}
-		mMapView = fragment.getMapView();
-	}
-
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container,
-			Bundle savedInstanceState)
-	{
-		// TODO Auto-generated method stub
-		// return super.onCreateView(inflater, container, savedInstanceState);
-				
-
-		requestloactions();
-
-		return inflater.inflate(R.layout.fragment_service_location, container,
-				false);
-	}
-
-	@Override
-	public void onResume()
-	{
-		super.onResume();
-
-		Log.d("onResume", "get map from fragment");
-		LatLng center = new LatLng(29.945,104.7);
-		MapStatusUpdate msu = MapStatusUpdateFactory.newLatLngZoom(center,4.8f);//MapStatusUpdateFactory.zoomTo(4.5f);
-		
-		
-		fragment.getMapView().getMap().setMapStatus(msu);
-		
-//		float zoomLevel = Float.parseFloat(t.getText().toString());
-//		MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(zoomLevel);
-//		mBaiduMap.animateMapStatus(u);
-//		 MapController controller = fragment.getMapView().getController();
-//		 controller.setCenter(new GeoPoint((int) ( * 1E6),
-//		 (int)  * 1E6)));
-//		 controller.setZoom(5);
-
-		if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-			// TODO: Consider calling
-			//    ActivityCompat#requestPermissions
-			// here to request the missing permissions, and then overriding
-			//   public void onRequestPermissionsResult(int requestCode, String[] permissions,
-			//                                          int[] grantResults)
-			// to handle the case where the user grants the permission. See the documentation
-			// for ActivityCompat#requestPermissions for more details.
-
-		} else {
-			fragment.getMapView().getMap().setMyLocationEnabled(true);
-			initLocation();
-			if(mLocationClient != null && !mLocationClient.isStarted()){//如果定位client没有开启,开启定位
-				mLocationClient.start();
-			}
-		}
-
-	}
-
-	@Override
-	public void onPause() {
-		super.onPause();
-
-		if(mLocationClient != null && mLocationClient.isStarted()){//如果定位client开启,关闭定位
-			mLocationClient.stop();
-		}
-	}
-
-	public BaiduMarkerClickListener markerClickListener;
-	public interface BaiduMarkerClickListener {
-		void markerClicked(LocationDetail detail);
-	}
-
-}

+ 0 - 97
Apex Mobile/app/src/main/java/com/usai/apex/BootBroadcastReceiver.java

@@ -1,97 +0,0 @@
-package com.usai.apex;
-
-
-import android.app.DownloadManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.Cursor;
-import android.net.Uri;
-
-public class BootBroadcastReceiver extends BroadcastReceiver
-{
-
-	@Override
-	public void onReceive(Context context, Intent intent)
-	{
-        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {  
-//            // 启动完成  
-//            Intent iAlarm = new Intent(context, Alarmreceiver.class);  
-//            iAlarm.setAction("com.usai.apex.push");  
-//            PendingIntent sender = PendingIntent.getBroadcast(context, 0,  
-//            		iAlarm, 0);  
-//            long firstime = SystemClock.elapsedRealtime();  
-//            AlarmManager am = (AlarmManager) context  
-//                    .getSystemService(Context.ALARM_SERVICE);  
-//  
-//            // 10秒一个周期,不停的发送广播  
-//            am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,  
-//                    30 * 1000, sender);  
-//			Intent intentservice = new Intent();
-//			intentservice.setClass(context, ApexPushService.class);
-//			if (intent.getExtras() != null)
-//				intentservice.putExtras(intent.getExtras());
-//			intentservice.setAction(intent.getAction());
-//			context.startService(intentservice);
-        	ApexTrackingApplication.startalarm("boot completed");
-        }
-		else if(intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
-		{
-			long myDwonloadID = intent.getLongExtra(
-					DownloadManager.EXTRA_DOWNLOAD_ID, -1);
-//                    LogUtils.i("下载完成 ID = " + myDwonloadID);
-			SharedPreferences sPreferences = context.getSharedPreferences(
-					"downloadplato", 0);
-			long refernece = sPreferences.getLong("plato", 0);
-			if (refernece == myDwonloadID) {
-				String serviceString = Context.DOWNLOAD_SERVICE;
-				DownloadManager dManager = (DownloadManager) context
-						.getSystemService(serviceString);
-
-				DownloadManager.Query query = new DownloadManager.Query();
-				query.setFilterById(myDwonloadID);
-				Cursor c = dManager.query(query);
-				if(c != null) {
-					if (c.moveToFirst()) {
-						int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS);
-						if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) {
-							String downloadFileUrl = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
-//							startInstall(context, Uri.parse(downloadFileUrl));
-
-
-
-							Intent install = new Intent(Intent.ACTION_VIEW);
-							Uri downloadFileUri =Uri.parse(downloadFileUrl);// dManager.getUriForDownloadedFile(myDwonloadID);
-							install.setDataAndType(downloadFileUri,
-									"application/vnd.android.package-archive");
-							install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-							context.startActivity(install);
-						}
-					}
-					c.close();
-				}
-
-
-
-
-
-			}
-		}
-//		else if (intent.getAction().equals(
-//				ConnectivityManager.CONNECTIVITY_ACTION))
-//		{
-//			
-//			ApexTrackingApplication.startalarm("connection change");
-//			// handle auto submit ,check update etc
-////			dbgUtil.Log(Log.INFO,TAG, "ConnectivityManager.CONNECTIVITY_ACTION");
-////			
-////			new AutoUpdateCheckThread(context, false).start();
-////
-////			new AutoSubmitThread(context).start();
-//
-//		}	       
-        
-	}
-
-}

+ 0 - 370
Apex Mobile/app/src/main/java/com/usai/apex/ChangePasswordActivity.java

@@ -1,370 +0,0 @@
-package com.usai.apex;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.util.Network;
-
-/**
- * Activity which displays a login screen to the user, offering registration as
- * well.
- */
-public class ChangePasswordActivity extends AppCompatActivity {
-	private UserLoginTask mAuthTask = null;
-
-	// Values for email and password at the time of the login attempt.
-	// private String m_sUser;
-	private String m_soldPassword;
-	private String m_snewPassword;
-	private String m_snew1Password;
-
-	// UI references.
-	private EditText mOldpassView;
-	private EditText mNewpassView;
-	private EditText mNew1passView;
-	private View mLoginFormView;
-	private View mLoginStatusView;
-	private TextView mLoginStatusMessageView;
-
-
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText(getTitle());
-
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-
-		setContentView(R.layout.activity_change_password);
-
-		setCustomActionBar();
-
-		// Set up the login form.
-
-		mOldpassView = (EditText) findViewById(R.id.old_password);
-
-		mNewpassView = (EditText) findViewById(R.id.new_password);
-		mNew1passView = (EditText) findViewById(R.id.new_password_confirm);
-		mNew1passView
-		 .setOnEditorActionListener(new TextView.OnEditorActionListener() {
-		 @Override
-		 public boolean onEditorAction(TextView textView, int id,
-		 KeyEvent keyEvent) {
-		 if (id == R.id.btn_ok || id == EditorInfo.IME_ACTION_DONE) {
-			 
-			 
-			 InputMethodManager inputMethodManager = (InputMethodManager)getApplicationContext().getSystemService(
-						Context.INPUT_METHOD_SERVICE);
-
-		// EditText editText =
-		// (EditText)findViewById(R.id.xxxx);
-		inputMethodManager.hideSoftInputFromWindow(
-				mNew1passView.getWindowToken(), 0); // ����
-		 changepassword();
-		 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.btn_ok).setOnClickListener(
-				new View.OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						InputMethodManager inputMethodManager = (InputMethodManager)getApplicationContext().getSystemService(
-								Context.INPUT_METHOD_SERVICE);
-
-				// EditText editText =
-				// (EditText)findViewById(R.id.xxxx);
-				inputMethodManager.hideSoftInputFromWindow(
-						mNew1passView.getWindowToken(), 0); // ����
-						changepassword();
-					}
-				});
-		findViewById(R.id.btn_close).setOnClickListener(
-				new View.OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						finish();
-					}
-				});
-	}
-
-	// @Override
-	// public boolean onCreateOptionsMenu(Menu menu) {
-	// super.onCreateOptionsMenu(menu);
-	// getMenuInflater().inflate(R.menu.change_password, 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 changepassword() {
-		if (mAuthTask != null) {
-			return;
-		}
-
-		// Reset errors.
-		mOldpassView.setError(null);
-		mNewpassView.setError(null);
-		mNew1passView.setError(null);
-
-		// Store values at the time of the login attempt.
-		m_soldPassword = mOldpassView.getText().toString();
-		m_snewPassword = mNewpassView.getText().toString();
-		m_snew1Password = mNew1passView.getText().toString();
-
-		boolean cancel = false;
-		View focusView = null;
-
-		// Check for a valid password.
-		if (TextUtils.isEmpty(m_soldPassword)) {
-			mOldpassView.setError(getString(R.string.error_field_required));
-			focusView = mOldpassView;
-			cancel = true;
-		} else if (TextUtils.isEmpty(m_snewPassword)) {
-			mNewpassView.setError(getString(R.string.error_field_required));
-			focusView = mNewpassView;
-			cancel = true;
-		} else if (TextUtils.isEmpty(m_snew1Password)) {
-			mNew1passView.setError(getString(R.string.error_field_required));
-			focusView = mNew1passView;
-			cancel = true;
-		} else if (m_snewPassword.equals(m_snew1Password)==false) {
-			mNew1passView.setError("New passwords not same");
-			focusView = mNew1passView;
-			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 errorcode;
-		@Override
-		protected Boolean doInBackground(Void... params) {
-			errorcode = Network.change_pass(m_soldPassword, m_snewPassword,ApexTrackingApplication.get_user());
-			if (errorcode == Network.RESULT_TRUE)
-				return true;
-			else {
-				return false;
-			}
-		}
-
-		@Override
-		protected void onPostExecute(final Boolean success) {
-			Log.d("onPostExecute", "entry");
-			mAuthTask = null;
-			showProgress(false);
-			// if (netconnect == )
-			// {
-			//
-			// }
-
-			if (success) {
-				AlertDialog.Builder builder = new Builder(ChangePasswordActivity.this);
-				builder.setMessage(getString(R.string.str_password_changed));
-
-				builder.setTitle(getString(R.string.str_change_success));
-
-				builder.setPositiveButton(getString(android.R.string.ok), new OnClickListener() {
-
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						dialog.dismiss();
-
-//						ApexTrackingApplication.put_password(m_snewPassword);
-						setResult(Activity.RESULT_OK, null);
-						finish();
-					}
-				});
-
-
-				builder.create().show();
-
-			} else {
-				switch (errorcode) {
-				case Network.RESULT_NET_NOTAVAILABLE: {
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-				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_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-
-				case Network.RESULT_FALSE: {
-					AlertDialog.Builder builder = new Builder(ChangePasswordActivity.this);
-					builder.setMessage(getString(R.string.str_invalid_password));
-
-					builder.setTitle(getString(R.string.str_failed_to_changepassword));
-
-					builder.setPositiveButton(getString(android.R.string.ok), new OnClickListener() {
-
-						@Override
-						public void onClick(DialogInterface dialog, int which) {
-							dialog.dismiss();
-
-//							RetrievePasswordActivity.this.finish();
-						}
-					});
-					builder.create().show();
-
-					return;
-				}
-				default: {
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_net_resulterror) + ":"
-									+ errorcode, Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				}
-			}
-		}
-
-		@Override
-		protected void onCancelled() {
-			mAuthTask = null;
-			showProgress(false);
-		}
-	}
-}

+ 0 - 166
Apex Mobile/app/src/main/java/com/usai/apex/ContainerSearchActivity.java

@@ -1,166 +0,0 @@
-package com.usai.apex;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.TextView;
-
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.util.dbUtil;
-
-public class ContainerSearchActivity extends AppCompatActivity {
-
-
-    private SegmentView mSegmentView;
-    private AutoCompleteTextView searchField;
-    private Button cancelBtn;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_container_search);
-
-        cancelBtn = findViewById(R.id.button2);
-        searchField = findViewById(R.id.atv_criterion2);
-
-        cancelBtn.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-
-                searchContainer();
-
-                searchField.clearFocus();
-                InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
-                inputMethodManager.hideSoftInputFromWindow(searchField.getWindowToken(),0);
-                inputMethodManager.hideStatusIcon(searchField.getWindowToken());
-            }
-        });
-
-        searchField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
-            @Override
-            public boolean onEditorAction(TextView textView, int i, KeyEvent event) {
-
-                // 当actionId == XX_SEND 或者 XX_DONE时都触发
-                // 或者event.getKeyCode == ENTER 且 event.getAction == ACTION_DOWN时也触发
-                // 注意,这是一定要判断event != null。因为在某些输入法上会返回null。
-                if (i == EditorInfo.IME_ACTION_SEND || i == EditorInfo.IME_ACTION_DONE || (event != null && KeyEvent.KEYCODE_ENTER == event.getKeyCode() && KeyEvent.ACTION_DOWN == event.getAction())) {
-                    searchContainer();
-                }
-
-                return false;
-            }
-        });
-
-        setCustomActionBar();
-    }
-
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarVie = LayoutInflater.from(this).inflate(R.layout.actionbar_segmentview, null);
-
-
-        mSegmentView = mActionBarVie.findViewById(R.id.segmentview);
-
-//
-//        mSegmentView.setOnSegmentViewClickListener(new SegmentView.onSegmentViewClickListener() {
-//            @Override
-//            public void onSegmentViewClick(View view, int postion) {
-//                switch (postion) {
-//                    case 0:
-//                        Toast.makeText(ContainerSearchActivity.this, "点击了消息" + postion,
-//                                Toast.LENGTH_SHORT).show();
-//                        break;
-//                    case 1:
-//                        Toast.makeText(ContainerSearchActivity.this, "点击了电话" + postion,
-//                                Toast.LENGTH_SHORT).show();
-//                        break;
-//                    default:
-//                        break;
-//                }
-//            }
-//        });
-
-
-//        TextView titleview = mActionBarView.findViewById(R.id.title);
-//        titleview.setText(getIntent().getStringExtra("title"));
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarVie, lp);
-        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-        actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(false);
-    }
-
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item)
-    {
-        Intent intent = new Intent();
-        switch (item.getItemId())
-        {
-            case android.R.id.home:
-                finish();
-                break;
-
-            default:
-                break;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    private void searchContainer() {
-
-        InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
-        inputMethodManager.hideSoftInputFromWindow(searchField.getWindowToken(),0);
-        inputMethodManager.hideStatusIcon(searchField.getWindowToken());
-
-        String cargo_criterion = searchField.getText().toString();
-
-        Intent intent = new Intent();
-        intent.setClass(this, NewDetailActivity.class);
-
-        intent.putExtra("action0", "Tracking");
-        intent.putExtra("function_name", "Cargo Tracking");
-
-        intent.putExtra("cargo_criterion", cargo_criterion);
-        intent.putExtra("actions_count", 1);
-        intent.putExtra("_id", "dumb");
-        String h_field;
-
-        int selectedId = mSegmentView.getSelect();
-        if (selectedId == 0)
-        {
-            intent.putExtra("criterion_type", 0);
-            h_field = "h_bol";
-        }
-        else
-        {
-            intent.putExtra("criterion_type", 1);
-            h_field = "ctnr";
-        }
-
-        dbUtil.savehistory(h_field, cargo_criterion);
-
-        startActivity(intent);
-    }
-
-}

+ 0 - 330
Apex Mobile/app/src/main/java/com/usai/apex/CustomizeFieldsActivity.java

@@ -1,330 +0,0 @@
-package com.usai.apex;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.TextView;
-
-import com.usai.util.dbUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-//import android.content.DialogInterface.OnClickListener;
-
-public class CustomizeFieldsActivity extends Activity implements
-		OnClickListener
-{
-	//
-	// @Override
-	// protected void onCreate(Bundle savedInstanceState)
-	// {
-	// super.onCreate(savedInstanceState);
-	// setContentView(R.layout.activity_customize_fields);
-	// }
-	//
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.customize_fields, menu);
-		return true;
-	}
-
-	private static List<fieldedit> list = null;
-	private DragListAdapter adapter = null;
-
-	// public static List<String> groupKey = new ArrayList<String>();
-	private List<fieldedit> showList = new ArrayList<fieldedit>();
-	private List<fieldedit> hideList = new ArrayList<fieldedit>();
-	private String user/* ,password */, function_name;
-	private int behavior;
-
-	public class fieldedit
-	{
-		public String name = null;
-		public int _id = -1;
-
-		public fieldedit(String str, int i)
-		{
-			name = str;
-			_id = i;
-
-		}
-	}
-
-	@Override
-	public void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-
-		user = ApexTrackingApplication.get_user();
-		// password = getIntent().getStringExtra("password");
-		function_name = getIntent().getStringExtra("function_name");
-		behavior = getIntent().getIntExtra("behavior", -1);
-		setContentView(R.layout.activity_customize_fields);
-		Button btnok = (Button) findViewById(R.id.btnok);
-		btnok.setOnClickListener(this);
-		Button btncancel = (Button) findViewById(R.id.btncancel);
-		btncancel.setOnClickListener(this);
-
-		initData();
-
-		DragListView dragListView = (DragListView) findViewById(R.id.drag_list);
-		adapter = new DragListAdapter(this, list);
-		dragListView.setAdapter(adapter);
-		
-		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
-		
-		String vername;
-		try
-		{
-			vername = getPackageManager().getPackageInfo(
-					"com.usai.apex", 0).versionName;
-			boolean bFirstRun = RunOnce.getBoolean(
-					"FirstRun"+vername+"_fields", true);
-			if(bFirstRun&&false)
-			{
-				SharedPreferences.Editor editor = RunOnce.edit();
-				editor.putBoolean("FirstRun"+vername+"_fields", false);
-				// Don't forget to commit your edits!!!
-				editor.commit();
-				Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "fields");
-				startActivity(intent);
-				
-			}		
-		}
-		catch (NameNotFoundException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		switch (item.getItemId())
-		{
-		case R.id.action_help:
-			Intent intent = new Intent();
-			intent.setClass(this, HelpActivity.class);
-			intent.putExtra("caller", "fields");
-//			// 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);
-	}
-	public void initData()
-	{
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("fields_info", new String[] { "aname", "show",
-				"_id" }, "function_name='" + function_name + "' and user='"
-				+ user + "' and behavior=" + behavior, null, null, null,
-				"priority , aname", null);
-		while (cursor.moveToNext())
-		{
-			int show = cursor.getInt(1);
-			if (show == 1)
-				showList.add(new fieldedit(cursor.getString(0), cursor
-						.getInt(2)));
-			else
-			{
-				hideList.add(new fieldedit(cursor.getString(0), cursor
-						.getInt(2)));
-
-			}
-		}
-		// ��ݽ��
-		list = new ArrayList<fieldedit>();
-
-		// groupKey��ŵ��Ƿ����ǩ
-		// groupKey.add("Display fields");
-		// groupKey.add("Hide fields");
-
-		// for (int i = 0; i < 5; i++)
-		// {
-		// navList.add("Aѡ��" + i);
-		// }
-		list.add(new fieldedit(getString(R.string.str_displayitem), -1));
-		list.addAll(showList);
-
-		// for (int i = 0; i <18; i++)
-		// {
-		// moreList.add("Bѡ��" + i);
-		// }
-		list.add(new fieldedit(getString(R.string.str_hideitem), -2));
-		list.addAll(hideList);
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-	}
-
-	public static class DragListAdapter extends ArrayAdapter<fieldedit>
-	{
-
-		// private Context mContext;
-
-		public DragListAdapter(Context context, List<fieldedit> objects)
-		{
-			super(context, 0, objects);
-			// this.mContext = context;
-		}
-
-		public List<fieldedit> getList()
-		{
-			return list;
-		}
-
-		@Override
-		public boolean isEnabled(int position)
-		{
-			if (getItem(position)._id < 0) // _id<0 means a group key
-				return false;
-			// if (groupKey.contains(getItem(position).name))
-			// {
-			// // ����Ƿ����ǩ������false������ѡ�У����ܵ��
-			// return false;
-			// }
-			return super.isEnabled(position);
-		}
-
-		public int switchpos()
-		{
-
-			for (int i = 1; i < getCount(); i++)
-			{
-				if (getItem(i)._id < 0)
-					return i;
-			}
-			return -1;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent)
-		{
-
-			View view = convertView;
-			if (getItem(position)._id < 0) // _id<0 means a group key
-			{
-				view = LayoutInflater.from(getContext()).inflate(
-						R.layout.drag_list_item_tag, null);
-			}
-			// if (groupKey.contains(getItem(position).name))
-			// {
-			// // ����Ƿ����ǩ���ͼ��ط����ǩ�IJ����ļ������������ļ���ʾЧ��ͬ
-			// view = LayoutInflater.from(getContext()).inflate(
-			// R.layout.drag_list_item_tag, null);
-			// }
-			else
-			{
-				// �������������ǩ���ͼ����������IJ����ļ�
-				view = LayoutInflater.from(getContext()).inflate(
-						R.layout.drag_list_item, null);
-			}
-
-			TextView textView = (TextView) view
-					.findViewById(R.id.drag_list_item_text);
-			textView.setText(getItem(position).name);
-
-			return view;
-		}
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-		switch (v.getId())
-		{
-		case R.id.btnok:
-		{
-			// DragListView dragListView = (DragListView)
-			// findViewById(R.id.drag_list);
-			int count = 0;
-			for (int i = 0; i < adapter.getCount(); i++)
-			{
-				fieldedit fe = adapter.getItem(i);
-				if (fe._id == -2 || count > 0)
-					break;
-				if (fe._id >= 0)
-					count++;
-
-			}
-			if (count == 0)
-			{
-				new AlertDialog.Builder(CustomizeFieldsActivity.this)
-						.setIcon(android.R.drawable.ic_dialog_info)
-						.setTitle("Error!")
-						.setMessage("You must set at least 1 field visiable!")
-						.setPositiveButton("OK",
-								new DialogInterface.OnClickListener()
-								{
-									public void onClick(DialogInterface dialog,
-											int whichButton)
-									{
-
-										// finish();
-										/* User clicked OK so do some stuff */
-									}
-								}).show();
-				break;
-
-			}
-
-			int show = 1;
-			SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
-			db.beginTransaction();
-			for (int i = 0; i < adapter.getCount(); i++)
-			{
-				fieldedit fe = adapter.getItem(i);
-				if (fe._id == -2)// hide group begin 
-				{
-					show = 0;
-				}
-				if (show == 1)
-					db.execSQL("update fields_info set show=" + show
-							+ " ,priority=" + i + " where _id=" + fe._id);
-				else
-					db.execSQL("update fields_info set show=" + show
-							+ " where _id=" + fe._id);
-
-			}
-			db.setTransactionSuccessful();
-			db.endTransaction();
-			dbUtil.CloseDB(db);
-			finish();
-			// Log.d("fields",);
-			break;
-		}
-		case R.id.btncancel:
-			finish();
-			break;
-		default:
-			break;
-		}
-		// TODO Auto-generated method stub
-
-	}
-
-}

+ 0 - 607
Apex Mobile/app/src/main/java/com/usai/apex/DetailActivity.java

@@ -1,607 +0,0 @@
-package com.usai.apex;
-
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.FrameLayout;
-import android.widget.TabHost;
-import android.widget.TabWidget;
-import android.widget.TextView;
-
-import com.usai.apex.Result.AMResultActivity;
-import com.usai.apex.mainframe.RootActivity;
-import com.usai.util.commonUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-public class DetailActivity extends AppCompatActivity implements
-		TabHost.TabContentFactory
-{
-	boolean showlogin = false;
-	// int radomid = 1 + (int) (Math.random() * 15);
-	TabHost							mTabHost;
-	LinkedHashMap<String, Integer>	tabmap	= new LinkedHashMap<String, Integer>();
-	HashMap<String,String> contentmap = new HashMap<String ,String>();
-
-	// HashMap<String, DetailFragment> fragments = new HashMap<String,
-	// DetailFragment>();
-	String							function_name;
-	String							_id;
-	String							cargo_criterion;
-	int								criterion_type;
-
-	String email_to = null,email_subject = null,email_content = null;
-	TextView mtitleview;
-//	@Override
-//	public void setTitle(CharSequence title) {
-////        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-////
-////        TextView mtitleviewtitleview = mActionBarView.findViewById(R.id.title);
-//
-//		if(title==null)
-//			title="";
-//		if(mtitleview!=null)
-//			mtitleview.setText(title);
-//	}
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		mtitleview= mActionBarView.findViewById(R.id.title);
-
-
-		function_name = getIntent().getStringExtra("function_name");
-		String title = "";
-		if(function_name.equals("Ocean Booking"))
-			title="Booking Detail";
-		else if(function_name.equals("Ocean B/L info."))
-			title="B/L info. Detail";
-		else if(function_name.equals("Container detail"))
-			title="Container Detail";
-		else if(function_name.equals("Cargo Tracking"))
-			title="Cargo Detail";
-		mtitleview.setText(title);
-		setTitle(title);
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-
-	public DetailActivity get_instance()
-	{
-		return this;
-	}
-
-
-//	String email_to = null,email_subject = null,email_content = null;
-
-	public void save_content(String which,String content)
-	{
-		contentmap.put(which, content);
-
-		try {
-
-			JSONObject jsonObject = new JSONObject(content);
-			email_to = jsonObject.optString("email",null);
-			email_subject = jsonObject.optString("email_subject",null);
-			email_content = jsonObject.optString("email_content",null);
-
-		} catch (JSONException e) {
-			e.printStackTrace();
-		}
-
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("DetailActivity", "onCreate");
-
-		super.onCreate(savedInstanceState);
-
-		setContentView(R.layout.activity_detail);
-
-		setCustomActionBar();
-
-		List<Fragment> fragments = getSupportFragmentManager().getFragments();
-		if (fragments != null)
-		{
-			Log.d("DetailActivity", "fragments count=" + fragments.size());
-//			for (int i = 0; i < fragments.size(); i++)
-//				Log.e("DetailFragment", "fragment name="
-//						+ fragments.get(i).getTag());
-
-		}
-
-		if (savedInstanceState != null)
-		{
-			tabmap = (LinkedHashMap<String, Integer>) savedInstanceState
-					.getSerializable("tabmap");
-			contentmap = (HashMap<String, String>) savedInstanceState.getSerializable("contentmap");
-		}
-		else
-		{
-			int count = getIntent().getIntExtra("actions_count", 0);
-			for (int i = 0; i < count; i++)
-			{
-				int vid = commonUtil.generateViewId();
-				tabmap.put(getIntent().getStringExtra("action" + i), vid);
-			}
-		}
-		function_name = getIntent().getStringExtra("function_name");
-		
-		if(function_name.equals("Ocean Booking"))
-			setTitle("Booking Detail");
-		else if(function_name.equals("Ocean B/L info."))
-			setTitle("B/L info. Detail");
-		else if(function_name.equals("Container detail"))
-			setTitle("Container Detail");
-//		else if(function_name.equals("Cargo Tracking"))
-//			setTitle("Cargo Detail");
-//		
-		
-		if (function_name.equals("Cargo Tracking"))
-		{
-			criterion_type = getIntent().getIntExtra("criterion_type", 0);
-			cargo_criterion = getIntent().getStringExtra("cargo_criterion");
-			setTitle("Cargo Detail");
-		}
-		_id = getIntent().getStringExtra("_id");
-		setupTabs();
-
-	}
-
-	// @Override
-	// protected void onSaveInstanceState(Bundle outState)
-	// {
-	// Iterator<String> iter=fragments.keySet().iterator();
-	//
-	// while (iter.hasNext())
-	// {
-	// String tag = (String) iter.next();
-	// getSupportFragmentManager().putFragment(outState,tag,fragments.get(tag));
-	//
-	// }
-	// outState.putStringArray("tags", fragments.keySet().toArray(new
-	// String[0]));
-	// Log.d("onSaveInstanceState","save fragments" +
-	// fragments.keySet().size());
-	// super.onSaveInstanceState(outState);
-	// }
-	//
-	// @Override
-	// protected void onRestoreInstanceState(Bundle savedInstanceState)
-	// {
-	// String [] tags =savedInstanceState.getStringArray("tags");
-	// Log.d("onRestoreInstanceState","load fragments" + tags.length);
-	// for(int i=0;i<tags.length;i++)
-	// {
-	// Log.d("onRestoreInstanceState","load fragment" + tags[i]);
-	// fragments.put(tags[i],(DetailFragment)
-	// getSupportFragmentManager().getFragment(savedInstanceState,tags[i]));
-	// }
-	//
-	// super.onRestoreInstanceState(savedInstanceState);
-	// }
-
-	/** {@inheritDoc} */
-	public View createTabContent(String tag)
-	{
-		FrameLayout fl = new FrameLayout(this);
-		fl.setId(tabmap.get(tag));
-
-		Fragment f;
-		Bundle bundle = new Bundle();
-		if (function_name.equals("Cargo Tracking"))
-		{
-			if (criterion_type == 0)
-				bundle.putString("hbol", cargo_criterion);
-			else
-				bundle.putString("container_no", cargo_criterion);
-
-		}
-		bundle.putString("action_type", tag);
-		bundle.putString("id", _id);
-		bundle.putString("module_name", function_name);
-
-//		Log.e("findFragmentByTag", "tag=" + tag + ", isnull= "
-//				+ (getSupportFragmentManager().findFragmentByTag(tag) == null));
-
-		f = getSupportFragmentManager().findFragmentById(tabmap.get(tag));
-		if (f == null)
-		{
-			Log.d("createTabContent", "create fragment" + tag);
-			f = new DetailFragment();
-
-			
-			f.setArguments(bundle);
-		}
-		((DetailFragment)f).set_content( contentmap.get(tag));
-		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-		ft.replace(fl.getId(), f);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack(tag);
-		ft.commit();
-		return fl;
-	}
-
-	@Override
-	protected void onSaveInstanceState(Bundle outState)
-	{
-		outState.putSerializable("tabmap", tabmap);
-		outState.putSerializable("contentmap", contentmap);
-		super.onSaveInstanceState(outState);
-	}
-
-	// TabHost mTabHost;
-	// private FrameLayout mTabContent;
-	
-//	@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);
-//			finish();
-//			return true;
-//		}
-//		return super.onKeyDown(keyCode, event);
-//	}
-
-	@Override
-	public boolean onKeyUp(int keyCode, KeyEvent event)
-	{
-		if (keyCode == KeyEvent.KEYCODE_BACK)
-		{
-			// Intent myIntent = new Intent();
-			// myIntent = new Intent(EditActivity.this, tabActivity.class);
-			// startActivity(myIntent);
-			finish();
-			return true;
-		}
-		return super.onKeyUp(keyCode, event);
-	}
-	//
-	// @Override
-	// protected void onCreate(Bundle savedInstanceState)
-	// {
-	// super.onCreate(savedInstanceState);
-	// setContentView(R.layout.activity_detail);
-	// // Show the Up button in the action bar.
-	// setupActionBar();
-	// setupTabs();
-	// }
-	//
-	// /**
-	// * Set up the {@link android.app.ActionBar}.
-	// */
-	// private void setupActionBar()
-	// {
-	//
-	// getActionBar().setDisplayHomeAsUpEnabled(true);
-	//
-	// }
-	//
-	// // private View createTabIndicatorView(ViewGroup parent, CharSequence
-	// label, Drawable icon) {
-	// // final LayoutInflater inflater = LayoutInflater.from(this);
-	// // final View tabIndicator = inflater.inflate(R.layout.tab_indicator,
-	// parent, false);
-	// //
-	// //// final TextView tv = (TextView)
-	// tabIndicator.findViewById(R.id.tab_title);
-	// //// tv.setText(label);
-	// ////
-	// //// final ImageView iconView = (ImageView)
-	// tabIndicator.findViewById(R.id.tab_icon);
-	// //// iconView.setImageDrawable(icon);
-	// //
-	// // return tabIndicator;
-	// // }
-	//
-	// @Override
-	// public View createTabContent(String tag)
-	// {
-	// final TextView tv = new TextView(this);
-	// tv.setText("Content for tab with tag " + tag);
-	// return tv;
-	// }
-	private void setupTabs()
-	{
-		mTabHost = (TabHost) findViewById(R.id.tabhost);
-		// mTabContent = (FrameLayout) findViewById(android.R.id.tabcontent);
-		// FrameLayout tab1 = new FrameLayout(this);
-		mTabHost.setup();
-
-		Iterator<String> iter = tabmap.keySet().iterator();
-		while (iter.hasNext())
-		{
-			String name = (String) iter.next();
-			mTabHost.addTab(mTabHost.newTabSpec(name).setIndicator(name)
-					.setContent(this));
-			// String val = (String) tabmap.get(field);
-			// parms.putString(field, val);
-			// // Cursor c = (Cursor) m_listadapter.getItem(key);
-			// Log.d("@@@@@@@@@", field + " : " + val);
-		}
-
-
-		TabWidget tabWidget=mTabHost.getTabWidget();
-		for (int i = 0; i < tabWidget.getChildCount(); i++) {
-
-			tabWidget.getChildAt(i).getLayoutParams().height = commonUtil.dp2px(this,39);
-			tabWidget.getChildAt(i).setPadding(24,0,24,0);
-//			tabWidget.getChildAt(i).getLayoutParams().height = 60;
-			TextView tv=(TextView)tabWidget.getChildAt(i).findViewById(android.R.id.title);
-//			tv.setGravity(BIND_AUTO_CREATE);
-//			tv.setPadding(10, 10,10, 10);
-			tv.setTextSize(12);//设置字体的大小;
-//			tv.setTextColor(Color.WHITE);//设置字体的颜色;
-//获取tabs图片;
-//			ImageView iv=(ImageView)tabWidget.getChildAt(i).findViewById(android.R.id.icon);
-		}
-
-		// for (int i=1; i <= tabmap.size(); i++) {
-		// String name = tabmap.keySet().iterator().;
-		// mTabHost.addTab(mTabHost.newTabSpec(name)
-		// .setIndicator(name)
-		// .setContent(this));
-		// }
-		// // if(true)
-		// // return;
-		//
-		// // View tab1 = createTabIndicatorView(mTabHost.getTabWidget(),
-		// // "Login",null);
-		// // tabhost.addTab(
-		// // tabhost.newTabSpec("tab" + i).setIndicator(tab)
-		// // .setContent(Mytabfirst.this)); tabhost.setCurrentTab(i);
-		// // i++; tab = null;
-		//
-		// // // ��ɵײ��Զ�����ʽ�İ�ť
-		// // String[] title = new String[] { "Login", "Not login" };
-		// // int[] tabIds = new int[] { R.id.tab1, R.id.tab2 };
-		// mTabHost.addTab(mTabHost.newTabSpec("Login").setIndicator("Login")
-		// .setContent(this));
-		// //
-		// mTabHost.addTab(mTabHost.newTabSpec("Direct Tracking").setIndicator("Direct Tracking").setContent(R.id.tab2));
-		// mTabHost.addTab(mTabHost.newTabSpec("Service Location")
-		// .setIndicator("Service Location").setContent(this));
-
-		// FragmentManager manager = this.getFragmentManager();
-
-		// Instantiate a new fragment.
-		// Fragment loginFragment = new LoginFragment();
-		// // Fragment dtFragement = new DirectTrackingFragment();
-		// Fragment slFragment = new ServiceLocationFragment();
-		// // Add the fragment to the activity, pushing this transaction
-		// // on to the back stack.
-		//
-		// FragmentTransaction ft =
-		// getSupportFragmentManager().beginTransaction();
-		// ft.replace(mTabHost.getTabContentView().getChildAt(0).getId(),
-		// loginFragment);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("Login");
-		//
-		// // ft.replace(R.id.tab2, dtFragement);
-		// // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// // ft.addToBackStack("Tracking");
-		//
-		// ft.replace(R.id.tab3, (Fragment) slFragment);
-		// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		// ft.addToBackStack("Location");
-		//
-		// ft.commit();
-
-		// if (manager.findFragmentByTag(tabId) == null)
-		// {
-		// FragmentTransaction trans = manager.beginTransaction();
-		// trans.replace(contentViewID, frag, tabId);
-		// trans.commit();
-		// }
-		// for (int i = 0; i < title.length; i++) {
-		// Button button = new Button(this);
-		// button.setText(title[i]);
-		// button.setBackgroundDrawable(this.getResources().getDrawable(
-		// R.drawable.tab_lable)); //�Զ��尴ť��ʽ
-		// mTabHost.addTab(mTabHost.newTabSpec(title[i]).setIndicator(button)
-		// .setContent(tabIds[i]));
-		// }
-
-		// mTabHost.setOnTabChangedListener(this);
-	}
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-
-		if (function_name.equals("Cargo Tracking")) {
-			getMenuInflater().inflate(R.menu.cargo_menu, menu);
-		} else {
-			getMenuInflater().inflate(R.menu.detail, menu);
-		}
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		switch (item.getItemId())
-		{
-			case R.id.action_close:
-
-				finish();
-//				if (SearchResultActivity.instance != null) {
-//					SearchResultActivity.instance.finish();
-//				}
-//				if (SearchListActivity.instance != null) {
-//					SearchListActivity.instance.finish();
-//				}
-				Intent intent = new Intent(this, RootActivity.class);
-
-//                Intent intent = new Intent(context, LoginView.class);
-                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-
-
-				startActivity(intent);
-				break;
-			case android.R.id.home:
-				finish();
-				break;
-			case R.id.action_addto_favorite:
-//	            LayoutInflater factory = LayoutInflater.from(this);
-//	            final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
-	            final View edit = new EditText(this);
-	             new AlertDialog.Builder(this)
-	                .setIconAttribute(android.R.attr.alertDialogIcon)
-	                .setTitle(R.string.str_createname)
-	                .setView(edit)
-	                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-                            String name = ((EditText)edit).getText().toString();
-                            if(TextUtils.isEmpty(name))
-                            {
-                                new android.app.AlertDialog.Builder(DetailActivity.this)
-                                        .setTitle("Warning")
-                                        .setMessage("Name can not be empty.")
-
-                                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                            @Override
-                                            public void onClick(DialogInterface dialog, int which) {
-
-                                            }
-                                        })
-                                        .show();
-                                return;
-                            }
-
-	                    	String param = getIntent().toUri(0);
-
-	        				SQLiteDatabase db = dbUtil.OpenDB(
-	        						ApexTrackingApplication.get_instance(), null, true);
-	        				db.execSQL("insert into favorites(name,params,user,create_time,module_name) values('"
-	        						+ name
-	        						+ "','"
-	        						+ param
-	        						+ "','"
-	        						+ ApexTrackingApplication.get_user()
-	        						+ "',"
-	        						+ System.currentTimeMillis()
-									+ ",'"
-									+getIntent().getStringExtra("function_name")+ "')");
-	        				dbUtil.CloseDB(db);
-
-	                        /* User clicked OK so do some stuff */
-	                    }
-	                })
-	                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-
-	                        /* User clicked cancel so do some stuff */
-	                    }
-	                })
-	                .create().show();
-	             return true;
-
-			case R.id.action_search_document: {
-				String cargo_str = contentmap.get("Tracking");
-				try {
-					JSONObject cargo_json = new JSONObject(cargo_str);
-					String hbol = cargo_json.optString("hbol");
-					if (hbol != null && hbol.length() > 0) {
-
-						Bundle parms = new Bundle();
-						parms.putString("bol",hbol);
-						parms.putString("module_name","Download Document");
-						Intent resultIntent = new Intent(this, AMResultActivity.class);
-						resultIntent.putExtra("query_params",parms);
-						startActivity(resultIntent);
-
-					} else {
-						showAlter("There is no hbol to search");
-					}
-
-				} catch (JSONException e) {
-					e.printStackTrace();
-					showAlter("There is no hbol to search");
-				}
-
-			}
-			break;
-
-			case R.id.action_share_detail: {
-
-				Intent share = new Intent();
-				share.setAction(Intent.ACTION_SEND);
-//				share.putExtra(Intent.EXTRA_STREAM, uri);
-				share.setType("text/plain");
-
-
-
-
-				if (email_content != null) {
-					share.putExtra(Intent.EXTRA_TEXT, email_content);   //附带的说明信息
-				}
-				if (email_subject != null) {
-					share.putExtra(Intent.EXTRA_SUBJECT, email_subject);
-				}
-				if (email_to != null) {
-					share.putExtra(Intent.EXTRA_EMAIL, email_to.split(","));
-				}
-
-//        share.putExtra(Intent.EXTRA_CC, new String[]{"ray.zhang@united-cn.net"});
-//        startActivity(Intent.createChooser(share,getString(R.string.str_sendto)));
-				startActivity(Intent.createChooser(share, "Share"));
-			}
-			break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	public void showAlter(String msg) {
-		new AlertDialog.Builder(this)
-				.setMessage(msg)
-				.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialogInterface, int i) {
-
-					}
-				})
-				.show();
-	}
-
-}

+ 0 - 1726
Apex Mobile/app/src/main/java/com/usai/apex/DetailFragment.java

@@ -1,1726 +0,0 @@
-package com.usai.apex;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.app.AlertDialog;
-import android.app.ProgressDialog;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.support.constraint.ConstraintLayout;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextWatcher;
-import android.util.Log;
-import android.util.SparseIntArray;
-import android.view.GestureDetector;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.webkit.WebResourceRequest;
-import android.webkit.WebResourceResponse;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.ScrollView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.apex.ShipMap.ShipMap;
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.apex.pdf.PDFPreviewActivity;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-import com.usai.util.commonUtil;
-
-import org.apache.http.util.EncodingUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.util.regex.Pattern;
-
-public class DetailFragment extends Fragment implements OnClickListener, ShipMap.ShipMapListener /*
-																		 * ,
-																		 * OnGestureListener
-																		 */
-{
-
-	private static final int People_Pick_Code = 1357;
-
-	private String copiedKey;
-	private String copiedVal;
-	private View touchedView;
-
-	@Override
-	public void shipMapTryToZoomIn(ShipMap shipMap, boolean zoomIn) {
-
-		if (zoomIn) {
-
-			LinearLayout.LayoutParams lfLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);
-			mDetailContainer.setLayoutParams(lfLayoutParams);
-
-		} else {
-
-			LinearLayout.LayoutParams lfLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0,2.0f);
-			mDetailContainer.setLayoutParams(lfLayoutParams);
-		}
-
-		mMapZoomIn = zoomIn;
-
-	}
-
-	private class GestureListener extends GestureDetector.SimpleOnGestureListener {
-
-		@Override
-		public boolean onDoubleTapEvent(MotionEvent e) {
-
-
-			if (e.getAction() == MotionEvent.ACTION_UP) {
-
-				if (touchedView == null) {
-
-					ClipboardManager cm = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
-					cm.setText(copiedVal);
-
-					Toast.makeText(mContext, "Copied " + copiedKey, Toast.LENGTH_LONG).show();
-				} else {
-
-					String type = (String) touchedView.getTag();
-					if (type.equals("tracking")) {
-
-						TextView tvgroup = (TextView) touchedView.findViewById(R.id.tv_group);
-
-						if (tvgroup != null) {
-
-							String val = tvgroup.getText().toString();
-							ClipboardManager cm = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
-							cm.setText(val);
-
-							Toast.makeText(mContext, "Copied " + val, Toast.LENGTH_LONG).show();
-						}
-					}
-				}
-			}
-
-			copiedKey = null;
-			copiedVal = null;
-			touchedView = null;
-
-			return false;
-		}
-
-		@Override
-		public boolean onSingleTapConfirmed(MotionEvent e) {
-
-			if (touchedView != null) {
-				onClick(touchedView);
-			}
-			touchedView = null;
-
-			return false;
-		}
-	}
-
-	private static final int	REQUEST_LOGINACTIVITY	= 1;
-
-	// DataFragment mdataFragment;
-
-	Context mContext;
-	ProgressDialog progressDialog;
-	private GestureDetector detector;
-
-	protected void showProgressDialog(final String title, final String msg) {
-
-		getActivity().runOnUiThread(new Runnable() {
-			@Override
-			public void run() {
-				try {
-					progressDialog.setTitle(title);
-					progressDialog.setMessage(msg);
-					progressDialog.show();
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-			}
-		});
-
-	}
-
-	/* private GestureDetector mGestureDetector; */
-	@Override
-	public void onCreate(Bundle savedInstanceState)
-	{
-		// TODO Auto-generated method stub
-		super.onCreate(savedInstanceState);
-
-		if (progressDialog == null) {
-			progressDialog = new ProgressDialog(mContext);
-			progressDialog.setCancelable(false);
-		}
-
-		if (detector == null) {
-			detector = new GestureDetector(mContext, new GestureListener());
-		}
-
-	}
-
-//	@Override
-//	public void onActivityCreated(@Nullable Bundle savedInstanceState) {
-//		super.onActivityCreated(savedInstanceState);
-//
-//		progressDialog = new ProgressDialog(mContext);
-//		progressDialog.setCancelable(false);
-//	}
-
-	@Override
-	public void onAttach(Context context) {
-		super.onAttach(context);
-		mContext = context;
-	}
-
-	@Override
-	public void onDestroyView()
-	{
-		Log.d("DetailFragment", "onDestroyView()");
-		super.onDestroyView();
-	}
-
-	// public String get_content()
-	// {
-	// return fragment_content;
-	// }
-
-	LinearLayout		ll_root;
-	ScrollView			sl_root;
-	String				mimeType			= "text/html";
-	private SearchTask	m_task				= null;
-	SparseIntArray		control				= new SparseIntArray();
-	// private TextView mStatusMessageView;
-	private View		mStatusView;
-
-	String				fragment_content	= null;
-
-	public void requestdata()
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		if (fragment_content != null)
-		{
-			LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
-					.get_instance().getSystemService(
-							Context.LAYOUT_INFLATER_SERVICE);
-			init(fragment_content, inflater);
-			return;
-		}
-		// if (mdataFragment.get_result() != null) {
-		// LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
-		// .get_instance().getSystemService(
-		// Context.LAYOUT_INFLATER_SERVICE);
-		// init(mdataFragment.get_result(), inflater);
-		// }
-		// if (fragment_content != null)
-		// return;
-		// mStatusMessageView.setText("Loading");
-		showProgress(true);
-		m_task = new SearchTask();
-		m_task.execute();
-
-	}
-
-	public void set_content(String content)
-	{
-		fragment_content = content;
-	}
-
-	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 = ApexTrackingApplication.get_instance()
-					.getResources()
-					.getInteger(android.R.integer.config_shortAnimTime);
-
-			mStatusView.setVisibility(View.VISIBLE);
-			mStatusView.animate().setDuration(shortAnimTime)
-					.alpha(show ? 1 : 0)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							mStatusView.setVisibility(show ? View.VISIBLE
-									: View.INVISIBLE);
-						}
-					});
-
-			ll_root.setVisibility(View.VISIBLE);
-			ll_root.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							ll_root.setVisibility(show ? View.INVISIBLE
-									: View.VISIBLE);
-						}
-					});
-		}
-		else
-		{
-			// The ViewPropertyAnimator APIs are not available, so simply show
-			// and hide the relevant UI components.
-			mStatusView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-			ll_root.setVisibility(show ? View.INVISIBLE : View.VISIBLE);
-		}
-	}
-
-	// @Override
-	// public void onActivityCreated(Bundle savedInstanceState)
-	// {
-	// FragmentManager fm = getFragmentManager();
-	//
-	// // Check to see if we have retained the worker fragment.
-	// mdataFragment = (DataFragment)fm.findFragmentByTag("work");
-	//
-	// // If not retained (or first time running), we need to create it.
-	// if (mdataFragment == null) {
-	// mdataFragment = new DataFragment();
-	// // Tell it who it is working with.
-	// mdataFragment.setTargetFragment(this, 0);
-	// fm.beginTransaction().add(mdataFragment, "work").commit();
-	// }
-	// super.onActivityCreated(savedInstanceState);
-	// }
-
-	private ShipMap mTrackingMap;
-
-
-
-	@Override
-	public void onSaveInstanceState(Bundle outState) {
-		super.onSaveInstanceState(outState);
-
-		if (mContent != null) {
-			outState.putString("content",mContent.toString());
-		}
-		outState.putInt("selectContactPosition",mSelectContactPosition);
-		outState.putInt("selectTrackingPosition",mSelectTrackingPosition);
-		outState.putInt("selectTrackingChild",mSelectTrackingChild);
-		outState.putBoolean("mapZoomIn",mMapZoomIn);
-	}
-
-	private void configureMap(ShipMap map) {
-		if (map == null) {
-			return;
-		}
-
-		map.setShowCurrent(true);
-		map.setShowDestination(true);
-		map.setShowOrigin(true);
-		map.setShowPor(true);
-		map.setShowPoe(true);
-		map.setShowPod(true);
-		map.setShowPol(true);
-
-		map.setShipMapListener(this);
-	}
-
-	private RelativeLayout mDetailContainer;
-	private boolean mMapZoomIn = false;
-
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container,
-			Bundle savedInstanceState)
-	{
-
-
-		final Context context = getContext();
-		/* mGestureDetector = new GestureDetector(this); */
-
-		View view = null;
-
-		if(this.getArguments().getString("action_type").equals("Tracing")||this.getArguments().getString("action_type").equals("Tracking")) {
-			view = inflater.inflate(R.layout.detail_fragment_withmap, null);
-			mTrackingMap = view.findViewById(R.id.tracking_map);
-			configureMap(mTrackingMap);
-			mDetailContainer = view.findViewById(R.id.detail_list_container);
-		} else {
-			view = inflater.inflate(R.layout.detail_fragment, null);
-			mTrackingMap = null;
-		}
-
-		if (savedInstanceState != null) {
-			fragment_content = savedInstanceState.getString("content");
-			mSelectContactPosition = savedInstanceState.getInt("selectContactPosition");
-			mSelectTrackingPosition = savedInstanceState.getInt("selectTrackingPosition");
-			mSelectTrackingChild = savedInstanceState.getInt("selectTrackingChild");
-			mMapZoomIn = savedInstanceState.getBoolean("mapZoomIn");
-		}
-
-		if (mTrackingMap != null) {
-			mTrackingMap.setZoomIn(mMapZoomIn);
-		}
-
-//		if(this.getArguments().getString("action_type").equals("Tracing"))
-//		{
-//			LinearLayout ll1 = view.findViewById(R.id.detail_linear);
-//
-//			ShipMap shipMap = new ShipMap(context);
-////		mShipMap = shipMap;
-//
-//
-//			LinearLayout.LayoutParams mapLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0,1.0f);
-//			mapLayoutParams.setMargins(commonUtil.dp2px(context,5),commonUtil.dp2px(context,2),commonUtil.dp2px(context,5),commonUtil.dp2px(context,2));
-//
-//			ll1.addView(shipMap,mapLayoutParams);
-//
-//		}
-
-
-
-
-		sl_root = (ScrollView) view.findViewById(R.id.sl_root);
-		/*
-		 * sl_root.setOnTouchListener(new View.OnTouchListener() {
-		 * 
-		 * @Override public boolean onTouch(View v, MotionEvent event) { return
-		 * mGestureDetector.onTouchEvent(event); } });
-		 */
-		ll_root = (LinearLayout) view.findViewById(R.id.ll_root);
-		mStatusView = view.findViewById(R.id.status);
-		LinearLayout ll = (LinearLayout) view.findViewById(R.id.ll_refresh);
-		Button btn_refresh = (Button) ll.findViewById(R.id.btn_refresh);
-		btn_refresh.setOnClickListener(new View.OnClickListener()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-				LinearLayout ll = (LinearLayout) ll_root
-						.findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.GONE);
-
-				requestdata();
-
-			}
-		});
-		// FragmentManager fm = getFragmentManager();
-		// List<Fragment> fragments = fm.getFragments();
-		// if (fragments != null) {
-		// Log.e("DetailFragment", "fragments count=" + fragments.size());
-		// // for (int i = 0; i < fragments.size(); i++)
-		// // Log.e("DetailFragment", "fragments name=" + fragments.size());
-		//
-		// }
-		// // this.getFragmentManager();
-		// String tag = getArguments().getString("module_name");
-		// // Check to see if we have retained the worker fragment.
-		// mdataFragment = (DataFragment) fm.findFragmentById(12345);
-		//
-		// // If not retained (or first time running), we need to create it.
-		// if (mdataFragment == null) {
-		// Log.e("dataFragment creaded ", "tag=data_" + tag);
-		// mdataFragment = new DataFragment();
-		// // Tell it who it is working with.
-		// mdataFragment.setTargetFragment(this, 0);
-		// fm.beginTransaction().add(12345,mdataFragment, "data+" +
-		// tag).commit();
-		// }
-		requestdata();
-		return view;
-	}
-
-	protected JSONObject loadfakecontent(int rawid)
-	{
-
-		String jstring = "";
-		try
-		{
-			InputStream in = getResources().openRawResource(rawid);
-			// 获取文件的字节数
-			int lenght = in.available();
-			// 创建byte数组
-			byte[] buffer = new byte[lenght];
-			// 将文件中的数据读到byte数组中
-			in.read(buffer);
-			jstring = EncodingUtils.getString(buffer, "UTF-8");
-			JSONObject jsobj = new JSONObject(jstring);
-			return jsobj;
-//            JSONObject objrecords = jsobj.getJSONObject("records");
-		}
-		catch (Exception e)
-		{
-			e.printStackTrace();
-		}
-		return null;
-
-	}
-
-	public JSONObject mContent;
-
-	private int mSelectContactPosition = -1;
-	private int mSelectTrackingPosition = -1;
-	private int mSelectTrackingChild = -1;
-	private View mSelectedTrackingCell = null;
-
-	private void selectLocation(View view,int group,int child,JSONObject location) {
-
-		if (mSelectedTrackingCell != null) {
-			mSelectedTrackingCell.setBackgroundColor(Color.WHITE);
-		}
-
-		mSelectTrackingPosition = group;
-		mSelectTrackingChild = child;
-		mSelectedTrackingCell = view;
-
-		if (mSelectedTrackingCell != null) {
-			mSelectedTrackingCell.setBackgroundColor(Color.LTGRAY);
-		}
-
-		if (mTrackingMap != null && location != null) {
-			mTrackingMap.showShipAnnotation(location);
-		}
-
-	}
-
-	void init(String jstr, LayoutInflater inflater)
-	{
-//		LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
-//				.get_instance().getSystemService(
-//						Context.LAYOUT_INFLATER_SERVICE);
-
-		inflater=getActivity().getLayoutInflater();
-
-
-		String TAG = "init@DetailFragment";
-		Log.d(TAG, jstr);
-		try
-		{
-			JSONObject jsonObj = new JSONObject(jstr);
-
-			int group_count = jsonObj.getInt("count");
-
-//			if (getArguments().getString("action_type").equals("Detail")) {
-//				JSONObject commObj = loadfakecontent(R.raw.fake_comm);
-//				jsonObj.put("group" + group_count++,commObj);
-//				jsonObj.put("count",group_count);
-//			}
-
-
-
-			mContent = jsonObj;
-
-			if (group_count == 0)
-			{
-
-				TextView tv_empty = (TextView) ll_root
-						.findViewById(R.id.tv_empty);
-				tv_empty.setVisibility(View.VISIBLE);
-
-
-				NewDetailActivity activity = (NewDetailActivity) getActivity();
-				int tabCount = activity.getTabCount();
-
-				if(tabCount==1)
-				{
-					new AlertDialog.Builder(getContext())
-							.setTitle("Warning")
-							.setCancelable(false)
-							.setMessage("No Search Result.")
-							.setPositiveButton("Back", new DialogInterface.OnClickListener() {
-								@Override
-								public void onClick(DialogInterface dialog, int which) {
-									getActivity().finish();
-//                                checkAllPermission();
-//								if (finalRequest)
-//									checkAllPermission();
-//								else
-//									finish();
-								}
-							})
-//                    .setNegativeButton("No", new DialogInterface.OnClickListener() {
-//                        @Override
-//                        public void onClick(DialogInterface dialog, int which) {
-//                            finish();
-//                        }
-//                    })
-							.show();
-				}
-
-			}
-			for (int i = 0; i < group_count; i++)
-			{
-				// String key = (String) it.next();
-				// if (key.equals("result"))
-				// continue;
-				final JSONObject groupobj = jsonObj.getJSONObject("group" + i);
-				View v = inflater.inflate(R.layout.group_tag, null);
-//				v.setOnClickListener(this);
-
-
-				TextView tvgroup = (TextView) v.findViewById(R.id.tv_group);
-				String group_name = groupobj.getString("_name");
-				tvgroup.setText(group_name);
-				v.setId(commonUtil.generateViewId());
-				ll_root.addView(v);
-				String grouptype = groupobj.getString("_type");
-
-				v.setTag(grouptype);
-				v.setOnTouchListener(new View.OnTouchListener() {
-					@Override
-					public boolean onTouch(View view, MotionEvent motionEvent) {
-
-						touchedView = view;
-						detector.onTouchEvent(motionEvent);
-
-						return true;
-					}
-				});
-
-
-				// groupobj.remove("_type");
-				if (grouptype.equals("mapping"))
-				{
-					LinearLayout mappingview = (LinearLayout) inflater.inflate(
-							R.layout.key_mapping, null);
-					mappingview.setId(commonUtil.generateViewId());
-					control.put(v.getId(), mappingview.getId());
-					ll_root.addView(mappingview);
-
-					int map_count = groupobj.getInt("count");
-					for (int j = 0; j < map_count; j++)
-					{
-						// String keygroup = (String) itgroup.next();
-						JSONObject itemobj = groupobj.getJSONObject("item" + j);
-						final String key = (String) itemobj.keys().next();
-						final String val = itemobj.getString(key);
-						LinearLayout mappingitem = (LinearLayout) inflater
-								.inflate(R.layout.keymapping_item, null);
-						TextView tvkey = (TextView) mappingitem
-								.findViewById(R.id.tv_key);
-						tvkey.setText(key);
-						// tvkey.setBackgroundResource(R.drawable.detail_item);
-						TextView tvval = (TextView) mappingitem
-								.findViewById(R.id.tv_value);
-						tvval.setText(Html.fromHtml(val));
-						// tvval.setBackgroundResource(R.drawable.detail_item);
-
-						tvval.setOnTouchListener(new View.OnTouchListener() {
-							@Override
-							public boolean onTouch(View view, MotionEvent motionEvent) {
-
-								copiedKey = key;
-								copiedVal = val;
-								detector.onTouchEvent(motionEvent);
-
-								return true;
-							}
-						});
-
-						mappingview.addView(mappingitem);
-					}
-					// Iterator itgroup = groupobj.keys();
-					// while (itgroup.hasNext())
-					// {
-					//
-					//
-					// }
-				}
-				else if (grouptype.equals("table"))
-				{
-					String content = groupobj.getString("content");
-					WebView wv;
-
-					wv = (WebView) inflater.inflate(R.layout.web_content, null);
-
-					wv.getSettings().setDefaultTextEncodingName("UTF-8");
-					wv.setId(commonUtil.generateViewId());
-					wv.setWebViewClient(new MyWebViewClient());
-//					wv.setDownloadListener(new DownloadListener()
-//					{
-//
-//						@Override
-//						public void onDownloadStart(String url,
-//								String userAgent, String contentDisposition,
-//								String mimetype, long contentLength)
-//						{
-//							if(!commonUtil.localdirExist())
-//							{
-//
-//								new AlertDialog.Builder(getActivity())
-//				                .setIconAttribute(android.R.attr.alertDialogIcon)
-//				                .setTitle(R.string.str_localdir_error)
-//				                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-//				                    public void onClick(DialogInterface dialog, int whichButton) {
-//
-//				                        /* User clicked OK so do some stuff */
-//				                    }
-//				                })
-//				                .create().show();
-//								return;
-//							}
-////							String filename = contentDisposition.replace("attachment;filename=\"", "");
-////							filename = filename.replace("\"", "");
-////
-////							Log.d("WebView", "Download Action");
-////							Log.d("tag", "url=" + url);
-////							// Log.i("tag", "userAgent="+userAgent);
-////							// Log.i("tag",
-////							// "contentDisposition="+contentDisposition);
-////							// Log.i("tag", "mimetype="+mimetype);
-////							// Log.i("tag", "contentLength="+contentLength);
-////							// Uri uri = Uri.parse(url);
-////							// Intent intent = new Intent(Intent.ACTION_VIEW,
-////							// uri);
-////							// startActivity(intent);
-////
-////							final DownloadManager downloadManager = (DownloadManager) ApexTrackingApplication
-////									.get_instance().getSystemService(
-////											Context.DOWNLOAD_SERVICE);
-////
-////							Uri uri = Uri.parse(url);
-////							final Request request = new Request(uri);
-////
-////							// 设置允许使用的网络类型,这里是移动网络和wifi都可以
-////							request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE
-////									| DownloadManager.Request.NETWORK_WIFI);
-////
-////
-////
-////							request.setDestinationInExternalPublicDir("Apex Mobile",filename);
-////
-////							// 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限:android.permission.DOWNLOAD_WITHOUT_NOTIFICATION
-////							// request.setShowRunningNotification(false);
-////
-////							// 不显示下载界面
-////							request.setVisibleInDownloadsUi(false);
-////							request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
-////
-////							/*
-////							 * 设置下载后文件存放的位置,如果sdcard不可用,那么设置这个将报错,
-////							 * 因此最好不设置如果sdcard可用,下载后的文件 在/mnt/sdcard/Android/
-////							 * data/packageName/files目录下面
-////							 * ,如果sdcard不可用,设置了下面这个将报错,不设置,下载后的文件在/cache这个 目录下面
-////							 */
-////							// request.setDestinationInExternalFilesDir(this,
-////							// null, "tar.apk");
-////
-//////							getActivity();
-////							AlertDialog.Builder builder = new Builder(
-////									getActivity());
-////							builder.setMessage(getString(R.string.str_downloadmessage));
-////
-////							builder.setTitle(getString(R.string.str_confirmdownload));
-////
-////							builder.setPositiveButton(
-////									getString(R.string.str_download),
-////									new Dialog.OnClickListener()
-////									{
-////
-////										@Override
-////										public void onClick(
-////												DialogInterface dialog,
-////												int which)
-////										{
-////											downloadManager.enqueue(request);
-////											dialog.dismiss();
-////
-////										}
-////									});
-////
-////							builder.setNegativeButton(
-////									getString(R.string.str_cancel),
-////									new Dialog.OnClickListener()
-////									{
-////
-////										@Override
-////										public void onClick(
-////												DialogInterface dialog,
-////												int which)
-////										{
-////											dialog.dismiss();
-////										}
-////									});
-////
-////							builder.create().show();
-//
-//						}
-//
-//					});
-					wv.setTag(i);
-					control.put(v.getId(), wv.getId());
-					wv.loadData(content, mimeType, null);
-
-					// wv.setOnTouchListener(new OnTouchListener()
-					// {
-					// @Override
-					// public boolean onTouch(View v, MotionEvent event)
-					// {
-					//
-					// if (event.getAction() == MotionEvent.ACTION_UP)
-					// sl_root.requestDisallowInterceptTouchEvent(false);
-					// else
-					// sl_root.requestDisallowInterceptTouchEvent(true);
-					//
-					// return false;
-					// }
-					// });
-					ll_root.addView(wv);
-					Log.d("table content", content);
-
-				}
-				if (grouptype.equals("tracking"))
-				{
-					LinearLayout listview = (LinearLayout) inflater.inflate(
-							R.layout.list_content, null);
-
-					listview.setId(commonUtil.generateViewId());
-
-
-					ViewGroup.LayoutParams lp=listview.getLayoutParams();
-					control.put(v.getId(), listview.getId());
-					ll_root.addView(listview);
-					long list_count = groupobj.getInt("count");
-					for (int j = 0; j < list_count; j++)
-					{
-						final JSONObject itemobj = groupobj.getJSONObject("item" + j);
-
-						ConstraintLayout listitem = (ConstraintLayout) inflater
-								.inflate(R.layout.detail_tracking_cell, null);
-
-
-						ImageView icon = (ImageView)  listitem
-								.findViewById(R.id.iv_thumb);
-
-						String iconname = itemobj.getString("icon");
-						int rid = commonUtil.iconName2Rid(getActivity(),iconname);
-						icon.setImageResource(rid);
-						if(j!=0)
-						{
-							icon.setColorFilter(Color.GRAY);
-//							ColorMatrix matrix = new ColorMatrix();
-//							matrix.setSaturation(0);
-//							ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
-//							icon..image.setColorFilter(filter);
-						}
-
-						TextView tvitem = (TextView) listitem
-								.findViewById(R.id.tv_title);
-						String val = itemobj.getString("msg");
-						tvitem.setText(val);
-
-						// tvitem.setBackgroundResource(R.drawable.detail_item);
-					//	listitem.removeView(tvitem);
-
-						int px=commonUtil.dp2px(getActivity(),56);
-						listitem.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, px, 1));
-						listview.addView(listitem);
-//						ViewGroup.LayoutParams lp1=listitem.getLayoutParams();
-
-						final int selectIndex = i;
-						final int child = j;
-						final JSONObject location = groupobj.optJSONObject("location");
-
-						listitem.setOnClickListener(new OnClickListener() {
-							@Override
-							public void onClick(View v) {
-
-//								if (mTrackingMap != null) {
-//									JSONObject location = groupobj.optJSONObject("location");
-//									if (location != null) {
-//										mTrackingMap.showShipAnnotation(location);
-//									}
-//									mSelectTrackingPosition = selectIndex;
-//								}
-
-								selectLocation(v,selectIndex,child,location);
-
-							}
-						});
-
-						if (mSelectTrackingPosition == -1) {
-							mSelectTrackingPosition = selectIndex;
-						}
-						if (mSelectTrackingChild == -1) {
-							mSelectTrackingChild = 0;
-						}
-
-						if (mSelectTrackingPosition == selectIndex && mSelectTrackingChild == child) {
-
-//							if (mTrackingMap != null) {
-//								JSONObject location = groupobj.optJSONObject("location");
-//								if (location != null) {
-//									mTrackingMap.showShipAnnotation(location);
-//								}
-//							}
-
-							selectLocation(listitem,selectIndex,child,location);
-						}
-
-					}
-
-				}
-				if (grouptype.equals("list"))
-				{
-					LinearLayout listview = (LinearLayout) inflater.inflate(
-							R.layout.list_content, null);
-					listview.setId(commonUtil.generateViewId());
-					control.put(v.getId(), listview.getId());
-					ll_root.addView(listview);
-					long list_count = groupobj.getInt("count");
-					for (int j = 0; j < list_count; j++)
-					{
-						RelativeLayout listitem = (RelativeLayout) inflater
-								.inflate(R.layout.list_item, null);
-
-						TextView tvitem = (TextView) listitem
-								.findViewById(R.id.tv_item);
-						String val = groupobj.getString("line" + j);
-						tvitem.setText(val);
-						// tvitem.setBackgroundResource(R.drawable.detail_item);
-						listitem.removeView(tvitem);
-
-						listview.addView(tvitem);
-					}
-					// Iterator itgroup = groupobj.keys();
-					// while (itgroup.hasNext())
-					// {
-					// String keygroup = (String) itgroup.next();
-					//
-					// }
-				}
-				if (grouptype.equals("communication"))
-				{
-					LinearLayout listview = (LinearLayout) inflater.inflate(
-							R.layout.list_content, null);
-					listview.setId(commonUtil.generateViewId());
-					control.put(v.getId(), listview.getId());
-					ll_root.addView(listview);
-
-					// 添加收件人和cc
-					ConstraintLayout commu_header = (ConstraintLayout) inflater
-							.inflate(R.layout.commu_item_header, null);
-
-					TextView toTv = commu_header.findViewById(R.id.comm_to_tv);
-                    EditText ccTv = commu_header.findViewById(R.id.comm_cc_tv);
-					ImageButton contactBtn = commu_header.findViewById(R.id.comm_contact_btn);
-
-					ccTv.setTag("group_" + i + "_cc");
-
-                    String to = groupobj.optString("receipt");
-                    String cc = groupobj.optString("cc");
-
-                    toTv.setText(to);
-                    ccTv.setText(cc);
-
-                    TextFieldTextWatcher ccWatcher = new TextFieldTextWatcher(getContext(),ccTv,i,0);
-                    ccTv.addTextChangedListener(ccWatcher);
-
-                    final int selectIndex = i;
-                    contactBtn.setOnClickListener(new OnClickListener() {
-						@Override
-						public void onClick(View v) {
-
-							mSelectContactPosition = selectIndex;
-							Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
-							startActivityForResult(intent, People_Pick_Code);
-
-						}
-					});
-
-					listview.addView(commu_header);
-
-
-					long list_count = groupobj.getInt("count");
-					for (int j = 0; j < list_count; j++)
-					{
-						ConstraintLayout msgitem = (ConstraintLayout) inflater
-								.inflate(R.layout.commu_item_msg, null);
-
-						JSONObject msgObj = groupobj.getJSONObject("item" + j);
-
-						String sender = msgObj.optString("Sender");
-
-						String msg = msgObj.optString("msg");
-						String time = msgObj.optString("mst_time");
-						final String email_url = msgObj.optString("email_url");
-
-						TextView senderTv = msgitem.findViewById(R.id.comm_sender_tv);
-						TextView msgTv = msgitem.findViewById(R.id.comm_msg_tv);
-						TextView timeTv = msgitem.findViewById(R.id.comm_time_tv);
-						Button sendBtn = msgitem.findViewById(R.id.comm_send_msg_btn);
-
-						senderTv.setText(sender);
-//						msgTv.setText(msg);
-						msgTv.setText(Html.fromHtml(msg));
-						timeTv.setText(time);
-						sendBtn.setOnClickListener(new OnClickListener() {
-                            @Override
-                            public void onClick(View v) {
-
-
-								Uri content_url = Uri.parse(email_url);
-
-                            	Intent intent = new Intent(Intent.ACTION_VIEW,content_url);
-
-//								Intent intent = new Intent();
-//								intent.setAction("android.intent.action.VIEW");
-//								intent.setData(content_url);
-
-								startActivity(intent);
-                            }
-                        });
-
-						if (email_url == null || email_url.length() == 0) {
-							sendBtn.setVisibility(View.INVISIBLE);
-						}
-
-						listview.addView(msgitem);
-					}
-
-
-					//添加 消息输入和发送
-					ConstraintLayout commu_footer = (ConstraintLayout) inflater
-							.inflate(R.layout.commu_item_footer, null);
-
-					EditText editTv = commu_footer.findViewById(R.id.comm_edit_tv);
-					Button sendEmailBtn = commu_footer.findViewById(R.id.comm_send_email_btn);
-
-                    TextFieldTextWatcher editWatcher = new TextFieldTextWatcher(getContext(),editTv,i,1);
-                    editTv.addTextChangedListener(editWatcher);
-
-					String edit_content = groupobj.optString("edit_content");
-
-					editTv.setText(edit_content);
-
-					final int groupIndex = i;
-                    sendEmailBtn.setOnClickListener(new OnClickListener() {
-						@Override
-						public void onClick(View v) {
-
-							JSONObject commGroup = getGroup(groupIndex);
-							final String cc = commGroup.optString("cc");
-							final String content = commGroup.optString("edit_content");
-
-							if (content == null || content.length() == 0) {
-
-								new AlertDialog.Builder(mContext)
-										.setTitle("Warning")
-										.setMessage("The communication message that will be sent is blank")
-										.setPositiveButton("Ok",null)
-										.show();
-
-								return;
-							}
-
-							if (cc != null && cc.length() > 0) {
-
-								// 校验邮箱地址
-								String[] ccArr = cc.split(";");
-								for (int k = 0; k < ccArr.length; k++) {
-									String ccStr = ccArr[k];
-									if (ccStr.length() > 0) {
-										boolean isEmail = validateEmail(ccStr);
-										if (!isEmail) {
-
-											new AlertDialog.Builder(mContext)
-													.setTitle("Warning")
-													.setMessage("The communication cc is not right")
-													.setPositiveButton("Ok",null)
-													.show();
-
-											return;
-										}
-									}
-								}
-
-							}
-
-							// send
-							final ProgressDialog pd = new ProgressDialog(mContext);
-							pd.setTitle(null);
-							pd.setMessage("send email");
-							pd.setCancelable(false);
-							pd.show();
-
-							final String serialNo = commGroup.optString("serial_no");
-
-							new Thread(new Runnable() {
-								@Override
-								public void run() {
-
-									final JSONObject response = Network.sendEmail(content,cc,serialNo);
-
-									getActivity().runOnUiThread(new Runnable() {
-										@Override
-										public void run() {
-											pd.dismiss();
-
-											boolean showAlert = false;
-											String msg = null;
-											if (response != null) {
-												int result = response.optInt("result",Network.RESULT_FALSE);
-												if (result != Network.RESULT_TRUE) {
-													showAlert = true;
-													msg = response.optString("err_msg");
-												}
-
-
-											} else {
-												showAlert = true;
-											}
-
-											if (msg == null) {
-												msg = "Sorry,something wrong";
-											}
-
-											if (showAlert) {
-												new AlertDialog.Builder(mContext)
-														.setTitle(null)
-														.setMessage(msg)
-														.setPositiveButton("Ok",null)
-														.show();
-											}
-										}
-									});
-
-
-
-								}
-							}).start();
-
-						}
-					});
-
-					listview.addView(commu_footer);
-
-					listview.forceLayout();
-				}
-				// String value = obj.getString(key);
-				// JSONArray array = obj.getJSONArray(key);
-				// for(int i=0;i<array.length();i++){
-				// JSONObject jsonobject = array.getJSONObject(i);
-				// jsonobject.put("name", key);
-				// jsonobject.put("exp", key+"="+jsonobject.getString("value"));
-				// newArray.put(jsonobject);
-
-			}
-			// Iterator it = jsonObj.keys();
-			// while (it.hasNext())
-			// {
-			//
-			// }
-		}
-		catch (JSONException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	private JSONObject getGroup(int group) {
-		if (mContent != null) {
-			JSONObject groupobj = mContent.optJSONObject("group" + group);
-			return groupobj;
-		}
-		return null;
-	}
-
-	private boolean validateEmail(String email) {
-
-		String emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
-
-		return Pattern.matches(emailRegex,email);
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-		View view = ll_root.findViewById(control.get(v.getId()));
-		ImageView expand_iv = v.findViewById(R.id.group_expand_indicator);
-		if (view.getVisibility() == View.VISIBLE) {
-			expand_iv.setImageResource(R.drawable.ic_expand_less);
-			view.setVisibility(View.GONE);
-		}
-		else {
-			expand_iv.setImageResource(R.drawable.ic_expand_more);
-			view.setVisibility(View.VISIBLE);
-		}
-
-	}
-
-	@Override
-	public void onDestroy()
-	{
-		if (m_task != null)
-			m_task.cancel(true);
-		super.onDestroy();
-	}
-
-	@Override
-	public void onActivityResult(int requestCode, int resultCode, Intent data)
-	{
-//		((NewDetailActivity) getActivity()).showlogin = false;
-		super.onActivityResult(requestCode, resultCode, data);
-
-		if (requestCode == People_Pick_Code && data != null) {
-			Uri contactData = data.getData();
-			if (contactData == null) {
-				return;
-			}
-			Cursor c = mContext.getContentResolver().query(contactData, null, null, null, null);
-
-
-			if (c.moveToFirst()) {
-				String contactId = c.getString(c.getColumnIndex(ContactsContract.Contacts._ID));
-
-				Cursor cursor = mContext.getContentResolver().query(
-						ContactsContract.CommonDataKinds.Email.CONTENT_URI,
-						new String[]{ContactsContract.CommonDataKinds.Email.DATA, ContactsContract.CommonDataKinds.Email.TYPE}, ContactsContract.Data.CONTACT_ID + "='" + contactId + "'", null, null);
-
-				while(cursor.moveToNext()) {
-					String email = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
-					String emailType = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE));
-
-					email = email.replace("\r\n",";");
-					email = email.replace("\r",";");
-					email = email.replace("\n",";");
-
-					String[] emailArr = email.split(";");
-					for (int i = 0; i < emailArr.length; i++) {
-						email = emailArr[i];
-						if (email.length() > 0) {
-							if (emailType != null && Integer.valueOf(emailType) == ContactsContract.CommonDataKinds.Email.TYPE_WORK) {
-								appendContactEmail(email,mSelectContactPosition);
-								return;
-							}
-						}
-					}
-
-
-				}
-
-			}
-
-			mSelectContactPosition = -1;
-		}
-
-	}
-
-	@Override
-	public void onDetach()
-	{
-		if (m_task != null)
-			m_task.cancel(false);
-		super.onDetach();
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int	errorcode;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-
-
-			String jstr = Network.get_detail(getArguments());
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			// mdataFragment.put_result(jstr);
-			fragment_content = jstr;
-			NewDetailActivity activity = (NewDetailActivity) getActivity();
-			activity.save_content(getArguments().getString("action_type"), jstr);
-
-			errorcode = Network.RESULT_TRUE;
-
-			return true;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-			Log.i("onPostExecute", "entry");
-			m_task = null;
-			showProgress(false);
-
-//			if (ApexTrackingApplication.get_authorization() == false)
-//			{
-//				if(((DetailActivity) getActivity()).showlogin == true)
-//					return;
-//				((DetailActivity) getActivity()).showlogin = true;
-//				LinearLayout ll = (LinearLayout) ll_root
-//						.findViewById(R.id.ll_refresh);
-//				ll.setVisibility(View.VISIBLE);
-//				Toast toast = Toast.makeText(
-//						ApexTrackingApplication.get_instance(),
-//						getText(R.string.msg_net_passwordchangedremote) , Toast.LENGTH_LONG);
-//				toast.setGravity(Gravity.CENTER, 0, 0);
-//				toast.show();
-//				Intent i = new Intent();
-//				i.setClass(getActivity(), ApexActivity.class);
-//				startActivityForResult(i, REQUEST_LOGINACTIVITY);
-//				return;
-//			}
-			
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror) + ":"
-									+ errorcode, Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-				LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
-						.get_instance().getSystemService(
-								Context.LAYOUT_INFLATER_SERVICE);
-
-				init(fragment_content, inflater/*
-												 * getActivity().
-												 * getLayoutInflater()
-												 */);
-			}
-			else
-			{
-				LinearLayout ll = (LinearLayout) ll_root
-						.findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.VISIBLE);
-			}
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			showProgress(false);
-		}
-	}
-    private void showQuickLook(final String url) {
-
-        showProgressDialog("Please wait","Downloading...");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getExternalCacheDir().getAbsolutePath();//ApexTrackingApplication.getInstance().getDocumentDir();
-
-                final Bundle param = new Bundle();
-                // 下载文件
-                final File downloadFile = Network.downloadFile(param,url,cacheDir);
-
-                getActivity().runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        progressDialog.dismiss();
-                        if (downloadFile != null && downloadFile.exists()) {
-                            String email = null,email_subject = null,email_content = null;
-                            //此处需要新增保存文档的本地表
-
-
-                            try {
-                                email = mContent.getString("email");
-                                email_subject = mContent.getString("email_subject");
-                                email_content = mContent.getString("email_content");
-
-                            } catch (JSONException e) {
-                                e.printStackTrace();
-                            }
-
-//                            email=param.getString("email");
-//                            email_subject=param.getString("email_subject");
-//                            email_content=param.getString("email_content");
-
-                            previewPDF(downloadFile.getAbsolutePath(),email,email_subject,email_content);
-                        } else {
-                            showAlert("Sorry,there is a wrong.");
-                        }
-                    }
-                });
-
-            }
-        }).start();
-
-
-    }
-
-	// public class DataFragment extends Fragment {
-	//
-	// String result = null;
-	//
-	// @Override
-	// public void onCreate(Bundle savedInstanceState) {
-	// setRetainInstance(true);
-	// super.onCreate(savedInstanceState);
-	// }
-	//
-	// public String get_result() {
-	// return result;
-	//
-	// }
-	//
-	// public void put_result(String s) {
-	// result = s;
-	// }
-	//
-	// }
-    public void showAlert(String msg) {
-        if (msg == null || msg.isEmpty()) {
-            return;
-        }
-
-        new android.support.v7.app.AlertDialog.Builder(mContext)
-                .setMessage(msg)
-                .show();
-    }
-
-
-
-    protected void previewPDF(String file,String email,String subject,String content) {
-        Intent myIntent = new Intent();
-        myIntent = new Intent(getActivity(), PDFPreviewActivity.class);
-
-        myIntent.putExtra("file",file);
-        myIntent.putExtra("iscache",true);
-
-        try {
-            JSONObject json = new JSONObject();
-//            email = "66666@qq.com";
-//            subject = "test subject";
-//            content = "test body";
-            if (email != null) {
-                json.put("email",email);
-            }
-            if (subject != null) {
-                json.put("subject",subject);
-            }
-            if (content != null) {
-                json.put("content",content);
-            }
-            myIntent.putExtra("email",json.toString());
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-
-        startActivity(myIntent);
-    }
-
-
-    public void download(String url) {
-
-
-
-
-		final String download_url = url;
-
-		showQuickLook(url);
-		if(true)
-		    return;
-
-		showProgressDialog("Please wait","Downloading...");
-		new Thread(new Runnable() {
-			@Override
-			public void run() {
-
-//									String cacheDir = ApexTrackingApplication.getInstance().getDocumentDir();
-				// 下载文件
-				final File downloadFile = Network.downloadFile(null,download_url,null);
-
-				getActivity().runOnUiThread(new Runnable() {
-					@Override
-					public void run() {
-						progressDialog.dismiss();
-						RAUtil.openFile(getActivity(),downloadFile);
-					}
-				});
-
-			}
-		}).start();
-	}
-
-	public class MyWebViewClient extends WebViewClient
-	{
-		// 如果页面中链接,如果希望点击链接继续在当前browser中响应,
-		// 而不是新开Android的系统browser中响应该链接,必须覆盖 webview的WebViewClient对象。
-		public boolean shouldOverviewUrlLoading(WebView view, String url)
-		{
-			Log.d("Web Client", "shouldOverviewUrlLoading: " + url);
-			// L.i("shouldOverviewUrlLoading");
-			view.loadUrl(url);
-			return true;
-		}
-
-		@Override
-		public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
-			Log.d("Web Client", "shouldOverrideUrlLoading: " + request);
-			return super.shouldOverrideUrlLoading(view, request);
-		}
-
-		public void onPageStarted(WebView view, String url, Bitmap favicon)
-		{
-			// L.i("onPageStarted");
-			// showProgress();
-			Log.d("Web Client", "onPageStarted: ");
-		}
-
-		public void onPageFinished(WebView view, String url)
-		{
-			// L.i("onPageFinished");
-			// closeProgress();
-			Log.d("Web Client", "onPageFinished: ");
-		}
-
-		public void onReceivedError(WebView view, int errorCode,
-				String description, String failingUrl)
-		{
-			// L.i("onReceivedError");
-			// closeProgress();
-			Log.d("Web Client", "onReceivedError: ");
-		}
-
-
-
-		@Override
-		public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
-
-			Log.d("Web Client", "shouldInterceptRequest: " + url);
-			if (url.startsWith("http") && url.contains("action_type=download_doc")) {
-				download(url);
-
-				String content = contentOfWebView(view);
-				WebResourceResponse response = new WebResourceResponse("text/html",
-						"utf-8",
-						new ByteArrayInputStream(content.getBytes()));
-				return response;
-
-			} else {
-				return super.shouldInterceptRequest(view,url);
-			}
-		}
-
-		String contentOfWebView(WebView webView) {
-
-			int i = (int)webView.getTag();
-			try {
-
-				JSONObject groupobj = mContent.getJSONObject("group" + i);
-				String content = groupobj.getString("content");
-				return content;
-			} catch (JSONException e) {
-				e.printStackTrace();
-			}
-
-			return null;
-		}
-
-//		@Override
-//		public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
-//			Log.d("Web Client", "shouldInterceptRequest: " + request);
-//
-//			if (request.getUrl().toString().contains("action_type=download_doc")) {
-//				return null;
-//			} else {
-//				return super.shouldInterceptRequest(view,request);
-//			}
-//
-//
-//		}
-	}
-
-	private void appendContactEmail(String email,int group) {
-
-		try {
-
-			String groupKey = "group" + group;
-
-			JSONObject groupObj = mContent.getJSONObject(groupKey);
-			String groupType = groupObj.getString("_type");
-
-			if (groupType.equals("communication")) {
-
-				String oldCC = groupObj.optString("cc");
-				if (oldCC == null || oldCC.length() == 0) {
-					oldCC = email + ";";
-				} else {
-					if (oldCC.substring(oldCC.length() - 1).equals(";")) {
-						oldCC = oldCC + email + ";";
-					} else {
-						oldCC = oldCC + ";" + email + ";";
-					}
-				}
-
-				commContentChange(oldCC,group,0);
-
-				EditText ccTv = ll_root.findViewWithTag("group_" + group + "_cc");
-				if (ccTv != null) {
-					ccTv.setText(oldCC);
-					ccTv.requestFocus();
-					ccTv.setSelection(oldCC.length());
-				}
-			}
-
-		} catch (JSONException e) {
-			e.printStackTrace();
-		}
-
-	}
-
-	private void commContentChange(String content,int group,int child) {
-
-        try {
-
-            String groupKey = "group" + group;
-
-            JSONObject groupObj = mContent.getJSONObject(groupKey);
-            String groupType = groupObj.getString("_type");
-
-            if (groupType.equals("communication")) {
-
-                if (child == 0) {
-                    groupObj.put("cc",content);
-                } else if (child == 1) {
-                    groupObj.put("edit_content",content);
-                }
-                mContent.put(groupKey,groupObj);
-
-            }
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-
-    public class TextFieldTextWatcher implements TextWatcher {
-
-        Context mCtx;
-        int group;
-        int child;
-        EditText textView;
-
-        public TextFieldTextWatcher(Context ctx,EditText textView,int group,int child) {
-            this.mCtx = ctx;
-            this.textView = textView;
-            this.group = group;
-            this.child = child;
-
-        }
-
-        String origin_text;
-        String string;
-        int start_position;
-        int change_length; // 修改原文长度
-        int new_string_length;
-
-
-        /**
-         * s        改变前的内容
-         * start    增加内容前光标位置,删除内容后光标位置 (起始位置)
-         * count    选中s中的内容长度(发生改变的原内容长度),未选中为0
-         * after    新添加的内容长度,删除为0
-         * */
-        @Override
-        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-//            Log.d("TextChange", "before Text Changed: " + s + " Start: " + start + " Count: " + count + " After: " + after);
-
-            origin_text = s.toString();
-            start_position = start;
-            change_length = count;
-            new_string_length = after;
-        }
-
-        /**
-         * s        改变后的内容
-         * start    增加内容前光标位置,删除内容后光标位置 (起始位置)
-         * before   选中s中的内容长度(发生改变的原内容长度),未选中为0
-         * count    增加内容长度,删除内容为0
-         * */
-        @Override
-        public void onTextChanged(CharSequence s, int start, int before, int count) {
-//            Log.d("TextChange", "on Text Changed: " + s + " Start: " + start + " Before: " + before + " Count: " + count);
-        }
-
-        @Override
-        public void afterTextChanged(Editable s) {
-
-            commContentChange(s.toString(),group,child);
-
-        }
-    }
-
-}

+ 0 - 25
Apex Mobile/app/src/main/java/com/usai/apex/DocumentsActivity.java

@@ -1,25 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-
-public class DocumentsActivity extends FragmentActivity
-{
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_inner_tools);
-
-		// Fragment f = new ToolsFragment();
-		if (savedInstanceState == null)
-		{
-			getSupportFragmentManager().beginTransaction()
-					.add(R.id.container, new DocumentsFragment()).commit();
-		}
-
-
-	}
-
-}

+ 0 - 86
Apex Mobile/app/src/main/java/com/usai/apex/DocumentsFragment.java

@@ -1,86 +0,0 @@
-package com.usai.apex;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.util.Log;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
-
-public class DocumentsFragment extends ListFragment
-{
-	
-
-	// @Override
-	// public View onCreateView(LayoutInflater inflater, ViewGroup container,
-	// Bundle savedInstanceState)
-	// {
-	// View view = inflater.inflate(R.layout.fragment_tools, null);
-	// // Button btn = (Button) view.findViewById(R.id.btn_cancel);
-	// // btn.setOnClickListener(this);
-	// return view;
-	// // return super.onCreateView(inflater, container, savedInstanceState);
-	// }
-	private List<Map<String, Object>> getData()
-	{
-		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-
-		Map<String, Object> map = new HashMap<String, Object>();
-		map.put("title", "Search document online");
-		map.put("img", R.drawable.rect_search_documents);
-		list.add(map);
-
-		map = new HashMap<String, Object>();
-		map.put("title", "View downloaded document");
-		map.put("img", R.drawable.rect_view_download_documents);
-		list.add(map);
-
-	
-		
-		return list;
-	}
-
-	@Override
-	public void onActivityCreated(Bundle savedInstanceState)
-	{
-		super.onActivityCreated(savedInstanceState);
-		SimpleAdapter adapter = new SimpleAdapter(this.getActivity(),
-				getData(), R.layout.fragment_tools, new String[] { "title",
-						"img" }, new int[] { R.id.tv_toolname, R.id.iv_thumb});
-		setListAdapter(adapter);
-		this.getListView().setBackgroundColor(Color.WHITE);
-	}
-
-	@Override
-	public void onListItemClick(ListView l, View v, int position, long id)
-	{
-		Log.d("FragmentList", "Item clicked: " + id);
-		
-		String title = (String) getData().get(position).get("title");
-		Intent intent = new Intent();
-		if(title.equals("Search document online"))
-		{
-			intent.setClass(getActivity(), SearchListActivity.class);
-	
-			intent.putExtra("function_name", "Download Document");
-			intent.putExtra("title", "Document Search");
-
-		}
-		else if(title.equals("View downloaded document"))
-		{
-			intent.setClass(getActivity(), LocalDocumentActivity.class);
-//			intent.putExtra("module_name", "Announcements");
-		}
-
-		
-		startActivity(intent);
-
-	}
-}

+ 0 - 282
Apex Mobile/app/src/main/java/com/usai/apex/DragListView.java

@@ -1,282 +0,0 @@
-package com.usai.apex;
-
-import com.usai.apex.CustomizeFieldsActivity.DragListAdapter;
-import com.usai.apex.CustomizeFieldsActivity.fieldedit;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.PixelFormat;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.AdapterView;
-import android.widget.ImageView;
-import android.widget.ListView;
-
-public class DragListView extends ListView
-{
-
-	private ImageView dragImageView;// ����ק�����ʵ����һ��ImageView
-	private int dragSrcPosition;// ��ָ�϶���ԭʼ���б��е�λ��
-	private int dragPosition;// ��ָ�϶���ʱ�򣬵�ǰ�϶������б��е�λ��
-
-	private int dragPoint;// �ڵ�ǰ������е�λ��
-	private int dragOffset;// ��ǰ��ͼ����Ļ�ľ���(����ֻʹ����y������)
-
-	private WindowManager windowManager;// windows���ڿ�����
-	private WindowManager.LayoutParams windowParams;// ���ڿ�����ק�����ʾ�IJ���
-
-	private int scaledTouchSlop;// �жϻ�����һ������
-	private int upScrollBounce;// �϶���ʱ�򣬿�ʼ���Ϲ����ı߽�
-	private int downScrollBounce;// �϶���ʱ�򣬿�ʼ���¹����ı߽�
-
-	public DragListView(Context context, AttributeSet attrs)
-	{
-		super(context, attrs);
-		scaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
-
-		this.setOnItemClickListener(mItemClickListenter);
-	}
-
-	private int lastClickId = -1;
-	private long lastClickTime;
-	private OnItemClickListener mItemClickListenter = new OnItemClickListener()
-	{
-		public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
-		{
-			DragListAdapter adapter = (DragListAdapter) ((ListView) parent)
-					.getAdapter();
-
-			if (adapter.isEnabled(pos) == false)// return if item is a group key
-				return;
-			fieldedit dclickitem = (fieldedit) ((ListView) parent).getAdapter()
-					.getItem(pos);
-
-			// �����˫��,1�����������ж�Ϊ˫��
-			if (dclickitem._id == lastClickId
-					&& (Math.abs(lastClickTime - System.currentTimeMillis()) < 1000))
-			{
-				lastClickId = -1;
-				lastClickTime = 0;
-				if (pos < adapter.switchpos())
-				{
-					adapter.remove(dclickitem);
-					adapter.insert(dclickitem, adapter.getCount());
-				}
-				else
-				{
-					adapter.remove(dclickitem);
-					adapter.insert(dclickitem, 1);
-
-				}
-				// Intent intent = new Intent();
-				// intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
-				// intent.putExtra("matchId", mv.getId());
-				// intent.putExtra("matchKey", mv.getMatchKey());
-				// intent.setClass(SenseSoccerScoreActivity.this,
-				// MatchEventActivity.class);
-				// startActivity(intent);
-			}
-			else
-			{
-				lastClickId = dclickitem._id;
-				lastClickTime = System.currentTimeMillis();
-			}
-		}
-	};
-
-	// ����touch�¼�����ʵ���Ǽ�һ�����
-	@Override
-	public boolean onInterceptTouchEvent(MotionEvent ev)
-	{
-		if (ev.getAction() == MotionEvent.ACTION_DOWN)
-		{
-			int x = (int) ev.getX();
-			int y = (int) ev.getY();
-
-			dragSrcPosition = dragPosition = pointToPosition(x, y);
-			if (dragPosition == AdapterView.INVALID_POSITION)
-			{
-				return super.onInterceptTouchEvent(ev);
-			}
-
-			ViewGroup itemView = (ViewGroup) getChildAt(dragPosition
-					- getFirstVisiblePosition());
-			dragPoint = y - itemView.getTop();
-			dragOffset = (int) (ev.getRawY() - y);
-
-			View dragger = itemView.findViewById(R.id.drag_list_item_image);
-			if (dragger != null && x > dragger.getLeft() - 20)
-			{
-				//
-				upScrollBounce = Math.min(y - scaledTouchSlop, getHeight() / 3);
-				downScrollBounce = Math.max(y + scaledTouchSlop,
-						getHeight() * 2 / 3);
-
-				itemView.setDrawingCacheEnabled(true);
-				Bitmap bm = Bitmap.createBitmap(itemView.getDrawingCache());
-				startDrag(bm, y);
-			}
-			return false;
-		}
-		return super.onInterceptTouchEvent(ev);
-	}
-
-	/**
-	 * �����¼�
-	 */
-	@Override
-	public boolean onTouchEvent(MotionEvent ev)
-	{
-		if (dragImageView != null && dragPosition != INVALID_POSITION)
-		{
-			int action = ev.getAction();
-			switch (action)
-			{
-			case MotionEvent.ACTION_UP:
-				int upY = (int) ev.getY();
-				stopDrag();
-				onDrop(upY);
-				break;
-			case MotionEvent.ACTION_MOVE:
-				int moveY = (int) ev.getY();
-				onDrag(moveY);
-				break;
-			default:
-				break;
-			}
-			return true;
-		}
-		// Ҳ������ѡ�е�Ч��
-		return super.onTouchEvent(ev);
-	}
-
-	/**
-	 * ׼���϶�����ʼ���϶����ͼ��
-	 * 
-	 * @param bm
-	 * @param y
-	 */
-	public void startDrag(Bitmap bm, int y)
-	{
-		stopDrag();
-
-		windowParams = new WindowManager.LayoutParams();
-		windowParams.gravity = Gravity.TOP;
-		windowParams.x = 0;
-		windowParams.y = y - dragPoint + dragOffset;
-		windowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
-		windowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
-		windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
-				| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
-				| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
-				| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
-		windowParams.format = PixelFormat.TRANSLUCENT;
-		windowParams.windowAnimations = 0;
-
-		ImageView imageView = new ImageView(getContext());
-		imageView.setImageBitmap(bm);
-		windowManager = (WindowManager) getContext().getSystemService("window");
-		windowManager.addView(imageView, windowParams);
-		dragImageView = imageView;
-	}
-
-	/**
-	 * ֹͣ�϶���ȥ���϶����ͷ��
-	 */
-	public void stopDrag()
-	{
-		if (dragImageView != null)
-		{
-			windowManager.removeView(dragImageView);
-			dragImageView = null;
-		}
-	}
-
-	/**
-	 * �϶�ִ�У���Move������ִ��
-	 * 
-	 * @param y
-	 */
-	public void onDrag(int y)
-	{
-		if (dragImageView != null)
-		{
-			windowParams.alpha = 0.8f;
-			windowParams.y = y - dragPoint + dragOffset;
-			windowManager.updateViewLayout(dragImageView, windowParams);
-		}
-		// Ϊ�˱��⻬�����ָ��ߵ�ʱ�򣬷���-1������
-		int tempPosition = pointToPosition(0, y);
-		if (tempPosition != INVALID_POSITION)
-		{
-			dragPosition = tempPosition;
-		}
-
-		// ����
-		int scrollHeight = 0;
-		if (y < upScrollBounce)
-		{
-			scrollHeight = 8;// �������Ϲ���8�����أ����������Ϲ����Ļ�
-		}
-		else
-			if (y > downScrollBounce)
-			{
-				scrollHeight = -8;// �������¹���8�����أ������������Ϲ����Ļ�
-			}
-
-		if (scrollHeight != 0)
-		{
-			// ����������setSelectionFromTop()
-			setSelectionFromTop(dragPosition,
-					getChildAt(dragPosition - getFirstVisiblePosition())
-							.getTop() + scrollHeight);
-		}
-	}
-
-	/**
-	 * �϶����µ�ʱ��
-	 * 
-	 * @param y
-	 */
-	public void onDrop(int y)
-	{
-
-		// Ϊ�˱��⻬�����ָ��ߵ�ʱ�򣬷���-1������
-		int tempPosition = pointToPosition(0, y);
-		if (tempPosition != INVALID_POSITION)
-		{
-			dragPosition = tempPosition;
-		}
-
-		// �����߽紦��
-		if (y < getChildAt(1).getTop())
-		{
-			// �����ϱ߽�
-			dragPosition = 1;
-		}
-		else
-			if (y > getChildAt(getChildCount() - 1).getBottom())
-			{
-				// �����±߽�
-				dragPosition = getAdapter().getCount() - 1;
-			}
-
-		// ��ݽ���
-		if (dragPosition > 0 && dragPosition < getAdapter().getCount())
-		{
-			/* @SuppressWarnings("unchecked") */
-			DragListAdapter adapter = (DragListAdapter) getAdapter();
-			fieldedit dragItem = adapter.getItem(dragSrcPosition);
-			adapter.remove(dragItem);
-			adapter.insert(dragItem, dragPosition);
-			// Toast.makeText(getContext(), adapter.getList().toString(),
-			// Toast.LENGTH_SHORT).show();
-		}
-
-	}
-}

+ 0 - 411
Apex Mobile/app/src/main/java/com/usai/apex/FunctionSelectActivity.java

@@ -1,411 +0,0 @@
-package com.usai.apex;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.NotificationManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.RadioGroup;
-import android.widget.RadioGroup.OnCheckedChangeListener;
-import android.widget.TextView;
-
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.util.dbUtil;
-
-public class FunctionSelectActivity extends FragmentActivity implements
-		OnClickListener, OnCheckedChangeListener
-{
-
-	static final int PASSWORD_CHANGED = 1;
-	private static final int	REQUEST_LOGINACTIVITY			= 1;
-	private static final int	REQUEST_CHANGEPASSWORD_ACTIVITY	= 2;
-	private static final int	REQUEST_TOOLS_ACTIVITY			= 3;
-	ArrayAdapter<String>		adapter							= null;
-	
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case R.id.action_settings:
-				intent.setClass(this, SettingsActivity.class);
-				// intent.putExtra("user", user);
-				// 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);
-	}
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.function_select, menu);
-		return true;
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		// user = ApexTrackingApplication.get_user();
-		// password= getIntent().getStringExtra("password");
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.new_function_select);
-
-		ActionBar bar = getActionBar();
-		bar.setTitle("");
-		//
-		TextView tv_booking = (TextView) findViewById(R.id.tv_booking);
-		tv_booking.setOnClickListener(this);
-		TextView tv_info = (TextView) findViewById(R.id.tv_info);
-		tv_info.setOnClickListener(this);
-		TextView tv_detail = (TextView) findViewById(R.id.tv_detail);
-		tv_detail.setOnClickListener(this);
-		// TextView tv_cargo = (TextView)findViewById(R.id.tv_cargo);
-		// tv_cargo.setOnClickListener(this);
-		TextView tv_doc = (TextView) findViewById(R.id.tv_doc);
-		tv_doc.setOnClickListener(this);
-		TextView tv_message = (TextView) findViewById(R.id.tv_message);
-		tv_message.setOnClickListener(this);
-		TextView tv_exit = (TextView) findViewById(R.id.tv_exit);
-		tv_exit.setOnClickListener(this);
-		TextView tv_loc = (TextView) findViewById(R.id.tv_location);
-		tv_loc.setOnClickListener(this);
-		TextView tv_tools = (TextView) findViewById(R.id.tv_tools);
-		tv_tools.setOnClickListener(this);
-		Button btn_search = (Button) findViewById(R.id.btn_search);
-		btn_search.setOnClickListener(this);
-		Button btn_clear = (Button) findViewById(R.id.btn_clear);
-		btn_clear.setOnClickListener(this);
-		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-		rg.setOnCheckedChangeListener(this);
-		// AutoCompleteTextView et = (AutoCompleteTextView)
-		// findViewById(R.id.atv_criterion);
-		// if (rg.getCheckedRadioButtonId() == R.id.radio0)
-		// adapter = new ArrayAdapter<String>(this,
-		// android.R.layout.simple_dropdown_item_1line,
-		// dbUtil.get_searchhistory("h_bol"));
-		// else
-		// adapter = new ArrayAdapter<String>(this,
-		// android.R.layout.simple_dropdown_item_1line,
-		// dbUtil.get_searchhistory("ctnr"));
-		// et.setAdapter(adapter);
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		boolean autologin = pref.getBoolean("autologin", false);
-
-		if (!autologin)
-		{
-			Intent i = new Intent();
-			i.setClass(this, ApexActivity.class);
-			startActivityForResult(i, REQUEST_LOGINACTIVITY);
-		}
-
-	}
-
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data)
-	{
-		switch (requestCode)
-		{
-			case REQUEST_LOGINACTIVITY:
-				if (resultCode == Activity.RESULT_CANCELED)
-					finish();
-				break;
-			case REQUEST_TOOLS_ACTIVITY:
-				if (resultCode == PASSWORD_CHANGED)
-				{
-					String UNIQUE_STRING = "com.usai.apex.push.cancel";
-					Intent intent = new Intent(UNIQUE_STRING);
-					sendBroadcast(intent);
-					Intent i = new Intent();
-					i.setClass(this, ApexActivity.class);
-					startActivityForResult(i, REQUEST_LOGINACTIVITY);
-				}
-				break;
-			default:
-				break;
-		}
-
-		super.onActivityResult(requestCode, resultCode, data);
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		// dbUtil.CloseDB(m_db);
-		super.onDestroy();
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-		String TAG = "onClick@FunctionSelectActivity";
-		Log.d(TAG, "ID=" + v.getId());
-		switch (v.getId())
-		{
-			case R.id.btn_clear:
-			{
-
-				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-				et.setText("");
-				break;
-
-			}
-			case R.id.btn_search:
-			{
-
-				AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-				// et.clearFocus();
-
-				InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
-						.getSystemService(Context.INPUT_METHOD_SERVICE);
-
-				inputMethodManager.hideSoftInputFromWindow(et.getWindowToken(),
-						0);
-				inputMethodManager.hideStatusIcon(et.getWindowToken());
-				String cargo_criterion = et.getText().toString();
-				// if (TextUtils.isEmpty(cargo_criterion))
-				// {
-				// et.setError(getString(R.string.error_field_required));
-				// et.requestFocus();
-				// }
-				// else
-				// {
-				Intent intent = new Intent();
-				intent.setClass(this, NewDetailActivity.class);
-
-				intent.putExtra("action0", "Tracking");
-				intent.putExtra("function_name", "Cargo Tracking");
-
-				intent.putExtra("cargo_criterion", cargo_criterion);
-				intent.putExtra("actions_count", 1);
-				intent.putExtra("_id", "dumb");
-				String h_field;
-				RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-				if (rg.getCheckedRadioButtonId() == R.id.radio0)
-				{
-					intent.putExtra("criterion_type", 0);
-					h_field = "h_bol";
-				}
-				else
-				{
-					intent.putExtra("criterion_type", 1);
-					h_field = "ctnr";
-				}
-
-				dbUtil.savehistory(h_field, cargo_criterion);
-
-				startActivity(intent);
-
-				break;
-			}
-			case R.id.tv_booking:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// intent.putExtra("user", ApexTrackingApplication.get_user());
-				// intent.putExtra("password", password);
-				intent.putExtra("function_name", "Ocean Booking");
-				intent.putExtra("title", "Booking Search");
-				startActivity(intent);
-				break;
-			}
-			case R.id.tv_info:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// intent.putExtra("user", user);
-				// intent.putExtra("password", password);
-				intent.putExtra("function_name", "Ocean B/L info.");
-				intent.putExtra("title", "B/L info. Search");
-				startActivity(intent);
-				break;
-			}
-			case R.id.tv_detail:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, SearchListActivity.class);
-				// intent.putExtra("user", user);
-				// intent.putExtra("password", password);
-				intent.putExtra("function_name", "Container detail");
-				intent.putExtra("title", "Container Search");
-				startActivity(intent);
-				break;
-			}
-
-			case R.id.tv_doc:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, DocumentsActivity.class);
-				// // intent.putExtra("user", user);
-				// // intent.putExtra("password", password);
-				// intent.putExtra("function_name", "Download Document");
-				// intent.putExtra("title", "Document Search");
-				startActivity(intent);
-				break;
-			}
-			case R.id.tv_message:
-			{
-
-				Intent intent = new Intent();
-				intent.setClass(this, MessageActivity.class);
-				startActivity(intent);
-				//
-				// Intent intent = new Intent();
-				// intent.setClass(this, ChangePasswordActivity.class);
-				// // intent.putExtra("function_name", "Container Detail");
-				// startActivityForResult(intent,
-				// REQUEST_CHANGEPASSWORD_ACTIVITY);
-				break;
-			}
-			case R.id.tv_exit:
-			{
-				String UNIQUE_STRING = "com.usai.apex.push.cancel";
-				Intent intent = new Intent(UNIQUE_STRING);
-				// intent.putExtra("key1", "value1");
-				// intent.putExtra("key2", "value2");
-				sendBroadcast(intent);
-
-				// ApexTrackingApplication.cancelalarm();
-				// ApexTrackingApplication.put_password("");
-				// ApexTrackingApplication.put_sessionid("");
-				// ApexTrackingApplication.put_user("");
-
-				Intent i = new Intent();
-				i.setClass(this, ApexActivity.class);
-				startActivityForResult(i, 1);
-
-				// finish();
-				// System.exit(0);
-				break;
-			}
-			case R.id.tv_tools:
-			{
-				Intent intent = new Intent();
-				intent.setClass(this, InnerToolsActivity.class);
-				intent.putExtra("launcher", "inner");
-				startActivityForResult(intent,REQUEST_TOOLS_ACTIVITY);
-				break;
-			}
-			case R.id.tv_location:
-			{
-				Log.d("==============", "start location activity");
-				Intent intent = new Intent();
-				intent.setClass(this, InnerMapActivity.class);
-				// intent.putExtra("user", user);
-				// intent.putExtra("password", password);
-				// intent.putExtra("function_name", "Container Detail");
-				startActivity(intent);
-				break;
-			}
-
-			default:
-				break;
-		}
-		// TODO Auto-generated method stub
-
-	}
-
-	// class HistoryAdapter extends SimpleCursorAdapter{
-	//
-	// public HistoryAdapter(Context context, int layout, Cursor c,
-	// String[] from, int[] to)
-	// {
-	// super(context, layout, c, from, to,FLAG_AUTO_REQUERY);
-	// // TODO Auto-generated constructor stub
-	// }
-	//
-	// }
-
-	@Override
-	protected void onResume()
-	{
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		int count = dbUtil.get_count(db, "push_message", "read = 0 and user = '"+ApexTrackingApplication.get_user()+"'");
-
-		dbUtil.CloseDB(db);
-		NotificationManager nManager = (NotificationManager) this
-				.getSystemService(Context.NOTIFICATION_SERVICE);
-		nManager.cancel(R.layout.activity_apex);
-		ApexTrackingApplication.ncount=1;
-
-		// Intent intent = new Intent();
-		// intent.setClass(ApexTrackingApplication
-		// .get_instance(), FunctionSelectActivity.class);
-		// Intent addShortcut = new Intent(
-		// "com.android.launcher.action.INSTALL_SHORTCUT");
-		// Parcelable icon = Intent.ShortcutIconResource.fromContext(this,
-		// R.drawable.ic_launcher);
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
-		// getString(R.string.app_name));
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
-		// addShortcut.putExtra("duplicate", 0);
-		// addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
-		// Log.e("uuuuuuuuuuuuuuuurrrrrrrrrrrrrriiiiiiiii",
-		// intent.toUri(MODE_WORLD_WRITEABLE));
-		// sendBroadcast(addShortcut);
-		if (count > 0)
-		{
-			TextView tv_message = (TextView) findViewById(R.id.tv_message);
-			tv_message.setCompoundDrawablesWithIntrinsicBounds(0,
-					R.drawable.ic_message_new, 0, 0);
-
-		}
-		else
-		{
-			TextView tv_message = (TextView) findViewById(R.id.tv_message);
-			tv_message.setCompoundDrawablesWithIntrinsicBounds(0,
-					R.drawable.ic_message, 0, 0);
-		}
-
-		RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
-		AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-		if (rg.getCheckedRadioButtonId() == R.id.radio0)
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("h_bol"));
-		else
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("ctnr"));
-		et.setAdapter(adapter);
-		super.onResume();
-	}
-
-	@Override
-	public void onCheckedChanged(RadioGroup group, int checkedId)
-	{
-
-		AutoCompleteTextView et = (AutoCompleteTextView) findViewById(R.id.atv_criterion);
-		if (checkedId == R.id.radio0)
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("h_bol"));
-		else
-			adapter = new ArrayAdapter<String>(this,
-					android.R.layout.simple_dropdown_item_1line,
-					dbUtil.get_searchhistory("ctnr"));
-		et.setAdapter(adapter);
-
-	}
-
-}

+ 0 - 48
Apex Mobile/app/src/main/java/com/usai/apex/HelpActivity.java

@@ -1,48 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-
-public class HelpActivity extends Activity implements OnClickListener
-{
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_help);
-		String caller=getIntent().getStringExtra("caller");
-		ImageView iv= (ImageView) findViewById(R.id.iv_help);
-		iv.setOnClickListener(this);
-		if(caller.equals("fields"))
-			iv.setImageResource(R.drawable.help_fields);
-		else if(caller.equals("search"))
-			iv.setImageResource(R.drawable.help_search);
-		else if(caller.equals("result"))
-			iv.setImageResource(R.drawable.help_result);
-	}
-	
-	
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.help, menu);
-		return true;
-	}
-
-
-
-	@Override
-	public void onClick(View v)
-	{
-		finish();
-		
-	}
-
-}

+ 0 - 312
Apex Mobile/app/src/main/java/com/usai/apex/InnerMapActivity.java

@@ -1,312 +0,0 @@
-package com.usai.apex;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.TextView;
-
-import com.baidu.mapapi.map.SupportMapFragment;
-import com.usai.Contacts.Contact;
-import com.usai.Contacts.ContactsManager;
-
-//import com.baidu.mapapi.MKGeneralListener;
-//import com.baidu.mapapi.map.MKEvent;
-
-public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragment.BaiduMarkerClickListener,ServiceLocationFragment.MarkerClickListener
-{
-//	public static boolean		m_bKeyRight				= true;
-//	BMapManager					mBMapManager			= null;
-
-//    public String strKey = getString(R.string.baidu_key);//"nqBQoSDbxrslhuzW91uViQX7";//release
-	private static final String	LTAG					= "test";
-	SupportMapFragment			map;
-
-	boolean						m_bhasgoogleframework	= true;  
-
-//	static class MyGeneralListener implements MKGeneralListener
-//	{
-//
-//		@Override
-//		public void onGetNetworkState(int iError)
-//		{
-//			if (iError == MKEvent.ERROR_NETWORK_CONNECT)
-//			{
-//				Toast.makeText(
-//						ApexTrackingApplication.get_instance()
-//								.getApplicationContext(),
-//						"????????????????????????", Toast.LENGTH_LONG).show();
-//			}
-//			else if (iError == MKEvent.ERROR_NETWORK_DATA)
-//			{
-//				Toast.makeText(
-//						ApexTrackingApplication.get_instance()
-//								.getApplicationContext(),
-//						"??????????????????????????????", Toast.LENGTH_LONG)
-//						.show();
-//			}
-//			// ...
-//		}
-//
-//		@Override
-//		public void onGetPermissionState(int iError)
-//		{
-//			// ???????????????key???????????????
-//			if (iError != 0)
-//			{
-//				// ??????Key?????????
-//				Toast.makeText(
-//						ApexTrackingApplication.get_instance()
-//								.getApplicationContext(),
-//						"?????? MyApplication.java???????????????????????????Key,??????????????????????????????????????????error: "
-//								+ iError, Toast.LENGTH_LONG).show();
-//				m_bKeyRight = false;
-//			}
-//			else
-//			{
-//				m_bKeyRight = true;
-//				Toast.makeText(
-//						ApexTrackingApplication.get_instance()
-//								.getApplicationContext(), "key????????????",
-//						Toast.LENGTH_LONG).show();
-//			}
-//		}
-//	}
-
-	@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);
-			finish();
-			return true;
-		}
-		return super.onKeyDown(keyCode, event);
-	}
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText("Service Location");
-		setTitle("Service Location");
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-
-	private Context mContext;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		mContext = this;
-		PackageInfo packageInfo;
-		try
-		{
-			packageInfo = this.getPackageManager().getPackageInfo(
-					"com.google.android.gms", 0);
-
-		}
-		catch (NameNotFoundException e)
-		{
-			packageInfo = null;
-			e.printStackTrace();
-		}
-		if (packageInfo == null)
-		{
-			m_bhasgoogleframework = false;
-			System.out.println("没有安装");
-		}
-		else
-		{
-			m_bhasgoogleframework = true;
-			System.out.println("已经安装");
-		}
-		// setUpMapIfNeeded();
-
-//		m_bhasgoogleframework = false;
-
-
-
-
-//		m_bhasgoogleframework= true;
-
-		Fragment slFragment = null;
-		if (m_bhasgoogleframework )
-		{
-			setContentView(R.layout.activity_inner_map);
-			slFragment = new ServiceLocationFragment();
-			((ServiceLocationFragment)slFragment).markerClickListener = this;
-			FragmentTransaction ft = getSupportFragmentManager()
-					.beginTransaction();
-			ft.replace(R.id.inner_map, slFragment);
-			ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-			ft.addToBackStack("Location");
-			ft.commit();
-
-		}
-		else
-		{
-//			if (mBMapManager == null)
-//			{
-//				mBMapManager = new BMapManager(getApplicationContext());
-//				/**
-//				 * ??????BMapManager???????????????????????????BMapManager
-//				 */
-//				mBMapManager.init(strKey, new MyGeneralListener());
-//			}
-			
-//			f.initEngineManager(this);
-			setContentView(R.layout.activity_inner_map);
-//			Log.d(LTAG, "onCreate");
-//			// setContentView(R.layout.activity_main);
-//			map = SupportMapFragment.newInstance();
-			BaiduMapFragment f  = new BaiduMapFragment();
-			FragmentManager manager = getSupportFragmentManager();
-			manager.beginTransaction().add(R.id.inner_map, f, "map_fragment")
-					.commit();
-			f.markerClickListener = this;
-		}
-
-		setCustomActionBar();
-
-//		LocationDetail detail = new LocationDetail("Kerry Freight (USA), Inc","3200 NW 67th Ave. Bldg. 3 Suite 390 Miami, FL 33122 Miami","+(305)12345678","+(305)4567890",null,"mario.alfonso@kerrylogistics.com");
-//		markerClicked(detail);
-	}
-
-	// @Override
-	// public boolean onCreateOptionsMenu(Menu menu)
-	// {
-	// // Inflate the menu; this adds items to the action bar if it is present.
-	// getMenuInflater().inflate(R.menu.inner_map, menu);
-	// return true;
-	// }
-	// private void setUpMapIfNeeded() {
-	// // Do a null check to confirm that we have not already instantiated the
-	// map.
-	// if (mMap == null) {
-	// // Try to obtain the map from the SupportMapFragment.
-	// mMap = ((SupportMapFragment)
-	// getSupportFragmentManager().findFragmentById(R.id.map))
-	// .getMap();
-	// // Check if we were successful in obtaining the map.
-	// if (mMap != null) {
-	// setUpMap();
-	// }
-	// }
-	// }
-
-
-	@Override
-	public void markerClicked(LocationDetail detail) {
-
-		if (detail == null) {
-			return;
-		}
-		String homePage = "http://www.apexshipping.com";
-		Bitmap photo = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
-
-		final Contact contact = new Contact();
-		contact.setName(detail.Name);
-		contact.setAddress(detail.Addr);
-		contact.setNumber(detail.Tel);
-		contact.setFax(detail.Fax);
-		contact.setEmail(detail.Email);
-		contact.setHomePage(homePage);
-		contact.setPhoto(photo);
-
-		final ContactsManager cm = new ContactsManager(this.getContentResolver());
-		if (cm.contactExist(contact.getName())) {
-
-			new AlertDialog.Builder(this)
-					.setTitle("Warning")
-					.setMessage(contact.getName() + " has exist in contacts,do you want to update it?")
-					.setNegativeButton("No", new DialogInterface.OnClickListener() {
-						@Override
-						public void onClick(DialogInterface dialog, int which) {
-							// 添加一条新记录
-							cm.insertContact(contact,mContext);
-//							Contact existContact = cm.searchContact(contact.getName());
-//							String contactId = cm.getContactID(existContact.getName());
-//							Intent editIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://com.android.contacts/contacts/"+contactId));
-//							startActivity(editIntent);
-						}
-					})
-					.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
-						@Override
-						public void onClick(DialogInterface dialog, int which) {
-
-							//Intent.ACTION_INSERT_OR_EDIT
-							//参考 https://blog.csdn.net/mls1454001840/article/details/60764351 之二
-							Contact existContact = cm.searchContact(contact.getName());
-							cm.updateContact(existContact,contact);
-
-							String contactId = cm.getContactID(existContact.getName());
-							Intent editIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://com.android.contacts/contacts/"+contactId));
-							startActivity(editIntent);
-//
-//							// 显示编辑界面
-//							String contactId = cm.getContactID(existContact.getName());
-//							cm.editContact(contactId,mContext);
-
-
-						}
-					})
-					.show();
-		} else {
-			// 自动保存,然后显示编辑
-//			cm.addContact(contact,true);
-//			// 显示编辑界面
-//			String contactId = cm.getContactID(contact.getName());
-//			editContact(contactId);
-
-			// 需要用户手动保存
-			cm.insertContact(contact,mContext);
-		}
-
-	}
-
-
-}

+ 0 - 31
Apex Mobile/app/src/main/java/com/usai/apex/InnerToolsActivity.java

@@ -1,31 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-
-import com.usai.apex.mainframe.ToolsFragment;
-
-public class InnerToolsActivity extends FragmentActivity
-{
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_inner_tools);
-
-		// Fragment f = new ToolsFragment();
-		if (savedInstanceState == null)
-		{
-			ToolsFragment f = new ToolsFragment();
-			Bundle b = new Bundle();
-			b.putBoolean("Login", true);
-			f.setArguments(b);
-			getSupportFragmentManager().beginTransaction()
-					.add(R.id.container, f).commit();
-		}
-
-
-	}
-
-}

+ 0 - 540
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPICell.java

@@ -1,540 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.animation.Animator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.graphics.Color;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.GestureDetector;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageButton;
-import android.widget.ListView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.apex.R;
-import com.usai.apex.mainframe.KPIFragment;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-public class KPICell extends RelativeLayout implements KPIListView.KPIListViewTouchListener,View.OnTouchListener {
-
-    public KPICell(Context context) {
-        super(context);
-//        init();
-    }
-
-    public KPICell(Context context, @Nullable AttributeSet attrs) {
-        super(context, attrs);
-//        init();
-    }
-
-    public KPICell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-//        init();
-    }
-
-
-    private KPICell mCell;
-    private ArrayList<PieChartView.ChartItem> mChartItems;
-    private PieChartView mChartView;
-    private ImageButton mPreBtn,mNextBtn;
-    private TextView mMonthTV,mShipTV,mContainerTV,mTeuTV,mSelectionTV;
-    private KPIListView mItemListView;
-    private ValueAnimator mAnimation;
-
-    public void init() {
-
-        mCell = this;
-
-        mDetector = new GestureDetector(getContext(), new GestureListener());
-        mMonthTV = findViewById(R.id.monthTV);
-        mShipTV = findViewById(R.id.shipmentTV);
-        mContainerTV = findViewById(R.id.containerTV);
-        mTeuTV = findViewById(R.id.teuTV);
-        mSelectionTV = findViewById(R.id.selectionTV);
-
-        mShipTV.setText(null);
-        mContainerTV.setText(null);
-        mTeuTV.setText(null);
-        mSelectionTV.setText(null);
-
-        mItemListView = findViewById(R.id.item_list);
-        mAdapter = new KPIItemAdapter(getContext(),R.layout.kpi_item_cell);
-        mItemListView.setAdapter(mAdapter);
-        mItemListView.setListener(this);
-
-        mChartView = findViewById(R.id.chart_view);
-
-        if (mAnimation == null) {
-            mAnimation = ValueAnimator.ofFloat(0f, 100f);
-
-            mAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
-                @Override
-                public void onAnimationUpdate(ValueAnimator updatedAnimation) {
-                    // You can use the animated value in a property that uses the
-                    // same type as the animation. In this case, you can use the
-                    // float value in the translationX property.
-                    float animatedValue = (float)updatedAnimation.getAnimatedValue();
-
-                    mChartView.progress = animatedValue / 100.0f;
-                    mChartView.postInvalidate();
-                }
-            });
-
-            mAnimation.addListener(new Animator.AnimatorListener() {
-                @Override
-                public void onAnimationStart(Animator animation) {
-
-                }
-
-                @Override
-                public void onAnimationEnd(Animator animation) {
-
-                }
-
-                @Override
-                public void onAnimationCancel(Animator animation) {
-
-                }
-
-                @Override
-                public void onAnimationRepeat(Animator animation) {
-
-                }
-            });
-
-            mAnimation.setDuration(100);
-        }
-
-
-        mChartView.minTitleAngle = 20;
-        mChartView.setPieChartItemClickListener(new PieChartView.PieChartItemClickListener() {
-            @Override
-            public void pieChartItemClicked(PieChartView pieChartView, PieChartView.ChartItem item) {
-
-                if (mListener != null) {
-                    mListener.KPIPieChartClickedItem(mCell,item);
-                }
-                mAnimation.end();
-
-                mAnimation.start();
-
-            }
-
-            @Override
-            public void pieChartCenterClicked(PieChartView pieChartView) {
-
-                if (mListener != null) {
-                    mListener.KPIPieChartClickedTitle(mCell);
-                }
-            }
-
-            @Override
-            public void pieChartDidBeginTouch() {
-                if (mListener != null) {
-                    mListener.KPIPieChartDidBeginClicked();
-                }
-            }
-
-            @Override
-            public void pieChartDidEndTouch() {
-                if (mListener != null) {
-                    mListener.KPIPieChartDidEndClicked();
-                }
-            }
-        });
-
-//        mPreBtn = findViewById(R.id.preBtn);
-//        mPreBtn.setOnClickListener(new OnClickListener() {
-//            @Override
-//            public void onClick(View v) {
-//                if (mListener != null) {
-//                    mListener.KPIPreviousButtonClicked(mCell);
-//                }
-//            }
-//        });
-//
-//        mNextBtn = findViewById(R.id.nextBtn);
-//        mNextBtn.setOnClickListener(new OnClickListener() {
-//            @Override
-//            public void onClick(View v) {
-//                if (mListener != null) {
-//                    mListener.KPINextButtonClicked(mCell);
-//                }
-//            }
-//        });
-    }
-
-    private void resizePieChartView(int w) {
-
-        int leftInterval = dp2px(getContext(),60);
-        int rightInterval = dp2px(getContext(),60);
-
-        final int pieW = (w - leftInterval - rightInterval);
-
-
-        mChartView.post(new Runnable() {
-
-            @Override
-            public void run() {
-
-                LayoutParams layout = (LayoutParams)mChartView.getLayoutParams();
-                layout.width = (int)pieW;
-                layout.height = (int)pieW;
-                mChartView.setLayoutParams(layout);
-                mChartView.requestLayout();
-            }
-        });
-    }
-
-    public void setMonthShipment(String shipment, int color) {
-        mShipTV.setText("Shipment:" + shipment);
-        mShipTV.setTextColor(color);
-    }
-
-    public void setMonthContainer(String container, int color) {
-        mContainerTV.setText("Container:" + container);
-        mContainerTV.setTextColor(color);
-    }
-
-    public void setMonthTeu(String teu, int color) {
-        mTeuTV.setText("TEU:" + teu);
-        mTeuTV.setTextColor(color);
-    }
-
-    public void setNameAndCount(String name, int count) {
-        if (mChartView != null) {
-            mChartView.setNameAndCount(name,count);
-        }
-    }
-
-    private KPIFragment.KPIModel mModel;
-    public void setKPIModel(KPIFragment.KPIModel model) {
-        mModel = model;
-        if (model != null) {
-            setChartItems(model.items);
-            setNameAndCount(model.name,model.total);
-        }
-    }
-
-    public void setSelection(String selection) {
-        mSelectionTV.setText(selection);
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-
-        super.onSizeChanged(w, h, oldw, oldh);
-
-    }
-
-    private int mWidth = 0;
-    private int mHeight = 0;
-
-    public int getKPIWidth() {
-        return mWidth;
-    }
-
-    public int getKPIHeight() {
-        return mHeight;
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
-        int w = getMeasuredWidth();
-        int h = getMeasuredHeight();
-
-        if (w != mWidth) {
-//            resizePieChartView(w);
-        }
-
-        mWidth = w;
-        mHeight = h;
-
-        float textSize = 7;
-        mMonthTV.setTextSize(TypedValue.COMPLEX_UNIT_PT,textSize);
-        mShipTV.setTextSize(TypedValue.COMPLEX_UNIT_PT,textSize);
-        mContainerTV.setTextSize(TypedValue.COMPLEX_UNIT_PT,textSize);
-        mTeuTV.setTextSize(TypedValue.COMPLEX_UNIT_PT,textSize);
-        mSelectionTV.setTextSize(TypedValue.COMPLEX_UNIT_PT,textSize);
-    }
-
-
-    float mTotal = 0;
-    private ArrayList<PieChartView.ChartItem> preparePieChartItems() {
-
-        float total = 0;
-        ArrayList<PieChartView.ChartItem> displayItems = new ArrayList<>();
-
-        if (mChartItems != null) {
-            total = 0;
-            for (int i = 0; i < mChartItems.size(); i++) {
-                PieChartView.ChartItem item = mChartItems.get(i);
-                if (item.display) {
-                    total += item.value;
-                }
-            }
-        } else {
-            total = 0;
-        }
-
-
-        for (int i = 0; i < mChartItems.size(); i++) {
-            PieChartView.ChartItem item = mChartItems.get(i);
-            if (item.display) {
-                if (total > 0) {
-                    item.setPercentage(item.value / total);
-                } else {
-                    item.setPercentage(0.f);
-                }
-
-                displayItems.add(item);
-            }
-        }
-
-        mTotal = total;
-        return displayItems;
-    }
-
-    private void refreshUI() {
-        ArrayList<PieChartView.ChartItem> displayItems = preparePieChartItems();
-        mChartView.setChartItems(displayItems);
-        mAdapter.notifyDataSetChanged();
-    }
-
-    public void setChartItems(ArrayList<PieChartView.ChartItem> chartItems) {
-        mChartItems = chartItems;
-        Log.d("KPI Cell", "setChartItems: ");
-        refreshUI();
-    }
-
-    public void randomColor() {
-        String r,g,b;
-        Random random = new Random();
-        r = Integer.toHexString(random.nextInt(256)).toUpperCase();
-        g = Integer.toHexString(random.nextInt(256)).toUpperCase();
-        b = Integer.toHexString(random.nextInt(256)).toUpperCase();
-
-        r = r.length()==1 ? "0" + r : r ;
-        g = g.length()==1 ? "0" + g : g ;
-        b = b.length()==1 ? "0" + b : b ;
-        int color = Color.parseColor("#" + r + g + b);
-        setBackgroundColor(color);
-    }
-
-    public static int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    public static int px2dp(Context context, float pxValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (pxValue / scale + 0.5f);
-    }
-
-    private KPIItemAdapter mAdapter;
-
-//    @Override
-//    public void onClick(View v) {
-//        if (v instanceof KPIItemButton) {
-//            KPIItemButton button = (KPIItemButton) v;
-//            Integer tag = (Integer) button.getTag();
-//            PieChartView.ChartItem item = mChartItems.get(tag);
-//            item.display = !item.display;
-//            refreshUI();
-//        }
-//    }
-
-    @Override
-    public void KPIListViewTouched(boolean t) {
-        if (mListener != null) {
-            mListener.KPIListTouched(t);
-        }
-    }
-
-    private class KPIItemAdapter extends BaseAdapter {
-
-        class ViewHolder {
-            KPIItemButton button_0, button_1;
-            ViewHolder(View root) {
-                if (root != null) {
-                    button_0 = root.findViewById(R.id.item_btn_0);
-                    button_1 = root.findViewById(R.id.item_btn_1);
-                    root.setTag(this);
-                }
-            }
-        }
-
-        int mLayoutId;
-        public KPIItemAdapter(Context context,int layoutId) {
-            mLayoutId = layoutId;
-        }
-
-        @NonNull
-        @Override
-        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
-
-            ViewHolder holder;
-            if (convertView == null) {
-                convertView = LayoutInflater.from(getContext()).inflate(mLayoutId,null);
-                holder = new ViewHolder(convertView);
-            } else {
-                holder = (ViewHolder) convertView.getTag();
-            }
-            holder.button_0.setOnClickListener(null);
-            holder.button_1.setOnClickListener(null);
-            holder.button_0.setOnTouchListener(null);
-            holder.button_1.setOnTouchListener(null);
-
-            holder.button_0.setTitle(null);
-            holder.button_1.setTitle(null);
-            holder.button_0.setDotColor(Color.parseColor("#00000000"));
-            holder.button_1.setDotColor(Color.parseColor("#00000000"));
-
-            int index = 2 * position;
-            PieChartView.ChartItem item_0 = mChartItems.get(index);
-
-            if (item_0.display) {
-                holder.button_0.setTitle(String.format("%s(%.2f%%)",item_0.shortTitle,item_0.getPercentage() * 100));
-                holder.button_0.setTitleColor(Color.BLACK);
-                holder.button_0.setDotColor(item_0.color);
-            } else {
-                holder.button_0.setTitle(item_0.shortTitle);
-                holder.button_0.setDotColor(Color.LTGRAY);
-                holder.button_0.setTitleColor(Color.LTGRAY);
-            }
-
-            holder.button_0.setTag(index);
-            holder.button_0.setOnTouchListener(mCell);
-
-            if (index < mChartItems.size() - 1) {
-                PieChartView.ChartItem item_1 = mChartItems.get(index + 1);
-                if (item_1.display) {
-                    holder.button_1.setTitle(String.format("%s(%.2f%%)",item_1.shortTitle,item_1.getPercentage() * 100));
-                    holder.button_1.setDotColor(item_1.color);
-                    holder.button_1.setTitleColor(Color.BLACK);
-                } else {
-                    holder.button_1.setTitle(item_1.shortTitle);
-                    holder.button_1.setDotColor(Color.LTGRAY);
-                    holder.button_1.setTitleColor(Color.LTGRAY);
-                }
-
-                holder.button_1.setTag(index + 1);
-                holder.button_1.setOnTouchListener(mCell);
-            }
-
-            return convertView;
-        }
-
-        @Override
-        public int getCount() {
-
-            if (mChartItems == null) {
-                return 0;
-            }
-
-            int row = mChartItems.size() / 2;
-            int col = mChartItems.size() % 2;
-            if (col != 0) {
-                row++;
-            }
-
-            return row;
-        }
-
-        @Override
-        public Object getItem(int position) {
-            int index = 2 * position;
-            PieChartView.ChartItem item_0 = mChartItems.get(index);
-            return item_0;
-        }
-
-        @Override
-        public long getItemId(int position) {
-            return position;
-        }
-    }
-
-    private KPIListener mListener;
-    public void setListener(KPIListener listener) {
-        mListener = listener;
-    }
-
-    public KPIListener getListener() {
-        return mListener;
-    }
-
-    public interface KPIListener {
-
-        void KPIPieChartClickedItem(KPICell cell, PieChartView.ChartItem item);
-        void KPIPieChartClickedTitle(KPICell cell);
-//        void KPIPreviousButtonClicked(KPICell cell);
-//        void KPINextButtonClicked(KPICell cell);
-
-        void KPIPieChartDidBeginClicked();
-        void KPIPieChartDidEndClicked();
-
-        void KPIListTouched(boolean touch);
-
-        void KPICellDidDoubleClickItem(KPICell cell, int index, KPIFragment.KPIModel model);
-
-    }
-
-    private KPIItemButton mClickBtn;
-    private GestureDetector mDetector;
-
-    @Override
-    public boolean onTouch(View v, MotionEvent event) {
-
-        if (v instanceof KPIItemButton) {
-            mClickBtn = (KPIItemButton) v;
-            mDetector.onTouchEvent(event);
-        }
-
-        return true;
-    }
-
-    private class GestureListener extends GestureDetector.SimpleOnGestureListener {
-
-        @Override
-        public boolean onDoubleTapEvent(MotionEvent e) {
-
-
-            if (e.getAction() == MotionEvent.ACTION_UP) {
-                Log.d("KPI Cell", "onDoubleTapEvent: ");
-                if (mListener != null) {
-                    mListener.KPICellDidDoubleClickItem(mCell,(Integer) mClickBtn.getTag(),mModel);
-                }
-            }
-
-            return false;
-        }
-
-        @Override
-        public boolean onSingleTapConfirmed(MotionEvent e) {
-
-            Log.d("KPI Cell", "onSingleTapConfirmed: ");
-            if (mClickBtn != null) {
-                KPIItemButton button = mClickBtn;
-                Integer tag = (Integer) button.getTag();
-                PieChartView.ChartItem item = mChartItems.get(tag);
-                item.display = !item.display;
-                refreshUI();
-            }
-
-            return false;
-        }
-    }
-}

+ 0 - 67
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIDot.java

@@ -1,67 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.RectF;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.view.View;
-
-public class KPIDot extends View {
-    public KPIDot(Context context) {
-        super(context);
-    }
-
-    public KPIDot(Context context, @Nullable AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public KPIDot(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    private int mWidth,mHeight;
-
-    int dotColor = -1;
-    public void setDotColor(int color) {
-        dotColor = color;
-        invalidate();
-    }
-
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-//        super.onDraw(canvas);
-
-        if (dotColor == -1) {
-            super.onDraw(canvas);
-            return;
-        }
-
-        setBackgroundColor(Color.WHITE);
-
-        Paint brush = new Paint(Paint.ANTI_ALIAS_FLAG);
-        brush.setAntiAlias(true); // 抗锯齿
-        brush.setDither(true); // 防抖动
-        brush.setStyle(Paint.Style.FILL);
-        brush.setColor(dotColor);
-
-        float r = Math.min(mWidth,mHeight) * 0.5f;
-        float x = (mWidth - 2 * r) * 0.5f;
-        float y = (mHeight - 2 * r) * 0.5f;
-        RectF rect = new RectF(x,y,x + 2 * r, y + 2 * r);
-        canvas.drawArc(rect,0,360,true,brush);
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-
-        mWidth = w;
-        mHeight = h;
-
-        invalidate();
-    }
-}

+ 0 - 47
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIItemButton.java

@@ -1,47 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.apex.R;
-
-public class KPIItemButton extends RelativeLayout {
-
-    public KPIItemButton(Context context) {
-        super(context);
-    }
-
-    public KPIItemButton(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public KPIItemButton(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    private KPIDot mDot;
-    private TextView mTextView;
-
-    public void setDotColor(int color) {
-        if (mDot == null) {
-            mDot = findViewById(R.id.icon_view);
-        }
-        mDot.setDotColor(color);
-    }
-
-    public void setTitle(String title) {
-        if (mTextView == null) {
-            mTextView = findViewById(R.id.name_tv);
-        }
-        mTextView.setText(title);
-    }
-
-    public void setTitleColor(int color) {
-        if (mTextView == null) {
-            mTextView = findViewById(R.id.name_tv);
-        }
-        mTextView.setTextColor(color);
-    }
-}

+ 0 - 47
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIListView.java

@@ -1,47 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.widget.ListView;
-
-public class KPIListView extends ListView {
-
-    public KPIListView(Context context) {
-        super(context);
-    }
-
-    public KPIListView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public KPIListView(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-
-         if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
-             if (mListener != null) {
-                 mListener.KPIListViewTouched(true);
-             }
-        } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
-             if (mListener != null) {
-                 mListener.KPIListViewTouched(false);
-             }
-        }
-
-        return super.onTouchEvent(event);
-    }
-
-    private KPIListViewTouchListener mListener;
-
-    public void setListener(KPIListViewTouchListener listener) {
-        this.mListener = mListener;
-    }
-
-    public interface KPIListViewTouchListener {
-        void KPIListViewTouched(boolean t);
-    }
-}

+ 0 - 53
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPISwipeRefresh.java

@@ -1,53 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-
-public class KPISwipeRefresh extends SwipeRefreshLayout {
-
-    public KPISwipeRefresh(Context context) {
-        super(context);
-    }
-
-    public KPISwipeRefresh(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    private float mFirstPointY = 0;
-
-    @Override
-    public boolean onInterceptTouchEvent(MotionEvent ev) {
-
-        Log.d("Refresh", "onInterceptTouchEvent: " + ev.getY() + "and Action: " + ev.getAction());
-
-        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
-            mFirstPointY = ev.getY();
-        }
-
-        // 防止下拉和ListView向上滑动冲突
-        if (mFirstPointY > 100) {
-            return false;
-        }
-
-        return super.onInterceptTouchEvent(ev);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-
-        Log.d("Refresh OnTouch", "onInterceptTouchEvent: " + ev.getY() + "and Action: " + ev.getAction());
-        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
-            mFirstPointY = ev.getY();
-        }
-
-        // 防止下拉和ListView向上滑动冲突
-        if (mFirstPointY > 100) {
-            return false;
-        }
-
-        return super.onTouchEvent(ev);
-    }
-}

+ 0 - 88
Apex Mobile/app/src/main/java/com/usai/apex/KPI/KPIViewPager.java

@@ -1,88 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.support.v4.view.ViewPager;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-
-public class KPIViewPager extends ViewPager {
-
-    private boolean scrollEnable = true;
-
-    public KPIViewPager(Context context) {
-        super(context);
-    }
-
-    public KPIViewPager(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public void setScrollEnable(boolean enable) {
-        scrollEnable = enable;
-    }
-
-    public boolean getScrollEnable() {
-        return scrollEnable;
-    }
-
-//    @Override
-//    public boolean onTouchEvent(MotionEvent ev) {
-//        if (scrollEnable) {
-//            return super.onTouchEvent(ev);
-//        }
-//        return false;
-//    }
-//
-//    @Override
-//    public boolean onInterceptTouchEvent(MotionEvent arg0) {
-//        if (scrollEnable) {
-//            return super.onInterceptTouchEvent(arg0);
-//        }
-//        return false;
-//    }
-
-
-    //mViewTouchMode表示ViewPager是否全权控制滑动事件,默认为true,即控制
-    private boolean mViewTouchMode = true;
-
-    public void setViewTouchMode(boolean b) {
-        if (b && !isFakeDragging()) {
-            //全权控制滑动事件
-            beginFakeDrag();
-        } else if (!b && isFakeDragging()) {
-            //终止控制滑动事件
-            endFakeDrag();
-        }
-        mViewTouchMode = b;
-    }
-
-    /**
-     * 在mViewTouchMode为true的时候,ViewPager不拦截点击事件,点击事件将由子View处理
-     */
-    @Override
-    public boolean onInterceptTouchEvent(MotionEvent event) {
-        if (mViewTouchMode || !scrollEnable) {
-            return false;
-        }
-        return super.onInterceptTouchEvent(event);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-        if (scrollEnable) {
-            return super.onTouchEvent(ev);
-        }
-        return false;
-    }
-
-    /**
-     * 在mViewTouchMode为true或者滑动方向不是左右的时候,ViewPager将放弃控制点击事件,
-     * 这样做有利于在ViewPager中加入ListView等可以滑动的控件,否则两者之间的滑动将会有冲突
-     */
-    @Override
-    public boolean arrowScroll(int direction) {
-        if (mViewTouchMode) return false;
-        if (direction != FOCUS_LEFT && direction != FOCUS_RIGHT) return false;
-        return super.arrowScroll(direction);
-    }
-}

+ 0 - 711
Apex Mobile/app/src/main/java/com/usai/apex/KPI/PieChartView.java

@@ -1,711 +0,0 @@
-package com.usai.apex.KPI;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.ColorDrawable;
-import android.support.annotation.Nullable;
-import android.text.Layout;
-import android.text.StaticLayout;
-import android.text.TextPaint;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewParent;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Random;
-
-
-/**
- * Created by macmini1 on 2018/3/28.
- */
-
-public class PieChartView extends View {
-
-//    private static final long serialVersionUID = 4564384597971491851L;
-
-    private static float titleFontSize = 40.0f;
-    private static float nameFontSize = 50.0f;
-    private static float detal = 10;
-    private static double M_PI = 3.14159265358979323846264338327950288;
-    private static double M_PI_2 = 1.57079632679489661923132169163975144;
-
-    public interface PieChartItemClickListener {
-
-        void pieChartItemClicked(PieChartView pieChartView, ChartItem item);
-        void pieChartCenterClicked(PieChartView pieChartView);
-        void pieChartDidBeginTouch();
-        void pieChartDidEndTouch();
-    }
-
-    public static class ChartItem implements Serializable {
-
-        private static final long serialVersionUID = 1437379045091025768L;
-
-        public String shortTitle;
-        public boolean display = true;
-
-        public int color = -1;
-        public float value;
-        public String title;
-        public int titleColor = -1;
-
-        private float startAngle;
-        private float angle;
-        private float endAngle;
-        private boolean select;
-        private PointF titlePosition;
-        private float percentage;
-        private Size titleSize;
-
-
-
-        private int getColor() {
-            if (color == -1) {
-                String r,g,b;
-                Random random = new Random();
-                r = Integer.toHexString(random.nextInt(256)).toUpperCase();
-                g = Integer.toHexString(random.nextInt(256)).toUpperCase();
-                b = Integer.toHexString(random.nextInt(256)).toUpperCase();
-
-                r = r.length()==1 ? "0" + r : r ;
-                g = g.length()==1 ? "0" + g : g ;
-                b = b.length()==1 ? "0" + b : b ;
-                color = Color.parseColor("#" + r + g + b);
-            }
-            return color;
-        }
-
-        private int getTitleColor() {
-            if (titleColor == -1) {
-//                String r,g,b;
-//                Random random = new Random();
-//                r = Integer.toHexString(random.nextInt(256)).toUpperCase();
-//                g = Integer.toHexString(random.nextInt(256)).toUpperCase();
-//                b = Integer.toHexString(random.nextInt(256)).toUpperCase();
-//
-//                r = r.length()==1 ? "0" + r : r ;
-//                g = g.length()==1 ? "0" + g : g ;
-//                b = b.length()==1 ? "0" + b : b ;
-//                titleColor = Color.parseColor("#" + r + g + b);
-                titleColor = Color.WHITE;
-            }
-            return titleColor;
-        }
-
-        private PieChartView.Size measure() {
-
-            Paint textPaint = new Paint();
-            textPaint.setColor(getTitleColor());
-            textPaint.setTextSize(titleFontSize);
-            textPaint.setStyle(Paint.Style.FILL);
-            //该方法即为设置基线上那个点到底是left,center,还是right  这里我设置为center
-            textPaint.setTextAlign(Paint.Align.CENTER);
-
-
-            Rect rect = new Rect();
-            String msg = getMessage();
-            textPaint.getTextBounds(msg, 0, msg.length(), rect);
-            int width = rect.width();// 文字宽
-            int height = rect.height();// 文字高
-
-            Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
-            float top = fontMetrics.top;//为基线到字体上边框的距离,即上图中的top
-            float bottom = fontMetrics.bottom;//为基线到字体下边框的距离,即上图中的bottom
-            float baseY = 0 - top / 2.0f - bottom / 2.0f;//基线中间点的y轴计算公式
-
-
-            titleSize = new Size(width,height);
-            return titleSize;
-        }
-
-        public float getPercentage() {
-            return percentage;
-        }
-
-        public void setPercentage(float percent) {
-            percentage = percent;
-        }
-
-        private String getMessage() {
-            return String.format("%.2f%%",percentage * 100);
-        }
-    }
-
-    private static class Size implements Serializable {
-        private static final long serialVersionUID = 3369542887994794927L;
-        int mWidth, mHeight;
-        public Size(int width, int height) {
-            mWidth = width;
-            mHeight = height;
-        }
-    }
-
-    public static int px2dp(Context context, float pxValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (pxValue / scale + 0.5f);
-    }
-
-    public static int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    public static int px2sp(Context context, float pxValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (pxValue / fontScale + 0.5f);
-    }
-
-    public static int sp2px(Context context, float spValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (spValue * fontScale + 0.5f);
-    }
-
-
-    private Paint mBrush = new Paint(Paint.ANTI_ALIAS_FLAG);
-    private int mWidth,mHeight;
-    private Context mCtx;
-    private ArrayList<ChartItem> chartItems = new ArrayList<>();
-    private ChartItem mSelectedItem;
-    private float mRadius;
-    private PieChartItemClickListener mPieChartItemClickListener;
-    public float minTitleAngle = 0;
-
-    public float progress = 0;
-
-    public PieChartView(Context context) {
-        this(context,null);
-    }
-
-    public PieChartView(Context context, @Nullable AttributeSet attrs) {
-        this(context, attrs,0);
-    }
-
-    public PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-        mCtx = context;
-        init();
-    }
-
-    public void setPieChartItemClickListener(PieChartItemClickListener listener) {
-        mPieChartItemClickListener = listener;
-    }
-
-
-    private float total = 0;
-    public void setChartItems(ArrayList<ChartItem> items) {
-        chartItems = items;
-
-        if (items != null) {
-            total = 0;
-            for (int i = 0; i < items.size(); i++) {
-                ChartItem item = items.get(i);
-                total += item.value;
-            }
-
-        } else {
-            chartItems = new ArrayList<>();
-            total = 0;
-        }
-
-        invalidate();
-    }
-
-    private String mName;
-    private int mCount;
-    public void setNameAndCount(String name, int count) {
-        mName = name;
-        mCount = count;
-    }
-
-    public void setRadius(float radius) {
-        mRadius = dp2px(getContext(),radius);
-    }
-
-    private void init() {
-
-        setBackgroundColor(Color.WHITE);
-        mBrush.setAntiAlias(true); // 抗锯齿
-        mBrush.setDither(true); // 防抖动
-        mBrush.setStyle(Paint.Style.FILL);
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-        mWidth = w;
-        mHeight = h;
-
-        mRadius = radius();
-        titleFontSize = 4.0f * px2dp(getContext(),mRadius) / 18.0f;
-        nameFontSize = 5.0f * px2dp(getContext(),mRadius) / 18.0f;
-        invalidate();
-    }
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-
-        if (total == 0) {
-            super.onDraw(canvas);
-        } else {
-
-            prepareItems();
-
-            showPie(canvas);
-
-            float hollowR = radius() * 0.5f;
-            float x = (mWidth - hollowR * 2) * 0.5f;
-            float y = (mHeight - hollowR * 2) * 0.5f;
-
-            RectF rect = new RectF(x, y,x + 2 * hollowR, y + 2 * hollowR);
-
-            Paint hollowPaint = new Paint();
-            hollowPaint.setAntiAlias(true); // 抗锯齿
-            hollowPaint.setDither(true); // 防抖动
-            hollowPaint.setStyle(Paint.Style.FILL);
-            ColorDrawable colordDrawable = (ColorDrawable) getBackground();
-            int color = colordDrawable.getColor();
-            hollowPaint.setColor(color);
-            canvas.drawArc(rect,0,360,true,hollowPaint);
-
-            drawPieTitle(canvas,mName,String.format("%d",mCount));
-        }
-
-    }
-
-    private void showPie(Canvas canvas) {
-
-        for (int i = 0; i < chartItems.size(); i++) {
-            ChartItem item = chartItems.get(i);
-            drawPieItem(canvas,item);
-        }
-    }
-
-    private void prepareItems() {
-
-
-        float perIntervalAngle = 1.0f;
-
-        ArrayList<ChartItem> zeroItems = new ArrayList<>();
-        // 剔除value == 0
-        for (int i = 0; i < chartItems.size(); i++) {
-            ChartItem item = chartItems.get(i);
-            if (item.value == 0) {
-                zeroItems.add(item);
-            }
-        }
-
-        if (zeroItems.size() > 0) {
-            for (int j = 0; j < zeroItems.size(); j++) {
-                ChartItem item = zeroItems.get(j);
-                chartItems.remove(item);
-            }
-        }
-
-        if (chartItems.size() == 1) {
-            perIntervalAngle = 0;
-        }
-        float totalIntervalAngle = perIntervalAngle * chartItems.size();
-        float totalAngle = 360.f - totalIntervalAngle;
-        float currentAngle = perIntervalAngle;
-
-        for (int i = 0; i < chartItems.size(); i++) {
-            ChartItem item = chartItems.get(i);
-            if (total > 0) {
-                item.percentage = item.value / total;
-            } else {
-                item.percentage = 0.f;
-            }
-            item.startAngle = currentAngle;
-            item.angle = totalAngle * item.percentage;
-            item.endAngle = item.startAngle + item.angle;
-
-            currentAngle += item.angle + perIntervalAngle;
-
-
-            float midAngle = (item.startAngle + item.endAngle) * 0.5f;
-
-            PointF point = findTitlePosition(midAngle);
-            item.titlePosition = point;
-            Size titleSize = item.measure();
-//            float x = point.x + titleSize.mWidth * 0.5f;
-//            float y = point.y - titleSize.mHeight * 0.5f;
-//
-//            item.titlePosition = new PointF(x,y);
-
-        }
-
-        // Title
-//        int lcount = lbArr.size() + ltArr.size();
-//        int rcount = rbArr.size() + rtArr.size();
-//
-//        float lh = mHeight / (lcount * 1.0f);
-//        float rh = mHeight / (rcount * 1.0f);
-//
-//        // 0
-//        for (int i = rbArr.size() - 1; i >= 0; i--) {
-//            // 最后一个Title在最下
-//            ChartItem item = rbArr.get(i);
-//            int index = (rbArr.size() - 1) - i;
-//
-//            float maxY = mHeight - rh * index;
-//            float minY = mHeight - rh * (index + 1);
-//            Size titleSize = item.measure();
-//
-////            float y = mHeight - rh * (index + 0.5f);
-//            float y = perfectY(maxY,minY,item.lineEndPoint.y,titleSize.mHeight);
-//            float x = mWidth * 1.0f - titleSize.mWidth;
-//            item.baseX = x + 0.5f * titleSize.mWidth;
-//
-//            item.titlePoint = new PointF(x,y);
-////            Log.d("prepareItems", "RB: " + item.title);
-//        }
-//        // 1
-//        for (int i = 0; i < lbArr.size(); i++) {
-//            // 第一个Title在最下
-//            ChartItem item = lbArr.get(i);
-//            int index = i;
-//            float maxY = mHeight - lh * index;
-//            float minY = mHeight - lh * (index + 1);
-//            Size titleSize = item.measure();
-//
-////            float y = mHeight - lh * (index + 0.5f);
-//            float y = perfectY(maxY,minY,item.lineEndPoint.y,titleSize.mHeight);
-//            float x = titleSize.mWidth;
-//            item.baseX = x - 0.5f * titleSize.mWidth;
-//
-//            item.titlePoint = new PointF(x,y);
-////            Log.d("prepareItems", "LB: " + item.title);
-//        }
-//
-//        // 2
-//        for (int i = ltArr.size() - 1; i >= 0; i--) {
-//            //最后一个Title在最上
-//            ChartItem item = ltArr.get(i);
-//            int index = (ltArr.size() - 1) - i;
-//
-//            float minY = lh * index;
-//            float maxY = lh * (index + 1);
-//            Size titleSize = item.measure();
-//
-////            float y = lh * (index + 0.5f);
-//            float x = titleSize.mWidth;
-//            float y = perfectY(maxY,minY,item.lineEndPoint.y,titleSize.mHeight);
-//            item.baseX = x - 0.5f * titleSize.mWidth;
-//
-//            item.titlePoint = new PointF(x,y);
-////            Log.d("prepareItems", "LT: " + item.title);
-//        }
-//
-//        // 3
-//        for (int i = 0; i < rtArr.size(); i++) {
-//            // 第一个Title在最上
-//            ChartItem item = rtArr.get(i);
-//            int index = i;
-//
-//            float minY = rh * index;
-//            float maxY = rh * (index + 1);
-//            Size titleSize = item.measure();
-//
-////            float y = rh * (index + 0.5f);
-//            float x = mWidth * 1.0f - titleSize.mWidth;
-//            float y = perfectY(maxY,minY,item.lineEndPoint.y,titleSize.mHeight);
-//            item.baseX = x + 0.5f * titleSize.mWidth;
-//
-//            item.titlePoint = new PointF(x,y);
-//            Log.d("prepareItems", "RT: " + item.title);
-//        }
-
-    }
-
-    public float perfectY(float maxY, float minY,float py, float h) {
-        float min_y = py - h * 0.5f, max_y = py + h * 0.5f;
-        if (min_y >= minY && max_y <= maxY) {
-            return py;
-        }
-
-        if ((min_y - minY) < 0) {
-            py += minY - min_y;
-        } else {
-            py -= max_y - maxY;
-        }
-
-        return py;
-    }
-
-    private void drawPieTitle(Canvas canvas, String title, String count) {
-
-        if (canvas == null || title == null || count == null) {
-            return;
-        }
-
-        if (title.length() == 0 || count.length() == 0) {
-            return;
-        }
-
-        float centerX = mWidth * 0.5f;
-        float centerY = mHeight * 0.5f;
-
-        float r = mRadius * 0.5f;
-        float w = (float) (Math.sqrt(Math.pow(r,2) / 2)) * 2.0f;
-        float h = w;
-
-        float x = centerX - w * 0.5f;
-        float y = centerY - h * 0.5f;
-
-//        String msg = "Per ETA\r\nContainer\r\n485845";
-
-//        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
-//        paint.setStyle(Paint.Style.STROKE);
-//        canvas.drawLine(x,y,x + w,y,paint);
-
-        String msg = title + "\r\n" + count;
-
-        canvas.save();
-
-        TextPaint textPaint = new TextPaint();
-        textPaint.setColor(Color.BLACK);
-        textPaint.setTextSize(nameFontSize);
-        textPaint.setAntiAlias(true);
-
-        StaticLayout layout = new StaticLayout(msg, textPaint, (int)w, Layout.Alignment.ALIGN_CENTER, 1.0F, 0.0F, true);
-
-        y = y + (h - layout.getHeight()) * 0.5f;
-        canvas.translate(x,y);
-        layout.draw(canvas);
-
-        canvas.restore();
-
-
-
-//        canvas.drawText(msg,x,y,textPaint);
-    }
-
-    private void drawPieItem(Canvas canvas,ChartItem item) {
-        if (item == null || canvas == null) {
-            return;
-        }
-
-        // draw Pie
-        if (item.angle > 0) {
-            float r = radius();
-            if (item.select) {
-                r += detal * progress;
-            }
-            float x = (mWidth - r * 2) * 0.5f;
-            float y = (mHeight - r * 2) * 0.5f;
-
-            RectF rect = new RectF(x, y,x + 2 * r, y + 2 * r);
-
-            mBrush.setColor(item.getColor());
-            canvas.drawArc(rect,item.startAngle,item.angle,true,mBrush);
-        }
-
-        if (minTitleAngle > item.angle) {
-            return;
-        }
-
-        // draw Title
-        Paint textPaint = new Paint();
-        textPaint.setColor(item.getTitleColor());
-        textPaint.setTextSize(titleFontSize);
-        textPaint.setStyle(Paint.Style.FILL);
-        //该方法即为设置基线上那个点到底是left,center,还是right  这里我设置为center
-        textPaint.setTextAlign(Paint.Align.CENTER);
-
-        String msg = item.getMessage();
-        canvas.drawText(msg,item.titlePosition.x,item.titlePosition.y + item.titleSize.mHeight * 0.5f,textPaint);
-
-
-//        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
-//        paint.setStyle(Paint.Style.STROKE);
-//        canvas.drawLine(item.titlePosition.x - 40.0f,item.titlePosition.y,item.titlePosition.x + 40.0f, item.titlePosition.y,paint);
-//        canvas.drawLine(item.titlePosition.x,item.titlePosition.y - 400.f,item.titlePosition.x, item.titlePosition.y + 40.0f,paint);
-
-    }
-
-    private PointF center() {
-        return new PointF(mWidth * 0.5f,mHeight * 0.5f);
-    }
-
-    private float radius() {
-//        if (mRadius <= 0) {
-            return Math.min(mWidth,mHeight) * 0.5f * 0.9f;
-//        } else {
-//            return mRadius;
-//        }
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-
-        if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
-
-            float touchX = event.getX();
-            float touchY = event.getY();
-
-            float distance = (float) Math.sqrt(Math.pow(center().x - touchX,2) + Math.pow(center().y - touchY,2));
-
-            if (distance < radius() * 0.5f) {
-                if (event.getAction() == MotionEvent.ACTION_DOWN) {
-                    if (mPieChartItemClickListener != null) {
-                        mPieChartItemClickListener.pieChartDidBeginTouch();
-                    }
-                }
-
-                if (mPieChartItemClickListener != null) {
-                    mPieChartItemClickListener.pieChartCenterClicked(this);
-                }
-                return true;
-            }
-
-            if (distance > radius()) {
-                return super.onTouchEvent(event);
-            }
-
-            if (event.getAction() == MotionEvent.ACTION_DOWN) {
-                if (mPieChartItemClickListener != null) {
-                    mPieChartItemClickListener.pieChartDidBeginTouch();
-                }
-            }
-
-            double rad_angle = findAngleBytouchPoint(touchX,touchY);
-            float angle = (float) (180.0f / M_PI * rad_angle);
-
-            Log.d("Touch", String.format("onTouch Angle: %f",angle));
-
-            Iterator iterator = chartItems.iterator();
-            while (iterator.hasNext()) {
-                ChartItem item = (ChartItem) iterator.next();
-                if (item.startAngle <= angle && item.endAngle >= angle) {
-                    if (mSelectedItem != null) {
-                        if (mSelectedItem == item) {
-                            break;
-                        } else {
-                            mSelectedItem.select = false;
-                        }
-                    }
-                    mSelectedItem = item;
-                    mSelectedItem.select = true;
-                    invalidate();
-                    if (mPieChartItemClickListener != null) {
-                        mPieChartItemClickListener.pieChartItemClicked(this,item);
-                    }
-                    break;
-                }
-            }
-            return true;
-        } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
-
-            if (mPieChartItemClickListener != null) {
-                mPieChartItemClickListener.pieChartDidEndTouch();
-            }
-
-            if (mSelectedItem != null) {
-                mSelectedItem.select = false;
-                invalidate();
-                mSelectedItem = null;
-            }
-            if (mPieChartItemClickListener != null) {
-                mPieChartItemClickListener.pieChartItemClicked(this,null);
-            }
-
-        }
-
-
-
-        return super.onTouchEvent(event);
-    }
-
-    private double findAngleBytouchPoint(float touchX, float touchY) {
-
-        float r = mRadius;
-        float x = (mWidth - r * 2) * 0.5f;
-        float y = (mHeight - r * 2) * 0.5f;
-        RectF rect = new RectF(x, y,x + 2 * r, y + 2 * r);
-
-        if (rect.contains(touchX,touchY)) {
-
-            float centerX = mWidth * 0.5f;
-            float centerY = mHeight * 0.5f;
-
-            float distance = (float) Math.sqrt(Math.pow(centerX - touchX,2) + Math.pow(centerY - touchY,2));
-            float angle = (float) Math.asin(Math.abs(touchY - centerY) / distance);
-
-            float offsetX = touchX - centerX;
-            float offsetY = touchY - centerY;
-
-
-            if (offsetX > 0 && offsetY > 0) {
-                return angle;
-            }
-            if (offsetX < 0 && offsetY > 0) {
-                return M_PI - angle;
-            }
-            if (offsetX < 0 && offsetY < 0) {
-                return M_PI + angle;
-            }
-            if (offsetX > 0 && offsetY < 0) {
-                return M_PI * 2 - angle;
-            }
-            if (offsetX == 0) {
-                if (offsetY > 0) {
-                    return M_PI;
-                }
-                if (offsetY < 0) {
-                    return M_PI_2 * 3;
-                }
-            }
-            if (offsetY == 0) {
-                if (offsetX > 0) {
-                    return 0;
-                }
-                if (offsetX < 0) {
-                    return M_PI;
-                }
-            }
-
-            return 0;
-
-        }
-        return 0;
-    }
-
-    private PointF findTitlePosition(float angle) {
-
-        float centerX = mWidth * 0.5f;
-        float centerY = mHeight * 0.5f;
-        float r = mRadius * 0.75f;
-        float rad = (float) (angle * M_PI / 180.0f);
-
-        return new PointF(centerX + (float) Math.cos(rad) * r, centerY + (float) Math.sin(rad) * r);
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-
-//        KPICell p = (KPICell) getParent();
-//        int w = p.getKPIWidth();
-//
-//        int leftInterval = dp2px(getContext(),60);
-//        int rightInterval = dp2px(getContext(),60);
-//
-//        int pieW = (w - leftInterval - rightInterval);
-
-//        widthMeasureSpec = MeasureSpec.makeMeasureSpec(pieW, MeasureSpec.EXACTLY);
-//        heightMeasureSpec = MeasureSpec.makeMeasureSpec(pieW, MeasureSpec.EXACTLY);
-
-        int width = MeasureSpec.getSize(widthMeasureSpec);
-        heightMeasureSpec = MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY);
-
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-    }
-}

+ 0 - 70
Apex Mobile/app/src/main/java/com/usai/apex/LicenseActivity.java

@@ -1,70 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.TextView;
-
-public class LicenseActivity extends AppCompatActivity {
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-        TextView mtitleview= mActionBarView.findViewById(R.id.title);
-
-//        String license_name=getIntent().getStringExtra("function_name");
-        String function_name = getIntent().getStringExtra("function_name");
-//        String title = "";
-//        if(function_name.equals("Ocean Booking"))
-//            title="Booking Detail";
-//        else if(function_name.equals("Ocean B/L info."))
-//            title="B/L info. Detail";
-//        else if(function_name.equals("Container detail"))
-//            title="Container Detail";
-//        else if(function_name.equals("Cargo Tracking"))
-//            title="Cargo Detail";
-        mtitleview.setText(function_name);
-        setTitle(function_name);
-////
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarView, lp);
-//        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//        actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-    }
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_license);
-        setCustomActionBar();
-        String license_content=getIntent().getStringExtra("content");
-
-        TextView tv = findViewById(R.id.tv_license);
-        tv.setText(license_content);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-
-
-            case android.R.id.home:
-                finish();
-                break;
-                default:
-                    break;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-}

+ 0 - 203
Apex Mobile/app/src/main/java/com/usai/apex/LocalDocumentActivity.java

@@ -1,203 +0,0 @@
-package com.usai.apex;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.usai.util.commonUtil;
-
-import android.app.ListActivity;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
-
-public class LocalDocumentActivity extends ListActivity
-{
-	public static final String FILETYPE ="pdf";
-	private List<Map<String, Object>> getData()
-	{
-		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
-
-		
-	
-        if(commonUtil.localdirExist())
-        {
-        	File path = new File(Environment.getExternalStorageDirectory().getPath()+"/Apex Mobile");
-            //返回文件夹中有的数据
-            File[] files = path.listFiles();
-            //先判断下有没有权限,如果没有权限的话,就不执行了
-            if(null == files)
-                return list;
-            for(int i = 0; i < files.length; i++)
-            {
-//				String filePath = files[i].getAbsolutePath();
-				String fileName = files[i].getName();
-				String[] token = fileName.split("\\.");
-				String ext = token[token.length-1];
-				if(!FILETYPE.contains(ext))
-					continue;
-
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("title", fileName);
-				map.put("ext", ext);
-				if(ext.toLowerCase().equals("pdf"))
-					map.put("img", R.drawable.ic_pdf128);
-				else
-					map.put("img", R.drawable.ic_file128);
-				list.add(map);
-
-            }
-        }
-		return list;
-	}
-
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.message_list);
-
-		SimpleAdapter adapter = new DocumentsAdapter(this,
-				getData(), R.layout.documents_list_item, new String[] { "title",
-						"img" }, new int[] { R.id.tv_toolname, R.id.iv_thumb});
-		setListAdapter(adapter);
-		this.getListView().setBackgroundColor(Color.WHITE);		
-		
-	}
-
-	@Override
-	public void onListItemClick(ListView l, View v, int position, long id)
-	{
-		Log.d("FragmentList", "Item clicked: " + id);
-		String filename = (String) getData().get(position).get("title");
-		Intent intent = new Intent("android.intent.action.VIEW");
-
-		intent.addCategory("android.intent.category.DEFAULT");
-
-		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-		Uri uri = Uri.fromFile(new File(Environment
-				.getExternalStorageDirectory().getPath()
-				+ "/Apex Mobile/"
-				+ filename));
-
-		intent.setDataAndType(uri, "application/"+(String) getData().get(position).get("ext"));
-//	    startActivity(intent);
-	    startActivity(Intent.createChooser(intent,getString(R.string.str_openfile)));
-//		
-//		Intent intent = new Intent();
-//		if(title.equals("Search documents online"))
-//		{
-//			intent.setClass(this, SearchListActivity.class);
-//	
-//			intent.putExtra("function_name", "Download Document");
-//			intent.putExtra("title", "Document Search");
-//
-//		}
-//		else if(title.equals("View download documents"))
-//		{
-//			intent.setClass(this, AnnouncementActivity.class);
-//			intent.putExtra("module_name", "Announcements");
-//		}
-//
-//		
-//		startActivity(intent);
-
-	}
-	
-	private class DocumentsAdapter extends SimpleAdapter
-	{
-
-//		private LayoutInflater	mInflater;
-		@Override
-		public View getView( int position, View convertView, ViewGroup parent)
-		{
-			convertView =super.getView(position, convertView, parent);
-			// TODO Auto-generated method stub
-//			convertView = mInflater.inflate(R.layout.announcement_item, null);// 根据布局文件实例化view
-
-			ImageView iv = (ImageView)convertView.findViewById(R.id.iv_share);
-			iv.setTag( (String) getData().get(position).get("title"));
-			iv.setOnClickListener(new OnClickListener()
-			{
-				
-				@Override
-				public void onClick(View v)
-				{
-					Intent share = new Intent(Intent.ACTION_SEND);   
-					String filename = (String) v.getTag();
-					share.putExtra(Intent.EXTRA_STREAM, 
-					Uri.fromFile(new File(Environment.getExternalStorageDirectory().getPath()+"/Apex Mobile/"+filename)));
-					String[] token = filename.split("\\.");
-					String ext = token[token.length-1];
-					share.setType("application/"+ext);//此处可发送多种文件
-					startActivity(Intent.createChooser(share,getString(R.string.str_sendto)));
-					
-				}
-			});
-//			TextView title = (TextView) convertView.findViewById(R.id.tv_title);// 找某个控件
-//			title.setText(result.getData().get(position).get("title")
-//					.toString());// 给该控件设置数据(数据从集合类中来)
-//			TextView content = (TextView) convertView
-//					.findViewById(R.id.tv_content);
-//			content.setText(result.getData().get(position).get("content")
-//					.toString());
-//			if (result.getData().get(position).get("image").toString().length() > 0)
-//			{
-//				byte[] gzipBuff = Base64.decode(result.getData().get(position)
-//						.get("image").toString(), 0);
-//
-//				ByteArrayInputStream memstream = new ByteArrayInputStream(
-//						gzipBuff, 0, gzipBuff.length);
-//
-//				ByteArrayOutputStream baos = new ByteArrayOutputStream(
-//						gzipBuff.length);
-//				ImageView iv_thumb = (ImageView) convertView
-//						.findViewById(R.id.iv_thumb);
-//				try
-//				{
-//					baos.write(gzipBuff);
-//
-//					Bitmap bmp = BitmapFactory.decodeStream(memstream);
-//
-//					// ImageView image = new ImageView(this);
-//
-//					iv_thumb.setImageBitmap(bmp);
-//				}
-//				catch (IOException e)
-//				{
-//					// TODO Auto-generated catch block
-//					e.printStackTrace();
-//				}
-//			}
-//			// img.setBackgroundResource((Integer)jObject.get("img"));
-
-			return convertView;
-		}
-		public DocumentsAdapter(Context context,
-				List<? extends Map<String, ?>> data, int resource,
-				String[] from, int[] to)
-		{
-			
-			super(context, data, resource, from, to);
-			
-//			this.mInflater = LayoutInflater.from(context);
-			// TODO Auto-generated constructor stub
-		}
-		
-	}
-}

+ 0 - 29
Apex Mobile/app/src/main/java/com/usai/apex/LocationDetail.java

@@ -1,29 +0,0 @@
-package com.usai.apex;
-
-import java.io.Serializable;
-
-public class LocationDetail implements Serializable
-{
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = -8043239175565480418L;
-	public String Name,Addr,Tel,Fax,Contact,Email;
-	LocationDetail(String name,String addr,String tel,String fax,String contact,String email)
-	{
-//		Name="aa";
-//		Addr="aa";
-//		Tel="aa";
-//		Fax="aa";
-//		Contact="aa";
-//		Email="aa";
-		Name=name;
-		Addr=addr;
-		Tel=tel;
-		Fax=fax;
-		Contact=contact;
-		Email=email;
-		
-	}
-
-}

+ 0 - 171
Apex Mobile/app/src/main/java/com/usai/apex/LocationDetailActivity.java

@@ -1,171 +0,0 @@
-package com.usai.apex;
-
-import java.util.List;
-
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Data;
-//import android.provider.Contacts;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.database.Cursor;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class LocationDetailActivity extends Activity
-{
-	LocationDetail	detail;
-
-	boolean isIntentAvailable(Context context, Intent intent)
-	{
-		final PackageManager packageManager = context.getPackageManager();
-		List<ResolveInfo> list = packageManager.queryIntentActivities(intent,
-				PackageManager.GET_ACTIVITIES);
-		return list.size() > 0;
-	}
-
-	public int getContactid(String name)
-	{
-		int _id = -1;
-
-		Cursor cursor = getContentResolver()
-				.query(Data.CONTENT_URI,
-						new String[] { Data._ID, Data.DISPLAY_NAME,
-								Data.DISPLAY_NAME_ALTERNATIVE,
-								Data.DISPLAY_NAME_SOURCE }, Data.DISPLAY_NAME+"='"+name+"'", null, null);
-
-		Log.d("", "contact " + Data.DISPLAY_NAME + name);
-
-		// Uri uri =
-		// Uri.parse("content://com.android.contacts/data/name/filter/" +
-		// number);
-		// ContentResolver resolver = getContentResolver();
-		// Cursor cursor = resolver.query(uri, new String[]{"_id"}, null, null,
-		// null);
-		while (cursor.moveToNext())
-		{
-			Log.d("", "cursor=" + cursor.getString(1) + cursor.getString(2)
-					+ cursor.getString(3));
-			_id = cursor.getInt(0);
-
-		}
-		cursor.close();
-		return _id;
-	}
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_location_detail);
-		detail = (LocationDetail) getIntent().getSerializableExtra("detail");
-		TextView tv_name = (TextView) findViewById(R.id.tv_title);
-		tv_name.setText(detail.Name);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-		TextView tv_addr = (TextView) findViewById(R.id.tv_addr);
-		tv_addr.setText(getString(R.string.str_address)+detail.Addr);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-		TextView tv_tel = (TextView) findViewById(R.id.tv_tel);
-		tv_tel.setText(getString(R.string.str_tel)+detail.Tel);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-		TextView tv_fax = (TextView) findViewById(R.id.tv_fax);
-		tv_fax.setText(getString(R.string.str_fax)+detail.Fax);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-		TextView tv_contact = (TextView) findViewById(R.id.tv_contact);
-		tv_contact.setText(getString(R.string.str_contact)+detail.Contact);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-		TextView tv_email = (TextView) findViewById(R.id.tv_email);
-		tv_email.setText(getString(R.string.str_email)+detail.Email);
-		// tv_name.setMovementMethod(LinkMovementMethod.getInstance());
-
-		Button btn = (Button) findViewById(R.id.btn_addcontact);
-		btn.setOnClickListener(new OnClickListener()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-
-				int _id = getContactid(detail.Name);
-				Log.d("", "contact id = " + _id);
-				Intent it = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, 
-		                ContactsContract.Contacts.CONTENT_URI); 
-				it.setData(Uri.parse("tel:"+detail.Tel));
-				it.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true);
-//				it.setType(ContactsContract.Contacts.CONTENT_TYPE);// .People.CONTENT_TYPE);
-				it.putExtra(ContactsContract.Intents.Insert.COMPANY,
-						detail.Name);
-				
-				
-				String tel[] = detail.Tel.split("\n");
-				if(tel.length>0)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.PHONE, tel[0]);
-					it.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, Phone.TYPE_WORK);
-				}
-				if(tel.length>1)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE, tel[1]);
-					it.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, Phone.TYPE_WORK);
-				}
-				if(tel.length>2)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE, tel[2]);
-					it.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE, Phone.TYPE_WORK);
-				}
-				String email[] = detail.Email.split("\n");
-				if(email.length>0)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.EMAIL, email[0]);
-					it.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, Email.TYPE_WORK);
-				}
-				if(email.length>1)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.SECONDARY_EMAIL, email[1]);
-					it.putExtra(ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, Email.TYPE_WORK);
-				}
-				if(email.length>2)
-				{
-					it.putExtra(ContactsContract.Intents.Insert.TERTIARY_EMAIL, email[2]);
-					it.putExtra(ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE, Email.TYPE_WORK);
-				}
-				//
-//				intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,
-//						Contacts.PhonesColumns.TYPE_MOBILE);
-//				it.putExtra(ContactsContract.Intents.Insert.EMAIL, detail.Email);
-//				it.putExtra(ContactsContract.Intents.Insert.COMPANY,
-//						detail.Name);
-				it.putExtra(ContactsContract.Intents.Insert.POSTAL, detail.Addr);
-
-				if (!isIntentAvailable(LocationDetailActivity.this, it))
-				{
-					Toast.makeText(LocationDetailActivity.this,
-							"failed to add contact", Toast.LENGTH_LONG).show();
-					return;
-				}
-
-				startActivity(it);
-
-			}
-		});
-	}
-
-//	@Override
-//	public boolean onCreateOptionsMenu(Menu menu)
-//	{
-//		// Inflate the menu; this adds items to the action bar if it is present.
-//		getMenuInflater().inflate(R.menu.location_detail, menu);
-//		return true;
-//	}
-
-}

+ 0 - 370
Apex Mobile/app/src/main/java/com/usai/apex/MessageActivity.java

@@ -1,370 +0,0 @@
-package com.usai.apex;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ListActivity;
-import android.app.NotificationManager;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.text.format.DateFormat;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnTouchListener;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.Button;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class MessageActivity extends ListActivity implements OnTouchListener
-{
-	SearchResult	searchresult	= new SearchResult();
-	BaseAdapter		adapter			= null;
-
-	private int		pointX, pointY, endX, endY;
-	private int		position, newpos;
-	private Button	curDel_btn;
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.message, menu);
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		// Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case R.id.action_deleteall:
-			{
-				AlertDialog.Builder builder = new Builder(this);
-				builder.setMessage(getString(R.string.str_deletemessage));
-
-				builder.setTitle(getString(R.string.str_confirmdelete));
-
-				builder.setPositiveButton(getString(R.string.str_del),
-						new Dialog.OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								SQLiteDatabase db = dbUtil.OpenDB(
-										MessageActivity.this, null, false);
-								db.execSQL("delete from push_message");
-								Log.d("sql delete" + position,
-										"delete from push_message where _id="
-												+ (Long) searchresult.getData()
-														.get(position)
-														.get("_id"));
-
-								dbUtil.CloseDB(db);
-								dialog.dismiss();
-								searchresult.getData().clear();// .remove(position);
-								adapter.notifyDataSetChanged();
-								NotificationManager nManager = (NotificationManager) 
-										getSystemService(Context.NOTIFICATION_SERVICE);
-								nManager.cancel(R.layout.activity_apex);
-								ApexTrackingApplication.ncount=1;
-							}
-						});
-
-				builder.setNegativeButton(getString(R.string.str_cancel),
-						new Dialog.OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								dialog.dismiss();
-							}
-						});
-
-				builder.create().show();
-
-				break;
-			}
-			case R.id.action_markallread:
-			{
-				SQLiteDatabase db = dbUtil.OpenDB(
-						MessageActivity.this, null, false);
-				db.execSQL("update push_message set read = 1 where user = '"+ApexTrackingApplication.get_user()+"'");
-				Log.d("sql delete" + position,
-						"delete from push_message where _id="
-								+ (Long) searchresult.getData()
-										.get(position)
-										.get("_id"));
-
-				dbUtil.CloseDB(db);
-				
-				for(int i=0;i<searchresult.getData().size();i++)
-				{
-					searchresult.getData().get(i).put("read", (long) 1);
-
-				}
-//				searchresult.getData().clear();// .remove(position);
-				adapter.notifyDataSetChanged();				
-			}
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	@Override
-	public boolean onTouch(View v, MotionEvent event)
-	{
-		switch (event.getAction())
-		{
-			case MotionEvent.ACTION_DOWN:
-				System.out.println("====>>>>>>>>>>>>>>ACTION_DOWN"
-						+ MotionEvent.ACTION_DOWN);
-				// 手指按下,计算焦点位于ListView的那个条目
-				pointX = (int) event.getX();
-				pointY = (int) event.getY();
-				// 备注1
-				position = getListView().pointToPosition(pointX, pointY);
-				if (curDel_btn != null)
-				{
-					curDel_btn.setVisibility(View.GONE);
-				}
-				break;
-			case MotionEvent.ACTION_MOVE:
-
-				break;
-			case MotionEvent.ACTION_UP:
-				System.out.println("====>>>>>>>>>>>>>>ACTION_UP"
-						+ MotionEvent.ACTION_UP);
-				endX = (int) event.getX();
-				endY = (int) event.getY();
-				newpos = getListView().pointToPosition(endX, endY);
-				// 原本想着加上这个条件(newpos==position)是不是更精确些,
-				// 经过实践发现,其实我们在滑动listView的列表的时候有时候更渴望有滑动就ok
-				if (Math.abs(endX - pointX) > 100 && newpos == position
-						&& Math.abs(endY - pointY) < 100)
-				{
-					// 获取到ListView第一个可见条目的position
-					int firstVisiblePosition = getListView()
-							.getFirstVisiblePosition();
-
-					// --------------备注2
-					View view = getListView().getChildAt(
-							position - firstVisiblePosition);
-					Button delbtn = (Button) view.findViewById(R.id.btn_del);
-					delbtn.setVisibility(View.VISIBLE);
-					curDel_btn = delbtn;
-					delbtn.setOnClickListener(new View.OnClickListener()
-					{
-
-						@Override
-						public void onClick(View v)
-						{
-							// TODO Auto-generated method stub
-
-							SQLiteDatabase db = dbUtil.OpenDB(
-									MessageActivity.this, null, false);
-							db.execSQL("delete from push_message where _id="
-									+ (Long) searchresult.getData()
-											.get(position).get("_id"));
-							Log.d("sql delete" + position,
-									"delete from push_message where _id="
-											+ (Long) searchresult.getData()
-													.get(position).get("_id"));
-
-							dbUtil.CloseDB(db);
-							searchresult.getData().remove(position);
-							adapter.notifyDataSetChanged();
-						}
-					});
-
-				}
-				break;
-
-			default:
-				break;
-		}
-		return false;
-	}
-
-	@Override
-	protected void onListItemClick(ListView l, View v, int position, long id)
-	{
-		SQLiteDatabase db = dbUtil.OpenDB(MessageActivity.this, null, false);
-		db.execSQL("update push_message set read = 1 where _id="
-				+ (Long) searchresult.getData().get(position).get("_id"));
-		searchresult.getData().get(position).put("read", (long) 1);// .get("_id")
-		dbUtil.CloseDB(db);
-		adapter.notifyDataSetChanged();
-		super.onListItemClick(l, v, position, id);
-
-		// Log.i("FragmentList", "Item clicked: " + id);
-		Intent intent = new Intent();
-		intent.putExtra("s_id", (String) searchresult.getData().get(position)
-				.get("s_id"));
-		intent.putExtra("e_id", (String) searchresult.getData().get(position)
-				.get("e_id"));
-		intent.putExtra("msgcount", (Long) searchresult.getData().get(position)
-				.get("msgcount"));
-
-		intent.setClass(this, MessageDetailActivity.class);
-		startActivity(intent);
-	}
-
-	@Override
-	public void onCreate(Bundle savedInstanceState)
-	{
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.message_list);
-		adapter = new MessageAdapter(searchresult, this);
-
-		getListView().setOnTouchListener(this);
-		setListAdapter(adapter);
-
-	}
-
-	private class SearchResult
-	{
-		List<Map<String, Object>>	datalist	= new ArrayList<Map<String, Object>>();
-
-		public int get_count()
-		{
-			return datalist.size();
-		}
-
-		public void add_records(Cursor c)
-		{
-			while (c.moveToNext())
-			{
-				long _id = c.getInt(0);
-				String h_time = c.getString(1);
-				long create_time = c.getLong(2);
-				long read = c.getLong(3);
-				String s_id = c.getString(4);
-				String e_id = c.getString(5);
-				long msgcount = c.getInt(6);
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("_id", _id);
-				map.put("h_time", h_time);
-				map.put("create_time", create_time);
-				map.put("read", read);
-				map.put("s_id", s_id);
-				map.put("e_id", e_id);
-				map.put("msgcount", msgcount);
-
-				datalist.add(map);
-			}
-
-		}
-
-		public List<Map<String, Object>> getData()
-		{
-
-			return datalist;
-		}
-	}
-
-	private class MessageAdapter extends BaseAdapter
-	{
-		private LayoutInflater	mInflater;	// 动态布局映射
-											// private SearchResult result;
-
-		// private Context context;
-		// private int i = 0;
-		public MessageAdapter(SearchResult result, Context context)
-		{
-			// this.result = result;
-			this.mInflater = LayoutInflater.from(context);
-			SQLiteDatabase db = dbUtil
-					.OpenDB(MessageActivity.this, null, false);
-			Cursor cursor = db.query("push_message",
-					new String[] { "_id", "h_time", "create_time", "read",
-							"s_id", "e_id", "msgcount" }, "user='"
-							+ ApexTrackingApplication.get_user() + "'", null,
-					null, null, "_id desc", null);
-
-			result.add_records(cursor);
-			dbUtil.CloseCursor(cursor);
-			dbUtil.CloseDB(db);
-			// this.result = result;
-			// // this.context = context;
-			// this.mInflater = LayoutInflater.from(context);
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent)
-		{
-			// TODO Auto-generated method stub
-			convertView = mInflater.inflate(R.layout.message_list_item, null);// 根据布局文件实例化view
-
-			TextView message = (TextView) convertView
-					.findViewById(R.id.tv_message);// 找某个控件
-
-			message.setText(getString(R.string.str_notification_text));// 给该控件设置数据(数据从集合类中来)
-			TextView time = (TextView) convertView.findViewById(R.id.tv_time);
-			time.setText(DateFormat.format(
-					getString(R.string.time_format),
-					(Long) searchresult.getData().get(position)
-							.get("create_time")));
-			if ((Long) searchresult.getData().get(position).get("read") == 0)
-			{
-				message.getPaint().setFakeBoldText(true);
-				time.getPaint().setFakeBoldText(true);
-				convertView.setBackgroundColor(Color.LTGRAY);
-			}
-			else
-			{
-				message.getPaint().setFakeBoldText(false);
-				time.getPaint().setFakeBoldText(false);
-				convertView.setBackgroundColor(Color.WHITE);
-			}
-
-			return convertView;
-		}
-
-		@Override
-		public int getCount()
-		{
-			return searchresult.get_count();
-		}
-
-		@Override
-		public Object getItem(int position)
-		{
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public long getItemId(int position)
-		{
-			// TODO Auto-generated method stub
-			return 0;
-		}
-	}
-
-}

+ 0 - 424
Apex Mobile/app/src/main/java/com/usai/apex/MessageDetailActivity.java

@@ -1,424 +0,0 @@
-package com.usai.apex;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import com.usai.util.Network;
-
-import android.app.ListActivity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.text.Html;
-import android.text.method.LinkMovementMethod;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AutoCompleteTextView;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.RadioGroup;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class MessageDetailActivity extends ListActivity
-{
-	long				msgcount		= 0;
-	String				e_id			= "";
-	String				s_id			= "";
-	int					limit			= 10;
-	int					offset			= 0;
-	private SearchTask	m_task			= null;
-	SearchResult		searchresult	= new SearchResult();
-	BaseAdapter			adapter			= null;
-	View				view_page_footer;
-
-	// String module_name = "";
-
-	public void requestdata()
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		// mStatusMessageView.setText(R.string.str_Loading);
-		// showProgress(true);
-		m_task = new SearchTask();
-
-		TextView text_page = (TextView) view_page_footer
-				.findViewById(R.id.text_page);
-		text_page.setText("Loading...");
-		text_page.setEnabled(false);
-		m_task.execute();
-
-	}
-
-	@Override
-	protected void onListItemClick(ListView l, View v, int position, long id)
-	{
-		super.onListItemClick(l, v, position, id);
-
-		Intent intent = new Intent();
-		intent.setClass(this, DetailActivity.class);
-
-		intent.putExtra("action0", "Tracking");
-		intent.putExtra("function_name", "Cargo Tracking");
-
-		intent.putExtra("cargo_criterion", searchresult.getData().get(position)
-				.get("url").toString());
-		intent.putExtra("actions_count", 1);
-		intent.putExtra("_id", "dumb");
-//		String h_field;
-		intent.putExtra("criterion_type", 1);
-//		h_field = "container_no";
-
-		startActivity(intent);
-
-	}
-
-	@Override
-	public void onDestroy()
-	{
-		if (m_task != null)
-			m_task.cancel(false);
-		super.onDestroy();
-	}
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-
-		// setTitle("Booking Result");
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.message_list);
-		adapter = new AnnouncementAdapter(searchresult, this);
-
-		s_id = getIntent().getStringExtra("s_id");
-		e_id = getIntent().getStringExtra("e_id");
-		msgcount = getIntent().getLongExtra("msgcount", 0);
-		view_page_footer = LayoutInflater.from(this).inflate(
-				R.layout.view_page_footer, null);
-		getListView().addFooterView(view_page_footer);// 添加底部视图
-		TextView text_page = (TextView) view_page_footer
-				.findViewById(R.id.text_page);
-		text_page.setOnClickListener(new View.OnClickListener()
-		{
-			// 点击按钮 追加数据 并通知适配器
-			@Override
-			public void onClick(View v)
-			{
-				// TODO Auto-generated method stub
-				// TextView tv = (TextView) v;
-				// tv.setText("Loading...");
-				offset += 10;
-				requestdata();
-				// tv.setText("下一页");
-				// adapter.notifyDataSetChanged();
-			}
-		});
-
-		setListAdapter(adapter);
-		// this.getListView().setBackgroundColor(Color.WHITE);
-		requestdata();
-
-	}
-
-	class SearchTask extends AsyncTask<Void, Void, Boolean>
-	{
-		int		errorcode;
-		boolean	bfinish	= false;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			Log.d("SearchTask", "doInBackground");
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-			String jstr = Network.get_push(e_id, s_id, limit, offset);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				int count = jsobj.getInt("total");
-				if (msgcount - offset <= limit)
-					bfinish = true;
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-					searchresult.add_records(objrecords.toString(), count);
-				errorcode = Network.RESULT_TRUE;
-
-				return true;
-
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-		}
-
-		@Override
-		protected void onPostExecute(Boolean success)
-		{
-			Log.d("onPostExecute", "entry");
-			m_task = null;
-			// showProgress(false);
-
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-
-				if (bfinish)
-				{
-					// getListView().removeFooterView(view_page_footer);
-					// Toast.makeText(AnnouncementActivity.this, "Load all!",
-					// Toast.LENGTH_LONG).show();
-
-					TextView tv = (TextView) view_page_footer
-							.findViewById(R.id.text_page);
-					tv.setText("No more items");
-					tv.setEnabled(false);
-				}
-				else
-				{
-					TextView tv = (TextView) view_page_footer
-							.findViewById(R.id.text_page);
-					tv.setText("More...");
-					tv.setEnabled(true);
-				}
-				adapter.notifyDataSetChanged();
-				// getListAdapter().notifyDataSetChanged;
-				// BaseAdapter mJson = null;
-				// mJson.notifyDataSetChanged();
-			}
-
-			super.onPostExecute(success);
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			// showProgress(false);
-		}
-	}
-
-	private class SearchResult
-	{
-		List<Map<String, Object>>	datalist	= new ArrayList<Map<String, Object>>();
-
-		public int get_count()
-		{
-			return datalist.size();
-		}
-
-		public void add_records(String source, int count)
-		{
-			JSONObject objrecords;
-			try
-			{
-				objrecords = new JSONObject(source);
-
-				for (int i = 0; i < count; i++)
-				{
-					// offset++;
-					JSONObject objrec = objrecords.getJSONObject("record" + i);
-					String title = objrec.getString("title");
-					// String content = objrec.getString("content");
-					// String image = objrec.getString("image");
-					// String id = objrec.getString("id");
-					String url = objrec.getString("url");
-					// lastid = id;
-					Map<String, Object> map = new HashMap<String, Object>();
-					map.put("title", title);
-					// map.put("content", content);
-					// map.put("image", image);
-					// map.put("id", id);
-					map.put("url", url);
-					datalist.add(map);
-
-					// Iterator<?> it = rec.keys();
-					// HashMap<String, String> record = new HashMap<String,
-					// String>();
-					// while (it.hasNext()) // loop for each function
-					// {
-					// String field_name = (String) it.next();
-					// String val = rec.getString(field_name)
-					// .replace("\n", "");
-					// record.put(field_name, val);
-					// }
-					// records.add(record);
-
-				}
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-
-		}
-
-		public List<Map<String, Object>> getData()
-		{
-
-			return datalist;
-		}
-	}
-
-	private class AnnouncementAdapter extends BaseAdapter
-	{
-		private LayoutInflater	mInflater;	// 动态布局映射
-		private SearchResult	result;
-
-		// private Context context;
-		// private int i = 0;
-		public AnnouncementAdapter(SearchResult result, Context context)
-		{
-			this.result = result;
-			// this.context = context;
-			this.mInflater = LayoutInflater.from(context);
-		}
-
-		@Override
-		public int getCount()
-		{
-			// TODO Auto-generated method stub
-			return result.get_count();
-		}
-
-		@Override
-		public Object getItem(int position)
-		{
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		@Override
-		public long getItemId(int position)
-		{
-			// TODO Auto-generated method stub
-			return 0;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent)
-		{
-			// TODO Auto-generated method stub
-			convertView = mInflater.inflate(R.layout.message_detail_item, null);// 根据布局文件实例化view
-
-			TextView title = (TextView) convertView.findViewById(R.id.tv_title);// 找某个控件
-			title.setText(Html.fromHtml(result.getData().get(position)
-					.get("title").toString()));
-			// title.setMovementMethod(LinkMovementMethod.getInstance());
-			// title.setText(result.getData().get(position).get("title")
-			// .toString());// 给该控件设置数据(数据从集合类中来)
-			// TextView content = (TextView) convertView
-			// .findViewById(R.id.tv_content);
-			// content.setText(result.getData().get(position).get("content")
-			// .toString());
-			// if
-			// (result.getData().get(position).get("image").toString().length()
-			// > 0)
-			// {
-			// byte[] gzipBuff = Base64.decode(result.getData().get(position)
-			// .get("image").toString(), 0);
-			//
-			// ByteArrayInputStream memstream = new ByteArrayInputStream(
-			// gzipBuff, 0, gzipBuff.length);
-			//
-			// ByteArrayOutputStream baos = new ByteArrayOutputStream(
-			// gzipBuff.length);
-			// ImageView iv_thumb = (ImageView) convertView
-			// .findViewById(R.id.iv_thumb);
-			// try
-			// {
-			// baos.write(gzipBuff);
-			//
-			// Bitmap bmp = BitmapFactory.decodeStream(memstream);
-			//
-			// // ImageView image = new ImageView(this);
-			//
-			// iv_thumb.setImageBitmap(bmp);
-			// }
-			// catch (IOException e)
-			// {
-			// // TODO Auto-generated catch block
-			// e.printStackTrace();
-			// }
-			// }
-			// img.setBackgroundResource((Integer)jObject.get("img"));
-
-			return convertView;
-		}
-	}
-
-}

+ 0 - 646
Apex Mobile/app/src/main/java/com/usai/apex/Result/AMResultActivity.java

@@ -1,646 +0,0 @@
-package com.usai.apex.Result;
-
-import android.app.Dialog;
-import android.app.DownloadManager;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AlertDialog;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.CustomizeFieldsActivity;
-import com.usai.apex.R;
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.apex.pdf.PDFPreviewActivity;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * Created by macmini1 on 2018/2/23.
- */
-
-public class AMResultActivity extends SearchResultActivity {
-    TextView mtitleview;
-    private static int REQUEST_FIELD_SETTING = 1000;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-
-        setCustomActionBar();
-
-    }
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-        mtitleview= mActionBarView.findViewById(R.id.title);
-        String title = mParams.getString("title");
-        mtitleview.setText(title);
-        setTitle(title);
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarView, lp);
-//        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//        actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-    }
-//    @Override
-//    public void setTitle(CharSequence title) {
-////        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-////
-////        TextView mtitleviewtitleview = mActionBarView.findViewById(R.id.title);
-//
-//        if(title==null)
-//            title="";
-//        if(mtitleview!=null)
-//            mtitleview.setText(title);
-//    }
-    @Override
-    protected void loadData() {
-        if (mParams.getString("columns") == null) {
-            ArrayList<String> header_name = new ArrayList<String>();
-            ArrayList<String> header_aname = new ArrayList<String>();
-            getHeader(header_name, header_aname);
-            String fields = "";
-            Iterator<String> iterator = header_name.iterator();
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                fields = fields + name + ",";
-            }
-            if (fields.length() > 0) {
-                fields = fields.substring(0, fields.length() - 1);
-            }
-            mParams.putString("columns", fields);
-        }
-        super.loadData();
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
-//        resultListView.setAdapter(adapter);
-//
-//        Iterator<String> keyIterator = resultData.keys();
-//        ArrayList<String> keys = new ArrayList<>();
-//        while (keyIterator.hasNext()) {
-//            String key = keyIterator.next();
-//            keys.add(key);
-//        }
-//        for (int i = 0; i < keys.size(); i++) {
-//            String key = keys.get(i);
-//            resultData.remove(key);
-//        }
-//
-//        adapter.notifyDataSetChanged();
-
-        if (requestCode == REQUEST_FIELD_SETTING) {
-
-            ArrayList<String> header_name = new ArrayList<String>();
-            ArrayList<String> header_aname = new ArrayList<String>();
-            getHeader(header_name,header_aname);
-            String fields = "";
-            Iterator<String> iterator = header_name.iterator();
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                fields = fields + name + ",";
-            }
-            fields = fields.substring(0,fields.length() - 1);
-            mParams.putString("columns",fields);
-
-
-            loadData();
-
-        }
-
-    }
-
-    // 动态修改Menu
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-        menu.clear();
-
-
-        if (resultData != null && resultData.length() > 0) {
-            try {
-                JSONArray menu_json = resultData.getJSONArray("menu");
-
-                if (menu_json != null && menu_json.length() > 0) {
-
-                    for (int i = 0; i < menu_json.length(); i++) {
-                        JSONObject json = menu_json.getJSONObject(i);
-                        String title = json.getString("title");
-                        menu.add(0, i, 0, title);
-                    }
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-
-        int which = item.getItemId();
-
-        switch (item.getItemId())
-        {
-
-            case android.R.id.home:
-                finish();
-                break;
-            default:
-            {
-                try {
-                    JSONArray menu = resultData.getJSONArray("menu");
-                    JSONObject json = menu.getJSONObject(which);
-
-                    String actionType = json.getString("action");
-                    String url = json.optString("url");
-
-
-
-                    if (actionType.equals("field_setting")) {
-
-                        fieldSetting();
-                    } else if (actionType.equals("save")) {
-
-                        save();
-                    } else if (actionType.equals("download")) {
-
-                        export(url);
-                    }
-
-                } catch (JSONException exception) {
-                    Log.d("Result", "onClick: ",exception);
-                }
-            }
-        }
-
-
-
-        return true;
-    }
-
-
-    @Override
-    public void cellDoubleTapAction(final int position) {
-
-        final JSONArray content_action = contentAction();
-        if (content_action != null) {
-
-            try {
-                if (content_action.length() == 1) {
-
-                    JSONObject action = content_action.getJSONObject(0);
-                    String module = action.getString("module");
-
-                    if (module.equals("quick_look")) {
-
-                        showQuickLookForPosition(position,action);
-
-                    } else if (module.equals("detail")) {
-
-                        showDetailForPosition(position);
-                    }
-
-
-                } else if (content_action.length() > 1) {
-
-                    ArrayList<String> titleList = new ArrayList<>();
-
-                    for (int i = 0; i < content_action.length(); i++) {
-                        JSONObject json = content_action.getJSONObject(i);
-                        String title = json.getString("title");
-                        titleList.add(title);
-                    }
-
-                    new AlertDialog.Builder(mContext)
-                            .setSingleChoiceItems((String[])titleList.toArray(new String[titleList.size()]), -1, new DialogInterface.OnClickListener() {
-                                @Override
-                                public void onClick(DialogInterface dialog, int which) {
-
-                                    try {
-
-                                        JSONObject json = content_action.getJSONObject(which);
-                                        String module = json.getString("module");
-
-                                        if (module.equals("quick_look")) {
-
-                                            showQuickLookForPosition(position,json);
-                                        } else if (module.equals("detail")) {
-
-                                            showDetailForPosition(position);
-                                        }
-
-
-                                    } catch (JSONException exception) {
-                                        Log.d("Result", "onClick: ",exception);
-                                    }
-                                    dialog.dismiss();
-
-                                }
-                            })
-                            .show();
-                }
-
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-        }
-
-    }
-
-    public void showDetailForPosition(final int position) {
-
-        ArrayList<String> actions = getActions();
-        if (actions.size() < 1) {
-            return;
-        }
-
-        try {
-            JSONArray arr_col = contentLayout().getJSONObject("header").getJSONArray("col");
-            JSONArray item = contentData().getJSONArray("item_" + (position - 1));
-
-            String module_name = mParams.getString("module_name");
-            String detail_id = item.getString(arr_col.length());
-
-            Intent intent = new Intent(mContext, NewDetailActivity.class);
-            intent.putExtra("function_name", module_name);
-            intent.putExtra("actions_count", actions.size());
-            intent.putExtra("_id",detail_id);
-
-            Iterator<String> iterator = actions.iterator();
-            int i = 0;
-            while (iterator.hasNext()) {
-                String name = iterator.next();
-                intent.putExtra("action" + i++, name);
-            }
-            startActivity(intent);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-    @Override
-    public void showQuickLook(final JSONObject param, final String url) {
-
-        showProgressDialog("Please wait","Downloading...");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getExternalCacheDir().getAbsolutePath();//ApexTrackingApplication.getInstance().getDocumentDir();
-
-                // 下载文件
-                final File downloadFile = Network.downloadFile(RAUtil.Json2Bundle(param),url,cacheDir);
-
-                runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        progressDialog.dismiss();
-                        if (downloadFile != null && downloadFile.exists()) {
-                            String email = null,email_subject = null,email_content = null;
-                            try {
-                                //此处需要新增保存文档的本地表
-
-                                email=param.getString("email");
-                                email_subject=param.getString("email_subject");
-                                email_content=param.getString("email_content");
-
-                            } catch (JSONException e) {
-                                e.printStackTrace();
-                            }
-                            previewPDF(downloadFile.getAbsolutePath(),email,email_subject,email_content);
-                        } else {
-                            showAlert("Sorry,there is a wrong.");
-                        }
-                    }
-                });
-
-            }
-        }).start();
-
-
-    }
-    public void showQuickLookForPosition(final int position,JSONObject action) {
-
-        try {
-
-            JSONObject params = new JSONObject();
-            Iterator<String> iterator = action.getJSONObject("params").keys();
-            while (iterator.hasNext()) {
-                String key = iterator.next();
-                JSONArray item = contentData().getJSONArray("item_" + (position - 1));
-                int idx = action.getJSONObject("params").getInt(key);
-                params.put(key,item.get(idx));
-            }
-
-            String url = action.getString("url");
-//            String module_name = mParams.getString("module_name");
-
-            showQuickLook(params,url);
-//            downloaddoc(url);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-
-    protected void previewPDF(String file,String email,String subject,String content) {
-        Intent myIntent = new Intent();
-        myIntent = new Intent(AMResultActivity.this, PDFPreviewActivity.class);
-
-        myIntent.putExtra("file",file);
-        myIntent.putExtra("iscache",true);
-
-        try {
-            JSONObject json = new JSONObject();
-//            email = "66666@qq.com";
-//            subject = "test subject";
-//            content = "test body";
-            if (email != null) {
-                json.put("email",email);
-            }
-            if (subject != null) {
-                json.put("subject",subject);
-            }
-            if (content != null) {
-                json.put("content",content);
-            }
-            myIntent.putExtra("email",json.toString());
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-
-        startActivity(myIntent);
-    }
-
-    private void downloaddoc(String url)
-    {
-
-            // if (true)
-            // return;
-//            URLSpan span[] = ((TextView) v).getUrls();
-//            if (span.length < 1)
-//                return;
-//            span[0].getURL();
-//            Log.d("Text", span[0].getURL());
-//
-//            TextView tv = (TextView)v;
-
-            final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
-
-            Uri uri = Uri.parse(url);
-            final DownloadManager.Request request = new DownloadManager.Request(uri);
-
-            // 设置允许使用的网络类型,这里是移动网络和wifi都可以
-            request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE
-                    | DownloadManager.Request.NETWORK_WIFI);
-
-            request.setDestinationInExternalPublicDir("Apex Mobile",url);
-
-            // 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限:android.permission.DOWNLOAD_WITHOUT_NOTIFICATION
-            // request.setShowRunningNotification(false);
-
-            // 不显示下载界面
-            request.setVisibleInDownloadsUi(false);
-            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
-
-							/*
-							 * 设置下载后文件存放的位置,如果sdcard不可用,那么设置这个将报错,
-							 * 因此最好不设置如果sdcard可用,下载后的文件 在/mnt/sdcard/Android/
-							 * data/packageName/files目录下面
-							 * ,如果sdcard不可用,设置了下面这个将报错,不设置,下载后的文件在/cache这个 目录下面
-							 */
-            // request.setDestinationInExternalFilesDir(this,
-            // null, "tar.apk");
-
-            android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(
-                    AMResultActivity.this);
-            builder.setMessage(getString(R.string.str_downloadmessage));
-
-            builder.setTitle(getString(R.string.str_confirmdownload));
-
-            builder.setPositiveButton(
-                    getString(R.string.str_download),
-                    new Dialog.OnClickListener()
-                    {
-
-                        @Override
-                        public void onClick(
-                                DialogInterface dialog,
-                                int which)
-                        {
-                            downloadManager.enqueue(request);
-                            dialog.dismiss();
-
-                        }
-                    });
-
-            builder.setNegativeButton(
-                    getString(R.string.str_cancel),
-                    new Dialog.OnClickListener()
-                    {
-
-                        @Override
-                        public void onClick(
-                                DialogInterface dialog,
-                                int which)
-                        {
-                            dialog.dismiss();
-                        }
-                    });
-
-            builder.create().show();
-
-
-    }
-
-    public void getHeader(ArrayList<String> header_name, ArrayList<String> header_aname) {
-
-        String module_name = mParams.getString("module_name");
-        String user = ApexTrackingApplication.get_user();
-
-        SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-        Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
-                "_id" }, "function_name='" + module_name + "' and user='"
-                + user + "' and behavior=" + Network.BEHAVIOR_RESULT
-                + " and show = 1", null, null, null, "priority , aname", null);
-        while (cursor.moveToNext())
-        {
-            String aname = cursor.getString(0);
-            String name = cursor.getString(1);
-
-            header_name.add(name);
-            header_aname.add(aname);
-        }
-        dbUtil.CloseCursor(cursor);
-        dbUtil.CloseDB(db);
-    }
-
-    public ArrayList<String> getActions() {
-
-        String module_name = mParams.getString("module_name");
-
-        SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-        Cursor cursor = db.query("actions_info",
-                new String[] { "name" }, "function_name='"
-                        + module_name + "' and user='" + ApexTrackingApplication.get_user() + "'", null,
-                null, null, "priority", null);
-
-        ArrayList<String> actions = new ArrayList<>();
-
-        while (cursor.moveToNext())
-        {
-            String name = cursor.getString(0);
-            actions.add(name);
-        }
-        dbUtil.CloseCursor(cursor);
-        dbUtil.CloseDB(db);
-
-        return actions;
-
-    }
-
-    public void save() {
-
-        final View edit = new EditText(this);
-        new android.app.AlertDialog.Builder(this)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
-                .setTitle(R.string.str_createname)
-                .setView(edit)
-                .setPositiveButton(android.R.string.ok,
-                        new DialogInterface.OnClickListener()
-                        {
-                            public void onClick(DialogInterface dialog,
-                                                int whichButton)
-                            {
-                                String name = ((EditText) edit)
-                                        .getText().toString();
-
-                                if(TextUtils.isEmpty(name))
-                                {
-                                    new android.app.AlertDialog.Builder(AMResultActivity.this)
-                                            .setTitle("Warning")
-                                            .setMessage("Name can not be empty.")
-
-                                            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                                @Override
-                                                public void onClick(DialogInterface dialog, int which) {
-
-                                                }
-                                            })
-                                            .show();
-                                    return;
-                                }
-
-                                String param = getIntent().toUri(0);
-
-                                JSONObject obj = new JSONObject();
-                                Set<String> keys = mParams.keySet();
-                                for (String key : keys)
-                                {
-
-
-                                    try
-                                    {
-                                        obj.put(key, mParams.get(key).toString());
-
-                                    }
-                                    catch (JSONException e)
-                                    {
-                                        // TODO Auto-generated catch block
-                                        e.printStackTrace();
-                                    }
-
-                                }
-                                obj.toString();
-
-                                SQLiteDatabase db = dbUtil.OpenDB(
-                                        ApexTrackingApplication.get_instance(), null, true);
-                                db.execSQL("insert into history(params,name,criterion,module_name,user,create_time) values('"
-
-                                        + param
-                                        + "','"
-                                        + name
-                                        + "','"
-                                        + obj.toString()
-                                        + "','"
-                                        + mParams.getString("module_name")
-                                        + "','"
-                                        + ApexTrackingApplication.get_user()
-                                        + "',"
-                                        + System.currentTimeMillis() + ")");
-                                dbUtil.CloseDB(db);
-
-										/* User clicked OK so do some stuff */
-                            }
-                        })
-                .setNegativeButton(android.R.string.cancel,
-                        new DialogInterface.OnClickListener()
-                        {
-                            public void onClick(DialogInterface dialog,
-                                                int whichButton)
-                            {
-
-										/* User clicked cancel so do some stuff */
-                            }
-                        }).create().show();
-    }
-
-    public void fieldSetting() {
-
-        Intent intent = new Intent();
-        intent.setClass(this, CustomizeFieldsActivity.class);
-        intent.putExtra("user", ApexTrackingApplication.get_user());
-        intent.putExtra("function_name", mParams.getString("module_name"));
-        intent.putExtra("behavior", Network.BEHAVIOR_RESULT);
-        startActivityForResult(intent,REQUEST_FIELD_SETTING);
-
-    }
-
-}

+ 0 - 348
Apex Mobile/app/src/main/java/com/usai/apex/Result/PullRefreshListView.java

@@ -1,348 +0,0 @@
-package com.usai.apex.Result;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.RotateAnimation;
-import android.widget.AbsListView;
-import android.widget.ListView;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class PullRefreshListView extends ListView implements AbsListView.OnScrollListener {
-
-    /**
-     * 头布局
-     */
-    private View headerView;
-
-    /**
-     * 头部布局的高度
-     */
-    private int headerViewHeight;
-
-    /**
-     * 底部布局
-     */
-    private View footerView;
-
-
-    /**
-     * 底部布局的高度
-     */
-    private int footerViewHeight;
-
-
-    /**
-     * 按下时的Y坐标
-     */
-    private int downY;
-
-    public static final int PULL_REFRESH = 0;//下拉刷新的状态
-    public static final int RELEASE_REFRESH = 1;//松开刷新的状态
-    public static final int REFRESHING = 2;//正在刷新的状态
-
-    /**
-     * 当前下拉刷新处于的状态
-     */
-    private int currentState = PULL_REFRESH;
-
-    /**
-     * 头部布局在下拉刷新改变时,图标的动画
-     */
-    private RotateAnimation upAnimation,downAnimation;
-
-    private boolean isLoadingMore = false;
-    private boolean isRefreshing = false;
-
-    public PullRefreshListView(Context context) {
-        this(context,null);
-    }
-
-    public PullRefreshListView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        init();
-    }
-
-    private void init(){
-        //设置滑动监听
-        setOnScrollListener(this);
-        //初始化头布局
-        initHeaderView();
-        //初始化头布局中图标的旋转动画
-        initRotateAnimation();
-        //初始化为尾布局
-        initFooterView();
-    }
-
-    @Override
-    public void setLayoutParams(ViewGroup.LayoutParams params) {
-        super.setLayoutParams(params);
-    }
-
-    /**
-     * 初始化headerView
-     */
-    private void initHeaderView() {
-
-//        headerView =  View.inflate(getContext(), R.layout.refresh_header, null);
-        if (headerView != null) {
-            //测量headView的高度
-            headerView.measure(0, 0);
-            //获取高度,并保存
-            headerViewHeight = headerView.getMeasuredHeight();
-            //设置paddingTop = -headerViewHeight;这样,该控件被隐藏
-//            headerView.setPadding(0, -headerViewHeight, 0, 0);
-            headerStateChange(currentState,-headerViewHeight);
-            //添加头布局
-            addHeaderView(headerView);
-        }
-    }
-
-    /**
-     * 初始化旋转动画
-     */
-    private void initRotateAnimation() {
-
-        upAnimation = new RotateAnimation(0, -180,
-                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
-                RotateAnimation.RELATIVE_TO_SELF, 0.5f);
-        upAnimation.setDuration(300);
-        upAnimation.setFillAfter(true);
-
-        downAnimation = new RotateAnimation(-180, -360,
-                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
-                RotateAnimation.RELATIVE_TO_SELF, 0.5f);
-        downAnimation.setDuration(300);
-        downAnimation.setFillAfter(true);
-    }
-
-    //初始化底布局,与头布局同理
-    private void initFooterView() {
-
-//        footerView =  View.inflate(getContext(), R.layout.refresh_footer, null);
-        if (footerView != null) {
-            footerView.measure(0, 0);
-            footerViewHeight = footerView.getMeasuredHeight();
-//            footerView.setPadding(0, -footerViewHeight, 0, 0);
-            footerStateChange(PULL_REFRESH, -footerViewHeight);
-            addFooterView(footerView);
-        }
-    }
-
-    public void setRefreshHeader(View header) {
-        headerView = header;
-        initHeaderView();
-    }
-
-    public void setRefreshFooter(View footer) {
-        footerView = footer;
-        initFooterView();
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-
-        if (headerView == null) {
-            return super.onTouchEvent(ev);
-        }
-
-        switch (ev.getAction()) {
-            case MotionEvent.ACTION_DOWN:
-                //获取按下时y坐标
-                downY = (int) ev.getY();
-                break;
-            case MotionEvent.ACTION_MOVE:
-
-                if(currentState==REFRESHING){
-                    //如果当前处在滑动状态,则不做处理
-                    break;
-                }
-                //手指滑动偏移量
-                int deltaY = (int) (ev.getY() - downY);
-
-                //获取新的padding值
-                int paddingTop = -headerViewHeight + deltaY;
-
-                if(paddingTop>-headerViewHeight && getFirstVisiblePosition()==0){
-                    //向下滑,且处于顶部,设置padding值,该方法实现了顶布局慢慢滑动显现
-//                    headerView.setPadding(0, paddingTop, 0, 0);
-
-
-                    if(paddingTop>=0 && currentState==PULL_REFRESH){
-
-                        //从下拉刷新进入松开刷新状态
-                        currentState = RELEASE_REFRESH;
-                    }else if (paddingTop<0 && currentState==RELEASE_REFRESH) {
-
-                        //进入下拉刷新状态
-                        currentState = PULL_REFRESH;
-                    }
-
-                    headerStateChange(currentState,paddingTop);
-
-                    return true;//拦截TouchMove,不让listview处理该次move事件,会造成listview无法滑动
-                }
-
-
-                break;
-            case MotionEvent.ACTION_UP:
-
-                if(currentState==PULL_REFRESH){
-                    //仍处于下拉刷新状态,未滑动一定距离,不加载数据,隐藏headView
-//                    headerView.setPadding(0, -headerViewHeight, 0, 0);
-                    headerStateChange(currentState,-headerViewHeight);
-
-                }else if (currentState==RELEASE_REFRESH) {
-
-                    //滑倒一定距离,显示无padding值得headcView
-//                    headerView.setPadding(0, 0, 0, 0);
-
-                    //设置状态为刷新
-                    currentState = REFRESHING;
-
-                    //刷新头部布局
-                    headerStateChange(currentState,0);
-
-                }
-                break;
-        }
-        return super.onTouchEvent(ev);
-    }
-
-
-    private void headerStateChange(int state,int offset) {
-
-        if (state == REFRESHING) {
-            isRefreshing = true;
-        }
-
-        if (headerView == null) {
-            return;
-        }
-
-        headerView.setPadding(0, offset, 0, 0);
-        if (listener != null) {
-            listener.onHeaderStateChange(state,offset);
-        }
-    }
-
-    private void footerStateChange(int state,int offset) {
-
-        if (state == REFRESHING) {
-            isRefreshing = true;
-        }
-
-        if (footerView == null) {
-            return;
-        }
-
-        footerView.setPadding(0, offset, 0, 0);
-
-        if (listener != null) {
-            listener.onFooterStateChange(state,offset + footerViewHeight);
-        }
-    }
-
-    /**
-     * 完成刷新操作,重置状态,在你获取完数据并更新完adater之后,去在UI线程中调用该方法
-     */
-    public void completeRefresh(){
-
-        isRefreshing = false;
-        if(isLoadingMore){
-
-            //重置footerView状态
-//            footerView.setPadding(0, -footerViewHeight, 0, 0);
-            isLoadingMore = false;
-            footerStateChange(PULL_REFRESH,-footerViewHeight);
-        } else {
-
-            //重置headerView状态
-//            headerView.setPadding(0, -headerViewHeight, 0, 0);
-            currentState = PULL_REFRESH;
-            headerStateChange(currentState,-headerViewHeight);
-        }
-    }
-
-    /**
-     * 获取当前系统时间,并格式化
-     * @return
-     */
-    private String getCurrentTime(){
-        SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
-        return format.format(new Date());
-    }
-
-    private OnRefreshListener listener;
-    public void setOnRefreshListener(OnRefreshListener listener){
-        this.listener = listener;
-    }
-    public interface OnRefreshListener{
-        void onHeaderStateChange(int state, int offset);
-        void onFooterStateChange(int state, int offset);
-        void shouldPullDownToRefresh(boolean should);
-    }
-
-    /**
-     * SCROLL_STATE_IDLE:闲置状态,就是手指松开
-     * SCROLL_STATE_TOUCH_SCROLL:手指触摸滑动,就是按着来滑动
-     * SCROLL_STATE_FLING:快速滑动后松开
-     */
-    @Override
-    public void onScrollStateChanged(AbsListView view, int scrollState) {
-
-        if (footerView == null) {
-            return;
-        }
-
-        if(scrollState==OnScrollListener.SCROLL_STATE_IDLE
-                && getLastVisiblePosition()==(getCount()-1) &&!isLoadingMore){
-            if (!isRefreshing) {
-
-                isRefreshing = true;
-                isLoadingMore = true;
-
-//                footerView.setPadding(0, 0, 0, 0);//显示出footerView
-                footerStateChange(REFRESHING,0);
-
-                setSelection(getCount());//让listview最后一条显示出来,在页面完全显示出底布局
-
-            }
-        }
-    }
-
-
-
-    public int getOffsetY() {
-        View c = getChildAt(0);
-        if (c == null) {
-            return 0;
-        }
-        int firstVisiblePosition = getFirstVisiblePosition();
-        int top = c.getTop();
-        return -top + firstVisiblePosition * c.getHeight() ;
-    }
-
-    @Override
-    public void onScroll(AbsListView view, int firstVisibleItem,
-                         int visibleItemCount, int totalItemCount) {
-
-
-        if (listener != null) {
-            if (getOffsetY() == 0) {
-                listener.shouldPullDownToRefresh(true);
-            } else {
-                listener.shouldPullDownToRefresh(false);
-            }
-        }
-
-        Log.d("Didida", "onScroll: " + firstVisibleItem + "  " + getOffsetY());
-
-    }
-
-}

+ 0 - 1361
Apex Mobile/app/src/main/java/com/usai/apex/Result/SearchResultActivity.java

@@ -1,1361 +0,0 @@
-package com.usai.apex.Result;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.database.DataSetObserver;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.drawable.ColorDrawable;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.content.FileProvider;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-import android.text.Html;
-import android.text.Layout;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.GestureDetector;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.BaseAdapter;
-import android.widget.HorizontalScrollView;
-import android.widget.RelativeLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-//import com.usai.redant.Detail.KVDetailActivity;
-//import com.usai.redant.Detail.OrderDetailActivity;
-//import com.usai.apex.redantmobile.BuildConfig;
-
-//import static com.usai.redant.CommonEditor.CommonEditorActivity.URL_REMOTE;
-
-
-public class SearchResultActivity extends AppCompatActivity {
-
-    public static SearchResultActivity instance = null;
-    protected Bundle mParams;
-    protected JSONObject resultData = new JSONObject();
-
-    protected Context mContext;
-    protected PullRefreshListView resultListView;
-    protected ResultAdapter adapter;
-    protected SwipeRefreshLayout resultSwipe;
-    protected View list_footer;
-    protected View refresh_footer;
-
-    private View clickedView;
-    private View.OnTouchListener resultRowClickListener;
-    private GestureDetector detector;
-
-    protected int footer_height;
-    protected int header_height;
-
-    ProgressDialog progressDialog;
-    public boolean isLoading = false;//表示是否正处于加载状态
-
-
-    public void cellDoubleTapAction(int position) {
-
-//        try {
-//
-//            JSONArray row_action = resultData.optJSONArray("row_action");
-//            if (row_action != null) {
-//
-//                if (row_action.length() == 1) {
-//
-//                    JSONObject action = row_action.getJSONObject(0);
-//                    String module = action.getString("module");
-//
-//                    if (module.equals("quick_look")) {
-//                        JSONObject param = action.getJSONObject("params");
-//                        String url = action.getString("url");
-//                        showQuickLook(param,url);
-//                    } else if (module.equals("kv_detail")) {
-//                        JSONObject params = new JSONObject();
-//                        params.put("query_id",mParams.get("query_id"));
-//
-//                        JSONObject criteria = new JSONObject();
-//                        JSONObject action_params = action.getJSONObject("params");
-//                        Iterator<String> iterator = action_params.keys();
-//                        while (iterator.hasNext()) {
-//                            String key = iterator.next();
-//                            JSONArray item = contentData().getJSONArray("item_" + position);
-//                            int idx = action_params.getInt(key);
-//                            criteria.put(key,item.get(idx));
-//                        }
-//
-//                        params.put("criteria",criteria.toString());
-//                        showKVDetail(params);
-//
-//                    } else if (module.equals("order_detail")) {
-//
-//                        showOrderDetail();
-//
-//                    }
-//
-//
-//                } else if (row_action.length() > 1) {
-//
-//                    ArrayList<String> titleList = new ArrayList<>();
-//
-//                    for (int i = 0; i < row_action.length(); i++) {
-//                        JSONObject json = row_action.getJSONObject(i);
-//                        String title = json.getString("title");
-//                        titleList.add(title);
-//                    }
-//
-//                    new AlertDialog.Builder(mContext)
-//                            .setSingleChoiceItems((String[])titleList.toArray(new String[titleList.size()]), -1, new DialogInterface.OnClickListener() {
-//                                @Override
-//                                public void onClick(DialogInterface dialog, int which) {
-//
-//                                    try {
-//                                        JSONArray content_action = resultData.getJSONArray("row_action");
-//                                        JSONObject json = content_action.getJSONObject(which);
-//                                        String module = json.getString("module");
-//                                        JSONObject add_params = json.getJSONObject("params");
-//
-//                                        if (module.equals("quick_look")) {
-//                                            JSONObject param = json.getJSONObject("params");
-//                                            String url = json.getString("url");
-//                                            showQuickLook(param,url);
-//                                        } else if (module.equals("kv_detail")) {
-//
-//                                            JSONObject params = json.getJSONObject("params");
-//                                            showKVDetail(params);
-//
-//                                        } else if (module.equals("order_detail")) {
-//
-//                                            showOrderDetail();
-//
-//                                        }
-//
-//
-//                                    } catch (JSONException exception) {
-//                                        Log.d("Result", "onClick: ",exception);
-//                                    }
-//                                    dialog.dismiss();
-//
-//                                }
-//                            })
-//                            .show();
-//
-//                }
-//
-//            }
-//
-//        } catch (JSONException exception) {
-//            Log.e("Result", "onDoubleTapEvent: ",exception);
-//        }
-    }
-
-    void setMargin(View view,int l,int t,int r,int b) {
-        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(view.getLayoutParams());
-        lp.setMargins(l, t, r, b);
-        view.setLayoutParams(lp);
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        if (progressDialog != null) {
-            progressDialog.dismiss();
-            progressDialog = null;
-        }
-    }
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_search_result);
-
-        instance = this;
-        mContext = this;
-        footer_height = dp2px(this,30);
-        header_height = dp2px(this,60);
-
-        resultListView = (PullRefreshListView) findViewById(R.id.result_table_list);
-        resultSwipe = findViewById(R.id.result_swipe);
-
-        progressDialog = new ProgressDialog(mContext);
-        progressDialog.setCancelable(false);
-
-        initClickListener();
-
-
-        adapter = new ResultAdapter(mContext);
-        resultListView.setAdapter(adapter);
-        resultListView.setDividerHeight(0);
-
-        // refresh header & footer
-        list_footer = View.inflate(this, R.layout.refresh_footer, null);
-        resultListView.setRefreshFooter(list_footer);
-
-        refresh_footer = findViewById(R.id.result_refresh_footer);
-        refresh_footer.bringToFront();
-
-        resultListView.setOnRefreshListener(new PullRefreshListView.OnRefreshListener() {
-            @Override
-            public void onHeaderStateChange(int state, int offset) {
-                Log.d("Pull Down", "onHeaderStateChange: " + offset);
-//                setMargin(refresh_header,0,offset,0,0);
-//                if (state == PullRefreshListView.REFRESHING) {
-//                   loadData();
-//                }
-            }
-
-            @Override
-            public void onFooterStateChange(int state, int offset) {
-
-                setMargin(refresh_footer,0,resultListView.getHeight() - offset,0,0);
-                if (state == PullRefreshListView.REFRESHING) {
-                    if (!isLoading) {
-                        loadMore();
-                    }
-                }
-            }
-
-            @Override
-            public void shouldPullDownToRefresh(boolean should) {
-                resultSwipe.setEnabled(should);
-            }
-        });
-
-        resultSwipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                if (isLoading) {
-                    resultSwipe.setRefreshing(false);
-                } else {
-                    loadData();
-                }
-            }
-        });
-
-
-
-        if (savedInstanceState != null) {
-            mParams = savedInstanceState.getBundle("query_params");
-        } else {
-            mParams = getIntent().getBundleExtra("query_params");
-        }
-
-        if (mParams == null) {
-            mParams = new Bundle();
-        }
-
-        String title = mParams.getString("title");
-        setTitle(title);
-
-        loadData();
-
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        outState.putBundle("query_params",mParams);
-    }
-
-    // 动态修改Menu
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-        menu.clear();
-
-
-//        if (resultData != null) {
-//            try {
-//                JSONArray menu_json = resultData.getJSONArray("menu");
-//
-//                if (menu_json != null && menu_json.length() > 0) {
-//
-//                    for (int i = 0; i < menu_json.length(); i++) {
-//                        JSONObject json = menu_json.getJSONObject(i);
-//                        String title = json.getString("title");
-//                        menu.add(0, i, 0, title);
-//                    }
-//                }
-//            } catch (JSONException e) {
-//                e.printStackTrace();
-//            }
-//        }
-
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-
-//        int which = item.getItemId();
-//        try {
-//            JSONArray menu = resultData.getJSONArray("menu");
-//            JSONObject json = menu.getJSONObject(which);
-//
-//            String actionType = json.getString("action");
-//            String url = json.optString("url");
-//
-//            if (actionType.equals("download")) {
-//                export(url);
-//            } else if (actionType.equals("save")) {
-//                if(BuildConfig.DEBUG && true){
-//                    //do something for assert aim
-//                    Log.e("Result", "onOptionsItemSelected DialogClick: not implement");
-//                }
-//            }
-//
-//        } catch (JSONException exception) {
-//            Log.d("Result", "onClick: ",exception);
-//        }
-
-        return true;
-    }
-
-
-//    public int last_index;
-//    public int total_index;
-//
-//    @Override
-//    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-//        last_index = firstVisibleItem+visibleItemCount;
-//        total_index = totalItemCount;
-//    }
-//
-//    @Override
-//    public void onScrollStateChanged(AbsListView view, int scrollState) {
-//        if(last_index == total_index && (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE))
-//        {
-//            // 表示此时需要显示刷新视图界面进行新数据的加载(要等滑动停止)
-//            if(!isLoading)
-//            {
-//                // 设置刷新界面可见
-//                footer.setVisibility(View.VISIBLE);
-//                loadMore();
-//            }
-//        }
-//    }
-
-    // 设置header 和 footer宽度,否则listView会显示默认宽度
-    protected void setupUI() {
-        try {
-            if (resultData == null) {
-                return;
-            } else {
-                int result = resultData.getInt("result");
-                if (result != 2) {
-                    return;
-                }
-            }
-            JSONObject layout = resultData.getJSONObject("layout");
-
-            JSONObject header = layout.getJSONObject("header");
-            int width = header.getInt("width");
-            width = convertDp2Px(width);
-
-            AbsListView.LayoutParams footerLayoutParams = (AbsListView.LayoutParams)list_footer.getLayoutParams();
-            if (footerLayoutParams == null) {
-                footerLayoutParams = new AbsListView.LayoutParams(width,footer_height);
-            }
-            footerLayoutParams.height = footer_height;
-            footerLayoutParams.width = width;
-            list_footer.setLayoutParams(footerLayoutParams);
-
-
-        } catch (JSONException e) {
-            Log.e("Result", "setupUI: ", e);
-        }
-
-    }
-
-    public void loadComplete() {
-
-        setupUI();
-        resultListView.completeRefresh();
-        if (resultSwipe.isRefreshing()) {
-            resultSwipe.setRefreshing(false);
-        }
-        resultListView.forceLayout();
-
-        isLoading = false;//设置正在刷新标志位false
-        invalidateOptionsMenu();
-
-        String title = resultData.optString("table_title");
-        setTitleColor(Color.BLACK);
-        setTitle(title);
-
-        progressDialog.dismiss();
-    }
-
-
-    protected void showProgressDialog(String title, String msg) {
-        progressDialog.setTitle(title);
-        progressDialog.setMessage(msg);
-        progressDialog.show();
-    }
-
-    JSONObject readRawFile(int id)
-    {
-        String content;
-        Resources resources=this.getResources();
-        InputStream is=null;
-        try{
-            is=resources.openRawResource(id);
-            byte buffer[]=new byte[is.available()];
-            is.read(buffer);
-            content=new String(buffer);
-            JSONObject json = new JSONObject(content);
-            return json;
-        }
-        catch(IOException e)
-        {
-            e.printStackTrace();
-        }
-        catch (JSONException e) {
-            e.printStackTrace();
-        }
-        finally
-        {
-            if(is!=null)
-            {
-                try{
-                    is.close();
-                }catch(IOException e)
-                {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return null;
-    }
-
-    protected void loadData() {
-
-//        resultData = readRawFile(R.raw.predef_query);
-//        if (1 == 1) {
-//            return;
-//        }
-
-        if (isLoading) {
-            return;
-        }
-
-        isLoading = true;
-
-        showProgressDialog(null,"Loading");
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                try {
-
-                    mParams.putInt("offset",0);
-                    mParams.putInt("limit",25);
-                    JSONObject new_resultData = Network.query(mParams);
-
-                    if (new_resultData != null) {
-                        Iterator<String> iterator = new_resultData.keys();
-                        while (iterator.hasNext()) {
-                            String key = iterator.next();
-                            Object value = new_resultData.get(key);
-                            resultData.put(key,value);
-                        }
-                    }
-
-                    runOnUiThread(new Runnable() {
-                        @Override
-                        public void run() {
-
-                            loadComplete();
-                            int result = resultData.optInt("result",0);
-                            if (result == 2) {
-
-                            } else {
-
-                                String msg = resultData.optString("msg");
-                                if (msg == null || msg.isEmpty()) {
-                                    msg = "Sorry,some error occurred";
-                                }
-
-                                new AlertDialog.Builder(mContext)
-                                        .setTitle("Warning")
-                                        .setMessage(msg)
-                                        .show();
-                            }
-
-                            adapter.notifyDataSetChanged();
-                        }
-                    });
-
-                } catch (Exception e) {
-                    Log.e("Result", "onCreate: ",e);
-                }
-
-
-
-
-            }
-        }).start();
-
-    }
-
-    protected void loadMore() {
-
-        if (isLoading) {
-            return;
-        }
-
-        isLoading = true;
-        showProgressDialog(null,"Loading");
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                try {
-
-//                    Thread.sleep(2000);
-//
-//                    InputStream in = getResources().openRawResource( R.raw.result);
-//                    int length = in.available();
-//                    byte[] buffer = new byte[length];
-//                    in.read(buffer);
-//                    String res = new String(buffer,"utf8");
-//                    in.close();
-//
-//                    JSONObject newJson = new JSONObject(res);
-
-                    mParams.putInt("offset",adapter.getCount());
-                    mParams.putInt("limit",25);
-                    JSONObject newJson = Network.query(mParams);
-
-                    if (newJson != null) {
-
-                        int result = newJson.getInt("result");
-                        if (result == 2) {
-                            JSONObject newData = newJson.getJSONObject("data");
-                            int add_count = newData.getInt("count");
-
-                            JSONObject data = resultData.getJSONObject("data");
-                            int count = data.getInt("count");
-
-                            for (int i = 0; i < add_count; i++) {
-                                JSONArray new_data_item = newData.getJSONArray("item_" + i);
-                                if (new_data_item != null) {
-                                    data.put("item_" + count++,new_data_item);
-                                }
-                            }
-                            data.put("count",count);
-                            resultData.put("data",data);
-
-                            runOnUiThread(new Runnable() {
-                                @Override
-                                public void run() {
-
-                                    loadComplete();
-                                    adapter.notifyDataSetChanged();
-                                }
-                            });
-                        } else {
-                            String msg = newJson.optString("msg");
-                            if (msg == null || msg.isEmpty()) {
-                                msg = "Some error occurred";
-                            }
-                            showAlert(msg);
-                        }
-
-
-                    }
-
-
-                } catch (Exception e) {
-                    Log.e("Result", "onCreate: ",e);
-                    showAlert("Some error occurred");
-                }
-
-
-
-
-            }
-        }).start();
-    }
-
-    protected JSONObject contentData() {
-        try {
-            return resultData.getJSONObject("data");
-        } catch (JSONException e) {
-            Log.e("Result", "contentData: ", e);
-        }
-        return null;
-    }
-
-    protected JSONArray contentMenu() {
-        if (resultData != null) {
-            try {
-                JSONArray menu_json = resultData.getJSONArray("menu");
-                return menu_json;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-    protected JSONArray contentAction() {
-        if (resultData != null) {
-            try {
-                JSONArray action_json = resultData.getJSONArray("row_action");
-                return action_json;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-
-    protected JSONObject contentLayout() {
-        if (resultData != null) {
-            try {
-                JSONObject layout = resultData.getJSONObject("layout");
-                return layout;
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        return null;
-
-    }
-
-
-    private class GestureListener extends GestureDetector.SimpleOnGestureListener {
-
-        @Override
-        public boolean onDoubleTapEvent(MotionEvent e) {
-
-
-            if (e.getAction() == MotionEvent.ACTION_UP) {
-
-                TableRow cellRow = (TableRow)clickedView.getParent();
-                RelativeLayout cell = (RelativeLayout)cellRow.getParent();
-
-                int position = resultListView.getPositionForView(cell);
-//                Log.d("Result", "onDoubleTapEvent: " + position);
-
-                if (position == 0) {
-                    return false;
-                }
-
-                cellDoubleTapAction(position);
-
-            }
-
-            return false;
-        }
-
-        @Override
-        public boolean onSingleTapConfirmed(MotionEvent e) {
-            if (clickedView instanceof TextView) {
-                TextView tv = (TextView)clickedView;
-                if (ellipsisTextView(tv)) {
-                    showAlert(tv.getText().toString());
-                }
-            }
-            return false;
-        }
-    }
-
-    private int normalColor;
-    private int touchColor = Color.GRAY;
-    private void initClickListener() {
-
-        // 需要作为成员变量
-        detector = new GestureDetector(mContext, new GestureListener());
-
-        resultRowClickListener = new View.OnTouchListener() {
-
-            @Override
-            public boolean onTouch(View v, MotionEvent event) {
-
-                TableRow cellRow = (TableRow)v.getParent();
-                RelativeLayout cell = (RelativeLayout)cellRow.getParent();
-
-                int position = resultListView.getPositionForView(cell);
-
-                if (position == 0) {
-                    return false;
-                }
-
-
-//                View cellRow = (View) v.getParent();
-                if (event.getAction() == MotionEvent.ACTION_DOWN) {
-
-                    if (clickedView != null) {
-                        ((View)clickedView.getParent()).setBackgroundColor(normalColor);
-                    }
-
-                    normalColor = ((ColorDrawable)cellRow.getBackground()).getColor();
-                    cellRow.setBackgroundColor(touchColor);
-
-                } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
-//                    cell.setBackgroundColor(normalColor);
-                }
-
-                clickedView = v;
-
-                detector.onTouchEvent(event);
-
-                return true;
-            }
-        };
-
-    }
-
-
-
-    protected class ResultAdapter extends BaseAdapter {
-
-        @Override
-        public boolean areAllItemsEnabled() {
-            return true;
-        }
-
-        @Override
-        public boolean isEnabled(int position) {
-            return true;
-        }
-
-        private class ResultHoder {
-            public ResultHoder(View view) {
-                row = (TableRow)view.findViewById(R.id.result_row);
-                view.setTag(this);
-            }
-            TableRow row;
-        }
-
-        public ResultAdapter(Context ctx) {
-
-        }
-
-        @Override
-        public void registerDataSetObserver(DataSetObserver observer) {
-            super.registerDataSetObserver(observer);
-        }
-
-        @Override
-        public void unregisterDataSetObserver(DataSetObserver observer) {
-            super.unregisterDataSetObserver(observer);
-        }
-
-        @Override
-        public int getCount() {
-            if (resultData == null) {
-                return 0;
-            } else {
-                int result = resultData.optInt("result");
-                if (result != 2) {
-                    return 0;
-                }
-            }
-            try {
-                JSONObject data = resultData.getJSONObject("data");
-                int result_count = data.getInt("count");
-                return result_count + 1; // header + data
-
-            } catch (JSONException e) {
-                Log.e("Result", "getCount: ", e);
-                return 0;
-            }
-        }
-
-        @Override
-        public Object getItem(int position) {
-            try {
-                if (position == 0) {
-                    // header
-
-                    JSONObject layout = resultData.getJSONObject("layout");
-                    JSONObject header = layout.getJSONObject("header");
-                    JSONArray col = header.getJSONArray("col");
-
-                    return col;
-
-                } else {
-                    // result row
-
-                    JSONObject data = resultData.getJSONObject("data");
-                    JSONArray item = data.getJSONArray("item_" + (position - 1));
-
-                    return item;
-                }
-
-
-            } catch (JSONException e) {
-                Log.e("Result", "getItem: ", e);
-            }
-            return null;
-        }
-
-        @Override
-        public long getItemId(int position) {
-            return position;
-        }
-
-        @Override
-        public boolean hasStableIds() {
-            return false;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-
-            View cell;
-            ResultHoder holder;
-            if (convertView == null) {
-
-                cell = LayoutInflater.from(mContext).inflate(R.layout.result_cell,null);
-                holder = new ResultHoder(cell);
-
-
-            } else {
-
-                cell = convertView;
-                holder = (ResultHoder)cell.getTag();
-
-            }
-//            holder.row.removeAllViews();
-
-//            cell.setOnTouchListener(resultRowClickListener);
-
-            holder.row.setBackgroundColor(Color.WHITE);
-            // setup
-           try {
-
-               JSONObject layout = resultData.getJSONObject("layout");
-
-               JSONObject header = layout.getJSONObject("header");
-               int width = header.getInt("width");
-               int height = header.getInt("height");
-               int margin_t = header.getInt("margin_t");
-               int margin_l = header.getInt("margin_l");
-               int margin_b = header.getInt("margin_b");
-               int margin_r = header.getInt("margin_r");
-
-               width = convertDp2Px(width);
-               height = convertDp2Px(height);
-               margin_t = convertDp2Px(margin_t);
-               margin_l = convertDp2Px(margin_l);
-               margin_b = convertDp2Px(margin_b);
-               margin_r = convertDp2Px(margin_r);
-
-
-               HorizontalScrollView.LayoutParams listViewLayoutParams = (HorizontalScrollView.LayoutParams)resultListView.getLayoutParams();
-               listViewLayoutParams.width = width;
-               resultListView.setLayoutParams(listViewLayoutParams);
-
-
-
-               JSONArray obj = (JSONArray)getItem(position);
-               JSONArray arr_col = header.getJSONArray("col");
-
-               if (position == 0) {
-
-                   // header
-                   String bg_color = header.getString("bg_color");
-                   String f_color = header.getString("f_color");
-
-                   if (!bg_color.contains("0x")) {
-                       bg_color = "0x" + bg_color;
-                   }
-                   if (!f_color.contains("0x")) {
-                       f_color = "0x" + f_color;
-                   }
-                   bg_color = bg_color.replace("0x","#");
-                   f_color = f_color.replace("0x","#");
-
-                   RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)holder.row.getLayoutParams();
-                   layoutParams.height = height;
-                   holder.row.setLayoutParams(layoutParams);
-
-                   // 调整显示列后,需要删除多余的列
-                   if (holder.row.getChildCount() > arr_col.length()) {
-                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
-                           TextView tv = (TextView)holder.row.findViewById(i);
-                           holder.row.removeView(tv);
-                       }
-                   }
-
-                   // col
-                   for (int i = 0; i < arr_col.length(); i++) {
-
-                       JSONObject value = obj.getJSONObject(i);
-                       int col_w = value.getInt("width");
-                       col_w = convertDp2Px(col_w);
-
-                       String h_align = value.getString("h_align");
-                       String v_center = value.getString("v_center");
-                       String col_bg_color = value.getString("bg_color");
-                       String col_f_color = value.getString("f_color");
-                       String name = value.getString("name");
-
-
-                       bg_color = bg_color.replace("0x","#");
-                       f_color = f_color.replace("0x","#");
-
-                       TextView tv = (TextView)holder.row.findViewById(i);
-                       if (tv == null) {
-                           tv = new TextView(mContext);
-
-                           tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
-                           tv.setSingleLine();
-                           tv.setEllipsize(TextUtils.TruncateAt.END);
-                           tv.setId(i);
-                           tv.setBackgroundDrawable(getResources().getDrawable(R.drawable.result_black_border));
-                           tv.setOnTouchListener(resultRowClickListener);
-                       } else {
-                           holder.row.removeView(tv);
-                       }
-
-                       // layout
-                       tv.setWidth(col_w);
-                       tv.setHeight(height);
-                       tv.setPadding(margin_l,margin_t,margin_r,margin_b);
-
-                       TableRow.LayoutParams tvLayoutParams = new  TableRow.LayoutParams(col_w, height);
-
-                       holder.row.addView(tv,i,tvLayoutParams);
-
-                       // content
-                       tv.setTextColor(Color.parseColor(f_color));
-                       tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
-                       tv.getPaint().setFakeBoldText(true);
-
-                       if (name.contains("</")) {
-                           tv.setText(Html.fromHtml(name));
-                       } else {
-                           tv.setText(name);
-                       }
-
-                   }
-                   holder.row.setBackgroundColor(Color.parseColor(bg_color));
-
-               } else {
-
-                   // row
-                   JSONObject row = layout.getJSONObject("row");
-                   String f_color = row.getString("f_color");
-                   String color_0 = row.getString("color_0");
-                   String color_1 = row.getString("color_1");
-
-                   if (!f_color.contains("0x")) {
-                       f_color = "0x" + f_color;
-                   }
-                   if (!color_0.contains("0x")) {
-                       color_0 = "0x" + color_0;
-                   }
-                   if (!color_1.contains("0x")) {
-                       color_1 = "0x" + color_1;
-                   }
-
-
-                   f_color = f_color.replace("0x","#");
-                   color_0 = color_0.replace("0x","#");
-                   color_1 = color_1.replace("0x","#");
-
-                   int row_h = row.getInt("height");
-                   row_h = convertDp2Px(row_h);
-
-                   RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)holder.row.getLayoutParams();
-                   layoutParams.height = row_h;
-                   holder.row.setLayoutParams(layoutParams);
-
-                   // 调整显示列后,需要删除多余的列
-                   if (holder.row.getChildCount() > arr_col.length()) {
-                       for (int i = arr_col.length(); i < holder.row.getChildCount(); i++) {
-                           TextView tv = (TextView)holder.row.findViewById(i);
-                           holder.row.removeView(tv);
-                       }
-                   }
-
-                   // col
-                   for (int i = 0; i < arr_col.length(); i++) {
-
-                       JSONArray col_layout = row.getJSONArray("val");
-                       JSONObject layout_val = col_layout.getJSONObject(i);
-
-                       String type = layout_val.getString("type");
-                       String h_align = layout_val.getString("h_align");
-                       String v_center = layout_val.getString("v_center");
-                       String col_bg_color = layout_val.getString("bg_color");
-                       String col_f_color = layout_val.getString("f_color");
-
-                       col_bg_color = col_bg_color.replace("0x","#");
-                       col_f_color = col_f_color.replace("0x","#");
-
-                       String value = obj.getString(i);
-
-
-                       JSONObject size = ((JSONArray)getItem(0)).getJSONObject(i);
-                       int col_w = size.getInt("width");
-                       int col_h = row.getInt("height");
-
-                       col_w = convertDp2Px(col_w);
-                       col_h = convertDp2Px(col_h);
-
-                       TextView tv = (TextView) holder.row.findViewById(i);
-                       if (tv == null) {
-                           tv = new TextView(mContext);
-
-                           tv.setGravity(convertGravity("h_align",h_align) | convertGravity("v_center",v_center));
-                           tv.setSingleLine();
-                           tv.setEllipsize(TextUtils.TruncateAt.END);
-                           tv.setId(i);
-                           tv.setOnTouchListener(resultRowClickListener);
-                           tv.setBackgroundDrawable(getResources().getDrawable(R.drawable.result_black_border));
-                       } else {
-                           holder.row.removeView(tv);
-                       }
-
-                       // layout
-                       tv.setWidth(col_w);
-                       tv.setHeight(col_h);
-                       tv.setPadding(margin_l,margin_t,margin_r,margin_b);
-
-                       TableRow.LayoutParams tvLayoutParams = new  TableRow.LayoutParams(col_w, col_h);
-                       holder.row.addView(tv,i,tvLayoutParams);
-
-                       // content
-
-                       tv.setTextColor(Color.parseColor(f_color));
-                       tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
-                       tv.getPaint().setFakeBoldText(false);
-                       tv.setText(Html.fromHtml(value));
-//                       if (value.contains("</")) {
-//                           tv.setText(Html.fromHtml(value));
-//                       } else {
-//                           tv.setText(value);
-//                       }
-
-
-                   }
-
-                   if ((position - 1) % 2 == 0) {
-                       holder.row.setBackgroundColor(Color.parseColor(color_0));
-                   } else {
-                       holder.row.setBackgroundColor(Color.parseColor(color_1));
-
-                   }
-               }
-
-           } catch (JSONException e) {
-               Log.e("Result", "getView: ", e);
-           }
-
-            return cell;
-        }
-
-        private int convertGravity(String key, String align) {
-
-            if (key.equals("h_align")) {
-                if (align.equals("center")) {
-                    return Gravity.CENTER_HORIZONTAL;
-                } else if (align.equals("left")) {
-                    return Gravity.LEFT;
-                } else if (align.equals("right")) {
-                    return Gravity.RIGHT;
-                }
-
-            }
-
-            if (key.equals("v_center")) {
-
-                if (align.equals("center")) {
-                    return Gravity.CENTER_VERTICAL;
-                } else if (align.equals("top")) {
-                    return Gravity.TOP;
-                } else if (align.equals("bottom")) {
-                    return Gravity.BOTTOM;
-                }
-            }
-            return Gravity.CENTER;
-        }
-
-        @Override
-        public int getItemViewType(int position) {
-            return 0;
-        }
-
-        @Override
-        public int getViewTypeCount() {
-            return 1;
-        }
-
-        @Override
-        public boolean isEmpty() {
-            return false;
-        }
-    }
-
-
-    public boolean ellipsisTextView(TextView tv) {
-        Layout l = tv.getLayout();
-        if ( l != null){
-            int lines = l.getLineCount();
-            if ( lines > 0) {
-                if (l.getEllipsisCount(lines - 1) > 0) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public int convertDp2Px(int dp) {
-        return dp2px(mContext,dp);
-    }
-
-    public int px2dp(Context context, float pxValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (pxValue / scale + 0.5f);
-    }
-
-    public int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    public int px2sp(Context context, float pxValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (pxValue / fontScale + 0.5f);
-    }
-
-    public int sp2px(Context context, float spValue) {
-        float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
-        return (int) (spValue * fontScale + 0.5f);
-    }
-
-
-    protected String documentPath;
-    protected String download_query;
-    protected void export(final String download_url) {
-
-        if (download_query != null) {
-            documentPath = download_query;
-            openFile(new File(download_query));
-            return;
-        }
-
-        showProgressDialog(null,"Please wait");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getDocumentDir();
-                // download & get path
-                final File downloadFile = Network.download_query(download_url,cacheDir);
-                final String path = downloadFile != null && downloadFile.exists() ? downloadFile.getPath() : null;
-
-
-
-                documentPath = path;
-                download_query = path;
-
-
-                if (path != null) {
-                    runOnUiThread(new Runnable() {
-                        @Override
-                        public void run() {
-                            progressDialog.dismiss();
-                            openFile(downloadFile);
-                        }
-                    });
-                }
-
-            }
-        }).start();
-
-    }
-
-    public void showAlert(final String msg) {
-        if (msg == null || msg.isEmpty()) {
-            return;
-        }
-
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                new AlertDialog.Builder(mContext)
-                        .setMessage(msg)
-                        .show();
-            }
-        });
-    }
-
-    public void showOrderDetail() {
-//        Intent intent = OrderDetailActivity.build(mContext,OrderDetailActivity.class,null,URL_REMOTE,null,new Bundle());
-//
-//        startActivity(intent);
-    }
-
-    public void showKVDetail(final JSONObject param) {
-//        showProgressDialog("Please wait","Loading...");
-//
-//        new Thread(new Runnable() {
-//            @Override
-//            public void run() {
-//
-//                final JSONObject json = Network.kv_detail(RAUtil.Json2Bundle(param));
-////                final JSONObject json = readRawFile(R.raw.kv);
-//
-//                runOnUiThread(new Runnable() {
-//                    @Override
-//                    public void run() {
-//                        progressDialog.dismiss();
-//
-//                        int result = 0;
-//                        if (json != null) {
-//                            result = json.optInt("result",0);
-//                        }
-//                        if (result == 2) {
-//
-//                            Intent intent = KVDetailActivity.build(mContext,json.toString());
-//
-//                            startActivity(intent);
-//
-//                        } else {
-//                            String msg = json.optString("msg");
-//                            if (msg == null) {
-//                                msg = "Sorry,some error occurred";
-//                            }
-//                            showAlert(msg);
-//                        }
-//
-//                    }
-//                });
-//
-//            }
-//        }).start();
-
-    }
-
-    public void showQuickLook(final JSONObject param, final String url) {
-
-        showProgressDialog("Please wait","Downloading...");
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getDocumentDir();
-                // 下载文件
-                final File downloadFile = Network.downloadFile(RAUtil.Json2Bundle(param),url,cacheDir);
-
-                runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        progressDialog.dismiss();
-                        if (downloadFile != null && downloadFile.exists()) {
-//                            try {
-//                                //此处需要新增保存文档的本地表
-//                                param;
-////                                String email=param.getString("email");
-////                                String email_subject=param.getString("email_subject");
-////                                String email_content=param.getString("email_content");
-//                            } catch (JSONException e) {
-//                                e.printStackTrace();
-//                            }
-                            openFile(downloadFile);
-                        } else {
-                            showAlert("Sorry,there is a wrong.");
-                        }
-                    }
-                });
-
-            }
-        }).start();
-
-
-    }
-
-    protected void openFile(File file) {
-
-        if (file == null || !file.exists()) {
-            return;
-        }
-
-        Uri uri = null;
-        String type = RAUtil.getMimeType(file.getPath());
-
-        // type "application/pdf"
-        Intent intent = new Intent(Intent.ACTION_VIEW);
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-
-            // "com.usai.apex.fileprovider"即是在Manifest文件中配置的authorities
-            uri = FileProvider.getUriForFile(mContext, "com.usai.apex.fileprovider", file);
-            // 给目标应用一个临时授权
-            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-        } else {
-            uri = Uri.fromFile(file);
-        }
-
-        intent.setDataAndType(uri, type);
-
-        if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
-            // someone knows how to handle this mime type with this scheme, don't download.
-            try {
-                startActivity(intent);
-                return;
-            } catch (Exception ex) {
-                Log.d("Open File", "activity not found for " + type + " over " + uri, ex);
-            }
-
-        } else {
-            Log.d("Open File", "openFileAtPath: " + "No App " + uri);
-            try {
-                shareFile(uri,type);
-            } catch (Exception e) {
-                Log.e("Show Dialog Error", "openFileAtPath: ", e);
-            }
-        }
-
-    }
-
-    protected void shareFile(Uri uri, String type) {
-
-        Intent shareIntent = new Intent();
-        shareIntent.setAction(Intent.ACTION_SEND);
-        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
-        shareIntent.setType(type);
-        startActivity(Intent.createChooser(shareIntent, "Share"));
-    }
-
-
-}

+ 0 - 871
Apex Mobile/app/src/main/java/com/usai/apex/ResultActivity.java

@@ -1,871 +0,0 @@
-package com.usai.apex;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.Dialog;
-import android.app.DownloadManager;
-import android.app.DownloadManager.Request;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.text.Html;
-import android.text.style.URLSpan;
-import android.util.Log;
-import android.util.SparseArray;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.Gravity;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnCreateContextMenuListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TableLayout;
-import android.widget.TableRow;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Set;
-
-public class ResultActivity extends Activity
-{
-
-	private static final int	REQUEST_LOGINACTIVITY	= 1;
-	String						user					= null;
-	String						password				= null;
-	String						function_name			= null;
-	private SearchTask			m_task					= null;
-
-	final int					OFFSET					= 5;
-
-	int							sel						= -1;
-
-	Bundle						searchParms				= null;
-	SearchResult				searchresult			= new SearchResult();
-
-	SparseArray<String>			showfieldmap			= new SparseArray<String>();
-	// HashMap<Integer, String> showfieldmap = new HashMap<Integer, String>();
-	private TextView			mStatusMessageView;
-	// private View mSearchFormView;
-	private View				footview;
-	private View				mStatusView;
-	int							actioncount				= 0;
-
-	// private class resultAdapter extends SimpleAdapter
-	// {
-	//
-	//
-	// }
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		user = ApexTrackingApplication.get_user();
-		password = ApexTrackingApplication.get_pass();
-		function_name = getIntent().getStringExtra("function_name");
-		if (function_name.equals("Ocean Booking"))
-			setTitle("Booking Result");
-		else if (function_name.equals("Ocean B/L info."))
-			setTitle("B/L info. Result");
-		else if (function_name.equals("Container detail"))
-			setTitle("Container Result");
-		else if (function_name.equals("Download Document"))
-			setTitle("Document Result");
-
-		searchParms = getIntent().getBundleExtra("searchParms");
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_result);
-
-		SQLiteDatabase db = dbUtil.OpenDB(ResultActivity.this, null, false);
-		Cursor cursor = db
-				.query("actions_info", new String[] { "count(*)" },
-						"function_name='" + function_name + "' and user='"
-								+ user + "'", null, null, null, "priority",
-						null);
-		if (cursor.moveToNext())
-		{
-			actioncount = cursor.getInt(0);
-		}
-
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-
-		footview = findViewById(R.id.foot);
-		// mSearchFormView = findViewById(R.id.search_form);
-		Button btnnext = (Button) findViewById(R.id.btn_next);
-		btnnext.setOnClickListener(new View.OnClickListener()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-				// TextView tv_head = (TextView) findViewById(R.id.tv_head);
-
-				// searchresult.set_direction(1);
-				if (searchresult.get_totalcount() == -1)
-					requestdata(true);
-				else
-				{
-					// if (searchresult.get_direction() == -1)
-					searchresult.set_offset(searchresult.get_offset() + OFFSET);
-					requestdata(false);
-				}
-
-			}
-		});
-
-		Button btnpre = (Button) findViewById(R.id.btn_pre);
-		btnpre.setOnClickListener(new View.OnClickListener()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-				// TextView tv_head = (TextView) findViewById(R.id.tv_head);
-				// searchresult.set_direction(-1);
-				if (searchresult.get_totalcount() == -1)
-					requestdata(true);
-				else
-				{
-					searchresult.set_offset(searchresult.get_offset() - OFFSET);
-					requestdata(false);
-				}
-
-			}
-		});
-		mStatusView = findViewById(R.id.status);
-		mStatusMessageView = (TextView) findViewById(R.id.status_message);
-		LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-		Button btn_refresh = (Button) ll.findViewById(R.id.btn_refresh);
-		btn_refresh.setOnClickListener(new View.OnClickListener()
-		{
-
-			@Override
-			public void onClick(View v)
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.INVISIBLE);
-				if (searchresult.get_totalcount() == -1)
-					requestdata(true);
-				else
-					requestdata(false);
-
-			}
-		});
-
-		SharedPreferences RunOnce = getSharedPreferences("Apex", 0);
-
-		String vername;
-		try
-		{
-			vername = getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
-			boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
-					+ "_result", true);
-			if (bFirstRun&&false)
-			{
-				SharedPreferences.Editor editor = RunOnce.edit();
-				editor.putBoolean("FirstRun" + vername + "_result", false);
-				// Don't forget to commit your edits!!!
-				editor.commit();
-				Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "result");
-				startActivity(intent);
-
-			}
-		}
-		catch (NameNotFoundException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		initTableHeader();
-		if (savedInstanceState != null)
-		{
-			searchresult = (SearchResult) savedInstanceState
-					.getSerializable("searchresult");
-			if (searchresult.get_totalcount() == -1)
-				requestdata(true);
-			else
-				initTable();
-		}
-		else
-			requestdata(true);
-
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		if (m_task != null)
-			m_task.cancel(false);
-		super.onDestroy();
-	}
-
-	private void initTable()
-	{
-		// int loadcount = searchresult.get_count();
-		int totalcount = searchresult.get_totalcount();
-		TextView tv_head = (TextView) findViewById(R.id.head);
-		if (totalcount == 0)
-		{
-			tv_head.setText(R.string.str_0);
-
-			return;
-		}
-		else if (searchresult.get_totalcount() > 2000)
-		{
-			tv_head.setText(R.string.str_2000);
-		}
-		else
-			tv_head.setText(/*
-							 * loadcount + "/" + //
-							 */searchresult.get_totalcount()
-					+ getText(R.string.str_records).toString());
-		TableLayout tl = (TableLayout) findViewById(R.id.result_table);
-
-		tl.removeViews(1, tl.getChildCount() - 1);
-		// int newcount = loadcount - showcount + 1;// +1 header row
-		for (int i = 0; i < searchresult.get_recordscount(); i++)
-		{
-
-			TableRow recordRow = new TableRow(ResultActivity.this);
-			recordRow.setOnLongClickListener(new View.OnLongClickListener()
-			{
-
-				@Override
-				public boolean onLongClick(View v)
-				{
-					// TODO Auto-generated method stub
-					// v.setBackgroundColor(Color.GRAY);
-					// v.showContextMenu();
-					// return true;
-					TableRow tr = (TableRow) v;
-					TextView tvno = (TextView) tr.getChildAt(0);
-					sel = (Integer.parseInt(tvno.getText().toString())-1) % 5 ;
-					registerForContextMenu(v);
-					openContextMenu(v);
-					unregisterForContextMenu(v);
-					return true;
-				}
-			});
-
-			// registerForContextMenu(recordRow);
-			// recordRow.setClickable(true);
-			// registerForContextMenu(recordRow);
-			// recordRow.setOnCreateContextMenuListener(m_tableMenu);
-			// recordRow.SETSE
-
-			HashMap<String, String> record = searchresult.get_record(i);
-			TextView field = new TextView(ResultActivity.this);
-			field.setBackgroundResource(R.drawable.tableitem);
-			field.setText(searchresult.get_offset() + i + 1 + "");
-			Log.d("offset=" + searchresult.get_offset(), "");
-			field.setGravity(Gravity.CENTER);
-			field.setPadding(10, 5, 10, 5);
-			field.setTextSize(20);
-			recordRow.addView(field);
-			for (int j = 0; j < showfieldmap.size(); j++)
-			{
-				TextView field1 = new TextView(ResultActivity.this);
-				// Log.d("onPostExecute", showfieldmap.get(j));
-				String str = record.get(showfieldmap.get(j));
-				field1.setBackgroundResource(R.drawable.tableitem);
-				if (str.toLowerCase().trim().equals("null"))
-					str = "";
-
-				// field1.setBackgroundColor(0xFFFFFFFF);
-
-				field1.setText(Html.fromHtml(str));
-
-				if (actioncount == 0)
-					field1.setOnClickListener(new OnClickListener()
-					{
-
-						@Override
-						public void onClick(View v)
-						{
-							// if (true)
-							// return;
-							URLSpan span[] = ((TextView) v).getUrls();
-							if (span.length < 1)
-								return;
-							span[0].getURL();
-							Log.d("Text", span[0].getURL());
-							
-							TextView tv = (TextView)v;
-
-							final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
-
-							Uri uri = Uri.parse(span[0].getURL());
-							final Request request = new Request(uri);
-
-							// 设置允许使用的网络类型,这里是移动网络和wifi都可以
-							request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE
-									| DownloadManager.Request.NETWORK_WIFI);
-							
-							request.setDestinationInExternalPublicDir("Apex Mobile",tv.getText().toString()); 
-
-							// 禁止发出通知,既后台下载,如果要使用这一句必须声明一个权限:android.permission.DOWNLOAD_WITHOUT_NOTIFICATION
-							// request.setShowRunningNotification(false);
-
-							// 不显示下载界面
-							request.setVisibleInDownloadsUi(false);
-							request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
-
-							/*
-							 * 设置下载后文件存放的位置,如果sdcard不可用,那么设置这个将报错,
-							 * 因此最好不设置如果sdcard可用,下载后的文件 在/mnt/sdcard/Android/
-							 * data/packageName/files目录下面
-							 * ,如果sdcard不可用,设置了下面这个将报错,不设置,下载后的文件在/cache这个 目录下面
-							 */
-							// request.setDestinationInExternalFilesDir(this,
-							// null, "tar.apk");
-
-							AlertDialog.Builder builder = new Builder(
-									ResultActivity.this);
-							builder.setMessage(getString(R.string.str_downloadmessage));
-
-							builder.setTitle(getString(R.string.str_confirmdownload));
-
-							builder.setPositiveButton(
-									getString(R.string.str_download),
-									new Dialog.OnClickListener()
-									{
-
-										@Override
-										public void onClick(
-												DialogInterface dialog,
-												int which)
-										{
-											downloadManager.enqueue(request);
-											dialog.dismiss();
-
-										}
-									});
-
-							builder.setNegativeButton(
-									getString(R.string.str_cancel),
-									new Dialog.OnClickListener()
-									{
-
-										@Override
-										public void onClick(
-												DialogInterface dialog,
-												int which)
-										{
-											dialog.dismiss();
-										}
-									});
-
-							builder.create().show();
-
-						}
-
-					});
-				// field1.setText(str);
-				field1.setGravity(Gravity.LEFT);
-				field1.setPadding(10, 5, 10, 5);
-				field1.setTextSize(20);
-				// field.setTextAppearance(ResultActivity.this,
-				// android.R.attr.textAppearanceMedium);
-				recordRow.addView(field1);
-			}
-			tl.addView(recordRow);
-		}
-
-		Button btnnext = (Button) findViewById(R.id.btn_next);
-
-		Button btnpre = (Button) findViewById(R.id.btn_pre);
-		if (searchresult.get_offset() == 0)
-			btnpre.setEnabled(false);
-		else
-		{
-			btnpre.setEnabled(true);
-		}
-		if ((searchresult.get_totalcount() - searchresult.get_offset() <= OFFSET)
-				|| (searchresult.get_totalcount() == 0))
-			btnnext.setEnabled(false);
-		else
-			btnnext.setEnabled(true);
-	}
-
-	private OnCreateContextMenuListener	m_tableMenu	= new OnCreateContextMenuListener()
-													{
-
-														@Override
-														public void onCreateContextMenu(
-																ContextMenu contextmenu,
-																View view,
-																ContextMenuInfo contextmenuinfo)
-														{
-
-															contextmenu
-																	.add(Menu.NONE,
-																			0,
-																			0,
-																			getString(R.string.str_detail));
-
-														}
-
-													};
-
-	@Override
-	public boolean onContextItemSelected(MenuItem item)
-	{
-		// menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
-		// Log.d("table row select", sel+ "");
-
-		Intent intent = new Intent();
-		intent.setClass(this, NewDetailActivity.class);
-
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("actions_info",
-				new String[] { "name", "_id" }, "function_name='"
-						+ function_name + "' and user='" + user + "'", null,
-				null, null, "priority", null);
-		int i = 0;
-		while (cursor.moveToNext())
-		{
-			String name = cursor.getString(0);
-			Log.d("actionname", name);
-			intent.putExtra("action" + i, name);
-			i++;
-		}
-		intent.putExtra("function_name", function_name);
-		intent.putExtra("actions_count", i);
-		intent.putExtra("_id", searchresult.get_record(sel).get("_id")
-				.toString());
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-
-		startActivity(intent);
-
-		return super.onContextItemSelected(item);
-	}
-
-	// @Override
-	// public void onCreateContextMenu(ContextMenu menu, View v,
-	// ContextMenuInfo menuInfo)
-	// {
-	// // // TODO Auto-generated method stub
-	// menu.add(Menu.NONE, 0, 0, "Detail");
-	// // // contextmenu.add(Menu.NONE, 1, 1, "�༭");
-	// super.onCreateContextMenu(menu, v, menuInfo);
-	// }
-
-	void initTableHeader()
-	{
-
-		TableLayout tl = (TableLayout) findViewById(R.id.result_table);
-		tl.setFocusable(true);
-		tl.setOnCreateContextMenuListener(m_tableMenu);
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, false);
-		Cursor cursor = db.query("fields_info", new String[] { "aname", "name",
-				"_id" }, "function_name='" + function_name + "' and user='"
-				+ user + "' and behavior=" + Network.BEHAVIOR_RESULT
-				+ " and show = 1", null, null, null, "priority , aname", null);
-		TableRow headerRow = (TableRow) findViewById(R.id.tr_header);
-		int pos = 0;
-		showfieldmap.clear();
-		headerRow.removeAllViews();
-		ArrayList<HashMap<String, String>> gridheader = new ArrayList<HashMap<String, String>>();
-		HashMap<String, String> map = new HashMap<String, String>();
-		map.put("key", "no.");
-		gridheader.add(map);
-		Button btn = new Button(this);
-		btn.setBackgroundResource(R.drawable.tablehead);
-		btn.setPadding(0, 0, 0, 0);
-		btn.setText("No.");
-		headerRow.addView(btn);
-		while (cursor.moveToNext())
-		{
-			String aname = cursor.getString(0);
-			Button btn1 = new Button(this);
-			btn1.setBackgroundResource(R.drawable.tablehead);
-			btn1.setText(aname);
-			headerRow.addView(btn1);
-			showfieldmap.put(pos, cursor.getString(1));
-
-			map.put("key", "header");
-			gridheader.add(map);
-			pos++;
-		}
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-
-		// SimpleAdapter adapter = new SimpleAdapter(this,
-		// gridheader,// �����Դ
-		// R.layout.result_item,//XMLʵ��
-		// new String[] { "key" }, // ��̬������ImageItem��Ӧ������
-		// new int[] { R.id.tv_value });
-		//
-		// GridView gridview = (GridView) findViewById(R.id.grid_result);
-		// gridview.setNumColumns(2);
-		// gridview.setAdapter(adapter);
-
-	}
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.result, 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_RESULT);
-				startActivity(intent);
-				break;
-			case R.id.action_help:
-				// Intent intent = new Intent();
-				intent.setClass(this, HelpActivity.class);
-				intent.putExtra("caller", "result");
-				// // intent.putExtra("password", password);
-				// intent.putExtra("function_name", function_name);
-				// intent.putExtra("behavior", Network.BEHAVIOR_SEARCH);
-				startActivity(intent);
-				break;
-			case R.id.action_save_search:
-				// LayoutInflater factory = LayoutInflater.from(this);
-				// final View textEntryView =
-				// factory.inflate(R.layout.alert_dialog_text_entry, null);
-				final View edit = new EditText(this);
-				new AlertDialog.Builder(this)
-						.setIconAttribute(android.R.attr.alertDialogIcon)
-						.setTitle(R.string.str_createname)
-						.setView(edit)
-						.setPositiveButton(android.R.string.ok,
-								new DialogInterface.OnClickListener()
-								{
-									public void onClick(DialogInterface dialog,
-											int whichButton)
-									{
-										String name = ((EditText) edit)
-												.getText().toString();
-										String param = getIntent().toUri(0);
-
-										JSONObject obj = new JSONObject();
-										Set<String> keys = searchParms.keySet();
-										for (String key : keys)
-										{
-
-											
-											try
-											{
-												obj.put(key, searchParms.get(key).toString());
-
-											}
-											catch (JSONException e)
-											{
-												// TODO Auto-generated catch block
-												e.printStackTrace();
-											}
-
-										}
-										obj.toString();
-
-										SQLiteDatabase db = dbUtil.OpenDB(
-												ApexTrackingApplication.get_instance(), null, true);
-										db.execSQL("insert into history(params,name,criterion,module_name,user,create_time) values('"
-
-												+ param
-												+ "','"
-												+ name
-												+ "','"
-												+ obj.toString()
-												+ "','"
-												+ function_name
-												+ "','"
-												+ ApexTrackingApplication.get_user()
-												+ "',"
-												+ System.currentTimeMillis() + ")");
-										dbUtil.CloseDB(db);
-
-										/* User clicked OK so do some stuff */
-									}
-								})
-						.setNegativeButton(android.R.string.cancel,
-								new DialogInterface.OnClickListener()
-								{
-									public void onClick(DialogInterface dialog,
-											int whichButton)
-									{
-
-										/* User clicked cancel so do some stuff */
-									}
-								}).create().show();
-				break;
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	public void requestdata(boolean requestcount)
-	{
-
-		if (m_task != null)
-		{
-			return;
-		}
-		mStatusMessageView.setText(R.string.str_Loading);
-		showProgress(true);
-		m_task = new SearchTask();
-		m_task.execute(requestcount);
-
-	}
-
-	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);
-
-			mStatusView.setVisibility(View.VISIBLE);
-			mStatusView.animate().setDuration(shortAnimTime)
-					.alpha(show ? 1 : 0)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							mStatusView.setVisibility(show ? View.VISIBLE
-									: View.INVISIBLE);
-						}
-					});
-
-			footview.setVisibility(View.VISIBLE);
-			footview.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
-					.setListener(new AnimatorListenerAdapter()
-					{
-						@Override
-						public void onAnimationEnd(Animator animation)
-						{
-							footview.setVisibility(show ? View.INVISIBLE
-									: View.VISIBLE);
-						}
-					});
-			// mSearchFormView.setVisibility(View.VISIBLE);
-			// mSearchFormView.animate().setDuration(shortAnimTime)
-			// .alpha(show ? 0 : 1)
-			// .setListener(new AnimatorListenerAdapter()
-			// {
-			// @Override
-			// public void onAnimationEnd(Animator animation)
-			// {
-			// mSearchFormView.setVisibility(show ? View.INVISIBLE
-			// : View.VISIBLE);
-			// }
-			// });
-		}
-		else
-		{
-			// The ViewPropertyAnimator APIs are not available, so simply show
-			// and hide the relevant UI components.
-			mStatusView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-			footview.setVisibility(show ? View.INVISIBLE : View.VISIBLE);
-			// mSearchFormView.setVisibility(show ? View.INVISIBLE :
-			// View.VISIBLE);
-		}
-	}
-
-	public class SearchTask extends AsyncTask<Boolean, Void, Boolean>
-	{
-		// int err_code = ERR_CODE_NONE;
-		int	errorcode;
-
-		@Override
-		protected Boolean doInBackground(Boolean... params)
-		{
-
-			if (!Network.NetworkIsAvailable())
-
-			{
-				errorcode = Network.RESULT_NET_NOTAVAILABLE;
-				return false;
-			}
-
-			if (params[0])
-			{
-				int ret = Network.get_recordcount(searchParms);
-				if (ret >= 0)
-				{
-					searchresult.put_totalcount(ret);
-					if (ret == 0)
-						return true;
-				}
-				else
-				{
-					errorcode = ret;
-					return false;
-				}
-			}
-
-			// if (searchresult.get_direction() == -1)
-			// searchresult.set_offset(searchresult.get_offset() - 20);
-			searchParms.putString("offset", searchresult.get_offset() + "");
-
-			String jstr = Network.get_records(user, password, searchParms);
-			if (jstr == null || jstr.length() <= 0)
-			{
-				// Log.d(TAG, "json is wrong");
-				errorcode = Network.RESULT_NET_ERROR;
-				return false;
-			}
-
-			JSONObject jsobj;
-			//
-			// array = new JSONArray(json);
-			try
-			{
-				jsobj = new JSONObject(jstr);
-				// if (searchresult.get_fieldscount() == 0)
-				// {
-				// JSONObject objfields = jsobj.getJSONObject("fields");
-				// if (objfields != null)
-				// searchresult.init_fields(objfields.toString());
-				// }
-				JSONObject objrecords = jsobj.getJSONObject("records");
-				if (objrecords != null)
-					searchresult.add_records(objrecords.toString());
-				errorcode = Network.RESULT_TRUE;
-
-				return true;
-
-			}
-			catch (JSONException e)
-			{
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			errorcode = Network.RESULT_NET_ERROR;
-			return false;
-
-		}
-
-		@Override
-		protected void onPostExecute(final Boolean success)
-		{
-			Log.d("onPostExecute", "entry");
-			m_task = null;
-			showProgress(false);
-			if (ApexTrackingApplication.get_authorization() == false)
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.VISIBLE);
-				Toast toast = Toast.makeText(
-						ApexTrackingApplication.get_instance(),
-						getText(R.string.msg_net_passwordchangedremote),
-						Toast.LENGTH_LONG);
-				toast.setGravity(Gravity.CENTER, 0, 0);
-				toast.show();
-				Intent i = new Intent();
-				i.setClass(ResultActivity.this, ApexActivity.class);
-				startActivityForResult(i, REQUEST_LOGINACTIVITY);
-				return;
-			}
-			switch (errorcode)
-			{
-				case Network.RESULT_NET_NOTAVAILABLE:
-				{
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				case Network.RESULT_NET_ERROR:
-				{
-
-					Toast toast = Toast.makeText(
-							ApexTrackingApplication.get_instance(),
-							getText(R.string.msg_net_resulterror) + ":"
-									+ errorcode, Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-
-					break;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(getApplicationContext(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-
-				default:
-					break;
-			}
-
-			if (success)
-			{
-
-				initTable();
-
-			}
-			else
-			{
-				LinearLayout ll = (LinearLayout) findViewById(R.id.ll_refresh);
-				ll.setVisibility(View.VISIBLE);
-			}
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			m_task = null;
-			showProgress(false);
-		}
-	}
-
-	@Override
-	protected void onSaveInstanceState(Bundle outState)
-	{
-		outState.putSerializable("searchresult", searchresult);
-		super.onSaveInstanceState(outState);
-	}
-
-}

+ 0 - 424
Apex Mobile/app/src/main/java/com/usai/apex/RetrievePasswordActivity.java

@@ -1,424 +0,0 @@
-package com.usai.apex;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.TargetApi;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.util.Network;
-
-/**
- * Activity which displays a login screen to the user, offering registration as
- * well.
- */
-public class RetrievePasswordActivity extends AppCompatActivity
-{
-
-	/**
-	 * Keep track of the login task to ensure we can cancel it if requested.
-	 */
-	private UserLoginTask	mAuthTask	= null;
-
-	// Values for email and password at the time of the login attempt.
-	private String			m_sEmail;
-	private String			m_sUser;
-
-	// UI references.
-	private EditText		mEmailView;
-	private EditText		m_userView;
-	private View			mLoginFormView;
-	private View			mLoginStatusView;
-	private TextView		mLoginStatusMessageView;
-
-
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText("Retrieve Password");
-		setTitle("Retrieve Password");
-
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-
-		setContentView(R.layout.activity_retrieve_password);
-
-		setCustomActionBar();
-		// Set up the login form.
-		m_userView = (EditText) findViewById(R.id.user);
-		// m_sEmail = getIntent().getStringExtra(EXTRA_EMAIL);
-		mEmailView = (EditText) findViewById(R.id.email);
-		// mEmailView.setText(m_sEmail);
-
-		mEmailView
-				.setOnEditorActionListener(new TextView.OnEditorActionListener()
-				{
-					@Override
-					public boolean onEditorAction(TextView textView, int id,
-							KeyEvent keyEvent)
-					{
-						if (id == R.id.btn_ok
-								|| id == EditorInfo.IME_ACTION_DONE)
-						{
-
-							InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
-									.getSystemService(
-											Context.INPUT_METHOD_SERVICE);
-
-							// EditText editText =
-							// (EditText)findViewById(R.id.xxxx);
-							inputMethodManager.hideSoftInputFromWindow(
-									mEmailView.getWindowToken(), 0); // ����
-							retrivev();
-							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.btn_ok).setOnClickListener(new View.OnClickListener()
-		{
-			@Override
-			public void onClick(View view)
-			{
-				InputMethodManager inputMethodManager = (InputMethodManager) getApplicationContext()
-						.getSystemService(Context.INPUT_METHOD_SERVICE);
-
-				// EditText editText =
-				// (EditText)findViewById(R.id.xxxx);
-				inputMethodManager.hideSoftInputFromWindow(
-						mEmailView.getWindowToken(), 0); // ����
-				retrivev();
-			}
-		});
-		findViewById(R.id.btn_close).setOnClickListener(
-				new View.OnClickListener()
-				{
-					@Override
-					public void onClick(View view)
-					{
-						finish();
-					}
-				});
-	}
-
-	//
-	// @Override
-	// public boolean onCreateOptionsMenu(Menu menu) {
-	// super.onCreateOptionsMenu(menu);
-	// getMenuInflater().inflate(R.menu.retrieve_password, 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 retrivev()
-	{
-		if (mAuthTask != null)
-		{
-			return;
-		}
-
-		// Reset errors.
-		mEmailView.setError(null);
-		m_userView.setError(null);
-
-		// Store values at the time of the login attempt.
-		m_sEmail = mEmailView.getText().toString();
-		m_sUser = m_userView.getText().toString();
-
-		boolean cancel = false;
-		View focusView = null;
-
-		// Check for a valid password.
-		if (TextUtils.isEmpty(m_sUser))
-		{
-			m_userView.setError(getString(R.string.error_field_required));
-			focusView = m_userView;
-			cancel = true;
-		}
-		// else if (m_sUser.length() < 4) {
-		// m_userView.setError(getString(R.string.error_invalid_password));
-		// focusView = m_userView;
-		// cancel = true;
-		// }
-
-		// Check for a valid email address.
-		if (TextUtils.isEmpty(m_sEmail))
-		{
-			mEmailView.setError(getString(R.string.error_field_required));
-			focusView = mEmailView;
-			cancel = true;
-		}
-		else if (!m_sEmail.contains("@"))
-		{
-			mEmailView.setError(getString(R.string.error_invalid_email));
-			focusView = mEmailView;
-			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	errorcode;
-
-		@Override
-		protected Boolean doInBackground(Void... params)
-		{
-			errorcode = Network.retrieve_pass(m_sUser, m_sEmail);
-			if (errorcode == Network.RESULT_TRUE)
-				return true;
-			else
-			{
-				return false;
-			}
-
-		}
-
-		@Override
-		protected void onPostExecute(final Boolean success)
-		{
-			Log.d("onPostExecute", "entry");
-			mAuthTask = null;
-			showProgress(false);
-			// if (netconnect == )
-			// {
-			//
-			// }
-
-			if (success)
-			{
-				AlertDialog.Builder builder = new Builder(
-						RetrievePasswordActivity.this);
-				builder.setMessage(getString(R.string.str_email_sent));
-
-				builder.setTitle(getString(R.string.str_retrieve_success));
-
-				builder.setPositiveButton(getString(android.R.string.ok), new OnClickListener()
-				{
-
-					@Override
-					public void onClick(DialogInterface dialog, int which)
-					{
-						dialog.dismiss();
-
-						RetrievePasswordActivity.this.finish();
-					}
-				});
-
-				// builder.setNegativeButton("取消", new OnClickListener() {
-				//
-				// @Override
-				// public void onClick(DialogInterface dialog, int which) {
-				// dialog.dismiss();
-				// }
-				// });
-
-				builder.create().show();
-
-			}
-			else
-			{
-				switch (errorcode)
-				{
-					case Network.RESULT_NET_NOTAVAILABLE:
-					{
-						Toast toast = Toast.makeText(getApplicationContext(),
-								getText(R.string.msg_connection_none),
-								Toast.LENGTH_LONG);
-						toast.setGravity(Gravity.CENTER, 0, 0);
-						toast.show();
-						return;
-					}
-					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_ERROR:
-					// case Network.RESULT_RESPONSE_NULL:
-					{
-						Toast toast = Toast.makeText(getApplicationContext(),
-								getText(R.string.msg_net_resulterror),
-								Toast.LENGTH_LONG);
-						toast.setGravity(Gravity.CENTER, 0, 0);
-						toast.show();
-						return;
-					}
-
-					case Network.RESULT_FALSE:
-					{
-						AlertDialog.Builder builder = new Builder(
-								RetrievePasswordActivity.this);
-						builder.setMessage(getString(R.string.str_invalid_pore));
-
-						builder.setTitle(getString(R.string.str_retrieve_failed));
-
-						builder.setPositiveButton(getString(android.R.string.ok), new OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								dialog.dismiss();
-
-								// RetrievePasswordActivity.this.finish();
-							}
-						});
-						builder.create().show();
-						return;
-
-					}
-					default:
-					{
-						Toast toast = Toast.makeText(getApplicationContext(),
-								getText(R.string.msg_net_resulterror) + ":"
-										+ errorcode, Toast.LENGTH_LONG);
-						toast.setGravity(Gravity.CENTER, 0, 0);
-						toast.show();
-						break;
-					}
-				}
-			}
-		}
-
-		@Override
-		protected void onCancelled()
-		{
-			mAuthTask = null;
-			showProgress(false);
-		}
-	}
-}

+ 0 - 412
Apex Mobile/app/src/main/java/com/usai/apex/SearchActivity.java

@@ -1,412 +0,0 @@
-package com.usai.apex;
-
-import android.app.ListActivity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.text.InputType;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.SimpleCursorAdapter;
-import android.widget.Switch;
-
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class SearchActivity extends ListActivity implements OnClickListener
-{
-	private SQLiteDatabase m_db = null;
-	private Cursor m_cursor = null;
-	String user = null;
-	String password = null;
-	String function_name = null;
-	RecordsAdapter m_listadapter;
-	// private ListView m_ListView = null;
-	HashMap<String, String> hashMap = new HashMap<String, String>();
-
-	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 View getView(int position, View convertView, ViewGroup parent)
-		// {
-		// // if(true)
-		// // return super.getView(position, convertView, parent);
-		// if(convertView==null)
-		// convertView = LayoutInflater.from(getApplication()).inflate(
-		// R.layout.search_lvitem_edit, null);
-		// // holder = new ViewHolder();
-		// // holder.textView = (TextView)convertView.findViewById(R.id.text);
-		// // convertView.setTag(holder);
-		// final int pos=position;
-		// // convertView = LayoutInflater.from(getApplication()).inflate(
-		// // R.layout.search_lvitem_edit, null);
-		//
-		// EditText editText = (EditText) convertView
-		// .findViewById(R.id.edit_val);
-		// // editText.setText(str);
-		//
-		// // 为editText设置TextChangedListener,每次改变的值设置到hashMap
-		// // 我们要拿到里面的值根据position拿值
-		// editText.addTextChangedListener(new TextWatcher()
-		// {
-		// @Override
-		// public void onTextChanged(CharSequence s, int start,
-		// int before, int count)
-		// {
-		//
-		// }
-		//
-		// @Override
-		// public void beforeTextChanged(CharSequence s, int start,
-		// int count, int after)
-		// {
-		//
-		// }
-		//
-		// @Override
-		// public void afterTextChanged(Editable s)
-		// {
-		// // int a = position;
-		// // 将editText中改变的值设置的HashMap中
-		// hashMap.put(pos, s.toString());
-		// }
-		// });
-		//
-		// // // 如果hashMap不为空,就设置的editText
-		// // if (hashMap.get(position) != null)
-		// // {
-		// // editText.setText(hashMap.get(position));
-		// // }
-		// return convertView;
-		// }
-
-		@Override
-		public void bindView(View view, Context context, Cursor cursor)
-		{
-			final String f0 = cursor.getString(0);
-			final String field_type = cursor.getString(1);
-			final String name = cursor.getString(2);
-
-			Log.d("cursor val", "name=" + f0 + " , type=" + field_type);
-			final EditText edit = (EditText) view.findViewById(R.id.edit_val);
-			edit.setText(hashMap.get(name));
-			Log.v("from hashmap",
-					"name=" + name + " , val=" + hashMap.get(name));
-
-//			edit.seton
-//			edit.addTextChangedListener(new TextWatcher()
-//			{
-//				@Override
-//				public void onTextChanged(CharSequence s, int start,
-//						int before, int count)
-//				{
-//
-//				}
-//
-//				@Override
-//				public void beforeTextChanged(CharSequence s, int start,
-//						int count, int after)
-//				{
-//
-//				}
-//
-//				@Override
-//				public void afterTextChanged(Editable s)
-//				{
-//					// 将editText中改变的值设置的HashMap中
-//					String val = s.toString();
-//					val.trim();
-//					if (val.length() > 0)
-//					{
-//						hashMap.put(name, val);
-//
-//						Log.i("to hashmap", "name=" + name + " , val=" + val);
-//					}
-//				}
-//			});
-			Switch switch_bool = (Switch) view.findViewById(R.id.switch_bool);
-			if (field_type.equals("boolean"))
-			{
-				edit.setVisibility(View.GONE);
-				switch_bool.setVisibility(View.VISIBLE);
-			}
-			else
-			{
-				edit.setVisibility(View.VISIBLE);
-				switch_bool.setVisibility(View.GONE);
-				if (field_type.equals("time"))
-				{
-					edit.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE
-							| InputType.TYPE_CLASS_DATETIME);
-
-				}
-				else
-					if (field_type.equals("int"))
-					{
-
-						edit.setInputType(InputType.TYPE_CLASS_NUMBER);
-					}
-					else
-					{
-						edit.setInputType(InputType.TYPE_CLASS_TEXT);
-					}
-				Log.d("ime debug", "name=" + f0 + " , type=" + field_type
-						+ ", ime=" + edit.getInputType());
-			}
-			super.bindView(view, context, cursor);
-
-			// TextView tvname = (TextView) view.findViewById(R.id.name);
-			// TextView tvinfo = (TextView) view.findViewById(R.id.info);
-			// String sname = cursor.getString(1);
-			// int iburntype = cursor.getInt(2);
-			// dbgUtil.Log(Log.INFO, "============>", "BURN TYPE =" +
-			// iburntype);
-			// if (sname == null || sname.equals(""))
-			// tvname.setVisibility(TextView.GONE);
-			// else
-			// tvname.setVisibility(View.VISIBLE);
-			// if (m_Activityinfo.NumberType != dbUtil.NUMBER_TYPE_WHITE
-			// && iburntype >= 0)
-			// {
-			//
-			// tvinfo.setText(m_arrBurntype[iburntype]);
-			// tvinfo.setVisibility(View.VISIBLE);
-			// }
-			// else
-			// {
-			// tvinfo.setVisibility(View.GONE);
-			// }
-
-		}
-
-	}
-
-	@Override
-	protected void onDestroy()
-	{
-		dbUtil.CloseDB(m_db);
-		super.onDestroy();
-	}
-
-	@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("fields_info", new String[] { "aname",
-				"field_type", "name", "_id" }, "function_name='"
-				+ function_name + "' and user='" + user + "' and behavior="
-				+ Network.BEHAVIOR_SEARCH + " and show = 1", null, null, null,
-				"priority , aname", 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[] { "aname", "field_type", "name" },
-				// The "text1" view defined in the XML template
-				new int[] { R.id.aname, R.id.tv_type });
-		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&&false)
-			{
-				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);
-
-	}
-
-//	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);
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-		switch (v.getId())
-		{
-		case R.id.btnok:
-		{
-			Intent intent = new Intent();
-			intent.setClass(this, ResultActivity.class);
-			intent.putExtra("user", user);
-			intent.putExtra("password", password);
-			intent.putExtra("function_name", function_name);
-			Bundle parms = new Bundle();
-			parms.putString("module_name", function_name);
-			parms.putString("columns", dbUtil.get_fields(user, function_name));
-			Iterator<String> iter = hashMap.keySet().iterator();
-			while (iter.hasNext())
-			{
-				String field = (String) iter.next();
-				String val = (String) hashMap.get(field);
-				parms.putString(field, val);
-				// Cursor c = (Cursor) m_listadapter.getItem(key);
-				Log.d("@@@@@@@@@", field + " : " + val);
-			}
-			intent.putExtra("searchParms", parms);
-
-			startActivity(intent);
-
-			break;
-		}
-		case R.id.btncancel:
-			finish();
-			break;
-		default:
-			break;
-		}
-
-	}
-
-	// class FieldsAdapter extends SimpleAdapter
-	// {
-	//
-	// public FieldsAdapter(Context context,
-	// List<? extends Map<String, ?>> data, int resource,
-	// String[] from, int[] to)
-	// {
-	// super(context, data, resource, from, to);
-	// // TODO Auto-generated constructor stub
-	// }
-	//
-	// }
-
-}

+ 0 - 161
Apex Mobile/app/src/main/java/com/usai/apex/SearchHistoryActivity.java

@@ -1,161 +0,0 @@
-package com.usai.apex;
-
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.widget.TabHost;
-
-import com.usai.apex.saved.SavedDetailFragment;
-import com.usai.apex.saved.SavedSearchFragment;
-import com.usai.util.dbUtil;
-
-public class SearchHistoryActivity extends FragmentActivity
-{
-	TabHost	mTabHost;
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		// Inflate the menu; this adds items to the action bar if it is present.
-		getMenuInflater().inflate(R.menu.checksaved, menu);
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		// Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case R.id.action_deleteall:
-			{
-				AlertDialog.Builder builder = new Builder(this);
-				builder.setMessage(getString(R.string.str_deletemessage));
-
-				builder.setTitle(getString(R.string.str_confirmdelete));
-
-				builder.setPositiveButton(getString(R.string.str_del),
-						new Dialog.OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								SQLiteDatabase db = dbUtil.OpenDB(
-										SearchHistoryActivity.this, null, false);
-								int a=mTabHost.getCurrentTab();
-								if(mTabHost.getCurrentTab()==0)
-								{
-									
-									db.execSQL("delete from history");
-									SavedSearchFragment f = (SavedSearchFragment)getSupportFragmentManager().findFragmentById(R.id.tab1);
-//									f.searchresult.getData().clear();
-//									f.adapter.notifyDataSetChanged();
-								}
-								else
-								{
-									db.execSQL("delete from favorites");
-									SavedDetailFragment f = (SavedDetailFragment)getSupportFragmentManager().findFragmentById(R.id.tab2);
-//									f.searchresult.getData().clear();
-//									f.adapter.notifyDataSetChanged();
-								}	
-
-
-								dbUtil.CloseDB(db);
-								dialog.dismiss();
-
-							}
-						});
-
-				builder.setNegativeButton(getString(R.string.str_cancel),
-						new Dialog.OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								dialog.dismiss();
-							}
-						});
-
-				builder.create().show();
-
-				break;
-			}
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		Log.d("SearchHistoryActivity", "onCreate");
-
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_search_history);
-		// ActionBar bar = getActionBar();
-		// bar.setTitle("");
-		setupTabs();
-
-	}
-	@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);
-			finish();
-			
-			return false;
-		}
-		return super.onKeyDown(keyCode, event);
-	}
-	private void setupTabs()
-	{
-		mTabHost = (TabHost) this.findViewById(R.id.tabhost);
-
-		mTabHost.setup();
-
-		mTabHost.addTab(mTabHost
-				.newTabSpec(getString(R.string.action_saved_search))
-				.setIndicator(getString(R.string.action_saved_search))
-				.setContent(R.id.tab1));
-
-		mTabHost.addTab(mTabHost.newTabSpec(getString(R.string.action_saved_detail))
-				.setIndicator(getString(R.string.action_saved_detail))
-				.setContent(R.id.tab2));
-
-
-		Fragment favorites = new SavedDetailFragment();
-		Fragment history = new SavedSearchFragment();
-
-		// Add the fragment to the activity, pushing this transaction
-		// on to the back stack.
-
-		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-		ft.replace(R.id.tab1, history);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("search");
-
-		ft.replace(R.id.tab2, favorites);
-		ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-		ft.addToBackStack("detail");
-
-		ft.commit();
-
-	}
-}

+ 0 - 702
Apex Mobile/app/src/main/java/com/usai/apex/SearchListActivity.java

@@ -1,702 +0,0 @@
-package com.usai.apex;
-
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.DatePickerDialog;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.constraint.ConstraintLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.SearchView;
-import android.text.Editable;
-import android.text.InputType;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.inputmethod.EditorInfo;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.DatePicker;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-import com.usai.apex.Result.AMResultActivity;
-import com.usai.apex.apexResult.ApexResultActivity;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import java.util.Calendar;
-import java.util.HashMap;
-
-public class SearchListActivity extends AppCompatActivity implements OnClickListener
-{
-
-
-	public static SearchListActivity instance = null;
-
-	// String[] spin_valbool = { "True", "False" };
-	LinearLayout			ll_list;
-	String					user			= null;
-	// String password = null;
-	String					function_name	= null;
-	HashMap<String, String>	hashMap			= new HashMap<String, String>();
-
-	// private class Field
-	// {
-	// String name;
-	// String value;
-	// public Field(String n,String v)
-	// {
-	// name=n;
-	// value=v;
-	// }
-	// }
-//    private Drawable getNumberDrawable() {
-//        int width = commonUtil.dp2px(getBaseContext(), 58);
-//        int height = commonUtil.dp2px(getBaseContext(), 48);
-//        Bitmap bmp = Bitmap
-//                .createBitmap(width, height, Bitmap.Config.ARGB_8888);// 这个返回的bitmap
-//        // 就是透明的
-//        Canvas canvas = new Canvas(bmp);
-//        Paint paint = new Paint();
-//
-//        RectF oval = new RectF(0, 0, width, height);
-//
-//        // canvas.drawRect(oval, paint);//画上这个就会有黑底
-//        paint.setTextSize(commonUtil.sp2px(getBaseContext(), 28));
-//        Paint.FontMetricsInt fontMetrics = paint.getFontMetricsInt();// 文字大小的设置,要在这个前面,否则文字计算不居中
-//
-//        float baseline = oval.top
-//                + (oval.bottom - oval.top - fontMetrics.bottom + fontMetrics.top)
-//                / 2 - fontMetrics.top;
-//
-//        paint.setTextAlign(Paint.Align.CENTER);
-//        paint.setFlags(Paint.ANTI_ALIAS_FLAG);
-//        paint.setColor(Color.BLACK);
-//        canvas.drawText("Return", oval.centerX(), baseline, paint);
-//
-//        return new BitmapDrawable(getResources(), bmp);
-//    }
-
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-        TextView titleview = mActionBarView.findViewById(R.id.title);
-        titleview.setText(getIntent().getStringExtra("title"));
-
-        setTitle(getIntent().getStringExtra("title"));
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarView, lp);
-//        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//        actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-    }
-
-    private EditText mSearchView;
-    private Button mTableExpandBtn;
-    private boolean mShowTable;
-    private SearchListActivity self = this;
-    private LinearLayout mSearchToolbar;
-
-    @Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_search_list);
-		instance = this;
-        setCustomActionBar();
-//		ActionBar actionBar = getSupportActionBar();
-////		actionBar.setLogo(R.drawable.apexlogo);
-////        actionBar.setIcon(R.drawable.ic_launcher);
-//
-////		actionBar.setDisplayUseLogoEnabled(true);
-//		actionBar.setDisplayShowHomeEnabled(true);
-////        actionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);
-//		actionBar.setHomeButtonEnabled(true);
-//		actionBar.setDisplayHomeAsUpEnabled(false);
-//		actionBar.setHomeActionContentDescription("Return");
-////		actionBar.setDisplayShowTitleEnabled(true);
-//
-		mShowTable = false;
-
-		user = ApexTrackingApplication.get_user();
-
-		// password = ApexTrackingApplication.get_pass();
-		function_name = getIntent().getStringExtra("function_name");
-
-		setTitle(getIntent().getStringExtra("title"));
-
-		ll_list = (LinearLayout) findViewById(R.id.ll_list);
-		final Button btnok = (Button) findViewById(R.id.btnok);
-		btnok.setOnClickListener(this);
-		Button btncancel = (Button) findViewById(R.id.btncancel);
-		btncancel.setOnClickListener(this);
-		Button btnclear = (Button) findViewById(R.id.btn_clear);
-		btnclear.setOnClickListener(this);
-		if (savedInstanceState != null)
-		{
-			hashMap = (HashMap<String, String>) savedInstanceState
-					.getSerializable("hashMap");
-			mShowTable = savedInstanceState.getBoolean("show_table");
-		}
-
-
-		mSearchView = findViewById(R.id.search_view);
-		mSearchView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
-			@Override
-			public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-				if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) { {
-
-					self.onClick(btnok);
-
-					return true;
-				}}
-				return false;
-			}
-		});
-
-		mTableExpandBtn = findViewById(R.id.search_table_expand_btn);
-		mTableExpandBtn.setOnClickListener(new OnClickListener() {
-			@Override
-			public void onClick(View v) {
-				boolean show = (boolean) v.getTag();
-				mShowTable = !show;
-				v.setTag(mShowTable);
-				if (mShowTable) {
-					mTableExpandBtn.setText("Hide Fields");
-				} else {
-					mTableExpandBtn.setText("Show Fields");
-				}
-				init();
-
-			}
-		});
-
-		if (mShowTable) {
-			mTableExpandBtn.setText("Hide Fields");
-		} else {
-			mTableExpandBtn.setText("Show Fields");
-		}
-		mTableExpandBtn.setTag(mShowTable);
-
-		mSearchToolbar = findViewById(R.id.search_tool_bar);
-
-		// 2019.1.9 修改Document和其他一样显示show fields
-//		if (function_name.equals("Download Document")) {
-//			mSearchToolbar.setVisibility(View.GONE);
-//			mShowTable = true;
-//		}
-
-	}
-
-	@Override
-	protected void onResume()
-	{
-		init();
-		super.onResume();
-	}
-
-	void init()
-	{
-		// hashMap.clear();
-		ll_list.removeAllViews();
-
-		if (!mShowTable && hashMap != null) {
-			hashMap.clear();
-			return;
-		}
-
-		SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
-		Cursor cursor = db.query("fields_info", new String[] { "aname",
-				"field_type", "name", "_id" }, "function_name='"
-				+ function_name + "' and user='" + user + "' and behavior="
-				+ Network.BEHAVIOR_SEARCH + " and show = 1", null, null, null,
-				"priority , aname", null);
-		while (cursor.moveToNext())
-		{
-			final String aname = cursor.getString(0);
-			String field_type = cursor.getString(1);
-			final String name = cursor.getString(2);
-
-			// hashMap.put(aname, field);
-
-			if (field_type.equals("boolean"))
-			{
-				ConstraintLayout spinneritem = (ConstraintLayout) this
-						.getLayoutInflater().inflate(
-								R.layout.search_item_spinner, null);
-				spinneritem.setTag("search_item_spinner");
-				TextView tvname = (TextView) spinneritem
-						.findViewById(R.id.aname);
-				tvname.setText(aname);
-				tvname.setTag(name);
-				Spinner spinner_bool = (Spinner) spinneritem
-						.findViewById(R.id.sp_bool);
-				ArrayAdapter<CharSequence> adapter = ArrayAdapter
-						.createFromResource(this, R.array.spinner_bool_val,
-								android.R.layout.simple_spinner_item);
-				adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-				spinner_bool.setAdapter(adapter);
-				String val = hashMap.get(name);
-				if (val != null)
-				{
-					if (val.equals("true"))
-						spinner_bool.setSelection(1);
-					else if (val.equals("false"))
-						spinner_bool.setSelection(2);
-					else
-						spinner_bool.setSelection(0);
-				}
-
-				spinner_bool
-						.setOnItemSelectedListener(new OnItemSelectedListener()
-						{
-
-							@Override
-							public void onItemSelected(AdapterView<?> arg0,
-									View arg1, int arg2, long arg3)
-							{
-								if (arg2 == 1)
-									hashMap.put(name, "true");
-								else if (arg2 == 2)
-									hashMap.put(name, "false");
-
-							}
-
-							@Override
-							public void onNothingSelected(AdapterView<?> arg0)
-							{
-
-							}
-
-						});
-				// String val = hashMap.get(name);
-				// if(val!=null)
-
-				// switch_bool.setOnCheckedChangeListener(new
-				// CompoundButton.OnCheckedChangeListener(){
-				//
-				// @Override
-				// public void onCheckedChanged(CompoundButton buttonView,
-				// boolean isChecked)
-				// {
-				// String val;
-				// if(isChecked)
-				// val="true";
-				// else
-				// val="false";
-				// Field field = new Field(name,val);
-				// field.name = name;
-				// hashMap.put(aname,field);
-				//
-				// }
-				//
-				// });
-				ll_list.addView(spinneritem);
-			}
-			else if (field_type.equals("time"))
-			{
-
-				ConstraintLayout timeitem = (ConstraintLayout) this
-						.getLayoutInflater().inflate(
-								R.layout.search_item_datepicker, null);
-				timeitem.setTag("search_item_datepicker");
-				TextView tvname = (TextView) timeitem.findViewById(R.id.aname);
-				tvname.setText(aname);
-				tvname.setTag(name);
-				final EditText edit_from = (EditText) timeitem
-						.findViewById(R.id.et_from);
-				final EditText edit_to = (EditText) timeitem
-						.findViewById(R.id.et_to);
-
-				String val_from = hashMap.get(name + "_from");
-				String val_to = hashMap.get(name + "_to");
-				if (val_from != null)
-				{
-					edit_from.setText(val_from);
-				}
-				if (val_to != null)
-					edit_to.setText(val_to);
-				// edit_from.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE
-				// | InputType.TYPE_CLASS_DATETIME);
-				final Calendar c = Calendar.getInstance();
-				// int mYear =
-				// int mMonth = c.get(Calendar.MONTH);
-				// int mDay = c.get(Calendar.DAY_OF_MONTH);
-				// final DatePickerDialog dialog =
-				Button btn_clear_from = (Button) timeitem
-						.findViewById(R.id.btn_clear_from);
-				btn_clear_from.setOnClickListener(new OnClickListener()
-				{
-
-					@Override
-					public void onClick(View v)
-					{
-						edit_from.setText("");
-						hashMap.remove(name + "_from");
-
-					}
-
-				});
-				Button btn_clear_to = (Button) timeitem
-						.findViewById(R.id.btn_clear_to);
-				btn_clear_to.setOnClickListener(new OnClickListener()
-				{
-
-					@Override
-					public void onClick(View v)
-					{
-						edit_to.setText("");
-						hashMap.remove(name + "_to");
-
-					}
-
-				});
-
-				edit_from.setOnClickListener(new OnClickListener()
-				{
-					public void onClick(View v)
-					{
-						new DatePickerDialog(SearchListActivity.this,
-								new DatePickerDialog.OnDateSetListener()
-								{
-
-									@Override
-									public void onDateSet(DatePicker view,
-											int year, int monthOfYear,
-											int dayOfMonth)
-									{
-										edit_from
-												.setText((monthOfYear + 1)
-														+ "/" + dayOfMonth
-														+ "/" + year);
-										hashMap.put(name + "_from",
-												(monthOfYear + 1) + "/"
-														+ dayOfMonth + "/"
-														+ year);
-
-									}
-
-								}, c.get(Calendar.YEAR), c.get(Calendar.MONTH),
-								c.get(Calendar.DAY_OF_MONTH)).show();
-
-					}
-				});
-
-				edit_to.setOnClickListener(new OnClickListener()
-				{
-					public void onClick(View v)
-					{
-						new DatePickerDialog(SearchListActivity.this,
-								new DatePickerDialog.OnDateSetListener()
-								{
-
-									@Override
-									public void onDateSet(DatePicker view,
-											int year, int monthOfYear,
-											int dayOfMonth)
-									{
-										edit_to.setText((monthOfYear + 1) + "/"
-												+ dayOfMonth + "/" + year);
-										hashMap.put(name + "_to",
-												(monthOfYear + 1) + "/"
-														+ dayOfMonth + "/"
-														+ year);
-
-									}
-
-								}, c.get(Calendar.YEAR), c.get(Calendar.MONTH),
-								c.get(Calendar.DAY_OF_MONTH)).show();
-
-					}
-				});
-
-				ll_list.addView(timeitem);
-			}
-			else
-			{
-				ConstraintLayout edititem = (ConstraintLayout) this
-						.getLayoutInflater().inflate(R.layout.search_item_edit,
-								null);
-				edititem.setTag("search_item_edit");
-				TextView tvname = (TextView) edititem.findViewById(R.id.aname);
-				tvname.setText(aname);
-				tvname.setTag(name);
-
-				AutoCompleteTextView edit = (AutoCompleteTextView) edititem
-						.findViewById(R.id.edit_val);
-				ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
-						android.R.layout.simple_dropdown_item_1line,
-						dbUtil.get_searchhistory(name));
-				edit.setAdapter(adapter);
-
-				String val = hashMap.get(name);
-				if (val != null)
-				{
-					edit.setText(val);
-				}
-				edit.addTextChangedListener(new TextWatcher()
-				{
-					@Override
-					public void onTextChanged(CharSequence s, int start,
-							int before, int count)
-					{
-
-					}
-
-					@Override
-					public void beforeTextChanged(CharSequence s, int start,
-							int count, int after)
-					{
-
-					}
-
-					@Override
-					public void afterTextChanged(Editable s)
-					{
-						String val = s.toString();
-						val.trim();
-						if (val.length() >= 0)
-						{
-
-							hashMap.put(name, val);
-						}
-					}
-
-				});
-				if (field_type.equals("int"))
-					edit.setInputType(InputType.TYPE_CLASS_NUMBER);
-
-				ll_list.addView(edititem);
-			}
-		}
-		dbUtil.CloseCursor(cursor);
-		dbUtil.CloseDB(db);
-	}
-
-	@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_list, menu);
-		return true;
-	}
-
-	@Override
-	protected void onSaveInstanceState(Bundle outState)
-	{
-		outState.putBoolean("show_table",mShowTable);
-		outState.putSerializable("hashmap", hashMap);
-		super.onSaveInstanceState(outState);
-	}
-
-	@Override
-	public void onClick(View v)
-	{
-		switch (v.getId())
-		{
-			case R.id.btnok:
-			{
-//				Intent intent = new Intent();
-//				intent.setClass(this, ResultActivity.class);
-//				// intent.putExtra("user", user);
-//				// intent.putExtra("password", password);
-//				intent.putExtra("function_name", function_name);
-				Bundle parms = new Bundle();
-
-				boolean hascriterion = false;
-				for (int i = 0; i < ll_list.getChildCount(); i++)
-				{
-					View item = ll_list.getChildAt(i);
-					String tag = item.getTag().toString();
-					TextView tv_aname = (TextView) item
-							.findViewById(R.id.aname);
-					String field_name = tv_aname.getTag().toString();
-					String val = "";
-					if (tag.equals("search_item_spinner"))
-					{
-						Spinner spinner_bool = (Spinner) item
-								.findViewById(R.id.sp_bool);
-						long sel = spinner_bool.getSelectedItemId();
-						if (sel == 1)
-							val = "true";
-						else if (sel == 2)
-							val = "false";
-						else
-							val = "";
-						if (!TextUtils.isEmpty(val))
-						{
-							parms.putString(field_name, val);
-							hascriterion = true;
-						}
-					}
-					else if (tag.equals("search_item_edit"))
-					{
-						AutoCompleteTextView edit = (AutoCompleteTextView) item
-								.findViewById(R.id.edit_val);
-						val = edit.getText().toString().trim();
-						if (!TextUtils.isEmpty(val))
-						{
-							parms.putString(field_name, val);
-							hascriterion = true;
-
-							dbUtil.savehistory(field_name, val);
-						}
-					}
-					else if (tag.equals("search_item_datepicker"))
-					{
-						EditText et_from = (EditText) item
-								.findViewById(R.id.et_from);
-						String val_from = et_from.getText().toString().trim();
-						EditText et_to = (EditText) item
-								.findViewById(R.id.et_to);
-						String val_to = et_to.getText().toString().trim();
-						if (!TextUtils.isEmpty(val_from))
-						{
-							parms.putString(field_name + "_from", val_from);
-							hascriterion = true;
-						}
-						if (!TextUtils.isEmpty(val_to))
-						{
-							parms.putString(field_name + "_to", val_to);
-							hascriterion = true;
-						}
-					}
-
-				}
-				// String criterion = "";
-				// if (hascriterion)
-				// {
-				// criterion = parms.toString();
-				// }
-
-				CharSequence keywordChar = mSearchView.getText();
-				if (keywordChar != null) {
-					String keyword = keywordChar.toString();
-					parms.putString("keyword",keyword);
-				}
-
-				parms.putString("module_name", function_name);
-				parms.putString("columns",
-						dbUtil.get_fields(user, function_name));
-				// Iterator<String> iter = hashMap.keySet().iterator();
-				// while (iter.hasNext())
-				// {
-				// String aname = (String) iter.next();
-				// Field field = (Field) hashMap.get(aname);
-				// parms.putString(field.name, field.value);
-				// }
-//				intent.putExtra("searchParms", parms);
-
-//				startActivity(intent);
-
-				// after 2019.1.8
-				ApexResultActivity.startResultActivity(this, parms);
-
-				// before 2019.1.8
-//				Intent intent = new Intent(this, AMResultActivity.class);
-//				intent.putExtra("query_params",parms);
-//				startActivity(intent);
-				break;
-			}
-			case R.id.btncancel:
-				finish();
-				break;
-			case R.id.btn_clear:
-			{
-				AlertDialog.Builder builder = new Builder(
-						SearchListActivity.this);
-				builder.setMessage("Click Reset button to reset");
-
-				builder.setTitle("Confirm reset");
-
-				builder.setPositiveButton("Reset", new Dialog.OnClickListener()
-				{
-
-					@Override
-					public void onClick(DialogInterface dialog, int which)
-					{
-						hashMap.clear();
-						init();
-						dialog.dismiss();
-
-					}
-				});
-
-				builder.setNegativeButton("Cancel",
-						new Dialog.OnClickListener()
-						{
-
-							@Override
-							public void onClick(DialogInterface dialog,
-									int which)
-							{
-								dialog.dismiss();
-							}
-						});
-
-				builder.create().show();
-			}
-			default:
-				break;
-		}
-
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-            case android.R.id.home:
-                finish();
-                break;
-			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);
-	}
-}

+ 0 - 78
Apex Mobile/app/src/main/java/com/usai/apex/SearchResult.java

@@ -1,78 +0,0 @@
-package com.usai.apex;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.util.Log;
-
-public class SearchResult implements Serializable
-{
-	/**
-	 * 
-	 */
-	private static final long	serialVersionUID	= 8847830656864696392L;
-	int total_count = -1;
-	// int direction = 1;
-	int offset = 0;
-	// int count = 0;
-	ArrayList<HashMap<String, String>> records = new ArrayList<HashMap<String, String>>();
-
-	public int get_recordscount() {
-		return records.size();
-	}
-
-	public HashMap<String, String> get_record(int i) {
-		return records.get(i);
-	}
-
-	public void add_records(String jsonstr) {
-		try {
-			records.clear();
-			JSONObject objrecords = new JSONObject(jsonstr);
-			for (int i = 0; i < objrecords.length(); i++) {
-				// offset++;
-				JSONObject rec = objrecords.getJSONObject("record" + i);
-				Iterator<?> it = rec.keys();
-				HashMap<String, String> record = new HashMap<String, String>();
-				while (it.hasNext()) // loop for each function
-				{
-					String field_name = (String) it.next();
-					String val = rec.getString(field_name)
-							.replace("\n", "");
-					record.put(field_name, val);
-				}
-				records.add(record);
-
-			}
-
-		} catch (JSONException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		String TAG = "init_fields@ResultActivity.SearchResult";
-		Log.d(TAG, jsonstr);
-	}
-
-	public int get_totalcount() {
-		return total_count;
-	}
-
-	public void put_totalcount(int c) {
-		total_count = c;
-	}
-
-	public int get_offset() {
-		return offset;
-	}
-
-
-	public void set_offset(int i) {
-		offset = i;
-
-	}
-}

+ 0 - 174
Apex Mobile/app/src/main/java/com/usai/apex/SegmentView.java

@@ -1,174 +0,0 @@
-package com.usai.apex;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-/**
- * Created by ray on 26/02/2018.
- */
-
-public class SegmentView extends LinearLayout {
-    private TextView leftTextView;
-    private TextView rightTextView;
-    private onSegmentViewClickListener segmentListener;
-
-    // 这是代码加载ui必须重写的方法
-    public SegmentView(Context context) {
-        super(context);
-        initView();
-    }
-
-    // 这是在xml布局使用必须重写的方法
-    public SegmentView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        initView();
-    }
-
-    private void initView() {
-        leftTextView = new TextView(getContext());
-        rightTextView = new TextView(getContext());
-
-        leftTextView.setSingleLine();
-        rightTextView.setSingleLine();
-
-//        leftTextView.setPadding(8,0,8,0);
-//        rightTextView.setPadding(8,0,8,0);
-
-        // 设置textview的布局宽高并设置为weight属性都为1
-        leftTextView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1));
-        rightTextView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1));
-
-        // 初始化的默认文字
-        leftTextView.setText("H BOL");
-        rightTextView.setText("Container#");
-
-        // 实现不同的按钮状态,不同的颜色
-        ColorStateList csl = getResources().getColorStateList(R.color.segment_text_color_select);
-        leftTextView.setTextColor(csl);
-        rightTextView.setTextColor(csl);
-
-        // 设置textview的内容位置居中
-        leftTextView.setGravity(Gravity.CENTER);
-        rightTextView.setGravity(Gravity.CENTER);
-
-        // 设置textview的内边距
-        leftTextView.setPadding(10, 10, 10, 10);
-        rightTextView.setPadding(10, 10, 10, 10);
-
-        // 设置文字大小
-        setSegmentTextSize(17);
-
-        // 设置背景资源
-        leftTextView.setBackgroundResource(R.drawable.segment_left_background);
-        rightTextView.setBackgroundResource(R.drawable.segment_right_background);
-
-        // 默认左侧textview为选中状态
-        leftTextView.setSelected(true);
-
-        // 加入textview
-        this.removeAllViews();
-        this.addView(leftTextView);
-        this.addView(rightTextView);
-        this.invalidate();//重新draw()
-
-        leftTextView.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (leftTextView.isSelected()) {
-                    return;
-                }
-                leftTextView.setSelected(true);
-                rightTextView.setSelected(false);
-                if (segmentListener != null) {
-                    segmentListener.onSegmentViewClick(leftTextView, 0);
-                }
-            }
-        });
-
-        rightTextView.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (rightTextView.isSelected()) {
-                    return;
-                }
-                rightTextView.setSelected(true);
-                leftTextView.setSelected(false);
-                if (segmentListener != null) {
-                    segmentListener.onSegmentViewClick(rightTextView, 1);
-                }
-            }
-        });
-
-    }
-
-    /**
-     * 设置字体大小
-     *
-     * @param dp
-     */
-    private void setSegmentTextSize(int dp) {
-        leftTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, dp);
-        rightTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, dp);
-    }
-
-    /**
-     * 手动设置选中的状态
-     *
-     * @param i
-     */
-    public void setSelect(int i) {
-        if (i == 0) {
-            leftTextView.setSelected(true);
-            rightTextView.setSelected(false);
-        } else {
-            leftTextView.setSelected(false);
-            rightTextView.setSelected(true);
-        }
-    }
-
-
-
-
-    /**
-     * 获取当前选中状态 0=left, 1=right
-     *
-     * @param i
-     */
-    public int getSelect() {
-        if (leftTextView.isSelected()) {
-            return  0;
-        } else {
-         return 1;
-        }
-    }
-    /**
-     * 设置控件显示的文字
-     *
-     * @param text
-     * @param position
-     */
-    public void setSegmentText(CharSequence text, int position) {
-        if (position == 0) {
-            leftTextView.setText(text);
-        }
-        if (position == 1) {
-            rightTextView.setText(text);
-        }
-    }
-
-    // 定义一个接口接收点击事件
-    public interface onSegmentViewClickListener {
-        public void onSegmentViewClick(View view, int postion);
-    }
-
-    public void setOnSegmentViewClickListener(onSegmentViewClickListener segmentListener) {
-        this.segmentListener = segmentListener;
-    }
-
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 79
Apex Mobile/app/src/main/java/com/usai/apex/ServiceLocationFragment.java


+ 0 - 371
Apex Mobile/app/src/main/java/com/usai/apex/SettingsActivity.java

@@ -1,371 +0,0 @@
-package com.usai.apex;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
-import android.preference.RingtonePreference;
-import android.text.TextUtils;
-
-import java.util.List;
-
-/**
- * A {@link PreferenceActivity} that presents a set of application settings. On
- * handset devices, settings are presented as a single list. On tablets,
- * settings are split by category, with category headers shown to the left of
- * the list of settings.
- * <p>
- * See <a href="http://developer.android.com/design/patterns/settings.html">
- * Android Design: Settings</a> for design guidelines and the <a
- * href="http://developer.android.com/guide/topics/ui/settings.html">Settings
- * API Guide</a> for more information on developing a Settings UI.
- */
-public class SettingsActivity extends PreferenceActivity
-{
-	/**
-	 * Determines whether to always show the simplified settings UI, where
-	 * settings are presented in a single list. When false, settings are shown
-	 * as a master/detail two-pane view on tablets. When true, a single pane is
-	 * shown on tablets.
-	 */
-//	private static final boolean	ALWAYS_SIMPLE_PREFS	= false;
-//
-//	@Override
-//	protected void onPostCreate(Bundle savedInstanceState)
-//	{
-//		super.onPostCreate(savedInstanceState);
-//
-//		
-//	}
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-		
-		super.onCreate(savedInstanceState);
-		setupSimplePreferencesScreen();
-		
-	}
-
-	/**
-	 * Shows the simplified settings UI if the device configuration if the
-	 * device configuration dictates that a simplified, single-pane UI should be
-	 * shown.
-	 */
-	private void setupSimplePreferencesScreen()
-	{
-//		if (!isSimplePreferences(this))
-//		{
-//			return;
-//		}
-
-		getPreferenceManager().setSharedPreferencesName("setting");
-		// In the simplified UI, fragments are not used at all and we instead
-		// use the older PreferenceActivity APIs.
-
-		// Add 'general' preferences.
-		addPreferencesFromResource(R.xml.setting);
-
-//		// Add 'notifications' preferences, and a corresponding header.
-//		PreferenceCategory fakeHeader = new PreferenceCategory(this);
-//		fakeHeader.setTitle(R.string.pref_header_notifications);
-//		getPreferenceScreen().addPreference(fakeHeader);
-//		addPreferencesFromResource(R.xml.pref_notification);
-//
-//		// Add 'data and sync' preferences, and a corresponding header.
-//		fakeHeader = new PreferenceCategory(this);
-//		fakeHeader.setTitle(R.string.pref_header_data_sync);
-//		getPreferenceScreen().addPreference(fakeHeader);
-//		addPreferencesFromResource(R.xml.pref_data_sync);
-//
-//		// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
-//		// their values. When their values change, their summaries are updated
-//		// to reflect the new value, per the Android Design guidelines.
-//		bindPreferenceSummaryToValue(findPreference("example_text"));
-//		bindPreferenceSummaryToValue(findPreference("example_list"));
-//		bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
-//		bindPreferenceSummaryToValue(findPreference("sync_frequency"));
-	}
-
-//	/** {@inheritDoc} */
-//	@Override
-//	public boolean onIsMultiPane()
-//	{
-//		return isXLargeTablet(this) && !isSimplePreferences(this);
-//	}
-
-	/**
-	 * Helper method to determine if the device has an extra-large screen. For
-	 * example, 10" tablets are extra-large.
-	 */
-//	private static boolean isXLargeTablet(Context context)
-//	{
-//		return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
-//	}
-
-	/**
-	 * Determines whether the simplified settings UI should be shown. This is
-	 * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
-	 * doesn't have newer APIs like {@link PreferenceFragment}, or the device
-	 * doesn't have an extra-large screen. In these cases, a single-pane
-	 * "simplified" settings UI should be shown.
-	 */
-//	private static boolean isSimplePreferences(Context context)
-//	{
-//		return ALWAYS_SIMPLE_PREFS
-//				|| Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
-//				|| !isXLargeTablet(context);
-//	}
-
-//	/** {@inheritDoc} */
-//	@Override
-//	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-//	public void onBuildHeaders(List<Header> target)
-//	{
-//		if (!isSimplePreferences(this))
-//		{
-//			loadHeadersFromResource(R.xml.pref_headers, target);
-//		}
-//	}
-
-	/**
-	 * A preference value change listener that updates the preference's summary
-	 * to reflect its new value.
-	 */
-	// private static Preference.OnPreferenceChangeListener
-	// sBindPreferenceSummaryToValueListener = new
-	// Preference.OnPreferenceChangeListener()
-	// {
-	// @Override
-	// public boolean onPreferenceChange(
-	// Preference preference,
-	// Object value)
-	// {
-	// String stringValue = value
-	// .toString();
-	//
-	// if (preference instanceof ListPreference)
-	// {
-	// // For
-	// // list
-	// // preferences,
-	// // look
-	// // up
-	// // the
-	// // correct
-	// // display
-	// // value
-	// // in
-	// // the
-	// // preference's
-	// // 'entries'
-	// // list.
-	// ListPreference listPreference = (ListPreference) preference;
-	// int index = listPreference
-	// .findIndexOfValue(stringValue);
-	//
-	// // Set
-	// // the
-	// // summary
-	// // to
-	// // reflect
-	// // the
-	// // new
-	// // value.
-	// preference
-	// .setSummary(index >= 0 ? listPreference
-	// .getEntries()[index]
-	// : null);
-	//
-	// }
-	// else if (preference instanceof RingtonePreference)
-	// {
-	// // For
-	// // ringtone
-	// // preferences,
-	// // look
-	// // up
-	// // the
-	// // correct
-	// // display
-	// // value
-	// // using
-	// // RingtoneManager.
-	// if (TextUtils
-	// .isEmpty(stringValue))
-	// {
-	// // Empty
-	// // values
-	// // correspond
-	// // to
-	// // 'silent'
-	// // (no
-	// // ringtone).
-	// preference
-	// .setSummary(R.string.pref_ringtone_silent);
-	//
-	// }
-	// else
-	// {
-	// Ringtone ringtone = RingtoneManager
-	// .getRingtone(
-	// preference
-	// .getContext(),
-	// Uri.parse(stringValue));
-	//
-	// if (ringtone == null)
-	// {
-	// // Clear
-	// // the
-	// // summary
-	// // if
-	// // there
-	// // was
-	// // a
-	// // lookup
-	// // error.
-	// preference
-	// .setSummary(null);
-	// }
-	// else
-	// {
-	// // Set
-	// // the
-	// // summary
-	// // to
-	// // reflect
-	// // the
-	// // new
-	// // ringtone
-	// // display
-	// // name.
-	// String name = ringtone
-	// .getTitle(preference
-	// .getContext());
-	// preference
-	// .setSummary(name);
-	// }
-	// }
-	//
-	// }
-	// else
-	// {
-	// // For
-	// // all
-	// // other
-	// // preferences,
-	// // set
-	// // the
-	// // summary
-	// // to
-	// // the
-	// // value's
-	// // simple
-	// // string
-	// // representation.
-	// preference
-	// .setSummary(stringValue);
-	// }
-	// return true;
-	// }
-	// };
-
-	/**
-	 * Binds a preference's summary to its value. More specifically, when the
-	 * preference's value is changed, its summary (line of text below the
-	 * preference title) is updated to reflect the value. The summary is also
-	 * immediately updated upon calling this method. The exact display format is
-	 * dependent on the type of preference.
-	 * 
-	 * @see #sBindPreferenceSummaryToValueListener
-	 */
-//	private static void bindPreferenceSummaryToValue(Preference preference)
-//	{
-//		// Set the listener to watch for value changes.
-//		preference
-//				.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
-//
-//		// Trigger the listener immediately with the preference's
-//		// current value.
-//		sBindPreferenceSummaryToValueListener.onPreferenceChange(
-//				preference,
-//				PreferenceManager.getDefaultSharedPreferences(
-//						preference.getContext()).getString(preference.getKey(),
-//						""));
-//	}
-
-	/**
-	 * This fragment shows general preferences only. It is used when the
-	 * activity is showing a two-pane settings UI.
-	 */
-//	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-//	public static class GeneralPreferenceFragment extends PreferenceFragment
-//	{
-//		@Override
-//		public void onCreate(Bundle savedInstanceState)
-//		{
-//			super.onCreate(savedInstanceState);
-//			addPreferencesFromResource(R.xml.pref_general);
-//
-//			// Bind the summaries of EditText/List/Dialog/Ringtone preferences
-//			// to their values. When their values change, their summaries are
-//			// updated to reflect the new value, per the Android Design
-//			// guidelines.
-//			bindPreferenceSummaryToValue(findPreference("example_text"));
-//			bindPreferenceSummaryToValue(findPreference("example_list"));
-//		}
-//	}
-
-	/**
-	 * This fragment shows notification preferences only. It is used when the
-	 * activity is showing a two-pane settings UI.
-	 */
-//	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-//	public static class NotificationPreferenceFragment extends
-//			PreferenceFragment
-//	{
-//		@Override
-//		public void onCreate(Bundle savedInstanceState)
-//		{
-//			super.onCreate(savedInstanceState);
-//			addPreferencesFromResource(R.xml.pref_notification);
-//
-//			// Bind the summaries of EditText/List/Dialog/Ringtone preferences
-//			// to their values. When their values change, their summaries are
-//			// updated to reflect the new value, per the Android Design
-//			// guidelines.
-//			bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
-//		}
-//	}
-
-	/**
-	 * This fragment shows data and sync preferences only. It is used when the
-	 * activity is showing a two-pane settings UI.
-	 */
-//	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-//	public static class DataSyncPreferenceFragment extends PreferenceFragment
-//	{
-//		@Override
-//		public void onCreate(Bundle savedInstanceState)
-//		{
-//			super.onCreate(savedInstanceState);
-//			addPreferencesFromResource(R.xml.pref_data_sync);
-//
-//			// Bind the summaries of EditText/List/Dialog/Ringtone preferences
-//			// to their values. When their values change, their summaries are
-//			// updated to reflect the new value, per the Android Design
-//			// guidelines.
-//			bindPreferenceSummaryToValue(findPreference("sync_frequency"));
-//		}
-//	}
-}

+ 0 - 735
Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java

@@ -1,735 +0,0 @@
-package com.usai.apex.ShipMap;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.support.annotation.CallSuper;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageButton;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.baidu.mapapi.SDKInitializer;
-import com.baidu.mapapi.map.BaiduMap;
-import com.baidu.mapapi.map.BitmapDescriptor;
-import com.baidu.mapapi.map.BitmapDescriptorFactory;
-import com.baidu.mapapi.map.InfoWindow;
-import com.baidu.mapapi.map.MapStatus;
-import com.baidu.mapapi.map.MapStatusUpdate;
-import com.baidu.mapapi.map.MapStatusUpdateFactory;
-import com.baidu.mapapi.map.MapView;
-import com.baidu.mapapi.map.Marker;
-import com.baidu.mapapi.map.MarkerOptions;
-import com.baidu.mapapi.model.LatLng;
-import com.google.android.gms.maps.CameraUpdate;
-import com.google.android.gms.maps.CameraUpdateFactory;
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.MapFragment;
-import com.google.android.gms.maps.OnMapReadyCallback;
-import com.google.android.gms.maps.model.CameraPosition;
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.lang.ref.WeakReference;
-import java.util.Timer;
-import java.util.TimerTask;
-
-public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickListener, BaiduMap.OnMarkerClickListener, GoogleMap.OnInfoWindowClickListener, OnMapReadyCallback, InfoWindow.OnInfoWindowClickListener {
-
-    private MapFragment mGoogleMapView;
-    private GoogleMap mGoogleMap;
-    private com.google.android.gms.maps.MapView mMap;
-
-    private MapView mBaiduMap;
-    private Context mContext;
-    private Boolean mUseGoogleMap;
-
-    private ShipMapListener mListener;
-    private ShipMap self = this;
-
-    private ImageButton mResizeBtn;
-
-    public ShipMap(Context context) {
-        super(context);
-        init(context);
-    }
-
-    public ShipMap(Context context, @Nullable AttributeSet attrs) {
-        super(context, attrs);
-        init(context);
-    }
-
-    public ShipMap(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-        init(context);
-    }
-
-
-    @CallSuper
-    protected void onDetachedFromWindow() {
-        super.onDetachedFromWindow();
-        destroy();
-    }
-    /**
-     * 防止恢复时报错Duplicate id 0x7f0b00d6, tag null, or parent id 0xffffffff with another fragment
-     * 需要在父fragment销毁时调用
-     * */
-    public void destroy() {
-        //
-        if (mUseGoogleMap && mGoogleMapView != null && mContext != null) {
-            ((Activity)mContext).getFragmentManager().beginTransaction().remove(mGoogleMapView).commit();
-        }
-
-        stopTwinkle();
-    }
-
-    private void init(Context ctx) {
-        mContext = ctx;
-
-        PackageInfo packageInfo;
-        try {
-            packageInfo = mContext.getPackageManager().getPackageInfo("com.google.android.gms", 0);
-
-        } catch (PackageManager.NameNotFoundException e) {
-            packageInfo = null;
-            e.printStackTrace();
-        }
-        if (packageInfo == null) {
-            mUseGoogleMap = false;
-            System.out.println("没有安装");
-        } else {
-            mUseGoogleMap = true;
-            System.out.println("已经安装");
-        }
-//        mUseGoogleMap = false;
-
-//        GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext.getApplicationContext());
-
-        if (mUseGoogleMap) {
-
-//            googleMap = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
-
-            View relativeLayout = LayoutInflater.from(mContext).inflate(R.layout.ship_google_map,null);
-//            mGoogleMapView = relativeLayout.findViewById(R.id.ship_google_map);
-//            mGoogleMapView = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
-//            mGoogleMapView.getMapAsync(this);
-
-            mMap = relativeLayout.findViewById(R.id.ship_google_map);
-            mMap.onCreate(null);
-            mMap.onResume();
-            mMap.getMapAsync(this);
-
-            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
-            relativeLayout.setBackgroundColor(Color.parseColor("#EFEFF4"));
-            addView(relativeLayout,layoutParams);
-
-        } else {
-
-            SDKInitializer.initialize(ApexTrackingApplication.get_instance());
-            mBaiduMap = new MapView(mContext);
-            mBaiduMap.getMap().setOnMarkerClickListener(this);
-
-            // 设置当前缩放
-            MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(mBaiduMap.getMap().getMinZoomLevel());
-            mBaiduMap.getMap().setMapStatus(u);
-            mBaiduMap.showZoomControls(false); // false不显示缩放按钮
-            mBaiduMap.getMap().getUiSettings().setRotateGesturesEnabled(false); // 禁止旋转
-            mBaiduMap.getMap().getUiSettings().setOverlookingGesturesEnabled(false); // 禁止俯视调整
-
-
-            LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
-            mBaiduMap.setBackgroundColor(Color.parseColor("#EFEFF4"));
-            addView(mBaiduMap,layoutParams);
-        }
-
-        ImageButton resizeBtn = new ImageButton(mContext);
-        resizeBtn.setImageResource(R.drawable.resize_max);
-        resizeBtn.setBackgroundResource(R.drawable.clear_background);
-        resizeBtn.setTag(false);
-
-        LayoutParams layoutParams = new LayoutParams(dp2px(mContext,30.0f),dp2px(mContext,30.0f));
-        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
-        layoutParams.setMargins(0,dp2px(mContext,10.0f),dp2px(mContext,10.0f),0);
-
-        addView(resizeBtn,layoutParams);
-        mResizeBtn = resizeBtn;
-
-        resizeBtn.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                ImageButton zoomBtn = (ImageButton)v;
-                boolean selected = (boolean) zoomBtn.getTag();
-                selected = !selected;
-
-                setZoomIn(selected);
-
-            }
-        });
-
-    }
-
-    public void setZoomIn(boolean zoomIn) {
-
-        mResizeBtn.setTag(zoomIn);
-
-        if (zoomIn) {
-            mResizeBtn.setImageResource(R.drawable.resize_min);
-        } else {
-            mResizeBtn.setImageResource(R.drawable.resize_max);
-        }
-
-        if (mListener != null) {
-            mListener.shipMapTryToZoomIn(self,zoomIn);
-        }
-
-    }
-
-
-    public static int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    private static int AnnotationDisplayPriorityRequired = 2;
-    private static int AnnotationDisplayPriorityHigh= 1;
-    private static int AnnotationDisplayPriorityLow = 0;
-
-    private JSONObject mAnnotation;
-
-    private Marker mCurrentBaiduMarker;
-    private com.google.android.gms.maps.model.Marker mCurrentGoogleMarker;
-    public void showShipAnnotation(JSONObject annotation) {
-        if (annotation == null) {
-            return;
-        }
-
-        mCurrentGoogleMarker = null;
-        mCurrentBaiduMarker = null;
-
-        if (mUseGoogleMap) {
-           if (mGoogleMap != null) {
-               mGoogleMap.clear();
-           } else {
-               mAnnotation = annotation;
-               return;
-           }
-        } else {
-            mBaiduMap.getMap().clear();
-        }
-        mAnnotation = null;
-
-        JSONObject pol = annotation.optJSONObject("pol");
-        if (showPol()) {
-
-            if (pol != null) {
-                try {
-                    pol.put("port","Port Of Load");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(pol,AnnotationDisplayPriorityHigh,R.drawable.new_location_pol);
-            }
-        }
-
-        JSONObject pod = annotation.optJSONObject("pod");
-        if (showPod()) {
-
-            if (pod != null) {
-                try {
-                    pod.put("port","Port Of Discharge");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(pod,AnnotationDisplayPriorityHigh,R.drawable.new_location_pod);
-            }
-        }
-
-        JSONObject poe = annotation.optJSONObject("poe");
-        if (showPoe()) {
-
-            if (poe != null) {
-                try {
-                    poe.put("port","Place Of Deliver");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(poe,AnnotationDisplayPriorityLow,R.drawable.new_location_poe);
-            }
-        }
-
-        JSONObject por = annotation.optJSONObject("por");
-        if (showPor()) {
-
-            if (por != null) {
-                try {
-                    por.put("port","Place Of Receipt");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(por,AnnotationDisplayPriorityLow,R.drawable.new_location_por);
-            }
-        }
-
-        JSONObject origin = annotation.optJSONObject("origin");
-        if (showOrigin()) {
-
-            if (origin != null) {
-                try {
-                    origin.put("port","Origin");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(origin,AnnotationDisplayPriorityLow,R.drawable.new_location_origin);
-            }
-        }
-
-        JSONObject destination = annotation.optJSONObject("destination");
-        if (showDestination()) {
-
-            if (destination != null) {
-                try {
-                    destination.put("port","Destination");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(destination,AnnotationDisplayPriorityLow,R.drawable.new_location_destination);
-            }
-        }
-
-        JSONObject current = annotation.optJSONObject("current");
-        if (showCurrent()) {
-            if (current != null) {
-                try {
-                    current.put("port","Vessel");
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                }
-                handleLocation(current,AnnotationDisplayPriorityRequired,R.drawable.ic_marker);
-            }
-        }
-
-
-        if (current != null && showCurrent()) {
-            moveToLocation(current);
-            if (mTwinkleCurrent) {
-                startTwinkle();
-            }
-        } else if (pol != null && showPol()) {
-            moveToLocation(pol);
-        } else if (pod != null && showPod()) {
-            moveToLocation(pod);
-        }
-
-
-    }
-
-    private Timer mTimer;
-    private TimerHandler mTimerHandler = new TimerHandler(this);
-    private TimerTask mTimerTask;
-    private void startTwinkle() {
-
-        if (mCurrentGoogleMarker == null && mCurrentBaiduMarker == null) {
-            return;
-        }
-
-        if (mTimer != null && mTimerTask != null) {
-            return;
-        }
-
-        mTimer = new Timer();
-        mTimerTask = new TimerTask() {
-            @Override
-            public void run() {
-                Message msg = new Message();
-                mTimerHandler.sendMessage(msg);
-            }
-        };
-        mTimer.schedule(mTimerTask,100,100);
-    }
-
-    private void stopTwinkle() {
-        if (mTimer != null) {
-            mTimer.cancel();
-        }
-        if (mTimerTask != null) {
-            mTimerTask.cancel();
-        }
-    }
-
-    private void twinkleCurrentAlpha(double alpha) {
-
-        if (mUseGoogleMap) {
-            if (mCurrentGoogleMarker != null) {
-                mCurrentGoogleMarker.setAlpha((float) alpha);
-            }
-
-        } else {
-            if (mCurrentBaiduMarker != null) {
-                mCurrentBaiduMarker.setAlpha((float) alpha);
-            }
-        }
-    }
-
-
-
-    private void moveToLocation(JSONObject location) {
-
-        if (location == null) {
-            return;
-        }
-
-        String lonStr = location.optString("lon");
-        String latStr = location.optString("lat");
-
-        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
-
-            if (mUseGoogleMap) {
-
-                CameraPosition newLocation = new CameraPosition.Builder()
-                        .target(new com.google.android.gms.maps.model.LatLng(Float.valueOf(latStr), Float.valueOf(lonStr)))
-                        .zoom(2.5f)
-                        .bearing(0)
-                        .tilt(0)
-                        .build();
-                mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(newLocation));
-            } else {
-
-                LatLng center = new LatLng(Float.valueOf(latStr),Float.valueOf(lonStr)); //设定中心点坐标
-                MapStatus mMapStatus = new MapStatus.Builder()//定义地图状态
-                                                    .target(center)
-                                                    .zoom(2.5f)
-                                                    .build();  //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
-                MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
-                mBaiduMap.getMap().setMapStatus(mMapStatusUpdate);//改变地图状态
-            }
-        }
-
-    }
-
-    private void handleLocation(JSONObject location,int priority, int imageId) {
-
-        if (location == null) {
-            return;
-        }
-
-        if (mUseGoogleMap) {
-            handleGoogleLocation(location,priority,imageId);
-        } else {
-            handleBaiduLocation(location,priority,imageId);
-        }
-
-    }
-
-    private void handleGoogleLocation(JSONObject location,int priority, int imageId) {
-
-        String port = location.optString("port");
-        String name = location.optString("name");
-        String addr = location.optString("addr");
-        String lonStr = location.optString("lon");
-        String latStr = location.optString("lat");
-
-        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
-
-            if (port == null) {
-                port = "";
-            }
-            if (addr == null) {
-                addr = "";
-            }
-
-            com.google.android.gms.maps.model.MarkerOptions options = new com.google.android.gms.maps.model.MarkerOptions();
-            options.icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(imageId))
-                    .position(new com.google.android.gms.maps.model.LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr)))
-                    .title(name)
-                    .snippet(port + " " + addr);
-            options.zIndex(priority);
-
-            com.google.android.gms.maps.model.Marker marker = mGoogleMap.addMarker(options);
-
-            if (port.equals("Vessel")) {
-                mCurrentGoogleMarker = marker;
-            }
-
-        } else {
-            return;
-        }
-
-    }
-
-    private void handleBaiduLocation(JSONObject location,int priority, int imageId) {
-
-        String port = location.optString("port");
-        String name = location.optString("name");
-        String addr = location.optString("addr");
-        String lonStr = location.optString("lon");
-        String latStr = location.optString("lat");
-
-        if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
-
-            if (port == null) {
-                port = "";
-            }
-            if (addr == null) {
-                addr = "";
-            }
-
-            LatLng llA = new LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr));
-            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(imageId);
-
-            Bundle extrainfo = new Bundle();
-            extrainfo.putString("detail",port + " " + addr);
-
-            MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
-            markeroption.zIndex(priority);
-
-            Marker marker = (Marker) mBaiduMap.getMap().addOverlay(markeroption);
-
-            if (port.equals("Vessel")) {
-                mCurrentBaiduMarker = marker;
-            }
-
-        } else {
-            return;
-        }
-
-    }
-
-    private boolean mShowPol = true,mShowPoe,mShowPod = true,mShowPor,mShowOrigin,mShowDestination,mShowCurrent = true,mTwinkleCurrent = true;
-
-    public void setShowPol(boolean show) {
-        mShowPol = show;
-    }
-
-    public boolean showPol() {
-        return mShowPol;
-    }
-
-    public void setShowPoe(boolean show) {
-        mShowPoe = show;
-    }
-
-    public boolean showPoe() {
-        return mShowPoe;
-    }
-
-    public void setShowPod(boolean show) {
-        mShowPod = show;
-    }
-
-    public boolean showPod() {
-        return mShowPod;
-    }
-
-    public void setShowPor(boolean show) {
-        mShowPor = show;
-    }
-
-    public boolean showPor() {
-        return mShowPor;
-    }
-
-    public void setShowOrigin(boolean show) {
-        mShowOrigin = show;
-    }
-
-    public boolean showOrigin() {
-        return mShowOrigin;
-    }
-
-    public void setShowDestination(boolean show) {
-        mShowDestination = show;
-    }
-
-    public boolean showDestination() {
-        return mShowDestination;
-    }
-
-    public void setShowCurrent(boolean show) {
-        mShowCurrent = show;
-    }
-
-    public boolean showCurrent() {
-        return mShowCurrent;
-    }
-
-    public void setShipMapListener(ShipMapListener listener) {
-        mListener = listener;
-    }
-
-    public void setTwinkleCurrent(boolean twinkleCurrent) {
-        mTwinkleCurrent = twinkleCurrent;
-    }
-
-    public boolean twinkleCurrent() {
-        return mTwinkleCurrent;
-    }
-
-    public ShipMapListener getShipMapListener() {
-        return mListener;
-    }
-
-    /**
-     * Google
-     * */
-
-    @Override
-    public boolean onMarkerClick(com.google.android.gms.maps.model.Marker marker) {
-        return false;
-    }
-
-    @Override
-    public void onInfoWindowClick(com.google.android.gms.maps.model.Marker marker) {
-
-    }
-
-    @Override
-    public void onMapReady(GoogleMap googleMap) {
-
-        mGoogleMap = googleMap;
-        if (mGoogleMap != null) {
-            mGoogleMap.setInfoWindowAdapter(new ShipMapWindowInfoAdapter());
-//            mGoogleMap.moveCamera(CameraUpdateFactory.newCameraPosition(US));
-            mGoogleMap.setOnMarkerClickListener(this);
-            mGoogleMap.setOnInfoWindowClickListener(this);
-            if (mAnnotation != null) {
-                showShipAnnotation(mAnnotation);
-            }
-            mGoogleMap.getUiSettings().setMapToolbarEnabled(false); // 隐藏底部ToolBar 导航按钮
-            mGoogleMap.getUiSettings().setRotateGesturesEnabled(false); // 禁止旋转
-
-            // 设置缩放级别
-            CameraUpdate zoom = CameraUpdateFactory.zoomTo(mGoogleMap.getMinZoomLevel());
-            mGoogleMap.animateCamera(zoom);
-        }
-    }
-
-    /**
-     * Baidu
-     * */
-
-    @Override
-    public boolean onMarkerClick(Marker marker) {
-
-//        View viewCache = LayoutInflater.from(mContext).inflate(R.layout.ship_map_bubble, null);
-//
-//        TextView tv_title = (TextView) viewCache.findViewById(R.id.bubble_title);
-//        TextView tv_info = (TextView) viewCache.findViewById(R.id.bubble_detail);
-
-        View viewCache = ((Activity)mContext)
-                .getLayoutInflater().inflate(
-                        R.layout.marker_view, null);
-
-        TextView tv_title = (TextView) viewCache
-                .findViewById(R.id.tv_title);
-        TextView tv_info = (TextView) viewCache
-                .findViewById(R.id.tv_info);
-
-        tv_title.setText(marker.getTitle());
-        tv_info.setText(marker.getExtraInfo().getString("detail"));
-
-        LatLng ll = marker.getPosition();
-        InfoWindow mInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(viewCache), ll, -100, this);
-        mBaiduMap.getMap().showInfoWindow(mInfoWindow);
-
-        return true;
-    }
-
-    @Override
-    public void onInfoWindowClick() {
-        mBaiduMap.getMap().hideInfoWindow();
-    }
-
-    /**
-     *
-     * */
-
-    class ShipMapWindowInfoAdapter implements GoogleMap.InfoWindowAdapter
-    {
-
-        View	mContents;
-
-        ShipMapWindowInfoAdapter() {
-            mContents = LayoutInflater.from(mContext).inflate(R.layout.ship_map_bubble, null);
-        }
-
-        @Override
-        public View getInfoContents(com.google.android.gms.maps.model.Marker marker)
-        {
-
-            String title = marker.getTitle();
-            TextView titleUi = ((TextView) mContents.findViewById(R.id.bubble_title));
-
-            if (title != null)
-            {
-                titleUi.setText(title);
-            }
-            else
-            {
-                titleUi.setText("");
-            }
-
-            String snippet = marker.getSnippet();
-            TextView snippetUi = ((TextView) mContents.findViewById(R.id.bubble_detail));
-            if (snippet != null)
-            {
-                snippetUi.setText(snippet);
-            }
-            else
-            {
-                snippetUi.setText("");
-            }
-            return mContents;
-        }
-
-        @Override
-        public View getInfoWindow(com.google.android.gms.maps.model.Marker marker)
-        {
-
-            return null;
-        }
-
-    }
-
-    public interface ShipMapListener {
-
-        void shipMapTryToZoomIn(ShipMap shipMap,boolean zoomIn);
-
-    }
-
-    private static final class TimerHandler extends Handler {
-
-        double angle = 0;
-        WeakReference<ShipMap> weakMap;
-
-        TimerHandler(ShipMap map) {
-            if (map == null) {
-                return;
-            }
-            weakMap = new WeakReference<>(map);
-        }
-
-        @Override
-        public void handleMessage(Message msg) {
-
-            angle += 0.1;
-            if (angle == 3.1) {
-                angle = 0;
-            }
-            double alpha = Math.abs(Math.cos(angle));
-            ShipMap shipMap = weakMap.get();
-            shipMap.twinkleCurrentAlpha(alpha);
-        }
-    }
-}

+ 0 - 71
Apex Mobile/app/src/main/java/com/usai/apex/TestActivity.java

@@ -1,71 +0,0 @@
-package com.usai.apex;
-
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-
-import com.usai.apex.ShipMap.ShipMap;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-public class TestActivity extends AppCompatActivity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_test);
-
-        String test = "{\n" +
-                "            \"title\":\"SH - PT. WANGSA MANUNGGAL JAYA PERKASA\",\n" +
-                "            \"icon\":\"status_vd\",\n" +
-                "            \"serial_no\":\"85625278dbaae299ffbbd10ee22cf875\",\n" +
-                "            \"hbol\":\"A1805340018\",\n" +
-                "            \"description\":\"A1805340018(1 containers)\",\n" +
-                "            \"detail\":\"Vessel Departure; IDSUB (SURABAYA, INDONESIA 2018-05-05)\",\n" +
-                "            \"date\":\"05/05/2018 - 06/02/2018\",\n" +
-                "            \"port\":\"IDSUB - USOAK\",\n" +
-                "            \"transport_stage\":\"3\",\n" +
-                "            \"locations\":{\n" +
-                "                \"por\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"-7.2000000000\",\n" +
-                "                    \"lon\":\"112.7333333333\",\n" +
-                "                    \"name\":\"SURABAYA\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                },\n" +
-                "                \"pol\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"-7.2000000000\",\n" +
-                "                    \"lon\":\"112.7333333333\",\n" +
-                "                    \"name\":\"SURABAYA\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                },\n" +
-                "                \"pod\":{\n" +
-                "                    \"icon\":\"\",\n" +
-                "                    \"lat\":\"37.7978400000\",\n" +
-                "                    \"lon\":\"-122.2864000000\",\n" +
-                "                    \"name\":\"OAKLAND\",\n" +
-                "                    \"addr\":\"\"\n" +
-                "                }\n" +
-                "            }\n" +
-                "        }";
-
-        ShipMap shipMap = findViewById(R.id.ship_map);
-
-        shipMap.setShowPol(true);
-        shipMap.setShowPod(true);
-        shipMap.setShowPoe(true);
-        shipMap.setShowPor(true);
-        shipMap.setShowOrigin(true);
-        shipMap.setShowDestination(true);
-        shipMap.setShowCurrent(true);
-
-        try {
-            JSONObject j = new JSONObject(test);
-            shipMap.showShipAnnotation(j.getJSONObject("locations"));
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 57
Apex Mobile/app/src/main/java/com/usai/apex/TestAppComActivity.java

@@ -1,57 +0,0 @@
-package com.usai.apex;
-
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Menu;
-
-public class TestAppComActivity extends AppCompatActivity {
-
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.quick_search,menu);
-        return  true;
-    }
-
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_test_app_com);
-
-
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setLogo(R.drawable.apexlogo);
-//        actionBar.setIcon(R.drawable.ic_launcher);
-
-        actionBar.setDisplayUseLogoEnabled(true);
-        actionBar.setDisplayShowHomeEnabled(true);
-//        actionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);
-        actionBar.setDisplayHomeAsUpEnabled(false);
-        actionBar.setDisplayShowTitleEnabled(true);
-
-
-//        actionBar.add
-//        getSupportActionBar().setIcon(R.drawable.ic_launcher);
-//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
-//        Toolbar toolbar =(Toolbar) findViewById(R.id.toolbar);
-//        setSupportActionBar(toolbar);
-//
-//        setSupportActionBar(toolbar);
-////        setTitle("aaaa");//设置标题
-////        toolbar.setNavigationIcon(R.mipmap.ic_launcher_round);//设置返回键,我这里没有,就有icon代替吧
-////        toolbar.setNavigationOnClickListener(new OnClickListener() {
-////            @Override
-////            public void onClick(View view) {
-////                finish();
-////            }
-////        });//返回监听
-//        toolbar.setLogo(R.drawable.apexlogo_2);//设置logo
-////        toolbar.setSubtitle("bbbb");//设置副标题
-//
-//
-
-    }
-}

+ 0 - 45
Apex Mobile/app/src/main/java/com/usai/apex/ViewPagerAdapter.java

@@ -1,45 +0,0 @@
-package com.usai.apex;
-
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by bruce on 2016/11/1.
- * ViewPagerAdapter
- */
-
-public class ViewPagerAdapter extends FragmentStatePagerAdapter {
-
-    private final List<Fragment> mFragmentList = new ArrayList<>();
-
-    public ViewPagerAdapter(FragmentManager manager) {
-        super(manager);
-    }
-
-    @Override
-    public Fragment getItem(int position) {
-        return mFragmentList.get(position);
-    }
-
-    @Override
-    public int getCount() {
-        return mFragmentList.size();
-    }
-
-    public void addFragment(Fragment fragment) {
-        mFragmentList.add(fragment);
-    }
-    //解决ViewPager数据源改变时,刷新无效的解决办法
-    @Override
-    public int getItemPosition(Object object) {
-        return POSITION_NONE;
-    }
-//    public void clear()
-//    {
-//        mFragmentList.clear();
-//    }
-}

+ 0 - 87
Apex Mobile/app/src/main/java/com/usai/apex/WebActivity.java

@@ -1,87 +0,0 @@
-package com.usai.apex;
-
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
-import android.widget.TextView;
-
-public class WebActivity extends AppCompatActivity
-{
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent();
-		switch (item.getItemId())
-		{
-			case android.R.id.home:
-				finish();
-				break;
-
-			default:
-				break;
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void setCustomActionBar() {
-		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-		TextView titleview = mActionBarView.findViewById(R.id.title);
-		titleview.setText(getTitle());
-
-		ActionBar actionBar = getSupportActionBar();
-		actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-		actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-		actionBar.setDisplayShowTitleEnabled(true);
-	}
-	@Override
-	protected void onCreate(Bundle savedInstanceState)
-	{
-
-		// setTitle("Booking Result");
-
-		super.onCreate(savedInstanceState);
-
-		String title = getIntent().getStringExtra("title");
-
-		setTitle(title);
-		setContentView(R.layout.fragment_web);
-
-
-		setCustomActionBar();
-		String url = getIntent().getStringExtra("url");
-		WebView wv = (WebView) findViewById(R.id.wv_content);
-
-		wv.setBackgroundColor(Color.TRANSPARENT); // 设置背景色
-
-
-		WebSettings settings=wv.getSettings();
-		// 设置可以支持缩放
-//		settings.setSupportZoom(true);
-// 设置出现缩放工具
-//		settings.setBuiltInZoomControls(true);
-//扩大比例的缩放
-//		settings.setUseWideViewPort(true);
-		//自适应屏幕
-		settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
-		settings.setLoadWithOverviewMode(true);
-		settings.setTextZoom(150);
-
-		wv.loadUrl(url);
-
-	}
-
-}

+ 0 - 133
Apex Mobile/app/src/main/java/com/usai/apex/actionSheet/ActionSheet.java

@@ -1,133 +0,0 @@
-package com.usai.apex.actionSheet;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.graphics.Color;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.text.TextPaint;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.LinearLayout;
-
-
-import com.usai.apex.R;
-import com.usai.apex.button.RAButton;
-
-import java.util.HashMap;
-
-public class ActionSheet extends Dialog implements View.OnClickListener {
-
-    private Context mCtx;
-    private LinearLayout mRootView;
-    private HashMap<Button,View.OnClickListener> buttonListenerMap = new HashMap<>();
-
-    public ActionSheet(@NonNull Context context) {
-        this(context,R.style.actionSheet);
-
-    }
-
-    public ActionSheet(@NonNull Context context, int themeResId) {
-        super(context, themeResId);
-
-        mCtx = context;
-        init();
-    }
-
-    protected ActionSheet(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
-        super(context, cancelable, cancelListener);
-
-        mCtx = context;
-        init();
-    }
-
-    private void init() {
-        mRootView = (LinearLayout) LayoutInflater.from(mCtx).inflate(R.layout.action_sheet, null);
-        setContentView(mRootView);
-    }
-
-    public void addAction(String title, ActionType actionType, View.OnClickListener clickListener) {
-
-        RAButton button = new RAButton(mCtx);
-        button.setText(title);
-        button.setTextColor(Color.parseColor("#2577ff"));
-        button.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
-        button.setAllCaps(false);
-        button.setBackgroundResource(R.drawable.actionsheet_round_corner_normal_bg);
-        button.setOnClickListener(this);
-        if (clickListener != null) {
-            buttonListenerMap.put(button,clickListener);
-        }
-
-        button.setTitleColorForState(RAButton.RAButtonState.RAButtonStateHighlight,Color.GRAY);
-        button.setBackgroundDrawableForState(RAButton.RAButtonState.RAButtonStateNormal,mCtx.getResources().getDrawable(R.drawable.actionsheet_round_corner_normal_bg));
-
-        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,dp2px(mCtx,50));
-
-        int marginH = dp2px(mCtx,10);
-        int marginV = dp2px(mCtx,5);
-        switch (actionType) {
-            case ACtionTypeCancel: {
-                layoutParams.setMargins(marginH,marginV,marginH,marginV);
-
-                TextPaint tp = button.getPaint();
-                tp.setFakeBoldText(true);
-            }
-            break;
-            case ActionTypeDefault: {
-                layoutParams.setMargins(marginH,0,marginH,marginV);
-            }
-            break;
-        }
-
-        mRootView.addView(button,layoutParams);
-    }
-
-    private static int dp2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    @Override
-    public void show() {
-
-        Window dialogWindow = getWindow();
-        if (dialogWindow != null) {
-
-            dialogWindow.setGravity(Gravity.BOTTOM);
-            WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes(); // 获取对话框当前的参数值
-            layoutParams.x = 0; // 新位置X坐标
-            layoutParams.y = 0; // 新位置Y坐标
-            layoutParams.width = (int) mCtx.getResources().getDisplayMetrics().widthPixels; // 宽度
-            mRootView.measure(0, 0);
-            layoutParams.height = mRootView.getMeasuredHeight();
-
-            layoutParams.alpha = 9f; // 透明度
-            dialogWindow.setAttributes(layoutParams);
-        }
-
-        super.show();
-    }
-
-    @Override
-    public void onClick(View v) {
-
-        dismiss();
-
-        View.OnClickListener listener = buttonListenerMap.get(v);
-        if (listener != null) {
-            listener.onClick(v);
-        }
-    }
-
-    public enum ActionType {
-        ActionTypeDefault,
-        ACtionTypeCancel
-    }
-}

+ 0 - 594
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultActivity.java

@@ -1,594 +0,0 @@
-package com.usai.apex.apexResult;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.sqlite.SQLiteDatabase;
-import android.graphics.Color;
-import android.support.v4.view.MenuItemCompat;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-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.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.CustomizeFieldsActivity;
-import com.usai.apex.R;
-import com.usai.apex.Result.AMResultActivity;
-import com.usai.apex.actionSheet.ActionSheet;
-import com.usai.apex.mainframe.NewDetailActivity;
-import com.usai.apex.pdf.PDFPreviewActivity;
-import com.usai.util.Network;
-import com.usai.util.commonUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.Iterator;
-
-
-public class ApexResultActivity extends AppCompatActivity implements ApexResultPresenter.ApexResultProtocol {
-
-    // region Build
-
-    private static final String ParametersKey = "Apex_Result_Parameters_Key";
-
-    public static void startResultActivity(Activity activity, Bundle params) {
-
-        if (activity != null) {
-
-            Intent intent = new Intent(activity, ApexResultActivity.class);
-            if (params != null) {
-                intent.putExtra(ParametersKey, params);
-            }
-            activity.startActivity(intent);
-        }
-
-    }
-
-    // endregion
-
-    // region Request Code
-
-    private static class RequestCode {
-
-        static final int Field_Setting = 1010;
-    }
-
-    // endregion
-
-    // region Property
-
-    private Context mCtx = this;
-
-    private ListView mListView;
-    private SwipeRefreshLayout mRefreshLayout;
-    private ProgressBar mProgressBar;
-    private TextView mListFooterView;
-
-    private ScrollListener mScrollListener;
-
-    private ApexResultPresenter mPresenter;
-    private ApexResultAdapter mAdapter;
-    private Bundle mParams;
-
-    // endregion
-
-    // region Override
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_apex_result);
-
-        //
-        if (savedInstanceState != null) {
-            mParams = savedInstanceState.getBundle(ParametersKey);
-        } else {
-            mParams = getIntent().getBundleExtra(ParametersKey);
-        }
-        if (mParams == null) {
-            mParams = new Bundle();
-        }
-
-        setup();
-
-        if (savedInstanceState != null) {
-            mPresenter.onRestoreInstanceState(savedInstanceState);
-        } else {
-            mPresenter.loadData();
-        }
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-        if (item.getItemId() == android.R.id.home) {
-            finish();
-            return  true;
-        } else if (item.getItemId() == R.id.apex_result_menu) {
-            menuItemClick();
-            return true;
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.apex_result_menu, menu);
-        return true;
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        outState.putBundle(ParametersKey, mParams);
-        mPresenter.onSaveInstanceState(outState);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
-        if (requestCode == RequestCode.Field_Setting) {
-            mPresenter.dirty = true;
-            loadData();
-        }
-    }
-
-    // endregion
-
-    // region Setting
-
-    private void setup() {
-
-        mPresenter = new ApexResultPresenter(this, mParams);
-        mAdapter = new ApexResultAdapter(mCtx, mPresenter);
-
-        setupActionBar();
-        setupRefreshLayout();
-        setupListView();
-
-        mProgressBar = findViewById(R.id.apex_result_progress_bar);
-    }
-
-    private void setupListView() {
-
-        mListView = findViewById(R.id.apex_result_list_view);
-        mListView.setAdapter(mAdapter);
-
-        setupListFooterView();
-        AbsListView.LayoutParams footerLayoutParams = new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
-        mListFooterView.setLayoutParams(footerLayoutParams);
-        mListView.addFooterView(mListFooterView);
-
-        mScrollListener = new ScrollListener();
-        mListView.setOnScrollListener(mScrollListener);
-
-        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override
-            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                clickItemCell(view, position);
-            }
-        });
-    }
-
-    private void setupListFooterView() {
-        mListFooterView = new TextView(mCtx);
-        mListFooterView.setBackgroundColor(Color.WHITE);
-        mListFooterView.setGravity(Gravity.CENTER);
-        mListFooterView.setText("loading more...");
-        mListFooterView.setTextSize(commonUtil.sp2px(mCtx,8));
-        mListFooterView.setVisibility(View.INVISIBLE);
-    }
-
-    private void setupRefreshLayout() {
-
-        mRefreshLayout = findViewById(R.id.apex_result_refresh_layout);
-        mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                refresh();
-            }
-        });
-    }
-
-
-    private void setupActionBar() {
-
-        android.support.v7.app.ActionBar actionBar = getSupportActionBar();
-        if(actionBar != null){
-            actionBar.setHomeButtonEnabled(true);
-            actionBar.setDisplayHomeAsUpEnabled(true);
-        }
-    }
-
-    // endregion
-
-    // region Action
-    private void loadData() {
-        mPresenter.loadData();
-    }
-
-    private void refresh() {
-        mPresenter.refreshData();
-    }
-
-    private void loadMore() {
-        mPresenter.loadMoreData();
-    }
-
-    private void clickItemCell(View cell, int position) {
-
-        handleRowAction(position);
-    }
-
-    // endregion
-
-    // region ProgressBar
-
-    public void showProgressBar() {
-        mProgressBar.setVisibility(View.VISIBLE);
-    }
-
-    public void dismissProgressBar() {
-        mProgressBar.setVisibility(View.GONE);
-    }
-
-    // endregion
-
-    // region Alert
-
-    private void showAlertMessage(String msg) {
-        new AlertDialog.Builder(mCtx)
-                .setTitle("Warning")
-                .setMessage(msg)
-                .setPositiveButton("OK",null)
-                .show();
-    }
-
-    // endregion
-
-    // region Presenter Delegate
-    @Override
-    public void onStartLoading() {
-        isLoading = true;
-        showProgressBar();
-    }
-
-    @Override
-    public void onStopLoading() {
-        if (mRefreshLayout.isRefreshing()) {
-            mRefreshLayout.setRefreshing(false);
-        }
-        mListFooterView.setVisibility(View.INVISIBLE);
-        dismissProgressBar();
-
-        isLoading = false;
-    }
-
-    @Override
-    public void onSuccess(String title) {
-        setTitle(title);
-        mAdapter.notifyDataSetChanged();
-    }
-
-    @Override
-    public void onFailed(String errMsg) {
-        if (errMsg == null) {
-            errMsg = "Sorry, something is wrong.";
-        }
-        showAlertMessage(errMsg);
-    }
-
-    @Override
-    public void onNoMoreData() {
-        showAlertMessage("No More Data");
-    }
-
-    @Override
-    public void onDownloadFile(String path, Bundle params) {
-
-        String email = params.getString("email");
-        String email_subject = params.getString("email_subject");
-        String email_content = params.getString("email_content");
-
-        previewPDF(path, email, email_subject, email_content);
-    }
-    // endregion
-
-    // region Menu Action
-
-    private void menuItemClick() {
-
-        ActionSheet actionSheet = new ActionSheet(mCtx);
-
-        actionSheet.addAction("Setting", ActionSheet.ActionType.ActionTypeDefault, new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                showFieldsSetting();
-            }
-        });
-
-        actionSheet.addAction("Save", ActionSheet.ActionType.ActionTypeDefault, new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                saveSearchParameters();
-            }
-        });
-
-        actionSheet.addAction("Cancel", ActionSheet.ActionType.ACtionTypeCancel, new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-
-            }
-        });
-
-        actionSheet.show();
-
-    }
-
-    private void saveSearchParameters() {
-
-        final View edit = new EditText(mCtx);
-        new android.app.AlertDialog.Builder(mCtx)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
-                .setTitle(R.string.str_createname)
-                .setView(edit)
-                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int whichButton) {
-
-                                String name = ((EditText) edit).getText().toString();
-                                if(TextUtils.isEmpty(name))
-                                {
-                                    new android.app.AlertDialog.Builder(mCtx)
-                                            .setTitle("Warning")
-                                            .setMessage("Name can not be empty.")
-                                            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                                @Override
-                                                public void onClick(DialogInterface dialog, int which) {
-
-                                                }
-                                            })
-                                            .show();
-                                    return;
-                                }
-
-                                mPresenter.saveSearchParametersWithName(getIntent().toUri(0), name);
-
-                            }
-                        })
-                .setNegativeButton(android.R.string.cancel, null)
-                .create()
-                .show();
-
-    }
-
-    private void showFieldsSetting() {
-
-        Intent intent = new Intent();
-        intent.setClass(this, CustomizeFieldsActivity.class);
-        intent.putExtra("user", ApexTrackingApplication.get_user());
-        intent.putExtra("function_name", mParams.getString("module_name"));
-        intent.putExtra("behavior", Network.BEHAVIOR_RESULT);
-        startActivityForResult(intent,RequestCode.Field_Setting);
-    }
-
-    // endregion
-
-    // region Scroll Listener
-
-    private boolean isLoading = false;
-    private class ScrollListener implements AbsListView.OnScrollListener {
-
-        private int last_index, total_index;
-
-        @Override
-        public void onScrollStateChanged(AbsListView view, int scrollState) {
-            if (last_index == total_index && (scrollState == SCROLL_STATE_IDLE)) {
-                if (!isLoading) {
-
-                    mListFooterView.setVisibility(View.VISIBLE);
-                    loadMore();
-                }
-            }
-        }
-
-        @Override
-        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-            last_index = firstVisibleItem + visibleItemCount;
-            total_index = totalItemCount;
-        }
-    }
-
-    // endregion
-
-    // region Row Action
-
-    private Bundle paramsForIndex(int position, JSONObject action) {
-
-        JSONArray parameters = mPresenter.rowActionParametersForIndex(position);
-        Bundle params = new Bundle();
-        JSONObject actionParams = action.optJSONObject("params");
-        if (actionParams != null) {
-
-            Iterator<String> keys = actionParams.keys();
-            while (keys.hasNext()) {
-                String key = keys.next();
-                try {
-
-                    int idx = actionParams.getInt(key);
-                    String value = parameters.getString(idx);
-                    params.putString(key, value);
-
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-
-        }
-        return params;
-    }
-
-    private void handleRowAction(int position) {
-
-        JSONArray rowActions = mPresenter.getRowActions();
-        if (rowActions != null) {
-
-            if (rowActions.length() == 1) {
-
-                JSONObject action = rowActions.optJSONObject(0);
-                if (action != null) {
-
-                    Bundle params = paramsForIndex(position, action);
-                    String module = action.optString("module");
-                    if (module != null) {
-                        if (module.equals("quick_look")) {
-
-                            showQuickLookForActionWithParams(action, params);
-
-                        } else if (module.equals("detail")) {
-
-                            showDetailForActionWithParams(action, params);
-                        }
-                    }
-                }
-
-            } else {
-
-                ActionSheet actionSheet = new ActionSheet(mCtx);
-
-                for (int i = 0; i < rowActions.length(); i++) {
-
-                    try {
-
-                        final JSONObject json = rowActions.getJSONObject(i);
-                        final Bundle params = paramsForIndex(position, json);
-
-                        String title = json.getString("title");
-                        final String module = json.getString("module");
-
-                        actionSheet.addAction(title, ActionSheet.ActionType.ActionTypeDefault, new View.OnClickListener() {
-                            @Override
-                            public void onClick(View v) {
-
-                                if (module.equals("quick_look")) {
-
-                                    showQuickLookForActionWithParams(json, params);
-
-                                } else if (module.equals("detail")) {
-
-                                    showDetailForActionWithParams(json, params);
-                                }
-
-                            }
-                        });
-
-                    } catch (JSONException e) {
-                        e.printStackTrace();
-                    }
-
-                } // for
-
-                actionSheet.addAction("Cancel", ActionSheet.ActionType.ACtionTypeCancel, new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-
-                    }
-                });
-
-                actionSheet.show();
-
-            }
-        }
-    }
-
-    private void showQuickLookForActionWithParams(JSONObject action, Bundle params) {
-
-        try {
-
-            String url = action.getString("url");
-            mPresenter.downloadFile(url, params);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void showDetailForActionWithParams(JSONObject action, Bundle params) {
-
-        String module_name = mPresenter.getParams().getString("module_name");
-        String detail_id = params.getString("id");
-        JSONArray actions = mPresenter.getActions();
-        if (actions == null) {
-            actions = new JSONArray();
-        }
-
-        Intent intent = new Intent(mCtx, NewDetailActivity.class);
-        intent.putExtra("function_name", module_name);
-        intent.putExtra("actions_count", actions.length());
-        intent.putExtra("_id",detail_id);
-
-        for (int i = 0; i < actions.length(); i++) {
-            try {
-                String name = actions.getString(i);
-                intent.putExtra("action" + i, name);
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-
-        startActivity(intent);
-    }
-
-    // endregion
-
-    // region PDF
-
-    private void previewPDF(String file,String email,String subject,String content) {
-
-        Intent myIntent = new Intent(mCtx, PDFPreviewActivity.class);
-        myIntent.putExtra("file",file);
-        myIntent.putExtra("iscache",true);
-
-        try {
-            JSONObject json = new JSONObject();
-
-            if (email != null) {
-                json.put("email",email);
-            }
-            if (subject != null) {
-                json.put("subject",subject);
-            }
-            if (content != null) {
-                json.put("content",content);
-            }
-            myIntent.putExtra("email",json.toString());
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-
-        startActivity(myIntent);
-    }
-
-    // endregion
-}

+ 0 - 176
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultAdapter.java

@@ -1,176 +0,0 @@
-package com.usai.apex.apexResult;
-
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-
-import com.usai.apex.apexResult.cell.ApexResultDocumentCell;
-import com.usai.apex.apexResult.cell.ApexResultShipCell;
-import com.usai.apex.apexResult.model.ApexResultBaseModel;
-import com.usai.apex.apexResult.model.ApexResultDocumentModel;
-import com.usai.apex.apexResult.model.ApexResultShipModel;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-public class ApexResultAdapter extends BaseAdapter {
-
-    // region DataSource
-    public static interface ApexResultAdapterDataSource {
-
-        int numberOfResultItem();
-        ApexResultBaseModel resultModelForIndex(int index);
-    }
-    // endregion
-
-    // region Initial
-    private WeakReference<Context> mWeakContext;
-    private WeakReference<ApexResultAdapterDataSource> mWeakDataSource;
-
-    public ApexResultAdapter(Context context, ApexResultAdapterDataSource dataSource) {
-        if (context == null) {
-            mWeakContext = null;
-        } else {
-            mWeakContext = new WeakReference<>(context);
-        }
-
-        if (dataSource == null) {
-            mWeakDataSource = null;
-        } else {
-            mWeakDataSource = new WeakReference<>(dataSource);
-        }
-    }
-    // endregion
-
-    // region Getter
-
-    private Context getContext() {
-        if (mWeakContext == null) {
-            return null;
-        }
-        return mWeakContext.get();
-    }
-
-    private ApexResultAdapterDataSource getDataSource() {
-        if (mWeakDataSource == null) {
-            return null;
-        }
-        return mWeakDataSource.get();
-    }
-
-    // endregion
-
-    // region Override
-
-    @Override
-    public int getCount() {
-        ApexResultAdapterDataSource dataSource = getDataSource();
-        if (dataSource != null) {
-            return dataSource.numberOfResultItem();
-        }
-        return 0;
-    }
-
-    @Override
-    public Object getItem(int position) {
-        ApexResultAdapterDataSource dataSource = getDataSource();
-        if (dataSource != null) {
-            return dataSource.resultModelForIndex(position);
-        }
-        return null;
-    }
-
-    @Override
-    public boolean hasStableIds() {
-        return true;
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return position;
-    }
-
-    @Override
-    public int getViewTypeCount() {
-        return 2;
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        ApexResultBaseModel model = (ApexResultBaseModel)getItem(position);
-        return model.type;
-    }
-
-    @Override
-    public View getView(int position, View convertView, ViewGroup parent) {
-
-        Context context = getContext();
-        if (context != null) {
-
-            ApexResultBaseModel model = (ApexResultBaseModel)getItem(position);
-            if (model.type == ApexResultBaseModel.ApexResultType.APEX_RESULT_TYPE_SHIP.ordinal()) {
-
-                ApexResultShipModel shipModel = (ApexResultShipModel)model;
-                ApexResultShipCell cell = dequeueShipCell(context, convertView);
-                cell.prepareReuse();
-                cell.setTitle(shipModel.title).setDetail(shipModel.detail).setIcon(shipModel.icon).setPort(shipModel.port).setTime(shipModel.date).setDescription(shipModel.desc);
-                cell.setTransportStage(shipModel.transport_stage);
-
-                ArrayList<ApexResultShipModel.ApexResultAddition> additions = shipModel.getAddition();
-                if (additions != null && additions.size() > 0) {
-                    for (ApexResultShipModel.ApexResultAddition addition : additions) {
-                        cell.addAddition(addition.name, addition.value);
-                    }
-                }
-
-                return cell;
-
-            } else if (model.type == ApexResultBaseModel.ApexResultType.APEX_RESULT_TYPE_DOCUMENT.ordinal()) {
-
-                ApexResultDocumentModel documentModel = (ApexResultDocumentModel)model;
-                ApexResultDocumentCell cell = dequeueDocumentCell(context, convertView);
-                cell.prepareReuse();
-                cell.setFileName(documentModel.fileName).setFileType(documentModel.fileType).setFileDescription(documentModel.fileDesc);
-
-                return cell;
-            }
-
-            return new View(context);
-        }
-        return null;
-    }
-
-    // endregion
-
-    // region Configure Cell
-
-    private ApexResultShipCell dequeueShipCell(Context context, View convertView) {
-
-        ApexResultShipCell cell = null;
-
-        if (convertView == null) {
-            cell = ApexResultShipCell.makeShipCell(context);
-        } else {
-            cell = (ApexResultShipCell)convertView;
-        }
-
-        return cell;
-    }
-
-    private ApexResultDocumentCell dequeueDocumentCell(Context context, View convertView) {
-
-        ApexResultDocumentCell cell = null;
-
-        if (convertView == null) {
-            cell = ApexResultDocumentCell.makeDocumentCell(context);
-        } else {
-            cell = (ApexResultDocumentCell)convertView;
-        }
-
-        return cell;
-    }
-
-    // endregion
-
-}

+ 0 - 497
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/ApexResultPresenter.java

@@ -1,497 +0,0 @@
-package com.usai.apex.apexResult;
-
-import android.os.Bundle;
-import android.text.TextUtils;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.apexResult.model.ApexResultBaseModel;
-import com.usai.apex.apexResult.model.ApexResultDocumentModel;
-import com.usai.apex.apexResult.model.ApexResultShipModel;
-import com.usai.apex.operationQueue.OperationQueue;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-public class ApexResultPresenter implements ApexResultAdapter.ApexResultAdapterDataSource {
-
-    // region Protocol
-    public static interface ApexResultProtocol {
-
-        void onStartLoading();
-        void onStopLoading();
-        void onSuccess(String title);
-        void onFailed(String errMsg);
-        void onNoMoreData();
-        void onDownloadFile(String path, Bundle params);
-
-    }
-    // endregion
-
-    // region Enum
-
-    private enum ApexResultFetchDataType {
-        APEX_RESULT_FETCH_DATA_TYPE_INITIAL,
-        APEX_RESULT_FETCH_DATA_TYPE_REFRESH,
-        APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE
-    }
-
-    // endregion
-
-    // region Initial
-
-    private WeakReference<ApexResultProtocol> mWeakDelegate;
-    private Bundle mParams;
-    private String mFields;
-    private int offset = 0;
-    private static final int detal = 20;
-    private ArrayList<ApexResultBaseModel> mDataArray;
-    private JSONArray rowActions;
-    private JSONArray actions;
-    public boolean dirty = true;
-
-    public ApexResultPresenter(ApexResultProtocol delegate, Bundle params) {
-        if (delegate == null) {
-            mWeakDelegate = null;
-        } else {
-            mWeakDelegate = new WeakReference<>(delegate);
-        }
-        if (params == null) {
-            mParams = new Bundle();
-        } else {
-            mParams = params;
-        }
-
-        if (mParams.containsKey("columns")) {
-
-            dirty = false;
-        } else {
-            dirty = true;
-        }
-    }
-    // endregion
-
-    // region Save Instance
-
-    private static final String Data_Array_Key = "Data_Array_Key";
-    private static final String Offset_Key = "Offset_Key";
-    private static final String Row_Actions_key = "Row_Actions_Key";
-    private static final String Actions_Key = "Actions_Key";
-    private static final String Dirty_Key = "Dirty_Key";
-    private static final String Display_Fields_Key = "Display_Fields_Key";
-
-    public void onSaveInstanceState(Bundle outState) {
-        if (outState != null) {
-
-            outState.putInt(Offset_Key, offset);
-
-            String dataStr = prepareSaveData();
-            if (dataStr != null) {
-                outState.putString(Data_Array_Key, dataStr);
-            }
-
-            if (rowActions != null) {
-                outState.putString(Row_Actions_key, rowActions.toString());
-            }
-
-            if (actions != null) {
-                outState.putString(Actions_Key, actions.toString());
-            }
-
-            outState.putBoolean(Dirty_Key, dirty);
-            if (mFields != null) {
-                outState.putString(Display_Fields_Key, mFields);
-            }
-        }
-    }
-
-    public void onRestoreInstanceState(Bundle savedInstanceState) {
-        if (savedInstanceState != null) {
-
-            offset = savedInstanceState.getInt(Offset_Key);
-
-            String dataStr = savedInstanceState.getString(Data_Array_Key);
-            prepareRestoreData(dataStr);
-
-            try {
-                String js = savedInstanceState.getString(Row_Actions_key);
-                if (js != null) {
-                    rowActions = new JSONArray(js);
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-            try {
-                String js = savedInstanceState.getString(Actions_Key);
-                if (js != null) {
-                    actions = new JSONArray(js);
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-            mFields = savedInstanceState.getString(Display_Fields_Key);
-            dirty = savedInstanceState.getBoolean(Dirty_Key);
-        }
-    }
-
-    private String prepareSaveData() {
-
-        if (mDataArray != null) {
-
-            JSONArray jsonArray = new JSONArray();
-
-            for (ApexResultBaseModel model : mDataArray) {
-                JSONObject item = model.toJson();
-                jsonArray.put(item);
-            }
-
-            return jsonArray.toString();
-        }
-
-        return null;
-    }
-
-    private void prepareRestoreData(String jsonStr) {
-
-        if (jsonStr != null) {
-
-            try {
-
-                JSONArray jsonArray = new JSONArray(jsonStr);
-
-                ArrayList<ApexResultBaseModel> models = new ArrayList<>();
-                for (int i = 0; i < jsonArray.length(); i++) {
-                    JSONObject item = jsonArray.optJSONObject(i);
-                    if (item != null) {
-                        ApexResultBaseModel model = makeModel(item);
-                        if (model != null) {
-                            models.add(model);
-                        }
-                    }
-                }
-                mDataArray = models;
-
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-
-        }
-    }
-
-    // endregion
-
-    // region Getter
-
-    private ApexResultProtocol getDelegate() {
-        if (mWeakDelegate == null) {
-            return null;
-        }
-        return mWeakDelegate.get();
-    }
-
-    public int dataCount() {
-        if (mDataArray == null) {
-            return 0;
-        }
-        return mDataArray.size();
-    }
-
-    public ApexResultBaseModel modelAtIndex(int index) {
-        if (index >= dataCount()) {
-            return null;
-        }
-        return mDataArray.get(index);
-    }
-
-    public JSONArray rowActionParametersForIndex(int position) {
-        ApexResultBaseModel model = modelAtIndex(position);
-        if (model != null) {
-            return model.rowActionParameters;
-        }
-        return null;
-    }
-
-    public JSONArray getRowActions() {
-        return rowActions;
-    }
-
-    public JSONArray getActions() {
-        return actions;
-    }
-
-    public Bundle getParams() {
-        return mParams;
-    }
-
-    // endregion
-
-    // region DataSource
-
-    @Override
-    public int numberOfResultItem() {
-        return dataCount();
-    }
-
-    @Override
-    public ApexResultBaseModel resultModelForIndex(int index) {
-        return modelAtIndex(index);
-    }
-
-    // endregion
-
-    // region Private
-
-    private ApexResultBaseModel makeModel(JSONObject item) {
-        if (item != null) {
-            int type = item.optInt("type", -1);
-            if (type == ApexResultBaseModel.ApexResultType.APEX_RESULT_TYPE_SHIP.ordinal()) {
-
-                ApexResultShipModel model = new ApexResultShipModel();
-                model.setValuesForKeysWithJSON(item);
-                return model;
-            } else if (type == ApexResultBaseModel.ApexResultType.APEX_RESULT_TYPE_DOCUMENT.ordinal()) {
-
-                ApexResultDocumentModel model = new ApexResultDocumentModel();
-                model.setValuesForKeysWithJSON(item);
-                return model;
-            }
-        }
-        return null;
-    }
-
-    // endregion
-
-    // region Data
-
-    private void loadData(final ApexResultFetchDataType option) {
-
-        if (getDelegate() != null) {
-            getDelegate().onStartLoading();
-        }
-
-        if (mFields == null) {
-            mFields = "";
-        }
-
-
-        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-            @Override
-            public Object operationDoInBackground() {
-
-                Bundle params = (Bundle) mParams.clone();
-                params.putInt("offset", offset);
-                params.putInt("limit", detal);
-                params.putString("columns", mFields);
-                JSONObject json = Network.fetchResult(params);
-
-                return json;
-            }
-        }, new OperationQueue.OperationCompletionCallBack() {
-            @Override
-            public void operationCompletion(Object object) {
-
-                JSONObject json = (JSONObject)object;
-                int result = Network.RESULT_FALSE;
-                if (json != null) {
-                    result = json.optInt("result", Network.RESULT_FALSE);
-                }
-
-                if (getDelegate() != null) {
-                    getDelegate().onStopLoading();
-                }
-
-                if (result == Network.RESULT_TRUE) {
-
-                    ArrayList<ApexResultBaseModel> models = new ArrayList<>();
-                    if (option == ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE && mDataArray != null && mDataArray.size() > 0) {
-                        models.addAll(mDataArray);
-                    }
-
-                    int loadCount = 0;
-                    JSONArray items = json.optJSONArray("items");
-                    if (items != null) {
-                        loadCount = items.length();
-
-                        for (int i = 0; i < loadCount; i++) {
-                            JSONObject item = items.optJSONObject(i);
-                            if (item != null) {
-
-                                ApexResultBaseModel model = makeModel(item);
-                                if (model != null) {
-                                    models.add(model);
-                                }
-                            }
-                        }
-                    }
-
-                    offset = models.size();
-                    String title = json.optString("title");
-                    rowActions = json.optJSONArray("row_actions");
-                    actions = json.optJSONArray("actions");
-
-                    mDataArray = models;
-                    if (getDelegate() != null) {
-                        getDelegate().onSuccess(title);
-                        if (loadCount < detal) {
-                            getDelegate().onNoMoreData();
-                        }
-                    }
-
-                } else {
-
-                    String msg = "Sorry, something is wrong.";
-                    if (json != null) {
-                        json.optString("err_msg", "Sorry, something is wrong.");
-                    }
-
-                    if (getDelegate() != null) {
-                        getDelegate().onFailed(msg);
-                    }
-                }
-
-            }
-        },null);
-
-    }
-
-    public void loadData() {
-
-        if (dirty) {
-            dirty = false;
-            String module_name = mParams.getString("module_name");
-            String fields = Network.getDisplayFieldsForFunction(module_name);
-            mFields = fields;
-        }
-
-        offset = 0;
-        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_INITIAL);
-    }
-
-    public void refreshData() {
-
-        offset = 0;
-        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_REFRESH);
-    }
-
-    public void loadMoreData() {
-        loadData(ApexResultFetchDataType.APEX_RESULT_FETCH_DATA_TYPE_LOAD_MORE);
-    }
-
-    // endregion
-
-    // region Save Search Parameter
-
-    public void saveSearchParametersWithName(final String  intentStr, final String name) {
-
-        if (getDelegate() != null) {
-            getDelegate().onStartLoading();
-        }
-
-        JSONObject json = RAUtil.Bundle2Json(mParams);
-        if (mFields != null) {
-            try {
-                json.put("columns", mFields);
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-
-
-        final String paramStr = json.toString();
-        final String module_name = mParams.getString("module_name");
-
-        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-            @Override
-            public Object operationDoInBackground() {
-                return Network.saveSearchParametersForModuleWithName(intentStr, paramStr, module_name, name);
-            }
-        }, new OperationQueue.OperationCompletionCallBack() {
-            @Override
-            public void operationCompletion(Object object) {
-
-                if (getDelegate() != null) {
-
-                    getDelegate().onStopLoading();
-
-                    JSONObject json = (JSONObject)object;
-
-                    int result = Network.RESULT_FALSE;
-                    String msg = "Sorry, something is wrong.";
-                    if (json != null) {
-
-                        result = json.optInt("result", Network.RESULT_FALSE);
-                        if (result != Network.RESULT_TRUE) {
-                            String err_msg = json.optString("err_msg");
-                            if (!TextUtils.isEmpty(err_msg)) {
-                                msg = err_msg;
-                            }
-                        }
-                    } // json
-
-                    if (result != Network.RESULT_TRUE) {
-                        getDelegate().onFailed(msg);
-                    }
-
-                } // != null
-
-
-
-            }
-        }, null);
-    }
-
-    // endregion
-
-    // region Download
-
-    public void downloadFile(final String url, final Bundle params) {
-
-        if (getDelegate() != null) {
-            getDelegate().onStartLoading();
-        }
-
-        OperationQueue.sharedQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
-            @Override
-            public Object operationDoInBackground() {
-
-                String cacheDir = ApexTrackingApplication.getInstance().getExternalCacheDir().getAbsolutePath();
-
-                final File downloadFile = Network.downloadFile(params, url, cacheDir);
-
-                return downloadFile;
-            }
-        }, new OperationQueue.OperationCompletionCallBack() {
-            @Override
-            public void operationCompletion(Object object) {
-
-                if (getDelegate() != null) {
-
-                    getDelegate().onStopLoading();
-
-                    File file = (File)object;
-                    if (file == null) {
-
-                        getDelegate().onFailed("Sorry, something is wrong.");
-
-                    } else {
-                        getDelegate().onDownloadFile(file.getAbsolutePath(), params);
-                    }
-
-                }
-
-            }
-        }, null);
-
-    }
-
-    // endregion
-}

+ 0 - 53
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultAdditionView.java

@@ -1,53 +0,0 @@
-package com.usai.apex.apexResult.cell;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.apex.R;
-
-public class ApexResultAdditionView extends RelativeLayout {
-
-    public static ApexResultAdditionView makeAdditionView(Context context) {
-
-        ApexResultAdditionView additionView = (ApexResultAdditionView) LayoutInflater.from(context).inflate(R.layout.apex_result_addition_view, null);
-        additionView.init();
-        return additionView;
-    }
-
-    private TextView titleTv, valueTv;
-
-    public ApexResultAdditionView(Context context) {
-        super(context);
-    }
-
-    public ApexResultAdditionView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public ApexResultAdditionView(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    private void init() {
-        titleTv = findViewById(R.id.apex_result_addition_title_tv);
-        valueTv = findViewById(R.id.apex_result_addition_value_tv);
-        prepareReuse();
-    }
-
-    private void prepareReuse() {
-        titleTv.setText("");
-        valueTv.setText("");
-    }
-
-    public void setTitle(String title) {
-        titleTv.setText(title);
-    }
-
-    public void setValue(String value) {
-        valueTv.setText(value);
-    }
-
-}

+ 0 - 70
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultDocumentCell.java

@@ -1,70 +0,0 @@
-package com.usai.apex.apexResult.cell;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.usai.apex.R;
-
-
-public class ApexResultDocumentCell extends RelativeLayout {
-
-    public static ApexResultDocumentCell makeDocumentCell(Context context) {
-
-        ApexResultDocumentCell cell = (ApexResultDocumentCell) LayoutInflater.from(context).inflate(R.layout.apex_result_document_cell, null);
-        cell.init();
-
-        return cell;
-    }
-
-
-    private ImageView fileIconView;
-    private TextView fileNameTv, fileTypeTv, fileDescTv;
-
-    private void init() {
-
-        fileIconView = findViewById(R.id.apex_result_document_icon_view);
-        fileNameTv = findViewById(R.id.apex_result_document_file_name_tv);
-        fileTypeTv = findViewById(R.id.apex_result_document_file_type_tv);
-        fileDescTv = findViewById(R.id.apex_result_document_file_desc_tv);
-
-        prepareReuse();
-    }
-
-    public ApexResultDocumentCell(Context context) {
-        super(context);
-    }
-
-    public ApexResultDocumentCell(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public ApexResultDocumentCell(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    public void prepareReuse() {
-        fileNameTv.setText("");
-        fileTypeTv.setText("");
-        fileDescTv.setText("");
-    }
-
-    public ApexResultDocumentCell setFileName(String name) {
-        fileNameTv.setText(name);
-        return this;
-    }
-
-    public ApexResultDocumentCell setFileType(String type) {
-        fileTypeTv.setText(type);
-        return this;
-    }
-
-    public ApexResultDocumentCell setFileDescription(String description) {
-        fileDescTv.setText(description);
-        return this;
-    }
-
-}

+ 0 - 165
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/cell/ApexResultShipCell.java

@@ -1,165 +0,0 @@
-package com.usai.apex.apexResult.cell;
-
-import android.content.Context;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.apex.mainframe.TrackingImageView;
-
-import java.util.ArrayList;
-
-public class ApexResultShipCell extends LinearLayout {
-
-    // region initial
-    public static ApexResultShipCell makeShipCell(Context context) {
-        ApexResultShipCell cell = (ApexResultShipCell) LayoutInflater.from(context).inflate(R.layout.apex_result_ship_cell, null);
-        cell.init();
-
-        return cell;
-    }
-
-    private TextView titleTv, dateTv, descTv, detailTv, portTv;
-    private TrackingImageView statusIv;
-    private View stageView;
-    private LinearLayout additionLayout;
-
-    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
-    private int additionCount = 0;
-
-    public ApexResultShipCell(Context context) {
-        super(context);
-    }
-
-    public ApexResultShipCell(Context context, @Nullable AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public ApexResultShipCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    private void init() {
-
-        titleTv = findViewById(R.id.tv_title);
-        dateTv = findViewById(R.id.tv_time);
-        descTv = findViewById(R.id.tv_description);
-        detailTv = findViewById(R.id.tv_detail);
-        portTv = findViewById(R.id.tv_port);
-        statusIv = findViewById(R.id.iv_status);
-        stageView = findViewById(R.id.v_transport_stage);
-        additionLayout = findViewById(R.id.apex_result_ship_addition_view);
-
-        prepareReuse();
-    }
-
-    public void prepareReuse() {
-
-        titleTv.setText("");
-        dateTv.setText("");
-        descTv.setText("");
-        detailTv.setText("");
-        portTv.setText("");
-        statusIv.setImageDrawable(null);
-        setTransportStage(0);
-        clearAdditionView();
-    }
-
-    public void setTransportStage(int stage) {
-        switch(stage)
-        {
-            case 0:
-                stageView.setBackground(ApexTrackingApplication.getInstance().getResources().getDrawable(R.drawable.list_corner_transport_stage_bg_0));
-                break;
-            case 1:
-                stageView.setBackground(ApexTrackingApplication.getInstance().getResources().getDrawable(R.drawable.list_corner_transport_stage_bg_1));
-                break;
-            case 2:
-                stageView.setBackground(ApexTrackingApplication.getInstance().getResources().getDrawable(R.drawable.list_corner_transport_stage_bg_2));
-                break;
-            case 3:
-                stageView.setBackground(ApexTrackingApplication.getInstance().getResources().getDrawable(R.drawable.list_corner_transport_stage_bg_3));
-                break;
-            default:
-                stageView.setBackground(ApexTrackingApplication.getInstance().getResources().getDrawable(R.drawable.list_corner_transport_stage_bg_0));
-                break;
-
-        }
-    }
-
-    // endregion
-
-    // region set
-
-    public ApexResultShipCell setTitle(String title) {
-        titleTv.setText(title);
-        return this;
-    }
-
-    public ApexResultShipCell setDetail(String detail) {
-        detailTv.setText(detail);
-        return this;
-    }
-
-    public ApexResultShipCell setIcon(String icon) {
-        if (icon != null) {
-            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
-            statusIv.setImageResource(resourceId);
-        } else {
-            statusIv.setImageDrawable(null);
-        }
-        return this;
-    }
-
-    public ApexResultShipCell setPort(String port) {
-        portTv.setText(port);
-        return this;
-    }
-
-    public ApexResultShipCell setTime(String time) {
-        dateTv.setText(time);
-        return this;
-    }
-
-    public ApexResultShipCell setDescription(String description) {
-        descTv.setText(description);
-        return this;
-    }
-
-    public void addAddition(String name, String value) {
-
-        ApexResultAdditionView additionView;
-        if (additionCount >= additionArray.size()) {
-
-            additionView = ApexResultAdditionView.makeAdditionView(getContext());
-            additionArray.add(additionView);
-
-        } else {
-            additionView = additionArray.get(additionCount);
-        }
-        additionCount++;
-
-        additionView.setTitle(name);
-        additionView.setValue(value);
-
-        LinearLayout.LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
-        additionLayout.addView(additionView, layoutParams);
-    }
-
-    // endregion
-
-    // region Private
-
-    private void clearAdditionView() {
-        additionLayout.removeAllViews();
-        additionCount = 0;
-    }
-
-    // endregion
-}

+ 0 - 50
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultBaseModel.java

@@ -1,50 +0,0 @@
-package com.usai.apex.apexResult.model;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.usai.apex.base.BaseObject;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-public class ApexResultBaseModel extends BaseObject {
-
-    protected ApexResultBaseModel(Parcel in) {
-        type = in.readInt();
-        String jsonStr = in.readString();
-        try {
-            rowActionParameters = new JSONArray(jsonStr);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public ApexResultBaseModel() {
-
-    }
-
-    public JSONObject toJson() {
-        JSONObject json = new JSONObject();
-        try {
-            json.put("type", type);
-            if (rowActionParameters != null) {
-                json.put("rowActionParameters", rowActionParameters);
-            }
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        return json;
-    }
-
-    public static enum ApexResultType {
-        APEX_RESULT_TYPE_SHIP,
-        APEX_RESULT_TYPE_DOCUMENT
-    }
-
-    public int type;
-    public JSONArray rowActionParameters;
-}

+ 0 - 36
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultDocumentModel.java

@@ -1,36 +0,0 @@
-package com.usai.apex.apexResult.model;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-public class ApexResultDocumentModel extends ApexResultBaseModel {
-
-    public String fileName;
-    public String fileType;
-    public String fileDesc;
-
-    public ApexResultDocumentModel() {
-
-    }
-
-    @Override
-    public JSONObject toJson() {
-        JSONObject json = super.toJson();
-
-        try {
-            if (fileName != null) {
-                json.put("fileName", fileName);
-            }
-            if (fileType != null) {
-                json.put("fileType", fileType);
-            }
-            if (fileDesc != null) {
-                json.put("fileDesc", fileDesc);
-            }
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        return json;
-    }
-}

+ 0 - 116
Apex Mobile/app/src/main/java/com/usai/apex/apexResult/model/ApexResultShipModel.java

@@ -1,116 +0,0 @@
-package com.usai.apex.apexResult.model;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.usai.apex.base.BaseObject;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-
-public class ApexResultShipModel extends ApexResultBaseModel {
-
-    // region Addition
-    public static class ApexResultAddition extends BaseObject{
-        public String name;
-        public String value;
-
-        private ApexResultAddition() {
-
-        }
-    }
-    // endregion
-
-    // region Model
-    public String title;
-    public String icon;
-    public String desc;
-    public String detail;
-    public String date;
-    public String port;
-    public int transport_stage;
-
-    public Object addition; // 使用Object对象,便于baseObject赋值
-    private ArrayList<ApexResultAddition> additions;
-
-    public ApexResultShipModel() {
-
-    }
-
-    public void setAddition(Object obj) {
-        this.addition = obj;
-        if (obj != null && obj instanceof JSONArray) {
-
-            JSONArray addition = (JSONArray) obj;
-            if (addition != null && addition.length() > 0) {
-
-                this.additions = new ArrayList<>();
-                for (int i = 0; i < addition.length(); i++) {
-                    JSONObject additionItem = addition.optJSONObject(i);
-                    if (additionItem != null) {
-
-                        ApexResultAddition additionModel = new ApexResultAddition();
-                        additionModel.setValuesForKeysWithJSON(additionItem);
-                        this.additions.add(additionModel);
-                    }
-                }
-
-            } else {
-                this.additions = null;
-            }
-
-        } else {
-            this.additions = null;
-        }
-
-
-
-    }
-
-    public ArrayList<ApexResultAddition> getAddition() {
-        return additions;
-    }
-    // endregion
-
-
-    @Override
-    public JSONObject toJson() {
-        JSONObject json = super.toJson();
-
-        try {
-
-            if (title != null) {
-                json.put("title", title);
-            }
-            if (icon != null) {
-                json.put("icon", icon);
-            }
-            if (desc != null) {
-                json.put("desc", desc);
-            }
-            if (detail != null) {
-                json.put("detail", detail);
-            }
-            if (date != null) {
-                json.put("date", date);
-            }
-            if (port != null) {
-                json.put("port", port);
-            }
-
-            json.put("transport_stage", transport_stage);
-
-            if (addition != null) {
-                json.put("addition", addition);
-            }
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        return json;
-    }
-}

+ 0 - 318
Apex Mobile/app/src/main/java/com/usai/apex/base/BaseObject.java

@@ -1,318 +0,0 @@
-package com.usai.apex.base;
-
-import android.text.TextUtils;
-
-import org.json.JSONObject;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- * 基础对象,方便使用json初始化对象,属性必须声明为public
- * 如果json中元素为json对象,那么属性对应的应该为Object类型
- * */
-public class BaseObject {
-
-    /**
-     * Utils
-     * */
-
-    private static String toUpperCaseFirstOne(String s){
-        if(Character.isUpperCase(s.charAt(0)))
-            return s;
-        else
-            return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
-    }
-
-    /**
-     * Setter
-     * */
-    private boolean invokeSetter(Class cls, Class type, String key, Object value) {
-
-        String setter = "set" + toUpperCaseFirstOne(key);
-        try {
-
-            Class<?> myClassType = Class.forName(cls.getName());
-
-            Method method = myClassType.getMethod(setter,type);
-            if (method != null) {
-
-                method.invoke(this,value);
-
-                return true;
-            }
-
-        } catch (Exception e) {
-//            e.printStackTrace();
-        }
-
-        return false;
-    }
-
-    private void setValue(Class cls, Field f, Class type, String key, Object value) {
-
-        if (!invokeSetter(cls, type, key, value)) {
-            try {
-                f.set(this,value);
-            } catch (IllegalAccessException e) {
-//                e.printStackTrace();
-            }
-        }
-    }
-
-    private void setValue(Class cls, Field f, String key, Object value) {
-
-        Class type = f.getType();
-
-        if (value == null) {
-
-            boolean isInt = (type == int.class || type == long.class);
-            boolean isFloat = (type == float.class || type == double.class);
-            boolean isBool = (type == Boolean.class || type == boolean.class);
-
-            if (isInt) {
-                value = 0;
-            } else if (isFloat) {
-                value = 0.0;
-            } else if (isBool) {
-                value = false;
-            }
-
-            setValue(cls, f, type, key, value);
-
-        } else {
-
-            if (type == value.getClass()) {
-
-                setValue(cls, f, type, key, value);
-
-            } else {
-
-                boolean isInt = ((type == int.class || type == long.class) && value.getClass() == Integer.class);
-                boolean isFloat = ((type == float.class || type == double.class) && (value.getClass() == Double.class || value.getClass() == Float.class));
-                boolean isBool = ((type == Boolean.class || type == boolean.class) && (value.getClass() == boolean.class || value.getClass() == Boolean.class));
-
-                if (isInt || isFloat || isBool) {
-                    setValue(cls, f, type, key, value);
-                } else {
-
-                    if (value.getClass() == String.class) {
-
-                        String string = (String)value;
-
-                        if (type == Integer.class || type == int.class || type == long.class) {
-
-                            value = Integer.valueOf(string);
-
-
-                        } else if (type == Double.class || type == double.class || type == float.class) {
-
-                            value = Double.valueOf(string);
-
-                        } else if (type == Boolean.class || type == boolean.class) {
-
-                            value = Boolean.valueOf(string);
-                        }
-
-                        setValue(cls, f, type, key, value);
-
-                    } else {
-
-                        if (type == Object.class) {
-                            setValue(cls, f, type, key, value);
-                        }
-
-                    }
-                }
-            }
-        }
-
-    }
-
-    public void setValueForKey(String key, Object value) {
-
-        if (key == null) {
-            return;
-        }
-
-        Class cls = getClass();
-//        out:while (cls != null && cls != Class.class) {
-//
-//            Field[] fields = cls.getFields();
-//            for (Field f : fields) {
-//
-//                String name = f.getName();
-//                if (name.equals(key)) {
-//
-//                    setValue(cls, f, key, value);
-//                    break out;
-//                }
-//            }
-//
-//            cls = cls.getSuperclass();
-//        }
-
-        try {
-            Field f = cls.getField(key);
-            setValue(cls, f, key, value);
-        } catch (NoSuchFieldException e) {
-//            e.printStackTrace();
-        }
-    }
-
-    public void setValueForKeyPath(String keyPath, Object value) {
-
-        if (keyPath != null) {
-            if (keyPath.contains(".")) {
-
-                Object receiver = this;
-                String[] nodes = keyPath.split("\\."); // split 实际上是正则表达式,所以特殊字符需要转译
-                for (int i = 0; i < nodes.length; i++) {
-                    String key = nodes[i];
-                    if (i == nodes.length - 1) {
-
-                        if (receiver != null) {
-
-                            if (receiver instanceof BaseObject) {
-                                ((BaseObject) receiver).setValueForKey(key,value);
-                            } else {
-
-                                try {
-
-                                    Class cls = receiver.getClass();
-                                    Field f = cls.getField(key);
-                                    setValue(cls, f, key, value);
-                                } catch (NoSuchFieldException e) {
-//                                    e.printStackTrace();
-                                }
-                            }
-                        }
-
-                    } else {
-
-                        receiver = getValueForKey(receiver, key);
-                        if (receiver == null) {
-                            break;
-                        }
-                    }
-                }
-
-            } else {
-                setValueForKey(keyPath,value);
-            }
-        }
-    }
-
-    public void setValuesForKeysWithJSON(JSONObject json) {
-
-        if (json == null || json.length() == 0) {
-            return;
-        }
-
-
-        try {
-            Class cls = getClass();
-            while (cls != null && cls != Class.class) {
-
-                Field[] fields = cls.getFields();
-                for (Field f : fields) {
-
-                    String key = f.getName();
-
-                    Object value = json.opt(key);
-
-//                    if (value == null) {
-//                        continue;
-//                    }
-
-                    setValue(cls, f, key, value);
-                }
-                cls = cls.getSuperclass();
-            }
-        } catch (Exception e) {
-//            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Getter
-     * */
-
-    private Object invokeGetter(Class cls, String key) {
-
-        String setter = "get" + toUpperCaseFirstOne(key);
-        try {
-
-            Class<?> myClassType = Class.forName(cls.getName());
-
-            Method method = myClassType.getMethod(setter,void.class);
-            if (method != null) {
-                return method.invoke(this);
-            }
-
-        } catch (Exception e) {
-//            e.printStackTrace();
-        }
-
-        return null;
-    }
-
-    private Object getValueForKey(Object receiver, String key) {
-
-        if (receiver == null || TextUtils.isEmpty(key)) {
-            return null;
-        }
-
-        try {
-
-            Class cls = receiver.getClass();
-
-            Object obj = invokeGetter(cls, key);
-
-            if (obj == null) {
-
-                Field field = cls.getField(key);
-                if (field != null) {
-                    obj = field.get(receiver);
-                    return obj;
-                } else {
-                    return null;
-                }
-            } else {
-                return obj;
-            }
-
-        } catch (NoSuchFieldException e) {
-//            e.printStackTrace();
-        } catch (IllegalAccessException e) {
-//            e.printStackTrace();
-        }
-        return null;
-
-    }
-
-    public Object getValueForKeyPath(String keyPath) {
-
-        if (keyPath != null) {
-
-            if (keyPath.contains(".")) {
-
-                Object receiver = this;
-                String[] nodes = keyPath.split("\\."); // split 实际上是正则表达式,所以特殊字符需要转译
-                for (int i = 0; i < nodes.length; i++) {
-                    String key = nodes[i];
-                    receiver = getValueForKey(receiver, key);
-                    if (receiver == null) {
-                        break;
-                    }
-                }
-                return receiver;
-
-            } else {
-                return getValueForKey(this,keyPath);
-            }
-
-        }
-        return null;
-    }
-}

+ 0 - 176
Apex Mobile/app/src/main/java/com/usai/apex/button/RAButton.java

@@ -1,176 +0,0 @@
-package com.usai.apex.button;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-
-import java.util.HashMap;
-
-public class RAButton extends android.support.v7.widget.AppCompatButton {
-
-    private HashMap<RAButtonState,Drawable> stateDrawableHashMap = new HashMap<>();
-    private HashMap<RAButtonState,String> stateTitleHashMap = new HashMap<>();
-    private HashMap<RAButtonState,Integer> stateTitleColorHashMap = new HashMap<>();
-
-    private RAButtonState state = RAButtonState.RAButtonStateNormal;
-    private boolean mSelected = false;
-
-    public RAButton(Context context) {
-        super(context);
-
-        init();
-    }
-
-    public RAButton(Context context, AttributeSet attrs) {
-        super(context, attrs);
-
-        init();
-    }
-
-    public RAButton(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-
-        init();
-    }
-
-    private void init() {
-
-        setAllCaps(false);
-
-        String normalTitle = getText().toString();
-        Drawable normalDrawable = getBackground();
-        Integer normalTitleColor = getTextColors().getDefaultColor();
-
-        String title = stateTitleHashMap.get(RAButtonState.RAButtonStateNormal);
-        if (title == null && normalTitle != null) {
-            stateTitleHashMap.put(RAButtonState.RAButtonStateNormal,normalTitle);
-        }
-
-        Drawable background = stateDrawableHashMap.get(RAButtonState.RAButtonStateNormal);
-        if (background == null && normalDrawable != null) {
-            stateDrawableHashMap.put(RAButtonState.RAButtonStateNormal,normalDrawable);
-        }
-
-        stateTitleColorHashMap.put(RAButtonState.RAButtonStateNormal,normalTitleColor);
-
-    }
-
-    public void setBackgroundDrawableForState(RAButtonState state, Drawable drawable) {
-
-        if (state == null) {
-            return;
-        }
-
-        if (drawable != null) {
-            stateDrawableHashMap.put(state,drawable);
-        } else {
-            stateDrawableHashMap.remove(state);
-        }
-    }
-
-    public void setTitleForState(RAButtonState state, String title) {
-
-        if (state == null) {
-            return;
-        }
-        if (title == null) {
-            stateTitleHashMap.remove(state);
-        } else {
-            stateTitleHashMap.put(state,title);
-        }
-    }
-
-    public void setTitleColorForState(RAButtonState state, int color) {
-
-        if (state == null) {
-            return;
-        }
-
-        stateTitleColorHashMap.put(state,Integer.valueOf(color));
-    }
-
-    public void setText(String text) {
-        super.setText(text);
-
-        setTitleForState(state,text);
-    }
-
-    public void setTextColor(int color) {
-        super.setTextColor(color);
-
-        setTitleColorForState(state,color);
-    }
-
-    public void setBackgroundDrawable(Drawable drawable) {
-        super.setBackgroundDrawable(drawable);
-
-        setBackgroundDrawableForState(state,drawable);
-    }
-
-    private void refreshUI() {
-
-        Drawable drawable = stateDrawableHashMap.get(state);
-        if (drawable == null) {
-            drawable = stateDrawableHashMap.get(RAButtonState.RAButtonStateNormal);
-        }
-        super.setBackgroundDrawable(drawable);
-
-        String title = stateTitleHashMap.get(state);
-        if (title == null) {
-            title = stateTitleHashMap.get(RAButtonState.RAButtonStateNormal);
-        }
-        super.setText(title);
-
-        Integer colorInteger = stateTitleColorHashMap.get(state);
-        if (colorInteger != null) {
-            super.setTextColor(colorInteger.intValue());
-        }
-    }
-
-    public void setSelection(boolean selection) {
-        mSelected = selection;
-
-        if (selection) {
-            state = RAButtonState.RAButtonStateSelected;
-        } else {
-            state = RAButtonState.RAButtonStateNormal;
-        }
-
-        refreshUI();
-    }
-
-    public boolean getSelection() {
-        return mSelected;
-    }
-
-    /**
-     * 按钮触摸状态改变回调
-     * */
-    @Override
-    protected void drawableStateChanged() {
-        super.drawableStateChanged();
-
-        boolean pressed = isPressed();
-
-        if (pressed) {
-            state = RAButtonState.RAButtonStateHighlight;
-        } else {
-
-            if (mSelected) {
-                state = RAButtonState.RAButtonStateSelected;
-            } else {
-                state = RAButtonState.RAButtonStateNormal;
-            }
-
-        }
-
-        refreshUI();
-
-    }
-
-    public enum RAButtonState {
-        RAButtonStateNormal,
-        RAButtonStateHighlight,
-        RAButtonStateSelected
-    }
-}

+ 0 - 94
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/BottomNavigationViewHelper.java

@@ -1,94 +0,0 @@
-package com.usai.apex.mainframe;
-
-import android.support.design.internal.BaselineLayout;
-import android.support.design.internal.BottomNavigationItemView;
-import android.support.design.internal.BottomNavigationMenuView;
-import android.support.design.widget.BottomNavigationView;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-
-import com.usai.apex.ApexTrackingApplication;
-
-import java.lang.reflect.Field;
-
-// 利用反射,改变 item 中 mShiftingMode 的值
-public class BottomNavigationViewHelper {
-
-    public static void disableShiftMode(BottomNavigationView navigationView, boolean showIcon) {
-
-
-        BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
-
-
-
-//        for (int i = 0; i < menuView.getChildCount(); i++) {
-//            final View iconView = menuView.getChildAt(i).findViewById(android.support.design.R.id.icon);
-//            final ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
-//            final DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
-//            layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, displayMetrics);
-//            layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, displayMetrics);
-//            iconView.setLayoutParams(layoutParams);
-//        }
-
-        try {
-            Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
-            shiftingMode.setAccessible(true);
-            shiftingMode.setBoolean(menuView, false);
-            shiftingMode.setAccessible(false);
-
-            for (int i = 0; i < menuView.getChildCount(); i++) {
-                BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
-
-
-
-
-
-
-                 View iconView = itemView.findViewById(android.support.design.R.id.icon);
-
-                final ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
-                final DisplayMetrics displayMetrics = ApexTrackingApplication.get_instance().getResources().getDisplayMetrics();
-                layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 26, displayMetrics);
-                layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 26, displayMetrics);
-                iconView.setLayoutParams(layoutParams);
-
-
-//                itemView.removeView(iconView);
-//                iconView.remove
-
-                if(!showIcon)
-                {
-                    for(int k=0;k<itemView.getChildCount();k++)
-                    {
-                        View v = itemView.getChildAt(k);
-                        if(v instanceof BaselineLayout)
-                        {
-//                        BaselineLayout bl = (BaselineLayout)v;
-                            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) v.getLayoutParams();
-                            params.gravity = Gravity.CENTER;
-                            v.setLayoutParams(params);
-
-                        }
-                    }
-
-                    iconView.setVisibility(View.GONE);
-                }
-
-                itemView.setShiftingMode(false);
-                itemView.setChecked(itemView.getItemData().isChecked());
-
-
-            }
-//            navigationView.setSelectedItemId(navigationView.getMenu().getItem(0).getItemId());
-
-
-
-        } catch (NoSuchFieldException | IllegalAccessException e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 355
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/HistoryFragment.java

@@ -1,355 +0,0 @@
-package com.usai.apex.mainframe;
-
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ListView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.apex.Result.PullRefreshListView;
-import com.usai.util.Network;
-import com.usai.util.dbUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class HistoryFragment extends TrackingListFragment {
-
-//
-//    boolean bactive = false;
-//    public  void setActive(boolean active){
-//        bactive = active;
-//
-//    }
-
-    private class HistoryTask extends AsyncTask<Void, Void, JSONObject> {
-
-        @Override
-        protected void onPreExecute() {
-            super.onPreExecute();
-
-            isLoading = true;
-            showProgressDialog();
-        }
-
-        @Override
-        protected JSONObject doInBackground(Void... voids) {
-
-            final Bundle params = new Bundle();
-            params.putInt("offset",mOffset);
-            params.putInt("limit",load_limit);
-
-            final JSONObject jsobj = Network.request_history(params);
-
-            return jsobj;
-        }
-
-        @Override
-        protected void onPostExecute(JSONObject jsobj) {
-            super.onPostExecute(jsobj);
-
-
-            mPullRefreshListView.completeRefresh();
-            showProgress(false);
-            if (mSwipeRefresh.isRefreshing()) {
-                mSwipeRefresh.setRefreshing(false);
-            }
-
-            dismissProgressDialog();
-
-            if (jsobj != null) {
-
-                try {
-                    int result = jsobj.getInt("result");
-                    if (result == Network.RESULT_TRUE) {
-
-                        JSONArray datalist = jsobj.getJSONArray("container_list");
-                        int count = datalist.length();
-
-                        switch (mOption) {
-                            case 0:
-                            case 1: {
-                                searchresult.clear();
-                            }
-                            break;
-                            case 2: {
-
-                            }
-                            break;
-                        }
-
-                        searchresult.add_records(datalist.toString(), count);
-
-                        if(searchresult.getData().size()==0)
-                        {
-
-                            showRefreshButton(true);
-                        }
-                        else
-                        {
-                            showRefreshButton(false);
-
-                        }
-                        adapter.notifyDataSetChanged();
-
-                        if (count < load_limit && count!=0) {
-                            showAlert("No More Data");
-                        }
-
-                        if(mOption==0)
-                            bdirty = false;
-
-                    } else {
-                        String msg = jsobj.getString("err_msg");
-                        showAlert(msg);
-                    }
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                    showAlert("Sorry,there is some wrong");
-                }
-
-            } else {
-                showAlert("Sorry,there is some wrong");
-            }
-
-            isLoading = false;
-            mTask = null;
-        }
-
-        @Override
-        protected void onCancelled() {
-            super.onCancelled();
-
-            isLoading = false;
-            dismissProgressDialog();
-            mTask = null;
-        }
-    }
-
-    private int mOffset = 0;
-    private int mOption = 0;
-    private HistoryTask mTask;
-
-    protected boolean isActive()
-    {
-        return ApexTrackingApplication.getInstance().historyactive;
-    }
-    public HistoryFragment() {
-        // Required empty public constructor
-        bdirty = true;
-    }
-
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState)
-    {
-        super.onActivityCreated(savedInstanceState);
-
-//        setupAdapter();
-//        customize_style();
-
-        refresh_footer = View.inflate(mContext, R.layout.refresh_footer, null);
-        mPullRefreshListView.setRefreshFooter(refresh_footer);
-        mPullRefreshListView.setOnRefreshListener(new PullRefreshListView.OnRefreshListener() {
-            @Override
-            public void onHeaderStateChange(int state, int offset) {
-
-            }
-
-            @Override
-            public void onFooterStateChange(int state, int offset) {
-                if (state == PullRefreshListView.REFRESHING) {
-                    if (!isLoading) {
-                        loadContent(2);
-                    }
-                }
-            }
-
-            @Override
-            public void shouldPullDownToRefresh(boolean should) {
-
-            }
-        });
-
-        // this.getListView().setBackgroundColor(Color.WHITE);
-//        if (searchresult.get_count() == 0) {
-//            requestData();
-//        }
-
-    }
-//    private void requestdata()
-//    {
-//
-//        loadContent(0);
-//
-////        JSONObject jsobj = loadfakecontent(R.raw.fake_container_list);
-////        // if (searchresult.get_fieldscount() == 0)
-////        // {
-////        // JSONObject objfields = jsobj.getJSONObject("fields");
-////        // if (objfields != null)
-////        // searchresult.init_fields(objfields.toString());
-////        // }
-////
-////
-////        try {
-////            JSONArray datalist = jsobj.getJSONArray("container_list");
-////            int count = datalist.length();
-////            searchresult.add_records(datalist.toString(), count);
-////
-////        } catch (JSONException e) {
-////            e.printStackTrace();
-////        }
-////
-//////        int count = jsobj.getInt("total");
-//////
-//////        if (count < limit)
-//////            bfinish = true;
-//////        JSONObject objrecords = jsobj.getJSONObject("records");
-//////        if (objrecords != null)
-//////            searchresult.add_records(objrecords.toString(), count);
-//////        errorcode = Network.RESULT_TRUE;
-////
-////        adapter.notifyDataSetChanged();
-//    }
-    @Override
-    protected View initHeaderView()
-    {
-
-        View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.invisable_listheader, null);
-        return headerView;
-
-    }
-
-    @Override
-    protected void requestData() {
-
-        loadContent(0);
-//        super.requestData();
-    }
-
-    private static final int load_limit = 10;
-    private void loadContent(final int option) {
-
-        if (isLoading) {
-            if (mSwipeRefresh.isRefreshing()) {
-                mSwipeRefresh.setRefreshing(false);
-            }
-            return;
-        }
-
-        mOffset = 0;
-        switch (option) {
-            case 0:
-            case 1: {
-                mOffset = 0;
-            }
-            break;
-            case 2: {
-                mOffset = searchresult.get_count();
-            }
-            break;
-        }
-        mOption = option;
-
-
-        mTask = new HistoryTask();
-        mTask.execute();
-
-    }
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-
-        if (mTask != null) {
-            mTask.cancel(false);
-        }
-        dismissProgressDialog();
-    }
-
-    @Override
-    public void onListItemClick(ListView l, View v, int position, long id) {
-
-        //!!!!! listview 有header, position 需要-1
-
-
-//        Log.d("FragmentList", "Item clicked: " + id);
-//
-//        String title = (String) getData(jsonobj).get(position - 1).get("title");
-
-        position = position - 1;
-        if (position < 0) {
-            return;
-        }
-
-        setSelectedPosition(position);
-
-        String cargo_criterion = (String) searchresult.getData().get(position).get("hbol");
-        String serial_no = (String) searchresult.getData().get(position).get("serial_no");
-        if(TextUtils.isEmpty(serial_no))
-            serial_no = "dumb";
-
-        Intent intent = new Intent();
-        intent.setClass(getContext(), NewDetailActivity.class);
-
-        intent.putExtra("action0", "Tracking");
-        intent.putExtra("function_name", "Cargo Tracking");
-
-        intent.putExtra("cargo_criterion", cargo_criterion);
-        intent.putExtra("actions_count", 1);
-        intent.putExtra("_id", serial_no);
-
-        intent.putExtra("criterion_type", 0);
-        String h_field = "h_bol";
-
-        dbUtil.savehistory(h_field, cargo_criterion);
-
-        startActivity(intent);
-
-    }
-
-    private void setSelectedPosition(int position) {
-
-        if (mSelectedIndex >= 0) {
-
-            View cell = getCellForPosition(mSelectedIndex);
-            if (cell != null) {
-
-                View contentView = cell.findViewById(R.id.cell_content_view);
-                if (contentView != null) {
-                    contentView.setBackground(getResources().getDrawable(R.drawable.list_corner_round_bg));
-                }
-
-//                TrackingImageView iv_status = (TrackingImageView) cell.findViewById(R.id.iv_status);
-//                iv_status.setSelected(false);
-            }
-
-        }
-
-        mSelectedIndex = position;
-        View cell = getCellForPosition(mSelectedIndex);
-        if (cell != null) {
-            View contentView = cell.findViewById(R.id.cell_content_view);
-            if (contentView != null) {
-                contentView.setBackground(getResources().getDrawable(R.drawable.list_corner_round_selected_bg));
-            }
-
-//            TrackingImageView iv_status = (TrackingImageView) cell.findViewById(R.id.iv_status);
-//            iv_status.setSelected(true);
-        }
-
-    }
-
-}

+ 0 - 230
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/HomeFragment.java

@@ -1,230 +0,0 @@
-package com.usai.apex.mainframe;
-
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.apex.SegmentView;
-
-//import android.app.FragmentTransaction;
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class HomeFragment extends Fragment implements KPIFragment.KPIPagerScrollListener{
-
-    private SegmentView mSegmentView;
-//    boolean bdirty = false;
-    private  Fragment activeFragment;
-
-//    private
-    private KPIFragment kpiFragment;
-    private RecentFragment recentFragment;
-    public HomeFragment() {
-
-        // Required empty public constructor
-    }
-    public void checkDirty()
-    {
-//        if(bdirty)
-//            requestData();
-
-        if(ApexTrackingApplication.get_instance().recentactive)
-        {
-            recentFragment.checkDirty();
-        }
-        else
-        {
-            kpiFragment.checkDirty();
-        }
-    }
-    private int mode = 0;
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
-        // Inflate the layout for this fragment
-        View v= inflater.inflate(R.layout.fragment_home, container, false);
-
-
-
-
-        if(kpiFragment==null) {
-            kpiFragment = new KPIFragment();
-
-//                    .add(R.id.container, kpiFragment).hide(kpiFragment).commit();
-        }
-
-        if(recentFragment==null) {
-            recentFragment = new RecentFragment();
-//            getChildFragmentManager().beginTransaction()
-//                    .add(R.id.container, recentFragment).commit();
-        }
-
-        showFragment(mode);
-
-//        if(mode==0)
-//            ft.replace(R.id.container,kpiFragment);
-//        else
-//            ft.replace(R.id.container,kpiFragment);
-//
-//        if(mode==0)
-//        {
-//
-//            getChildFragmentManager().beginTransaction().show(getChildFragmentManager().getFragments().get(1)).hide(getChildFragmentManager().getFragments().get(0)).commit();
-//
-////            getChildFragmentManager().beginTransaction().show(recentFragment).hide(kpiFragment).commit();
-//        }
-//        else if(mode==1)
-//        {
-//            getChildFragmentManager().beginTransaction().show(getChildFragmentManager().getFragments().get(0)).hide(getChildFragmentManager().getFragments().get(1)).commit();
-//
-////            getChildFragmentManager().beginTransaction().show(kpiFragment).hide(recentFragment).commit();
-//        }
-
-
-        mSegmentView = v.findViewById(R.id.segmentview);
-
-        mSegmentView.setSegmentText("Recent",0);
-        mSegmentView.setSegmentText("KPI",1);
-
-                mSegmentView.setOnSegmentViewClickListener(new SegmentView.onSegmentViewClickListener() {
-            @Override
-            public void onSegmentViewClick(View view, int postion) {
-                switch (postion) {
-                    case 0:
-
-                        mode = 0;
-                        ((RootActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false);
-
-
-//                        ((Activity)getActivity()).setTitle(null);
-//                        getChildFragmentManager().beginTransaction().show(recentFragment).hide(kpiFragment).commit();
-
-//                        getChildFragmentManager().beginTransaction().show(getChildFragmentManager().getFragments().get(1)).hide(getChildFragmentManager().getFragments().get(0)).commit();
-
-
-
-                        break;
-                    case 1:
-
-                        mode = 1;
-                        ((RootActivity)getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(true);
-
-//                        ((Activity)getActivity()).setTitle(null);
-
-
-//                        getChildFragmentManager().beginTransaction().show(getChildFragmentManager().getFragments().get(0)).hide(getChildFragmentManager().getFragments().get(1)).commit();
-
-//                        getChildFragmentManager().beginTransaction().show(kpiFragment).hide(recentFragment).commit();
-
-                        break;
-                    default:
-                        break;
-                }
-                showFragment(mode);
-            }
-        });
-        return v;
-    }
-
-
-    void showFragment(int mode)
-    {
-
-        if(mode==0)
-            ApexTrackingApplication.getInstance().recentactive = true;
-        else
-            ApexTrackingApplication.getInstance().recentactive = false;
-        FragmentManager fm=getChildFragmentManager();
-        FragmentTransaction ft= fm .beginTransaction();
-        if(activeFragment!=null)
-            ft.hide(activeFragment);
-        Fragment fragment = null;
-        String tag = "";
-        if(mode==0) {
-            tag = "recent";
-            fragment = fm.findFragmentByTag(tag);
-            if(fragment==null)
-                fragment = recentFragment;
-            else
-                recentFragment = (RecentFragment) fragment;
-
-        }
-        else
-        {
-            tag = "kpi";
-            fragment = fm.findFragmentByTag(tag);
-            if(fragment==null)
-                fragment = kpiFragment;
-            else
-                kpiFragment = (KPIFragment) fragment;
-
-            kpiFragment.setKPIScrollListener(this);
-        }
-        activeFragment = fragment;
-
-        Log.d("Home Switch Mode", "UserHint: " + getUserVisibleHint() + " isHidden: " + isHidden());
-        if (activeFragment instanceof KPIFragment) {
-            kpiFragment.showTitle(getActivity(),true);
-        } else {
-            kpiFragment.showTitle(getActivity(),false);
-        }
-
-        if (!fragment.isAdded()) {
-            ft.add(R.id.container, fragment, tag);
-        } else {
-
-            ft.show(fragment);
-        }
-        ft.commit();
-
-
-        if(ApexTrackingApplication.get_instance().recentactive)
-        {
-            recentFragment.checkDirty();
-        }
-        else
-        {
-            kpiFragment.checkDirty();
-        }
-    }
-
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        outState.putInt("mode",mode);
-
-    }
-
-    @Override
-    public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
-        super.onViewStateRestored(savedInstanceState);
-
-            if(savedInstanceState!=null) {
-                mode = savedInstanceState.getInt("mode");
-                mSegmentView.setSelect(mode);
-            }
-    }
-
-    @Override
-    public void KPIPagerDidScrollToPage(int position) {
-        Log.d("Home Switch Mode", " Scroll UserHint: "  + getUserVisibleHint() + " isHidden: " + isHidden());
-        if (activeFragment instanceof KPIFragment) {
-            kpiFragment.showTitle(getActivity(),true);
-        } else {
-            kpiFragment.showTitle(getActivity(),false);
-        }
-    }
-}

+ 0 - 749
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/KPIFragment.java

@@ -1,749 +0,0 @@
-package com.usai.apex.mainframe;
-
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.graphics.Color;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.LocalBroadcastManager;
-import android.support.v4.view.PagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ProgressBar;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.KPI.KPICell;
-import com.usai.apex.KPI.KPIViewPager;
-import com.usai.apex.KPI.PieChartView;
-import com.usai.apex.R;
-import com.usai.apex.Result.AMResultActivity;
-import com.usai.apex.ResultActivity;
-import com.usai.util.Network;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class KPIFragment extends Fragment implements KPICell.KPIListener {
-
-    boolean bdirty = false;
-
-
-    protected boolean isActive()
-    {
-        return ApexTrackingApplication.getInstance().homeactive&& !ApexTrackingApplication.get_instance().recentactive;
-    }
-//    private static final long serialVersionUID = 2873400198824958986L;
-public void checkDirty()
-{
-
-    if(bdirty) {
-        loadKPIData();
-
-    }
-}
-    public static class KPIModel implements Serializable,Parcelable {
-
-        private static final long serialVersionUID = -6280156291692980527L;
-        public ArrayList<PieChartView.ChartItem> items;
-        public String name;
-        public String module_name;
-        public int total;
-
-
-        public KPIModel() {
-
-        }
-
-        protected KPIModel(Parcel in) {
-            name = in.readString();
-            module_name = in.readString();
-            total = in.readInt();
-        }
-
-        public static final Creator<KPIModel> CREATOR = new Creator<KPIModel>() {
-            @Override
-            public KPIModel createFromParcel(Parcel in) {
-                return new KPIModel(in);
-            }
-
-            @Override
-            public KPIModel[] newArray(int size) {
-                return new KPIModel[size];
-            }
-        };
-
-        @Override
-        public int describeContents() {
-            return 0;
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            dest.writeString(name);
-            dest.writeString(module_name);
-            dest.writeInt(total);
-        }
-    }
-
-    private static class Month implements Serializable {
-
-        private static final long serialVersionUID = -1567922292260033377L;
-        String shipVal;
-        int shipColor = Color.WHITE;
-
-        void setShipColor(String color) {
-            if (color == null) {
-                return;
-            }
-            shipColor = Color.parseColor(color.replace("0x","#"));
-        }
-
-        String containerVal;
-        int containerColor = Color.WHITE;
-
-        void setContainerColor(String color) {
-            if (color == null) {
-                return;
-            }
-            containerColor = Color.parseColor(color.replace("0x","#"));
-        }
-
-        String teuVal;
-        int teuColor = Color.WHITE;
-
-        void setTeuColor(String color) {
-            if (color == null) {
-                return;
-            }
-            teuColor = Color.parseColor(color.replace("0x","#"));
-        }
-    }
-
-    public interface KPIPagerScrollListener {
-        /*
-         * 解决Home.KPI --> My --> History显示KPI Title
-         * isHidden()、getUserHint()取得的值不正确
-         * */
-        void KPIPagerDidScrollToPage(int position);
-    }
-    private KPIPagerScrollListener mScrollListener;
-
-    public void setKPIScrollListener(KPIPagerScrollListener mScrollListener) {
-        this.mScrollListener = mScrollListener;
-    }
-
-    Context mContext;
-    KPIViewPager mKPIPager;
-    KPIPagerAdapter mAdapter;
-    JSONObject mData;
-    ArrayList<KPIModel> mKPIArr = new ArrayList<>();
-    Month mMonthModel;
-    SwipeRefreshLayout mSwipeRefresh;
-    ProgressBar mLoadIndicator;
-    private KPIFragment self;
-
-    private int currentKPI = 1, totalKPI = 0;
-
-    private KPIBroadcastReceiver mReceiver;
-
-    public KPIFragment() {
-        // Required empty public constructor
-    }
-
-    @Override
-    public void onDestroyView() {
-
-        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
-        localBroadcastManager.unregisterReceiver(mReceiver);
-
-        super.onDestroyView();
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
-        // Inflate the layout for this fragment
-        View root = inflater.inflate(R.layout.fragment_kpi, container, false);
-
-        mContext = getContext();
-        self = this;
-
-        if (savedInstanceState != null) {
-            bdirty = savedInstanceState.getBoolean("dirty");
-            currentKPI = savedInstanceState.getInt("currentKPI");
-            mKPIArr = (ArrayList<KPIModel>) savedInstanceState.getSerializable("KPIData");
-            mMonthModel = (Month) savedInstanceState.getSerializable("KPIMonth");
-            if (mKPIArr != null) {
-                totalKPI = mKPIArr.size();
-            }
-        }
-
-        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
-        IntentFilter intentFilter = new IntentFilter("com.apex.broadcast.person_mode");
-        mReceiver = new KPIBroadcastReceiver();
-        localBroadcastManager.registerReceiver(mReceiver,intentFilter);
-
-        mLoadIndicator = root.findViewById(R.id.loadKPI_indicator);
-        mSwipeRefresh = root.findViewById(R.id.kpi_swipe_refresh);
-        mSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                loadKPIData();
-            }
-        });
-
-        mKPIPager = mSwipeRefresh.findViewById(R.id.kpi_pager);
-//        mKPIPager = root.findViewById(R.id.kpi_pager);
-        mAdapter = new KPIPagerAdapter();
-        mKPIPager.setAdapter(mAdapter);
-        mKPIPager.setScrollEnable(true);
-        mKPIPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
-            @Override
-            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
-                Log.d("KPI", "onPageScrolled: " + position);
-            }
-
-            @Override
-            public void onPageSelected(int position) {
-
-                currentKPI = position;
-                int display_index = currentKPI;
-                Log.d("KPI", "onPageSelected: " + position);
-                if (position == 0) {
-                    display_index = totalKPI;
-//                    mKPIPager.setCurrentItem(currentKPI,false);
-                } else if (position == totalKPI + 1) {
-                    display_index = 1;
-//                    mKPIPager.setCurrentItem(currentKPI,false);
-                } else
-                    {
-                        display_index = position;
-                }
-                if (mScrollListener != null) {
-                    mScrollListener.KPIPagerDidScrollToPage(display_index);
-                }
-
-            }
-
-            @Override
-            public void onPageScrollStateChanged(int state) {
-                Log.d("KPI", "onPageScrollStateChanged: " + state);
-
-                if (state == ViewPager.SCROLL_STATE_IDLE) {
-                    if (currentKPI == mKPIPager.getAdapter().getCount() - 1) {
-                        mKPIPager.setCurrentItem(1, false);
-                    }
-                    else if (currentKPI == 0) {
-                        mKPIPager.setCurrentItem(mKPIPager.getAdapter().getCount() - 2, false);
-                    }
-                }
-                }
-        });
-
-        mSwipeRefresh.setEnabled(true);
-
-//        if (savedInstanceState != null) {
-//            String kpiString = savedInstanceState.getString("KPIData");
-//            if (kpiString != null) {
-//                try {
-//                    mData = new JSONObject(kpiString);
-//                    prepareData();
-//                } catch (JSONException e) {
-//                    e.printStackTrace();
-//                }
-//            }
-//        }
-//
-
-        if (mKPIArr != null && mKPIArr.size() > 0) {
-            int display_index = currentKPI;
-            mKPIPager.setCurrentItem(display_index,false);
-        }
-        if (mKPIArr == null || mKPIArr.size() == 0) {
-            loadKPIData();
-        }
-
-        return root;
-    }
-
-//    @Override
-//    public void setUserVisibleHint(boolean isVisibleToUser) {
-//        super.setUserVisibleHint(isVisibleToUser);
-//        showTitle(isVisibleToUser);
-//    }
-//
-//    @Override
-//    public void onHiddenChanged(boolean hidden) {
-//        super.onHiddenChanged(hidden);
-//        showTitle(!hidden);
-//    }
-
-    public void showTitle(Context ctx,boolean show) {
-        if (ctx == null) {
-            return;
-        }
-        android.support.v7.app.ActionBar bar = ((RootActivity)ctx).getSupportActionBar();
-        if (bar == null) {
-            return;
-        }
-        if (show) {
-//            bar.setDisplayShowTitleEnabled(true);
-            if (totalKPI > 0) {
-                int display_index = currentKPI % mKPIArr.size()==0?mKPIArr.size():currentKPI % mKPIArr.size();
-                ((Activity)ctx).setTitle(display_index + "/" + totalKPI);
-            } else {
-                ((Activity)ctx).setTitle(null);
-            }
-        } else {
-//            bar.setDisplayShowTitleEnabled(false);
-            ((Activity)ctx).setTitle(null);
-        }
-    }
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-
-    }
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-
-        if (mTask != null) {
-            mTask.cancel(false);
-        }
-        dismissProgressDialog();
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        if (mKPIArr != null) {
-            outState.putSerializable("KPIData",mKPIArr);
-        }
-        if (mMonthModel != null) {
-            outState.putSerializable("KPIMonth",mMonthModel);
-        }
-        outState.putInt("currentKPI",currentKPI);
-        outState.putBoolean("dirty",bdirty);
-
-
-//        mKPIArr.clear();
-//        mAdapter.notifyDataSetChanged();
-    }
-
-    @Override
-    public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
-        super.onViewStateRestored(savedInstanceState);
-        if (savedInstanceState != null) {
-
-            bdirty = savedInstanceState.getBoolean("dirty");
-//            currentKPI = savedInstanceState.getInt("currentKPI");
-//            mKPIArr = (ArrayList<KPIModel>) savedInstanceState.getSerializable("KPIData");
-//            mMonthModel = (Month) savedInstanceState.getSerializable("KPIMonth");
-//        }
-//
-//        if (mKPIArr == null || mKPIArr.size() == 0) {
-//            loadKPIData();
-        }
-    }
-
-    @Override
-    public void setUserVisibleHint(boolean isVisibleToUser) {
-        super.setUserVisibleHint(isVisibleToUser);
-    }
-
-    @Override
-    public void onHiddenChanged(boolean hidden) {
-        super.onHiddenChanged(hidden);
-    }
-
-
-    private ProgressDialog mProgressDialog;
-
-    public void showProgressDialog() {
-
-        if (mProgressDialog == null) {
-            if (getContext() == null) {
-                return;
-            }
-            mProgressDialog = new ProgressDialog(getContext());
-            mProgressDialog.setCancelable(false);
-            mProgressDialog.setMessage("Loading...");
-        }
-        mProgressDialog.show();
-    }
-
-    public void dismissProgressDialog() {
-        if (mProgressDialog != null && mProgressDialog.isShowing()) {
-            mProgressDialog.dismiss();
-        }
-    }
-
-    private class KPITask extends AsyncTask<Void, Void, JSONObject> {
-
-        @Override
-        protected void onPreExecute() {
-            super.onPreExecute();
-
-            loading = true;
-            showProgressDialog();
-        }
-
-        @Override
-        protected JSONObject doInBackground(Void... voids) {
-
-            mData = Network.request_KPI();
-            return mData;
-        }
-
-        @Override
-        protected void onPostExecute(JSONObject jsonObject) {
-            super.onPostExecute(jsonObject);
-
-            if (mLoadIndicator.getVisibility() == View.VISIBLE) {
-                mLoadIndicator.setVisibility(View.GONE);
-            }
-            if (mSwipeRefresh.isRefreshing()) {
-                mSwipeRefresh.setRefreshing(false);
-            }
-            dismissProgressDialog();
-            prepareData();
-
-            loading = false;
-            bdirty = false;
-            mTask = null;
-        }
-
-        @Override
-        protected void onCancelled() {
-            super.onCancelled();
-
-            loading = false;
-            dismissProgressDialog();
-            mTask = null;
-        }
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-
-    }
-
-    private KPITask mTask;
-
-    private boolean loading = false;
-    private void loadKPIData() {
-
-        if (loading) {
-            return;
-        }
-
-
-        mTask = new KPITask();
-        mTask.execute();
-    }
-
-    private void prepareData() {
-
-        if (mData == null) {
-            return;
-        }
-
-        JSONArray monthArray = mData.optJSONArray("month");
-        if (monthArray != null) {
-
-            Month monthModel = new Month();
-            for (int i = 0; i < monthArray.length(); i++) {
-                JSONObject month = monthArray.optJSONObject(i);
-                if (month != null) {
-                    String key = month.optString("key");
-                    String val = month.optString("val");
-                    String color = month.optString("color");
-                    if (key != null) {
-                        if (key.equals("Shipment")) {
-
-                            monthModel.shipVal = val;
-                            monthModel.setShipColor(color);
-
-                        } else if (key.equals("Container")) {
-
-                            monthModel.containerVal = val;
-                            monthModel.setContainerColor(color);
-
-                        } else if (key.equals("TEU")) {
-
-                            monthModel.teuVal = val;
-                            monthModel.setTeuColor(color);
-                        }
-                    }
-                }
-            }
-            mMonthModel = monthModel;
-
-        }
-
-        JSONArray kpiArray = mData.optJSONArray("KPI");
-
-        if (kpiArray != null) {
-            if (mKPIArr == null) {
-                mKPIArr = new ArrayList<>();
-            }
-            mKPIArr.clear();
-//            currentKPI = 1;
-            for (int i = 0; i < kpiArray.length(); i++) {
-
-                JSONObject kpi = kpiArray.optJSONObject(i);
-                if (kpi != null) {
-
-                    KPIModel model = new KPIModel();
-
-                    ArrayList<PieChartView.ChartItem> items = new ArrayList<>();
-
-                    JSONArray jsonArr = kpi.optJSONArray("arr_val");
-                    if (jsonArr != null) {
-
-                        for (int j = 0; j < jsonArr.length(); j++) {
-                            JSONObject item = jsonArr.optJSONObject(j);
-                            if (item != null) {
-                                PieChartView.ChartItem itm = new PieChartView.ChartItem();
-                                itm.value = Integer.valueOf(item.optString("A_val"));
-                                itm.title = item.optString("full_title");
-                                String color_str = item.optString("color");
-                                if (color_str != null) {
-                                    color_str = color_str.replace("0x","#");
-                                    itm.color = Color.parseColor(color_str);
-                                }
-                                itm.display = item.optBoolean("display");
-                                itm.shortTitle = item.optString("title");
-
-                                items.add(itm);
-                            }
-                        }
-
-                    }
-                    model.name = kpi.optString("name");
-                    model.total = kpi.optInt("total");
-                    model.module_name = kpi.optString("module_name");
-                    model.items = items;
-
-                    mKPIArr.add(model);
-                }
-
-            }
-            totalKPI = mKPIArr.size();
-        }
-        mAdapter.notifyDataSetChanged();
-        if (mKPIArr != null && mKPIArr.size() > 0) {
-            int display_index = currentKPI;
-            mKPIPager.setCurrentItem(display_index,false);
-        }
-    }
-
-    @Override
-    public void KPIPieChartClickedItem(KPICell cell, PieChartView.ChartItem item) {
-
-        String selection = null;
-        if (item != null) {
-            selection = String.format("%s %d %.2f%%",item.title, (int)item.value, item.getPercentage() * 100);
-        }
-        cell.setSelection(selection);
-    }
-
-    @Override
-    public void KPIPieChartClickedTitle(KPICell cell) {
-        Log.d("KPICell", "pieChartCenterClicked: ");
-    }
-
-//    @Override
-//    public void KPIPreviousButtonClicked(KPICell cell) {
-//        int index = mKPIPager.getCurrentItem();
-//        if (index == 0) {
-//            mKPIPager.setCurrentItem(mKPIArr.size() - 1,false);
-//        } else {
-//            mKPIPager.setCurrentItem(index - 1,false);
-//        }
-//    }
-//
-//    @Override
-//    public void KPINextButtonClicked(KPICell cell) {
-//        int index = mKPIPager.getCurrentItem();
-//        if (index == mKPIArr.size() - 1) {
-//            mKPIPager.setCurrentItem(0,false);
-//        } else {
-//            mKPIPager.setCurrentItem(index + 1,false);
-//        }
-//    }
-
-
-    @Override
-    public void KPIPieChartDidBeginClicked() {
-        mSwipeRefresh.setEnabled(false);
-        mKPIPager.setScrollEnable(false);
-    }
-
-    @Override
-    public void KPIPieChartDidEndClicked() {
-        mSwipeRefresh.setEnabled(true);
-        mKPIPager.setScrollEnable(true);
-    }
-
-    @Override
-    public void KPIListTouched(boolean touch) {
-        mSwipeRefresh.setEnabled(!touch);
-    }
-
-    @Override
-    public void KPICellDidDoubleClickItem(KPICell cell, int index, KPIModel model) {
-
-        if (model == null) {
-            return;
-        }
-
-        PieChartView.ChartItem legend = model.items.get(index);
-        String kpi_name = model.name;
-        String sector = legend.title;
-        String module_name = model.module_name;
-        if (kpi_name == null) {
-            kpi_name = "";
-        }
-        if (sector == null) {
-            sector = "";
-        }
-        if (module_name == null) {
-            module_name = "";
-        }
-
-        Bundle params = new Bundle();
-        params.putBoolean("is_kpi",true);
-        params.putString("name",kpi_name);
-        params.putString("sector",sector);
-        params.putString("module_name",module_name);
-
-        Intent intent = new Intent(getContext(), AMResultActivity.class);
-        intent.putExtra("query_params",params);
-        startActivity(intent);
-    }
-
-    public class KPIPagerAdapter extends PagerAdapter {
-
-        ArrayList<KPICell> mReusePool = new ArrayList<>();
-
-        @Override
-        public int getCount() {
-            if (mKPIArr == null || mKPIArr.size() == 0) {
-                return 0;
-            }
-            return mKPIArr.size() + 2;
-        }
-
-        @Override
-        public boolean isViewFromObject(View view, Object object) {
-            return view == object;
-        }
-
-        @Override
-        public int getItemPosition(Object object) {
-//            return super.getItemPosition(object);
-            return POSITION_NONE;
-        }
-
-        @Override
-        public void destroyItem(ViewGroup container, int position, Object object) {
-
-            KPICell cell = (KPICell)object;
-            cell.setListener(null);
-            container.removeView(cell);
-            mReusePool.add(cell);
-        }
-
-        @Override
-        public Object instantiateItem(ViewGroup container, int position) {
-
-            KPICell cell = null;
-            if (mReusePool.isEmpty()) {
-                cell = (KPICell) LayoutInflater.from(mContext).inflate(R.layout.kpi_cell,null);
-                cell.init();
-            } else {
-                cell = mReusePool.get(0);
-                mReusePool.remove(cell);
-            }
-
-
-
-            int index = position;
-            if (position == 0) {
-                index = mKPIArr.size() - 1;
-            } else if (position == mKPIArr.size() + 1) {
-                index = 0;
-            } else {
-                index = position - 1;
-            }
-
-            KPIModel model = mKPIArr.get(index);
-            Log.d("KPI Cell", "dequeue Cell " + index);
-//            cell.setChartItems(model.items);
-//            cell.setNameAndCount(model.name,model.total);
-//            cell.randomColor();
-            cell.setKPIModel(model);
-
-            if (mMonthModel != null) {
-                cell.setMonthShipment(mMonthModel.shipVal,mMonthModel.shipColor);
-                cell.setMonthContainer(mMonthModel.containerVal,mMonthModel.containerColor);
-                cell.setMonthTeu(mMonthModel.teuVal,mMonthModel.teuColor);
-            }
-
-            container.addView(cell);
-            cell.setListener(self);
-
-            return cell;
-        }
-    }
-
-
-    class KPIBroadcastReceiver extends BroadcastReceiver {
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-
-            if (intent.getAction().equals("com.apex.broadcast.person_mode")) {
-
-//                loadKPIData();
-                bdirty = true;
-
-                if(isActive())
-                {
-                    loadKPIData();
-                }
-            }
-//            else if (intent.getAction().equals("com.usai.apex.push.cancel")) {
-//                mData = null;
-//                mKPIArr.clear();
-//                mAdapter.notifyDataSetChanged();
-//            }
-        }
-    }
-
-}

+ 0 - 477
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/LoginFragment.java

@@ -1,477 +0,0 @@
-package com.usai.apex.mainframe;
-
-//import android.app.Fragment;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.LocalBroadcastManager;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.apex.RetrievePasswordActivity;
-import com.usai.util.AES;
-import com.usai.util.Network;
-
-//import android.app.Fragment;
-//import android.content.SharedPreferences;
-//import android.widget.TextView;
-
-/**
- * Activity which displays a login screen to the user, offering registration as
- * well.
- */
-public class LoginFragment extends Fragment/* implements OnClickListener */
-{
-
-
-	public interface LoginCallBack{
-		public abstract void onLogin();
-//		public abstract void onLogout();
-	}
-	private LoginCallBack mCallBack;
-	private String m_sUser;
-	private String m_sPassword;
-	private EditText m_etName;
-	private EditText m_etPassword;
-	private UserLoginTask mAuthTask = null;
-	private TextView mLoginStatusMessageView;
-	private View mLoginFormView;
-	private View mLoginStatusView;
-
-	private CheckBox m_cbSave;
-
-	// SQLiteDatabase m_db;
-	public void setCallBack(LoginCallBack callBack) {
-		this.mCallBack = callBack;
-	}
-//
-//	@Override
-//	public void onSaveInstanceState(Bundle outState) {
-//		super.onSaveInstanceState(outState);
-//		outState.putSerializable("hashmap", mCallBack);
-//	}
-
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container,
-			Bundle savedInstanceState) {
-		View view = inflater.inflate(R.layout.fragment_login, null);
-		TextView tv_ver = (TextView) view.findViewById(R.id.tv_ver);
-		try {
-			tv_ver.setText(getText(R.string.str_ver)+"2.20." +ApexTrackingApplication.get_instance().getPackageManager().getPackageInfo(
-						"com.usai.apex", 0).versionName);
-		} catch (NameNotFoundException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		}
-		// Button btn = (Button) view.findViewById(R.id.sign_in_button);
-		// btn.setOnClickListener(this);
-
-		// m_cbSave.setOnCheckedChangeListener(new OnCheckedChangeListener()
-		// {
-		//
-		// @Override
-		// public void onCheckedChanged(CompoundButton buttonView,
-		// boolean isChecked)
-		// {
-		// if (isChecked)
-		// {
-		// String user,password;
-		// SharedPreferences RunOnce = ApexTrackingApplication
-		// .get_instance().getSharedPreferences("Apex", 0);
-		// SharedPreferences.Editor editor = RunOnce.edit();
-		// editor.putString("user", user);
-		// editor.putString("password", user);
-		// }
-		// String vername;
-		// try
-		// {
-		// vername = ApexTrackingApplication.get_instance()
-		// .getPackageManager()
-		// .getPackageInfo("com.usai.apex", 0).versionName;
-		// boolean bFirstRun = RunOnce.getBoolean("FirstRun" + vername
-		// + "_result", true);
-		// if (bFirstRun)
-		// {
-		// SharedPreferences.Editor editor = RunOnce.edit();
-		// editor.putBoolean("FirstRun" + vername + "_result",
-		// false);
-		// // Don't forget to commit your edits!!!
-		// editor.commit();
-		// Intent intent = new Intent();
-		// intent.setClass(this, HelpActivity.class);
-		// intent.putExtra("caller", "result");
-		// startActivity(intent);
-		//
-		// }
-		// }
-		// catch (NameNotFoundException e)
-		// {
-		// // TODO Auto-generated catch block
-		// e.printStackTrace();
-		// }
-		//
-		// }
-		//
-		// });
-		// Set up the login form.
-		// mUser = getIntent().getStringExtra(EXTRA_EMAIL);
-		m_etName = (EditText) view.findViewById(R.id.user);
-		// mUserView.setText(mUser);
-
-		m_etPassword = (EditText) view.findViewById(R.id.password);
-
-		m_cbSave = (CheckBox) view.findViewById(R.id.cb_save);
-		SharedPreferences pref = ApexTrackingApplication.get_instance()
-				.getSharedPreferences("Apex", 0);
-		String u = pref.getString("user", null);
-		String p = pref.getString("password", null);
-		if (u != null && p != null) {
-			try {
-				m_etName.setText(AES.decrypt("apexu", u));
-				m_etPassword.setText(AES.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) getActivity()
-									.getApplicationContext().getSystemService(
-											Context.INPUT_METHOD_SERVICE);
-
-							// EditText editText =
-							// (EditText)findViewById(R.id.xxxx);
-							inputMethodManager.hideSoftInputFromWindow(
-									m_etPassword.getWindowToken(), 0); // ����
-							attemptLogin();
-							return true;
-						}
-						return false;
-					}
-				});
-
-		mLoginFormView = view.findViewById(R.id.login_form);
-		mLoginStatusView = view.findViewById(R.id.login_status);
-		mLoginStatusMessageView = (TextView) view
-				.findViewById(R.id.login_status_message);
-
-		view.findViewById(R.id.sign_in_button).setOnClickListener(
-				new View.OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
-								.getApplicationContext().getSystemService(
-										Context.INPUT_METHOD_SERVICE);
-
-						// EditText editText =
-						// (EditText)findViewById(R.id.xxxx);
-						inputMethodManager.hideSoftInputFromWindow(
-								m_etPassword.getWindowToken(), 0);
-						attemptLogin();
-						// showProgress(true);
-					}
-				});
-		
-		view.findViewById(R.id.tv_retrieve_pass).setOnClickListener(
-				new View.OnClickListener() {
-					@Override
-					public void onClick(View view) {
-						Intent intent = new Intent();
-						intent.setClass(getActivity(), RetrievePasswordActivity.class);
-						startActivity(intent);
-						// showProgress(true);
-					}
-				});
-		return view;
-		// return super.onCreateView(inflater, container, savedInstanceState);
-	}
-
-	// /**
-	// * 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(1==1)
-//		{
-//			if(mCallBack!=null)
-//				mCallBack.onLogin();
-//			return;
-//		}
-		if (mAuthTask != null) {
-			return;
-		}
-
-		// Reset errors.
-		m_etName.setError(null);
-		m_etPassword.setError(null);
-
-		// Store values at the time of the login attempt.
-		m_sUser = m_etName.getText().toString().toLowerCase();
-		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_sUser)) {
-			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.INVISIBLE);
-						}
-					});
-
-			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.INVISIBLE
-									: View.VISIBLE);
-						}
-					});
-		} else {
-			// The ViewPropertyAnimator APIs are not available, so simply show
-			// and hide the relevant UI components.
-			mLoginStatusView
-					.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-			mLoginFormView.setVisibility(show ? View.INVISIBLE : 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 errorcode;
-
-		@Override
-		protected Boolean doInBackground(Void... params) {
-			errorcode = Network.get_Auth(m_sUser, m_sPassword);
-			if (errorcode == Network.RESULT_TRUE)
-				return true;
-			else {
-				return false;
-			}
-
-		}
-
-		@Override
-		protected void onPostExecute(final Boolean success) {
-			Log.d("onPostExecute", "entry");
-			mAuthTask = null;
-			showProgress(false);
-			// if (netconnect == )
-			// {
-			//
-			// }
-
-			if (success) {
-
-				// SharedPreferences.Editor editor = RunOnce.edit();
-				// editor.putBoolean("FirstRun"+globalUtil.getVerName(this),
-				// false);
-				// // Don't forget to commit your edits!!!
-				// editor.commit();
-				SharedPreferences pref = ApexTrackingApplication.get_instance()
-						.getSharedPreferences("Apex", 0);
-				SharedPreferences.Editor editor = pref.edit();
-
-				try {
-					if (/*m_cbSave.isChecked()*/ true) {
-						editor.putString("user",
-								AES.encrypt("apexu", m_sUser.toLowerCase()));
-						editor.putString("password",
-								AES.encrypt("apexp", m_sPassword));
-						editor.putBoolean("autologin", true);
-					} else {
-						editor.putString("user", null);
-						editor.putString("password", null);
-						editor.putBoolean("autologin", false);
-					}
-
-
-				} catch (Exception e) {
-					editor.putString("user", null);
-					editor.putString("password", null);
-					editor.putBoolean("autologin", false);
-					e.printStackTrace();
-				}
-				editor.commit();
-
-				ApexTrackingApplication.getInstance().shouldCheckCache = true;
-
-				if(mCallBack!=null)
-					mCallBack.onLogin();
-
-
-				{
-
-					Intent intent = new Intent("Login");
-					intent.putExtra("state", true);
-					LocalBroadcastManager.getInstance(getActivity())
-							.sendBroadcast(intent);
-				}
-
-//				Intent intent = new Intent();
-//				intent.setClass(getActivity(), FunctionSelectActivity.class);
-////				intent.putExtra("user", m_sUser);
-////				intent.putExtra("password", m_sPassword);
-//				startActivity(intent);
-//				getActivity().setResult(Activity.RESULT_OK, null);
-//				getActivity().finish();
-			} else {
-				switch (errorcode) {
-				case Network.RESULT_NET_NOTAVAILABLE: {
-					Toast toast = Toast.makeText(getActivity()
-							.getApplicationContext(),
-							getText(R.string.msg_connection_none),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-				case Network.RESULT_NET_ERROR: {
-					Toast toast = Toast.makeText(getActivity()
-							.getApplicationContext(),
-							getText(R.string.msg_net_error), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-				case Network.RESULT_VER_LOW:
-				{
-					Toast toast = Toast.makeText(getActivity()
-							.getApplicationContext(),
-							getText(R.string.msg_ver_low), Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-				case Network.RESULT_ERROR:
-				// case Network.RESULT_RESPONSE_NULL:
-				{
-					Toast toast = Toast.makeText(getActivity()
-							.getApplicationContext(),
-							getText(R.string.msg_net_resulterror),
-							Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					return;
-				}
-
-				case Network.RESULT_FALSE: {
-					m_etPassword
-							.setError(getString(R.string.error_incorrect_password));
-					m_etPassword.requestFocus();
-					return;
-					
-				}
-				default: {
-					Toast toast = Toast.makeText(getActivity()
-							.getApplicationContext(),
-							getText(R.string.msg_net_resulterror) + ":"
-									+ errorcode, Toast.LENGTH_LONG);
-					toast.setGravity(Gravity.CENTER, 0, 0);
-					toast.show();
-					break;
-				}
-				}
-			}
-		}
-
-		@Override
-		protected void onCancelled() {
-			mAuthTask = null;
-			showProgress(false);
-		}
-	}
-}

+ 0 - 167
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/MyFragment.java

@@ -1,167 +0,0 @@
-package com.usai.apex.mainframe;
-
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.LocalBroadcastManager;
-import android.util.Log;
-import android.view.View;
-import android.widget.ListView;
-
-import com.usai.apex.ChangePasswordActivity;
-import com.usai.apex.R;
-import com.usai.apex.saved.CheckSavedActivity;
-
-import org.json.JSONObject;
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class MyFragment extends StaticModelistFragment {
-
-    static final int PASSWORD_CHANGED = 1;
-    private static final int	REQUEST_CHANGEPASSWORD_ACTIVITY	= 2;
-
-
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data)
-    {
-        switch (requestCode)
-        {
-
-//			case REQUEST_LOGINACTIVITY:
-//				if (resultCode == Activity.RESULT_CANCELED)
-//					getActivity().finish();
-//				break;
-            case REQUEST_CHANGEPASSWORD_ACTIVITY:
-                if (resultCode == Activity.RESULT_OK)
-                {
-//					String UNIQUE_STRING = "com.usai.apex.push.cancel";
-//					Intent intent = new Intent(UNIQUE_STRING);
-//					getActivity().sendBroadcast(intent);
-//					Intent i = new Intent();
-//					i.setClass(getActivity(), ApexActivity.class);
-//					startActivityForResult(i, REQUEST_LOGINACTIVITY);
-                    getActivity().setResult(PASSWORD_CHANGED, null);
-                    getActivity().finish();
-                }
-                break;
-            default:
-                break;
-        }
-        super.onActivityResult(requestCode, resultCode, data);
-    }
-
-
-    public interface LogoutCallBack{
-        //        public abstract void onLogin();
-        public abstract void onLogout();
-    }
-    private LogoutCallBack mCallBack;
-    public void setCallBack(LogoutCallBack callBack) {
-        this.mCallBack = callBack;
-    }
-
-    public MyFragment() {
-        // Required empty public constructor
-    }
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState)
-    {
-        super.onActivityCreated(savedInstanceState);
-
-        setupAdapter(R.raw.my);
-
-//        adapter.getView()
-
-        customize_style();
-//        JSONObject jsonobj=loadjson(R.raw.search);
-//        adapter        = new SimpleRoundCornerAdapter(this.getActivity(),
-//                getData(jsonobj), R.layout.static_modelist_cell, new String[] { "title",
-//                "img","detail" }, new int[] { R.id.tv_name, R.id.iv_icon,R.id.tv_detail });
-//        setListAdapter(adapter);
-////        this.getListView().setDivider(R.drawable.);
-//        this.getListView().setDividerHeight(18);
-//        this.getListView().setBackgroundColor(Color.WHITE);
-
-    }
-    @Override
-    public void onListItemClick(ListView l, View v, int position, long id)
-    {
-
-        JSONObject jsonobj=loadjson(R.raw.my);
-        Log.d("FragmentList", "Item clicked: " + id);
-
-        String 	title = (String) getData(jsonobj).get(position-1).get("title");
-
-//        Intent intent = new Intent();
-        if (title.equals("Saved Detail"))
-        {
-            Intent intent = new Intent();
-            intent.setClass(getActivity(), CheckSavedActivity.class);
-            // intent.putExtra("user", ApexTrackingApplication.get_user());
-            // intent.putExtra("password", password);
-            intent.putExtra("function_name", "Saved Detail");
-//            intent.putExtra("title", "Booking Search");
-            startActivity(intent);
-        }
-        else if (title.equals("Saved Search"))
-        {
-            Intent intent = new Intent();
-            intent.setClass(getActivity(), CheckSavedActivity.class);
-            // intent.putExtra("user", user);
-            // intent.putExtra("password", password);
-            intent.putExtra("function_name", "Saved Search");
-//            intent.putExtra("title", "B/L info. Search");
-            startActivity(intent);
-        }
-
-        else if(title.equals("Saved Documents"))
-        {
-//            Intent intent = new Intent();
-//            intent.setClass(getActivity(), LocalDocumentActivity.class);
-////			intent.putExtra("module_name", "Announcements");
-//            startActivity(intent);
-
-            Intent intent = new Intent();
-            intent.setClass(getActivity(), CheckSavedActivity.class);
-            intent.putExtra("function_name", "Saved Documents");
-
-            startActivity(intent);
-
-        }
-        else if (title.equals("Change Password"))
-        {
-            Intent intent = new Intent();
-			intent.setClass(getActivity(), ChangePasswordActivity.class);
-
-			startActivityForResult(intent, REQUEST_CHANGEPASSWORD_ACTIVITY);
-			return;
-        }
-        else if (title.equals("Logout"))
-        {
-
-            String UNIQUE_STRING = "com.usai.apex.push.cancel";
-            Intent intent = new Intent(UNIQUE_STRING);
-            // intent.putExtra("key1", "value1");
-            // intent.putExtra("key2", "value2");
-            getActivity().sendBroadcast(intent);
-            if(mCallBack!=null)
-                mCallBack.onLogout();
-
-            {
-
-                Intent bintent = new Intent("Login");
-                bintent.putExtra("state", false);
-                LocalBroadcastManager.getInstance(getActivity())
-                        .sendBroadcast(bintent);
-            }
-
-        }
-
-
-    }
-
-}

+ 0 - 934
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/NewDetailActivity.java

@@ -1,934 +0,0 @@
-package com.usai.apex.mainframe;
-
-//import android.app.Fragment;
-import android.app.AlertDialog;
-import android.content.BroadcastReceiver;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.design.widget.BottomNavigationView;
-import android.support.v4.app.Fragment;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.DetailFragment;
-import com.usai.apex.R;
-import com.usai.apex.Result.AMResultActivity;
-import com.usai.apex.ViewPagerAdapter;
-import com.usai.util.commonUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-
-public class NewDetailActivity extends AppCompatActivity {
-
-
-    HashMap<String,String> contentmap = new HashMap<String ,String>();
-    HashMap<Integer, Integer> menu_map		= new HashMap<Integer, Integer>();
-
-    String							function_name;
-    String							_id;
-    String							cargo_criterion;
-    int								criterion_type;
-
-    String email_to = null,email_subject = null,email_content = null;
-    TextView mtitleview;
-
-    private NoScrollViewPager viewPager;
-    private MenuItem menuItem;
-    private BottomNavigationView bottomNavigationView;
-    int selectedMenuItem;
-//    boolean login=false;
-    BroadcastReceiver br;
-
-//    Menu actionbutton;
-
-    public int getTabCount()
-    {
-        return bottomNavigationView.getMenu().size();
-    }
-    private void setCustomActionBar() {
-        ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
-        View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
-
-        mtitleview= mActionBarView.findViewById(R.id.title);
-
-
-        function_name = getIntent().getStringExtra("function_name");
-        String title = "";
-        if(function_name.equals("Ocean Booking"))
-            title="Booking Detail";
-        else if(function_name.equals("Ocean B/L info."))
-            title="B/L info. Detail";
-        else if(function_name.equals("Container detail"))
-            title="Container Detail";
-        else if(function_name.equals("Cargo Tracking"))
-            title="Cargo Detail";
-        mtitleview.setText(title);
-        setTitle(title);
-//
-//        mActionBarView.setBackgroundColor(Color.YELLOW);
-//        titleview.setBackgroundColor(Color.BLUE);
-        ActionBar actionBar = getSupportActionBar();
-        actionBar.setCustomView(mActionBarView, lp);
-//		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
-//		actionBar.setDisplayShowCustomEnabled(true);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-
-//        actionBar.setIcon(getNumberDrawable());
-//        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(true);
-    }
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu)
-    {
-        // Inflate the menu; this adds items to the action bar if it is present.
-
-        if (function_name.equals("Cargo Tracking")) {
-            getMenuInflater().inflate(R.menu.cargo_menu, menu);
-        } else {
-            getMenuInflater().inflate(R.menu.detail, menu);
-        }
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId())
-        {
-            case R.id.action_close:
-
-                finish();
-//				if (SearchResultActivity.instance != null) {
-//					SearchResultActivity.instance.finish();
-//				}
-//				if (SearchListActivity.instance != null) {
-//					SearchListActivity.instance.finish();
-//				}
-                Intent intent = new Intent(this, RootActivity.class);
-
-//                Intent intent = new Intent(context, LoginView.class);
-                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-
-
-                startActivity(intent);
-                break;
-            case android.R.id.home:
-                finish();
-                break;
-            case R.id.action_addto_favorite:
-//	            LayoutInflater factory = LayoutInflater.from(this);
-//	            final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
-                final View edit = new EditText(this);
-                new AlertDialog.Builder(this)
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
-                        .setTitle(R.string.str_createname)
-                        .setView(edit)
-                        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int whichButton) {
-                                String name = ((EditText)edit).getText().toString();
-                                if(TextUtils.isEmpty(name))
-                                {
-                                    new android.app.AlertDialog.Builder(NewDetailActivity.this)
-                                            .setTitle("Warning")
-                                            .setMessage("Name can not be empty.")
-
-                                            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-                                                @Override
-                                                public void onClick(DialogInterface dialog, int which) {
-
-                                                }
-                                            })
-                                            .show();
-                                    return;
-                                }
-
-                                String param = getIntent().toUri(0);
-
-                                SQLiteDatabase db = dbUtil.OpenDB(
-                                        ApexTrackingApplication.get_instance(), null, true);
-                                db.execSQL("insert into favorites(name,params,user,create_time,module_name) values('"
-                                        + name
-                                        + "','"
-                                        + param
-                                        + "','"
-                                        + ApexTrackingApplication.get_user()
-                                        + "',"
-                                        + System.currentTimeMillis()
-                                        + ",'"
-                                        +getIntent().getStringExtra("function_name")+ "')");
-                                dbUtil.CloseDB(db);
-
-                                /* User clicked OK so do some stuff */
-                            }
-                        })
-                        .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int whichButton) {
-
-                                /* User clicked cancel so do some stuff */
-                            }
-                        })
-                        .create().show();
-                return true;
-
-            case R.id.action_search_document: {
-                String cargo_str = contentmap.get("Tracking");
-                try {
-                    JSONObject cargo_json = new JSONObject(cargo_str);
-                    String hbol = cargo_json.optString("hbol");
-                    if (hbol != null && hbol.length() > 0) {
-
-                        Bundle parms = new Bundle();
-                        parms.putString("bol",hbol);
-                        parms.putString("module_name","Download Document");
-                        Intent resultIntent = new Intent(this, AMResultActivity.class);
-                        resultIntent.putExtra("query_params",parms);
-                        startActivity(resultIntent);
-
-                    } else {
-                        showAlter("There is no hbol to search");
-                    }
-
-                } catch (JSONException e) {
-                    e.printStackTrace();
-                    showAlter("There is no hbol to search");
-                }
-
-            }
-            break;
-
-            case R.id.action_share_detail: {
-
-                Intent share = new Intent();
-                share.setAction(Intent.ACTION_SEND);
-//				share.putExtra(Intent.EXTRA_STREAM, uri);
-                share.setType("text/plain");
-
-
-
-
-                if (email_content != null) {
-                    share.putExtra(Intent.EXTRA_TEXT, email_content);   //附带的说明信息
-                }
-                if (email_subject != null) {
-                    share.putExtra(Intent.EXTRA_SUBJECT, email_subject);
-                }
-                if (email_to != null) {
-                    share.putExtra(Intent.EXTRA_EMAIL, email_to.split(","));
-                }
-
-//        share.putExtra(Intent.EXTRA_CC, new String[]{"ray.zhang@united-cn.net"});
-//        startActivity(Intent.createChooser(share,getString(R.string.str_sendto)));
-                startActivity(Intent.createChooser(share, "Share"));
-            }
-            break;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    public void showAlter(String msg) {
-        new AlertDialog.Builder(this)
-                .setMessage(msg)
-                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialogInterface, int i) {
-
-                    }
-                })
-                .show();
-    }
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-        outState.putSerializable("menu_map", menu_map);
-        outState.putSerializable("contentmap", contentmap);
-//        outState.putBoolean("login",login);
-    }
-
-//    @Override
-//    protected void onDestroy() {
-//        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
-//                .getInstance(this);
-//        localBroadcastManager.unregisterReceiver(br);
-//        super.onDestroy();
-//    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-//        if (!isTaskRoot()) {
-//            finish();
-//            return;
-//        }
-//
-//        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
-//                .getInstance(this);
-//        IntentFilter intentFilter = new IntentFilter();
-//        intentFilter.addAction("Login");
-//        br = new BroadcastReceiver() {
-//
-//            @Override
-//            public void onReceive(Context context, Intent intent) {
-//                boolean blogin = intent.getBooleanExtra("state",true);
-//                login=blogin;
-//
-//                setupViewPager(viewPager);
-//            }
-//
-//        };
-//        localBroadcastManager.registerReceiver(br, intentFilter);
-//
-
-        setContentView(R.layout.activity_new_detail);
-
-        setCustomActionBar();
-
-
-        if (savedInstanceState != null)
-        {
-            menu_map = (HashMap<Integer, Integer>) savedInstanceState
-                    .getSerializable("menu_map");
-//            tabmap = (LinkedHashMap<String, Integer>) savedInstanceState
-//                    .getSerializable("tabmap");
-            contentmap = (HashMap<String, String>) savedInstanceState.getSerializable("contentmap");
-        }
-        else
-        {
-            int count = getIntent().getIntExtra("actions_count", 0);
-            for (int i = 0; i < count; i++)
-            {
-                int vid = commonUtil.generateViewId();
-//                tabmap.put(getIntent().getStringExtra("action" + i), vid);
-            }
-        }
-
-
-        function_name = getIntent().getStringExtra("function_name");
-
-//        if(function_name.equals("Ocean Booking"))
-//            setTitle("Booking Detail");
-//        else if(function_name.equals("Ocean B/L info."))
-//            setTitle("B/L info. Detail");
-//        else if(function_name.equals("Container detail"))
-//            setTitle("Container Detail");
-////		else if(function_name.equals("Cargo Tracking"))
-////			setTitle("Cargo Detail");
-////
-//
-        if (function_name.equals("Cargo Tracking"))
-        {
-            criterion_type = getIntent().getIntExtra("criterion_type", 0);
-            cargo_criterion = getIntent().getStringExtra("cargo_criterion");
-//            setTitle("Cargo Detail");
-        }
-        _id = getIntent().getStringExtra("_id");
-//
-//        if (savedInstanceState != null) {
-//            login = savedInstanceState.getBoolean("login");
-//        }
-
-
-
-
-
-//
-//        Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
-//        setSupportActionBar(toolbar);
-//
-//        getSupportActionBar().setDisplayShowTitleEnabled(false);
-        /*
-        ActionBar actionBar = getSupportActionBar();
-//        actionBar.setLogo(R.drawable.apexlogo);
-        actionBar.setIcon(R.drawable.apexlogo);
-//        actionBar.setIcon(R.drawable.ic_launcher);
-
-//        actionBar.setDisplayUseLogoEnabled(true);
-        actionBar.setDisplayShowHomeEnabled(true);
-        actionBar.setHomeButtonEnabled(true);
-//        actionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);
-//        actionBar.setDisplayHomeAsUpEnabled(true);
-        actionBar.setDisplayShowTitleEnabled(false);
-*/
-
-        viewPager = (NoScrollViewPager) findViewById(R.id.viewpager);
-        bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
-
-        bottomNavigationView.setItemIconTintList(null);
-//        bottomNavigationView.setItemTextColor();;
-//        bottomNavigationView.getItemTextColor();
-
-//        bottomNavigationView.setlistener
-
-        //默认 >3 的选中效果会影响ViewPager的滑动切换时的效果,故利用反射去掉
-        BottomNavigationViewHelper.disableShiftMode(bottomNavigationView, false);
-        bottomNavigationView.setOnNavigationItemSelectedListener(
-                new BottomNavigationView.OnNavigationItemSelectedListener() {
-                    @Override
-                    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
-//                        actionbutton.getItem(0).setVisible(false);
-//                        getSupportActionBar().setHomeAsUpIndicator(R.drawable.apexlogo);
-//                        getSupportActionBar().setDisplayShowTitleEnabled(false);
-
-//                        if(item.getItemId() == menu_map.get("Tracing").intValue())
-                        {
-
-                            viewPager.setCurrentItem(menu_map.get(item.getItemId()));
-                            return true;
-                        }
-//                        else if(item.getItemId() == menu_map.get("Detail").intValue())
-//                        {
-//
-//                            viewPager.setCurrentItem(1);
-//                            return true;
-//                        }
-//
-//
-//                        switch (item.getItemId()) {
-//                            case menu_map.get("Tracing"):
-//
-//                                viewPager.setCurrentItem(0);
-//                                return true;
-//
-//                            case R.id.item_tool:
-//                                viewPager.setCurrentItem(3);
-//                                return true;
-//
-//                            case R.id.item_otool:
-//                                viewPager.setCurrentItem(1);
-//                                return true;
-//
-//                            case R.id.item_home:
-//                                actionbutton.getItem(0).setVisible(true);
-//                                if (ApexTrackingApplication.get_instance().getPersonMode()) {
-//                                    getSupportActionBar().setHomeAsUpIndicator(R.drawable.apexlogo_p);
-//                                }
-//                                getSupportActionBar().setDisplayShowTitleEnabled(true);
-//                                viewPager.setCurrentItem(0);
-//                                return true;
-//
-//                            case R.id.item_history:
-//                                if (ApexTrackingApplication.get_instance().getPersonMode()) {
-//                                    getSupportActionBar().setHomeAsUpIndicator(R.drawable.apexlogo_p);
-//                                }
-//                                viewPager.setCurrentItem(1);
-//                                return true;
-//
-//                            case R.id.item_search:
-//                                viewPager.setCurrentItem(2);
-//                                return true;
-//
-//                            case R.id.item_my:
-//                                viewPager.setCurrentItem(4);
-//                                return true;
-
-//                        }
-//                        return false;
-                    }
-                });
-
-//
-//        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
-//            @Override
-//            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
-//
-//            }
-//
-//            @Override
-//            public void onPageSelected(int position) {
-//
-//                MenuItem item= bottomNavigationView.getMenu().getItem(position);
-//
-//                switch (item.getItemId())
-//                {
-//                    case R.id.item_login:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        break;
-//
-//                    case R.id.item_tool:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        break;
-//
-//                    case R.id.item_otool:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        break;
-//
-//                    case R.id.item_home:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = true;
-//
-//                        HomeFragment homef=(HomeFragment)((ViewPagerAdapter)viewPager.getAdapter()).getItem(position);
-//                        homef.checkDirty();
-//                        break;
-//
-//                    case R.id.item_history:
-//
-//                        ApexTrackingApplication.get_instance().historyactive = true;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        HistoryFragment historyf=(HistoryFragment)((ViewPagerAdapter)viewPager.getAdapter()).getItem(position);
-//                        historyf.checkDirty();
-//
-//                        break;
-//                    case R.id.item_search:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        break;
-//
-//                    case R.id.item_my:
-//                        ApexTrackingApplication.get_instance().historyactive = false;
-//                        ApexTrackingApplication.get_instance().homeactive = false;
-//                        break;
-//                }
-//
-//
-//
-////                if(viewPager.gets)
-////                if (menuItem != null) {
-////                    menuItem.setChecked(false);
-////                } else {
-////                    bottomNavigationView.getMenu().getItem(0).setChecked(false);
-////                }
-////                menuItem = bottomNavigationView.getMenu().getItem(position);
-////                menuItem.setChecked(true);
-//            }
-//
-//            @Override
-//            public void onPageScrollStateChanged(int state) {
-//            }
-//        });
-//
-
-
-//        viewPager.set
-////        禁止ViewPager滑动
-//        viewPager.setOnTouchListener(new View.OnTouchListener() {
-//            @Override
-//            public boolean onTouch(View v, MotionEvent event) {
-//                return true;
-//            }
-//        });
-
-        setupViewPager(viewPager);
-
-
-//        boolean pop = checkAllPermission();
-//        if(!pop)
-//        {
-//            if(TextUtils.isEmpty(ApexTrackingApplication.station_name))
-//            {
-//                Intent intent = new Intent();
-//                intent.setClass(RootActivity.this,ServerSettingActivity.class);
-////            startActivity(intent);
-//                startActivityForResult(intent, 0);
-//            }
-//        }
-    }
-//    public boolean checkAllPermission() {
-//
-//
-//        /*
-//        *
-//        *     -->
-//    <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.READ_CONTACTS" />
-//    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
-//    <!-- External storage for caching. -->
-//    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-//    <!-- My Location -->
-//    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-//    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-//    <!-- Maps API needs OpenGL ES 2.0. -->
-//    <uses-feature
-//        android:glEsVersion="0x00020000"
-//        android:required="true" />
-//    <!-- End of copy. -->
-//
-//
-//    <!-- Baidu Map API -->
-//
-//    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-//    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-//        * */
-//
-//
-//
-//        String[] permissions = {
-////                Manifest.permission.CAMERA,
-////                Manifest.permission.VIBRATE,
-//                Manifest.permission.READ_CONTACTS,
-//                Manifest.permission.READ_PHONE_STATE,
-//                Manifest.permission.WRITE_EXTERNAL_STORAGE,
-//                Manifest.permission.READ_EXTERNAL_STORAGE,
-////                Manifest.permission.RECEIVE_BOOT_COMPLETED,
-////                Manifest.permission.ACCESS_NETWORK_STATE,
-////                Manifest.permission.ACCESS_WIFI_STATE,
-////                Manifest.permission.INTERNET,
-////                Manifest.permission.ACCESS_FINE_LOCATION,
-////
-////                Manifest.permission.CHANGE_CONFIGURATION
-//
-//
-//
-//        };
-//
-//
-//
-////        RAUtil.checkPermissions1(this,permissions);
-//        boolean ret = true;
-////        for(String permission : permissions) {
-////            boolean granted = ;
-////            if (!granted) {
-////                ret= false;
-////            }
-////        }
-//
-//
-//        return commonUtil.checkPermissions(this,permissions);
-//
-////        return ret;
-//    }
-
-
-//    @Override
-//    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
-//    {
-//
-//        if (requestCode == commonUtil.MY_PERMISSIONS_REQUEST)
-//        {
-//            boolean missing=false;
-//            boolean request = false;
-//            for(int i=0;i<grantResults.length;i++)
-//            {
-//
-//                if(grantResults[i]!= PackageManager.PERMISSION_GRANTED)
-//                    missing=true;
-//                boolean bshow= ActivityCompat.shouldShowRequestPermissionRationale(this,permissions[i]);
-//                if(bshow)
-//                    request = true;
-//            }
-//
-//            String msg=null;
-//            if(request)
-//                msg="Apex Mobile needs some essential permissions.";
-//            else
-//                msg="Apex Mobile will quit because missing some essential permissions.\nPlease check your system setting.";
-//
-//            if(missing) {
-//                final boolean finalRequest = request;
-//                new AlertDialog.Builder(this)
-//                        .setTitle("Warning")
-//                        .setMessage(msg)
-//                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-//                            @Override
-//                            public void onClick(DialogInterface dialog, int which) {
-////                                checkAllPermission();
-//                                if (finalRequest)
-//                                    checkAllPermission();
-//                                else
-//                                    finish();
-//                            }
-//                        })
-////                    .setNegativeButton("No", new DialogInterface.OnClickListener() {
-////                        @Override
-////                        public void onClick(DialogInterface dialog, int which) {
-////                            finish();
-////                        }
-////                    })
-//                        .show();
-//            }
-//            else
-//            {
-////                if(TextUtils.isEmpty(ApexTrackingApplication.station_name))
-////                {
-////                    Intent intent = new Intent();
-////                    intent.setClass(FullScreenLoginActivity.this,ServerSettingActivity.class);
-//////            startActivity(intent);
-////                    startActivityForResult(intent, 0);
-////                }
-//            }
-////            if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
-////            {
-////               // callPhone();
-////            } else
-////            {
-////
-////
-////                            new AlertDialog.Builder(this)
-////                    .setTitle("Warning")
-////                    .setMessage("RA Image missing essential permission")
-////                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-////                        @Override
-////                        public void onClick(DialogInterface dialog, int which) {
-////                            checkAllPermission();
-////                        }
-////                    })
-//////                    .setNegativeButton("No", new DialogInterface.OnClickListener() {
-//////                        @Override
-//////                        public void onClick(DialogInterface dialog, int which) {
-//////                            finish();
-//////                        }
-//////                    })
-////                    .show();
-////
-////                // Permission Denied
-////               // Toast.makeText(MainActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show();
-////            }
-//            return;
-//        }
-//        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
-//    }
-
-    private void setupViewPager(final ViewPager viewPager) {
-//        TestFragment.LoginCallBack logincallback = new TestFragment.LoginCallBack() {
-//            @Override
-//            public void onLogin() {
-//                System.out.println("login ");
-//                login = true;
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-//                bottomNavigationView.getChildAt(0).setSelected(true);
-//                bottomNavigationView.getMenu().clear();
-////                bottomNavigationView.getMenu().
-//                bottomNavigationView.inflateMenu(R.menu.navi_login);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//
-//            }
-//
-//            @Override
-//            public void onLogout() {
-//                System.out.println("log out ");
-//                login=false;
-//
-////                BottomNavigationView v;
-//
-////                v.getse
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////                navigation.setSelectedItemId(navigation.getMenu().getItem(position).getItemId());
-//                bottomNavigationView.getMenu().clear();
-//                bottomNavigationView.inflateMenu(R.menu.navi_logout);
-//                BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//                setupViewPager(viewPager);
-//            }
-//        };
-
-
-        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
-
-
-//        adapter.clear();
-
-        if(true)
-        {
-//            if(actionbutton!=null)
-//                actionbutton.getItem(0).setVisible(true);
-
-            bottomNavigationView.getChildAt(0).setSelected(true);
-            bottomNavigationView.getMenu().clear();
-//                bottomNavigationView.getMenu().
-//            bottomNavigationView.inflateMenu();
-//            bottomNavigationView.inflateMenu(R.menu.navi_logout);
-
-//            PrepareMenu(bottomNavigationView.getMenu());
-
-            Menu menu = bottomNavigationView.getMenu();
-
-
-
-            int count = getIntent().getIntExtra("actions_count", 0);
-            for (int i = 0; i < count; i++)
-            {
-
-                int vid = commonUtil.generateViewId();
-                String title = getIntent().getStringExtra("action" + i);
-                menu.add(0, vid, 0, title);
-
-                menu_map.put(vid,i);
-
-
-                Bundle bundle = new Bundle();
-                if (function_name.equals("Cargo Tracking"))
-                {
-                    if (criterion_type == 0)
-                        bundle.putString("hbol", cargo_criterion);
-                    else
-                        bundle.putString("container_no", cargo_criterion);
-
-                }
-                bundle.putString("action_type", title);
-                bundle.putString("id", _id);
-                bundle.putString("module_name", function_name);
-
-
-                Fragment f;
-                f= new DetailFragment();
-                ((DetailFragment)f).set_content( contentmap.get(title));
-                f.setArguments(bundle);
-
-                adapter.addFragment(f);
-//
-//            tabmap.put(getIntent().getStringExtra("action" + i), vid);
-            }
-            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView, false);
-
-
-//		Log.e("findFragmentByTag", "tag=" + tag + ", isnull= "
-//				+ (getSupportFragmentManager().findFragmentByTag(tag) == null));
-
-//            f = getSupportFragmentManager().findFragmentById(tabmap.get(tag));
-//            if (f == null)
-//            {
-//                Log.d("createTabContent", "create fragment" + tag);
-//                f = new DetailFragment();
-//
-//
-//                f.setArguments(bundle);
-//            }
-
-//            HomeFragment homeFragment = new HomeFragment();
-//            HistoryFragment historyFragment = new HistoryFragment();
-//            SearchFragment searchFragment = new SearchFragment();
-//            ToolsFragment toolsFragment = new ToolsFragment();
-//            MyFragment myFragment = new MyFragment();
-//            myFragment.setCallBack(new MyFragment.LogoutCallBack() {
-//                @Override
-//                public void onLogout() {
-//
-//                                    System.out.println("log out ");
-//                login=false;
-//
-////                BottomNavigationView v;
-//
-////                v.getse
-////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////                navigation.setSelectedItemId(navigation.getMenu().getItem(position).getItemId());
-//
-//                setupViewPager(viewPager);
-//                }
-//            });
-
-
-//            adapter.addFragment(homeFragment);
-//            adapter.addFragment(historyFragment);
-//            adapter.addFragment(searchFragment);
-//            adapter.addFragment(toolsFragment);
-//
-//
-//            adapter.addFragment(myFragment);
-
-
-            ApexTrackingApplication.get_instance().homeactive = true;
-
-
-
-//            adapter.addFragment(BaseFragment.newInstance("home"));
-//            adapter.addFragment(BaseFragment.newInstance("history"));
-//            adapter.addFragment(BaseFragment.newInstance("search"));
-//            adapter.addFragment(BaseFragment.newInstance("tool"));
-//
-//            TestFragment logoutf = TestFragment.newInstance("logout");
-//            logoutf.setCallBack(logincallback);
-//            adapter.addFragment(logoutf);
-        }
-//        else
-//        {
-//            ApexTrackingApplication.get_instance().homeactive = false;
-//            ApexTrackingApplication.get_instance().historyactive = false;
-//            ApexTrackingApplication.get_instance().recentactive = false;
-//            if(actionbutton!=null)
-//                actionbutton.getItem(0).setVisible(false);
-//            bottomNavigationView.getChildAt(0).setSelected(true);
-//            bottomNavigationView.getMenu().clear();
-//            bottomNavigationView.inflateMenu(R.menu.navi_logout);
-//            BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
-//
-//
-//            LoginFragment loginFragment = new LoginFragment();
-////            loginFragment.setCallBack(new LoginFragment.LoginCallBack() {
-////                @Override
-////                public void onLogin() {
-////                System.out.println("login ");
-////                login = true;
-//////                bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu().getItem(0).getItemId());
-////
-////                setupViewPager(viewPager);
-////                }
-////            });
-////            TestFragment loginf = TestFragment.newInstance("login");
-////            loginf.setCallBack(logincallback);
-//
-//
-//            adapter.addFragment(loginFragment);
-//
-////            SearchFragment searchFragment = new SearchFragment();
-////            adapter.addFragment(searchFragment);
-//
-//            Fragment toolsFragment = new ToolsFragment();
-//            adapter.addFragment(toolsFragment);
-//        }
-
-
-
-
-
-
-
-//        viewPager.removeAllViews();
-
-
-        viewPager.setAdapter(adapter);
-    }
-    public void save_content(String which,String content)
-    {
-        contentmap.put(which, content);
-
-        try {
-
-            JSONObject jsonObject = new JSONObject(content);
-            email_to = jsonObject.optString("email",null);
-            email_subject = jsonObject.optString("email_subject",null);
-            email_content = jsonObject.optString("email_content",null);
-
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-    }
-//    boolean PrepareMenu(Menu menu)
-//    {
-//        int count = getIntent().getIntExtra("actions_count", 0);
-//        for (int i = 0; i < count; i++)
-//        {
-//
-//            int vid = commonUtil.generateViewId();
-//            String title = getIntent().getStringExtra("action" + i);
-//            menu.add(0, vid, 0, title);
-//
-//            menu_map.put(title,vid);
-////
-////            tabmap.put(getIntent().getStringExtra("action" + i), vid);
-//        }
-//        return true;
-//    }
-}

+ 0 - 30
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/NoScrollViewPager.java

@@ -1,30 +0,0 @@
-package com.usai.apex.mainframe;
-
-import android.content.Context;
-import android.support.v4.view.ViewPager;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-
-/**
- * Created by ray on 05/03/2018.
- */
-
-public class NoScrollViewPager extends ViewPager {
-    public NoScrollViewPager(Context context) {
-        super(context);
-    }
-
-    public NoScrollViewPager(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent arg0) {
-        return false;
-    }
-
-    @Override
-    public boolean onInterceptTouchEvent(MotionEvent arg0) {
-        return false;
-    }
-}

+ 0 - 428
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/RecentFragment.java

@@ -1,428 +0,0 @@
-package com.usai.apex.mainframe;
-
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ListView;
-
-import com.usai.apex.ApexTrackingApplication;
-import com.usai.apex.R;
-import com.usai.apex.ShipMap.ShipMap;
-import com.usai.util.Network;
-import com.usai.util.RAUtil;
-import com.usai.util.dbUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.Map;
-
-
-/**
- * A simple {@link Fragment} subclass.
- */
-public class RecentFragment extends TrackingListFragment {
-
-
-    /**
-     * Param 0 启动任务时输入的参数类型
-     * Param 1 后台任务执行中返回进度值的类型
-     * Param 2 后台任务执行完成后返回结果的类型
-     * */
-    private class RecentTask extends AsyncTask<Void, Void, JSONObject> {
-
-        @Override
-        protected void onPreExecute() {
-            super.onPreExecute();
-            isLoading = true;
-            showProgressDialog();
-        }
-
-        @Override
-        protected JSONObject doInBackground(Void... voids) {
-
-            final JSONObject jsobj = Network.request_home();
-            return jsobj;
-        }
-
-        @Override
-        protected void onPostExecute(JSONObject jsobj) {
-
-            showProgress(false);
-            if (mSwipeRefresh.isRefreshing()) {
-                mSwipeRefresh.setRefreshing(false);
-            }
-
-            if (jsobj != null) {
-                handleJson(jsobj);
-                bdirty = false;
-            } else {
-                showAlert("Sorry,there is some wrong");
-            }
-
-            isLoading = false;
-            dismissProgressDialog();
-            mTask = null;
-        }
-
-        @Override
-        protected void onCancelled() {
-            super.onCancelled();
-
-            isLoading = false;
-            dismissProgressDialog();
-            mTask = null;
-        }
-    }
-
-    private RecentTask mTask;
-
-    protected boolean isActive()
-    {
-        return ApexTrackingApplication.getInstance().homeactive&&ApexTrackingApplication.getInstance().recentactive;
-    }
-
-    public RecentFragment() {
-        // Required empty public constructor
-    }
-
-    private JSONObject mJson;
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState)
-    {
-        super.onActivityCreated(savedInstanceState);
-
-//        setupAdapter();
-//        customize_style();
-
-        // this.getListView().setBackgroundColor(Color.WHITE);
-//
-//        if (savedInstanceState != null) {
-//            String jsonString = savedInstanceState.getString("RecentJson");
-//            if (jsonString != null) {
-//                try {
-//                    JSONObject json = new JSONObject(jsonString);
-//                    handleJson(json);
-//                } catch (JSONException e) {
-//                    e.printStackTrace();
-//                }
-//            }
-//        }
-
-        if (savedInstanceState != null) {
-            mSelectedIndex = savedInstanceState.getInt("selectIndex");
-            setSelectedPosition(mSelectedIndex);
-        }
-
-        if (searchresult.get_count() == 0) {
-            requestData();
-        }
-
-    }
-
-//    @Override
-//    protected void requestData() {
-//
-//        requestdata();
-//    }
-//    @Override
-//<<<<<<< .mine
-//    protected void requestData()
-//=======
-//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-//        return super.onCreateView(inflater, container, savedInstanceState);
-//    }
-//
-//    @Override
-//    public void onSaveInstanceState(Bundle outState) {
-//        super.onSaveInstanceState(outState);
-//        if (mJson != null) {
-//            outState.putString("RecentJson",mJson.toString());
-//        }
-//    }
-//
-//    @Override
-//    protected void requestData() {
-//
-//        requestdata();
-//    }
-
-    private void checkDatabase() {
-        if (ApexTrackingApplication.getInstance().shouldCheckCache) {
-            ApexTrackingApplication.getInstance().shouldCheckCache = false;
-
-            if (dbUtil.isCachedDataForUser(mContext, ApexTrackingApplication.get_user())) {
-
-                new AlertDialog.Builder(mContext)
-                        .setTitle("Warning")
-                        .setMessage("there is some cached data need to upload to service, do you allow us to upload it? if you reject we would clean it")
-                        .setNegativeButton("Reject", new DialogInterface.OnClickListener() {
-                            @Override
-                            public void onClick(DialogInterface dialog, int which) {
-                                new Thread(new Runnable() {
-                                    @Override
-                                    public void run() {
-                                        dbUtil.cleanCachedDataForUser(mContext, ApexTrackingApplication.get_user());
-                                    }
-                                }).start();
-                            }
-                        })
-                        .setPositiveButton("Allow", new DialogInterface.OnClickListener() {
-                            @Override
-                            public void onClick(DialogInterface dialog, int which) {
-
-                                uploadCache();
-                            }
-                        })
-                        .show();
-
-            } // is cached data
-
-        }
-    }
-
-    private void uploadCache() {
-
-        isLoading = true;
-        showProgressDialog();
-
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-
-                String sql = dbUtil.prepareUploadSQLForUser(mContext, ApexTrackingApplication.get_user(), RAUtil.getDeviceID(mContext));
-                JSONObject json = Network.uploadUserSql(sql);
-                int result = Network.RESULT_FALSE;
-                if (json != null) {
-                    result = json.optInt("result", Network.RESULT_FALSE);
-                }
-                final int fr = result;
-
-                getActivity().runOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-
-                        isLoading = false;
-                        dismissProgressDialog();
-
-                        if (fr == Network.RESULT_TRUE) {
-
-                            showAlert("upload success");
-
-                        } else {
-
-                            new AlertDialog.Builder(mContext)
-                                    .setTitle("Warning")
-                                    .setMessage("upload local cached data failed,do you want to rery or cancel? if you choose cancel, then we will clean the cache")
-                                    .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
-                                        @Override
-                                        public void onClick(DialogInterface dialog, int which) {
-                                            dbUtil.cleanCachedDataForUser(mContext, ApexTrackingApplication.get_user());
-                                        }
-                                    })
-                                    .setPositiveButton("Retry", new DialogInterface.OnClickListener() {
-                                        @Override
-                                        public void onClick(DialogInterface dialog, int which) {
-                                            uploadCache();
-                                        }
-                                    })
-                                    .show();
-
-                        }
-
-                    }
-                });
-            }
-        }).start();
-
-    }
-
-    private void handleJson(JSONObject jsobj) {
-
-        mJson = jsobj;
-        if (mJson == null) {
-            return;
-        }
-        try {
-            int result = jsobj.getInt("result");
-            if (result == Network.RESULT_TRUE) {
-
-                searchresult.clear();
-                JSONArray datalist = jsobj.getJSONArray("container_list");
-                int count = datalist.length();
-                searchresult.add_records(datalist.toString(), count);
-
-                adapter.notifyDataSetChanged();
-
-                if(count==0)
-                    showRefreshButton(true);
-                else
-                    showRefreshButton(false);
-                setSelectedPosition(0);
-
-//                checkDatabase();
-
-            } else {
-                String msg = jsobj.getString("err_msg");
-                showAlert(msg);
-            }
-        } catch (JSONException e) {
-            e.printStackTrace();
-            showAlert("Sorry,there is some wrong");
-        }
-    }
-@Override
-    protected void requestData()
-
-    {
-        if (isLoading) {
-            if (mSwipeRefresh.isRefreshing()) {
-                mSwipeRefresh.setRefreshing(false);
-            }
-            return;
-        }
-
-        mTask = new RecentTask();
-        mTask.execute();
-
-        super.requestData();
-    }
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-
-        if (mTask != null) {
-            mTask.cancel(false);
-        }
-        dismissProgressDialog();
-    }
-
-    @Override
-    protected View initHeaderView()
-    {
-
-        View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.home_listheader, null);
-        return headerView;
-
-    }
-
-    @Override
-    public void onListItemClick(ListView l, View v, int position, long id) {
-
-        //!!!!! listview 有header, position 需要-1
-
-
-//        Log.d("FragmentList", "Item clicked: " + id);
-//
-//        String title = (String) getData(jsonobj).get(position - 1).get("title");
-
-        position = position - 1;
-        if (position < 0) {
-            return;
-        }
-
-        setSelectedPosition(position);
-
-        String cargo_criterion = (String) searchresult.getData().get(position).get("hbol");
-
-        String serial_no = (String) searchresult.getData().get(position).get("serial_no");
-if(TextUtils.isEmpty(serial_no))
-    serial_no = "dumb";
-        Intent intent = new Intent();
-        intent.setClass(getContext(), NewDetailActivity.class);
-
-        intent.putExtra("action0", "Tracking");
-        intent.putExtra("function_name", "Cargo Tracking");
-
-        intent.putExtra("cargo_criterion", cargo_criterion);
-        intent.putExtra("actions_count", 1);
-        intent.putExtra("_id", serial_no);
-
-
-        intent.putExtra("criterion_type", 0);
-        String h_field = "h_bol";
-
-        dbUtil.savehistory(h_field, cargo_criterion);
-
-        startActivity(intent);
-
-    }
-
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-
-        outState.putInt("selectIndex",mSelectedIndex);
-
-        Log.d("RecentFragment", "onSaveInstanceState: ");
-    }
-
-
-
-    @Override
-    public void onClick(View v) {
-        super.onClick(v);
-        int position = (Integer) v.getTag();
-        // 会重复调用两次
-        if (mSelectedIndex == position) {
-            return;
-        }
-        setSelectedPosition(position);
-    }
-
-
-    private void setSelectedPosition(int position) {
-
-        if (mSelectedIndex >= 0) {
-
-            View cell = getCellForPosition(mSelectedIndex);
-            if (cell != null) {
-
-                View contentView = cell.findViewById(R.id.cell_content_view);
-                if (contentView != null) {
-                    contentView.setBackground(getResources().getDrawable(R.drawable.list_corner_round_bg));
-                }
-
-                TrackingImageView iv_status = (TrackingImageView) cell.findViewById(R.id.iv_status);
-                iv_status.setSelected(false);
-            }
-
-        }
-
-        mSelectedIndex = position;
-        View cell = getCellForPosition(mSelectedIndex);
-        if (cell != null) {
-            View contentView = cell.findViewById(R.id.cell_content_view);
-            if (contentView != null) {
-                contentView.setBackground(getResources().getDrawable(R.drawable.list_corner_round_selected_bg));
-            }
-
-            TrackingImageView iv_status = (TrackingImageView) cell.findViewById(R.id.iv_status);
-            iv_status.setSelected(true);
-        }
-
-        if(searchresult.getData().size()==0)
-            return;
-        Map<String,Object> item = searchresult.getData().get(position);
-        if (item != null) {
-            JSONObject locations = (JSONObject) item.get("locations");
-            ShipMap shipMap = getShipMap();
-            if (shipMap != null) {
-                shipMap.showShipAnnotation(locations);
-            }
-        }
-    }
-
-}

Некоторые файлы не были показаны из-за большого количества измененных файлов