소스 검색

feat 完善界面真实操作入口

lihao1 3 년 전
부모
커밋
4c72028065

+ 4 - 4
demo/src/main/AndroidManifest.xml

@@ -44,16 +44,16 @@
             android:name=".activities.poc.SpaceActivity"
             android:exported="true" />
         <activity android:name=".activities.MainActivity">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
 
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
         </activity>
         <activity android:name=".activities.GraphyActivity" />
         <activity android:name=".activities.WebViewActivity" />
         <activity android:name=".activities.PocActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
 
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
         </activity>
         <activity android:name="com.zbar.lib.CaptureActivity" />
     </application>

+ 36 - 6
demo/src/main/java/com/sybotan/android/demo/activities/GraphyActivity.kt

@@ -62,20 +62,35 @@ class GraphyActivity : BaseActivity() {
 
     lateinit var graphyVM: GraphyVM
 
-    //实际距离
+    /** 建筑Id */
+    lateinit var buildingId: String
+
+    /** 楼层Id */
+    lateinit var floorId: String
+
+    /** 楼层地图 */
+    lateinit var floorMap: String
+
+    /**
+     * space 结构核查
+     * survey 空间勘测
+     */
+    lateinit var from: String
+
+    /** 实际距离 */
     val distance = 1800f
 
-    //缩放后的同比例距离
+    /** 缩放后的同比例距离 */
     var realDistance = 0f
 
     val scene = FloorScene()
     val gson = Gson()
 
-    //    val path = "base/cbde057b91e711eb9901557a780001bf.jsonz"
+//    val path = "base/cbde057b91e711eb9901557a780001bf.jsonz"
 //    val path = "base/ebd53bb00d3511eb9a1db95f725712e8.jsonz"
 //    val path = "base/a4e671ec8b8111eb9a520dc30d098a92.jsonz"
 //    val path = "base/0764ad79555d11ebab557bd2e22cfb56.jsonz"
-    val path = "base/05d5b9e6c8c411eb8437353008b31107.jsonz"
+//    val path = "base/05d5b9e6c8c411eb8437353008b31107.jsonz"
 
     @Subscribe
     fun test(msg: SGraphyViewMoveEvent) {
@@ -93,12 +108,14 @@ class GraphyActivity : BaseActivity() {
         setContentView(R.layout.activity_graphy)
         // 注册eventbus
         EventBus.getDefault().register(this)
+        /** 初始化数据 */
+        initData()
 
         graphyView.scene = scene
 
         /** 开启异步 */
         doAsync {
-            val downloadGZIPMap = HttpDownloadMap.downloadGZIPMap(path)
+            val downloadGZIPMap = HttpDownloadMap.downloadGZIPMap(floorMap)
             if (downloadGZIPMap != null) {
                 scene.loadData(downloadGZIPMap!!)
             }
@@ -128,6 +145,17 @@ class GraphyActivity : BaseActivity() {
     } // Function onCreate()
 
     /**
+     * 初始化数据
+     */
+    private fun initData() {
+        var floor = intent.getBundleExtra("floor")
+        buildingId = floor.getString("buildingId")
+        floorId = floor.getString("floorId")
+        floorMap = floor.getString("floorMap")
+        from = floor.getString("from")
+    }
+
+    /**
      * 图形点击事件
      * */
     private fun initSingleTopUp() {
@@ -143,6 +171,7 @@ class GraphyActivity : BaseActivity() {
                 } else if (scene.mapType.equals("nothing")) {
                     spaceStructure.visibility = View.GONE
                     qrcodeLl.visibility = View.GONE
+                    quesDetail.visibility = View.GONE
                     for (item in scene.pointItemList) {
                         scene.removeItem(item)
                     }
@@ -354,7 +383,7 @@ class GraphyActivity : BaseActivity() {
                     graphyVM.getSpaceJob()
                 }
             }
-        }, this)
+        }, this, buildingId, floorId)
         graphyVM.getSpaceJob()
     }
 
@@ -391,6 +420,7 @@ class GraphyActivity : BaseActivity() {
         quesDetail.visibility = View.VISIBLE
         quesTv.setText(
             "这是描述问题的文本,左侧是拍照图片。" +
+                    "\n问题编码:${point.data.id}" +
                     "\nx轴:${point.data.mX}" +
                     "\ny轴:${point.data.mY}" +
                     "\n点击下方“问题已解决”按钮后可关闭该问题点。"

+ 13 - 8
demo/src/main/java/com/sybotan/android/demo/viewmodel/GraphyVM.java

@@ -56,9 +56,13 @@ public class GraphyVM extends BaseViewModel {
     public static final String GET_QECODE = "GET_QECODE";
     //设置空间的任务状态(新建和修改)
     public static final String SET_JOB = "SET_JOB";
+    private String buildingId;
+    private String floorId;
 
-    public GraphyVM(BaseViewModelInterface object, BaseActivity activity) {
+    public GraphyVM(BaseViewModelInterface object, BaseActivity activity, String buildingId, String floorId) {
         super(object, activity);
+        this.buildingId = buildingId;
+        this.floorId = floorId;
     }
 
     /**
@@ -66,8 +70,8 @@ public class GraphyVM extends BaseViewModel {
      */
     public void getSpaceJob() {
         ReqSpaceJob bean = new ReqSpaceJob();
-        bean.buildingId = "Bd00022200113a69205aebc34aba87b31a2a03a572ab";
-        bean.floorId = "Fl00022200115d43d88abaab46cda43f1596b5e3930b";
+        bean.buildingId = buildingId;
+        bean.floorId = floorId;
         bean.jobStatus.add("01");
         bean.jobStatus.add("02");
         Observable<BaseModel<List<SpaceJobModel>>> observable = RetrofitFactory.getInstance().getSpaceJob(getRequestBody(bean));
@@ -89,7 +93,7 @@ public class GraphyVM extends BaseViewModel {
     public void addProblem(TunableSpaceItem choseSpace, float x, float y) {
         ReqAddProblem bean = new ReqAddProblem();
         bean.spaceId = choseSpace.getData().getId();
-        bean.floorId = "Fl00022200115d43d88abaab46cda43f1596b5e3930b";
+        bean.floorId = floorId;
         Position position = new Position();
         position.x = x + "";
         position.y = y + "";
@@ -110,7 +114,7 @@ public class GraphyVM extends BaseViewModel {
      */
     public void getProblem(@Nullable TunableSpaceItem choseSpace) {
         ReqProblems bean = new ReqProblems();
-        bean.floorId = "Fl00022200115d43d88abaab46cda43f1596b5e3930b";
+        bean.floorId = floorId;
         bean.spaceId = choseSpace.getData().getId();
         Observable<BaseModel<List<ProblemsModel>>> observable = RetrofitFactory.getInstance().problems(getRequestBody(bean));
         sendRequest(observable, new BaseObserver<List<ProblemsModel>>(mActivity, this) {
@@ -189,13 +193,14 @@ public class GraphyVM extends BaseViewModel {
 
     /**
      * 设置空间的任务状态(新建和修改)
+     *
      * @param choseSpace 选中的空间
-     * @param toString 数字化交付编码
+     * @param toString   数字化交付编码
      */
     public void setJob(@Nullable TunableSpaceItem choseSpace, @NotNull String toString) {
         ReqSetJob bean = new ReqSetJob();
-        bean.buildingId = "Bd00022200113a69205aebc34aba87b31a2a03a572ab";
-        bean.floorId = "Fl00022200115d43d88abaab46cda43f1596b5e3930b";
+        bean.buildingId = buildingId;
+        bean.floorId = floorId;
         bean.spaceId.add(choseSpace.getData().getId());
         bean.jobStatus = "03";
         bean.spaceCode = toString;

+ 1 - 0
demo/src/main/res/layout/activity_graphy.xml

@@ -26,6 +26,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
+    android:background="@color/white"
     tools:context="com.sybotan.android.demo.activities.GraphyActivity">
 
     <com.sybotan.android.graphy.SGraphyView