瀏覽代碼

Add Android TradeFiling

Ray Zhang 5 年之前
父節點
當前提交
76ced4320e
共有 100 個文件被更改,包括 19160 次插入0 次删除
  1. 43 0
      ApexDrivers/ratradefiling/build.gradle
  2. 21 0
      ApexDrivers/ratradefiling/proguard-rules.pro
  3. 420 0
      ApexDrivers/ratradefiling/src/debug/assets/home.json
  4. 267 0
      ApexDrivers/ratradefiling/src/debug/assets/login.json
  5. 106 0
      ApexDrivers/ratradefiling/src/debug/assets/searchresult_acem1.json
  6. 134 0
      ApexDrivers/ratradefiling/src/debug/assets/searchresult_aci.json
  7. 119 0
      ApexDrivers/ratradefiling/src/debug/assets/searchresult_customer.json
  8. 146 0
      ApexDrivers/ratradefiling/src/debug/assets/searchresult_emanifest.json
  9. 133 0
      ApexDrivers/ratradefiling/src/debug/assets/searchresult_isf.json
  10. 44 0
      ApexDrivers/ratradefiling/src/main/AndroidManifest.xml
  11. 12 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/Const.java
  12. 14 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/EmptyActivity.java
  13. 31 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/NoScrollViewPager.java
  14. 686 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/RootActivity.java
  15. 239 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/StaticModelistFragment.java
  16. 597 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/TradeFilingApplication.java
  17. 45 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/ViewPagerAdapter.java
  18. 79 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/about/AboutFragment.java
  19. 72 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicActivity.java
  20. 106 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicDialog.java
  21. 171 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicObject.java
  22. 4 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/NoProguard.java
  23. 118 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/ResultBaseModel.java
  24. 77 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/OfflineDataProvider.java
  25. 1704 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/OnlineDataProvider.java
  26. 237 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/RADataProvider.java
  27. 783 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailActivity.java
  28. 869 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailAdapter.java
  29. 155 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailSectionModel.java
  30. 107 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionModel.java
  31. 10 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionSelectionModel.java
  32. 50 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailBaseModel.java
  33. 12 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailMultipleLineModel.java
  34. 13 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSingleLineModel.java
  35. 81 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSubActionModel.java
  36. 438 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/CustomizeFieldsActivity.java
  37. 330 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/DragListView.java
  38. 85 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/FunctionPanelAdapter.java
  39. 165 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeCellLayout.java
  40. 485 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashAdapter.java
  41. 581 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashPresenter.java
  42. 1562 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeFragment.java
  43. 317 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeHeaderView.java
  44. 130 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeOrderModel.java
  45. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/HomeDashEmptyCell.java
  46. 182 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/HomeDashSectionCell.java
  47. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashACEM1CellE.java
  48. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashACICellE.java
  49. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashISFCellE.java
  50. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDasheManifestCellE.java
  51. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashACEM1CellP.java
  52. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashACICellP.java
  53. 183 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashISFCellP.java
  54. 190 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDasheManifestCellP.java
  55. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashACEM1ModelE.java
  56. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashACIModelE.java
  57. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashISFModelE.java
  58. 69 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDasheManifestModelE.java
  59. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashACEM1ModelP.java
  60. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashACIModelP.java
  61. 68 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashISFModelP.java
  62. 71 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDasheManifestModelP.java
  63. 512 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/login/LoginFragment.java
  64. 427 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/login/RetrievePasswordActivity.java
  65. 180 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/my/MyFragment.java
  66. 15 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/raconst.java
  67. 696 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultActivity.java
  68. 400 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAdapter.java
  69. 16 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAddition.java
  70. 13 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultMenuItem.java
  71. 572 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultPresenter.java
  72. 194 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultACEM1Cell.java
  73. 194 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultACICell.java
  74. 54 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultAdditionView.java
  75. 196 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultISFCell.java
  76. 205 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResulteManifestCell.java
  77. 70 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultACEM1Model.java
  78. 74 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultACIModel.java
  79. 70 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultISFModel.java
  80. 71 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResulteManifestModel.java
  81. 987 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/search/SearchListActivity.java
  82. 32 0
      ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/utils/AES.java
  83. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/flag_ca.png
  84. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/flag_us.png
  85. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_customer.png
  86. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_drag_new.png
  87. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_more_dot.png
  88. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/login_img.png
  89. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/navigate_logo.png
  90. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/flag_ca.png
  91. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/flag_us.png
  92. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_customer.png
  93. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_drag_new.png
  94. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_more_dot.png
  95. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/login_img.png
  96. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/navigate_logo.png
  97. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/flag_ca.png
  98. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/flag_us.png
  99. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/ic_customer.png
  100. 二進制
      ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/ic_drag_new.png

+ 43 - 0
ApexDrivers/ratradefiling/build.gradle

@@ -0,0 +1,43 @@
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 28
+
+    defaultConfig {
+        applicationId "com.usai.ratradefiling"
+        minSdkVersion 26
+        targetSdkVersion 28
+        versionCode 1
+        versionName "1.0"
+//        ndk.abiFilters 'armeabi-v7a',"arm64-v8a"
+
+//        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+//    implementation fileTree(dir: "libs", include: ["*.jar"])
+    api 'androidx.appcompat:appcompat:1.2.0'
+    api 'androidx.legacy:legacy-support-v4:1.0.0'
+    api 'androidx.constraintlayout:constraintlayout:2.0.4'
+    implementation 'com.google.android.material:material:1.3.0'
+
+
+//    implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.18'
+//    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
+
+//    api 'com.android.support:support-v4:27.1.0'
+//
+    implementation project(path: ':RAUtilsLibrary')
+//    testImplementation 'junit:junit:4.12'
+//    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+//    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+
+}

+ 21 - 0
ApexDrivers/ratradefiling/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 420 - 0
ApexDrivers/ratradefiling/src/debug/assets/home.json

@@ -0,0 +1,420 @@
+{
+  "result": 2,
+  "total": {
+    "acem1": 0,
+    "isf": 99999,
+    "aci": 99999,
+    "emanifest": 99999
+  },
+  "sections": [
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "acem1"
+      },
+      "type": 3,
+      "title": "Unsubmitted - ACE-M1",
+      "totalCount": "5",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "acem1",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACE M1 Log",
+        "ISF Log"
+      ],
+      "orders": [
+        {
+          "sn": "1",
+          "hbol": "HBOL: PDLA200127H",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "mbol": "MBOL: SMLMTAYH9L071600 "
+        },
+        {
+          "sn": "99",
+          "hbol": "HBOL: PDLA200127H",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "mbol": "MBOL: SMLMTAYH9L071600 "
+        },
+        {
+          "sn": "999",
+          "hbol": "HBOL: PDLA200127H",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "mbol": "MBOL: SMLMTAYH9L071600 "
+        }
+      ]
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "isf"
+      },
+      "title": "Unsubmitted - ISF",
+      "type": 4,
+      "totalCount": "5",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "isf",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACE M1 Log",
+        "ISF Log"
+      ],
+      "orders": [
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "isftype": "ISF TYPE: 10+2"
+        },
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "99",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "isftype": "ISF TYPE: 10+2"
+        },
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "999",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "isftype": "ISF TYPE: 10+2"
+        }
+      ]
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "aci"
+      },
+      "title": "Unsubmitted - ACI",
+      "totalCount": "1",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "aci",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACI Log"
+      ],
+      "orders": [
+        {
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        },
+        {
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "sn": "99",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        },
+        {
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "sn": "999",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        }
+      ],
+      "type": 1
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "emanifest"
+      },
+      "title": "Unsubmitted - eManifest",
+      "totalCount": "1",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "emanifest",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "eManifest Log",
+        "HBL Close Log"
+      ],
+      "orders": [
+        {
+          "sn": "1",
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "previous_ccn": "Previous CCN: 9558THD0608081",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        },
+        {
+          "sn": "99",
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "previous_ccn": "Previous CCN: 9558THD0608081",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        },
+        {
+          "sn": "999",
+          "primary_ccn": "Primary CCN: 9558THD0608081",
+          "ccn": "House CCN: 8FFLA2012311120",
+          "previous_ccn": "Previous CCN: 9558THD0608081",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ]
+        }
+      ],
+      "type": 2
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "acem1"
+      },
+      "title": "Error - ACE-M1",
+      "totalCount": "0",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "acem1",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACE M1 Log",
+        "ISF Log"
+      ],
+      "type": 7,
+      "orders": [
+        {
+          "hbol": "HBOL: CTLQD1912860",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CBP REJECT,ERROR,DEL"
+        },
+        {
+          "hbol": "HBOL: CTLQD1912860",
+          "sn": "99",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CBP REJECT,ERROR,DEL"
+        },
+        {
+          "hbol": "HBOL: CTLQD1912860",
+          "sn": "999",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CBP REJECT,ERROR,DEL"
+        }
+      ]
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "isf"
+      },
+      "title": "Error - ISF",
+      "totalCount": "0",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "isf",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACE M1 Log",
+        "ISF Log"
+      ],
+      "type": 8,
+      "orders": [
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CANNOT SEND TO CBP,CBP REPLY,SA7,SENT"
+        },
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "99",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CANNOT SEND TO CBP,CBP REPLY,SA7,SENT"
+        },
+        {
+          "bol": "BOL: TLKPTAOATL0D199X",
+          "sn": "999",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: CANNOT SEND TO CBP,CBP REPLY,SA7,SENT"
+        }
+      ]
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "aci"
+      },
+      "title": "Error - ACI",
+      "totalCount": "0",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "aci",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "ACI Log"
+      ],
+      "type": 5,
+      "orders": [
+        {
+          "ccn": "CCN: 8FFLA2102410143",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: ACCEPTED,06,SU,ACCEPTED,06"
+        },
+        {
+          "ccn": "CCN: 8FFLA2102410143",
+          "sn": "99",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: ACCEPTED,06,SU,ACCEPTED,06"
+        },
+        {
+          "ccn": "CCN: 8FFLA2102410143",
+          "sn": "999",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: ACCEPTED,06,SU,ACCEPTED,06"
+        }
+      ]
+    },
+    {
+      "more": {
+        "param": {
+          "keyword": ""
+        },
+        "sub_type": "emanifest"
+      },
+      "title": "Error - eManifest",
+      "totalCount": "0",
+      "row_actions": [
+        {
+          "title": "Detail",
+          "sub_type": "emanifest",
+          "params": {
+            "id": 0
+          }
+        }
+      ],
+      "actions": [
+        "Detail",
+        "eManifest/ACI Log",
+        "HBL Close Log"
+      ],
+      "type": 6,
+      "orders": [
+        {
+          "ccn": "CCN: 8112S2102180093",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: "
+        },
+        {
+          "ccn": "CCN: 8112A2101545403",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: ACCEPTED,06,0003,0002"
+        },
+        {
+          "ccn": "CCN: 8112A2101545399",
+          "sn": "1",
+          "rowActionParameters": [
+            "_49208a00d6908828437963179575e3aa"
+          ],
+          "log": "LOG: ACCEPTED 06 ACCEPTED 06 0003 0002 0001 0001 0001 0001"
+        }
+      ]
+    }
+  ]
+}

+ 267 - 0
ApexDrivers/ratradefiling/src/debug/assets/login.json

@@ -0,0 +1,267 @@
+{
+  "result": 2,
+  "nick_name": "Ray",
+  "company": [
+    {
+      "name": "CSLL - CSLL LOGISTICS INC.",
+      "id": "aaaa"
+    },
+    {
+      "name": "KLNL - Kerry",
+      "id": "bbbb"
+    }
+  ],
+  "function_panel": {
+    "ver": 4,
+    "active_functions": [
+      {
+        "name": "ACE-M1",
+        "icon": "flag_us",
+        "type": "result",
+        "sub_type": "acem1"
+      },
+      {
+        "name": "ISF",
+        "icon": "flag_us",
+        "type": "result",
+        "sub_type": "isf"
+      },
+      {
+        "name": "eManifest",
+        "icon": "flag_ca",
+        "type": "result",
+        "sub_type": "emanifest"
+      },
+      {
+        "name": "ACI",
+        "icon": "flag_ca",
+        "type": "result",
+        "sub_type": "aci"
+      }
+    ],
+    "deactive_functions": [
+      {
+        "name": "Customer",
+        "icon": "ic_customer",
+        "type": "result",
+        "sub_type": "customer"
+      }
+    ]
+  },
+  "fields": {
+    "search": {
+      "acem1": {
+        "ver": 10,
+        "show": [
+          {
+            "name": "booking_no",
+            "type": "string",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Active",
+            "name": "active",
+            "type": "boolean"
+          },
+          {
+            "aname": "ETA",
+            "name": "eta",
+            "type": "time"
+          },
+          {
+            "aname": "PO#",
+            "name": "po_no",
+            "type": "string"
+          }
+        ]
+      },
+      "aci": {
+        "ver": 2,
+        "show": [
+          {
+            "name": "booking_no",
+            "type": "string",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Active",
+            "name": "active",
+            "type": "boolean"
+          },
+          {
+            "aname": "ETA",
+            "name": "eta",
+            "type": "time"
+          },
+          {
+            "aname": "PO#",
+            "name": "po_no",
+            "type": "string"
+          }
+        ]
+      },
+      "emanifest": {
+        "ver": 2,
+        "show": [
+          {
+            "name": "booking_no",
+            "type": "string",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Active",
+            "name": "active",
+            "type": "boolean"
+          },
+          {
+            "aname": "ETA",
+            "name": "eta",
+            "type": "time"
+          },
+          {
+            "aname": "PO#",
+            "name": "po_no",
+            "type": "string"
+          }
+        ]
+      },
+      "isf": {
+        "ver": 2,
+        "show": [
+          {
+            "name": "booking_no",
+            "type": "string",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Active",
+            "name": "active",
+            "type": "boolean"
+          },
+          {
+            "aname": "ETA",
+            "name": "eta",
+            "type": "time"
+          },
+          {
+            "aname": "PO#",
+            "name": "po_no",
+            "type": "string"
+          }
+        ]
+      },
+      "customer": {
+        "ver": 2,
+        "show": [
+          {
+            "name": "booking_no",
+            "type": "string",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Active",
+            "name": "active",
+            "type": "boolean"
+          },
+          {
+            "aname": "ETA",
+            "name": "eta",
+            "type": "time"
+          },
+          {
+            "aname": "PO#",
+            "name": "po_no",
+            "type": "string"
+          }
+        ]
+      }
+    },
+    "result": {
+      "acem1": {
+        "ver": 3,
+        "hide": [
+          {
+            "name": "booking_no",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Shipper",
+            "name": "shipper"
+          },
+          {
+            "aname": "Consignee",
+            "name": "consignee"
+          }
+        ]
+      },
+      "aci": {
+        "ver": 2,
+        "hide": [
+          {
+            "name": "booking_no",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Shipper",
+            "name": "shipper"
+          },
+          {
+            "aname": "Consignee",
+            "name": "consignee"
+          }
+        ]
+      },
+      "emanifest": {
+        "ver": 1,
+        "hide": [
+          {
+            "name": "booking_no",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Shipper",
+            "name": "shipper"
+          },
+          {
+            "aname": "Consignee",
+            "name": "consignee"
+          }
+        ]
+      },
+      "isf": {
+        "ver": 1,
+        "hide": [
+          {
+            "name": "booking_no",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Shipper",
+            "name": "shipper"
+          },
+          {
+            "aname": "Consignee",
+            "name": "consignee"
+          }
+        ]
+      },
+      "customer": {
+        "ver": 1,
+        "hide": [
+          {
+            "name": "booking_no",
+            "aname": "Booking#"
+          },
+          {
+            "aname": "Shipper",
+            "name": "shipper"
+          },
+          {
+            "aname": "Consignee",
+            "name": "consignee"
+          }
+        ]
+      }
+    }
+  }
+}

+ 106 - 0
ApexDrivers/ratradefiling/src/debug/assets/searchresult_acem1.json

@@ -0,0 +1,106 @@
+{
+  "result": 2,
+  "row_actions": [
+    {
+      "title": "ACE M1 Detail",
+      "module": "detail",
+      "params": {
+        "id": 0
+      }
+    }
+  ],
+  "title": "ACE M1",
+  "items": [
+    {
+      "port": "TWTXG-USOAK",
+      "log": "1Y,3Z,S1,69,CBP ACCEPT,SENT",
+      "icon": "status_deleted",
+      "consignee": "BC COORDINATE INTERNATIONAL INC.",
+      "hbol": "PDLA200127H",
+      "date": "08/14/2108-02/11/2020",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 3,
+      "mbol": "MBOL: SMLMTAYH9L071600 "
+    },
+    {
+      "port": "TWTXG-USOAK",
+      "log": "1Y,3Z,S1,69,CBP ACCEPT,SENT,1Y,3Z,S1,69,CBP ACCEPT,SENT",
+      "icon": "status_pending",
+      "consignee": "BC COORDINATE INTERNATIONAL INC.",
+      "hbol": "PDLA200127H",
+      "date": "08/14/2108-02/11/2020",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 3,
+      "mbol": "MBOL: SMLMTAYH9L071600 "
+    },
+    {
+      "port": "TWTXG-USOAK",
+      "log": "1Y,3Z,S1,69,CBP ACCEPT,SENT,1Y,3Z,S1,69,CBP ACCEPT,SENT,1Y,3Z,S1,69,CBP ACCEPT,SENT,1Y,3Z,S1,69,CBP ACCEPT,SENT",
+      "icon": "status_matched",
+      "consignee": "BC COORDINATE INTERNATIONAL INC.",
+      "hbol": "PDLA200127H",
+      "date": "08/14/2108-02/11/2020",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 3,
+      "mbol": "MBOL: SMLMTAYH9L071600 "
+    },
+    {
+      "port": "TWTXG-USOAK",
+      "log": "1Y,3Z,S1,69,CBP ACCEPT,SENT",
+      "icon": "status_deleted",
+      "consignee": "BC COORDINATE INTERNATIONAL INC.",
+      "hbol": "PDLA200127H",
+      "date": "08/14/2108-02/11/2020",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 3,
+      "mbol": "MBOL: SMLMTAYH9L071600 "
+    },
+    {
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "NINGBO, PRC"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "NEW YORK, NY"
+        }
+      ],
+      "port": "TWTXG-USOAK",
+      "log": "1Y,3Z,S1,69,CBP ACCEPT,SENT",
+      "icon": "status_error",
+      "consignee": "BC COORDINATE INTERNATIONAL INC.",
+      "hbol": "PDLA200127H",
+      "date": "08/14/2108-02/11/2020",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 3,
+      "mbol": "MBOL: SMLMTAYH9L071600 "
+    }
+  ],
+  "actions": [
+      "Detail",
+    
+    "ACE M1 Log",
+    "ISF Log"
+  ],
+  "menu": [
+    {
+      "title": "Fields Setting",
+      "action": "field_setting"
+    },
+    {
+      "title": "Save",
+      "action": "save"
+    }
+  ]
+}

+ 134 - 0
ApexDrivers/ratradefiling/src/debug/assets/searchresult_aci.json

@@ -0,0 +1,134 @@
+{
+  "result": 2,
+  "row_actions": [
+    {
+      "title": "ACI Detail",
+      "module": "detail",
+      "params": {
+        "id": 0
+      }
+    }
+  ],
+  "title": "ACI",
+  "items": [
+    {
+        "icon":"status_pending",
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "primary_ccn": "Primary CCN: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 1,
+      "desc": "PO#: "
+    },
+    {
+        "icon":"status_error",
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ],
+      "primary_ccn": "Primary CCN: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 1,
+      "desc": "PO#: "
+    },
+    {
+        "icon":"status_matched",
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ],
+      "primary_ccn": "Primary CCN: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 1,
+      "desc": "PO#: "
+    },
+    {
+        "icon":"status_deleted",
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ],
+      "primary_ccn": "Primary CCN: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 1,
+      "desc": "PO#: "
+    },
+    {
+        "icon":"status_matched",
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ],
+      "primary_ccn": "Primary CCN: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 1,
+      "desc": "PO#: "
+    }
+  ],
+  "actions": [
+      "Detail",
+    "ACI Log"
+  ],
+  "menu": [
+    {
+      "title": "Fields Setting",
+      "action": "field_setting"
+    },
+    {
+      "title": "Save",
+      "action": "save"
+    }
+  ]
+}

+ 119 - 0
ApexDrivers/ratradefiling/src/debug/assets/searchresult_customer.json

@@ -0,0 +1,119 @@
+{
+  "result": 2,
+  "row_actions": [
+    {
+      "title": "Customer Detail",
+      "module": "detail",
+      "params": {
+        "id": 0
+      }
+    }
+  ],
+  "title": "Customer",
+  "items": [
+    {
+      "contactid": "ACI01304",
+      "company": "OTR WHEEL ENGINEERING-CANADA",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "ic_customer",
+      "address": "1667 TRUNK ROAD \nSAULT STE.MARIE, ON P6A 6X9 CDN\nSTE MARIE, CA",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 5
+    },
+    {
+      "contactid": "ACI01304",
+      "company": "OTR WHEEL ENGINEERING-CANADA",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "ic_customer",
+      "address": "1667 TRUNK ROAD \nSAULT STE.MARIE, ON P6A 6X9 CDN\nSTE MARIE, CA",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 5
+    },
+    {
+      "contactid": "ACI01304",
+      "company": "OTR WHEEL ENGINEERING-CANADA",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "ic_customer",
+      "address": "1667 TRUNK ROAD \nSAULT STE.MARIE, ON P6A 6X9 CDN\nSTE MARIE, CA",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 5
+    },
+    {
+      "contactid": "ACI01304",
+      "company": "OTR WHEEL ENGINEERING-CANADA",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "ic_customer",
+      "address": "1667 TRUNK ROAD \nSAULT STE.MARIE, ON P6A 6X9 CDN\nSTE MARIE, CA",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 5
+    },
+    {
+      "contactid": "ACI01304",
+      "company": "OTR WHEEL ENGINEERING-CANADA",
+
+      "icon": "ic_customer",
+      "address": "1667 TRUNK ROAD \nSAULT STE.MARIE, ON P6A 6X9 CDN\nSTE MARIE, CA",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 5
+    }
+  ],
+  "actions": [
+    "Customer Detail"
+  ],
+  "menu": [
+    {
+      "title": "Fields Setting",
+      "action": "field_setting"
+    },
+    {
+      "title": "Save",
+      "action": "save"
+    }
+  ]
+}

+ 146 - 0
ApexDrivers/ratradefiling/src/debug/assets/searchresult_emanifest.json

@@ -0,0 +1,146 @@
+{
+  "result": 2,
+  "row_actions": [
+    {
+      "title": "eManifest Detail",
+      "module": "detail",
+      "params": {
+        "id": 0
+      }
+    }
+  ],
+  "title": "eManifest",
+  "items": [
+    {
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      
+      "icon": "status_matched",
+      "previous_ccn": "C9558THD0608081",
+      "inclose": true,
+      "primary_ccn": "MBOL: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 2,
+      "desc": "PO#: "
+    },
+    {
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "icon": "status_pending",
+      "previous_ccn": "C9558THD0608081",
+      "inclose": true,
+      "primary_ccn": "MBOL: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 2,
+      "desc": "PO#: ",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ]
+    },
+    {
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "icon": "status_pending",
+      "previous_ccn": "C9558THD0608081",
+      "inclose": false,
+      "primary_ccn": "MBOL: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 2,
+      "desc": "PO#: ",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ]
+    },
+    {
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "icon": "status_deleted",
+      "previous_ccn": "C9558THD0608081",
+      "inclose": true,
+      "primary_ccn": "MBOL: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 2,
+      "desc": "PO#: ",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ]
+    },
+    {
+      "lastaction": "Original",
+      "log": "ACCEPTED,06",
+      "icon": "status_error",
+      "previous_ccn": "C9558THD0608081",
+      "inclose": false,
+      "primary_ccn": "MBOL: 9558THD0608081",
+      "hbccn": "8FFLA2012311120",
+      "date": "12/16/2020-01/04/2021",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 2,
+      "desc": "PO#: ",
+      "addition": [
+        {
+          "name": "Vessel Name",
+          "value": "CMA CGM BRAZIL"
+        },
+        {
+          "name": "ACI NO",
+          "value": "ACI282012119682"
+        }
+      ]
+    }
+  ],
+  "actions": [
+      "Detail",
+    "eManifest Log",
+    "HBL Close Log"
+  ],
+  "menu": [
+    {
+      "title": "Fields Setting",
+      "action": "field_setting"
+    },
+    {
+      "title": "Save",
+      "action": "save"
+    }
+  ]
+}

+ 133 - 0
ApexDrivers/ratradefiling/src/debug/assets/searchresult_isf.json

@@ -0,0 +1,133 @@
+{
+  "result": 2,
+  "row_actions": [
+    {
+      "title": "ISF Detail",
+      "module": "detail",
+      "params": {
+        "id": 0
+      }
+    }
+  ],
+  "title": "ISF",
+  "items": [
+    {
+      "bol": "TLKPTAOATL0D199X",
+      "log": "S1,CBP REPLY,SENT",
+
+      "icon": "status_matched",
+      "consignee": "SUNRISE IMPORT&EXPORT LTD",
+      "transactionno": "CLLB98451749890",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 4,
+      "isftype": "10+2"
+    },
+    {
+      "bol": "TLKPTAOATL0D199X",
+      "log": "S1,CBP REPLY,SENT",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "status_error",
+      "consignee": "SUNRISE IMPORT&EXPORT LTD",
+      "transactionno": "CLLB98451749890",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 4,
+      "isftype": "10+2"
+    },
+    {
+      "bol": "TLKPTAOATL0D199X",
+      "log": "S1,CBP REPLY,SENT",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "status_error",
+      "consignee": "SUNRISE IMPORT&EXPORT LTD",
+      "transactionno": "CLLB98451749890",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 4,
+      "isftype": "10+2"
+    },
+    {
+      "bol": "TLKPTAOATL0D199X",
+      "log": "S1,CBP REPLY,SENT",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "status_pending",
+      "consignee": "SUNRISE IMPORT&EXPORT LTD",
+      "transactionno": "CLLB98451749890",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 4,
+      "isftype": "10+2"
+    },
+    {
+      "bol": "TLKPTAOATL0D199X",
+      "log": "S1,CBP REPLY,SENT",
+      "addition": [
+        {
+          "name": "Place Of Receipt",
+          "value": "TAICHUNG,TAIWAN"
+        },
+        {
+          "name": "Place Of Delivery",
+          "value": "OAKLAND, CA"
+        }
+      ],
+      "icon": "status_deleted",
+      "consignee": "SUNRISE IMPORT&EXPORT LTD",
+      "transactionno": "CLLB98451749890",
+      "rowActionParameters": [
+        "_49208a00d6908828437963179575e3aa"
+      ],
+      "type": 4,
+      "isftype": "10+2"
+    }
+  ],
+  "actions": [
+      "Detail",
+    
+    "ACE M1 Log",
+    "ISF Log"
+    
+  ],
+  "menu": [
+    {
+      "title": "Fields Setting",
+      "action": "field_setting"
+    },
+    {
+      "title": "Save",
+      "action": "save"
+    }
+  ]
+}

+ 44 - 0
ApexDrivers/ratradefiling/src/main/AndroidManifest.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.usai.ratradefiling">
+
+    <application
+        android:name=".TradeFilingApplication"
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/TradeFilingTheme">
+        <activity android:name=".EmptyActivity">
+
+        </activity>
+
+        <activity
+            android:name=".RootActivity"
+            android:configChanges="fontScale"
+            android:launchMode="singleTop"
+            android:screenOrientation="portrait"
+
+            >
+            <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=".result.ResultActivity">
+
+        </activity>
+        <activity android:name=".search.SearchListActivity">
+
+        </activity>
+
+        <activity android:name=".fields.CustomizeFieldsActivity">
+
+        </activity>
+
+    </application>
+
+
+</manifest>

+ 12 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/Const.java

@@ -0,0 +1,12 @@
+package com.usai.ratradefiling;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class Const {
+
+    public static final boolean FAKE_DATA = true;
+
+    public static final int MY_PERMISSIONS_REQUEST = 1;
+    private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
+
+}

+ 14 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/EmptyActivity.java

@@ -0,0 +1,14 @@
+package com.usai.ratradefiling;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+
+public class EmptyActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_empty);
+    }
+}

+ 31 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/NoScrollViewPager.java

@@ -0,0 +1,31 @@
+package com.usai.ratradefiling;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import androidx.viewpager.widget.ViewPager;
+
+/**
+ * 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;
+    }
+}

+ 686 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/RootActivity.java

@@ -0,0 +1,686 @@
+package com.usai.ratradefiling;
+
+import android.Manifest;
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.app.ActivityCompat;
+import androidx.fragment.app.Fragment;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.viewpager.widget.ViewPager;
+
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+//import com.usai.apex.TradeFilingApplication;
+//import com.usai.apex.ContainerSearchActivity;
+//import com.usai.apex.ViewPagerAdapter;
+import com.usai.ratradefiling.about.AboutFragment;
+import com.usai.ratradefiling.base.BasicActivity;
+import com.usai.ratradefiling.home.HomeFragment;
+import com.usai.ratradefiling.login.LoginFragment;
+import com.usai.ratradefiling.my.MyFragment;
+import com.usai.redant.rautils.utils.RAUtil;
+
+import static android.view.View.GONE;
+
+//import static androidx.constraintlayout.widget.ConstraintSet.GONE;
+//import com.usai.util.commonUtil;
+
+/**
+ * Created by bruce on 2016/11/1.
+ * HomeActivity 主界面
+ */
+
+public class RootActivity extends BasicActivity {
+
+    private NoScrollViewPager viewPager;
+    private MenuItem menuItem;
+    private BottomNavigationView bottomNavigationView;
+    int selectedMenuItem;
+    boolean login=false;
+
+//    Toolbar toolbar=null;
+    Menu actionbutton;
+
+
+//    @Override
+//    public boolean onCreateOptionsMenu(Menu menu) {
+//        actionbutton = menu;
+//        getMenuInflater().inflate(R.menu.quick_search,menu);
+//        return  true;
+//    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case android.R.id.home:
+//                Toast.makeText(this, "switch mode", Toast.LENGTH_SHORT).show();
+
+                if (login && (viewPager.getCurrentItem() == 0 || viewPager.getCurrentItem() == 1)) {
+                    boolean personMode = TradeFilingApplication.get_instance().getPersonMode();
+                    personMode = !personMode;
+                    TradeFilingApplication.get_instance().setPersonMode(personMode);
+
+                    if (personMode) {
+                        getSupportActionBar().setHomeAsUpIndicator(R.drawable.navigate_logo);
+                    } else {
+                        getSupportActionBar().setHomeAsUpIndicator(R.drawable.navigate_logo);
+                    }
+
+                    Intent intent = new Intent("com.apex.broadcast.person_mode");
+                    LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
+                }
+
+                break;
+//            case R.id.quick_search:
+//
+//                Intent intent = new Intent();
+//                intent.setClass(RootActivity.this,ContainerSearchActivity.class);
+//            startActivity(intent);
+//
+////                Toast.makeText(this,"跳转至container search activity",Toast.LENGTH_LONG).show();
+//                break;
+
+        }
+
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+
+        outState.putBoolean("login",login);
+    }
+    BroadcastReceiver br;
+    @Override
+    protected void onDestroy() {
+        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
+                .getInstance(this);
+        localBroadcastManager.unregisterReceiver(br);
+        super.onDestroy();
+    }
+
+    @Override
+    public void changeStatusBarNormal() {
+        initStatusBar(R.color.white);
+
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+//            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+//        }
+    }
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        autoSetupStatusBar=false;
+        super.onCreate(savedInstanceState);
+
+        if (!isTaskRoot()) {
+            finish();
+            return;
+        }
+
+        LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
+                .getInstance(this);
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction("Login");
+//        intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
+
+        br = new BroadcastReceiver() {
+
+            @Override
+            public void onReceive(Context context, Intent intent) {
+
+                if(intent.getAction().equals("Login"))
+                {
+                    boolean blogin = intent.getBooleanExtra("state",true);
+                    login=blogin;
+
+                    setupViewPager(viewPager);
+                }
+
+
+            }
+
+        };
+        localBroadcastManager.registerReceiver(br, intentFilter);
+//        registerReceiver(br, intentFilter);
+
+        setContentView(R.layout.activity_root);
+
+        if (savedInstanceState != null) {
+            login = savedInstanceState.getBoolean("login");
+        }
+
+
+
+
+
+
+//        toolbar = (Toolbar) findViewById(R.id.tool_bar);
+//        setSupportActionBar(toolbar);
+//        toolbar.setVisibility(GONE);
+        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
+
+
+
+        bottomNavigationView.setOnNavigationItemSelectedListener(
+                new BottomNavigationView.OnNavigationItemSelectedListener() {
+                    @Override
+                    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+                        actionbutton.getItem(0).setVisible(false);
+                        getSupportActionBar().setHomeAsUpIndicator(R.drawable.navigate_logo);
+                        getSupportActionBar().setDisplayShowTitleEnabled(false);
+                        switch (item.getItemId()) {
+                            case R.id.item_login:
+
+                                viewPager.setCurrentItem(0);
+                                return true;
+
+
+                            case R.id.item_about:
+
+                                viewPager.setCurrentItem(1);
+                                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 (TradeFilingApplication.get_instance().getPersonMode()) {
+                                    getSupportActionBar().setHomeAsUpIndicator(R.drawable.navigate_logo);
+                                }
+                                getSupportActionBar().setDisplayShowTitleEnabled(true);
+                                viewPager.setCurrentItem(0);
+                                return true;
+
+//                            case R.id.item_history:
+//                                if (TradeFilingApplication.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:
+                        TradeFilingApplication.get_instance().historyactive = false;
+                        TradeFilingApplication.get_instance().homeactive = false;
+                        break;
+
+//                    case R.id.item_tool:
+//                        TradeFilingApplication.get_instance().historyactive = false;
+//                        TradeFilingApplication.get_instance().homeactive = false;
+//                        break;
+//
+//                    case R.id.item_otool:
+//                        TradeFilingApplication.get_instance().historyactive = false;
+//                        TradeFilingApplication.get_instance().homeactive = false;
+//                        break;
+
+                    case R.id.item_home:
+                        TradeFilingApplication.get_instance().historyactive = false;
+                        TradeFilingApplication.get_instance().homeactive = true;
+
+                        HomeFragment homef=(HomeFragment)((ViewPagerAdapter)viewPager.getAdapter()).getItem(position);
+//                        homef.checkDirty();
+                        break;
+
+//                    case R.id.item_history:
+//
+//                        TradeFilingApplication.get_instance().historyactive = true;
+//                        TradeFilingApplication.get_instance().homeactive = false;
+//                        HistoryFragment historyf=(HistoryFragment)((ViewPagerAdapter)viewPager.getAdapter()).getItem(position);
+//                        historyf.checkDirty();
+//
+//                        break;
+//                    case R.id.item_search:
+//                        TradeFilingApplication.get_instance().historyactive = false;
+//                        TradeFilingApplication.get_instance().homeactive = false;
+//                        break;
+
+                    case R.id.item_my:
+                        TradeFilingApplication.get_instance().historyactive = false;
+                        TradeFilingApplication.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);
+//            }
+//        }
+
+        if (savedInstanceState == null) {
+            TradeFilingApplication.get_instance().checkUpdate(true,null);
+        }
+
+    }
+    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 RAUtil.checkPermissions(this,permissions);
+
+//        return ret;
+    }
+
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
+    {
+
+        if (requestCode == Const.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) {
+
+
+
+
+        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
+
+
+//        adapter.clear();
+
+        if(login)
+        {
+            if(actionbutton!=null)
+                actionbutton.getItem(0).setVisible(true);
+
+            bottomNavigationView.getChildAt(0).setSelected(true);
+            bottomNavigationView.getMenu().clear();
+//                bottomNavigationView.getMenu().
+            bottomNavigationView.inflateMenu(R.menu.navi_login);
+
+
+
+            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);
+
+
+            TradeFilingApplication.get_instance().homeactive = true;
+            setupLoginAppearance();
+
+
+//            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);
+//            toolbar.setVisibility(View.VISIBLE);
+        }
+        else
+        {
+            TradeFilingApplication.get_instance().homeactive = false;
+            TradeFilingApplication.get_instance().historyactive = false;
+            TradeFilingApplication.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);
+
+
+
+            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);
+
+            AboutFragment aboutFragment = new AboutFragment();
+            adapter.addFragment(aboutFragment);
+
+            setupLogoutAppearance();
+//            toolbar.setVisibility(GONE);
+        }
+
+
+
+
+
+
+
+//        viewPager.removeAllViews();
+
+
+        viewPager.setAdapter(adapter);
+    }
+
+
+
+    private void setupLoginAppearance() {
+
+//        changeStatusBarGradient();
+
+        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+        actionBar.show();
+        if(actionBar != null){
+            actionBar.setElevation(0); // 5.0以上隐藏分割线
+
+            // 将图像渲染成白色
+            Drawable drawable = getResources().getDrawable(R.drawable.navigate_logo);
+//            ImageUtil.renderingDrawable(drawable,getResources(),R.color.ApexDriverWhite);
+
+            actionBar.setHomeAsUpIndicator(drawable);
+            actionBar.setDisplayHomeAsUpEnabled(true);
+
+        }
+
+//        setTitle(null);
+
+        invalidateOptionsMenu();
+
+//        setTitle(ApexDriverApplication.sharedApplication().user + " " + ApexDriverApplication.sharedApplication().getFirstName());
+    }
+
+    private void setupLogoutAppearance() {
+
+//        changeStatusBarNormal();
+
+        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+        actionBar.hide();
+        if(actionBar != null){
+            actionBar.setElevation(1); // 5.0以上隐藏分割线
+
+//            actionBar.back
+            Drawable drawable = getResources().getDrawable(R.drawable.navigate_logo);
+//            ImageUtil.clearDrawableRendering(drawable);
+
+            actionBar.setHomeAsUpIndicator(null);
+            actionBar.setDisplayHomeAsUpEnabled(true);
+
+        }
+
+        invalidateOptionsMenu();
+
+//        setTitle(getString(R.string.login_title));
+    }
+}

+ 239 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/StaticModelistFragment.java

@@ -0,0 +1,239 @@
+package com.usai.ratradefiling;
+
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.SimpleAdapter;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.ListFragment;
+
+import com.usai.redant.rautils.utils.RAUtil;
+//import com.usai.util.commonUtil;
+
+//import org.apache.http.util.EncodingUtils;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class StaticModelistFragment extends ListFragment {
+
+    String ModeName=null;
+    String ModeIcon= null;
+
+
+//    public class SimpleRoundCornerAdapter extends  SimpleAdapter{
+//        public SimpleRoundCornerAdapter(Context context, List<? extends Map<String, ?>> data,
+//                                        @LayoutRes int resource, String[] from, @IdRes int[] to) {
+//            super(context, data, resource, from, to);
+//
+//        }
+//        @Override
+//        public View getView(int position, View convertView, ViewGroup parent) {
+//            View v = super.getView(position,convertView,parent);
+////            v.setBackground(getResources().getDrawable(R.drawable.list_corner_round_bg));
+////            v.setBackgroundColor(Color.BLUE);
+//            return v;
+//        }
+//    }
+
+    SimpleAdapter adapter;
+
+
+
+
+    public StaticModelistFragment() {
+        // Required empty public constructor
+    }
+
+//
+//    @Override
+//    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+//                             Bundle savedInstanceState) {
+//
+//
+//
+//        // Inflate the layout for this fragment
+//        return inflater.inflate(R.layout.fragment_static_modelist, container, false);
+//
+//
+////        super.onActivityCreated(savedInstanceState);
+//
+//
+//    }
+
+    protected  void setupAdapter(int rawid)
+    {
+        JSONObject jsonobj=loadjson(rawid);
+        adapter        = new SimpleAdapter(this.getActivity(),
+                getData(jsonobj), R.layout.static_modelist_cell, new String[] { "title",
+                "img","detail" }, new int[] { R.id.tv_title, R.id.iv_thumb,R.id.tv_detail });
+
+        View headerView = initHeaderView();
+        if(headerView!=null) {
+//            headerView.setOnClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//
+//                }
+//            });
+            getListView().addHeaderView(headerView);
+        }
+        setListAdapter(adapter);
+    }
+
+    protected void customize_style()
+    {
+
+
+
+//        this.getListView().setDivider(new ColorDrawable(Color.RED));
+        this.getListView().setDivider(getResources().getDrawable(R.drawable.list_div));
+        int px=RAUtil.dp2px(getActivity(), 8.75f);
+        this.getListView().setDividerHeight(px);
+
+
+//        this.getListView().setBackground(getResources().getDrawable(R.drawable.list_corner_round_bg));
+        this.getListView().setBackgroundColor(getResources().getColor(R.color.table_bg)  );
+//        this.getListView().setSelector(R.drawable.list_corner_round);
+
+
+    }
+
+    protected View initHeaderView()
+    {
+
+        View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.invisable_listheader, null);
+        return headerView;
+
+    }
+    protected JSONObject loadjson(int rawid)
+    {
+
+        return RAUtil.getJsonFromRAW(getActivity(),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;
+
+    }
+
+    protected List<Map<String, Object>> getData(JSONObject jsobj)
+    {
+
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+
+        try {
+            ModeName=jsobj.getString("title");
+            ModeIcon=jsobj.getString("icon");
+
+            JSONArray array = jsobj.getJSONArray("modelist");
+             for(int i=0;i<array.length();i++) {
+
+                 JSONObject rowobj = array.getJSONObject(i);
+
+                 Map<String, Object> map = new HashMap<String, Object>();
+                 String name=rowobj.getString("name");
+                 String info=rowobj.getString("detail");
+                 String    icon=rowobj.getString("icon");
+                 String    type=rowobj.getString("type");
+
+
+                 int iconid = RAUtil.iconName2Rid(getContext(),icon);
+                 map.put("title", name);
+                 map.put("detail", info);
+                 map.put("img", iconid);
+                 map.put("type", type);
+                 list.add(map);
+
+
+             }
+
+
+            // jsonobject.put("name", key);
+            // jsonobject.put("exp", key+"="+jsonobject.getString("value"));
+            // newArray.put(jsonobject);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+//        boolean login = false;
+//        Bundle b = getArguments();
+//
+//        if(b!=null)
+//        {
+//            login = b.getBoolean("Login");
+//        }
+
+
+//        Map<String, Object> map = new HashMap<String, Object>();
+//        map.put("title", "Market news");
+//        map.put("info", "google 1");
+//        map.put("img", R.drawable.rect_market_news);
+//        list.add(map);
+//
+//        map = new HashMap<String, Object>();
+//        map.put("title", "Announcements");
+//        map.put("info", "google 2");
+//        map.put("img", R.drawable.rect_announcements);
+//        list.add(map);
+//
+//        if (login)
+//        {
+//            map = new HashMap<String, Object>();
+//            map.put("title", "Saved Detail/Search");
+//            map.put("info", "google 2");
+//            map.put("img", R.drawable.rect_search_history);
+//            list.add(map);
+//
+//            map = new HashMap<String, Object>();
+//            map.put("title", "Change Password");
+//            map.put("img", R.drawable.rect_change_password);
+//            list.add(map);
+//            map = new HashMap<String, Object>();
+//            map.put("title", "Setting");
+//            map.put("img", R.drawable.rect_setting);
+//            list.add(map);
+//        }
+//
+//        map = new HashMap<String, Object>();
+//        map.put("title", "Apex History");
+//
+//        map.put("img", R.drawable.rect_history);
+//        list.add(map);
+//
+//        map = new HashMap<String, Object>();
+//        map.put("title", "About this App");
+//        map.put("info", "google 2");
+//        map.put("img", R.drawable.rect_about);
+//        list.add(map);
+
+        return list;
+    }
+
+}

+ 597 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/TradeFilingApplication.java

@@ -0,0 +1,597 @@
+package com.usai.ratradefiling;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Application;
+import android.app.DownloadManager;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+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.ratradefiling.dataprovider.RADataProvider;
+import com.usai.ratradefiling.utils.AES;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.redant.rautils.utils.FileManager;
+import com.usai.redant.rautils.utils.RAProviderHelper;
+import com.usai.redant.rautils.utils.RAUtil;
+//import com.usai.util.AES;
+//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.lang.ref.WeakReference;
+
+public class TradeFilingApplication extends Application implements RAProviderHelper.ProviderHelperDelegate
+{
+
+	static final String						TAG				= "TradeFilingApplication";
+	private static TradeFilingApplication	instance;
+
+	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 TradeFilingApplication getInstance() {
+		return instance;
+	}
+
+
+	private static JSONObject m_function_panel;
+	private static JSONObject m_fields;
+	private static JSONArray m_company_list;
+
+	private static int m_current_company_idx=0;
+
+	@Override
+	public void onCreate()
+	{
+
+		// TODO Auto-generated method stub
+		Log.d(TAG, "onCreate");
+		super.onCreate();
+
+
+//		ApexResultBaseModel b=new ApexResultBaseModel();
+//		Field[] f = b.getClass().getFields();
+//
+//		Log.d(TAG, "Fields count"+f.length);
+
+		registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
+			@Override
+			public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
+				mCurrentActivity = activity;
+				Resources res = TradeFilingApplication.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 = TradeFilingApplication.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();
+
+		// 删除Result固定显示字段 及 更新显示最多三条
+//		dbUtil.deleteResultFields();
+//		dbUtil.updateResultDisplayFields();
+
+		// 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;
+
+	@Override
+	public String getProviderAuthorities() {
+		return "com.usai.apex.fileprovider";
+	}
+
+	private static final class CheckUpdateHandler extends Handler {
+
+        WeakReference<TradeFilingApplication> mWeakApp;
+
+        public CheckUpdateHandler(TradeFilingApplication application) {
+            mWeakApp = new WeakReference<> (application);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+            switch (msg.what) {
+                case HandlerMsgTypeCheckUpdate: {
+
+                    final TradeFilingApplication 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 = OnlineDataProvider.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() {
+
+//		throw new AssertionError("TradeFilingApplication::getDocumentDir() not impl");
+
+
+		return FileManager.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 TradeFilingApplication 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;
+		m_function_panel=null;
+		m_fields=null;
+		m_company_list = null;
+		get_instance().setPersonMode(false);
+		SharedPreferences pref = TradeFilingApplication.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 user, String pass,JSONObject json)
+	{
+//		m_sessionid = sid;
+		m_user = user;
+		m_password = pass;
+		m_bauthorized = true;
+
+		try {
+			m_function_panel = json.getJSONObject("function_panel");
+
+			RADataProvider.updateFunctionPanel();
+
+
+			m_fields = json.getJSONObject("fields");
+			m_company_list = json.getJSONArray("company");
+
+		} catch (JSONException e) {
+			m_function_panel = null;
+			e.printStackTrace();
+		}
+
+		SharedPreferences pref = TradeFilingApplication.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;
+	}
+	public static JSONObject get_functionPanel()
+	{
+		Log.d(TAG, "get_functionPanel");
+		return m_function_panel;
+	}
+	public static JSONObject get_fields(String type, String subtype)
+	{
+		Log.d(TAG, "get_fields");
+
+		try
+		{
+			return m_fields.getJSONObject(type).getJSONObject(subtype);
+		} catch (JSONException e)
+		{
+			e.printStackTrace();
+		}
+		return null;
+//		return m_fields;
+	}
+	public static JSONArray get_company_list()
+	{
+		Log.d(TAG, "get_company_list");
+		return m_company_list;
+	}
+	public static int get_current_company_index()
+	{
+		Log.d(TAG, "get_company_list");
+		return m_current_company_idx;
+	}
+	public static String get_current_company_name()
+	{
+		Log.d(TAG, "get_company_list");
+
+		try {
+			String company= m_company_list.getJSONObject(m_current_company_idx).optString("name","");
+			return company;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return "";
+	}
+}

+ 45 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/ViewPagerAdapter.java

@@ -0,0 +1,45 @@
+package com.usai.ratradefiling;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.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();
+//    }
+}

+ 79 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/about/AboutFragment.java

@@ -0,0 +1,79 @@
+package com.usai.ratradefiling.about;
+
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.TradeFilingApplication;
+
+/**
+ * A simple {@link Fragment} subclass.
+ * Use the {@link AboutFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ */
+public class AboutFragment extends Fragment {
+
+    // TODO: Rename parameter arguments, choose names that match
+    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+    private static final String ARG_PARAM1 = "param1";
+    private static final String ARG_PARAM2 = "param2";
+
+    // TODO: Rename and change types of parameters
+    private String mParam1;
+    private String mParam2;
+
+    public AboutFragment() {
+        // Required empty public constructor
+    }
+
+    /**
+     * Use this factory method to create a new instance of
+     * this fragment using the provided parameters.
+     *
+     * @param param1 Parameter 1.
+     * @param param2 Parameter 2.
+     * @return A new instance of fragment AboutFragment.
+     */
+    // TODO: Rename and change types and number of parameters
+    public static AboutFragment newInstance(String param1, String param2) {
+        AboutFragment fragment = new AboutFragment();
+        Bundle args = new Bundle();
+        args.putString(ARG_PARAM1, param1);
+        args.putString(ARG_PARAM2, param2);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (getArguments() != null) {
+            mParam1 = getArguments().getString(ARG_PARAM1);
+            mParam2 = getArguments().getString(ARG_PARAM2);
+        }
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
+        // Inflate the layout for this fragment
+        View view =  inflater.inflate(R.layout.fragment_about, container, false);
+        TextView tv_ver = (TextView) view.findViewById(R.id.tv_ver);
+        try {
+            tv_ver.setText(getText(R.string.str_ver)+ TradeFilingApplication.get_instance().getPackageManager().getPackageInfo(
+                    "com.usai.apex", 0).versionName);
+        } catch (PackageManager.NameNotFoundException e1) {
+            // TODO Auto-generated catch block
+            e1.printStackTrace();
+        }
+
+        return view;
+    }
+}

+ 72 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicActivity.java

@@ -0,0 +1,72 @@
+package com.usai.ratradefiling.base;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.usai.ratradefiling.R;
+
+public class BasicActivity extends AppCompatActivity {
+
+    public boolean autoSetupStatusBar = true;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+//        setContentView(R.layout.activity_basic);
+
+//        Looper.myQueue().addIdleHandler(new MessageQueue.IdleHandler() {
+//            @Override
+//            public boolean queueIdle() {
+//                if (true) {
+//                    initStatusBar();
+//                    getWindow().getDecorView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+//                        @Override
+//                        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+//                            initStatusBar();
+//                        }
+//                    });
+//                }
+//                return false;
+//            }
+//        });
+
+        if (autoSetupStatusBar) {
+            getWindow().getDecorView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+                @Override
+                public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
+                    changeStatusBarGradient();
+                }
+            });
+        }
+
+    }
+
+
+    protected void initStatusBar(int resId) {
+        View statusBarView = null;
+        if (statusBarView == null) {
+            //android系统级的资源id得这么拿,不然拿不到
+            int identifier = getResources().getIdentifier("statusBarBackground", "id", "android");
+            statusBarView = getWindow().findViewById(identifier);
+        }
+        if (statusBarView != null) {
+            statusBarView.setBackgroundResource(resId);
+        }
+    }
+
+    public void changeStatusBarGradient() {
+        initStatusBar(R.drawable.gradient_color);
+    }
+
+    public void changeStatusBarNormal() {
+//        initStatusBar(R.color.white);
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+        }
+    }
+}

+ 106 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicDialog.java

@@ -0,0 +1,106 @@
+package com.usai.ratradefiling.base;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.view.Gravity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.annotation.NonNull;
+
+import com.usai.ratradefiling.R;
+
+
+public class BasicDialog extends Dialog {
+
+    private Context mCtx;
+    private View mRootView;
+    private BasicDialogSetupCallBack mCallBack;
+
+    public final static int BasicDialogContentGravityTop = 0;
+    public final static int BasicDialogContentGravityCenter = 1;
+    public final static int BasicDialogContentGravityBottom = 2;
+
+    public BasicDialog(@NonNull Context context, BasicDialogSetupCallBack callBack) {
+        this(context);
+
+        mCallBack = callBack;
+
+        mCtx = context;
+        init();
+    }
+
+    private BasicDialog(@NonNull Context context) {
+        this(context, R.style.RedAntDialog);
+    }
+
+    private BasicDialog(@NonNull Context context, int themeResId) {
+        super(context, themeResId);
+    }
+
+    private void init() {
+        if (mCallBack != null) {
+            mRootView = mCallBack.createContentView(this);
+            if (mRootView != null) {
+                setContentView(mRootView);
+            }
+        }
+    }
+
+    @Override
+    public void show() {
+
+        if (mRootView == null) {
+            super.show();
+            return;
+        }
+
+        Window dialogWindow = getWindow();
+        if (dialogWindow != null) {
+
+            int gravity = BasicDialogContentGravityCenter;
+            if (mCallBack != null) {
+                gravity = mCallBack.dialogGravity(this);
+            }
+
+            switch (gravity) {
+                case BasicDialogContentGravityTop: {
+                    dialogWindow.setGravity(Gravity.TOP);
+                }
+                break;
+                case BasicDialogContentGravityCenter: {
+                    dialogWindow.setGravity(Gravity.CENTER);
+                }
+                break;
+                case BasicDialogContentGravityBottom: {
+                    dialogWindow.setGravity(Gravity.BOTTOM);
+                }
+                break;
+                default: {
+                    dialogWindow.setGravity(Gravity.CENTER);
+                }
+                break;
+            }
+
+            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();
+    }
+
+    public interface BasicDialogSetupCallBack {
+
+        View createContentView(final BasicDialog dialog);
+        int dialogGravity(final BasicDialog dialog);
+
+    }
+}

+ 171 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/BasicObject.java

@@ -0,0 +1,171 @@
+package com.usai.ratradefiling.base;
+
+import org.json.JSONObject;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+public class BasicObject extends NoProguard {
+
+    public void setValuesForKeysWithJSON(JSONObject json) {
+//        Log.e("BasicObject", "setValuesForKeysWithJSON: " );
+        if (json == null || json.length() == 0) {
+
+//            Log.e("BasicObject", "setValuesForKeysWithJSON: json is null" );
+            return;
+        }
+
+
+        try {
+            Class cls = getClass();
+//            Log.e("BasicObject", "cls != null "+(cls != null) );
+//            Log.e("BasicObject", "cls != Class.class "+(cls != Class.class) );
+
+//            Log.e("BasicObject", "Class.class "+Class.class );
+            while (cls != null && cls != Class.class) {
+//                Log.e("BasicObject", "cls "+cls );
+                Field[] fields = cls.getFields();
+
+//                Log.e("BasicObject", "fields  "+fields.length );
+//                Log.e("BasicObject", "fields  "+fields );
+
+                for (Field f : fields) {
+
+                    String key = f.getName();
+
+                    Object value = json.opt(key);
+//                    Log.e("BasicObject full info", "key "+key+" value "+value + " type "+f.getType());
+                    if (value == null) {
+                        continue;
+                    }
+
+                    Class type = f.getType();
+                    if (type == value.getClass() || ((type == int.class || type == long.class) && value.getClass() == Integer.class) || ((type == float.class || type == double.class) && (value.getClass() == Double.class || value.getClass() == Float.class)) || ((type == Boolean.class || type == boolean.class) && (value.getClass() == boolean.class || value.getClass() == Boolean.class))) {
+
+
+                        boolean success = invokeSetter(cls,f,type,key,value);
+                        if (!success) {
+                            f.set(this,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);
+                            }
+
+                            boolean success = invokeSetter(cls,f,type,key,value);
+                            if (!success) {
+                                f.set(this,value);
+                            }
+
+                        } else {
+
+                            if (type == Object.class) {
+                                boolean success = invokeObjectSetter(type,key,(Object) value);
+//                                Log.e("invokeObjectSetter", ""+cls+"  ,  "+f+","+type+"  ,  "+key+"  ,  "+value+"  ,  "+success );
+
+                                if (!success) {
+                                    f.set(this,value);
+                                }
+                            }
+
+                        }
+
+                    }
+
+                }
+                cls = cls.getSuperclass();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public boolean invokeObjectSetter( Class type,String key,Object value) {
+
+        String setter = "set" + toUpperCaseFirstOne(key);
+        try {
+
+
+//            Class<?> myClassType = Class.forName(cls.getName());
+//            Class<?>[] types = new Class[] { File.class };
+//            Constructor<?> cons = myClassType.getConstructor(types);
+
+//            Log.e("invokeObjectSetter", "settler: "+setter+" type "+type );
+
+            Class[] cArg = new Class[1];
+            cArg[0] = type;
+//            Log.e("invokeObjectSetter", getClass().getName() );
+            Method method = getClass().getMethod(setter,cArg);
+            if (method != null) {
+
+                method.invoke(this,value);
+
+                return true;
+            }
+
+        }
+        catch(NoSuchMethodException e)
+        {
+            e.printStackTrace();
+        }
+        catch (Exception e) {
+//            dbgUtil.Logd("invokeSetter",e.getMessage());
+            e.printStackTrace();
+        }
+
+        return false;
+    }
+    public boolean invokeSetter(Class cls, Field f, Class type,String key,Object value) {
+
+        String setter = "set" + toUpperCaseFirstOne(key);
+        try {
+
+
+            Class<?> myClassType = Class.forName(cls.getName());
+//            Class<?>[] types = new Class[] { File.class };
+//            Constructor<?> cons = myClassType.getConstructor(types);
+
+            Method method = myClassType.getMethod(setter,type);
+            if (method != null) {
+
+                method.invoke(this,value);
+
+                return true;
+            }
+
+        }
+        catch(NoSuchMethodException e)
+        {
+//            e.printStackTrace();
+        }
+        catch (Exception e) {
+//            dbgUtil.Logd("invokeSetter",e.getMessage());
+            e.printStackTrace();
+        }
+
+        return false;
+    }
+
+    public 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();
+    }
+}

+ 4 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/NoProguard.java

@@ -0,0 +1,4 @@
+package com.usai.ratradefiling.base;
+
+public class NoProguard extends Object {
+}

+ 118 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/base/ResultBaseModel.java

@@ -0,0 +1,118 @@
+package com.usai.ratradefiling.base;
+
+import android.os.Parcel;
+
+//import com.usai.apex.base.BaseObject;
+
+import com.usai.ratradefiling.result.ResultAddition;
+import com.usai.redant.rautils.base.BaseObject;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+public class ResultBaseModel extends BaseObject
+{
+
+    protected ResultBaseModel(Parcel in) {
+        type = in.readInt();
+        String jsonStr = in.readString();
+        try {
+            rowActionParameters = new JSONArray(jsonStr);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public ResultBaseModel() {
+
+    }
+//    public String getIcon() {
+//        return icon;
+//    }
+    public JSONObject toJson() {
+        JSONObject json = new JSONObject();
+        try {
+            json.put("type", type);
+            if (rowActionParameters != null) {
+                json.put("rowActionParameters", rowActionParameters);
+            }
+
+            if (addition != null) {
+                json.put("addition", addition);
+            }
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+    public static enum HomeDashResultType {
+        DashResultTypeEmpty,
+        DashResultTypeACIPending,
+        DashResultTypeeManifestPending,
+        DashResultTypeACEM1Pending,
+        DashResultTypeISFPending,
+        DashResultTypeACIError,
+        DashResultTypeeManifestError,
+        DashResultTypeACEM1Error,
+        DashResultTypeISFError
+//        ,
+//        DashResultTypeSection,
+    }
+    public static enum ResultType {
+        ResultTypeEmpty,
+        ResultTypeACI,
+        ResultTypeeManifest,
+        ResultTypeACEM1,
+        ResultTypeISF,
+        ResultTypeCustomer
+    }
+
+    public int type;
+    public JSONArray rowActionParameters;
+
+    // region Addition
+
+    public Object addition; // 使用Object对象,便于baseObject赋值
+    private ArrayList<ResultAddition> additions;
+
+    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) {
+
+                        ResultAddition additionModel = new ResultAddition();
+                        additionModel.setValuesForKeysWithJSON(additionItem);
+                        this.additions.add(additionModel);
+                    }
+                }
+
+            } else {
+                this.additions = null;
+            }
+
+        } else {
+            this.additions = null;
+        }
+
+
+
+    }
+
+    public ArrayList<ResultAddition> getAddition() {
+        return additions;
+    }
+
+    // endregion
+}

+ 77 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/OfflineDataProvider.java

@@ -0,0 +1,77 @@
+package com.usai.ratradefiling.dataprovider;
+
+import android.os.Bundle;
+
+import com.usai.ratradefiling.TradeFilingApplication;
+
+import org.json.JSONObject;
+
+import static com.usai.redant.rautils.utils.RAUtil.getJsonFromAsset;
+
+public class OfflineDataProvider {
+    public static JSONObject request_login(String user, String password)
+    {
+        JSONObject commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(),"login.json");
+
+
+        TradeFilingApplication.login(
+                user, password,commObj);
+        return commObj;
+    }
+
+    public static JSONObject request_home()
+    {
+        JSONObject commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(),"home.json");
+
+
+        return commObj;
+    }
+
+    public static JSONObject request_result(Bundle params)
+    {
+
+        String subtype = params.getString("sub_type");
+        JSONObject commObj = null;
+        if (subtype.equals("aci"))
+        {
+            commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_aci.json");
+        }
+        else
+        {
+            if (subtype.equals("emanifest"))
+            {
+                commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_emanifest.json");
+            }
+            else
+            {
+                if (subtype.equals("isf"))
+                {
+                    commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_isf.json");
+                }
+                else
+                {
+                    if (subtype.equals("acem1"))
+                    {
+                        commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_acem1.json");
+                    }
+                    else
+                    {
+                        if (subtype.equals("customer"))
+                        {
+                            commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_emanifest.json");
+                        }
+                        else
+                        {
+                            if (subtype.equals("emanifest"))
+                            {
+                                commObj = getJsonFromAsset(TradeFilingApplication.get_instance().getApplicationContext(), "searchresult_customer.json");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return commObj;
+    }
+}

+ 1704 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/OnlineDataProvider.java

@@ -0,0 +1,1704 @@
+package com.usai.ratradefiling.dataprovider;
+
+import android.content.Context;
+import android.content.SharedPreferences.Editor;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteStatement;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+
+//import com.usai.apex.TradeFilingApplication;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.redant.rautils.utils.FileManager;
+import com.usai.redant.rautils.utils.RAUtil;
+
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.util.Iterator;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+
+public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
+{
+	public static final String SHORT_VER ="2.92";
+
+	public static final int		BEHAVIOR_SEARCH					= 0;
+	public static final int		BEHAVIOR_RESULT					= 1;
+
+	private static final int	REQUEST_TIMEOUT					= 30 * 1000;										// request
+																													// time
+
+																													// out
+																													// 20
+																													// secs
+	private static final int	SO_TIMEOUT						= 30 * 1000;										// so
+																													// time
+																													// out
+																													// 20
+																													// secs;
+	public static int			AP_USER_AUTH					= 1;
+	public static int			AP_USER_NOT_AUTH				= 2;
+	public static int			AP_USER_NOT_EXIST				= 3;
+	public static int			AP_SESSION_EXPIRED				= 4;
+
+	public static int			AP_MESSAGE_NEW					= 5;
+	public static int			AP_MESSAGE_NONE					= 6;
+
+
+
+	//DEBUG
+//	public static String		BASE_URL						= "http://10.0.0.123:8888";
+
+	//RELEASE
+	public static String		BASE_URL						= "https://ra.apexshipping.com";
+
+
+//	URL
+	public static String		URL_HOME						= BASE_URL+"/main_new_29.php";
+	public static String		URL_HISTORY						= BASE_URL+"/main_new_29.php";
+	public static String		URL_KPI							= BASE_URL+"/main_new_29.php";
+	public static String		URL_UPDATE_AUTH					= BASE_URL+"/main_new_29.php";
+	public static String		URL_REQUEST_COUNT				= BASE_URL+"/main_new_29.php";
+	public static String		URL_REQUEST_RECORDS				= BASE_URL+"/main_new_29.php";
+	public static String		URL_RETRIEVE_PASS				= BASE_URL+"/main_new_29.php";
+	public static String		URL_ANNOUNCEMENTS				= BASE_URL+"/mobile_news.php";
+	public static String		URL_NEWS						= BASE_URL+"/mobile_news.php";
+	public static String		URL_LOCATIONS					= BASE_URL+"/mobile_news26.php";
+	public static String		URL_PUSH						= BASE_URL+"/main_new_29.php";
+	public static String		URL_LOG							= BASE_URL+"/mobile_news.php";
+	public static String		URL_SEND_COMM_EMAIL				= BASE_URL+"/main_new_29.php";
+	public static String		URL_CHECK_UPDATE				= BASE_URL+"/main_new_29.php";
+
+
+	public static String		URL_UPLOAD_SQL					= BASE_URL+"/main_new_29.php";
+	public static String		URL_FETCH_RESULT				= BASE_URL+"/main_new_29.php";
+	public static String		URL_SAVE_RESULT					= BASE_URL+"/main_new_29.php";
+
+
+//
+//
+//////debug
+//	public static String		URL_HOME						= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_HISTORY						= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_KPI							= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_UPDATE_AUTH					= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_REQUEST_COUNT				= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_REQUEST_RECORDS				= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_RETRIEVE_PASS				= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_ANNOUNCEMENTS				= "http://192.168.0.138:8899/mobile_news.php";
+//	public static String		URL_NEWS						= "http://192.168.0.138:8899/mobile_news.php";
+//	public static String		URL_LOCATIONS					= "http://192.168.0.138:8899/mobile_news26.php";
+//	public static String		URL_PUSH						= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_LOG							= "http://192.168.0.138:8899/mobile_news.php";
+//	public static String		URL_SEND_COMM_EMAIL				= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_CHECK_UPDATE				= "http://192.168.0.138:8899/main_new_29.php";
+//
+//
+//	public static String		URL_UPLOAD_SQL					= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_FETCH_RESULT				= "http://192.168.0.138:8899/main_new_29.php";
+//	public static String		URL_SAVE_RESULT					= "http://192.168.0.138:8899/main_new_29.php";
+//
+
+	public static JSONObject request_login(String user, String password)
+	{
+		return null;
+	}
+
+
+	public static String get_marketnews(String id, int limit)
+	{
+		String TAG = "net_dbg@get_marketnews";
+
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return null; // network not available
+		}
+
+		Bundle parms = new Bundle();
+		parms.putString("module_name", "Market News");
+		parms.putString("action_type", "search");
+		parms.putString("id", id + "");
+		parms.putString("limit", limit + "");
+		String jstr = getJson(OnlineDataProvider.URL_NEWS, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return null;
+		}
+		return jstr;
+
+	}
+	private static JSONObject handleJson(String jsonStr) {
+
+		if (jsonStr == null || jsonStr.isEmpty()) {
+			return null;
+		}
+
+		try {
+			JSONObject json = new JSONObject(jsonStr);
+			String msg = json.optString("msg");
+			if (msg != null) {
+				json.put("err_msg",msg);
+			}
+
+			return json;
+		} catch (JSONException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	public static String get_servicelocation()
+	{
+
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			return null; // network not available
+		}
+
+		Bundle parms = new Bundle();
+		parms.putString("module_name", "Location");
+		parms.putString("action_type", "search");
+		// parms.putString("id", id+"");
+		parms.putString("limit", "999");
+		String jstr = getJson(OnlineDataProvider.URL_LOCATIONS, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			return null;
+		}
+
+
+
+
+
+		JSONObject json = handleJson(jstr);
+
+
+
+
+//		String user = ApexDriverApplication.sharedApplication().user;
+		String path=FileManager.internalStorageFileDir(TradeFilingApplication.get_instance().getApplicationContext())+ File.separator + "service_location.json";
+
+		if(json!=null&& json.optInt("result")!=RESULT_NET_ERROR&& json.optInt("result")!=RESULT_NET_NOTAVAILABLE)
+		{
+			FileManager.writeJson(jstr,path);
+//			return jstr;
+		}
+
+
+
+		return jstr;
+
+	}
+
+
+
+
+	public static String get_announcements(String id, int limit)
+	{
+
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			return null; // network not available
+		}
+
+		Bundle parms = new Bundle();
+		parms.putString("module_name", "Announcements");
+		parms.putString("action_type", "search");
+		parms.putString("id", id);
+		parms.putString("limit", limit + "");
+		String jstr = getJson(OnlineDataProvider.URL_ANNOUNCEMENTS, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			return null;
+		}
+		return jstr;
+
+	}
+
+	public static int change_pass(String oldpass, String newpass, String user)
+	{
+		String TAG = "net_dbg@change_pass";
+		Log.d(TAG, "old:" + oldpass + ";new:" + newpass);
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return OnlineDataProvider.RESULT_NET_NOTAVAILABLE; // network not available
+		}
+		Bundle parms = new Bundle();
+		parms.putString("user", user);
+		parms.putString("oldpass", oldpass);
+		parms.putString("newpass", newpass);
+		parms.putString("module_name", "Change Password");
+//		parms.putString("sessionid", ApexTrackingApplication.get_sessionid());
+		parms.putString("action", "handset_search");
+		String jstr = getJson(OnlineDataProvider.URL_RETRIEVE_PASS, parms);
+		/*
+		 * error occur while get authorization info from server. include can not
+		 * reach server , wrong parms ,server get wrong , etc.
+		 */
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return OnlineDataProvider.RESULT_NET_ERROR;
+		}
+		JSONObject jsobj;
+
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					OnlineDataProvider.get_Auth(user, oldpass);
+					jstr = getJson(OnlineDataProvider.URL_RETRIEVE_PASS, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_USER_AUTH)
+				{
+					// user not authorized return
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return RESULT_FALSE;
+				}
+				else
+				{
+
+					return RESULT_TRUE;
+				}
+			}
+			return RESULT_NET_ERROR;
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		return RESULT_NET_ERROR;
+	}
+
+	public static int retrieve_pass(String user, String email)
+	{
+		String TAG = "net_dbg@retrieve_pass";
+		Log.d(TAG, "u:" + user + ";e:" + email);
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return OnlineDataProvider.RESULT_NET_NOTAVAILABLE; // network not available
+		}
+		Bundle parms = new Bundle();
+		parms.putString("user", user);
+		parms.putString("email", email);
+		parms.putString("module_name", "Retrieve Password");
+		parms.putString("action", "handset_search");
+		String jstr = getJson(OnlineDataProvider.URL_RETRIEVE_PASS, parms);
+		/*
+		 * error occur while get authorization info from server. include can not
+		 * reach server , wrong parms ,server get wrong , etc.
+		 */
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return OnlineDataProvider.RESULT_NET_ERROR;
+		}
+		JSONObject jsobj;
+
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+
+				if (iresult != OnlineDataProvider.AP_USER_AUTH)
+				{
+					// user not authorized return
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return RESULT_FALSE;
+				}
+				return RESULT_TRUE;
+
+			}
+			return RESULT_NET_ERROR;
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		return RESULT_NET_ERROR;
+	}
+
+	public static void prepare_addtional_params(Bundle params) {
+		if (params == null) {
+			params = new Bundle();
+		}
+
+		String user = TradeFilingApplication.get_user();
+		if (user != null && params.getString("user") == null) {
+			params.putString("user",user);
+		}
+
+		String pwd = TradeFilingApplication.get_pass();
+		if (pwd != null && params.getString("pwd") == null) {
+			params.putString("pwd",pwd);
+		}
+
+		params.putString("os","Android");
+		params.putString("app_short_ver",SHORT_VER);
+
+	}
+
+	public static String getJson(String url, Bundle parms)
+	{
+		prepare_addtional_params(parms);
+		return com.usai.redant.rautils.utils.Network.getJson(url, parms, REQUEST_TIMEOUT);
+	}
+
+	public static int get_recordcount(Bundle parms)
+	{
+		String TAG = "net_dbg@get_recordcount";
+
+		parms.putString("action", "handset_search_count");
+//		parms.putString("sessionid", ApexTrackingApplication.get_sessionid());
+//		Log.d(TAG, "sessionid=" + ApexTrackingApplication.get_sessionid());
+		String jstr = getJson(OnlineDataProvider.URL_REQUEST_COUNT, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return OnlineDataProvider.RESULT_NET_ERROR;
+		}
+		JSONObject jsobj;
+
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					String user, pass;
+					user = TradeFilingApplication.get_user();
+					pass = TradeFilingApplication.get_pass();
+					OnlineDataProvider.get_Auth(user, pass);
+					jstr = getJson(OnlineDataProvider.URL_REQUEST_COUNT, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_USER_AUTH)
+				{
+					// session expired
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return RESULT_SESSION_EXPIRED;
+					// if (get_Auth(name, password) == RESULT_TRUE)
+					// {
+					// return get_recordcount(name, password, parms);
+					//
+					// }
+					// else
+					// {
+					//
+					// Log.d(TAG,
+					// "USER NOT AUTHORIZED CODE="
+					// + jsobj.getInt("result"));
+					// return RESULT_SESSION_EXPIRED;
+					// }
+				}
+				else
+				{
+					TradeFilingApplication.SetAuthorizeStatus(true);
+					return jsobj.getInt("count");
+				}
+			}
+			else
+			{
+				Log.d(TAG, "json is wrong");
+				return OnlineDataProvider.RESULT_NET_ERROR;
+			}
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		return RESULT_ERROR;
+	}
+
+	public static String get_records(String name, String password, Bundle parms)
+	{
+		String TAG = "net_dbg@get_records";
+		// parms.putString("user", name);
+		// parms.putString("password", password);
+		// if (!Network.NetworkIsAvailable())
+		// {
+		// Log.d(TAG, "network not available!");
+		// return "Network.RESULT_NET_NOTAVAILABLE"; // network not available
+		// }
+		parms.putString("action", "handset_search");
+//		parms.putString("sessionid", ApexTrackingApplication.get_sessionid());
+		String jstr = getJson(OnlineDataProvider.URL_REQUEST_RECORDS, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return null;
+		}
+		JSONObject jsobj;
+		//
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					String user, pass;
+					user = TradeFilingApplication.get_user();
+					pass = TradeFilingApplication.get_pass();
+					OnlineDataProvider.get_Auth(user, pass);
+					jstr = getJson(OnlineDataProvider.URL_REQUEST_RECORDS, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_USER_AUTH)
+				{
+					// session expired
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return null;
+					// if (get_Auth(name, password) == RESULT_TRUE)
+					// {
+					// return get_records(name, password, parms);
+					//
+					// }
+					// else
+					// {
+					//
+					// Log.d(TAG,
+					// "USER NOT AUTHORIZED CODE="
+					// + jsobj.getInt("result"));
+					// return null;
+					// }
+				}
+				else
+				{
+					TradeFilingApplication.SetAuthorizeStatus(true);
+					return jstr;
+				}
+			}
+			else
+			{
+				Log.d(TAG, "json is wrong");
+				return null;
+			}
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+
+		// return RESULT_ERROR;
+	}
+
+	public static String get_push(String e_id, String s_id, int limit,
+			int offset)
+	{
+		String TAG = "net_dbg@get_push";
+		Bundle parms = new Bundle();
+		parms.putString("action", "handset_search");
+		parms.putString("e_id", e_id);
+		parms.putString("s_id", s_id);
+		parms.putString("limit", limit + "");
+		parms.putString("offset", offset + "");
+		parms.putString("action_type", "detail");
+		parms.putString("module_name", "Pull Message");
+		parms.putString("puid", RAUtil.getDeviceId(TradeFilingApplication.get_instance().getApplicationContext()));
+//		String sessionid = ApexTrackingApplication.get_sessionid();
+		// if (TextUtils.isEmpty(sessionid))
+		// {
+		//
+		// Log.d(TAG, "no sessionid return!");
+		// return null;
+		//
+		// }
+		String user = TradeFilingApplication.get_user();
+		// if (TextUtils.isEmpty(user))
+		// {
+		//
+		// Log.d(TAG, "no user name return!");
+		// return null;
+		//
+		// }
+//		parms.putString("sessionid", sessionid);
+		parms.putString("user", user);
+		// SQLiteDatabase db =
+		// dbUtil.OpenDB(ApexTrackingApplication.get_instance(), null, false);
+		// Cursor cursor = db.query("push_message", new String[] {"MAX(e_id)"},
+		// "user = '"+ApexTrackingApplication.get_user()+"'", null, null, null,
+		// null, null);
+		// if (cursor.moveToNext())
+		// {
+		// String maxid = cursor.getString(0);
+		// if(!TextUtils.isEmpty(maxid))
+		// parms.putString("id", maxid);
+		// }
+		// dbUtil.CloseCursor(cursor);
+		// dbUtil.CloseDB(db);
+
+		String jstr = getJson(OnlineDataProvider.URL_PUSH, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return null;
+		}
+		JSONObject jsobj;
+		//
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					String pass;
+
+					pass = TradeFilingApplication.get_pass();
+					OnlineDataProvider.get_Auth(user, pass);
+					jstr = getJson(OnlineDataProvider.URL_REQUEST_RECORDS, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_MESSAGE_NEW)
+				{
+					// session expired
+					Log.d(TAG,
+							"DOSE NOT GET NEW MESSAGE CODE="
+									+ jsobj.getInt("result"));
+					return null;
+					// if (get_Auth(name, password) == RESULT_TRUE)
+					// {
+					// return get_records(name, password, parms);
+					//
+					// }
+					// else
+					// {
+					//
+					// Log.d(TAG,
+					// "USER NOT AUTHORIZED CODE="
+					// + jsobj.getInt("result"));
+					// return null;
+					// }
+				}
+				else
+				{
+					return jstr;
+				}
+			}
+			else
+			{
+				Log.d(TAG, "json is wrong");
+				return null;
+			}
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+
+		// return RESULT_ERROR;
+	}
+
+	public static String check_push()
+	{
+	    if(true)
+	        return null;
+		String TAG = "net_dbg@check_push";
+		Bundle parms = new Bundle();
+		parms.putString("action", "handset_search");
+		parms.putString("module_name", "Pull Message");
+		parms.putString("puid", RAUtil.getDeviceId(TradeFilingApplication.get_instance().getApplicationContext()));
+//		String sessionid = ApexTrackingApplication.get_sessionid();
+		// if (TextUtils.isEmpty(sessionid))
+		// {
+		//
+		// Log.d(TAG, "no sessionid return!");
+		// return null;
+		//
+		// }
+		String user = TradeFilingApplication.get_user();
+		if (TextUtils.isEmpty(user))
+		{
+
+			Log.d(TAG, "no user name return!");
+			return null;
+
+		}
+		// parms.putString("sessionid", sessionid);
+		parms.putString("user", user);
+
+		if(true)
+		throw new AssertionError("OnlinedataProvider::check_push not impl");
+//		SQLiteDatabase db = dbUtil.OpenDB(
+//				TradeFilingApplication.get_instance(), null, false);
+//		Cursor cursor = db.query("push_message", new String[] { "MAX(e_id)" },
+//				"user = '" + TradeFilingApplication.get_user() + "'", null,
+//				null, null, null, null);
+//		if (cursor.moveToNext())
+//		{
+//			String maxid = cursor.getString(0);
+//			if (!TextUtils.isEmpty(maxid))
+//				parms.putString("id", maxid);
+//		}
+//		dbUtil.CloseCursor(cursor);
+//		dbUtil.CloseDB(db);
+
+		String jstr = getJson(OnlineDataProvider.URL_PUSH, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return null;
+		}
+		JSONObject jsobj;
+		//
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					String pass;
+
+					pass = TradeFilingApplication.get_pass();
+					OnlineDataProvider.get_Auth(user, pass);
+					jstr = getJson(OnlineDataProvider.URL_PUSH, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_MESSAGE_NEW)
+				{
+					// session expired
+					Log.d(TAG,
+							"DOSE NOT GET NEW MESSAGE CODE="
+									+ jsobj.getInt("result"));
+					return null;
+					// if (get_Auth(name, password) == RESULT_TRUE)
+					// {
+					// return get_records(name, password, parms);
+					//
+					// }
+					// else
+					// {
+					//
+					// Log.d(TAG,
+					// "USER NOT AUTHORIZED CODE="
+					// + jsobj.getInt("result"));
+					// return null;
+					// }
+				}
+				else
+				{
+					return jstr;
+				}
+			}
+			else
+			{
+				Log.d(TAG, "json is wrong");
+				return null;
+			}
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+
+		// return RESULT_ERROR;
+	}
+
+	public static String get_detail(Bundle parms)
+	{
+		String TAG = "net_dbg@get_detail";
+		parms.putString("action", "handset_search");
+
+		String actionType = parms.getString("action_type");
+		if (actionType != null && actionType.equals("Detail")) {
+		    parms.putBoolean("request_communication",true);
+        } else if(actionType != null && (actionType.equals("Tracing") || actionType.equals("Tracking"))) {
+			parms.putBoolean("request_location",true);
+		}
+
+//		parms.putString("sessionid", ApexTrackingApplication.get_sessionid());
+		String jstr = getJson(OnlineDataProvider.URL_REQUEST_RECORDS, parms);
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return null;
+		}
+		JSONObject jsobj;
+		//
+		// array = new JSONArray(json);
+		try
+		{
+			jsobj = new JSONObject(jstr);
+			if (jsobj.length() > 0)
+			{
+				int iresult = jsobj.getInt("result");
+				if (iresult == OnlineDataProvider.AP_SESSION_EXPIRED)
+				{
+					Log.e(TAG, "AP_SESSION_EXPIRED");
+					String user, pass;
+					user = TradeFilingApplication.get_user();
+					pass = TradeFilingApplication.get_pass();
+					OnlineDataProvider.get_Auth(user, pass);
+					jstr = getJson(OnlineDataProvider.URL_REQUEST_RECORDS, parms);
+					jsobj = new JSONObject(jstr);
+					iresult = jsobj.getInt("result");
+				}
+				if (iresult != OnlineDataProvider.AP_USER_AUTH)
+				{
+					// session expired
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return null;
+					// if (get_Auth(name, password) == RESULT_TRUE)
+					// {
+					// return get_records(name, password, parms);
+					//
+					// }
+					// else
+					// {
+					//
+					// Log.d(TAG,
+					// "USER NOT AUTHORIZED CODE="
+					// + jsobj.getInt("result"));
+					// return null;
+					// }
+				}
+				else
+				{
+					TradeFilingApplication.SetAuthorizeStatus(true);
+					return jstr;
+				}
+			}
+			else
+			{
+				Log.d(TAG, "json is wrong");
+				return null;
+			}
+		}
+		catch (JSONException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+
+		// return RESULT_ERROR;
+	}
+
+	public static int get_Auth(String name, String password)
+	{
+
+		String TAG = "net_dbg@get_Auth";
+//		Log.d(TAG, "u:" + name + ";p:" + password);
+		if (!OnlineDataProvider.NetworkIsAvailable())
+		{
+			Log.d(TAG, "network not available!");
+			return OnlineDataProvider.RESULT_NET_NOTAVAILABLE; // network not available
+		}
+		Bundle parms = new Bundle();
+		parms.putString("user", name);
+		parms.putString("password", password);
+		parms.putString("action", "handset_login");
+		int ver = TradeFilingApplication
+				.get_instance()
+				.getSharedPreferences(name + "_Apex_auth", Context.MODE_PRIVATE)
+				.getInt("AuthInfoVer", 0);
+		parms.putString("auth_ver", ver + "");
+		String jstr = getJson(OnlineDataProvider.URL_UPDATE_AUTH, parms);
+		/*
+		 * error occur while get authorization info from server. include can not
+		 * reach server , wrong parms ,server get wrong , etc.
+		 */
+		if (jstr == null || jstr.length() <= 0)
+		{
+			Log.d(TAG, "json is wrong");
+			return OnlineDataProvider.RESULT_NET_ERROR;
+		}
+
+		return parse_authinfo(jstr, name, password, parms);
+	}
+
+	private static int parse_authinfo(String json, String user, String pass, Bundle parms)
+	{
+		if(true)
+			throw new AssertionError("OnlineDataProvider::parse_authinfo not impl");
+		String TAG = "net_dbg@parse_authinfo";
+		Log.d(TAG, json);
+		// JSONArray array;
+		JSONObject jsobj;
+		SQLiteDatabase db = null;
+		try
+
+		{
+
+			// array = new JSONArray(json);
+			jsobj = new JSONObject(json);
+			if (jsobj.length() > 0)
+			{
+				// JSONObject objresult = jsobj.get.getJSONObject(0);// result
+				// the
+				// server result
+				// ;
+				if (jsobj.getInt("result") != OnlineDataProvider.AP_USER_AUTH)
+				{
+					TradeFilingApplication.logout();
+					// user not authorized return
+					Log.d(TAG,
+							"USER NOT AUTHORIZED CODE="
+									+ jsobj.getInt("result"));
+					return RESULT_FALSE;
+				}
+
+				JSONObject objheader = jsobj.getJSONObject("header");
+				String required_ver = objheader.getString("client_ver");
+				//String ver = objheader.getString("ver");
+				String current_ver = TradeFilingApplication.get_instance()
+						.getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
+				if (current_ver.compareTo(required_ver) < 0)
+					return RESULT_VER_LOW;
+				// JSONObject objsessionid = jsobj.getJSONObject(1); // session
+				// id
+				// on
+				// server;
+				// ApexTrackingApplication.put_sessionid(objheader
+				// .getString("sessionid"));
+				// ApexTrackingApplication.put_user(user);
+				// ApexTrackingApplication.put_password(pass);
+				// ApexTrackingApplication.put_authorization(true);
+				TradeFilingApplication.login(
+						user, pass,jsobj);
+//				Log.d(TAG, "sessionid=" + objheader.getString("sessionid"));
+				// JSONObject objupdate = array.getJSONObject(3); // whether
+				// need
+				// update ;
+				if (objheader.getBoolean("update") == false)
+				{
+					// no update on the server;
+					return RESULT_TRUE;
+				}
+				// JSONObject objver = array.getJSONObject(4); // new version
+				// get
+				// from server;
+
+				Editor editor = TradeFilingApplication
+						.get_instance()
+						.getSharedPreferences(user + "_Apex_auth",
+								Context.MODE_PRIVATE).edit();
+
+				editor.putInt("AuthInfoVer", objheader.getInt("ver"));
+				JSONObject objfuncs = jsobj.getJSONObject("functions");
+				Iterator<?> it = objfuncs.keys();
+//				db = dbUtil.OpenDB(TradeFilingApplication.get_instance(),
+//						null, true);
+//				String sql = "insert into fields_info(name,aname,field_type,function_name,behavior,priority,show,user) values(?,?,?,?,?,?,?,?)";
+//				String sql1 = "insert into actions_info(name,function_name,user,priority) values(?,?,?,?)";
+//
+//				SQLiteStatement stat = db.compileStatement(sql);
+//				SQLiteStatement stat1 = db.compileStatement(sql1);
+//
+//				db.beginTransaction();
+//				db.execSQL("update fields_info set abandon = 1 where user ='"
+//						+ user + "'");
+//				db.execSQL("update actions_info set abandon = 1 where user ='"
+//						+ user + "'");
+//
+//				String field_name, field_type, alias_name;
+//				while (it.hasNext()) // loop for each function
+//				{
+//					String func_name = (String) it.next();
+//
+//					// Set<String> funset = new HashSet<String>();
+//					JSONObject objfun = objfuncs.getJSONObject(func_name);
+//					int behavior, priority = 999;
+//					int show = 1;
+//					JSONObject objbehavior = objfun.getJSONObject("search");
+//					Iterator<?> itbehavior = objbehavior.keys();
+//					behavior = BEHAVIOR_SEARCH;
+//					while (itbehavior.hasNext()) // loop for search fields in
+//													// certain function
+//					{
+//						String field = (String) itbehavior.next();
+//						JSONObject field_info = objbehavior
+//								.getJSONObject(field);
+//						field_name = field_info.getString("name");
+//						field_type = field_info.getString("type");
+//						alias_name = field_info.getString("alias");
+//						priority = field_info.getInt("priority");
+//						if (priority == 999)
+//							show = 0;
+//						else
+//							show = 1;
+//						int id = dbUtil.get_recordid(db, "fields_info",
+//								"name='" + field_name + "' and behavior="
+//										+ behavior + " and function_name='"
+//										+ func_name + "' and user='" + user
+//										+ "'");
+//						if (id >= 0) // record exist;
+//						{
+//							db.execSQL("update fields_info set abandon = 0 where _id ="
+//									+ id);
+//						}
+//						else
+//						{
+//							stat.bindString(1, field_name);
+//							stat.bindString(2, alias_name);
+//							stat.bindString(3, field_type);
+//							stat.bindString(4, func_name);
+//							stat.bindLong(5, behavior);
+//							stat.bindLong(6, priority);
+//							stat.bindLong(7, show);
+//							stat.bindString(8, user);
+//							stat.executeInsert();
+//						}
+//					}
+//
+//					objbehavior = objfun.getJSONObject("result");
+//					Iterator<?> itresult = objbehavior.keys();
+//					behavior = BEHAVIOR_RESULT;
+//					while (itresult.hasNext()) // loop for result fields in
+//												// certain function
+//					{
+//						String field = (String) itresult.next();
+//						JSONObject field_info = objbehavior
+//								.getJSONObject(field);
+//						field_name = field_info.getString("name");
+//						field_type = field_info.getString("type");
+//						alias_name = field_info.getString("alias");
+//						priority = field_info.getInt("priority");
+//						if (priority == 999)
+//							show = 0;
+//						else
+//							show = 1;
+//						int id = dbUtil.get_recordid(db, "fields_info",
+//								"name='" + field_name + "' and behavior="
+//										+ behavior + " and function_name='"
+//										+ func_name + "' and user='" + user
+//										+ "'");
+//						if (id >= 0) // record exist;
+//						{
+//							db.execSQL("update fields_info set abandon = 0 where _id ="
+//									+ id);
+//						}
+//						else
+//						{
+//							stat.bindString(1, field_name);
+//							stat.bindString(2, alias_name);
+//							stat.bindString(3, field_type);
+//							stat.bindString(4, func_name);
+//							stat.bindLong(5, behavior);
+//							stat.bindLong(6, priority);
+//							stat.bindLong(7, show);
+//							stat.bindString(8, user);
+//							stat.executeInsert();
+//						}
+//					}
+//
+//					// objfun.has("actions")
+//					objbehavior = objfun.getJSONObject("actions");
+//					Iterator<?> itactions = objbehavior.keys();
+//					// behavior = BEHAVIOR_RESULT;
+//					while (itactions.hasNext()) // loop for result fields in
+//												// certain function
+//					{
+//						String actionname = (String) itactions.next();
+//						int action_priority = objbehavior.getInt(actionname);
+//
+//						int id = dbUtil.get_recordid(db, "actions_info",
+//								"name='" + actionname + "' and function_name='"
+//										+ func_name + "' and user='" + user
+//										+ "'");
+//						if (id >= 0) // record exist;
+//						{
+//							db.execSQL("update actions_info set abandon = 0 , priority="
+//									+ action_priority + " where _id =" + id);
+//						}
+//						else
+//						{
+//							stat1.bindString(1, actionname);
+//							stat1.bindString(2, func_name);
+//							stat1.bindString(3, user);
+//							stat1.bindLong(4, action_priority);
+//							stat1.executeInsert();
+//
+//						}
+//					}
+//				}
+//				db.execSQL("delete from fields_info where abandon = 1");
+//				db.execSQL("delete from actions_info where abandon = 1");
+//				db.setTransactionSuccessful();
+//				db.endTransaction();
+//				editor.commit();
+//
+//				// 删除Result固定显示字段 及 更新显示最多三条
+//				dbUtil.deleteResultFields(db);
+//				dbUtil.updateResultDisplayFields(db);
+
+				return RESULT_TRUE;
+			}
+			Log.d(TAG, "json is wrong");
+			return RESULT_USERAUTH_ERROR;
+		}
+		catch (JSONException e1)
+		{
+			// TODO Auto-generated catch block
+			TradeFilingApplication.logout();
+			
+			
+			parms.putString("module_name", "Log");
+			parms.putString("action_type", "save");
+			parms.putString("return", json);
+			
+			String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
+			
+			e1.printStackTrace();
+			Log.d(TAG, "json is wrong");
+		}
+		catch (NameNotFoundException e)
+		{
+			// TODO Auto-generated catch block
+
+			TradeFilingApplication.logout();
+			
+			
+			parms.putString("module_name", "Log");
+			parms.putString("action_type", "save");
+			parms.putString("return", json);
+			String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
+			e.printStackTrace();
+		}
+		finally
+		{
+//			dbUtil.CloseDB(db);
+		}
+
+		// try
+		// {
+		// m_RemoteVerCode = Integer
+		// .parseInt(obj.getString("verCode"));
+		// m_RemoteVerName = obj.getString("verName");
+		// m_NewVerUrl = obj.getString("URL");
+		// }
+		// catch (Exception e)
+		// {
+		// m_RemoteVerCode = -1;
+		// m_RemoteVerName = "";
+		// m_NewVerUrl = "";
+		// dbgUtil.Log(Log.INFO,TAG, "download failed json file wrong!");
+		// return false;
+		// }
+		Log.d(TAG, "json is wrong");
+		return RESULT_USERAUTH_ERROR;
+	}
+
+	// private void writeData(JSONObject allData)
+	// {
+	//
+	// File file = new File(Environment.getExternalStorageDirectory()
+	// .toString() + File.separator + "live.txt");
+	// if (!file.exists())
+	// {
+	// try
+	// {
+	// file.createNewFile();
+	// }
+	// catch (IOException e)
+	// {
+	// e.printStackTrace();
+	// }
+	// }
+	// FileOutputStream fos;
+	// OutputStreamWriter osw = null;
+	// try
+	// {
+	// fos = new FileOutputStream(file);
+	//
+	// osw = new OutputStreamWriter(fos, "UTF-8");
+	// osw.write(allData.toString());
+	// osw.flush();
+	// }
+	// catch (FileNotFoundException e)
+	// {
+	// e.printStackTrace();
+	// }
+	// catch (UnsupportedEncodingException e)
+	// {
+	// e.printStackTrace();
+	// }
+	// catch (IOException e)
+	// {
+	// e.printStackTrace();
+	// }
+	// finally
+	// {
+	// if (osw != null)
+	// {
+	// try
+	// {
+	// osw.close();
+	// }
+	// catch (IOException e)
+	// {
+	// e.printStackTrace();
+	// }
+	// }
+	// }
+	// }
+
+	public static boolean NetworkIsAvailable()// Context context)
+	{
+		return com.usai.redant.rautils.utils.Network.isNetworkAvailable(TradeFilingApplication.get_instance());
+	}
+
+//	public static class SSLSocketFactoryEx extends SSLSocketFactory
+//	{
+//
+//		SSLContext	sslContext	= SSLContext.getInstance("TLS");
+//
+//		public SSLSocketFactoryEx(KeyStore truststore)
+//				throws NoSuchAlgorithmException, KeyManagementException,
+//				KeyStoreException, UnrecoverableKeyException
+//		{
+//			super(truststore);
+//
+//			TrustManager tm = new X509TrustManager()
+//			{
+//				public java.security.cert.X509Certificate[] getAcceptedIssuers()
+//				{
+//					return null;
+//				}
+//
+//				@Override
+//				public void checkClientTrusted(
+//						java.security.cert.X509Certificate[] chain,
+//						String authType)
+//						throws java.security.cert.CertificateException
+//				{
+//				}
+//
+////				@Override
+////				public void checkServerTrusted(
+////						java.security.cert.X509Certificate[] chain,
+////						String authType)
+////						throws java.security.cert.CertificateException
+////				{
+////				}
+////				@Override
+////				public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
+////	                try {
+////	                    chain[0].checkValidity();
+////	                } catch (java.security.cert.CertificateExpiredException e) {
+////	                   // Logger.e(TAG, "CertificateExpiredException");
+////	                    throw new java.security.cert.CertificateException("CertificateExpiredException");
+////	                } catch (java.security.cert.CertificateNotYetValidException e) {
+////	                    //Logger.e(TAG, "CertificateNotYetValidException");
+////	                    throw new java.security.cert.CertificateException("CertificateNotYetValidException");
+////	                }
+////	            }@Override
+////				public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
+////	                try {
+////	                    chain[0].checkValidity();
+////	                } catch (java.security.cert.CertificateExpiredException e) {
+////	                   // Logger.e(TAG, "CertificateExpiredException");
+////	                    throw new java.security.cert.CertificateException("CertificateExpiredException");
+////	                } catch (java.security.cert.CertificateNotYetValidException e) {
+////	                    //Logger.e(TAG, "CertificateNotYetValidException");
+////	                    throw new java.security.cert.CertificateException("CertificateNotYetValidException");
+////	                }
+////	            }
+//			};
+//			sslContext.init(null, new TrustManager[] { tm }, null);
+//		}
+//
+//		@Override
+//		public Socket createSocket(Socket socket, String host, int port,
+//				boolean autoClose) throws IOException, UnknownHostException
+//		{
+//			return sslContext.getSocketFactory().createSocket(socket, host,
+//					port, autoClose);
+//		}
+//
+//		@Override
+//		public Socket createSocket() throws IOException
+//		{
+//			return sslContext.getSocketFactory().createSocket();
+//		}
+//	}
+
+	public static class SSLSocketFactoryEx extends SSLSocketFactory
+	{
+
+		SSLContext	sslContext	= SSLContext.getInstance("TLS");
+
+		public SSLSocketFactoryEx(KeyStore truststore)
+				throws NoSuchAlgorithmException, KeyManagementException,
+				KeyStoreException, UnrecoverableKeyException
+		{
+			super(truststore);
+
+			TrustManager tm = new X509TrustManager()
+			{
+				public java.security.cert.X509Certificate[] getAcceptedIssuers()
+				{
+					return null;
+				}
+
+				@Override
+				public void checkClientTrusted(
+						java.security.cert.X509Certificate[] chain,
+						String authType)
+						throws java.security.cert.CertificateException
+				{
+				}
+
+				//				@Override
+//				public void checkServerTrusted(
+//						java.security.cert.X509Certificate[] chain,
+//						String authType)
+//						throws java.security.cert.CertificateException
+//				{
+//				}
+				@Override
+				public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
+					try {
+						chain[0].checkValidity();
+					} catch (java.security.cert.CertificateExpiredException e) {
+						// Logger.e(TAG, "CertificateExpiredException");
+						throw new java.security.cert.CertificateException("CertificateExpiredException");
+					} catch (java.security.cert.CertificateNotYetValidException e) {
+						//Logger.e(TAG, "CertificateNotYetValidException");
+						throw new java.security.cert.CertificateException("CertificateNotYetValidException");
+					}
+				}
+			};
+			sslContext.init(null, new TrustManager[] { tm }, null);
+		}
+
+		@Override
+		public Socket createSocket(Socket socket, String host, int port,
+								   boolean autoClose) throws IOException, UnknownHostException
+		{
+			return sslContext.getSocketFactory().createSocket(socket, host,
+					port, autoClose);
+		}
+
+		@Override
+		public Socket createSocket() throws IOException
+		{
+			return sslContext.getSocketFactory().createSocket();
+		}
+	}
+
+	public static File downloadFile(Bundle params, String download_url,String dir) {
+		prepare_addtional_params(params);
+		return com.usai.redant.rautils.utils.Network.downloadFile(params, download_url, dir);
+	}
+
+	public static File download_query(String download_url,String path) {
+
+		return downloadFile(null,download_url,path);
+	}
+
+	public  static JSONObject query(Bundle params) {
+
+		params.putString("action","handset_search");
+
+		String jstr = getJson(OnlineDataProvider.URL_REQUEST_COUNT, params);
+		try {
+
+			if (jstr == null || jstr.length() <= 0)
+			{
+				JSONObject resultJson = new JSONObject();
+				resultJson.put("err_msg","Net Error. Cannot connect to server for now. Please retry later.");
+				resultJson.put("result",RESULT_NET_ERROR);
+				return resultJson;
+			}
+
+			JSONObject jsobj = new JSONObject(jstr);
+			return jsobj;
+
+		} catch (JSONException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
+	public static JSONObject request_result(Bundle params)
+	{
+		return null;
+	}
+	public static JSONObject request_home() {
+
+		Bundle params = new Bundle();
+		params.putString("action","hand_new_home_list");
+		params.putBoolean("request_location",true);
+		boolean personMode = TradeFilingApplication.get_instance().getPersonMode();
+		if (personMode) {
+			params.putString("personal_mode","true");
+		} else {
+			params.putString("personal_mode","false");
+		}
+
+		String jstr = getJson(URL_HOME,params);
+		Log.d("Network", "request_home: " + jstr);
+		try {
+
+			if (jstr == null || jstr.length() <= 0)
+			{
+				JSONObject resultJson = new JSONObject();
+				resultJson.put("err_msg","Net Error. Cannot connect to server for now. Please retry later.");
+				resultJson.put("result",RESULT_NET_ERROR);
+				return resultJson;
+			}
+
+			JSONObject jsobj = new JSONObject(jstr);
+			return jsobj;
+
+		} catch (JSONException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
+	public static JSONObject request_KPI() {
+
+		Bundle params = new Bundle();
+		params.putString("action","hand_new_kpi");
+
+		boolean personMode = TradeFilingApplication.get_instance().getPersonMode();
+		if (personMode) {
+			params.putString("personal_mode","true");
+		} else {
+			params.putString("personal_mode","false");
+		}
+
+		String jstr = getJson(URL_KPI,params);
+		Log.d("Network", "request_kpi: " + jstr);
+		try {
+
+			if (jstr == null || jstr.length() <= 0)
+			{
+				JSONObject resultJson = new JSONObject();
+				resultJson.put("err_msg","Net Error. Cannot connect to server for now. Please retry later.");
+				resultJson.put("result",RESULT_NET_ERROR);
+				return resultJson;
+			}
+
+			JSONObject jsobj = new JSONObject(jstr);
+			return jsobj;
+
+		} catch (JSONException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
+	public static JSONObject request_history(Bundle params) {
+
+		if (params == null) {
+			params = new Bundle();
+		}
+		params.putString("action","hand_new_home_list_all");
+
+		boolean personMode = TradeFilingApplication.get_instance().getPersonMode();
+		if (personMode) {
+			params.putString("personal_mode","true");
+		} else {
+			params.putString("personal_mode","false");
+		}
+
+		String jstr = getJson(URL_HISTORY,params);
+		Log.d("Network", "request_home: " + jstr);
+		try {
+
+			if (jstr == null || jstr.length() <= 0)
+			{
+				JSONObject resultJson = new JSONObject();
+				resultJson.put("err_msg","Net Error. Cannot connect to server for now. Please retry later.");
+				resultJson.put("result",RESULT_NET_ERROR);
+				return resultJson;
+			}
+
+			JSONObject jsobj = new JSONObject(jstr);
+			return jsobj;
+
+		} catch (JSONException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
+	public static JSONObject sendEmail(String email,String cc, String serialNo) {
+
+		Bundle params = new Bundle();
+		if (email == null) {
+			email = "";
+		}
+		if (serialNo == null) {
+			serialNo = "";
+		}
+
+		params.putString("msg",email);
+		params.putString("action","handset_search");
+		params.putString("action_type","save_communication_email");
+		params.putString("serial_no",serialNo);
+
+		if (cc != null) {
+			params.putString("cc",cc);
+		}
+		String jstr = getJson(URL_SEND_COMM_EMAIL,params);
+
+		return handleResponse(jstr);
+	}
+
+	private static JSONObject handleResponse(String jstr) {
+
+		try {
+
+			if (jstr == null || jstr.length() <= 0)
+			{
+				JSONObject resultJson = new JSONObject();
+				resultJson.put("err_msg","Net Error. Cannot connect to server for now. Please retry later.");
+				resultJson.put("result",RESULT_NET_ERROR);
+				return resultJson;
+			}
+
+			JSONObject jsobj = new JSONObject(jstr);
+			return jsobj;
+
+		} catch (JSONException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+
+	}
+
+	public static String checkUpdate(Context context) {
+
+		if (context == null) {
+			return null;
+		}
+		String  ver_name = null;
+		int ver_code = -1;
+		try {
+			// ---get the package info---
+			PackageManager pm = context.getPackageManager();
+			PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
+			ver_name = pi.versionName;
+			ver_code = pi.versionCode;
+
+		} catch (Exception e) {
+			Log.e("VersionInfo", "Exception", e);
+		}
+
+		if (ver_name == null || ver_name.length() <= 0) {
+			return null;
+		}
+
+		Bundle params = new Bundle();
+		params.putString("ver",ver_name);
+		params.putString("action","current_ver");
+
+		String jsonStr = getJson(URL_CHECK_UPDATE,params);
+
+//		String jsonStr = "{\"ver\":\"2.2.1.180519\",\"url\":\"http://192.168.0.130/Apex Mobile.apk\"}";
+
+		return jsonStr;
+	}
+
+	public static JSONObject uploadUserSql(String sql) {
+
+		Bundle params = new Bundle();
+
+		if (sql == null) {
+			sql = "";
+		}
+
+		params.putString("action","handset_search");
+		params.putString("sql",sql);
+
+		String jstr = getJson(URL_UPLOAD_SQL,params);
+
+		return handleResponse(jstr);
+	}
+
+	public static JSONObject fetchResult(Bundle params) {
+
+		if(true)
+			throw new AssertionError("OnlinedataProvider::fetchResult not impl");
+		return null;
+//
+//
+//		params.putString("action","handset_search");
+//
+//		String module_name = params.getString("module_name");
+//
+//
+////		String url = "http://192.168.1.151:8080/MyWeb/SearchBooking";
+////
+////		if (module_name.equals("Ocean Booking")) {
+////
+////		} else if (module_name.equals("Ocean B/L info.")) {
+////
+////			url = "http://192.168.1.151:8080/MyWeb/SearchBL";
+////		} else if (module_name.equals("Container detail")) {
+////
+////			url = "http://192.168.1.151:8080/MyWeb/SearchContainer";
+////		} else if (module_name.equals("Download Document")) {
+////
+////			url = "http://192.168.1.151:8080/MyWeb/SearchDoc";
+////		}
+////
+////		try {
+////			Thread.sleep(2000);
+////		} catch (InterruptedException e) {
+////			e.printStackTrace();
+////		}
+//
+//		String url = URL_FETCH_RESULT;
+//		// URL_FETCH_RESULT
+//		String jstr = getJson(url, params);
+//
+//		JSONObject json = handleResponse(jstr);
+//		if (json != null) {
+//
+//			JSONArray actions = dbUtil.getActionsForFunction(module_name, TradeFilingApplication.get_user());
+//			try {
+//				json.put("actions", actions);
+//			} catch (JSONException e) {
+//				e.printStackTrace();
+//			}
+//		}
+//		return json;
+
+	}
+
+	public static JSONObject saveSearchParametersForModuleWithName(String intentStr, String paramStr, String module, String name) {
+
+
+		if(true)
+			throw new AssertionError("OnlinedataProvider::saveSearchParametersForModuleWithName not impl");
+		return null;
+//
+//		boolean success = true;
+//		try {
+//			SQLiteDatabase db = dbUtil.OpenDB(TradeFilingApplication.get_instance(), null, true);
+//
+//			db.execSQL("insert into history(params,name,criterion,module_name,user,create_time) values('"
+//					+ intentStr
+//					+ "','"
+//					+ name
+//					+ "','"
+//					+ paramStr
+//					+ "','"
+//					+ module
+//					+ "','"
+//					+ TradeFilingApplication.get_user()
+//					+ "',"
+//					+ System.currentTimeMillis() + ")");
+//			dbUtil.CloseDB(db);
+//
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//			success = false;
+//		}
+//
+//		JSONObject json = new JSONObject();
+//
+//		try {
+//			if (success) {
+//
+//				json.put("result", RESULT_TRUE);
+//				json.put("err_msg", "save success.");
+//
+//			} else {
+//
+//				json.put("result", RESULT_FALSE);
+//				json.put("err_msg", "Sorry, something is wrong.");
+//			}
+//		} catch (JSONException e) {
+//			e.printStackTrace();
+//		}
+//
+//		return json;
+	}
+
+	public static String getDisplayFieldsForFunction(String function) {
+
+
+		if(true)
+			throw new AssertionError("OnlinedataProvider::getDisplayFieldsForFunction not impl");
+		return null;
+
+//		String user = TradeFilingApplication.get_user();
+//		return dbUtil.getDisplayFieldsForFunction(function, user);
+
+	}
+}

+ 237 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/dataprovider/RADataProvider.java

@@ -0,0 +1,237 @@
+package com.usai.ratradefiling.dataprovider;
+
+import android.os.Bundle;
+
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.redant.rautils.utils.FileManager;
+import com.usai.redant.rautils.utils.RAUtil;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+
+import static com.usai.ratradefiling.Const.FAKE_DATA;
+
+public class RADataProvider {
+    //
+//    public static final int		RESULT_FALSE					= 0;
+//    public static final int		RESULT_TRUE						= 2;
+//    public static final int		RESULT_NET_ERROR				= -3;
+//    public static final int		RESULT_NET_NOTAVAILABLE			= -4;
+//    public static final int		RESULT_ERROR					= -5;
+//    public static final int		RESULT_LOCALFILE_ERROR			= -7;
+//    public static final int		RESULT_USERAUTH_ERROR			= -9;
+//    public static final int		RESULT_UPDATE_USERAUTH_ERROR	= -11;
+//    public static final int		RESULT_SESSION_EXPIRED			= -13;
+//    public static final int		RESULT_VER_LOW					= -15;
+    public static int retrieve_pass(String user, String email)
+    {
+        return 0;
+    }
+    public static JSONObject saveSearchParametersForModuleWithName(String intentStr, String paramStr, String module, String name) {
+        return null;
+    }
+    public static File downloadFile(Bundle params, String download_url,String dir) {
+        return null;
+    }
+    public static String getDisplayFieldsForFunction(String module_name)
+    {
+        return null;
+    }
+
+    public static JSONObject Search(Bundle params)
+    {
+        if(FAKE_DATA)
+        {
+            return OfflineDataProvider.request_result(params);
+        }
+        else {
+            return OnlineDataProvider.request_result(params);
+        }
+    }
+
+    public static JSONObject LoadHome()
+    {
+        if(FAKE_DATA)
+        {
+            return OfflineDataProvider.request_home();
+        }
+        else {
+            return OnlineDataProvider.request_home();
+        }
+    }
+    public static JSONObject Login(String user, String password)
+    {
+        if(FAKE_DATA)
+        {
+            return OfflineDataProvider.request_login(user,password);
+        }
+        else
+        {
+            return OnlineDataProvider.request_login(user,password);
+        }
+
+    }
+
+
+    public static JSONObject updateFunctionPanel()
+    {
+
+//        File dir=TradeFilingApplication.get_instance().getFilesDir();
+
+
+
+        String userfilePath = TradeFilingApplication.get_instance().getFilesDir().getPath()+"/FunctionPanel_"+TradeFilingApplication.get_instance().get_user()+".json";
+        String  json_user=FileManager.readJson(userfilePath);
+        if(json_user!=null)
+        {
+
+
+            JSONObject dict = TradeFilingApplication.get_instance().get_functionPanel();
+
+
+            JSONObject dict_user = null;
+            try {
+                dict_user = new JSONObject(json_user);
+
+                if(dict_user.optInt("ver")<dict.optInt("ver"))
+                {
+                    dict_user=dict;
+
+                    FileManager.writeJson(dict_user.toString(),userfilePath);
+                }
+//                    dict_user.put("ver",dict.optInt("ver"));
+//
+//                    JSONArray  arr_add=dict
+//
+//                    NSMutableArray* user_deactive=[dict_user[@"deactive_functions"] mutableCopy];
+//                    NSMutableArray* user_active=[dict_user[@"active_functions"] mutableCopy];
+//                    for(int i=0;i<arr_add.count;i++)
+//                    {
+//                [user_deactive addObject:arr_add[i]];
+//
+//                    }
+//                    NSArray * arr_remove=dict[@"remove"];
+//                    for(int i=0;i<arr_remove.count;i++)
+//                    {
+//                [user_deactive removeObject:arr_remove[i]];
+//                [user_active removeObject:arr_remove[i]];
+//
+//                    }
+//                    dict_user[@"deactive_functions"] = user_deactive;
+//                    dict_user[@"active_functions"] = user_active;
+//                    json_user =[RAConvertor dict2data:dict_user];
+//                    bool result =[json_user writeToFile:[docDir stringByAppendingPathComponent:[NSString stringWithFormat:@"FunctionPanel_%@.json",RASingleton.sharedInstance.user]]  atomically:true];
+//                }
+
+
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+
+
+
+
+            return dict_user;
+        }
+        else
+        {
+            JSONObject dict=null;
+            dict= TradeFilingApplication.get_instance().get_functionPanel();
+
+            FileManager.writeJson(dict.toString(),userfilePath);
+
+            return dict;
+        }
+
+
+//        JSONObject json_user=RAUtil.getJsonFromAsset(TradeFilingApplication.get_instance(),"FunctionPanel_"+TradeFilingApplication.get_instance().get_user()+".json");
+
+    }
+
+    public static void saveFieldsJson(String type, String subtype,JSONObject json)
+    {
+
+    }
+    public static JSONObject updateFieldsjson(String type, String subtype)
+    {
+
+//        File dir=TradeFilingApplication.get_instance().getFilesDir();
+
+
+
+        String userfilePath = TradeFilingApplication.get_instance().getFilesDir().getPath()+"/"+type+"_"+subtype+"_"+TradeFilingApplication.get_instance().get_user()+".json";
+        String  json_user=FileManager.readJson(userfilePath);
+        if(json_user!=null)
+        {
+
+
+            JSONObject dict = TradeFilingApplication.get_instance().get_fields(type, subtype);
+
+            if(dict==null)
+                return null;
+
+//            JSONObject dict = fields.getJSONObject(type).getJSONObject(subtype)
+
+            JSONObject dict_user = null;
+            try {
+                dict_user = new JSONObject(json_user);
+
+                if(dict_user.optInt("ver")<dict.optInt("ver"))
+                {
+                    dict_user=dict;
+
+                    FileManager.writeJson(dict_user.toString(),userfilePath);
+                }
+//                    dict_user.put("ver",dict.optInt("ver"));
+//
+//                    JSONArray  arr_add=dict
+//
+//                    NSMutableArray* user_deactive=[dict_user[@"deactive_functions"] mutableCopy];
+//                    NSMutableArray* user_active=[dict_user[@"active_functions"] mutableCopy];
+//                    for(int i=0;i<arr_add.count;i++)
+//                    {
+//                [user_deactive addObject:arr_add[i]];
+//
+//                    }
+//                    NSArray * arr_remove=dict[@"remove"];
+//                    for(int i=0;i<arr_remove.count;i++)
+//                    {
+//                [user_deactive removeObject:arr_remove[i]];
+//                [user_active removeObject:arr_remove[i]];
+//
+//                    }
+//                    dict_user[@"deactive_functions"] = user_deactive;
+//                    dict_user[@"active_functions"] = user_active;
+//                    json_user =[RAConvertor dict2data:dict_user];
+//                    bool result =[json_user writeToFile:[docDir stringByAppendingPathComponent:[NSString stringWithFormat:@"FunctionPanel_%@.json",RASingleton.sharedInstance.user]]  atomically:true];
+//                }
+
+
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+
+
+
+
+            return dict_user;
+        }
+        else
+        {
+            JSONObject dict=null;
+            dict = TradeFilingApplication.get_instance().get_fields(type, subtype);
+
+            FileManager.writeJson(dict.toString(),userfilePath);
+
+            return dict;
+        }
+
+
+//        JSONObject json_user=RAUtil.getJsonFromAsset(TradeFilingApplication.get_instance(),"FunctionPanel_"+TradeFilingApplication.get_instance().get_user()+".json");
+
+    }
+
+}

+ 783 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailActivity.java

@@ -0,0 +1,783 @@
+package com.usai.ratradefiling.detail;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ExpandableListView;
+import android.widget.ListView;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.base.BasicActivity;
+import com.usai.ratradefiling.detail.model.DetailActionSelectionModel;
+import com.usai.ratradefiling.detail.model.DetailSubActionModel;
+//import com.usai.ratradefiling.network.Network;
+//import com.usai.ratradefiling.update.UpdateActivity;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeAccept;
+import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeEnum;
+import static com.usai.ratradefiling.detail.model.DetailSubActionModel.DetailActionSubType.DetailActionSubTypeUpdate;
+
+public class DetailActivity extends BasicActivity  {
+
+
+    private final static String IntentOrderIDKey = "orderID";
+    private final static  String IntentOrderStatusKey = "orderStatus";
+    private final static  String IntentOrderType2Key = "orderType2";
+    private final static  String IntentStatusNoKey = "statusNo";
+
+    private final static  String SaveDataKey = "DetailSaveJSON";
+    private final static  String SaveOrderIDKey = "DetailSaveOrderID";
+    private final static  String SaveOrderStatusKey = "DetailSaveOrderStatus";
+    private final static  String SaveOrderType2Key = "DetailSaveOrderType2";
+    private final static  String SaveStatusNo2Key = "DetailSaveStatusNo";
+    private final static  String SavedLoadKey = "DetailSaveLoad";
+    private final static  String SavedFirstVisible = "SavedFirstVisible";
+
+    public final static String CheckDetailNotification = "com.usai.redant.apexdriver.CheckDetailNotification";
+
+    public static Intent build(Context context, String orderID,int status,String type2,String statusNo) {
+
+        if (context == null) {
+            return null;
+        }
+
+        Intent intent = new Intent(context,DetailActivity.class);
+        if (orderID != null) {
+            intent.putExtra(IntentOrderIDKey,orderID);
+        }
+        if (type2 != null) {
+            intent.putExtra(IntentOrderType2Key,type2);
+        }
+        if (statusNo != null) {
+            intent.putExtra(IntentStatusNoKey,statusNo);
+        }
+
+        intent.putExtra(IntentOrderStatusKey,status);
+        return intent;
+    }
+
+    private String mOrderID;
+    private String mOrderType2;
+    private String mStatusNo;
+    private int mOrderStatus;
+
+    private Context mCtx = this;
+    private DetailActivity self = this;
+    private ExpandableListView mListView;
+    private SwipeRefreshLayout mRefresh;
+    private DetailAdapter mAdapter;
+    private ArrayList<DetailSectionModel> mSectionArray = new ArrayList<>();
+    private JSONObject mJson;
+
+    private DetailHandler mHandler;
+    private TextView mEmptyView;
+    private boolean mLoad = false;
+    private int mFirstVisible = 0;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+//        setContentView(R.layout.activity_detail);
+//
+//        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+//        if(actionBar != null){
+//            actionBar.setHomeButtonEnabled(true);
+//            actionBar.setDisplayHomeAsUpEnabled(true);
+//        }
+//
+//        setTitle(getString(R.string.detail_title));
+//
+//        if (getIntent() != null) {
+//            mOrderID = getIntent().getStringExtra(IntentOrderIDKey);
+//            mOrderType2 = getIntent().getStringExtra(IntentOrderType2Key);
+//            mOrderStatus = getIntent().getIntExtra(IntentOrderStatusKey,0);
+//            mStatusNo = getIntent().getStringExtra(IntentStatusNoKey);
+//        }
+//
+//        mHandler = new DetailHandler(this);
+//
+//        mListView = findViewById(R.id.detail_list_view);
+//        mAdapter = new DetailAdapter(mCtx,self,mSectionArray);
+//
+//        mListView.setAdapter(mAdapter);
+//        mListView.setGroupIndicator(null);
+//        mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
+//            @Override
+//            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
+//                return true; // 不允许GroupView点击
+//            }
+//        });
+//
+//        mRefresh = findViewById(R.id.detail_refresh);
+//        mRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+//            @Override
+//            public void onRefresh() {
+//                loadData();
+//            }
+//        });
+//
+//        mEmptyView = findViewById(R.id.detail_empty_btn);
+//        mEmptyView.setText(getString(R.string.empty_msg));
+//        mEmptyView.setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                loadData();
+//            }
+//        });
+//        mListView.setEmptyView(findViewById(R.id.detail_empty_view));
+//
+//        mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
+//            @Override
+//            public void onScrollStateChanged(AbsListView view, int scrollState) {
+//
+//            }
+//
+//            @Override
+//            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+//
+//                mFirstVisible = firstVisibleItem;
+//            }
+//        });
+//
+//        if (savedInstanceState != null) {
+//
+//            String jsonStr = savedInstanceState.getString(SaveDataKey);
+//            if (jsonStr != null) {
+//
+//                try {
+//
+//                    JSONObject json = new JSONObject(jsonStr);
+//
+//                    handleJson(json);
+//                    changeData();
+//
+//                } catch (JSONException e) {
+//                    e.printStackTrace();
+//                }
+//
+//            }
+//
+//            mOrderID = savedInstanceState.getString(SaveOrderIDKey);
+//            mOrderType2 = savedInstanceState.getString(SaveOrderType2Key);
+//            mOrderStatus = savedInstanceState.getInt(SaveOrderStatusKey);
+//            mStatusNo = savedInstanceState.getString(SaveStatusNo2Key);
+//            mLoad = savedInstanceState.getBoolean(SavedLoadKey);
+//
+//            final int tmpVisible = savedInstanceState.getInt(SavedFirstVisible);
+//            mListView.post(new Runnable() {
+//                @Override
+//                public void run() {
+//                    mListView.setSelection(tmpVisible);
+//                }
+//            });
+//
+//        } else {
+//            loadData();
+//        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case android.R.id.home:
+                this.finish(); // back button
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+
+        if (mJson != null) {
+            outState.putString(SaveDataKey,mJson.toString());
+        }
+        if (mOrderID != null) {
+            outState.putString(SaveOrderIDKey,mOrderID);
+        }
+        if (mOrderType2 != null) {
+            outState.putString(SaveOrderType2Key,mOrderType2);
+        }
+        outState.putInt(SaveOrderStatusKey,mOrderStatus);
+
+        if (mStatusNo != null) {
+            outState.putString(SaveStatusNo2Key,mStatusNo);
+        }
+
+        outState.putBoolean(SavedLoadKey,mLoad);
+        outState.putInt(SavedFirstVisible,mFirstVisible);
+
+        sendLifeCircleBroadCast(0);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        sendLifeCircleBroadCast(1);
+    }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        sendLifeCircleBroadCast(2);
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        sendLifeCircleBroadCast(3);
+    }
+    @Override
+    protected void onPause() {
+        sendLifeCircleBroadCast(4);
+        super.onPause();
+    }
+
+    @Override
+    public void onLowMemory() {
+        super.onLowMemory();
+        sendLifeCircleBroadCast(5);
+    }
+
+    @Override
+    protected void onDestroy() {
+
+        dismissProgressDialog();
+
+        sendLifeCircleBroadCast(6);
+
+        super.onDestroy();
+    }
+
+    private void sendLifeCircleBroadCast(int life) {
+
+//        Intent intent = new Intent(MapLifCircleAction);
+//        intent.putExtra("Life",life);
+//
+//        LocalBroadcastManager.getInstance(mCtx).sendBroadcast(intent);
+    }
+
+    private void goHome() {
+//        Intent intent = new Intent(self, ApexDriverApplication.sharedApplication().getMainActivityClass());
+//        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+//        self.startActivity(intent);
+//        Intent bintent=new Intent(HomeFragment.HomeReloadBroadcastAction);
+//        bintent.setPackage(getPackageName());
+//        sendBroadcast(bintent);
+    }
+
+    /**
+     * Data
+     * */
+
+    private ProgressDialog mProgressDialog;
+    private void showProgressDialog() {
+//        if (mProgressDialog == null) {
+//            mProgressDialog = new ProgressDialog(this);
+//            mProgressDialog.setMessage(getString(R.string.loading));
+//            mProgressDialog.setCancelable(false);
+//            mProgressDialog.show();
+//        }
+    }
+
+    private void dismissProgressDialog() {
+        if (mProgressDialog != null && mProgressDialog.isShowing()) {
+            mProgressDialog.dismiss();
+        }
+        mProgressDialog = null;
+    }
+
+    private void showWarningMsg(String msg) {
+        if (msg == null || msg.length() == 0) {
+            return;
+        }
+
+//        new AlertDialog.Builder(mCtx).setTitle(getString(R.string.warning))
+//                .setMessage(msg)
+//                .setPositiveButton(getString(R.string.btn_ok),null)
+//                .show();
+    }
+
+    private void handleJson(JSONObject json) {
+
+        try {
+            JSONArray sectionArr = json.optJSONArray("sections");
+            if (sectionArr != null) {
+
+                mJson = json;
+                mSectionArray.clear();
+
+                for (int i = 0; i < sectionArr.length(); i++) {
+
+                    JSONObject section = sectionArr.getJSONObject(i);
+                    DetailSectionModel model = new DetailSectionModel(mCtx);
+
+                    model.title = section.optString("title");
+                    model.setValues(section.optJSONArray("values"));
+
+                    mSectionArray.add(model);
+                }
+            }
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void changeData() {
+
+        /**
+         * 手动调用打开/关闭 Group,否则默认关闭
+         * */
+        if (mSectionArray.size() > 0) {
+            for (int i = 0; i < mSectionArray.size(); i++) {
+                mListView.expandGroup(i);
+            }
+        }
+
+        mAdapter.notifyDataSetChanged();
+
+    }
+
+    private void reload() {
+        loadData();
+    }
+
+    private void loadData() {
+        findViewById(R.id.label_cache).setVisibility(View.INVISIBLE);
+        showProgressDialog();
+
+        if (mSectionArray != null) {
+            mSectionArray.clear();
+        }
+        if (mAdapter != null) {
+            mAdapter.notifyDataSetChanged();
+        }
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+
+//                JSONObject json = com.usai.ratradefiling.network.Network.requestOrderDetail(mCtx,mOrderID,mOrderStatus,mOrderType2,mStatusNo);
+//                if(json.optBoolean("iscache"))
+//                {
+//                    runOnUiThread(new Runnable() {
+//                        @Override
+//                        public void run() {
+//                            findViewById(R.id.label_cache).setVisibility(View.VISIBLE);
+//                        }
+//                    });
+//
+//                }
+//                Message msg = new Message();
+//                msg.what = DetailHandler.DetailActionReloadData;
+//                msg.obj = json;
+//                mHandler.sendMessage(msg);
+            }
+
+        }).start();
+    }
+
+    private void handleRemoteAction(final DetailSubActionModel model) {
+
+        showProgressDialog();
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+
+//                JSONObject json = Network.report(mOrderID,mOrderStatus,model.actionSubType,model.index,model.actionTitle,model.url,model.params);
+//
+//                Message msg = new Message();
+//                msg.what = DetailHandler.DetailActionRemote;
+//                msg.obj = json;
+//                msg.arg1 = model.remoteActionType;
+//                mHandler.sendMessage(msg);
+
+            }
+        }).start();
+
+    }
+
+    private void handleEnumAction(View view,DetailSubActionModel actionModel) {
+
+//        showWindow(view,actionModel.enums);
+    }
+
+    private void showUpdate(DetailSubActionModel model) {
+
+//        Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2, model.index);
+//        mCtx.startActivity(intent);
+    }
+
+    /**
+     * Detail Action
+     * */
+
+//    @Override
+//    public void performAction(final View view, final DetailSubActionModel actionModel) {
+//
+//        if (actionModel == null) {
+//            return;
+//        }
+//
+//        if (actionModel.alert) {
+//
+////            new AlertDialog.Builder(mCtx)
+////                    .setTitle(actionModel.alertTitle)
+////                    .setMessage(actionModel.alertMsg)
+////                    .setNegativeButton(getString(R.string.btn_cancel),null)
+////                    .setPositiveButton(getString(R.string.btn_ok), new DialogInterface.OnClickListener() {
+////                        @Override
+////                        public void onClick(DialogInterface dialog, int which) {
+////                            handleAction(view,actionModel);
+////                        }
+////                    })
+////                    .show();
+//
+//        } else {
+//            handleAction(view,actionModel);
+//        }
+//
+//    }
+//
+//    @Override
+//    public void navigationTo(DetailLocationModel locationModel) {
+//
+//        if (locationModel != null && !TextUtils.isEmpty(locationModel.street)) {
+//
+//            Uri gmmIntentUri = Uri.parse("google.navigation:q=" + locationModel.street + "&mode=d");
+//            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
+//            mapIntent.setPackage("com.google.android.apps.maps");
+//            if (mapIntent.resolveActivity(getPackageManager()) != null) {
+//                startActivity(mapIntent);
+//            } else {
+//                Toast.makeText(mCtx,getString(R.string.alert_no_google_map),Toast.LENGTH_LONG).show();
+//            }
+//        }
+//
+//    }
+//
+//    @Override
+//    public void showMap(DetailMapModel model) {
+//        if (model != null && !TextUtils.isEmpty(model.getLat()) && !TextUtils.isEmpty(model.getLon())) {
+//
+//            Uri gmmIntentUri = Uri.parse("geo:" + model.getLat() + "," + model.getLon() + "?mode=d");
+//            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
+//            mapIntent.setPackage("com.google.android.apps.maps");
+//            if (mapIntent.resolveActivity(getPackageManager()) != null) {
+//                startActivity(mapIntent);
+//            } else {
+//                Toast.makeText(mCtx,getString(R.string.alert_no_google_map),Toast.LENGTH_LONG).show();
+//            }
+//
+//        }
+//    }
+
+    private void handleAction(View view, DetailSubActionModel actionModel) {
+
+        switch (actionModel.actionType) {
+            case DetailSubActionModel.DetailActionType.DetailActionTypeLocal: {
+
+                if (actionModel.actionSubType == DetailActionSubTypeEnum) {
+                    handleEnumAction(view,actionModel);
+                } else if (actionModel.actionSubType == DetailActionSubTypeUpdate) {
+                    showUpdate(actionModel);
+                }
+
+
+            }
+            break;
+            case DetailSubActionModel.DetailActionType.DetailActionTypeRemote: {
+
+                if (actionModel.actionSubType == DetailActionSubTypeAccept) {
+//                    ApexDriverApplication.sharedApplication().setRequiredBackgroundLocation(true);
+                }
+
+                handleRemoteAction(actionModel);
+            }
+            break;
+            default:
+                break;
+        }
+    }
+
+
+    /**
+     * Handler
+     * */
+
+    private static final class DetailHandler extends Handler {
+
+        static final int DetailActionReloadData = 0;
+        static final int DetailActionRemote = 1;
+
+        WeakReference<DetailActivity> mWeakDetail;
+
+        public DetailHandler(DetailActivity activity) {
+            mWeakDetail = new WeakReference<>(activity);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+
+//            DetailActivity activity = mWeakDetail.get();
+//            activity.dismissProgressDialog();
+//            switch (msg.what) {
+//                case DetailActionReloadData: {
+////                    if(activity.mListView.getEmptyView()==null)
+////                    {
+////                        activity.mListView.setEmptyView(activity.findViewById(R.id.detail_empty_view));
+////                    }
+//
+//                    if (activity.mRefresh.isRefreshing()) {
+//                        activity.mRefresh.setRefreshing(false);
+//                    }
+//
+//                    JSONObject json = (JSONObject) msg.obj;
+//
+//                    if (json != null) {
+//
+//                        try {
+//                            int restul = json.getInt("result");
+//                            if (restul == RESULT_TRUE) {
+//                                activity.mEmptyView.setVisibility(View.GONE);
+//                                if (!activity.mLoad) {
+//                                    activity.mLoad = true;
+//
+//                                    Intent intent = new Intent(CheckDetailNotification);
+//                                    intent.putExtra("order_id",activity.mOrderID);
+//                                    intent.setPackage( activity.getPackageName());
+//                                    activity.sendBroadcast(intent);
+//                                }
+//
+//                                activity.handleJson(json);
+//
+//                            } else {
+//                                // error
+//                                activity.mEmptyView.setVisibility(View.VISIBLE);
+//                                String errMsg = json.optString("err_msg");
+//                                if (errMsg == null || errMsg.length() == 0) {
+//                                    errMsg = activity.getString(R.string.sorry);
+//                                }
+//                                activity.showWarningMsg(errMsg);
+//                            }
+//
+//                        } catch (JSONException e) {
+//                            activity.mEmptyView.setVisibility(View.VISIBLE);
+//                            e.printStackTrace();
+//                            // error
+//                            String errMsg = activity.getString(R.string.sorry);
+//                            activity.showWarningMsg(errMsg);
+//                        }
+//                    } else {
+//                        // error
+//                        String errMsg = activity.getString(R.string.connect_wrong);
+//                        activity.showWarningMsg(errMsg);
+//                    }
+//                    activity.changeData();
+//                }
+//                break;
+//                case DetailActionRemote: {
+//
+//                    JSONObject json = (JSONObject)msg.obj;
+//                    if (json != null) {
+//                        int result = json.optInt("result");
+//                        if (result == RESULT_TRUE) {
+//
+//                            switch (msg.arg1) {
+//                                case DetailRemoteActionTypeGoHome: {
+//                                    activity.goHome();
+//                                }
+//                                break;
+//                                case DetailRemoteActionTypeReload: {
+//                                    activity.reload();
+//                                }
+//                                break;
+//                            }
+//                        } else {
+//                            // error;
+//                            String errMsg = json.optString("err_msg");
+//                            if (errMsg == null || errMsg.length() == 0) {
+//                                errMsg = activity.getString(R.string.sorry);
+//                            }
+//                            activity.showWarningMsg(errMsg);
+//                        }
+//                    } else {
+//                        // error
+//                        String errMsg = activity.getString(R.string.sorry);
+//                        activity.showWarningMsg(errMsg);
+//                    }
+//
+//                }
+//                break;
+//                default:{
+//
+//                }
+//                break;
+//            }
+        }
+    }
+
+    /**
+     * Pop
+     * */
+    private PopupWindow popupWindow;
+    private ListView popListView;
+    private PopAdapter popAdapter;
+    private View popView;
+    private void showWindow(View parent, final ArrayList<DetailActionSelectionModel> models) {
+//
+//        LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+//
+//        popView = layoutInflater.inflate(R.layout.pop_list_view, null);
+//
+//        popListView = (ListView) popView.findViewById(R.id.pop_list);
+//
+//        popAdapter = new PopAdapter(this, R.layout.pop_cell,models);
+//        popListView.setAdapter(popAdapter);
+//
+//        // 创建一个PopuWidow对象
+//        popupWindow = new PopupWindow(popView, RAUtil.dp2px(mCtx,250), RAUtil.dp2px(mCtx,300));
+//
+//        // 使其聚集
+//        popupWindow.setFocusable(true);
+//        // 设置允许在外点击消失
+//        popupWindow.setOutsideTouchable(true);
+//
+//        popupWindow.update();
+//
+//        // 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
+//        popupWindow.setBackgroundDrawable(new ColorDrawable(Color.RED));
+//        WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+//        // 显示的位置
+//        int xPos = windowManager.getDefaultDisplay().getWidth() / 2 - popupWindow.getWidth() / 2;
+//
+//        popupWindow.showAsDropDown(parent, xPos, 0);
+////        popupWindow.showAsDropDown(parent);
+//
+//        popListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+//
+//            @Override
+//            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
+//
+//                final DetailActionSelectionModel model = models.get(position);
+//
+//                if (position != 0) {
+//
+//                    DetailActionSelectionModel currentModel = models.get(0);
+//
+//                    new AlertDialog.Builder(mCtx)
+//                            .setTitle(getString(R.string.warning))
+//                            .setMessage(String.format(getString(R.string.not_done),currentModel.actionTitle,model.actionTitle))
+//                            .setNegativeButton(getString(R.string.btn_cancel),null)
+//                            .setPositiveButton(getString(R.string.btn_ok), new DialogInterface.OnClickListener() {
+//                                @Override
+//                                public void onClick(DialogInterface dialog, int which) {
+//                                    if (popupWindow != null) {
+//                                        popupWindow.dismiss();
+//                                    }
+//
+//
+//                                    Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2,model.actionIndex);
+//                                    mCtx.startActivity(intent);
+//                                }
+//                            })
+//                            .show();
+//
+//                } else {
+//
+//                    if (popupWindow != null) {
+//                        popupWindow.dismiss();
+//                    }
+//
+//
+//                    Intent intent = UpdateActivity.build(mCtx,mOrderID,model.actionID,model.actionTitle,mOrderType2, model.actionIndex);
+//                    mCtx.startActivity(intent);
+//
+//                }
+//            }
+//        });
+    }
+
+    private class PopAdapter extends ArrayAdapter<DetailActionSelectionModel> {
+
+        private Context ctx;
+        private int resId;
+        private ArrayList<DetailActionSelectionModel> selectionModels;
+
+        public PopAdapter(@NonNull Context context, int resource,ArrayList<DetailActionSelectionModel> selectionModels) {
+            super(context, resource);
+            ctx = context;
+            resId = resource;
+            this.selectionModels = selectionModels;
+        }
+
+        @Override
+        public int getCount() {
+
+            return selectionModels.size();
+        }
+
+        @NonNull
+        @Override
+        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
+
+            PopHolder holder;
+            if (convertView == null) {
+
+                convertView = LayoutInflater.from(ctx).inflate(resId,null);
+                holder = new PopHolder(convertView);
+
+            } else {
+
+                holder = (PopHolder)convertView.getTag();
+            }
+
+            DetailActionSelectionModel model = selectionModels.get(position);
+            holder.bindPopModel(model);
+
+            return convertView;
+        }
+
+        private class PopHolder {
+
+            TextView titleTv;
+
+            PopHolder(View view) {
+
+//                titleTv = view.findViewById(R.id.pop_title_tv);
+//
+//                view.setTag(this);
+            }
+
+            public void bindPopModel(DetailActionSelectionModel model) {
+                titleTv.setText(model.actionTitle);
+            }
+
+        }
+    }
+
+}

+ 869 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailAdapter.java

@@ -0,0 +1,869 @@
+package com.usai.ratradefiling.detail;
+
+import android.content.Context;
+import android.text.method.LinkMovementMethod;
+import android.text.util.Linkify;
+import android.util.Patterns;
+import android.util.TypedValue;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.detail.model.DetailActionModel;
+import com.usai.ratradefiling.detail.model.DetailBaseModel;
+import com.usai.ratradefiling.detail.model.DetailMultipleLineModel;
+//import com.usai.ratradefiling.detail.model.DetailMultiplePhotoModel;
+//import com.usai.ratradefiling.detail.model.DetailPhotoModel;
+import com.usai.ratradefiling.detail.model.DetailSingleLineModel;
+import com.usai.ratradefiling.detail.model.DetailSubActionModel;
+//import com.usai.ratradefiling.photoCell.PhotoCell;
+//import com.usai.ratradefiling.photoCell.PhotoCellDelegate;
+//import com.usai.ratradefiling.photoCell.PhotoItemModel;
+//import com.usai.ratradefiling.update.PhotoPreviewActivity;
+import com.usai.redant.rautils.utils.RAUtil;
+
+import java.util.ArrayList;
+
+//import static android.text.util.Linkify.PHONE_NUMBERS;
+//import com.google.android.gms.maps.GoogleMap;
+//import com.google.android.gms.maps.OnMapReadyCallback;
+
+public class DetailAdapter extends BaseExpandableListAdapter {
+
+    private ArrayList<DetailSectionModel> mSections;
+    private Context mCtx;
+//    private WeakReference<DetailActionDelegate> mDelegate;
+
+    DetailAdapter(Context ctx, ArrayList<DetailSectionModel> sections) {
+        mCtx = ctx;
+        mSections = sections;
+//        mDelegate = new WeakReference<>(delegate);
+    }
+
+    @Override
+    public int getGroupCount() {
+        if (mSections == null) {
+            return 0;
+        }
+        return mSections.size();
+    }
+
+    @Override
+    public int getChildrenCount(int groupPosition) {
+
+        DetailSectionModel sectionModel = mSections.get(groupPosition);
+
+        return sectionModel.itemCount();
+    }
+
+    @Override
+    public Object getGroup(int groupPosition) {
+        return mSections.get(groupPosition);
+    }
+
+    @Override
+    public Object getChild(int groupPosition, int childPosition) {
+        DetailSectionModel sectionModel = mSections.get(groupPosition);
+        return sectionModel.itemAtIndex(childPosition);
+    }
+
+    @Override
+    public long getGroupId(int groupPosition) {
+        return groupPosition;
+    }
+
+    @Override
+    public long getChildId(int groupPosition, int childPosition) {
+        return childPosition;
+    }
+
+    @Override
+    public int getChildTypeCount() {
+
+        return DetailBaseModel.detailValueTypeCount();
+    }
+
+    @Override
+    public int getChildType(int groupPosition, int childPosition) {
+
+        DetailSectionModel sectionModel = mSections.get(groupPosition);
+        DetailBaseModel model = sectionModel.itemAtIndex(childPosition);
+
+        return model.type;
+    }
+
+    @Override
+    public boolean hasStableIds() {
+        return true;
+    }
+
+    @Override
+    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
+
+        if (mCtx == null) {
+            return null;
+        }
+
+        SectionHolder holder;
+//        if (convertView == null) {
+//
+//            convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_section_header,null);
+//            holder = new SectionHolder(convertView);
+//
+//        } else {
+//            holder = (SectionHolder) convertView.getTag();
+//        }
+//        DetailSectionModel sectionModel = mSections.get(groupPosition);
+//        holder.bindSecionModel(sectionModel);
+//
+
+        return convertView;
+    }
+
+    @Override
+    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
+        if (mCtx == null) {
+            return null;
+        }
+
+        DetailSectionModel sectionModel = mSections.get(groupPosition);
+        DetailBaseModel model = sectionModel.itemAtIndex(childPosition);
+
+//        switch (getChildType(groupPosition,childPosition))
+//        {
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSingleLine: {
+//
+//                SingleLineHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_single_line_cell,null);
+//                    holder = new SingleLineHolder(convertView);
+//
+//                } else {
+//
+//                    holder = (SingleLineHolder) convertView.getTag();
+//                }
+//
+//                DetailSingleLineModel singleLineModel = (DetailSingleLineModel)model;
+//
+//                holder.bindSingleLineModel(singleLineModel);
+//
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultipleLine: {
+//
+//                MultipleLineHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_mult_line_cell,null);
+//                    holder = new MultipleLineHolder(convertView);
+//
+//                } else {
+//
+//                    holder = (MultipleLineHolder)convertView.getTag();
+//                }
+//
+//                DetailMultipleLineModel multipleLineModel = (DetailMultipleLineModel)model;
+//
+//                holder.bindMultLineModel(multipleLineModel);
+//
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeAction: {
+//
+//                ActionHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_action_cell,null);
+//                    holder = new ActionHolder(convertView);
+//
+//                } else {
+//
+//                    holder = (ActionHolder) convertView.getTag();
+//                }
+//                DetailActionModel actionModel = (DetailActionModel)model;
+//
+//                holder.bindActionModel(actionModel);
+//
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeLocation: {
+//
+//                LocationHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_location_cell,null);
+//                    holder = new LocationHolder(convertView);
+//
+//                } else {
+//
+//                    holder = (LocationHolder)convertView.getTag();
+//                }
+//                DetailLocationModel locationModel = (DetailLocationModel)model;
+//
+//                holder.bindLocationModel(locationModel);
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMap: {
+//                MapHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_map_cell,null);
+//                    holder = new MapHolder(convertView);
+//
+//                } else {
+//                    holder = (MapHolder)convertView.getTag();
+//                }
+//
+//                DetailMapModel mapModel = (DetailMapModel)model;
+//                holder.bindModel(mapModel);
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypePhoto: {
+//                PhotoHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_photo_cell,null);
+//                    holder = new PhotoHolder(convertView);
+//
+//                } else {
+//                    holder = (PhotoHolder)convertView.getTag();
+//                }
+//
+//                DetailPhotoModel mapModel = (DetailPhotoModel)model;
+//                holder.bindModel(mapModel);
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSignature: {
+//                SignatureHolder holder;
+//                if (convertView == null) {
+//
+//                    convertView = LayoutInflater.from(mCtx).inflate(R.layout.detail_signature_cell,null);
+//                    holder = new SignatureHolder(convertView);
+//
+//                } else {
+//                    holder = (SignatureHolder)convertView.getTag();
+//                }
+//
+//                DetailSignatureModel mapModel = (DetailSignatureModel)model;
+//                holder.bindModel(mapModel);
+//            }
+//            break;
+//            case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultiplePhoto: {
+//
+//                MultPhotoHolder holder;
+//                PhotoCell cell = (PhotoCell)convertView;
+//                if (cell == null) {
+//                    cell = PhotoCell.photoCell(mCtx);
+//                    holder = new MultPhotoHolder(cell);
+//                } else {
+//                    holder = (MultPhotoHolder)cell.getTag();
+//                }
+//                convertView = cell;
+//
+//                DetailMultiplePhotoModel photoModel = (DetailMultiplePhotoModel)model;
+//                holder.setModel(photoModel);
+//
+//            }
+//            break;
+//
+//            default:
+//                break;
+//        }
+
+
+        return convertView;
+    }
+
+    @Override
+    public boolean isChildSelectable(int groupPosition, int childPosition) {
+        return false;
+    }
+
+    private class SectionHolder {
+
+        TextView titleTv;
+
+        SectionHolder(View view) {
+
+            titleTv = view.findViewById(R.id.header_title_tv);
+
+            view.setTag(this);
+        }
+
+        public void bindSecionModel(DetailSectionModel model) {
+            titleTv.setText(model.title);
+        }
+    }
+
+    private class SingleLineHolder {
+
+        TextView titleTv;
+        TextView valueTv;
+
+        SingleLineHolder(View view) {
+
+//            titleTv = view.findViewById(R.id.detail_title_tv);
+//            valueTv = view.findViewById(R.id.detail_value_tv);
+
+            view.setTag(this);
+        }
+
+        public void bindSingleLineModel(DetailSingleLineModel model) {
+
+            if (model == null) {
+                titleTv.setText(null);
+                valueTv.setText(null);
+                return;
+            }
+
+//            if (model != null && model.detectTel) {
+//                valueTv.setAutoLinkMask(PHONE_NUMBERS);
+//            } else {
+//                valueTv.setAutoLinkMask(0);
+//            }
+
+            if (model != null) {
+                titleTv.setText(model.title);
+                valueTv.setText(model.value);
+            } else {
+                titleTv.setText(null);
+                valueTv.setText(null);
+            }
+
+            if (model != null && model.highlight) {
+                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextRed));
+            } else {
+                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextBlack));
+            }
+
+            if (model.detectTel) {
+                Linkify.addLinks(valueTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
+                valueTv.setMovementMethod(LinkMovementMethod.getInstance());
+            }
+        }
+    }
+
+    private class MultipleLineHolder {
+
+        TextView valueTv;
+
+        MultipleLineHolder(View view) {
+
+//            valueTv = view.findViewById(R.id.detail_multiple_tv);
+
+            view.setTag(this);
+        }
+
+        public void bindMultLineModel(DetailMultipleLineModel model) {
+
+            if (model == null) {
+                valueTv.setText(null);
+                return;
+            }
+
+//            if (model != null && model.detectTel) {
+//                valueTv.setAutoLinkMask(PHONE_NUMBERS);
+//            } else {
+//                valueTv.setAutoLinkMask(0);
+//            }
+
+
+            if (model != null) {
+                valueTv.setText(model.value);
+            } else {
+                valueTv.setText(null);
+            }
+            if (model != null && model.highlight) {
+                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextRed));
+            } else {
+                valueTv.setTextColor(mCtx.getResources().getColor(R.color.TFTextBlack));
+            }
+
+            if (model.detectTel) {
+                Linkify.addLinks(valueTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
+                valueTv.setMovementMethod(LinkMovementMethod.getInstance());
+            }
+
+        }
+    }
+
+    private class ActionHolder {
+
+        LinearLayout linearLayout;
+
+        ActionHolder(View view) {
+
+            linearLayout = (LinearLayout) view;
+
+            view.setTag(this);
+        }
+
+        public void bindActionModel(DetailActionModel model) {
+
+            linearLayout.removeAllViews();
+
+            int actionCount = model.actionCount();
+            if (actionCount == 0) {
+                return;
+            }
+
+            int colCount = 2;
+            int rowCount = actionCount / colCount;
+            if (actionCount % colCount != 0) {
+                rowCount++;
+            }
+
+
+            for (int row = 0; row < rowCount; row++) {
+
+                LinearLayout ll = new LinearLayout(mCtx);
+                for (int col = 0; col < colCount; col++) {
+
+                    final int index = row * colCount + col;
+
+                    RelativeLayout container = new RelativeLayout(mCtx);
+                    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT,1);
+                    ll.addView(container,layoutParams);
+
+                    Button btn = new Button(mCtx);
+                    RelativeLayout.LayoutParams btnLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RAUtil.dp2px(mCtx,50));
+                    btnLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
+
+                    int marginH = RAUtil.dp2px(mCtx,5);
+                    int marginT = RAUtil.dp2px(mCtx,2.5f);
+                    int marginB = RAUtil.dp2px(mCtx,2.5f);
+                    if (row == rowCount - 1) {
+                        marginB = RAUtil.dp2px(mCtx,5);
+                    } else if (row == 0) {
+                        marginT = RAUtil.dp2px(mCtx,5);
+                    }
+
+                    btnLayoutParams.setMargins(marginH,marginT,marginH,marginB);
+                    container.addView(btn,btnLayoutParams);
+
+                    final DetailSubActionModel subActionModel = model.actionModelForIndex(index);
+                    btn.setText(subActionModel.actionTitle);
+                    btn.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
+                    btn.setAllCaps(false);
+                    btn.setBackgroundResource(R.drawable.btn_bg);
+
+                    btn.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+
+                        }
+                    });
+
+                    if (index + 1 ==  actionCount) {
+                        break;
+                    }
+
+                }
+
+                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
+                linearLayout.addView(ll,layoutParams);
+            }
+
+        }
+    }
+
+//    private class LocationHolder {
+//
+//        TextView titleTv;
+//        TextView locationTv;
+//        ImageButton navigationBtn;
+//        WeakReference<DetailLocationModel> mWeakLocation;
+//
+//        LocationHolder(View view) {
+//
+////            titleTv = view.findViewById(R.id.detail_location_title_tv);
+////            locationTv = view.findViewById(R.id.detail_location_value_tv);
+////            navigationBtn = view.findViewById(R.id.detail_location_nav_btn);
+////            navigationBtn.setOnClickListener(new View.OnClickListener() {
+////                @Override
+////                public void onClick(View v) {
+////                    if (mWeakLocation != null && mDelegate != null) {
+////
+////                        DetailLocationModel model = mWeakLocation.get();
+////                        DetailActionDelegate delegate = mDelegate.get();
+////                        if (delegate != null && model != null) {
+////                            delegate.navigationTo(model);
+////                        }
+////                    }
+////                }
+////            });
+//
+//            view.setTag(this);
+//        }
+//
+////        public void bindLocationModel(DetailLocationModel model) {
+////
+////            if (model == null) {
+////
+////                titleTv.setText(null);
+////                locationTv.setText(null);
+////                return;
+////            }
+////
+//////            if (model != null && model.detectTel) {
+//////                locationTv.setAutoLinkMask(PHONE_NUMBERS);
+//////            } else {
+//////                locationTv.setAutoLinkMask(0);
+//////            }
+////
+////            titleTv.setText(model.title);
+////            locationTv.setText(model.location);
+////
+////            mWeakLocation = new WeakReference<>(model);
+////
+////            if (model != null && model.highlight) {
+////                locationTv.setTextColor(mCtx.getResources().getColor(R.color.ApexDriverTextRedColor));
+////            } else {
+////                locationTv.setTextColor(mCtx.getResources().getColor(R.color.ApexDriverTextBlackColor));
+////            }
+////
+////            if (model.detectTel) {
+////                Linkify.addLinks(locationTv, Patterns.PHONE,"tel:",Linkify.sPhoneNumberMatchFilter,Linkify.sPhoneNumberTransformFilter);
+////                locationTv.setMovementMethod(LinkMovementMethod.getInstance());
+////            }
+////
+////        }
+//    }
+
+    public final static String MapLifCircleAction = "com.apex.driver.map_life_circle.action";
+
+    private class MapHolder implements DetailBaseModel.OrderDetailModelDelegate {
+        TextView titleTv;
+        TextView valueTv;
+//        com.google.android.gms.maps.MapView mapView;
+//        GoogleMap googleMap;
+//        MapBroadcastReceiver receiver;
+        ImageButton mapBtn;
+
+//        WeakReference<DetailMapModel> weakMap;
+
+
+//        private class MapBroadcastReceiver extends BroadcastReceiver {
+//
+//            @Override
+//            public void onReceive(Context context, Intent intent) {
+//
+//                int life = intent.getIntExtra("life",0);
+//                switch (life) {
+//                    case 0:{
+//                        onActivitySaveInstanceState();
+//                    }
+//                    break;
+//                    case 1:{
+//                        onActivityResume();
+//                    }
+//                    break;
+//                    case 2:{
+//                        onActivityStart();
+//                    }
+//                    break;
+//                    case 3:{
+//                        onActivityStop();
+//                    }
+//                    break;
+//                    case 4:{
+//                        onActivityPause();
+//                    }
+//                    break;
+//                    case 5:{
+//                        onActivityLowMemory();
+//                    }
+//                    break;
+//                    case 6:{
+//                        onActivityDestroy();
+//                    }
+//                    break;
+//                }
+//            }
+//        }
+
+//        MapHolder(View view) {
+//
+////            titleTv = view.findViewById(R.id.detail_map_title_tv);
+////            valueTv = view.findViewById(R.id.detail_map_value_tv);
+////            mapView = view.findViewById(R.id.detail_map_view);
+////            mapView.getMapAsync(this);
+//
+//            mapBtn = view.findViewById(R.id.detail_map_view);
+//            mapBtn.setOnClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//
+//                    if (mDelegate != null && weakMap != null) {
+//
+//                        DetailActionDelegate delegate = mDelegate.get();
+//                        DetailMapModel mapModel = weakMap.get();
+//                        if (delegate != null && mapModel != null) {
+//                            delegate.showMap(mapModel);
+//                        }
+//
+//                    }
+//                }
+//            });
+//
+//            view.setTag(this);
+//
+////            receiver = new MapBroadcastReceiver();
+////
+////            IntentFilter  intentFilter = new IntentFilter();
+////            intentFilter.addAction(MapLifCircleAction);
+////
+////            LocalBroadcastManager.getInstance(mCtx).registerReceiver(receiver,intentFilter);
+//        }
+
+//        private void onActivitySaveInstanceState() {
+//
+//            onActivityDestroy();
+//        }
+//
+//
+//        private void onActivityResume() {
+//            mapView.onResume();
+//        }
+//
+//
+//        private void onActivityStart() {
+//            mapView.onStart();
+//        }
+//
+//
+//        private void onActivityStop() {
+//            mapView.onStop();
+//        }
+//
+//        private void onActivityPause() {
+//            mapView.onPause();
+//        }
+//
+//        private void onActivityDestroy() {
+//
+//            mapView.onDestroy();
+//            LocalBroadcastManager.getInstance(mCtx).unregisterReceiver(receiver);
+//        }
+//
+//        private void onActivityLowMemory() {
+//            mapView.onLowMemory();
+//        }
+
+//        public void bindModel(DetailMapModel model) {
+//            if (weakMap != null) {
+//
+//                DetailMapModel detailMapModel = weakMap.get();
+//                if (detailMapModel != null) {
+//                    detailMapModel.setDelegate(null);
+//                }
+//            }
+//            if (model != null) {
+//                weakMap = new WeakReference<>(model);
+//                weakMap.get().setDelegate(this);
+//            } else {
+//                weakMap = null;
+//            }
+//
+//            refreshUI();
+//        }
+
+//        @Override
+//        public void onMapReady(GoogleMap googleMap) {
+//            this.googleMap = googleMap;
+//
+//            refreshUI();
+//        }
+
+        @Override
+        public void refreshUI() {
+
+
+{
+                titleTv.setText(null);
+                valueTv.setText(null);
+//                valueTv.setAutoLinkMask(0);
+                mapBtn.setEnabled(false);
+//                mapBtn.setImageResource(R.drawable.btn_map_no);
+            }
+        }
+    }
+
+//    private class PhotoHolder implements DetailBaseModel.OrderDetailModelDelegate {
+//        TextView titleTv;
+//        ImageButton photoBtn;
+//        WeakReference<DetailPhotoModel> weakPhoto;
+//
+//        PhotoHolder(View view) {
+//
+//            titleTv = view.findViewById(R.id.detail_photo_title_tv);
+//            photoBtn = view.findViewById(R.id.detail_photo_btn);
+//            photoBtn.setOnClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//
+//                    if (weakPhoto != null) {
+//
+//                        DetailPhotoModel detailPhotoModel = weakPhoto.get();
+//
+//                        if (detailPhotoModel != null) {
+//                            String path = detailPhotoModel.getPhotoPath(mCtx);
+//                            clickImage(path);
+//                        }
+//                    }
+//
+//                }
+//            });
+//
+//            view.setTag(this);
+//        }
+//
+//        public void bindModel(DetailPhotoModel model) {
+//            if (weakPhoto != null) {
+//
+//                DetailPhotoModel detailPhotoModel = weakPhoto.get();
+//                if (detailPhotoModel != null) {
+//                    detailPhotoModel.setDelegate(null);
+//                }
+//
+//
+//            }
+//            if (model != null) {
+//                weakPhoto = new WeakReference<>(model);
+//                weakPhoto.get().setDelegate(this);
+//            } else {
+//                weakPhoto = null;
+//            }
+//        }
+//
+//        @Override
+//        public void refreshUI() {
+//            if (weakPhoto != null) {
+//                DetailPhotoModel model = weakPhoto.get();
+//                if (model != null) {
+//
+//                    titleTv.setText(model.getTitle());
+//                    photoBtn.setImageBitmap(model.getPhoto());
+//                }
+//            }
+//        }
+//    }
+
+//    private class SignatureHolder implements DetailBaseModel.OrderDetailModelDelegate {
+//
+//        TextView titleTv;
+//        ImageView signatureView;
+//        WeakReference<DetailSignatureModel> weakSignature;
+//
+//        SignatureHolder(View view) {
+//
+//            titleTv = view.findViewById(R.id.detail_signature_title_tv);
+//            signatureView = view.findViewById(R.id.detail_signature_image_view);
+//            signatureView.setOnClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//
+//                    if (weakSignature != null) {
+//
+//                        DetailSignatureModel signatureModel = weakSignature.get();
+//
+//                        if (signatureModel != null) {
+//
+//                            String path = signatureModel.getSignaturePath(mCtx);
+//                            clickImage(path);
+//                        }
+//
+//
+//                    }
+//                }
+//            });
+//
+//            view.setTag(this);
+//        }
+//
+//        public void bindModel(DetailSignatureModel model) {
+//            if (weakSignature != null) {
+//
+//                DetailSignatureModel signatureModel = weakSignature.get();
+//                if (signatureModel != null) {
+//                    signatureModel.setDelegate(null);
+//                }
+//
+//
+//            }
+//            if (model != null) {
+//                weakSignature = new WeakReference<>(model);
+//                weakSignature.get().setDelegate(this);
+//            } else {
+//                weakSignature = null;
+//            }
+//        }
+//
+//        @Override
+//        public void refreshUI() {
+//            if (weakSignature != null) {
+//                DetailSignatureModel model = weakSignature.get();
+//                if (model != null) {
+//
+//                    titleTv.setText(model.getTitle());
+//                    signatureView.setImageBitmap(model.getSignature());
+//                }
+//            }
+//        }
+//    }
+
+//    private class MultPhotoHolder implements PhotoCellDelegate {
+//
+//        WeakReference<PhotoCell>  weakCell;
+//        MultPhotoHolder(PhotoCell view) {
+//            view.setTag(this);
+//            weakCell = new WeakReference<>(view);
+//            view.delegate = this;
+//        }
+//
+//        void setModel(DetailMultiplePhotoModel model) {
+//            if (weakCell != null) {
+//
+//                PhotoCell cell = weakCell.get();
+//
+//                if (cell != null) {
+//                    if (model != null) {
+//                        cell.setModel(model.getMapModel());
+//                    } else {
+//                        cell.setModel(null);
+//                    }
+//                }
+//            }
+//        }
+//
+//        @Override
+//        public void clickPhotoItem(PhotoItemModel model) {
+//            if (model != null) {
+//                String url = model.url;
+//                String path = ImageUtil.imageCachePathForURl(mCtx,url);
+//                clickImage(path);
+//            }
+//        }
+//    }
+
+//    public interface DetailActionDelegate {
+//
+//        void performAction(View view, DetailSubActionModel actionModel);
+//        void navigationTo(DetailLocationModel locationModel);
+//        void showMap(DetailMapModel model);
+//    }
+
+//    private void clickImage(String path) {
+//
+//        Intent intent = PhotoPreviewActivity.build(mCtx,path,false);
+//        mCtx.startActivity(intent);
+//
+//    }
+}

+ 155 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/DetailSectionModel.java

@@ -0,0 +1,155 @@
+package com.usai.ratradefiling.detail;
+
+import android.content.Context;
+
+import com.usai.ratradefiling.detail.model.DetailActionModel;
+import com.usai.ratradefiling.detail.model.DetailBaseModel;
+import com.usai.ratradefiling.detail.model.DetailMultipleLineModel;
+import com.usai.ratradefiling.detail.model.DetailSingleLineModel;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+public class DetailSectionModel {
+
+    public ArrayList<DetailBaseModel> values = new ArrayList<>();
+    public String title;
+
+    private Context mCtx;
+    DetailSectionModel(Context context) {
+        mCtx = context;
+    }
+
+    public int itemCount() {
+        if (values == null) {
+            return 0;
+        }
+        return values.size();
+    }
+
+    public DetailBaseModel itemAtIndex(int index) {
+        if (values == null || index >= values.size()) {
+            return null;
+        }
+        return values.get(index);
+    }
+
+    public void setValues(JSONArray values) {
+        this.values.clear();
+        if (values == null) {
+            return;
+        } else {
+
+            for (int i = 0; i < values.length(); i++) {
+
+                JSONObject value = values.optJSONObject(i);
+                if (value != null) {
+                    int type = value.optInt("type",-1);
+                    boolean highlight = value.optBoolean("highlight");
+                    boolean detectTel = value.optBoolean("detectTel");
+//                    switch (type) {
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSingleLine: {
+//                            DetailSingleLineModel model = new DetailSingleLineModel(mCtx);
+//
+//                            model.title = value.optString("title");
+//                            model.value = value.optString("value");
+//                            model.type = type;
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultipleLine: {
+//                            DetailMultipleLineModel model = new DetailMultipleLineModel(mCtx);
+//
+//                            model.value = value.optString("value");
+//                            model.type = type;
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeAction: {
+//
+//                            DetailActionModel model = new DetailActionModel(mCtx);
+//
+//                            model.setActions(value.optJSONArray("actions"));
+//                            model.type = type;
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeLocation: {
+//
+//                            DetailLocationModel model = new DetailLocationModel(mCtx);
+//
+//                            model.title = value.optString("title");
+//                            model.location = value.optString("location");
+//                            model.street = value.optString("street");
+//                            model.type = type;
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMap: {
+//
+//                            DetailMapModel model = new DetailMapModel(mCtx);
+//                            model.type = type;
+//                            model.title = value.optString("title");
+//                            model.location = value.optString("location");
+//                            model.setLatlon(value.optString("latlon"));
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+////                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypePhoto: {
+////
+////                            DetailPhotoModel model = new DetailPhotoModel(mCtx);
+////                            model.setTitle(value.optString("title"));
+////                            model.setPhotoURL(value.optString("photoURL"));
+////                            model.type = type;
+////                            model.highlight = highlight;
+////                            model.detectTel = detectTel;
+////
+////                            this.values.add(model);
+////                        }
+////                        break;
+//                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeSignature: {
+//
+//                            DetailSignatureModel model = new DetailSignatureModel(mCtx);
+//                            model.setTitle(value.optString("title"));
+//                            model.setSignatureURL(value.optString("signatureURL"));
+//                            model.type = type;
+//                            model.highlight = highlight;
+//                            model.detectTel = detectTel;
+//
+//                            this.values.add(model);
+//                        }
+//                        break;
+////                        case DetailBaseModel.OrderDetailValueType.OderDetailValueTypeMultiplePhoto: {
+////
+////                            DetailMultiplePhotoModel model = new DetailMultiplePhotoModel(mCtx);
+////                            model.setValuesForKeysWithJSON(value);
+////
+////                            this.values.add(model);
+////                        }
+////                        break;
+//                        default:
+//                            break;
+//                    }
+                }
+            }
+        }
+    }
+
+}

+ 107 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionModel.java

@@ -0,0 +1,107 @@
+package com.usai.ratradefiling.detail.model;
+
+import android.content.Context;
+
+import com.usai.redant.rautils.utils.RAUtil;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+public class DetailActionModel extends DetailBaseModel{
+
+    public ArrayList<DetailSubActionModel> actions = new ArrayList<>();
+
+    public DetailActionModel(Context context) {
+        super(context);
+    }
+
+    public int actionCount() {
+        if (actions == null) {
+            return 0;
+        }
+        return actions.size();
+    }
+
+    public DetailSubActionModel actionModelForIndex(int index) {
+        if (actions == null || index >= actions.size()) {
+            return null;
+        }
+        return actions.get(index);
+    }
+
+    public void setActions(JSONArray actions) {
+
+        this.actions.clear();
+        if (actions == null) {
+
+            return;
+        } else  {
+
+            for (int i = 0; i < actions.length(); i++) {
+                JSONObject action = actions.optJSONObject(i);
+                if (action != null) {
+                    DetailSubActionModel subActionModel = new DetailSubActionModel();
+
+                    int type = action.optInt("actionType");
+                    int subType = action.optInt("actionSubType");
+                    int index = action.optInt("index");
+                    String title = action.optString("actionTitle");
+
+
+                    subActionModel.actionTitle = title;
+                    subActionModel.actionType = type;
+                    subActionModel.actionSubType = subType;
+                    subActionModel.index = index;
+
+                    if (type == DetailSubActionModel.DetailActionType.DetailActionTypeLocal) {
+
+                        if (subType == DetailSubActionModel.DetailActionSubType.DetailActionSubTypeEnum) {
+                            JSONArray enums = action.optJSONArray("enums");
+                            subActionModel.setEnums(enums);
+                        } else if (subType == DetailSubActionModel.DetailActionSubType.DetailActionSubTypeUpdate) {
+                            int actionID = action.optInt("actionID");
+                            subActionModel.actionID = actionID;
+                        }
+                    }
+
+                    if (type == DetailSubActionModel.DetailActionType.DetailActionTypeRemote) {
+
+                        String url = action.optString("url");
+                        subActionModel.url = url;
+
+                        JSONObject params = action.optJSONObject("params");
+                        if (params != null) {
+                            subActionModel.params = RAUtil.Json2Bundle(params);
+                        } else {
+                            subActionModel.params = null;
+                        }
+
+                        int remoteActionType = action.optInt("remoteActionType");
+                        subActionModel.remoteActionType = remoteActionType;
+                    }
+
+                    boolean alert = action.optBoolean("alert");
+                    if (alert) {
+
+                        String alertTitle = action.optString("alertTitle");
+                        String alertMsg = action.optString("alertMsg");
+
+                        subActionModel.alertTitle = alertTitle;
+                        subActionModel.alertMsg = alertMsg;
+                    }
+                    subActionModel.alert = alert;
+
+
+
+                    this.actions.add(subActionModel);
+                }
+            }
+        }
+
+
+
+    }
+
+}

+ 10 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailActionSelectionModel.java

@@ -0,0 +1,10 @@
+package com.usai.ratradefiling.detail.model;
+
+public class DetailActionSelectionModel {
+
+    public String actionTitle;
+    public String detailActionTitle;
+    public int actionID;
+    public int actionIndex;
+
+}

+ 50 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailBaseModel.java

@@ -0,0 +1,50 @@
+package com.usai.ratradefiling.detail.model;
+
+import android.content.Context;
+
+import com.usai.ratradefiling.base.BasicObject;
+
+public class DetailBaseModel extends BasicObject {
+
+    public static class OrderDetailValueType {
+        public static final int OderDetailValueTypeSingleLine = 0;
+        public static final int OderDetailValueTypeMultipleLine = 1;
+        public static final int OderDetailValueTypeAction = 2;
+        public static final int OderDetailValueTypeLocation = 3;
+        public static final int OderDetailValueTypeMap = 4;
+        public static final int OderDetailValueTypePhoto = 5;
+        public static final int OderDetailValueTypeSignature = 6;
+        public static final int OderDetailValueTypeMultiplePhoto = 7;
+    }
+
+    public static int detailValueTypeCount() {
+        return 8;
+    }
+
+    public interface OrderDetailModelDelegate {
+        void refreshUI();
+    }
+
+    public int type;
+    public boolean highlight;
+    public boolean detectTel;
+
+    private OrderDetailModelDelegate delegate;
+
+    Context mCtx;
+    public DetailBaseModel(Context context) {
+        mCtx = context;
+    }
+
+    public void setDelegate(OrderDetailModelDelegate delegate) {
+        this.delegate = delegate;
+
+        if (delegate != null) {
+            delegate.refreshUI();
+        }
+    }
+
+    public OrderDetailModelDelegate getDelegate() {
+        return delegate;
+    }
+}

+ 12 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailMultipleLineModel.java

@@ -0,0 +1,12 @@
+package com.usai.ratradefiling.detail.model;
+
+import android.content.Context;
+
+public class DetailMultipleLineModel extends DetailBaseModel {
+
+    public String value;
+
+    public DetailMultipleLineModel(Context context) {
+        super(context);
+    }
+}

+ 13 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSingleLineModel.java

@@ -0,0 +1,13 @@
+package com.usai.ratradefiling.detail.model;
+
+import android.content.Context;
+
+public class DetailSingleLineModel extends DetailBaseModel {
+
+    public String title;
+    public String value;
+
+    public DetailSingleLineModel(Context context) {
+        super(context);
+    }
+}

+ 81 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/detail/model/DetailSubActionModel.java

@@ -0,0 +1,81 @@
+package com.usai.ratradefiling.detail.model;
+
+import android.os.Bundle;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+public class DetailSubActionModel {
+
+    public static class DetailActionType {
+        public static final int DetailActionTypeRemote = 0;
+        public static final int DetailActionTypeLocal = 1;
+    }
+
+    public static class DetailActionSubType {
+        public static final int DetailActionSubTypeEnum = 0;
+        public static final int DetailActionSubTypeAccept = 1;
+        public static final int DetailActionSubTypeReject = 2;
+        public static final int DetailActionSubTypeUpdate = 3;
+        public static final int DetailActionSubTypeOther = 4;
+    }
+
+    public static class DetailRemoteActionType {
+
+        public static final int DetailRemoteActionTypeGoHome = 0;
+        public static final int DetailRemoteActionTypeReload = 1;
+
+    }
+
+    public int actionType;
+    public int actionSubType;
+    public String actionTitle;
+    public int index;
+
+    /**
+     * actionType == RADetailActionTypeLocal && actionSubType == RADetailActionSubTypeEnum
+     * */
+    public ArrayList<DetailActionSelectionModel> enums = new ArrayList<DetailActionSelectionModel>();
+    public void setEnums(JSONArray enums) {
+
+        this.enums.clear();
+        if (enums == null) {
+            return;
+        }
+
+        for (int i = 0; i < enums.length(); i++) {
+            JSONObject enumObj = enums.optJSONObject(i);
+            if (enumObj != null) {
+                DetailActionSelectionModel model = new DetailActionSelectionModel();
+
+                model.actionID = enumObj.optInt("actionID");
+                model.actionTitle = enumObj.optString("actionTitle");
+                model.detailActionTitle = actionTitle;
+                model.actionIndex = enumObj.optInt("actionIndex");
+
+                this.enums.add(model);
+            }
+        }
+    }
+
+    /**
+     * actionType == RADetailActionTypeRemote
+     * */
+    public String url;
+    public Bundle params;
+    public int remoteActionType;
+
+    /**
+     * actionType == RADetailActionTypeLocal && actionSubType == DetailActionSubTypeUpdate
+     * */
+    public int actionID;
+
+    /**
+     * alert
+     * */
+    public boolean alert;
+    public String alertTitle;
+    public String alertMsg;
+}

+ 438 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/CustomizeFieldsActivity.java

@@ -0,0 +1,438 @@
+package com.usai.ratradefiling.fields;
+
+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.util.JsonReader;
+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.ratradefiling.R;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+import com.usai.redant.rautils.utils.FileManager;
+import com.usai.redant.rautils.utils.RAConverter;
+//import com.usai.util.dbUtil;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+//import android.content.DialogInterface.OnClickListener;
+
+public class CustomizeFieldsActivity extends Activity implements
+		OnClickListener, DragListView.DragListViewDelegate
+{
+	//
+	// @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 static List<JSONObject> list = null;
+	private List<JSONObject> showList = null;
+	private List<JSONObject> hideList = null;
+//	private List<fieldedit> showList = new ArrayList<fieldedit>();
+//	private List<fieldedit> hideList = new ArrayList<fieldedit>();
+	private String user/* ,password */, type,subtype;
+//	private int behavior;
+
+	@Override
+	public boolean dragListViewCanMoveItem(DragListView dragListView, int from, int to) {
+
+		int hidePosition = adapter.getPosition(mHideField);
+		// hide -> display && displayCount >= maxDisplayCount
+		if (from > hidePosition && to < hidePosition && hidePosition > maxDisplayCount) {
+
+			new AlertDialog.Builder(this)
+					.setTitle("Warning")
+					.setMessage("the maximums count of display items is " + maxDisplayCount)
+					.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+						@Override
+						public void onClick(DialogInterface dialog, int which) {
+
+						}
+					})
+					.show();
+
+			return false;
+		}
+
+		return true;
+	}
+
+	public class fieldedit
+	{
+		public String name = null;
+		public int _id = -1;
+
+		public fieldedit(String str, int i)
+		{
+			name = str;
+			_id = i;
+
+		}
+	}
+
+	private boolean forNewResult = false;
+	private int maxDisplayCount = 0;
+
+	@Override
+	public void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+
+		user = TradeFilingApplication.get_user();
+		// password = getIntent().getStringExtra("password");
+		type = getIntent().getStringExtra("type");
+		subtype = getIntent().getStringExtra("sub_type");
+		forNewResult = getIntent().getBooleanExtra("forNewResult", false);
+		maxDisplayCount = getIntent().getIntExtra("maxDisplayCount", 0);
+
+
+		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);
+
+		if (forNewResult) {
+
+			dragListView.setDelegate(this);
+		}
+
+		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);
+	}
+
+	private JSONObject mDisplayField, mHideField;
+	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)));
+//
+//			}
+//		}
+		try
+		{
+		JSONObject fields = RADataProvider.updateFieldsjson(type,subtype);
+
+//			JSONObject.parseArray(array.toJSONString(), JSONObject.class);
+
+
+			showList= RAConverter.JsonArray2List(fields.optJSONArray("show")) ;
+			hideList= RAConverter.JsonArray2List(fields.optJSONArray("hide")) ;
+			fields.getJSONArray("hide");
+		// ��ݽ��
+		list = new ArrayList<JSONObject>();
+
+		// groupKey��ŵ��Ƿ����ǩ
+		// groupKey.add("Display fields");
+		// groupKey.add("Hide fields");
+
+		// for (int i = 0; i < 5; i++)
+		// {
+		// navList.add("Aѡ��" + i);
+		// }
+//		if (forNewResult) {
+//			mDisplayField = new fieldedit("Additional Fields To Display", -1);
+//		} else {
+//			mDisplayField = new fieldedit(getString(R.string.str_displayitem), -1);
+//		}
+
+
+
+			mDisplayField=	new JSONObject("{\"name\":\"Additional Fields To Display\",\"id\":-1}");
+			list.add(mDisplayField);
+			list.addAll(showList);
+			mHideField = new JSONObject("{\"name\":\"Additional Fields\",\"id\":-2}");
+			list.add(mHideField);
+			list.addAll(hideList);
+		} catch (JSONException e)
+		{
+			e.printStackTrace();
+		}
+
+
+
+		// for (int i = 0; i <18; i++)
+		// {
+		// moreList.add("Bѡ��" + i);
+		// }
+//		if (forNewResult) {
+//			mHideField = new fieldedit("Additional Fields", -2);
+//		} else {
+//			mHideField = new fieldedit(getString(R.string.str_hideitem), -2);
+//		}
+
+//		dbUtil.CloseCursor(cursor);
+//		dbUtil.CloseDB(db);
+	}
+
+	public static class DragListAdapter extends ArrayAdapter<JSONObject>
+	{
+
+		// private Context mContext;
+
+		public DragListAdapter(Context context, List<JSONObject> objects)
+		{
+			super(context, 0, objects);
+			// this.mContext = context;
+		}
+
+		public List<JSONObject> getList()
+		{
+			return list;
+		}
+
+		@Override
+		public boolean isEnabled(int position)
+		{
+			if (getItem(position).optInt("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).optInt("id") < 0)
+					return i;
+			}
+			return -1;
+		}
+
+		@Override
+		public View getView(int position, View convertView, ViewGroup parent)
+		{
+
+			View view = convertView;
+			if (getItem(position).optInt("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).optString("name"));
+
+			return view;
+		}
+	}
+
+	@Override
+	public void onClick(View v)
+	{
+		switch (v.getId())
+		{
+		case R.id.btnok:
+		{
+			// DragListView dragListView = (DragListView)
+			// findViewById(R.id.drag_list);
+//			if (!forNewResult) {
+//				int count = 0;
+//				for (int i = 0; i < adapter.getCount(); i++)
+//				{
+//					JSONObject item = adapter.getItem(i);
+//					if (item.optInt("id",0)== -2 || count > 0)
+//						break;
+//					if (item.optInt("id",0) >= 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;
+//			showList.clear();
+//			hideList.clear();
+//			SQLiteDatabase db = dbUtil.OpenDB(this, null, true);
+//			db.beginTransaction();
+			JSONArray jarr_show = new JSONArray();
+			JSONArray jarr_hide = new JSONArray();
+			for (int i = 0; i < adapter.getCount(); i++)
+			{
+				JSONObject item = adapter.getItem(i);
+				if (item.optInt("id",0) == -2)// hide group begin
+				{
+					show = 0;
+				}
+				if (show == 1)
+					jarr_show.put(item);
+//					showList.add(item);
+//					db.execSQL("update fields_info set show=" + show
+//							+ " ,priority=" + i + " where _id=" + fe._id);
+				else
+					jarr_hide.put(item);
+//					hideList.add(item);
+//					db.execSQL("update fields_info set show=" + show
+//							+ " where _id=" + fe._id);
+
+			}
+
+			JSONObject fields = RADataProvider.updateFieldsjson(type,subtype);
+			try
+			{
+				fields.put("show",jarr_show);
+				fields.put("hide",jarr_hide);
+				String userfilePath = TradeFilingApplication.get_instance().getFilesDir().getPath()+"/"+type+"_"+subtype+"_"+TradeFilingApplication.get_instance().get_user()+".json";
+				FileManager.writeJson(fields.toString(),userfilePath);
+
+			} catch (JSONException e)
+			{
+				e.printStackTrace();
+			}
+
+//			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
+
+	}
+
+}

+ 330 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/fields/DragListView.java

@@ -0,0 +1,330 @@
+package com.usai.ratradefiling.fields;
+
+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;
+
+
+import com.usai.ratradefiling.R;
+
+import org.json.JSONObject;
+
+import java.lang.ref.WeakReference;
+
+import static android.content.Context.WINDOW_SERVICE;
+
+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)
+		{
+			CustomizeFieldsActivity.DragListAdapter adapter = (CustomizeFieldsActivity.DragListAdapter) ((ListView) parent)
+					.getAdapter();
+
+			if (adapter.isEnabled(pos) == false)// return if item is a group key
+				return;
+			JSONObject dclickitem = (JSONObject) ((ListView) parent).getAdapter()
+					.getItem(pos);
+
+			// �����˫��,1�����������ж�Ϊ˫��
+			if (pos == 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 = pos;
+				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_SERVICE);
+		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") */
+			CustomizeFieldsActivity.DragListAdapter adapter = (CustomizeFieldsActivity.DragListAdapter) getAdapter();
+			JSONObject dragItem = adapter.getItem(dragSrcPosition);
+
+			DragListViewDelegate delegate = getDelegate();
+			if (delegate != null) {
+
+				int from = adapter.getPosition(dragItem);
+				int to = dragPosition;
+				if (delegate.dragListViewCanMoveItem(this, from, to)) {
+					adapter.remove(dragItem);
+					adapter.insert(dragItem, to);
+				}
+
+			} else {
+				// 保证在修改前的不变
+				adapter.remove(dragItem);
+				adapter.insert(dragItem, dragPosition);
+			}
+			// Toast.makeText(getContext(), adapter.getList().toString(),
+			// Toast.LENGTH_SHORT).show();
+		}
+
+	}
+
+	private WeakReference<DragListViewDelegate> mWeakDelegate;
+
+	public void setDelegate(DragListViewDelegate delegate) {
+		if (delegate != null) {
+
+			mWeakDelegate = new WeakReference<>(delegate);
+
+		} else {
+
+			mWeakDelegate = null;
+		}
+	}
+
+	public DragListViewDelegate getDelegate() {
+		if (mWeakDelegate != null) {
+
+			return mWeakDelegate.get();
+
+		} else {
+			return null;
+		}
+
+	}
+
+	public interface DragListViewDelegate {
+		boolean dragListViewCanMoveItem(DragListView dragListView, int from, int to);
+	}
+}

+ 85 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/FunctionPanelAdapter.java

@@ -0,0 +1,85 @@
+package com.usai.ratradefiling.home;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class FunctionPanelAdapter extends BaseAdapter {
+
+    private Context context;
+    JSONObject function_json;
+
+    public FunctionPanelAdapter(Context context, JSONObject functions) {
+        this.context = context;
+        this.function_json = functions;
+
+    }
+
+
+    @Override
+    public int getCount() {
+
+        try {
+            int count = function_json.getJSONArray("active_functions").length();
+            return count;
+//            JSONArray a=null;
+
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
+
+    @Override
+    public Object getItem(int i) {
+
+        JSONObject item = null;
+        try {
+            item = function_json.getJSONArray("active_functions").getJSONObject(i);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        return item;
+    }
+
+    @Override
+    public long getItemId(int i) {
+        return 0;
+    }
+
+    @Override
+    public View getView(int i, View view, ViewGroup viewGroup) {
+        view = LayoutInflater.from(context).inflate(R.layout.function_panel_item, null);
+        ImageView iv = view.findViewById(R.id.func_image);
+        TextView tv = view.findViewById(R.id.tv_func_name);
+
+        try {
+            JSONObject item = function_json.getJSONArray("active_functions").getJSONObject(i);
+            tv.setText(item.getString("name"));
+
+
+            int resourceId = context.getResources().getIdentifier(item.getString("icon"), "drawable", context.getPackageName());
+            iv.setImageResource(resourceId);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+//
+
+
+
+
+        return view;
+
+    }
+}

+ 165 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeCellLayout.java

@@ -0,0 +1,165 @@
+package com.usai.ratradefiling.home;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import java.lang.ref.WeakReference;
+
+import static com.usai.ratradefiling.home.HomeOrderModel.OrderStatusNew;
+
+public class HomeCellLayout extends RelativeLayout implements HomeOrderModel.OrderModelDelegate {
+
+    TextView titleTv, orderNoTv, containerNoTv, dateTv,orderType2Tv, index_tv;
+    ImageView statusView, markView;
+    RelativeLayout contentContainer,newFlagView;
+
+    WeakReference<ResultBaseModel> weakModel;
+    private boolean initialed = false;
+
+    public HomeCellLayout(Context context) {
+        super(context);
+
+    }
+
+    public HomeCellLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+    }
+
+    public HomeCellLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+    }
+
+    public HomeCellLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+
+    }
+
+    private void init() {
+
+//        contentContainer = findViewById(R.id.content_container);
+//        titleTv = findViewById(R.id.title_tv);
+//        orderNoTv = findViewById(R.id.order_no_tv);
+//        containerNoTv = findViewById(R.id.container_no_tv);
+//        dateTv = findViewById(R.id.date_tv);
+//        statusView = findViewById(R.id.status_view);
+//        markView = findViewById(R.id.order_mark_view);
+//        orderType2Tv = findViewById(R.id.type2_tv);
+//
+//        initialed = true;
+    }
+
+    private boolean isMore = false;
+    public void setIsMore(boolean isMore) {
+//        this.isMore = isMore;
+//        if (isMore) {
+//            index_tv = findViewById(R.id.index_tv);
+//        } else {
+//            newFlagView = findViewById(R.id.order_new_flag_view);
+//        }
+    }
+
+    public void setIndex(int idx) {
+        if (index_tv != null) {
+            index_tv.setText(String.format("%d",idx));
+        }
+    }
+
+    public void bindOrderModel(ResultBaseModel model) {
+
+        if (!initialed) {
+            init();
+        }
+
+        if (weakModel != null) {
+            try {
+
+                ResultBaseModel homeOrderModel = weakModel.get();
+//                if (homeOrderModel != null) {
+//                    homeOrderModel.delegate = null;// 会有null的情况
+//                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        if (model != null) {
+            weakModel = new WeakReference<>(model);
+//            weakModel.get().delegate = this;
+        } else {
+            weakModel = null;
+        }
+
+        refresh();
+
+    }
+
+    @Override
+    public void refresh() {
+//
+//        if (weakModel == null || weakModel.get() == null) {
+//            return;
+//        }
+//
+//        ResultBaseModel model = weakModel.get();
+//        titleTv.setText(model.title);
+//        orderNoTv.setText(model.orderNo);
+//        containerNoTv.setText(model.containerNo);
+//        dateTv.setText(model.date);
+//        orderType2Tv.setText(model.order_type);
+//        statusView.setImageBitmap(model.getIcon());
+//
+//        if (model.backendFlag) {
+//            markView.setVisibility(View.VISIBLE);
+//        } else {
+//            markView.setVisibility(View.GONE);
+//        }
+//
+//        if (model.selected || isPressed()) {
+////            contentContainer.setBackgroundResource(R.drawable.round_corner_selection_bg);
+//        } else {
+//            contentContainer.setBackgroundResource(R.drawable.round_corner_bg);
+//        }
+//
+//        if (model != null && !TextUtils.isEmpty(model.color)) {
+//            orderType2Tv.setTextColor(Color.parseColor(model.color));
+//        } else {
+//            orderType2Tv.setTextColor(Color.parseColor("#000000"));
+//        }
+//
+//        if (!isMore) {
+//            if (newFlagView != null && model != null) {
+//                if (model.status == OrderStatusNew) {
+//                    newFlagView.setVisibility(VISIBLE);
+//                } else {
+//                    newFlagView.setVisibility(GONE);
+//                }
+//            }
+//
+//        }
+
+    }
+
+    @Override
+    protected void drawableStateChanged() {
+        super.drawableStateChanged();
+
+//        RelativeLayout contentContainer = findViewById(R.id.content_container);
+//        if (contentContainer == null) {
+//            return;
+//        }
+
+        refresh();
+    }
+}

+ 485 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashAdapter.java

@@ -0,0 +1,485 @@
+package com.usai.ratradefiling.home;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+import com.usai.ratradefiling.home.dashcell.HomeDashEmptyCell;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashACEM1CellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashACICellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashISFCellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDasheManifestCellE;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashACEM1CellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashACICellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashISFCellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDasheManifestCellP;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACEM1ModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACIModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashISFModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDasheManifestModelE;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Error;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Pending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIPending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeEmpty;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFPending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestPending;
+
+public class HomeDashAdapter extends BaseAdapter
+{
+
+    // region DataSource
+    public static interface HomeDashDataSource
+    {
+
+        int numberOfResultItem();
+
+        ResultBaseModel resultModelForIndex(int index);
+    }
+    // endregion
+
+    // region Initial
+    private WeakReference<Context> mWeakContext;
+    private WeakReference<HomeDashDataSource> mWeakDataSource;
+
+    public HomeDashAdapter(Context context, HomeDashDataSource 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 HomeDashDataSource getDataSource()
+    {
+        if (mWeakDataSource == null)
+        {
+            return null;
+        }
+        return mWeakDataSource.get();
+    }
+
+    // endregion
+
+    // region Override
+
+    @Override
+    public int getCount()
+    {
+        HomeDashDataSource dataSource = getDataSource();
+        if (dataSource != null)
+        {
+            return dataSource.numberOfResultItem();
+        }
+        return 0;
+    }
+
+    @Override
+    public Object getItem(int position)
+    {
+        HomeDashDataSource 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 ResultBaseModel.HomeDashResultType.values().length;
+    }
+
+    @Override
+    public int getItemViewType(int position)
+    {
+        ResultBaseModel model = (ResultBaseModel) getItem(position);
+        return model.type;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent)
+    {
+
+        Context context = getContext();
+        if (context != null)
+        {
+
+            ResultBaseModel model = (ResultBaseModel) getItem(position);
+
+
+            if(model.type == DashResultTypeACIPending.ordinal())
+            {
+                HomeDashACIModelP dashmode = (HomeDashACIModelP)model;
+                HomeDashACICellP cell=aciCellP(context, convertView);
+                cell.prepareReuse();
+                cell.setCCN(dashmode.ccn).setPCCN(dashmode.primary_ccn).setSN(dashmode.sn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeeManifestPending.ordinal())
+            {
+                HomeDasheManifestModelP dashmode = (HomeDasheManifestModelP)model;
+                HomeDasheManifestCellP cell=emanifestCellP(context, convertView);
+                cell.prepareReuse();
+                cell.setCCN(dashmode.ccn).setPrimaryCCN(dashmode.primary_ccn).setSN(dashmode.sn).setPreviousCCN(dashmode.previous_ccn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeACEM1Pending.ordinal())
+            {
+                HomeDashACEM1ModelP dashmode = (HomeDashACEM1ModelP)model;
+                HomeDashACEM1CellP cell=acem1CellP(context, convertView);
+                cell.prepareReuse();
+                cell.setHBOL(dashmode.hbol).setMBOL(dashmode.mbol).setSN(dashmode.sn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeISFPending.ordinal())
+            {
+                HomeDashISFModelP dashmode = (HomeDashISFModelP)model;
+                HomeDashISFCellP cell=isfCellP(context, convertView);
+                cell.prepareReuse();
+                cell.setBOL(dashmode.bol).setISFType(dashmode.isftype).setSN(dashmode.sn);
+                return cell;
+
+            }
+            else if(model.type == DashResultTypeACIError.ordinal())
+            {
+                HomeDashACIModelE dashmode = (HomeDashACIModelE)model;
+                HomeDashACICellE cell=aciCellE(context, convertView);
+                cell.prepareReuse();
+                cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeeManifestError.ordinal())
+            {
+                HomeDasheManifestModelE dashmode = (HomeDasheManifestModelE)model;
+                HomeDasheManifestCellE cell=emanifestCellE(context, convertView);
+                cell.prepareReuse();
+                cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeACEM1Error.ordinal())
+            {
+                HomeDashACEM1ModelE dashmode = (HomeDashACEM1ModelE)model;
+                HomeDashACEM1CellE cell=acem1CellE(context, convertView);
+                cell.prepareReuse();
+                cell.setHBOL(dashmode.hbol).setLog(dashmode.log).setSN(dashmode.sn);
+                return cell;
+
+            }
+            else if(model.type == DashResultTypeISFError.ordinal())
+            {
+                HomeDashISFModelE dashmode = (HomeDashISFModelE)model;
+                HomeDashISFCellE cell=isfCellE(context, convertView);
+                cell.prepareReuse();
+                cell.setBOL(dashmode.bol).setLog(dashmode.log).setSN(dashmode.sn);
+                return cell;
+            }
+            else if(model.type == DashResultTypeEmpty.ordinal())
+            {
+
+                return emptyCell(context, convertView);
+//                HomeDashEmptyCell=
+
+            }
+
+            return new View(context);
+        }
+        return null;
+    }
+
+    // endregion
+
+    // region Configure Cell
+//    private ApexResultAirBookingCell dequeueAirBookingCell(Context context, View convertView)
+//    {
+//
+//        ApexResultAirBookingCell cell = null;
+//
+//        if (convertView == null)
+//        {
+//            cell = ApexResultAirBookingCell.makeBookingCell(context);
+//        }
+//        else
+//        {
+//            cell = (ApexResultAirBookingCell) convertView;
+//        }
+//
+//        return cell;
+//    }
+
+    private HomeDashACICellP aciCellP(Context context, View convertView)
+    {
+        HomeDashACICellP cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashACICellP.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashACICellP) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDashACICellE aciCellE(Context context, View convertView)
+    {
+        HomeDashACICellE cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashACICellE.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashACICellE) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDasheManifestCellP emanifestCellP(Context context, View convertView)
+    {
+        HomeDasheManifestCellP cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDasheManifestCellP.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDasheManifestCellP) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDasheManifestCellE emanifestCellE(Context context, View convertView)
+    {
+        HomeDasheManifestCellE cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDasheManifestCellE.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDasheManifestCellE) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDashISFCellP isfCellP(Context context, View convertView)
+    {
+        HomeDashISFCellP cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashISFCellP.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashISFCellP) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDashISFCellE isfCellE(Context context, View convertView)
+    {
+        HomeDashISFCellE cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashISFCellE.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashISFCellE) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDashACEM1CellP acem1CellP(Context context, View convertView)
+    {
+        HomeDashACEM1CellP cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashACEM1CellP.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashACEM1CellP) convertView;
+        }
+
+        return cell;
+    }
+    private HomeDashACEM1CellE acem1CellE(Context context, View convertView)
+    {
+        HomeDashACEM1CellE cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashACEM1CellE.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashACEM1CellE) convertView;
+        }
+
+        return cell;
+    }
+
+    private HomeDashEmptyCell emptyCell(Context context, View convertView)
+    {
+        HomeDashEmptyCell cell = null;
+
+        if (convertView == null)
+        {
+            cell = HomeDashEmptyCell.makeCell(context);
+        }
+        else
+        {
+            cell = (HomeDashEmptyCell) convertView;
+        }
+
+        return cell;
+    }
+//    private ApexResultAirAwbInfoCell dequeueAirAwbInfoCell(Context context, View convertView)
+//    {
+//
+//        ApexResultAirAwbInfoCell cell = null;
+//
+//        if (convertView == null)
+//        {
+//            cell = ApexResultAirAwbInfoCell.makeBLInfoCell(context);
+//        }
+//        else
+//        {
+//            cell = (ApexResultAirAwbInfoCell) convertView;
+//        }
+//
+//        return cell;
+//    }
+//
+//    private ApexResultBookingCell dequeueBookingCell(Context context, View convertView)
+//    {
+//
+//        ApexResultBookingCell cell = null;
+//
+//        if (convertView == null)
+//        {
+//            cell = ApexResultBookingCell.makeBookingCell(context);
+//        }
+//        else
+//        {
+//            cell = (ApexResultBookingCell) convertView;
+//        }
+//
+//        return cell;
+//    }
+//
+//    private ApexResultBLInfoCell dequeueBLInfoCell(Context context, View convertView)
+//    {
+//
+//        ApexResultBLInfoCell cell = null;
+//
+//        if (convertView == null)
+//        {
+//            cell = ApexResultBLInfoCell.makeBLInfoCell(context);
+//        }
+//        else
+//        {
+//            cell = (ApexResultBLInfoCell) convertView;
+//        }
+//
+//        return cell;
+//    }
+//
+//    private ApexResultContainerCell dequeueContainerCell(Context context, View convertView)
+//    {
+//
+//        ApexResultContainerCell cell = null;
+//
+//        if (convertView == null)
+//        {
+//            cell = ApexResultContainerCell.makeContainerCell(context);
+//        }
+//        else
+//        {
+//            cell = (ApexResultContainerCell) 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
+
+}

+ 581 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeDashPresenter.java

@@ -0,0 +1,581 @@
+package com.usai.ratradefiling.home;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+//
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.apexresult.model.ApexResultAirAwbInfoModel;
+//import com.usai.apex.apexresult.model.ApexResultAirBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultBLInfoModel;
+//import com.usai.apex.apexresult.model.ResultBaseModel;
+//import com.usai.apex.apexresult.model.ApexResultBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultContainerModel;
+//import com.usai.apex.apexresult.model.ApexResultDocumentModel;
+import com.usai.ratradefiling.base.ResultBaseModel;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACEM1ModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACIModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashISFModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDasheManifestModelE;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
+import com.usai.redant.rautils.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 HomeDashPresenter implements HomeDashAdapter.HomeDashDataSource {
+
+    // 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<ResultBaseModel> mDataArray;
+    private JSONArray rowActions;
+    private JSONArray actions;
+    public boolean dirty = true;
+//    private ArrayList<ApexResultMenuItem> mMenuItems;
+
+
+
+    public HomeDashPresenter(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 (ResultBaseModel 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<ResultBaseModel> models = new ArrayList<>();
+                for (int i = 0; i < jsonArray.length(); i++) {
+                    JSONObject item = jsonArray.optJSONObject(i);
+                    if (item != null) {
+                        ResultBaseModel 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 ResultBaseModel modelAtIndex(int index) {
+        if (index >= dataCount()) {
+            return null;
+        }
+        return mDataArray.get(index);
+    }
+
+    public JSONArray rowActionParametersForIndex(int position) {
+        ResultBaseModel 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;
+    }
+
+//    public ArrayList<ApexResultMenuItem> getMenuItems() {
+//        return mMenuItems;
+//    }
+
+    // endregion
+
+    // region DataSource
+
+    @Override
+    public int numberOfResultItem() {
+        return dataCount();
+    }
+
+    @Override
+    public ResultBaseModel resultModelForIndex(int index) {
+        return modelAtIndex(index);
+    }
+
+    // endregion
+
+    // region Private
+
+    private ResultBaseModel makeModel(JSONObject item) {
+        if (item != null) {
+            int type = item.optInt("type", -1);
+
+            if (type < ResultBaseModel.HomeDashResultType.values().length) {
+                ResultBaseModel.HomeDashResultType resultType = ResultBaseModel.HomeDashResultType.values()[type];
+                switch (resultType) {
+
+
+                    case DashResultTypeEmpty:
+                    {
+                        ResultBaseModel emptymodel= new ResultBaseModel();
+                        emptymodel.type=type;
+                        return emptymodel;
+                    }
+                    case DashResultTypeACIPending: {
+                        HomeDashACIModelP model = new HomeDashACIModelP();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeeManifestPending: {
+                        HomeDasheManifestModelP model = new HomeDasheManifestModelP();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeACEM1Pending: {
+                        HomeDashACEM1ModelP model = new HomeDashACEM1ModelP();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeISFPending: {
+                        HomeDashISFModelP model = new HomeDashISFModelP();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeACIError: {
+                        HomeDashACIModelE model = new HomeDashACIModelE();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeeManifestError: {
+                        HomeDasheManifestModelE model = new HomeDasheManifestModelE();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeACEM1Error: {
+                        HomeDashACEM1ModelE model = new HomeDashACEM1ModelE();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case DashResultTypeISFError: {
+                        HomeDashISFModelE model = new HomeDashISFModelE();
+                        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<ResultBaseModel> 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) {
+//
+//                                ResultBaseModel 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");
+//
+//                    JSONArray menu = json.optJSONArray("menu");
+//                    if (menu != null) {
+//
+//                        ArrayList<ApexResultMenuItem> menuItems = new ArrayList<>();
+//                        int len = menu.length();
+//                        for (int i = 0; i < len; i++) {
+//
+//                            JSONObject item = menu.optJSONObject(i);
+//                            if (item != null) {
+//
+//                                ApexResultMenuItem menuItem = new ApexResultMenuItem();
+//                                menuItem.setValuesForKeysWithJSON(item);
+//                                menuItems.add(menuItem);
+//                            }
+//                        }
+//                        mMenuItems = menuItems;
+//                    }
+//
+//                    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
+}

+ 1562 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeFragment.java

@@ -0,0 +1,1562 @@
+package com.usai.ratradefiling.home;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.Button;
+import android.widget.ExpandableListView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.fragment.app.Fragment;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import com.usai.ratradefiling.TradeFilingApplication;
+//import com.usai.ratradefiling.MainActivity;
+import com.usai.ratradefiling.R;
+//import com.usai.ratradefiling.SaveInstanceHelper;
+//import com.usai.ratradefiling.badgeview.BadgeView;
+import com.usai.ratradefiling.base.ResultBaseModel;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+import com.usai.ratradefiling.detail.DetailActivity;
+//import com.usai.ratradefiling.message.MessageActivity;
+import com.usai.ratradefiling.home.dashcell.HomeDashEmptyCell;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashACEM1CellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashACICellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDashISFCellE;
+import com.usai.ratradefiling.home.dashcell.error.HomeDasheManifestCellE;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashACEM1CellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashACICellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDashISFCellP;
+import com.usai.ratradefiling.home.dashcell.pending.HomeDasheManifestCellP;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACEM1ModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashACIModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDashISFModelE;
+import com.usai.ratradefiling.home.dashmodel.error.HomeDasheManifestModelE;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACEM1ModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashACIModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDashISFModelP;
+import com.usai.ratradefiling.home.dashmodel.pending.HomeDasheManifestModelP;
+import com.usai.redant.rautils.operationqueue.OperationQueue;
+import com.usai.redant.rautils.utils.Network;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Error;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACEM1Pending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeACIPending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeEmpty;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeISFPending;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestError;
+import static com.usai.ratradefiling.base.ResultBaseModel.HomeDashResultType.DashResultTypeeManifestPending;
+
+//import com.usai.ratradefiling.settings;
+
+public class HomeFragment extends Fragment
+{
+
+    public final static String HomeReloadBroadcastAction = "com.usai.redant.apexdriver.home_refresh";
+
+    private final static int REQUEST_MORE_CODE = 0;
+
+    private final static String SavedFirstVisible = "SavedFirstVisible";
+
+    private Context mCtx;
+    private HomeFragment self = this;
+    private ExpandableListView mListView;
+    private SwipeRefreshLayout mRefresh;
+    private HomeListAdapter mAdapter;
+    private HomeHandler mHandler = new HomeHandler(this);
+    private HomeBroadCastReceiver mReceiver;
+
+
+    private TextView mEmptyView;
+    private RelativeLayout mEmptyContainer;
+    private HomeHeaderView mHeaderView;
+
+//    private HomeHeaderModel mHeaderModel = new HomeHeaderModel();
+    private ResultBaseModel mSelectedModel;
+    private ArrayList<HomeSectionModel> mSectionArray = new ArrayList<>();
+    private int mFirstVisible = 0;
+
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
+    {
+
+        /**
+         * 直接inflate并返回的,结果是看不到View
+         * */
+        View view = super.onCreateView(inflater, container, savedInstanceState);
+        if (view == null)
+        {//
+            view = inflater.inflate(R.layout.fragment_home, container, false);
+        }
+        ViewGroup parent = (ViewGroup) view.getParent();
+        if (parent != null)
+        {
+            parent.removeView(view);
+        }
+        return view;
+    }
+
+    @Override
+    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
+    {
+        super.onViewCreated(view, savedInstanceState);
+
+        mCtx = getActivity();
+
+        mListView = view.findViewById(R.id.home_list_view);
+
+        mAdapter = new HomeListAdapter();
+        mListView.setAdapter(mAdapter);
+        mListView.setGroupIndicator(null); // Section Header前面有一个小三角,移除。也可以设置自己的图片
+        mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener()
+        {
+            @Override
+            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
+            {
+
+                HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+                ResultBaseModel orderModel = sectionModel.orderModelForIndex(childPosition);
+
+//                if (mSelectedModel != null)
+//                {
+//                    mSelectedModel.setSelection(false);
+//                }
+//                mSelectedModel = orderModel;
+//                if (mSelectedModel != null)
+//                {
+//                    mSelectedModel.setSelection(true);
+//                }
+
+//                if (orderModel.getBackendFlag()) {
+//                    orderModel.setBackendFlag(!orderModel.getBackendFlag());
+//                    sectionModel.setBackendFlagCount(--sectionModel.backendFlagCount);
+//                }
+
+//                checOrder(orderModel.orderID);
+
+//                Intent intent = DetailActivity.build(mCtx, orderModel.orderID, orderModel.status, orderModel.order_type2, orderModel.status_no);
+//                mCtx.startActivity(intent);
+
+                return false;
+            }
+        });
+        mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener()
+        {
+            @Override
+            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id)
+            {
+                return true;
+            }
+        });
+
+        mRefresh = view.findViewById(R.id.home_refresh);
+        mRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
+        {
+            @Override
+            public void onRefresh()
+            {
+                loadData();
+            }
+        });
+
+        // header
+        mHeaderView = HomeHeaderView.headerView(mCtx);
+//        mHeaderView.setDelegate(this);
+        mListView.addHeaderView(mHeaderView);
+
+        mEmptyContainer = view.findViewById(R.id.home_empty_view);
+        mEmptyView = view.findViewById(R.id.home_empty_btn);
+        mEmptyView.setText(getString(R.string.empty_msg));
+        mEmptyView.setOnClickListener(new View.OnClickListener()
+        {
+            @Override
+            public void onClick(View v)
+            {
+                loadData();
+            }
+        });
+//        mListView.setEmptyView(view.findViewById(R.id.home_empty_view));
+
+        mListView.setOnScrollListener(new AbsListView.OnScrollListener()
+        {
+            @Override
+            public void onScrollStateChanged(AbsListView view, int scrollState)
+            {
+
+            }
+
+            @Override
+            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
+            {
+                mFirstVisible = firstVisibleItem;
+            }
+        });
+
+        {
+
+            registBroadcastReceiver();
+
+            if (savedInstanceState != null)
+            {
+
+                recovery();
+
+                final int tmpVisible = savedInstanceState.getInt(SavedFirstVisible);
+                mListView.post(new Runnable()
+                {
+                    @Override
+                    public void run()
+                    {
+                        mListView.setSelection(tmpVisible);
+                    }
+                });
+
+            }
+            else
+            {
+                loadData();
+            }
+        } // initial
+    }
+
+    @Override
+    public void onSaveInstanceState(@NonNull Bundle outState)
+    {
+        super.onSaveInstanceState(outState);
+
+//        outState.putInt(SavedFirstVisible,mFirstVisible);
+//
+//        SaveInstanceHelper.HomeSaveHelper helper = SaveInstanceHelper.getInstance().getHomeSaveHelper();
+//        helper.saved = true;
+//        helper.mHeaderModel = mHeaderModel;
+//        helper.mSelectedModel = mSelectedModel;
+//        helper.mSectionArray = mSectionArray;
+//
+//        if (mSectionArray != null && mSectionArray.size() > 0) {
+//            for (HomeSectionModel sectionModel : mSectionArray) {
+//                sectionModel.clearDelegate();
+//            }
+//        }
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data)
+    {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (requestCode == REQUEST_MORE_CODE)
+        {
+
+            if (requestCode == Activity.RESULT_OK && data != null)
+            {
+
+                boolean reload = data.getBooleanExtra("reload", false);
+                if (reload)
+                {
+                    loadData();
+                }
+            }
+        }
+    }
+
+    @Override
+    public void onResume()
+    {
+        super.onResume();
+
+        recovery();
+    }
+
+    @Override
+    public void onDestroy()
+    {
+        super.onDestroy();
+
+        mCtx.unregisterReceiver(mReceiver);
+        dismissProgressDialog();
+    }
+
+    private void recovery()
+    {
+
+//        final SaveInstanceHelper.HomeSaveHelper helper = SaveInstanceHelper.getInstance().getHomeSaveHelper();
+//        if (helper.saved) {
+//
+//            mHeaderModel = helper.mHeaderModel;
+//            mSelectedModel = helper.mSelectedModel;
+//            mSectionArray = helper.mSectionArray;
+//
+//            changeData();
+//
+//            final Intent intent = helper.homeBroadcastIntent;
+//            if (intent != null) {
+//
+//                new Handler().post(new Runnable() {
+//                    @Override
+//                    public void run() {
+//                        mReceiver.onReceive(ApexDriverApplication.sharedApplication(), intent);
+//                    }
+//                });
+//            }
+//
+//        }
+//        helper.clear();
+    }
+
+//    private void updateHomeHeader() {
+//
+//        mHeaderView.setAvailable(mHeaderModel.driver_available);
+//        mHeaderView.setNewCount(mHeaderModel.new_count);
+//        mHeaderView.setProcessingCount(mHeaderModel.processing_count);
+//        mHeaderView.setFinishCount(mHeaderModel.finish_count);
+//        mHeaderView.setExistNewMessage(mHeaderModel.message_count > 0);
+//    }
+
+    private void registBroadcastReceiver()
+    {
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(HomeReloadBroadcastAction);
+        intentFilter.addAction(DetailActivity.CheckDetailNotification);
+
+        mReceiver = new HomeBroadCastReceiver();
+        mCtx.registerReceiver(mReceiver, intentFilter);
+    }
+
+    private void updateEmptyViewState(boolean empty)
+    {
+
+        if (empty)
+        {
+
+            int top = 0;
+            if (mHeaderView != null)
+            {
+                ViewGroup.LayoutParams layoutParams = mHeaderView.getLayoutParams();
+                if (layoutParams != null)
+                {
+                    top = layoutParams.height;
+                }
+            }
+
+            if (mEmptyContainer != null)
+            {
+                mEmptyContainer.setVisibility(View.VISIBLE);
+                ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) mEmptyContainer.getLayoutParams();
+                if (layoutParams != null)
+                {
+                    layoutParams.setMargins(0, top, 0, 0);
+                }
+            }
+
+        }
+        else
+        {
+            if (mEmptyContainer != null)
+            {
+                mEmptyContainer.setVisibility(View.GONE);
+            }
+        }
+    }
+
+    private ProgressDialog mProgressDialog;
+
+    private void showProgressDialog()
+    {
+        if (mProgressDialog == null)
+        {
+            mProgressDialog = new ProgressDialog(mCtx);
+            mProgressDialog.setMessage(getString(R.string.loading));
+            mProgressDialog.setCancelable(false);
+            mProgressDialog.show();
+        }
+    }
+
+    private void dismissProgressDialog()
+    {
+        if (mProgressDialog != null && mProgressDialog.isShowing())
+        {
+            mProgressDialog.dismiss();
+        }
+        mProgressDialog = null;
+    }
+
+    private void showWarningMsg(String msg)
+    {
+        if (msg == null || msg.length() == 0)
+        {
+            return;
+        }
+
+        new AlertDialog.Builder(mCtx).setTitle(getString(R.string.warning))
+                .setMessage(msg)
+                .setPositiveButton(getString(R.string.btn_ok), null)
+                .show();
+    }
+
+    private void changeData()
+    {
+
+        /**
+         * 手动调用打开/关闭 Group,否则默认关闭
+         * */
+        for (int i = 0; i < mSectionArray.size(); i++)
+        {
+            HomeSectionModel sectionModel = mSectionArray.get(i);
+            mListView.expandGroup(i);
+        }
+
+        mAdapter.notifyDataSetChanged();
+//        updateHomeHeader();
+    }
+
+    private void handleJson(JSONObject json)
+    {
+
+        Message msg = new Message();
+        msg.what = HomeHandler.HomeActionReloadData;
+        msg.obj = json;
+        mHandler.sendMessage(msg);
+    }
+
+    private void handleJsonOnUI(JSONObject json)
+    {
+
+        if (json != null)
+        {
+            try
+            {
+                JSONArray sectionArr = json.optJSONArray("sections");
+                if (sectionArr != null)
+                {
+                    mSectionArray.clear();
+
+                    for (int i = 0; i < sectionArr.length(); i++)
+                    {
+
+                        JSONObject section = sectionArr.getJSONObject(i);
+                        HomeSectionModel model = new HomeSectionModel(mCtx);
+                        model.section = i;
+
+                        model.type = section.optInt("type");
+                        model.title = section.optString("title");
+                        model.setOrders(section.optJSONArray("orders"));
+                        model.totalCount = section.optInt("totalCount", 0);
+                        model.backendFlagCount = section.optInt("backendFlagCount");
+
+                        mSectionArray.add(model);
+                    }
+
+//                    mHeaderModel.setValuesForKeysWithJSON(json);
+                }
+            } catch (JSONException e)
+            {
+                e.printStackTrace();
+            }
+        }
+
+        changeData();
+    }
+
+    private void loadData()
+    {
+
+//        if(true)
+//            return;
+        getActivity().findViewById(R.id.label_cache).setVisibility(View.INVISIBLE);
+        showProgressDialog();
+
+        if (mSectionArray != null)
+        {
+            mSectionArray.clear();
+        }
+        if (mAdapter != null)
+        {
+            mAdapter.notifyDataSetChanged();
+        }
+
+        new Thread(new Runnable()
+        {
+            @Override
+            public void run()
+            {
+
+                JSONObject json = RADataProvider.LoadHome();
+                if (json != null)
+                {
+                    try
+                    {
+
+                        int restul = json.getInt("result");
+                        final JSONArray sectionArr = json.optJSONArray("sections");
+                        if (restul == Network.RESULT_TRUE)
+                        {
+                            getActivity().runOnUiThread(new Runnable()
+                            {
+                                @Override
+                                public void run()
+                                {
+                                    if (sectionArr != null && sectionArr.length() != 0)
+                                    {
+                                        mEmptyView.setVisibility(View.GONE);
+                                    }
+                                    else
+                                    {
+                                        mEmptyView.setVisibility(View.VISIBLE);
+                                    }
+                                }
+                            });
+//                            boolean requiredLocation = json.optBoolean("requiredLocation");
+//                            TradeFilingApplication.get_instance().setRequiredBackgroundLocation(requiredLocation);
+
+//                            if(json.optBoolean("iscache"))
+//                            {
+//
+//                                getActivity().runOnUiThread(new Runnable() {
+//                                    @Override
+//                                    public void run() {
+//                                        getActivity().findViewById(R.id.label_cache).setVisibility(View.VISIBLE);
+//                                    }
+//                                });
+//                            }
+                            mSelectedModel = null;
+                            handleJson(json);
+
+                        }
+                        else
+                        {
+                            getActivity().runOnUiThread(new Runnable()
+                            {
+                                @Override
+                                public void run()
+                                {
+                                    mEmptyView.setVisibility(View.VISIBLE);
+                                    ;
+                                }
+                            });
+                            // error
+                            Message msg = new Message();
+                            msg.what = HomeHandler.HomeActionError;
+
+                            String errMsg = json.optString("err_msg");
+                            if (errMsg == null || errMsg.length() == 0)
+                            {
+                                errMsg = getString(R.string.sorry);
+                            }
+                            msg.obj = errMsg;
+
+                            mHandler.sendMessage(msg);
+
+                        }
+
+                    } catch (JSONException e)
+                    {
+                        e.printStackTrace();
+                        // error
+                        Message msg = new Message();
+                        msg.what = HomeHandler.HomeActionError;
+
+                        String errMsg = getString(R.string.sorry);
+                        msg.obj = errMsg;
+
+                        mHandler.sendMessage(msg);
+                    }
+                }
+                else
+                {
+                    // error;
+                    getActivity().runOnUiThread(new Runnable()
+                    {
+                        @Override
+                        public void run()
+                        {
+                            mEmptyView.setVisibility(View.VISIBLE);
+                            ;
+                        }
+                    });
+                    Message msg = new Message();
+                    msg.what = HomeHandler.HomeActionError;
+
+                    String errMsg = getString(R.string.sorry);
+                    msg.obj = errMsg;
+
+                    mHandler.sendMessage(msg);
+                }
+
+            }
+
+        }).start();
+
+    }
+
+    private void updateDriverAvailable(final boolean available)
+    {
+
+        showProgressDialog();
+//        ApexDriverApplication.sharedApplication().getNetworkQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
+//            @Override
+//            public Object operationDoInBackground() {
+//
+//                return com.usai.ratradefiling.network.Network.updateDriverAvailable(available);
+//            }
+//        }, new OperationQueue.OperationCompletionCallBack() {
+//            @Override
+//            public void operationCompletion(Object object) {
+//
+//                dismissProgressDialog();
+//
+//                JSONObject json = (JSONObject)object;
+//
+//                if (json != null) {
+//
+//                    int result = json.optInt("result");
+//                    if (result == Network.RESULT_TRUE) {
+//
+//                        mHeaderView.setAvailable(available);
+//
+//                    } else {
+//                        String errMsg = json.optString("err_msg");
+//                        if (errMsg == null || errMsg.length() == 0) {
+//                            errMsg = getString(R.string.sorry);
+//                        }
+//                        showWarningMsg(errMsg);
+//                    }
+//                } else {
+//                    String errMsg = getString(R.string.sorry);
+//
+//                    showWarningMsg(errMsg);
+//                }
+//
+//
+//            }
+//        },null);
+    }
+
+//    private void startMoreActivity(String title, int type)
+//    {
+//
+//        Intent intent = HomeMoreActivity.build(mCtx, type, title);
+//
+//        startActivityForResult(intent, REQUEST_MORE_CODE);
+//    }
+//
+//    @Override
+//    public void newCountClick() {
+////        startMoreActivity(getString(R.string.new_order_title),HomeOrderModel.OrderStatusNew);
+//    }
+//
+//    @Override
+//    public void processingCountClick() {
+////        startMoreActivity(getString(R.string.processing_order_title),HomeOrderModel.OrderStatusProcessing);
+//    }
+//
+//    @Override
+//    public void finishedCountClick() {
+////        startMoreActivity(getString(R.string.finished_order_title),HomeOrderModel.OrderStatusFinish);
+//    }
+//
+//    @Override
+//    public void signoutClick() {
+////        ((MainActivity)getActivity()).logout();
+//    }
+//
+//    @Override
+//    public void settingClick() {
+////        com.usai.ratradefiling.setting.SettingActivity.startSettingActivity(mCtx);
+//    }
+//
+//    @Override
+//    public void availableClick() {
+//
+////        final boolean available = mHeaderView.isAvailable();
+////        String msg = getString(R.string.user_state_change_tip) + (available ? getString(R.string.user_state_unavailable) : getString(R.string.user_state_available));
+////        new AlertDialog.Builder(mCtx)
+////                .setTitle(getString(R.string.warning))
+////                .setMessage(msg)
+////                .setPositiveButton(getString(R.string.btn_ok), new DialogInterface.OnClickListener() {
+////                    @Override
+////                    public void onClick(DialogInterface dialog, int which) {
+////                        updateDriverAvailable(!available);
+////                    }
+////                })
+////                .setNegativeButton(getString(R.string.btn_cancel),null)
+////                .show();
+//
+//    }
+//
+//    @Override
+//    public void messageClick() {
+////        MessageActivity.startMessageActivity(mCtx);
+//    }
+
+    private static final class HomeHandler extends Handler
+    {
+
+        static final int HomeActionReloadData = 0;
+        static final int HomeActionError = 1;
+
+        WeakReference<HomeFragment> mWeakHome;
+
+        public HomeHandler(HomeFragment fragment)
+        {
+            mWeakHome = new WeakReference<>(fragment);
+        }
+
+        @Override
+        public void handleMessage(Message msg)
+        {
+            super.handleMessage(msg);
+
+            HomeFragment fragment = mWeakHome.get();
+            fragment.dismissProgressDialog();
+            if (fragment.mRefresh.isRefreshing())
+            {
+                fragment.mRefresh.setRefreshing(false);
+            }
+
+            switch (msg.what)
+            {
+                case HomeActionReloadData:
+                {
+
+                    JSONObject json = (JSONObject) msg.obj;
+                    fragment.handleJsonOnUI(json);
+                }
+                break;
+                case HomeActionError:
+                {
+                    String errMsg = (String) msg.obj;
+                    fragment.showWarningMsg(errMsg);
+                }
+                default:
+                {
+
+                }
+                break;
+            }
+        }
+    }
+
+
+    private static int HOME_CELL_TYPE_SECTION_HEADER = 0;
+    private static int HOME_CELL_TYPE_ORDER = 1;
+
+    private class HomeListAdapter extends BaseExpandableListAdapter
+    {
+
+
+        // region Configure Cell
+
+
+        private HomeDashACICellP aciCellP(Context context, View convertView)
+        {
+            HomeDashACICellP cell = null;
+
+            if (convertView == null || !HomeDashACICellP.class.isInstance(convertView))
+            {
+                cell = HomeDashACICellP.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashACICellP) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDashACICellE aciCellE(Context context, View convertView)
+        {
+            HomeDashACICellE cell = null;
+
+            if (convertView == null || !HomeDashACICellE.class.isInstance(convertView))
+            {
+                cell = HomeDashACICellE.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashACICellE) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDasheManifestCellP emanifestCellP(Context context, View convertView)
+        {
+            HomeDasheManifestCellP cell = null;
+
+
+            if (convertView == null || !HomeDasheManifestCellP.class.isInstance(convertView))
+            {
+                cell = HomeDasheManifestCellP.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDasheManifestCellP) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDasheManifestCellE emanifestCellE(Context context, View convertView)
+        {
+            HomeDasheManifestCellE cell = null;
+
+            if (convertView == null || !HomeDasheManifestCellE.class.isInstance(convertView))
+            {
+                cell = HomeDasheManifestCellE.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDasheManifestCellE) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDashISFCellP isfCellP(Context context, View convertView)
+        {
+            HomeDashISFCellP cell = null;
+
+            if (convertView == null || !HomeDashISFCellP.class.isInstance(convertView))
+            {
+                cell = HomeDashISFCellP.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashISFCellP) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDashISFCellE isfCellE(Context context, View convertView)
+        {
+            HomeDashISFCellE cell = null;
+
+            if (convertView == null || !HomeDashISFCellE.class.isInstance(convertView))
+            {
+                cell = HomeDashISFCellE.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashISFCellE) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDashACEM1CellP acem1CellP(Context context, View convertView)
+        {
+            HomeDashACEM1CellP cell = null;
+
+            if (convertView == null || !HomeDashACEM1CellP.class.isInstance(convertView))
+            {
+                cell = HomeDashACEM1CellP.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashACEM1CellP) convertView;
+            }
+
+            return cell;
+        }
+        private HomeDashACEM1CellE acem1CellE(Context context, View convertView)
+        {
+            HomeDashACEM1CellE cell = null;
+
+            if (convertView == null || !HomeDashACEM1CellE.class.isInstance(convertView))
+            {
+                cell = HomeDashACEM1CellE.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashACEM1CellE) convertView;
+            }
+
+            return cell;
+        }
+
+        private HomeDashEmptyCell emptyCell(Context context, View convertView)
+        {
+            HomeDashEmptyCell cell = null;
+
+            if (convertView == null || !HomeDashEmptyCell.class.isInstance(convertView))
+            {
+                cell = HomeDashEmptyCell.makeCell(context);
+            }
+            else
+            {
+                cell = (HomeDashEmptyCell) convertView;
+            }
+
+            return cell;
+        }
+
+
+        // endregion
+
+        private class SectionHeaderHolder implements View.OnClickListener, HomeSectionModel.SectionModelListener
+        {
+
+            TextView titleTv;
+            //            BadgeView badgeView;
+            Button expandBtn;
+            WeakReference<HomeSectionModel> weakSectionModel;
+
+            SectionHeaderHolder(View view)
+            {
+
+                titleTv = view.findViewById(R.id.header_title_tv);
+//                badgeView = view.findViewById(R.id.header_badge_tv);
+//                badgeView.setBackgroundColor(getResources().getColor(R.color.ApexDriverRedColor));
+                expandBtn = view.findViewById(R.id.section_switch_btn);
+                expandBtn.setOnClickListener(this);
+                expandBtn.setText(getString(R.string.btn_more));
+
+                view.setTag(this);
+            }
+
+            void bindSectionModel(HomeSectionModel model)
+            {
+                if (weakSectionModel != null)
+                {
+
+                    HomeSectionModel homeSectionModel = weakSectionModel.get();
+                    if (homeSectionModel != null)
+                    {
+                        homeSectionModel.listener = null;
+                    }
+
+                }
+                if (model == null)
+                {
+                    weakSectionModel = null;
+                }
+                else
+                {
+                    weakSectionModel = new WeakReference<>(model);
+                }
+                if (weakSectionModel != null)
+                {
+                    weakSectionModel.get().listener = this;
+                }
+                refresh();
+            }
+
+            @Override
+            public void onClick(View v)
+            {
+                HomeSectionModel sectionModel = weakSectionModel.get();
+
+//                Intent intent = HomeMoreActivity.build(mCtx, sectionModel.type, sectionModel.title);
+//
+//                startActivityForResult(intent, REQUEST_MORE_CODE);
+            }
+
+            @Override
+            public void refresh()
+            {
+
+                HomeSectionModel model = null;
+                if (weakSectionModel != null)
+                {
+                    model = weakSectionModel.get();
+                }
+
+                if (model != null)
+                {
+                    titleTv.setText(model.title);
+//                    badgeView.setBadgeCount(model.backendFlagCount);
+                    if (model.hasMore())
+                    {
+                        expandBtn.setVisibility(View.VISIBLE);
+                    }
+                    else
+                    {
+                        expandBtn.setVisibility(View.GONE);
+                    }
+                }
+                else
+                {
+                    titleTv.setText(null);
+                    expandBtn.setVisibility(View.GONE);
+                }
+
+
+            }
+        }
+
+//        private class OrderCellHolder
+//        {
+//
+//            WeakReference<LinearLayout> weakCell;
+//
+//            OrderCellHolder(View view)
+//            {
+//
+//                view.setTag(this);
+//                weakCell = new WeakReference<>((LinearLayout) view);
+//            }
+//
+//            void bindOrderModel(ResultBaseModel model)
+//            {
+//
+//                if (weakCell != null)
+//                {
+//
+//                    HomeCellLayout cellLayout = weakCell.get();
+//                    if (cellLayout != null)
+//                    {
+//                        cellLayout.bindOrderModel(model);
+//                    }
+//
+//
+//                }
+//            }
+//
+//        }
+
+        @Override
+        public boolean isEmpty()
+        {
+
+            return false;
+        }
+
+        @Override
+        public int getGroupCount()
+        {
+            int groupCount = 0;
+            if (mSectionArray == null)
+            {
+                groupCount = 0;
+            }
+            groupCount = mSectionArray.size();
+
+            updateEmptyViewState(groupCount == 0);
+
+            return groupCount;
+        }
+
+        @Override
+        public int getChildrenCount(int groupPosition)
+        {
+
+            HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+
+            int childrenCount = sectionModel.orderCount();
+
+            return childrenCount;
+        }
+
+        @Override
+        public Object getGroup(int groupPosition)
+        {
+            HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+            return sectionModel;
+        }
+
+        @Override
+        public Object getChild(int groupPosition, int childPosition)
+        {
+
+            HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+            return sectionModel.orderModelForIndex(childPosition);
+        }
+
+        @Override
+        public int getChildType(int groupPosition, int childPosition)
+        {
+            return 0;
+        }
+
+        @Override
+        public int getChildTypeCount()
+        {
+            return 2;
+        }
+
+        @Override
+        public long getGroupId(int groupPosition)
+        {
+            return groupPosition;
+        }
+
+        @Override
+        public long getChildId(int groupPosition, int childPosition)
+        {
+            return childPosition;
+        }
+
+        @Override
+        public boolean hasStableIds()
+        {
+            return true;
+        }
+
+        @Override
+        public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
+        {
+
+            View header;
+            SectionHeaderHolder holder;
+            if (convertView == null)
+            {
+
+                header = LayoutInflater.from(mCtx).inflate(R.layout.section_header, null);
+                holder = new SectionHeaderHolder(header);
+
+            }
+            else
+            {
+                header = convertView;
+                holder = (SectionHeaderHolder) convertView.getTag();
+            }
+
+            HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+            holder.bindSectionModel(sectionModel);
+
+            return header;
+        }
+
+        @Override
+        public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
+        {
+
+            Context context = getContext();
+            if (context != null)
+            {
+                HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+                ResultBaseModel model = sectionModel.orderModelForIndex(childPosition);
+//                ResultBaseModel model = (ResultBaseModel) getItem(position);
+
+
+                if(model.type == DashResultTypeACIPending.ordinal())
+                {
+                    HomeDashACIModelP dashmode = (HomeDashACIModelP)model;
+                    HomeDashACICellP cell=aciCellP(context, convertView);
+                    cell.prepareReuse();
+                    cell.setCCN(dashmode.ccn).setPCCN(dashmode.primary_ccn).setSN(dashmode.sn);
+                    return cell;
+                }
+                else if(model.type == DashResultTypeeManifestPending.ordinal())
+                {
+                    HomeDasheManifestModelP dashmode = (HomeDasheManifestModelP)model;
+                    HomeDasheManifestCellP cell=emanifestCellP(context, convertView);
+                    cell.prepareReuse();
+                    cell.setCCN(dashmode.ccn).setPrimaryCCN(dashmode.primary_ccn).setSN(dashmode.sn).setPreviousCCN(dashmode.previous_ccn);
+                    return cell;
+                }
+                else if(model.type == DashResultTypeACEM1Pending.ordinal())
+                    {
+                        HomeDashACEM1ModelP dashmode = (HomeDashACEM1ModelP)model;
+                        HomeDashACEM1CellP cell=acem1CellP(context, convertView);
+                        cell.prepareReuse();
+                        cell.setHBOL(dashmode.hbol).setMBOL(dashmode.mbol).setSN(dashmode.sn);
+                        return cell;
+                    }
+                    else if(model.type == DashResultTypeISFPending.ordinal())
+                        {
+                            HomeDashISFModelP dashmode = (HomeDashISFModelP)model;
+                            HomeDashISFCellP cell=isfCellP(context, convertView);
+                            cell.prepareReuse();
+                            cell.setBOL(dashmode.bol).setISFType(dashmode.isftype).setSN(dashmode.sn);
+                            return cell;
+
+                        }
+                        else if(model.type == DashResultTypeACIError.ordinal())
+                            {
+                                HomeDashACIModelE dashmode = (HomeDashACIModelE)model;
+                                HomeDashACICellE cell=aciCellE(context, convertView);
+                                cell.prepareReuse();
+                                cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
+                                return cell;
+                            }
+                            else if(model.type == DashResultTypeeManifestError.ordinal())
+                                {
+                                    HomeDasheManifestModelE dashmode = (HomeDasheManifestModelE)model;
+                                    HomeDasheManifestCellE cell=emanifestCellE(context, convertView);
+                                    cell.prepareReuse();
+                                    cell.setCCN(dashmode.ccn).setLog(dashmode.log).setSN(dashmode.sn);
+                                    return cell;
+                                }
+                                else if(model.type == DashResultTypeACEM1Error.ordinal())
+                                    {
+                                        HomeDashACEM1ModelE dashmode = (HomeDashACEM1ModelE)model;
+                                        HomeDashACEM1CellE cell=acem1CellE(context, convertView);
+                                        cell.prepareReuse();
+                                        cell.setHBOL(dashmode.hbol).setLog(dashmode.log).setSN(dashmode.sn);
+                                        return cell;
+
+                                    }
+                                    else if(model.type == DashResultTypeISFError.ordinal())
+                                        {
+                                            HomeDashISFModelE dashmode = (HomeDashISFModelE)model;
+                                            HomeDashISFCellE cell=isfCellE(context, convertView);
+                                            cell.prepareReuse();
+                                            cell.setBOL(dashmode.bol).setLog(dashmode.log).setSN(dashmode.sn);
+                                            return cell;
+                                        }
+                                        else if(model.type == DashResultTypeEmpty.ordinal())
+                                            {
+
+                                                return emptyCell(context, convertView);
+//                HomeDashEmptyCell=
+
+                                            }
+
+                return new View(context);
+            }
+            return null;
+        }
+//        {
+//
+//
+//            View cell;
+//            OrderCellHolder holder;
+//            if (convertView == null)
+//            {
+//
+//                cell = LayoutInflater.from(mCtx).inflate(R.layout.home_order_cell, null);
+//                holder = new OrderCellHolder(cell);
+//
+//            }
+//            else
+//            {
+//
+//                cell = convertView;
+//                holder = (OrderCellHolder) convertView.getTag();
+//            }
+//            ((HomeCellLayout) cell).setIsMore(false);
+//
+//            if (groupPosition < mSectionArray.size())
+//            {
+//                HomeSectionModel sectionModel = mSectionArray.get(groupPosition);
+//                ResultBaseModel orderModel = sectionModel.orderModelForIndex(childPosition);
+//
+//                holder.bindOrderModel(orderModel);
+//            }
+//
+//            return cell;
+//        }
+
+        @Override
+        public boolean isChildSelectable(int groupPosition, int childPosition)
+        {
+            return true;
+        }
+
+        @Override
+        public void onGroupExpanded(int groupPosition)
+        {
+            super.onGroupExpanded(groupPosition);
+        }
+
+        @Override
+        public void onGroupCollapsed(int groupPosition)
+        {
+            super.onGroupCollapsed(groupPosition);
+        }
+    }
+
+    public static class HomeSectionModel
+    {
+
+        public interface SectionModelListener
+        {
+            void refresh();
+        }
+
+        int type; // OrderStatus
+        ArrayList<ResultBaseModel> orders;
+        String title;
+        int section;
+        long totalCount;
+        int backendFlagCount;
+        SectionModelListener listener;
+
+        private Context mContext;
+
+        public HomeSectionModel(Context context)
+        {
+            mContext = context;
+        }
+
+//        public void clearDelegate()
+//        {
+//            listener = null;
+//            if (orders != null && orders.size() > 0)
+//            {
+//                for (ResultBaseModel model : orders)
+//                {
+////                    model.clearDelegate();
+//                }
+//            }
+//        }
+
+        public void setBackendFlagCount(int count)
+        {
+            backendFlagCount = count;
+
+            if (listener != null)
+            {
+                listener.refresh();
+            }
+        }
+
+        int orderCount()
+        {
+            if (orders == null)
+            {
+                return 0;
+            }
+
+            return orders.size();
+        }
+
+        boolean hasMore()
+        {
+            return totalCount > orderCount();
+        }
+
+        void setOrders(JSONArray orders)
+        {
+            if (orders == null)
+            {
+                this.orders = null;
+                return;
+            }
+            ArrayList<ResultBaseModel> orderArr = new ArrayList<>();
+            for (int i = 0; i < orders.length(); i++)
+            {
+                JSONObject order = orders.optJSONObject(i);
+                if (order != null)
+                {
+//                    int type = order.optInt("type", -1);
+
+                    if (type < ResultBaseModel.HomeDashResultType.values().length) {
+                        ResultBaseModel.HomeDashResultType resultType = ResultBaseModel.HomeDashResultType.values()[type];
+                        switch (resultType) {
+
+
+                            case DashResultTypeEmpty:
+                            {
+                                ResultBaseModel emptymodel= new ResultBaseModel();
+                                emptymodel.type=type;
+                                orderArr.add(emptymodel);
+                                break;
+                            }
+                            case DashResultTypeACIPending: {
+                                HomeDashACIModelP model = new HomeDashACIModelP();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeeManifestPending: {
+                                HomeDasheManifestModelP model = new HomeDasheManifestModelP();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeACEM1Pending: {
+                                HomeDashACEM1ModelP model = new HomeDashACEM1ModelP();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeISFPending: {
+                                HomeDashISFModelP model = new HomeDashISFModelP();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeACIError: {
+                                HomeDashACIModelE model = new HomeDashACIModelE();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeeManifestError: {
+                                HomeDasheManifestModelE model = new HomeDasheManifestModelE();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeACEM1Error: {
+                                HomeDashACEM1ModelE model = new HomeDashACEM1ModelE();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+                            case DashResultTypeISFError: {
+                                HomeDashISFModelE model = new HomeDashISFModelE();
+                                model.setValuesForKeysWithJSON(order);
+                                model.type=type;
+                                orderArr.add(model);
+                                break;
+                            }
+
+
+
+                        }
+                    }
+
+                }
+            }
+            this.orders = orderArr;
+        }
+
+        ResultBaseModel orderModelForIndex(int index)
+        {
+            if (index >= orders.size())
+            {
+                return null;
+            }
+
+            return orders.get(index);
+        }
+
+//        int orderModelIndexForID(String id)
+//        {
+//
+//            if (id == null)
+//            {
+//                return 0;
+//            }
+//
+//            for (int i = 0; i < orders.size(); i++)
+//            {
+//
+//                ResultBaseModel model = orders.get(i);
+//                if (model.orderID != null && model.orderID.equals(id))
+//                {
+//                    return i;
+//                }
+//            }
+//            return 0;
+//        }
+
+    }
+
+//    private void checOrder(String orderId)
+//    {
+//
+//        if (mSectionArray == null || mSectionArray.size() == 0)
+//        {
+//            return;
+//        }
+//
+//        HomeOrderModel model = null;
+//        for (HomeSectionModel sectionModel : mSectionArray)
+//        {
+//            int count = sectionModel.orderCount();
+//            if (count > 0)
+//            {
+//                int index = sectionModel.orderModelIndexForID(orderId);
+//                model = sectionModel.orderModelForIndex(index);
+//                if (model != null && model.orderID.equals(orderId))
+//                {
+//
+//                    if (model.backendFlag)
+//                    {
+//
+//                        final HomeOrderModel fmodel = model;
+//                        final HomeSectionModel fsection = sectionModel;
+//
+//                        ((Activity) mCtx).runOnUiThread(new Runnable()
+//                        {
+//                            @Override
+//                            public void run()
+//                            {
+//
+//                                // 刷新Order Cell
+//                                fmodel.backendFlag = false;
+//
+//                                // 刷新Section
+//                                int backendCount = fsection.backendFlagCount;
+//                                if (backendCount > 0)
+//                                {
+//                                    backendCount--;
+//                                }
+//                                fsection.setBackendFlagCount(backendCount);
+//
+////                                // 刷新Message
+////                                int message_count = mHeaderModel.message_count;
+////                                if (message_count > 0)
+////                                {
+////                                    message_count--;
+////                                    mHeaderModel.message_count = message_count;
+////                                }
+////                                updateHomeHeader();
+//
+//                            }
+//                        });
+//                    }
+//
+//                }
+//                else
+//                {
+//                    model = null;
+//                }
+//            }
+//        }
+//    }
+
+    /**
+     * Receiver
+     */
+
+    private class HomeBroadCastReceiver extends BroadcastReceiver
+    {
+
+        @Override
+        public void onReceive(Context context, Intent intent)
+        {
+
+            if (intent.getAction() == HomeReloadBroadcastAction)
+            {
+                loadData();
+            }
+            else
+            {
+                if (intent.getAction() == DetailActivity.CheckDetailNotification)
+                {
+                    String orderId = intent.getStringExtra("order_id");
+                    if (orderId != null)
+                    {
+//                        checOrder(orderId);
+                    }
+                }
+            }
+
+        }
+    }
+}

+ 317 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeHeaderView.java

@@ -0,0 +1,317 @@
+package com.usai.ratradefiling.home;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.GridView;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.result.ResultActivity;
+import com.usai.redant.rautils.utils.FileManager;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class HomeHeaderView extends RelativeLayout {
+
+    JSONObject function_json=null;
+    GridView function_panel=null;
+
+    TextView tv_company;
+    TextView tv_recent;
+    public interface HomeHeaderDelegate {
+//        void signoutClick();
+//        void settingClick();
+//        void availableClick();
+//        void messageClick();
+//        void newCountClick();
+//        void processingCountClick();
+//        void finishedCountClick();
+    }
+
+    private Context mCtx;
+
+    public static HomeHeaderView headerView(Context ctx) {
+        HomeHeaderView headerView = (HomeHeaderView) LayoutInflater.from(ctx).inflate(R.layout.home_header_view1,null);
+        headerView.init();
+        return headerView;
+    }
+
+    public HomeHeaderView(Context context) {
+        this(context,null);
+    }
+
+    public HomeHeaderView(Context context, AttributeSet attrs) {
+        this(context, attrs,0);
+    }
+
+    public HomeHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+        mCtx = context;
+    }
+
+    private boolean initialized = false;
+//
+//    private View newContainer, processingContainer, finishedContainer;
+//    private TextView newCountTv,processingCountTv,finishCountTv,availableTv;
+//    private ImageView signoutBtn,settingBtn,availableBtn,messageBtn;
+//    private ImageView messageFlagView;
+//
+//    private boolean available,existNewMessage;
+    private HomeHeaderDelegate delegate;
+//    private int newCount,processingCount,finishCount;
+
+
+    public void setS30(String s30)
+    {
+        tv_recent.setText(s30);
+    }
+    private void init() {
+
+        if (initialized) {
+            return;
+        }
+        String userfilePath = TradeFilingApplication.get_instance().getFilesDir().getPath()+"/FunctionPanel_"+TradeFilingApplication.get_instance().get_user()+".json";
+        String  json_user= FileManager.readJson(userfilePath);
+
+        try {
+            function_json = new JSONObject(json_user);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        function_panel = findViewById(R.id.function_grid);
+        function_panel.setAdapter(new FunctionPanelAdapter(getContext(),function_json));
+        function_panel.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+
+
+                JSONObject item =(JSONObject) function_panel.getItemAtPosition(position);
+
+
+                Bundle parms = new Bundle();
+                parms.putString("sub_type",item.optString("sub_type",""));
+                ResultActivity.startResultActivity(mCtx, parms);
+//                clickItemCell(view, position);
+            }
+        });
+
+
+        tv_company = findViewById(R.id.tv_company);
+        tv_company.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if(TradeFilingApplication.get_instance().get_company_list().length()<2)
+                    return;
+            }
+        });
+
+
+        tv_company.setText(TradeFilingApplication.get_instance().get_current_company_name());
+
+        tv_recent = findViewById(R.id.tv_s30);
+
+
+//        newContainer = findViewById(R.id.new_count_container);
+//        processingContainer = findViewById(R.id.processing_count_container);
+//        finishedContainer = findViewById(R.id.finished_count_container);
+//
+//        newCountTv = findViewById(R.id.home_header_new_count_tv);
+//        processingCountTv = findViewById(R.id.home_header_processing_count_tv);
+//        finishCountTv = findViewById(R.id.home_header_finish_count_tv);
+//        availableTv = findViewById(R.id.home_header_available_tv);
+//
+//        signoutBtn = findViewById(R.id.home_header_sign_out_iv);
+//        settingBtn = findViewById(R.id.home_header_setting_iv);
+//        availableBtn = findViewById(R.id.home_header_available_iv);
+//        messageBtn = findViewById(R.id.home_header_message_iv);
+//
+//        messageFlagView = findViewById(R.id.home_header_message_flag_view);
+//
+//        setAvailable(false);
+//        setExistNewMessage(false);
+
+//        newContainer.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.newCountClick();
+//                }
+//            }
+//        });
+//
+//        processingContainer.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.processingCountClick();
+//                }
+//            }
+//        });
+//
+//        finishedContainer.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.finishedCountClick();
+//                }
+//            }
+//        });
+//
+//        signoutBtn.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.signoutClick();
+//                }
+//            }
+//        });
+//
+//        settingBtn.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.settingClick();
+//                }
+//            }
+//        });
+//
+//        availableBtn.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.availableClick();
+//                }
+//            }
+//        });
+//
+//        messageBtn.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (delegate != null) {
+//                    delegate.messageClick();
+//                }
+//            }
+//        });
+
+        initialized = true;
+    }
+//
+//    private String textFromCount(int count) {
+//
+//        if (count >= 0) {
+//            return String.format("%d",count);
+//        }
+//
+//        return null;
+//    }
+//
+//    public void setNewCount(int newCount) {
+//        this.newCount = newCount;
+//
+//        if (newCountTv == null) {
+//            return;
+//        }
+//
+//        newCountTv.setText(textFromCount(newCount));
+//    }
+//
+//    public void setProcessingCount(int processingCount) {
+//        this.processingCount = processingCount;
+//
+//        if (processingCountTv == null) {
+//            return;
+//        }
+//
+//        processingCountTv.setText(textFromCount(processingCount));
+//    }
+//
+//    public void setFinishCount(int finishCount) {
+//        this.finishCount = finishCount;
+//
+//        if (finishCountTv == null) {
+//            return;
+//        }
+//
+//        finishCountTv.setText(textFromCount(finishCount));
+//    }
+
+//    public int getNewCount() {
+//        return newCount;
+//    }
+//
+//    public int getProcessingCount() {
+//        return processingCount;
+//    }
+//
+//    public int getFinishCount() {
+//        return finishCount;
+//    }
+//
+//    public void setAvailable(boolean available) {
+//        this.available = available;
+//
+//        if (availableBtn == null || availableTv == null) {
+//            return;
+//        }
+//        if (available) {
+//
+//            if (availableBtn != null) {
+//                availableBtn.setImageResource(R.drawable.action_setting);
+//            }
+//            if (availableTv != null) {
+//                availableTv.setText("ava");
+//            }
+//
+//        } else {
+//
+//            if (availableBtn != null) {
+//                availableBtn.setImageResource(R.drawable.action_setting);
+//            }
+//            if (availableTv != null) {
+//                availableTv.setText("mCtx.getString(R.string.user_state_unavailable)");
+//            }
+//        }
+//    }
+//
+//    public boolean isAvailable() {
+//        return available;
+//    }
+//
+//    public void setExistNewMessage(boolean existNewMessage) {
+//        this.existNewMessage = existNewMessage;
+//
+//        if (messageFlagView == null || messageBtn == null) {
+//            return;
+//        }
+//
+//        if (existNewMessage) {
+//            messageBtn.setImageResource(R.drawable.action_setting);
+//            messageFlagView.setVisibility(VISIBLE);
+//
+//        } else {
+//            messageBtn.setImageResource(R.drawable.action_setting);
+//            messageFlagView.setVisibility(INVISIBLE);
+//        }
+//    }
+//
+//    public boolean isExistNewMessage() {
+//        return existNewMessage;
+//    }
+//
+//    public void setDelegate(HomeHeaderDelegate delegate) {
+//        this.delegate = delegate;
+//    }
+
+//    public HomeHeaderDelegate getDelegate() {
+//        return delegate;
+//    }
+}

+ 130 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/HomeOrderModel.java

@@ -0,0 +1,130 @@
+package com.usai.ratradefiling.home;
+import android.content.Context;
+import android.graphics.Bitmap;
+
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.redant.rautils.operationqueue.OperationQueue;
+import com.usai.redant.rautils.utils.ImageUtil;
+import com.usai.redant.rautils.utils.RAUtil;
+
+import java.net.URI;
+
+public class HomeOrderModel {
+
+    public static final int OrderStatusFinish = 3;
+    public static final int OrderStatusProcessing = 1;
+    public static final int OrderStatusNew = 2;
+
+    int status;
+    String title;
+    String orderNo;
+    String containerNo;
+    String date;
+    String orderID;
+    boolean selected;
+    String order_type2;
+    String iconURL;
+    boolean backendFlag;
+    String status_no;
+    String color;
+    String order_type;
+
+    OrderModelDelegate delegate;
+
+
+    private Bitmap mIcon;
+    private Context mCtx;
+    HomeOrderModel(Context context) {
+        mCtx = context;
+    }
+
+    public void setSelection(boolean selection) {
+        selected = selection;
+
+        if (delegate != null) {
+            delegate.refresh();
+        }
+    }
+
+    public void setBackendFlag(boolean flag) {
+        backendFlag = flag;
+
+        if (delegate != null) {
+            delegate.refresh();
+        }
+    }
+
+    public boolean getBackendFlag() {
+        return backendFlag;
+    }
+
+    public void setIconURL(String url) {
+        iconURL = url;
+//
+//        TradeFilingApplication.sharedApplication().getNetworkQueue().addOperationTask(new OperationQueue.OperationBackgroundCallBack() {
+//            @Override
+//            public Object operationDoInBackground() {
+//
+//                try {
+//
+////                    String url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1536134884&di=9ea523019212b373ac04f4411e8aa56b&imgtype=jpg&er=1&src=http%3A%2F%2Fp3.music.126.net%2Fyp-UZgqWp6FV_AN4hPozjQ%3D%3D%2F109951163414711232.jpg";
+////                    String url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1535609923557&di=ae4e880ba67797a64ccb8336f5fdee3f&imgtype=0&src=http%3A%2F%2Fpic48.nipic.com%2F20140909%2F6608733_105101600000_2.jpg";
+//
+//                    int size = (int) (RAUtil.dp2px(mCtx,50.0f));
+//                    Bitmap bitmap = ImageUtil.loadImageFromURL(mCtx,new URI(iconURL), size, size);
+//
+////                    bitmap = Bitmap.createScaledBitmap(bitmap, size, size, true);
+//
+//
+//                    return bitmap;
+//
+//                } catch (Exception e) {
+//                    e.printStackTrace();
+//                }
+//
+//                return null;
+//            }
+//        }, new OperationQueue.OperationCompletionCallBack() {
+//
+//            @Override
+//            public void operationCompletion(Object object) {
+//
+//                if (object != null) {
+//                    Bitmap bitmap = (Bitmap)object;
+//                    setIcon(bitmap);
+//                }
+//
+//            }
+//        },null);
+
+    }
+
+    public Bitmap getIcon() {
+
+        if (mCtx == null) {
+            return null;
+        }
+
+//        Bitmap bitmap = BitmapFactory.decodeResource(mCtx.getResources(), R.drawable.status_delivered);
+//
+//        return bitmap;
+
+        return mIcon;
+    }
+
+    public void setIcon(Bitmap icon) {
+        mIcon = icon;
+
+        if (delegate != null) {
+            delegate.refresh();
+        }
+    }
+
+    public interface OrderModelDelegate {
+        void refresh();
+    }
+
+    public void clearDelegate() {
+        delegate = null;
+    }
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/HomeDashEmptyCell.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashEmptyCell extends LinearLayout {
+
+    // region initial
+    public static HomeDashEmptyCell makeCell(Context context) {
+        HomeDashEmptyCell cell = (HomeDashEmptyCell) LayoutInflater.from(context).inflate(R.layout.home_dash_empty_cell, null);
+        cell.init();
+
+        return cell;
+    }
+
+//    private TextView snTV, hbolTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashEmptyCell(Context context) {
+        super(context);
+    }
+
+    public HomeDashEmptyCell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashEmptyCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+//        snTV = findViewById(R.id.tv_sn);
+//        hbolTV = findViewById(R.id.tv_hbol);
+//        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+//        snTV.setText("");
+//        hbolTV.setText("");
+//        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashEmptyCell setSN(String sn) {
+//        snTV.setText(sn);
+//        snTV.forceLayout();
+//        return this;
+//    }
+//
+//    public HomeDashEmptyCell setHBOL(String hbol) {
+//        hbolTV.setText(hbol);
+//        hbolTV.forceLayout();
+//        return this;
+//    }
+//    public HomeDashEmptyCell setLog(String log) {
+//        logTv.setText(log);
+//        logTv.forceLayout();
+//        return this;
+//    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 182 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/HomeDashSectionCell.java

@@ -0,0 +1,182 @@
+package com.usai.ratradefiling.home.dashcell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashSectionCell extends LinearLayout {
+
+    // region initial
+    public static HomeDashSectionCell makeCell(Context context) {
+        HomeDashSectionCell cell = (HomeDashSectionCell) LayoutInflater.from(context).inflate(R.layout.home_dash_acem1_cell_e, null);
+        cell.init();
+
+        return cell;
+    }
+
+//    private TextView snTV, hbolTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashSectionCell(Context context) {
+        super(context);
+    }
+
+    public HomeDashSectionCell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashSectionCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+//        snTV = findViewById(R.id.tv_sn);
+//        hbolTV = findViewById(R.id.tv_hbol);
+//        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+//        snTV.setText("");
+//        hbolTV.setText("");
+//        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashEmptyCell setSN(String sn) {
+//        snTV.setText(sn);
+//        snTV.forceLayout();
+//        return this;
+//    }
+//
+//    public HomeDashEmptyCell setHBOL(String hbol) {
+//        hbolTV.setText(hbol);
+//        hbolTV.forceLayout();
+//        return this;
+//    }
+//    public HomeDashEmptyCell setLog(String log) {
+//        logTv.setText(log);
+//        logTv.forceLayout();
+//        return this;
+//    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashACEM1CellE.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.error;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashACEM1CellE extends LinearLayout {
+
+    // region initial
+    public static HomeDashACEM1CellE makeCell(Context context) {
+        HomeDashACEM1CellE cell = (HomeDashACEM1CellE) LayoutInflater.from(context).inflate(R.layout.home_dash_acem1_cell_e, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, hbolTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashACEM1CellE(Context context) {
+        super(context);
+    }
+
+    public HomeDashACEM1CellE(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashACEM1CellE(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        hbolTV = findViewById(R.id.tv_hbol);
+        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        hbolTV.setText("");
+        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashACEM1CellE setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashACEM1CellE setHBOL(String hbol) {
+        hbolTV.setText(hbol);
+        hbolTV.forceLayout();
+        return this;
+    }
+    public HomeDashACEM1CellE setLog(String log) {
+        logTv.setText(log);
+        logTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashACICellE.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.error;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashACICellE extends LinearLayout {
+
+    // region initial
+    public static HomeDashACICellE makeCell(Context context) {
+        HomeDashACICellE cell = (HomeDashACICellE) LayoutInflater.from(context).inflate(R.layout.home_dash_aci_cell_e, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, ccnTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashACICellE(Context context) {
+        super(context);
+    }
+
+    public HomeDashACICellE(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashACICellE(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        ccnTV = findViewById(R.id.tv_ccn);
+        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        ccnTV.setText("");
+        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashACICellE setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashACICellE setCCN(String ccn) {
+        ccnTV.setText(ccn);
+        ccnTV.forceLayout();
+        return this;
+    }
+    public HomeDashACICellE setLog(String log) {
+        logTv.setText(log);
+        logTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDashISFCellE.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.error;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashISFCellE extends LinearLayout {
+
+    // region initial
+    public static HomeDashISFCellE makeCell(Context context) {
+        HomeDashISFCellE cell = (HomeDashISFCellE) LayoutInflater.from(context).inflate(R.layout.home_dash_isf_cell_e, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, bolTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashISFCellE(Context context) {
+        super(context);
+    }
+
+    public HomeDashISFCellE(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashISFCellE(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        bolTV = findViewById(R.id.tv_bol);
+        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        bolTV.setText("");
+        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashISFCellE setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashISFCellE setBOL(String bol) {
+        bolTV.setText(bol);
+        bolTV.forceLayout();
+        return this;
+    }
+    public HomeDashISFCellE setLog(String log) {
+        logTv.setText(log);
+        logTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/error/HomeDasheManifestCellE.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.error;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDasheManifestCellE extends LinearLayout {
+
+    // region initial
+    public static HomeDasheManifestCellE makeCell(Context context) {
+        HomeDasheManifestCellE cell = (HomeDasheManifestCellE) LayoutInflater.from(context).inflate(R.layout.home_dash_emanifest_cell_e, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, ccnTV, logTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDasheManifestCellE(Context context) {
+        super(context);
+    }
+
+    public HomeDasheManifestCellE(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDasheManifestCellE(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        ccnTV = findViewById(R.id.tv_ccn);
+        logTv = findViewById(R.id.tv_log);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        ccnTV.setText("");
+        logTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDasheManifestCellE setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDasheManifestCellE setCCN(String ccn) {
+        ccnTV.setText(ccn);
+        ccnTV.forceLayout();
+        return this;
+    }
+    public HomeDasheManifestCellE setLog(String log) {
+        logTv.setText(log);
+        logTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashACEM1CellP.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.pending;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashACEM1CellP extends LinearLayout {
+
+    // region initial
+    public static HomeDashACEM1CellP makeCell(Context context) {
+        HomeDashACEM1CellP cell = (HomeDashACEM1CellP) LayoutInflater.from(context).inflate(R.layout.home_dash_acem1_cell_p, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, hbolTV, mbolTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashACEM1CellP(Context context) {
+        super(context);
+    }
+
+    public HomeDashACEM1CellP(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashACEM1CellP(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        hbolTV = findViewById(R.id.tv_hbol);
+        mbolTv = findViewById(R.id.tv_mbol);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        hbolTV.setText("");
+        mbolTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashACEM1CellP setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashACEM1CellP setHBOL(String hbol) {
+        hbolTV.setText(hbol);
+        hbolTV.forceLayout();
+        return this;
+    }
+    public HomeDashACEM1CellP setMBOL(String mbol) {
+        mbolTv.setText(mbol);
+        mbolTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashACICellP.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.pending;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+import com.usai.ratradefiling.R;
+
+public class HomeDashACICellP extends LinearLayout {
+
+    // region initial
+    public static HomeDashACICellP makeCell(Context context) {
+        HomeDashACICellP cell = (HomeDashACICellP) LayoutInflater.from(context).inflate(R.layout.home_dash_aci_cell_p, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, ccnTV, pccnTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashACICellP(Context context) {
+        super(context);
+    }
+
+    public HomeDashACICellP(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashACICellP(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        ccnTV = findViewById(R.id.tv_ccn);
+        pccnTv = findViewById(R.id.tv_pccn);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        ccnTV.setText("");
+        pccnTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashACICellP setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashACICellP setCCN(String ccn) {
+        ccnTV.setText(ccn);
+        ccnTV.forceLayout();
+        return this;
+    }
+    public HomeDashACICellP setPCCN(String pccn) {
+        pccnTv.setText(pccn);
+        pccnTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 183 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDashISFCellP.java

@@ -0,0 +1,183 @@
+package com.usai.ratradefiling.home.dashcell.pending;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDashISFCellP extends LinearLayout {
+
+    // region initial
+    public static HomeDashISFCellP makeCell(Context context) {
+        HomeDashISFCellP cell = (HomeDashISFCellP) LayoutInflater.from(context).inflate(R.layout.home_dash_isf_cell_p, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, bolTV, typeTv;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDashISFCellP(Context context) {
+        super(context);
+    }
+
+    public HomeDashISFCellP(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDashISFCellP(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        bolTV = findViewById(R.id.tv_bol);
+        typeTv = findViewById(R.id.tv_isftype);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        bolTV.setText("");
+        typeTv.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDashISFCellP setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDashISFCellP setBOL(String bol) {
+        bolTV.setText(bol);
+        bolTV.forceLayout();
+        return this;
+    }
+    public HomeDashISFCellP setISFType(String type) {
+        typeTv.setText(type);
+        typeTv.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 190 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashcell/pending/HomeDasheManifestCellP.java

@@ -0,0 +1,190 @@
+package com.usai.ratradefiling.home.dashcell.pending;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class HomeDasheManifestCellP extends LinearLayout {
+
+    // region initial
+    public static HomeDasheManifestCellP makeCell(Context context) {
+        HomeDasheManifestCellP cell = (HomeDasheManifestCellP) LayoutInflater.from(context).inflate(R.layout.home_dash_emanifest_cell_p, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView snTV, ccnTV, primary_ccnTv,previous_ccnTV;
+//    private LinearLayout additionLayout;
+
+//    private ArrayList<ApexResultAdditionView> additionArray = new ArrayList<>();
+//    private int additionCount = 0;
+
+    public HomeDasheManifestCellP(Context context) {
+        super(context);
+    }
+
+    public HomeDasheManifestCellP(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public HomeDasheManifestCellP(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        snTV = findViewById(R.id.tv_sn);
+        ccnTV = findViewById(R.id.tv_ccn);
+        primary_ccnTv = findViewById(R.id.tv_primaryccn);
+        previous_ccnTV = findViewById(R.id.tv_previous_ccn);
+//        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);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        snTV.setText("");
+        ccnTV.setText("");
+        primary_ccnTv.setText("");
+        previous_ccnTV.setText("");
+//        detailTv.setText("");
+//        portTv.setText("");
+//        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+//        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 HomeDasheManifestCellP setSN(String sn) {
+        snTV.setText(sn);
+        snTV.forceLayout();
+        return this;
+    }
+
+    public HomeDasheManifestCellP setCCN(String ccn) {
+        ccnTV.setText(ccn);
+        ccnTV.forceLayout();
+        return this;
+    }
+    public HomeDasheManifestCellP setPrimaryCCN(String primaryCCN) {
+        primary_ccnTv.setText(primaryCCN);
+        primary_ccnTv.forceLayout();
+        return this;
+    }
+    public HomeDasheManifestCellP setPreviousCCN(String previousCCN) {
+        previous_ccnTV.setText(previousCCN);
+        previous_ccnTV.forceLayout();
+        return this;
+    }
+//
+//    public HomeDashACICellP setIcon(String icon) {
+//        if (icon != null) {
+//            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+//            statusIv.setImageResource(resourceId);
+//        } else {
+//            statusIv.setImageDrawable(null);
+//        }
+//        statusIv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setPort(String port) {
+//        portTv.setText(port);
+//        portTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setTime(String time) {
+//        dateTv.setText(time);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setDescription(String description) {
+//        descTv.setText(description);
+//        descTv.forceLayout();
+//        return this;
+//    }
+//
+//    public ApexResultBLInfoCell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        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);
+//
+//        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;
+//        additionLayout.forceLayout();
+//    }
+
+    // endregion
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashACEM1ModelE.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.error;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashACEM1ModelE extends ResultBaseModel
+{
+
+
+    // region Model
+    public String sn;
+    public String hbol;
+    public String log;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashACEM1ModelE() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (hbol != null) {
+                json.put("hbol", hbol);
+            }
+            if ( sn!= null) {
+                json.put("sn", sn);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashACIModelE.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.error;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashACIModelE extends ResultBaseModel
+{
+
+
+    // region Model
+    public String ccn;
+    public String sn;
+    public String log;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashACIModelE() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (ccn != null) {
+                json.put("ccn", ccn);
+            }
+            if (sn != null) {
+                json.put("sn", sn);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDashISFModelE.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.error;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashISFModelE extends ResultBaseModel
+{
+
+
+    // region Model
+    public String sn;
+    public String bol;
+    public String log;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashISFModelE() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (bol != null) {
+                json.put("bol", bol);
+            }
+            if ( sn!= null) {
+                json.put("sn", sn);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 69 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/error/HomeDasheManifestModelE.java

@@ -0,0 +1,69 @@
+package com.usai.ratradefiling.home.dashmodel.error;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDasheManifestModelE extends ResultBaseModel
+{
+
+
+    // region Model
+    public String ccn;
+    public String sn;
+    public String log;
+
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDasheManifestModelE() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+            if (log != null) {
+                json.put("log", log);
+            }
+            if (ccn != null) {
+                json.put("ccn", ccn);
+            }
+            if (sn != null) {
+                json.put("sn", sn);
+            }
+
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashACEM1ModelP.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.pending;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashACEM1ModelP extends ResultBaseModel
+{
+
+
+    // region Model
+    public String sn;
+    public String hbol;
+    public String mbol;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashACEM1ModelP() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (hbol != null) {
+                json.put("hbol", hbol);
+            }
+            if ( sn!= null) {
+                json.put("sn", sn);
+            }
+            if (mbol != null) {
+                json.put("mbol", mbol);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashACIModelP.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.pending;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashACIModelP extends ResultBaseModel
+{
+
+
+    // region Model
+    public String ccn;
+    public String sn;
+    public String primary_ccn;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashACIModelP() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (ccn != null) {
+                json.put("ccn", ccn);
+            }
+            if (sn != null) {
+                json.put("sn", sn);
+            }
+            if (primary_ccn != null) {
+                json.put("primary_ccn", primary_ccn);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 68 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDashISFModelP.java

@@ -0,0 +1,68 @@
+package com.usai.ratradefiling.home.dashmodel.pending;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDashISFModelP extends ResultBaseModel
+{
+
+
+    // region Model
+    public String sn;
+    public String bol;
+    public String isftype;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDashISFModelP() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (bol != null) {
+                json.put("bol", bol);
+            }
+            if ( sn!= null) {
+                json.put("sn", sn);
+            }
+            if (isftype != null) {
+                json.put("isftype", isftype);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 71 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/home/dashmodel/pending/HomeDasheManifestModelP.java

@@ -0,0 +1,71 @@
+package com.usai.ratradefiling.home.dashmodel.pending;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class HomeDasheManifestModelP extends ResultBaseModel
+{
+
+
+    // region Model
+    public String ccn;
+    public String sn;
+    public String primary_ccn;
+    public String previous_ccn;
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public HomeDasheManifestModelP() {
+
+    }
+
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+            if (previous_ccn != null) {
+                json.put("previous_ccn", previous_ccn);
+            }
+            if (ccn != null) {
+                json.put("ccn", ccn);
+            }
+            if (sn != null) {
+                json.put("sn", sn);
+            }
+            if (primary_ccn != null) {
+                json.put("primary_ccn", primary_ccn);
+            }
+//            if (detail != null) {
+//                json.put("detail", detail);
+//            }
+//            if (date != null) {
+//                json.put("date", date);
+//            }
+//            if (port != null) {
+//                json.put("port", port);
+//            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 512 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/login/LoginFragment.java

@@ -0,0 +1,512 @@
+package com.usai.ratradefiling.login;
+
+//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.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 androidx.fragment.app.Fragment;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
+import com.usai.ratradefiling.RootActivity;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+import com.usai.ratradefiling.utils.AES;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import static com.usai.redant.rautils.utils.Network.RESULT_AUTH_EXPIRED;
+import static com.usai.redant.rautils.utils.Network.RESULT_TRUE;
+//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 mLoginFormView1;
+	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) {
+
+		RootActivity pa=(RootActivity) getActivity();
+
+//		pa.changeStatusBarNormal();
+
+		View view = inflater.inflate(R.layout.fragment_login1, null);
+		TextView tv_ver = (TextView) view.findViewById(R.id.tv_ver);
+		try {
+			tv_ver.setText(getText(R.string.str_ver)+TradeFilingApplication.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 = TradeFilingApplication.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 == 1024
+								|| 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);
+		mLoginFormView1 = view.findViewById(R.id.login_form1);
+		mLoginStatusView = view.findViewById(R.id.login_status);
+		mLoginStatusMessageView = (TextView) view
+				.findViewById(R.id.login_status_message);
+
+		view.findViewById(R.id.tv_login).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);
+						}
+					});
+
+
+			mLoginFormView1.setVisibility(View.VISIBLE);
+			mLoginFormView1.animate().setDuration(shortAnimTime)
+					.alpha(show ? 0 : 1)
+					.setListener(new AnimatorListenerAdapter() {
+						@Override
+						public void onAnimationEnd(Animator animation) {
+							mLoginFormView1.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);
+			mLoginFormView1.setVisibility(show ? View.INVISIBLE : View.VISIBLE);
+		}
+	}
+
+	//
+	// /**
+	// * Represents an asynchronous login/registration task used to authenticate
+	// * the user.
+	// */
+	public class UserLoginTask extends AsyncTask<Void, Void, JSONObject> {
+		// int err_code = ERR_CODE_NONE;
+//		int errorcode;
+		JSONObject json;
+
+		@Override
+		protected JSONObject doInBackground(Void... params) {
+
+
+			json= RADataProvider.Login(m_sUser,m_sPassword);;
+			return json;
+//			errorcode =
+//			errorcode = OnlineDataProvider.get_Auth(m_sUser, m_sPassword);
+//			if (errorcode == OnlineDataProvider.RESULT_TRUE)
+//				return true;
+//			else {
+//				return false;
+//			}
+
+		}
+
+		@Override
+		protected void onPostExecute(final JSONObject jsobj) {
+			Log.d("onPostExecute", "entry");
+			mAuthTask = null;
+			showProgress(false);
+
+			try {
+				int result = jsobj.getInt("result");
+
+
+
+
+					switch (result) {
+						case RESULT_TRUE:
+						{
+							SharedPreferences pref = TradeFilingApplication.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();
+
+							TradeFilingApplication.getInstance().shouldCheckCache = true;
+
+							if(mCallBack!=null)
+								mCallBack.onLogin();
+
+
+							{
+
+								Intent intent = new Intent("Login");
+								intent.putExtra("state", true);
+								LocalBroadcastManager.getInstance(getActivity())
+										.sendBroadcast(intent);
+							}
+							return;
+						}
+						case OnlineDataProvider.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 OnlineDataProvider.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 OnlineDataProvider.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 OnlineDataProvider.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 OnlineDataProvider.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) + ":"
+											+ result, Toast.LENGTH_LONG);
+							toast.setGravity(Gravity.CENTER, 0, 0);
+							toast.show();
+							break;
+						}
+					}
+
+			} catch (JSONException e) {
+				e.printStackTrace();
+			}
+			// if (netconnect == )
+			// {
+			//
+			// }
+
+
+		}
+
+		@Override
+		protected void onCancelled() {
+			mAuthTask = null;
+			showProgress(false);
+		}
+	}
+}

+ 427 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/login/RetrievePasswordActivity.java

@@ -0,0 +1,427 @@
+package com.usai.ratradefiling.login;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.annotation.TargetApi;
+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.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 androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+
+
+/**
+ * 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 = RADataProvider.retrieve_pass(m_sUser, m_sEmail);
+			if (errorcode == OnlineDataProvider.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)
+			{
+				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 OnlineDataProvider.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 OnlineDataProvider.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 OnlineDataProvider.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 OnlineDataProvider.RESULT_FALSE:
+					{
+						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);
+		}
+	}
+}

+ 180 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/my/MyFragment.java

@@ -0,0 +1,180 @@
+package com.usai.ratradefiling.my;
+
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.ListView;
+
+import androidx.fragment.app.Fragment;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
+//import com.usai.apex.ChangePasswordActivity;
+//import com.usai.apex.saved.CheckSavedActivity;
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.StaticModelistFragment;
+
+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"))
+        {
+
+            if(true)
+                throw new AssertionError("not impl");
+//            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"))
+        {
+
+            if(true)
+                throw new AssertionError("not impl");
+//
+//            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"))
+        {
+
+            if(true)
+                throw new AssertionError("not impl");
+//            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");
+            intent.setPackage( getActivity().getPackageName());
+            getActivity().sendBroadcast(intent);
+            if(mCallBack!=null)
+                mCallBack.onLogout();
+
+            {
+
+                Intent bintent = new Intent("Login");
+                bintent.putExtra("state", false);
+                LocalBroadcastManager.getInstance(getActivity())
+                        .sendBroadcast(bintent);
+            }
+
+        }
+
+
+    }
+
+}

+ 15 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/raconst.java

@@ -0,0 +1,15 @@
+package com.usai.ratradefiling;
+
+public class raconst {
+    //
+//    public static final int		RESULT_FALSE					= 0;
+//    public static final int		RESULT_TRUE						= 2;
+//    public static final int		RESULT_NET_ERROR				= -3;
+//    public static final int		RESULT_NET_NOTAVAILABLE			= -4;
+//    public static final int		RESULT_ERROR					= -5;
+//    public static final int		RESULT_LOCALFILE_ERROR			= -7;
+//    public static final int		RESULT_USERAUTH_ERROR			= -9;
+//    public static final int		RESULT_UPDATE_USERAUTH_ERROR	= -11;
+//    public static final int		RESULT_SESSION_EXPIRED			= -13;
+//    public static final int		RESULT_VER_LOW					= -15;
+}

+ 696 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultActivity.java

@@ -0,0 +1,696 @@
+package com.usai.ratradefiling.result;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Color;
+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 androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+//import com.usai..TrackingApplication;
+//import com.usai..CustomizeFieldsActivity;
+//import com.usai..R;
+//import com.usai..mainframe.NewDetailActivity;
+//import com.usai..pdf.PDFPreviewActivity;
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.ratradefiling.fields.CustomizeFieldsActivity;
+import com.usai.ratradefiling.search.SearchListActivity;
+import com.usai.redant.rautils.actionsheet.ActionSheet;
+import com.usai.redant.rautils.utils.RAUtil;
+//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.ArrayList;
+import java.util.Iterator;
+
+
+public class ResultActivity extends AppCompatActivity implements ResultPresenter.ResultProtocol {
+
+    // region Build
+
+
+    private static final String ParametersKey = "_Result_Parameters_Key";
+
+    public static void startResultActivity(Context context, Bundle params) {
+
+        if (context != null) {
+
+            Intent intent = new Intent(context, ResultActivity.class);
+            if (params != null) {
+                intent.putExtra(ParametersKey, params);
+            }
+            context.startActivity(intent);
+        }
+
+    }
+
+    // endregion
+
+    // region Request Code
+
+    private static class RequestCode {
+
+        static final int Field_Setting = 1010;
+    }
+
+    // endregion
+
+    // region Property
+
+    private Context mCtx = this;
+
+
+    private SwipeRefreshLayout mRefreshLayout;
+    private ProgressBar mProgressBar;
+    private TextView mListFooterView;
+
+    private ScrollListener mScrollListener;
+
+    private ResultPresenter mPresenter;
+    private ResultAdapter mAdapter;
+    private Bundle mParams;
+
+    // endregion
+
+    // region Override
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_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.dirty = true;
+            mPresenter.loadData();
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+
+
+
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            return  true;
+        } else if (item.getItemId() == R.id.result_menu) {
+            menuItemClick();
+            return true;
+        }
+        else if (item.getItemId() == R.id.result_search) {
+                onSearchClick();
+                return true;
+            }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+
+        boolean bfrom_search=mParams.getBoolean("from_search",false);
+//        boolean bfrom_search=getIntent().getBooleanExtra("from_search",false);
+
+        if(bfrom_search)
+            getMenuInflater().inflate(R.menu.result_menu, menu);
+        else
+            getMenuInflater().inflate(R.menu.result_search_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 ResultPresenter(this, mParams);
+        mAdapter = new ResultAdapter(mCtx, mPresenter);
+
+        setupActionBar();
+        setupRefreshLayout();
+        setupListView();
+
+        mProgressBar = findViewById(R.id.result_progress_bar);
+    }
+
+    private void setupListView() {
+
+         ListView mListView = findViewById(R.id.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(RAUtil.sp2px(mCtx,8));
+        mListFooterView.setVisibility(View.INVISIBLE);
+    }
+
+    private void setupRefreshLayout() {
+
+        mRefreshLayout = findViewById(R.id.result_refresh_layout);
+        mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+            @Override
+            public void onRefresh() {
+                refresh();
+            }
+        });
+    }
+
+
+    private void setupActionBar() {
+
+        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+        if(actionBar != null){
+            actionBar.setHomeButtonEnabled(true);
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+    }
+
+    // endregion
+
+    // region Action
+    private void loadData() {
+        mPresenter.loadData();
+    }
+
+    private void refresh() {
+        isNoMore = false;
+        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 showMessage(String msg) {
+
+        new AlertDialog.Builder(mCtx)
+                .setTitle("Message")
+                .setMessage(msg)
+                .setPositiveButton("OK",null)
+                .show();
+    }
+    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() {
+        if(isNoMore) //首次nomore 不提示,当拖到底部再次刷新才提示
+            showMessage("No More Data");
+        isNoMore = true;
+        mListFooterView.setText("No more data");
+        mListFooterView.setVisibility(View.VISIBLE);
+//
+    }
+
+//    @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 onSearchClick()
+    {
+        Intent intent = new Intent();
+        intent.setClass(this, SearchListActivity.class);
+        // intent.putExtra("user", ApexTrackingApplication.get_user());
+        // intent.putExtra("password", password);
+        intent.putExtra("sub_type", mParams.getString("sub_type"));
+        intent.putExtra("title", "Booking Search");
+        startActivity(intent);
+    }
+
+    private void menuItemClick() {
+
+        ArrayList<ResultMenuItem> menuItems = mPresenter.getMenuItems();
+        if (menuItems != null && menuItems.size() > 0) {
+
+            ActionSheet actionSheet = new ActionSheet(mCtx);
+
+            int len = menuItems.size();
+            for (int i = 0; i < len; i++) {
+
+                final ResultMenuItem menuItem = menuItems.get(i);
+                actionSheet.addAction(menuItem.title, ActionSheet.ActionType.ActionTypeDefault, new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        if (menuItem.action != null) {
+
+                            if (menuItem.action.equals("save")) {
+
+                                saveSearchParameters();
+                            } else if (menuItem.action.equals("field_setting")) {
+                                showFieldsSetting();
+                            }
+                        }
+                    }
+                });
+            }
+
+            actionSheet.addAction("Cancel", ActionSheet.ActionType.ACtionTypeCancel, new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+
+                }
+            });
+
+            actionSheet.show();
+
+        } else {
+
+            new AlertDialog.Builder(mCtx)
+                    .setTitle("Warning")
+                    .setMessage("there is no menu field to response")
+                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+
+                        }
+                    })
+                    .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", TradeFilingApplication.get_user());
+        intent.putExtra("sub_type", mParams.getString("sub_type"));
+//        intent.putExtra("sub_type", mParams.getString("sub_type"));
+        intent.putExtra("type", "result");
+        intent.putExtra("forNewResult", true);
+        intent.putExtra("maxDisplayCount", 3);
+
+        startActivityForResult(intent, RequestCode.Field_Setting);
+    }
+
+    // endregion
+
+    // region Scroll Listener
+
+    private boolean isLoading = false;
+    private  boolean isNoMore = false;
+    private class ScrollListener implements AbsListView.OnScrollListener {
+
+        private int last_index, total_index;
+
+        @Override
+        public void onScrollStateChanged(AbsListView view, int scrollState) {
+//            if(isNoMore&& (scrollState == SCROLL_STATE_IDLE))
+//            {
+//                showMessage("No more data.");
+//                // no more 只提示一次
+////                isNoMore = false;
+////                return;
+//            }
+
+            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");
+//        String _schema = params.getString("_schema");
+//        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);
+//        if(_schema!=null)
+//            intent.putExtra("_schema",_schema);
+//
+//        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) {
+//
+//
+//
+////        File f = new File(file);
+////
+////        Intent intent = new Intent(Intent.ACTION_VIEW);
+////        intent.addCategory("android.intent.category.DEFAULT");
+////        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+////        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+////
+////        Uri uri = FileProvider.getUriForFile(this, RAUtil.getProviderAuthorities(), f);
+//////        Uri uri = Uri.fromFile(f);
+////        intent.setDataAndType(uri, "application/pdf");
+////        startActivity(intent);
+////
+////
+////        if(true)
+////            return;
+//
+//
+//
+//        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
+}

+ 400 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAdapter.java

@@ -0,0 +1,400 @@
+package com.usai.ratradefiling.result;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+//import com.usai.apex.apexresult.cell.ApexResultAirAwbInfoCell;
+//import com.usai.apex.apexresult.cell.ApexResultAirBookingCell;
+//import com.usai.apex.apexresult.cell.ApexResultBLInfoCell;
+//import com.usai.apex.apexresult.cell.ApexResultBookingCell;
+//import com.usai.apex.apexresult.cell.ApexResultContainerCell;
+//import com.usai.apex.apexresult.cell.ApexResultDocumentCell;
+//import com.usai.apex.apexresult.model.ApexResultAddition;
+//import com.usai.apex.apexresult.model.ApexResultAirAwbInfoModel;
+//import com.usai.apex.apexresult.model.ApexResultAirBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultBLInfoModel;
+//import com.usai.apex.apexresult.model.ResultBaseModel;
+//import com.usai.apex.apexresult.model.ApexResultBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultContainerModel;
+//import com.usai.apex.apexresult.model.ApexResultDocumentModel;
+import com.usai.ratradefiling.base.ResultBaseModel;
+import com.usai.ratradefiling.result.cell.ResultACEM1Cell;
+import com.usai.ratradefiling.result.cell.ResultACICell;
+import com.usai.ratradefiling.result.cell.ResultISFCell;
+import com.usai.ratradefiling.result.cell.ResulteManifestCell;
+import com.usai.ratradefiling.result.model.ResultACEM1Model;
+import com.usai.ratradefiling.result.model.ResultACIModel;
+import com.usai.ratradefiling.result.model.ResultISFModel;
+import com.usai.ratradefiling.result.model.ResulteManifestModel;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+public class ResultAdapter extends BaseAdapter {
+
+    // region DataSource
+    public static interface ApexResultAdapterDataSource {
+
+        int numberOfResultItem();
+        ResultBaseModel resultModelForIndex(int index);
+    }
+    // endregion
+
+    // region Initial
+    private WeakReference<Context> mWeakContext;
+    private WeakReference<ApexResultAdapterDataSource> mWeakDataSource;
+
+    public ResultAdapter(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 ResultBaseModel.ResultType.values().length;
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        ResultBaseModel model = (ResultBaseModel)getItem(position);
+        return model.type;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+
+        Context context = getContext();
+        if (context != null) {
+
+            ResultBaseModel model = (ResultBaseModel)getItem(position);
+            if (model.type == ResultBaseModel.ResultType.ResultTypeACEM1.ordinal()) {
+
+                ResultACEM1Model acem1Model = (ResultACEM1Model)model;
+                ResultACEM1Cell cell = dequeueACEM1Cell(context, convertView);
+                cell.prepareReuse();
+                cell.setHBOL(acem1Model.hbol).setMBOL(acem1Model.mbol).setIcon(acem1Model.getIcon()).setPort(acem1Model.port).setDate(acem1Model.date).setLog(acem1Model.log).setConsignee(acem1Model.consignee);
+
+                ArrayList<ResultAddition> additions = acem1Model.getAddition();
+                if (additions != null && additions.size() > 0) {
+                    for (ResultAddition addition : additions) {
+                        cell.addAddition(addition.name, addition.value);
+                    }
+                }
+
+                return cell;
+
+            }
+            else if (model.type == ResultBaseModel.ResultType.ResultTypeISF.ordinal()) {
+
+                ResultISFModel isfModel = (ResultISFModel)model;
+                ResultISFCell cell = dequeueISFCell(context, convertView);
+                cell.prepareReuse();
+                cell.setBOL(isfModel.bol).setTransactinNo(isfModel.transactionno).setIcon(isfModel.getIcon()).setISFType(isfModel.isftype).setLog(isfModel.log).setConsignee(isfModel.consignee);
+
+                ArrayList<ResultAddition> additions = isfModel.getAddition();
+                if (additions != null && additions.size() > 0) {
+                    for (ResultAddition addition : additions) {
+                        cell.addAddition(addition.name, addition.value);
+                    }
+                }
+
+                return cell;
+
+            }
+            else if (model.type == ResultBaseModel.ResultType.ResultTypeACI.ordinal()) {
+
+                    ResultACIModel aciModel = (ResultACIModel)model;
+                    ResultACICell cell = dequeueACICell(context, convertView);
+                    cell.prepareReuse();
+                    cell.setHBCCN(aciModel.hbccn).setPrimaryCCN(aciModel.primary_ccn).setIcon(aciModel.getIcon()).setLastAction(aciModel.lastaction).setLog(aciModel.log).setDate(aciModel.date);
+
+                    ArrayList<ResultAddition> additions = aciModel.getAddition();
+                    if (additions != null && additions.size() > 0) {
+                        for (ResultAddition addition : additions) {
+                            cell.addAddition(addition.name, addition.value);
+                        }
+                    }
+
+                    return cell;
+
+                }
+                else if (model.type == ResultBaseModel.ResultType.ResultTypeeManifest.ordinal()) {
+
+                        ResulteManifestModel emanifestModel = (ResulteManifestModel)model;
+                        ResulteManifestCell cell = dequeueeManifestCell(context, convertView);
+                        cell.prepareReuse();
+                        cell.setHBCCN(emanifestModel.hbccn).setPrimaryCCN(emanifestModel.primary_ccn).setIcon(emanifestModel.getIcon()).setDate(emanifestModel.date)
+                                .setLog(emanifestModel.log).setPreviousCCN(emanifestModel.previous_ccn).setIsClose(emanifestModel.inclose);
+
+                        ArrayList<ResultAddition> additions = emanifestModel.getAddition();
+                        if (additions != null && additions.size() > 0) {
+                            for (ResultAddition addition : additions) {
+                                cell.addAddition(addition.name, addition.value);
+                            }
+                        }
+
+                        return cell;
+
+                    }
+//            else if (model.type == ResultBaseModel.ResultType.APEX_RESULT_TYPE_AIRBOOKING.ordinal()) {
+//
+//                ApexResultAirBookingModel shipModel = (ApexResultAirBookingModel)model;
+//                ApexResultAirBookingCell cell = dequeueAirBookingCell(context, convertView);
+//                cell.prepareReuse();
+//                cell.setTitle(shipModel.title).setDetail(shipModel.detail).setIcon(shipModel.getIcon()).setPort(shipModel.port).setTime(shipModel.date).setDescription(shipModel.desc).setConsignee(shipModel.consignee);
+//
+//                ArrayList<ApexResultAddition> additions = shipModel.getAddition();
+//                if (additions != null && additions.size() > 0) {
+//                    for (ApexResultAddition addition : additions) {
+//                        cell.addAddition(addition.name, addition.value);
+//                    }
+//                }
+//
+//                return cell;
+//
+//            }
+//            else if (model.type == ResultBaseModel.ResultType.APEX_RESULT_TYPE_AIRAWBINFO.ordinal()) {
+//
+//                ApexResultAirAwbInfoModel shipModel = (ApexResultAirAwbInfoModel)model;
+//                ApexResultAirAwbInfoCell cell = dequeueAirAwbInfoCell(context, convertView);
+//                cell.prepareReuse();
+//                cell.setTitle(shipModel.title).setDetail(shipModel.detail).setIcon(shipModel.getIcon()).setPort(shipModel.port).setTime(shipModel.date).setDescription(shipModel.desc).setConsignee(shipModel.consignee);
+//                cell.setTransportStage(shipModel.transport_stage);
+//
+//                ArrayList<ApexResultAddition> additions = shipModel.getAddition();
+//                if (additions != null && additions.size() > 0) {
+//                    for (ApexResultAddition addition : additions) {
+//                        cell.addAddition(addition.name, addition.value);
+//                    }
+//                }
+//
+//                return cell;
+//
+//            }
+//            else if (model.type == ResultBaseModel.ResultType.APEX_RESULT_TYPE_BLINFO.ordinal()) {
+//
+//                ApexResultBLInfoModel shipModel = (ApexResultBLInfoModel)model;
+//                ApexResultBLInfoCell cell = dequeueBLInfoCell(context, convertView);
+//                cell.prepareReuse();
+//                cell.setTitle(shipModel.title).setDetail(shipModel.detail).setIcon(shipModel.icon).setPort(shipModel.port).setTime(shipModel.date).setDescription(shipModel.desc).setConsignee(shipModel.consignee);
+//                cell.setTransportStage(shipModel.transport_stage);
+//
+//                ArrayList<ApexResultAddition> additions = shipModel.getAddition();
+//                if (additions != null && additions.size() > 0) {
+//                    for (ApexResultAddition addition : additions) {
+//                        cell.addAddition(addition.name, addition.value);
+//                    }
+//                }
+//
+//                return cell;
+//
+//            } else if (model.type == ResultBaseModel.ResultType.APEX_RESULT_TYPE_CONTAINER.ordinal()) {
+//
+//                ApexResultContainerModel shipModel = (ApexResultContainerModel)model;
+//                ApexResultContainerCell cell = dequeueContainerCell(context, convertView);
+//                cell.prepareReuse();
+//                cell.setTitle(shipModel.title).setDetail(shipModel.detail).setIcon(shipModel.icon).setPort(shipModel.port).setTime(shipModel.date).setDescription(shipModel.desc).setConsignee(shipModel.consignee);
+//                cell.setTransportStage(shipModel.transport_stage);
+//
+//                ArrayList<ApexResultAddition> additions = shipModel.getAddition();
+//                if (additions != null && additions.size() > 0) {
+//                    for (ApexResultAddition addition : additions) {
+//                        cell.addAddition(addition.name, addition.value);
+//                    }
+//                }
+//
+//                return cell;
+//
+//            } else if (model.type == ResultBaseModel.ResultType.APEX_RESULT_TYPE_DOCUMENT.ordinal()) {
+//
+//                ApexResultDocumentModel documentModel = (ApexResultDocumentModel)model;
+//                ApexResultDocumentCell cell = dequeueDocumentCell(context, convertView);
+//                cell.prepareReuse();
+//                cell.setFileName(documentModel.fileName).setFileType(documentModel.fileType).setPo(documentModel.po).setBOL(documentModel.bol);
+//
+//                return cell;
+//            }
+
+            return new View(context);
+        }
+        return null;
+    }
+
+    // endregion
+
+    // region Configure Cell
+    private ResultACEM1Cell dequeueACEM1Cell(Context context, View convertView) {
+
+        ResultACEM1Cell cell = null;
+
+        if (convertView == null) {
+            cell = ResultACEM1Cell.makeCell(context);
+        } else {
+            cell = (ResultACEM1Cell)convertView;
+        }
+
+        return cell;
+    }
+    private ResultISFCell dequeueISFCell(Context context, View convertView) {
+
+        ResultISFCell cell = null;
+
+        if (convertView == null) {
+            cell = ResultISFCell.makeCell(context);
+        } else {
+            cell = (ResultISFCell)convertView;
+        }
+
+        return cell;
+    }
+    private ResultACICell dequeueACICell(Context context, View convertView) {
+
+        ResultACICell cell = null;
+
+        if (convertView == null) {
+            cell = ResultACICell.makeCell(context);
+        } else {
+            cell = (ResultACICell)convertView;
+        }
+
+        return cell;
+    }
+    private ResulteManifestCell dequeueeManifestCell(Context context, View convertView) {
+
+        ResulteManifestCell cell = null;
+
+        if (convertView == null) {
+            cell = ResulteManifestCell.makeCell(context);
+        } else {
+            cell = (ResulteManifestCell)convertView;
+        }
+
+        return cell;
+    }
+//    private ApexResultAirAwbInfoCell dequeueAirAwbInfoCell(Context context, View convertView) {
+//
+//        ApexResultAirAwbInfoCell cell = null;
+//
+//        if (convertView == null) {
+//            cell = ApexResultAirAwbInfoCell.makeBLInfoCell(context);
+//        } else {
+//            cell = (ApexResultAirAwbInfoCell)convertView;
+//        }
+//
+//        return cell;
+//    }
+//    private ApexResultBookingCell dequeueBookingCell(Context context, View convertView) {
+//
+//        ApexResultBookingCell cell = null;
+//
+//        if (convertView == null) {
+//            cell = ApexResultBookingCell.makeBookingCell(context);
+//        } else {
+//            cell = (ApexResultBookingCell)convertView;
+//        }
+//
+//        return cell;
+//    }
+//
+//    private ApexResultBLInfoCell dequeueBLInfoCell(Context context, View convertView) {
+//
+//        ApexResultBLInfoCell cell = null;
+//
+//        if (convertView == null) {
+//            cell = ApexResultBLInfoCell.makeBLInfoCell(context);
+//        } else {
+//            cell = (ApexResultBLInfoCell)convertView;
+//        }
+//
+//        return cell;
+//    }
+//
+//    private ApexResultContainerCell dequeueContainerCell(Context context, View convertView) {
+//
+//        ApexResultContainerCell cell = null;
+//
+//        if (convertView == null) {
+//            cell = ApexResultContainerCell.makeContainerCell(context);
+//        } else {
+//            cell = (ApexResultContainerCell)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
+
+}

+ 16 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultAddition.java

@@ -0,0 +1,16 @@
+package com.usai.ratradefiling.result;
+
+//import com.usai.apex.base.BaseObject;
+
+import com.usai.redant.rautils.base.BaseObject;
+
+public class ResultAddition extends BaseObject
+{
+
+    public String name;
+    public String value;
+
+    public void setName(String name) {
+        this.name = String.format("%s: ",name);
+    }
+}

+ 13 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultMenuItem.java

@@ -0,0 +1,13 @@
+package com.usai.ratradefiling.result;
+
+//import com.usai.apex.base.BaseObject;
+
+import com.usai.redant.rautils.base.BaseObject;
+
+public class ResultMenuItem extends BaseObject
+{
+
+    public String title;
+    public String action;
+
+}

+ 572 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/ResultPresenter.java

@@ -0,0 +1,572 @@
+package com.usai.ratradefiling.result;
+
+import android.os.Bundle;
+import android.text.TextUtils;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.apexresult.model.ApexResultAirAwbInfoModel;
+//import com.usai.apex.apexresult.model.ApexResultAirBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultBLInfoModel;
+//import com.usai.apex.apexresult.model.ResultBaseModel;
+//import com.usai.apex.apexresult.model.ApexResultBookingModel;
+//import com.usai.apex.apexresult.model.ApexResultContainerModel;
+//import com.usai.apex.apexresult.model.ApexResultDocumentModel;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.base.ResultBaseModel;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+import com.usai.ratradefiling.result.model.ResultACEM1Model;
+import com.usai.ratradefiling.result.model.ResultACIModel;
+import com.usai.ratradefiling.result.model.ResultISFModel;
+import com.usai.ratradefiling.result.model.ResulteManifestModel;
+import com.usai.redant.rautils.operationqueue.OperationQueue;
+import com.usai.redant.rautils.utils.RAUtil;
+//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 ResultPresenter implements ResultAdapter.ApexResultAdapterDataSource {
+
+    // region Protocol
+    public static interface ResultProtocol {
+
+        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 ResultFetchDataType {
+        RESULT_FETCH_DATA_TYPE_INITIAL,
+        RESULT_FETCH_DATA_TYPE_REFRESH,
+        RESULT_FETCH_DATA_TYPE_LOAD_MORE
+    }
+
+    // endregion
+
+    // region Initial
+
+    private WeakReference<ResultProtocol> mWeakDelegate;
+    private Bundle mParams;
+    private String mFields;
+    private int offset = 0;
+    private static final int detal = 20;
+    private ArrayList<ResultBaseModel> mDataArray;
+    private JSONArray rowActions;
+    private JSONArray actions;
+    public boolean dirty = true;
+    private ArrayList<ResultMenuItem> mMenuItems;
+
+
+
+    public ResultPresenter(ResultProtocol 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 (ResultBaseModel 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<ResultBaseModel> models = new ArrayList<>();
+                for (int i = 0; i < jsonArray.length(); i++) {
+                    JSONObject item = jsonArray.optJSONObject(i);
+                    if (item != null) {
+                        ResultBaseModel model = makeModel(item);
+                        if (model != null) {
+                            models.add(model);
+                        }
+                    }
+                }
+                mDataArray = models;
+
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    // endregion
+
+    // region Getter
+
+    private ResultProtocol getDelegate() {
+        if (mWeakDelegate == null) {
+            return null;
+        }
+        return mWeakDelegate.get();
+    }
+
+    public int dataCount() {
+        if (mDataArray == null) {
+            return 0;
+        }
+        return mDataArray.size();
+    }
+
+    public ResultBaseModel modelAtIndex(int index) {
+        if (index >= dataCount()) {
+            return null;
+        }
+        return mDataArray.get(index);
+    }
+
+    public JSONArray rowActionParametersForIndex(int position) {
+        ResultBaseModel 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;
+    }
+
+    public ArrayList<ResultMenuItem> getMenuItems() {
+        return mMenuItems;
+    }
+
+    // endregion
+
+    // region DataSource
+
+    @Override
+    public int numberOfResultItem() {
+        return dataCount();
+    }
+
+    @Override
+    public ResultBaseModel resultModelForIndex(int index) {
+        return modelAtIndex(index);
+    }
+
+    // endregion
+
+    // region Private
+
+    private ResultBaseModel makeModel(JSONObject item) {
+        if (item != null) {
+            int type = item.optInt("type", -1);
+
+            if (type < ResultBaseModel.ResultType.values().length) {
+                ResultBaseModel.ResultType resultType = ResultBaseModel.ResultType.values()[type];
+                switch (resultType) {
+                    case ResultTypeACEM1: {
+                        ResultACEM1Model model = new ResultACEM1Model();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case ResultTypeISF: {
+                        ResultISFModel model = new ResultISFModel();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case ResultTypeACI: {
+                        ResultACIModel model = new ResultACIModel();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+                    case ResultTypeeManifest: {
+                        ResulteManifestModel model = new ResulteManifestModel();
+                        model.setValuesForKeysWithJSON(item);
+                        return model;
+                    }
+//                    case APEX_RESULT_TYPE_BOOKING: {
+//                        ApexResultBookingModel model = new ApexResultBookingModel();
+//                        model.setValuesForKeysWithJSON(item);
+//                        return model;
+//                    }
+//                    case APEX_RESULT_TYPE_BLINFO: {
+//                        ApexResultBLInfoModel model = new ApexResultBLInfoModel();
+//                        model.setValuesForKeysWithJSON(item);
+//                        return model;
+//                    }
+//                    case APEX_RESULT_TYPE_CONTAINER: {
+//                        ApexResultContainerModel model = new ApexResultContainerModel();
+//                        model.setValuesForKeysWithJSON(item);
+//                        return model;
+//                    }
+//                    case APEX_RESULT_TYPE_DOCUMENT: {
+//                        ApexResultDocumentModel model = new ApexResultDocumentModel();
+//                        model.setValuesForKeysWithJSON(item);
+//                        return model;
+//                    }
+                    default:
+                        return null;
+                }
+            }
+
+        }
+        return null;
+    }
+
+    // endregion
+
+    // region Data
+
+    private void loadData(final ResultFetchDataType 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 = RADataProvider.Search(params);
+
+                return json;
+            }
+        }, new OperationQueue.OperationCompletionCallBack() {
+            @Override
+            public void operationCompletion(Object object) {
+
+                JSONObject json = (JSONObject)object;
+                int result = OnlineDataProvider.RESULT_FALSE;
+                if (json != null) {
+                    result = json.optInt("result", OnlineDataProvider.RESULT_FALSE);
+                }
+
+                if (getDelegate() != null) {
+                    getDelegate().onStopLoading();
+                }
+
+                if (result == OnlineDataProvider.RESULT_TRUE) {
+
+                    ArrayList<ResultBaseModel> models = new ArrayList<>();
+                    if (option == ResultFetchDataType.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) {
+
+                                ResultBaseModel 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");
+
+                    JSONArray menu = json.optJSONArray("menu");
+                    if (menu != null) {
+
+                        ArrayList<ResultMenuItem> menuItems = new ArrayList<>();
+                        int len = menu.length();
+                        for (int i = 0; i < len; i++) {
+
+                            JSONObject item = menu.optJSONObject(i);
+                            if (item != null) {
+
+                                ResultMenuItem menuItem = new ResultMenuItem();
+                                menuItem.setValuesForKeysWithJSON(item);
+                                menuItems.add(menuItem);
+                            }
+                        }
+                        mMenuItems = menuItems;
+                    }
+
+                    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 = RADataProvider.getDisplayFieldsForFunction(module_name);
+            mFields = fields;
+        }
+
+        offset = 0;
+        loadData(ResultFetchDataType.RESULT_FETCH_DATA_TYPE_INITIAL);
+    }
+
+    public void refreshData() {
+
+        offset = 0;
+        loadData(ResultFetchDataType.RESULT_FETCH_DATA_TYPE_REFRESH);
+    }
+
+    public void loadMoreData() {
+        loadData(ResultFetchDataType.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 RADataProvider.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 = OnlineDataProvider.RESULT_FALSE;
+                    String msg = "Sorry, something is wrong.";
+                    if (json != null) {
+
+                        result = json.optInt("result", OnlineDataProvider.RESULT_FALSE);
+                        if (result != OnlineDataProvider.RESULT_TRUE) {
+                            String err_msg = json.optString("err_msg");
+                            if (!TextUtils.isEmpty(err_msg)) {
+                                msg = err_msg;
+                            }
+                        }
+                    } // json
+
+                    if (result != OnlineDataProvider.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 = TradeFilingApplication.getInstance().getExternalCacheDir().getAbsolutePath();
+//
+//                final File downloadFile = RADataProvider.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
+}

+ 194 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultACEM1Cell.java

@@ -0,0 +1,194 @@
+package com.usai.ratradefiling.result.cell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+import com.usai.ratradefiling.R;
+
+import java.util.ArrayList;
+
+public class ResultACEM1Cell extends LinearLayout {
+
+    // region initial
+    public static ResultACEM1Cell makeCell(Context context) {
+        ResultACEM1Cell cell = (ResultACEM1Cell) LayoutInflater.from(context).inflate(R.layout.result_acem1_cell, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView hbolTV, dateTv, mbolTV, logTV, portTv, consigneeTv;
+    private ImageView statusIv;
+//    private View stageView;
+    private LinearLayout additionLayout;
+
+    private ArrayList<ResultAdditionView> additionArray = new ArrayList<>();
+    private int additionCount = 0;
+
+    public ResultACEM1Cell(Context context) {
+        super(context);
+    }
+
+    public ResultACEM1Cell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ResultACEM1Cell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        hbolTV = findViewById(R.id.tv_hbol);
+        dateTv = findViewById(R.id.tv_time);
+        mbolTV = findViewById(R.id.tv_mbol);
+        logTV = findViewById(R.id.tv_log);
+        portTv = findViewById(R.id.tv_port);
+        statusIv = findViewById(R.id.iv_status);
+//        stageView = findViewById(R.id.v_transport_stage);
+        additionLayout = findViewById(R.id.result_addition_view);
+        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        hbolTV.setText("");
+        dateTv.setText("");
+        mbolTV.setText("");
+        logTV.setText("");
+        portTv.setText("");
+        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+        consigneeTv.setText("");
+        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 String icon;
+//    public String hbol;
+//    public String mbol;
+//    public String log;
+//    public String date;
+//    public String port;
+//    public String consignee;
+
+
+
+    public ResultACEM1Cell setHBOL(String hbol) {
+        hbolTV.setText(hbol);
+        hbolTV.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setLog(String log) {
+        logTV.setText(log);
+        logTV.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setIcon(String icon) {
+        if (icon != null) {
+            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+            statusIv.setImageResource(resourceId);
+        } else {
+            statusIv.setImageDrawable(null);
+        }
+        statusIv.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setPort(String port) {
+        portTv.setText(port);
+        portTv.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setDate(String date) {
+        dateTv.setText(date);
+        dateTv.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setMBOL(String mbol) {
+        mbolTV.setText(mbol);
+        mbolTV.forceLayout();
+        return this;
+    }
+
+    public ResultACEM1Cell setConsignee(String consignee) {
+        consigneeTv.setText(consignee);
+        consigneeTv.forceLayout();
+        return this;
+    }
+
+    public void addAddition(String name, String value) {
+
+        ResultAdditionView additionView;
+        if (additionCount >= additionArray.size()) {
+
+            additionView = ResultAdditionView.makeAdditionView(getContext());
+            additionArray.add(additionView);
+
+        } else {
+            additionView = additionArray.get(additionCount);
+        }
+        additionCount++;
+
+        additionView.setTitle(name);
+        additionView.setValue(value);
+
+        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;
+        additionLayout.forceLayout();
+    }
+
+    // endregion
+}

+ 194 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultACICell.java

@@ -0,0 +1,194 @@
+package com.usai.ratradefiling.result.cell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+import java.util.ArrayList;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class ResultACICell extends LinearLayout {
+
+    // region initial
+    public static ResultACICell makeCell(Context context) {
+        ResultACICell cell = (ResultACICell) LayoutInflater.from(context).inflate(R.layout.result_aci_cell, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView hbccnTV, dateTv, primaryCCNTV, logTV, lastActionTv;
+    private ImageView statusIv;
+//    private View stageView;
+    private LinearLayout additionLayout;
+
+    private ArrayList<ResultAdditionView> additionArray = new ArrayList<>();
+    private int additionCount = 0;
+
+    public ResultACICell(Context context) {
+        super(context);
+    }
+
+    public ResultACICell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ResultACICell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        hbccnTV = findViewById(R.id.tv_hbccn);
+        dateTv = findViewById(R.id.tv_time);
+        primaryCCNTV = findViewById(R.id.tv_primaryccn);
+        logTV = findViewById(R.id.tv_log);
+        lastActionTv = findViewById(R.id.tv_lastaction);
+        statusIv = findViewById(R.id.iv_status);
+//        stageView = findViewById(R.id.v_transport_stage);
+        additionLayout = findViewById(R.id.result_addition_view);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        hbccnTV.setText("");
+        dateTv.setText("");
+        primaryCCNTV.setText("");
+        logTV.setText("");
+        lastActionTv.setText("");
+        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 String icon;
+//    public String hbol;
+//    public String mbol;
+//    public String log;
+//    public String date;
+//    public String port;
+//    public String consignee;
+
+
+
+    public ResultACICell setHBCCN(String hbccn) {
+        hbccnTV.setText(hbccn);
+        hbccnTV.forceLayout();
+        return this;
+    }
+
+    public ResultACICell setLog(String log) {
+        logTV.setText(log);
+        logTV.forceLayout();
+        return this;
+    }
+
+    public ResultACICell setIcon(String icon) {
+        if (icon != null) {
+            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+            statusIv.setImageResource(resourceId);
+        } else {
+            statusIv.setImageDrawable(null);
+        }
+        statusIv.forceLayout();
+        return this;
+    }
+
+    public ResultACICell setLastAction(String lastaction) {
+        lastActionTv.setText(lastaction);
+        lastActionTv.forceLayout();
+        return this;
+    }
+
+    public ResultACICell setDate(String date) {
+        dateTv.setText(date);
+        dateTv.forceLayout();
+        return this;
+    }
+
+    public ResultACICell setPrimaryCCN(String primary_ccn) {
+        primaryCCNTV.setText(primary_ccn);
+        primaryCCNTV.forceLayout();
+        return this;
+    }
+
+//    public ResultACICell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        return this;
+//    }
+
+    public void addAddition(String name, String value) {
+
+        ResultAdditionView additionView;
+        if (additionCount >= additionArray.size()) {
+
+            additionView = ResultAdditionView.makeAdditionView(getContext());
+            additionArray.add(additionView);
+
+        } else {
+            additionView = additionArray.get(additionCount);
+        }
+        additionCount++;
+
+        additionView.setTitle(name);
+        additionView.setValue(value);
+
+        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;
+        additionLayout.forceLayout();
+    }
+
+    // endregion
+}

+ 54 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultAdditionView.java

@@ -0,0 +1,54 @@
+package com.usai.ratradefiling.result.cell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.usai.ratradefiling.R;
+
+
+public class ResultAdditionView extends RelativeLayout {
+
+    public static ResultAdditionView makeAdditionView(Context context) {
+
+        ResultAdditionView additionView = (ResultAdditionView) LayoutInflater.from(context).inflate(R.layout.result_addition_view, null);
+        additionView.init();
+        return additionView;
+    }
+
+    private TextView titleTv, valueTv;
+
+    public ResultAdditionView(Context context) {
+        super(context);
+    }
+
+    public ResultAdditionView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ResultAdditionView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+        titleTv = findViewById(R.id.result_addition_title_tv);
+        valueTv = findViewById(R.id.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);
+    }
+
+}

+ 196 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResultISFCell.java

@@ -0,0 +1,196 @@
+package com.usai.ratradefiling.result.cell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+import java.util.ArrayList;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class ResultISFCell extends LinearLayout {
+
+    // region initial
+    public static ResultISFCell makeCell(Context context) {
+        ResultISFCell cell = (ResultISFCell) LayoutInflater.from(context).inflate(R.layout.result_isf_cell, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView bolTV,
+//            dateTv,
+            transactionnoTV, logTV, isftypeTv, consigneeTv;
+    private ImageView statusIv;
+//    private View stageView;
+    private LinearLayout additionLayout;
+
+    private ArrayList<ResultAdditionView> additionArray = new ArrayList<>();
+    private int additionCount = 0;
+
+    public ResultISFCell(Context context) {
+        super(context);
+    }
+
+    public ResultISFCell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ResultISFCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        bolTV = findViewById(R.id.tv_bol);
+//        dateTv = findViewById(R.id.tv_time);
+        transactionnoTV = findViewById(R.id.tv_transactionno);
+        logTV = findViewById(R.id.tv_log);
+        isftypeTv = findViewById(R.id.tv_isftype);
+        statusIv = findViewById(R.id.iv_status);
+//        stageView = findViewById(R.id.v_transport_stage);
+        additionLayout = findViewById(R.id.result_addition_view);
+        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        bolTV.setText("");
+//        dateTv.setText("");
+        transactionnoTV.setText("");
+        logTV.setText("");
+        isftypeTv.setText("");
+        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+        consigneeTv.setText("");
+        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 String icon;
+//    public String hbol;
+//    public String mbol;
+//    public String log;
+//    public String date;
+//    public String port;
+//    public String consignee;
+
+
+
+    public ResultISFCell setBOL(String bol) {
+        bolTV.setText(bol);
+        bolTV.forceLayout();
+        return this;
+    }
+
+    public ResultISFCell setLog(String log) {
+        logTV.setText(log);
+        logTV.forceLayout();
+        return this;
+    }
+
+    public ResultISFCell setIcon(String icon) {
+        if (icon != null) {
+            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+            statusIv.setImageResource(resourceId);
+        } else {
+            statusIv.setImageDrawable(null);
+        }
+        statusIv.forceLayout();
+        return this;
+    }
+
+    public ResultISFCell setISFType(String isfType) {
+        isftypeTv.setText(isfType);
+        isftypeTv.forceLayout();
+        return this;
+    }
+
+//    public ResultISFCell setDate(String date) {
+//        dateTv.setText(date);
+//        dateTv.forceLayout();
+//        return this;
+//    }
+
+    public ResultISFCell setTransactinNo(String transactinNo) {
+        transactionnoTV.setText(transactinNo);
+        transactionnoTV.forceLayout();
+        return this;
+    }
+
+    public ResultISFCell setConsignee(String consignee) {
+        consigneeTv.setText(consignee);
+        consigneeTv.forceLayout();
+        return this;
+    }
+
+    public void addAddition(String name, String value) {
+
+        ResultAdditionView additionView;
+        if (additionCount >= additionArray.size()) {
+
+            additionView = ResultAdditionView.makeAdditionView(getContext());
+            additionArray.add(additionView);
+
+        } else {
+            additionView = additionArray.get(additionCount);
+        }
+        additionCount++;
+
+        additionView.setTitle(name);
+        additionView.setValue(value);
+
+        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;
+        additionLayout.forceLayout();
+    }
+
+    // endregion
+}

+ 205 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/cell/ResulteManifestCell.java

@@ -0,0 +1,205 @@
+package com.usai.ratradefiling.result.cell;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.usai.ratradefiling.R;
+
+import java.util.ArrayList;
+
+//import com.usai.apex.ApexTrackingApplication;
+//import com.usai.apex.R;
+//import com.usai.apex.mainframe.TrackingImageView;
+
+public class ResulteManifestCell extends LinearLayout {
+
+    // region initial
+    public static ResulteManifestCell makeCell(Context context) {
+        ResulteManifestCell cell = (ResulteManifestCell) LayoutInflater.from(context).inflate(R.layout.result_emanifest_cell, null);
+        cell.init();
+
+        return cell;
+    }
+
+    private TextView hbccnTV, dateTv, primaryCCNTv, logTV, previousCCNTv;
+    private ImageView statusIv;
+//    private View stageView;
+    private LinearLayout additionLayout;
+
+    private ArrayList<ResultAdditionView> additionArray = new ArrayList<>();
+    private int additionCount = 0;
+
+    public ResulteManifestCell(Context context) {
+        super(context);
+    }
+
+    public ResulteManifestCell(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ResulteManifestCell(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    private void init() {
+
+        hbccnTV = findViewById(R.id.tv_hbccn);
+        dateTv = findViewById(R.id.tv_time);
+        primaryCCNTv = findViewById(R.id.tv_primaryccn);
+        logTV = findViewById(R.id.tv_log);
+        previousCCNTv = findViewById(R.id.tv_previousccn);
+        statusIv = findViewById(R.id.iv_status);
+//        stageView = findViewById(R.id.v_transport_stage);
+        additionLayout = findViewById(R.id.result_addition_view);
+//        consigneeTv = findViewById(R.id.tv_consignee);
+
+        prepareReuse();
+    }
+
+    public void prepareReuse() {
+
+        hbccnTV.setText("");
+        dateTv.setText("");
+        primaryCCNTv.setText("");
+        logTV.setText("");
+        previousCCNTv.setText("");
+        statusIv.setImageDrawable(null);
+//        setTransportStage(0);
+//        consigneeTv.setText("");
+        clearAdditionView();
+        forceLayout();
+    }
+
+//    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 String icon;
+//    public String hbol;
+//    public String mbol;
+//    public String log;
+//    public String date;
+//    public String port;
+//    public String consignee;
+
+
+
+    public ResulteManifestCell setHBCCN(String hbccn) {
+        hbccnTV.setText(hbccn);
+        hbccnTV.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setLog(String log) {
+        logTV.setText(log);
+        logTV.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setIcon(String icon) {
+        if (icon != null) {
+            int resourceId = getContext().getResources().getIdentifier(icon, "drawable", getContext().getPackageName());
+            statusIv.setImageResource(resourceId);
+        } else {
+            statusIv.setImageDrawable(null);
+        }
+        statusIv.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setPreviousCCN(String previousCCN) {
+        previousCCNTv.setText(previousCCN);
+        previousCCNTv.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setDate(String date) {
+        dateTv.setText(date);
+        dateTv.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setPrimaryCCN(String primary_ccn) {
+        primaryCCNTv.setText(primary_ccn);
+        primaryCCNTv.forceLayout();
+        return this;
+    }
+
+    public ResulteManifestCell setIsClose(boolean isClose) {
+
+
+        if(isClose)
+            statusIv.setBackgroundColor(getResources().getColor(R.color.white));
+        else
+            statusIv.setBackgroundColor(getResources().getColor(R.color.icon_red));
+//        primaryCCNTv.setText(primary_ccn);
+//        primaryCCNTv.forceLayout();
+        return this;
+    }
+//    public ResultACICell setConsignee(String consignee) {
+//        consigneeTv.setText(consignee);
+//        consigneeTv.forceLayout();
+//        return this;
+//    }
+
+    public void addAddition(String name, String value) {
+
+        ResultAdditionView additionView;
+        if (additionCount >= additionArray.size()) {
+
+            additionView = ResultAdditionView.makeAdditionView(getContext());
+            additionArray.add(additionView);
+
+        } else {
+            additionView = additionArray.get(additionCount);
+        }
+        additionCount++;
+
+        additionView.setTitle(name);
+        additionView.setValue(value);
+
+        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;
+        additionLayout.forceLayout();
+    }
+
+    // endregion
+}

+ 70 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultACEM1Model.java

@@ -0,0 +1,70 @@
+package com.usai.ratradefiling.result.model;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class ResultACEM1Model extends ResultBaseModel
+{
+
+
+    // region Model
+    public String icon;
+    public String hbol;
+    public String mbol;
+    public String log;
+    public String date;
+    public String port;
+    public String consignee;
+//    public String consignee;
+
+
+    public ResultACEM1Model() {
+
+    }
+    public String getIcon() {
+        return icon;
+    }
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (hbol != null) {
+                json.put("hbol", hbol);
+            }
+            if ( icon!= null) {
+                json.put("icon", icon);
+            }
+            if (mbol != null) {
+                json.put("mbol", mbol);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+            if (date != null) {
+                json.put("date", date);
+            }
+            if (port != null) {
+                json.put("port", port);
+            }
+            if (consignee != null) {
+                json.put("consignee", consignee);
+            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 74 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultACIModel.java

@@ -0,0 +1,74 @@
+package com.usai.ratradefiling.result.model;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class ResultACIModel extends ResultBaseModel
+{
+
+
+    // region Model
+    public String icon;
+    public String hbccn;
+    public String primary_ccn;
+    public String log;
+    public String date;
+    public String lastaction;
+
+//    public String detail;
+//    public String date;
+//    public String port;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public ResultACIModel() {
+
+    }
+    public String getIcon() {
+        return icon;
+    }
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (hbccn != null) {
+                json.put("hbccn", hbccn);
+            }
+            if ( primary_ccn!= null) {
+                json.put("primary_ccn", primary_ccn);
+            }
+            if (icon != null) {
+                json.put("icon", icon);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+            if (date != null) {
+                json.put("date", date);
+            }
+            if (lastaction != null) {
+                json.put("port", lastaction);
+            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 70 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResultISFModel.java

@@ -0,0 +1,70 @@
+package com.usai.ratradefiling.result.model;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class ResultISFModel extends ResultBaseModel
+{
+
+
+    // region Model
+    public String icon;
+    public String bol;
+    public String transactionno;
+    public String log;
+    public String isftype;
+    public String consignee;
+//    public int transport_stage;
+//    public String consignee;
+
+
+    public ResultISFModel() {
+
+    }
+    public String getIcon() {
+        return icon;
+    }
+
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (bol != null) {
+                json.put("bol", bol);
+            }
+            if ( icon!= null) {
+                json.put("icon", icon);
+            }
+            if (transactionno != null) {
+                json.put("transactionno", transactionno);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+            if (isftype != null) {
+                json.put("isftype", isftype);
+            }
+            if (consignee != null) {
+                json.put("consignee", consignee);
+            }
+//            if (consignee != null) {
+//                json.put("consignee", consignee);
+//            }
+//
+//            json.put("transport_stage", transport_stage);
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 71 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/result/model/ResulteManifestModel.java

@@ -0,0 +1,71 @@
+package com.usai.ratradefiling.result.model;
+
+import com.usai.ratradefiling.base.ResultBaseModel;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+public class ResulteManifestModel extends ResultBaseModel
+{
+
+
+    // region Model
+    public String hbccn;
+    public String icon;
+    public String primary_ccn;
+    public String previous_ccn;
+    public String log;
+    public String date;
+    public String lastaction;
+    public boolean inclose;
+
+
+
+    public ResulteManifestModel() {
+
+    }
+    public String getIcon() {
+        return icon;
+    }
+    // endregion
+
+
+    @Override
+    public JSONObject toJson() {
+        JSONObject json = super.toJson();
+
+        try {
+
+            if (hbccn != null) {
+                json.put("hbccn", hbccn);
+            }
+            if ( icon!= null) {
+                json.put("icon", icon);
+            }
+            if (primary_ccn != null) {
+                json.put("primary_ccn", primary_ccn);
+            }
+            if (log != null) {
+                json.put("log", log);
+            }
+            if (date != null) {
+                json.put("date", date);
+            }
+            if (previous_ccn != null) {
+                json.put("previous_ccn", previous_ccn);
+            }
+            if (lastaction != null) {
+                json.put("lastaction", lastaction);
+            }
+
+            json.put("inclose", inclose);
+
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        return json;
+    }
+}

+ 987 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/search/SearchListActivity.java

@@ -0,0 +1,987 @@
+package com.usai.ratradefiling.search;
+
+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.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 androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+//import com.usai.apex.apexresult.ApexResultActivity;
+//import com.usai.util.Network;
+//import com.usai.util.dbUtil;
+
+import com.usai.ratradefiling.R;
+import com.usai.ratradefiling.TradeFilingApplication;
+import com.usai.ratradefiling.dataprovider.OnlineDataProvider;
+import com.usai.ratradefiling.dataprovider.RADataProvider;
+import com.usai.ratradefiling.fields.CustomizeFieldsActivity;
+import com.usai.ratradefiling.result.ResultActivity;
+import com.usai.redant.rautils.utils.RAConverter;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+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>();
+
+	String type="search";
+	String subtype;
+	// 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 = TradeFilingApplication.get_user();
+
+		// password = ApexTrackingApplication.get_pass();
+//		function_name = getIntent().getStringExtra("function_name");
+		subtype = getIntent().getStringExtra("sub_type");
+
+		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");
+			if (hashMap == null) {
+				hashMap = new 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;
+		}
+
+		try
+		{
+			JSONObject json=RADataProvider.updateFieldsjson(type,subtype);
+			JSONArray arr = json.getJSONArray("show");
+			for(int i=0;i<arr.length();i++)
+			{
+				JSONObject item = arr.getJSONObject(i);
+				final String aname = item.optString("aname");
+				String field_type = item.optString("string");
+				final String name = item.optString("name");
+
+
+				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);
+				}
+			}
+
+		} catch (JSONException e)
+		{
+			e.printStackTrace();
+		}
+
+//		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="
+//				+ OnlineDataProvider.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("sub_type", subtype);
+//				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
+				parms.putBoolean("from_search",true);
+				ResultActivity.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:
+			{
+				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("type", type);
+				intent.putExtra("sub_type", subtype);
+				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);
+	}
+}

+ 32 - 0
ApexDrivers/ratradefiling/src/main/java/com/usai/ratradefiling/utils/AES.java

@@ -0,0 +1,32 @@
+package com.usai.ratradefiling.utils;
+
+
+import com.usai.redant.rautils.utils.AESUtil;
+
+/**
+ * Created by ray on 07/06/2017.
+ * AES128 算法
+ *
+ * CBC 模式
+ *
+ * PKCS7Padding 填充模式
+ *
+ * CBC模式需要添加一个参数iv
+ *
+ * 介于java 不支持PKCS7Padding,只支持PKCS5Padding 但是PKCS7Padding 和 PKCS5Padding 没有什么区别
+ * 要实现在java端用PKCS7Padding填充,需要用到bouncycastle组件来实现
+ */
+
+public class AES {
+
+
+    public static String encrypt(String key, String content)
+    {
+        return AESUtil.encrypt128(key, content);
+    }
+
+    public static String decrypt(String key, String content)
+    {
+        return AESUtil.decrypt128(key, content);
+    }
+}

二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/flag_ca.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/flag_us.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_customer.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_drag_new.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/ic_more_dot.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/login_img.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-hdpi/navigate_logo.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/flag_ca.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/flag_us.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_customer.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_drag_new.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/ic_more_dot.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/login_img.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-ldpi/navigate_logo.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/flag_ca.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/flag_us.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/ic_customer.png


二進制
ApexDrivers/ratradefiling/src/main/res/drawable-mdpi/ic_drag_new.png


Some files were not shown because too many files changed in this diff