Ver Fonte

1、涂鸦界面开发完成,包括绘制涂鸦、清除涂鸦、保存涂鸦、删除全部、选择涂鸦、删除选择
2、地图增加Touch通用操作及回调监听
3、地图增加注册事件及事件解析操作

不会爬树的猴 há 2 anos atrás
pai
commit
a5a9a03c43

BIN
app/src/main/assets/fonts/iconfont.ttf


+ 67 - 9
app/src/main/java/com/cr/cruav/AvMain.kt

@@ -3,19 +3,14 @@ package com.cr.cruav
 import android.annotation.SuppressLint
 import android.os.Bundle
 import android.view.View
-import android.widget.FrameLayout
-import android.widget.TextView
 import androidx.activity.viewModels
 
-import androidx.appcompat.app.AppCompatActivity
-import androidx.constraintlayout.widget.ConstraintLayout
-import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams
-import androidx.fragment.app.FragmentTransaction
 import androidx.fragment.app.commit
-import androidx.fragment.app.commitNow
 import com.cr.data.CrConfig
 import com.cr.data.CrUtil
 import com.cr.event.EventFragmentBarAction
+import com.cr.map.EventMap
+import com.cr.map.MapAction
 import com.cr.pages.*
 import com.cr.viewmodel.*
 import com.squareup.otto.Subscribe
@@ -60,6 +55,9 @@ class AvMain : CrActivity(), View.OnClickListener {
     // define: 2023/4/14 图层控制页面
     private var fragmentLayerControl: FragmentLayerControl? = null
 
+    // define: 2023/4/17 涂鸦页面
+    private var fragmentDoodle: FragmentDoodle? = null
+
 
     /**
      * 入口函数
@@ -82,6 +80,10 @@ class AvMain : CrActivity(), View.OnClickListener {
         // todo: 2023/4/11 设置点击事件
         tools_set.setOnClickListener(this)
         tools_layer.setOnClickListener(this)
+        tools_doodle.setOnClickListener(this)
+        tools_ico.setOnClickListener(this)
+        tools_wx.setOnClickListener(this)
+        tools_tools.setOnClickListener(this)
     }
 
     /**
@@ -111,7 +113,14 @@ class AvMain : CrActivity(), View.OnClickListener {
         // todo: 2023/4/14 初始化图层控制页面
         fragmentLayerControl = FragmentLayerControl()
         fragmentLayerControl?.let {
-            addFragment(it,R.id.av_frm_right_panel)
+            addFragment(it, R.id.av_frm_right_panel)
+            hideFragment(it)
+        }
+        // todo: 2023/4/17 初始化涂鸦操作页面
+        fragmentDoodle = FragmentDoodle()
+        fragmentDoodle?.setListener(doodleListener)
+        fragmentDoodle?.let {
+            addFragment(it,R.id.av_frm_left_panel)
             hideFragment(it)
         }
     }
@@ -211,14 +220,63 @@ class AvMain : CrActivity(), View.OnClickListener {
             R.id.tools_set -> {
                 showFragment(fragmentSet!!)
             }
-            R.id.tools_layer->{
+            R.id.tools_layer -> {
                 showFragment(fragmentLayerControl!!)
                 fragmentLayerControl?.initPage()
             }
+            R.id.tools_doodle->{
+                showFragment(fragmentDoodle!!)
+            }
         }
     }
 
     /**
+     * 涂鸦页面操作监听
+     */
+    private val doodleListener = object:FragmentDoodle.OnOperationListener{
+        // todo: 2023/4/17 开启绘制
+        override fun onStartDraw() {
+            CrApplication.getEventBus().post(EventMap(MapAction.MapTapDrawDoodle))
+        }
+
+        // todo: 2023/4/17 停止绘制
+        override fun onStopDraw() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventStopSketch))
+        }
+
+        // todo: 2023/4/17 开启选择
+        override fun onSelect() {
+            CrApplication.getEventBus().post(EventMap(MapAction.MapTapSelectDoodle))
+        }
+
+        // todo: 2023/4/17 关闭选择
+        override fun onStopSelect() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventStopTouch))
+        }
+
+        // todo: 2023/4/17 清除
+        override fun onClear() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventDoodleClear))
+        }
+
+        // todo: 2023/4/17 保存
+        override fun onSave() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventDoodleSave))
+        }
+
+        // todo: 2023/4/17 删除全部
+        override fun onRemove() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventDoodleRemove))
+        }
+
+        // todo: 2023/4/17 移除选择
+        override fun onDelete() {
+            CrApplication.getEventBus().post(EventMap(MapAction.EventDoodleDelete))
+        }
+
+    }
+
+    /**
      * 销毁
      */
     override fun onDestroy() {

+ 20 - 3
app/src/main/java/com/cr/dialog/DialogNormal.kt

@@ -32,7 +32,7 @@ class DialogNormal : Dialog, View.OnClickListener {
     }
 
     // define: 2023/3/31 监听接口
-    var listener: DialogNormalListener? = null
+    private var listener: DialogNormalListener? = null
 
     // define: 2023/3/31 定义控件
     var btnCompletion: Button? = null
@@ -126,8 +126,18 @@ class DialogNormal : Dialog, View.OnClickListener {
      * @param closeText String 关闭按钮文字
      */
     fun setButtonsText(okText:String,closeText:String){
-        btnClose?.text = closeText
-        btnCompletion?.text = okText
+        if (okText != null){
+            btnCompletion?.text = okText
+            btnCompletion?.visibility = View.VISIBLE
+        }else{
+            btnCompletion?.visibility = View.GONE
+        }
+        if (closeText != null){
+            btnClose?.text = closeText
+            btnClose?.visibility = View.VISIBLE
+        }else{
+            btnClose?.visibility = View.GONE
+        }
     }
 
     /**
@@ -141,6 +151,13 @@ class DialogNormal : Dialog, View.OnClickListener {
     }
 
     /**
+     * 设置监听
+     * @param listener DialogNormalListener
+     */
+    fun setListener(listener: DialogNormalListener){
+        this.listener = listener
+    }
+    /**
      * 覆写点击事件
      * @param p0 View
      */

+ 21 - 0
app/src/main/java/com/cr/map/EventMap.kt

@@ -0,0 +1,21 @@
+package com.cr.map
+
+/**
+ * 操作系统:MAC系统
+ * 创建者:王成
+ * 创建日期:2023/4/17 15:15
+ * 描述:地图事件
+ */
+class EventMap @JvmOverloads constructor(
+    action:MapAction
+){
+    // define: 2023/4/17 事件动作
+    var action:MapAction?= null
+
+    /**
+     * 初始化
+     */
+    init {
+        this.action = action
+    }
+}

+ 54 - 3
app/src/main/java/com/cr/map/EventMapAction.kt → app/src/main/java/com/cr/map/MapAction.kt

@@ -6,73 +6,124 @@ package com.cr.map
  * 创建日期:2023/4/13 15:31
  * 描述:地图动作
  */
-enum class EventMapAction {
+enum class MapAction {
     /**
      * 没有任何动作
      */
     MapTapNon,
+
     /**
-     * 涂鸦动作
+     * 绘制涂鸦
      */
-    MapTapSelectTy,
+    MapTapDrawDoodle,
+
+    /**
+     * 选择涂鸦
+     */
+    MapTapSelectDoodle,
+
     /**
      * 微信分享上传动作
      */
     MapTapCaseWxAndUpload,
+
     /**
      * 添加标志动作
      */
     MapTapAppendICO,
+
     /**
      * 选择标志动作
      */
     MapTapSelectICO,
+
     /**
      * 添加违建点动作
      */
     MapTapAddWaypoint,
+
     /**
      * 选择违建点动作
      */
     MapTapSelectWaypoint,
+
     /**
      * 长度测量动作
      */
     MapTapSurveyLength,
+
     /**
      * 面积测量动作
      */
     MapTapSurveyArea,
+
     /**
      * 删除违建点动作
      */
     MapTapDeleteWaypoing,
+
     /**
      * 移动违建点动作
      */
     MapTapMoveWaypoing,
+
     /**
      * 移动中动作
      */
     MapTapMovingWaypoint,
+
     /**
      * 创建违建面动作
      */
     MapTapCreateCasePolygon,
+
     /**
      * 查询网络案件动作
      */
     MapTapQueryNetCase,
+
     /**
      * 查询本地案件动作
      */
     MapTapQueryLocalCase,
+
     /**
      * 添加复飞点动作
      */
     MapTapAddRepeatFlight,
+
     /**
      * 查询位置动作
      */
     MapTapGetLocation,
+
+    /**
+     * 清除涂鸦
+     */
+    EventDoodleClear,
+
+    /**
+     * 保存涂鸦
+     */
+    EventDoodleSave,
+
+    /**
+     * 删除全部涂鸦
+     */
+    EventDoodleRemove,
+
+    /**
+     * 移除选择涂鸦
+     */
+    EventDoodleDelete,
+
+    /**
+     * 停止草图编辑
+     */
+    EventStopSketch,
+
+    /**
+     * 停止点击
+     */
+    EventStopTouch,
 }

+ 138 - 0
app/src/main/java/com/cr/map/MapTouch.kt

@@ -0,0 +1,138 @@
+package com.cr.map
+
+import android.content.Context
+import android.view.MotionEvent
+import com.cr.dialog.DialogNormal
+import com.esri.arcgisruntime.ArcGISRuntimeException
+import com.esri.arcgisruntime.data.Feature
+import com.esri.arcgisruntime.geometry.Point
+import com.esri.arcgisruntime.geometry.SpatialReference
+import com.esri.arcgisruntime.layers.FeatureLayer
+import com.esri.arcgisruntime.layers.Layer
+import com.esri.arcgisruntime.mapping.GeoElement
+import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener
+import com.esri.arcgisruntime.mapping.view.MapView
+
+/**
+ * 操作系统:MAC系统
+ * 创建者:王成
+ * 创建日期:2023/4/18 08:44
+ * 描述:地图Touch
+ */
+class MapTouch constructor(context: Context, mapView: MapView) :
+    DefaultMapViewOnTouchListener(context, mapView) {
+
+    /**
+     * Touch回调
+     */
+    interface TouchListener {
+        // todo: 2023/4/18 涂鸦选择
+        fun onDoodleSelect(feature: Feature?)
+    }
+
+
+    // define: 2023/4/18 定义变量
+    private var context: Context? = null
+    private var mapView: MapView? = null
+
+    private var queryLayer: Layer? = null  // define: 2023/4/18 查询的图层
+    private var action: MapAction? = null
+
+    // todo: 2023/4/18 监听
+    private var listener: TouchListener? = null
+
+    // todo: 2023/4/13 静态
+    companion object {
+        // define: 2023/4/13 WGS84坐标系框架
+        val wgs84SpatialReference: SpatialReference = SpatialReference.create(4326)
+    }
+
+    /**
+     * 初始化
+     */
+    init {
+        this.context = context
+        this.mapView = mapView
+    }
+
+
+    // todo: 2023/4/18 重写旋转事件
+    override fun onRotate(event: MotionEvent?, rotationAngle: Double): Boolean {
+        return false
+    }
+
+    // todo: 2023/4/18 重写点击事件
+    override fun onSingleTapUp(e: MotionEvent?): Boolean {
+        when (action) {
+            MapAction.MapTapSelectDoodle -> {
+                identifyLayer(e!!.x.toInt(), e.y.toInt())
+            }
+        }
+        return true
+    }
+
+    // todo: 2023/4/18 内部函数
+    private fun identifyLayer(sx: Int, sy: Int) {
+        var queryPoint = android.graphics.Point(sx, sy)
+        var iAsync = mapView?.identifyLayerAsync(queryLayer, queryPoint, 5.0, false)
+        iAsync?.addDoneListener(Runnable {
+            var feature:Feature ? = null
+            try {
+                var result = iAsync.get()
+                if (result.elements.size >= 1) {
+                    feature = result.elements[0] as Feature
+                } else {
+                    showWarning("未查询到任何数据!")
+                }
+            } catch (e: java.lang.IllegalArgumentException) {
+                showError("查询错误!")
+            } catch (e: ArcGISRuntimeException) {
+                showError("查询错误!")
+            }finally {
+                if (listener != null) listener?.onDoodleSelect(feature)
+            }
+        })
+    }
+
+    /**
+     * 显示错误消息
+     * @param error String 错误消息
+     */
+    private fun showError(error: String) {
+        DialogNormal(context!!, "错误", error).show()
+    }
+
+    /**
+     * 显示警告信息
+     * @param warning String 警告信息
+     */
+    private fun showWarning(warning: String) {
+        DialogNormal(context!!, "警告", warning).show()
+    }
+
+    /**
+     * 设置查询图层
+     * @param layer Layer 查询图层
+     */
+    fun setQueryLayer(layer: Layer) {
+        this.queryLayer = layer
+    }
+
+    /**
+     * 设置查询图层 用于点击查询
+     * @param layer Layer 图层
+     * @param action MapAction 动作
+     */
+    fun setQueryLayer(layer: Layer?, action: MapAction?) {
+        this.queryLayer = layer
+        this.action = action
+    }
+
+    /**
+     * 设置监听
+     * @param listener TouchListener 监听
+     */
+    fun setListener(listener: TouchListener) {
+        this.listener = listener
+    }
+}

+ 0 - 17
app/src/main/java/com/cr/map/SketchGraphicsOverlay.kt

@@ -1,17 +0,0 @@
-package com.cr.map
-
-import com.esri.arcgisruntime.geometry.SpatialReference
-
-/**
- * 操作系统:MAC系统
- * 创建者:王成
- * 创建日期:2023/4/13 16:59
- * 描述:草图编辑工具
- */
-class SketchGraphicsOverlay {
-    // todo: 2023/4/13 静态
-    companion object{
-        // define: 2023/4/13 WGS84坐标系框架
-        val wgs84SpatialReference:SpatialReference = SpatialReference.create(4326)
-    }
-}

+ 230 - 0
app/src/main/java/com/cr/pages/FragmentDoodle.kt

@@ -0,0 +1,230 @@
+package com.cr.pages
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.CompoundButton
+import android.widget.CompoundButton.OnCheckedChangeListener
+import android.widget.Switch
+import com.cr.cruav.CrApplication
+import com.cr.cruav.R
+import com.cr.event.BarAction
+import com.cr.event.EventFragmentBarAction
+import com.cr.widget.CrButton
+import com.squareup.otto.Subscribe
+
+/**
+ * 操作系统:MAC系统
+ * 创建者:王成
+ * 创建日期:2023/4/17 09:12
+ * 描述:涂鸦操作页面
+ */
+class FragmentDoodle : CrNavigationFragment(), CrButton.OnClickListener, OnCheckedChangeListener {
+    /**
+     * 操作监听接口
+     */
+    interface OnOperationListener {
+        // todo: 2023/4/17 开启绘制
+        fun onStartDraw()
+
+        // todo: 2023/4/17 停止绘制
+        fun onStopDraw()
+
+        // todo: 2023/4/17 开启选择
+        fun onSelect()
+
+        // todo: 2023/4/17 停止选择
+        fun onStopSelect()
+
+        // todo: 2023/4/17 清除
+        fun onClear()
+
+        // todo: 2023/4/17 保存
+        fun onSave()
+
+        // todo: 2023/4/17 删除全部
+        fun onRemove()
+
+        // todo: 2023/4/17 移除
+        fun onDelete()
+    }
+
+    private var btnClear: CrButton? = null // define: 2023/4/17 清除临时绘制的涂鸦
+    private var btnSave: CrButton? = null  // define: 2023/4/17 保存临时绘制的涂鸦
+    private var btnRemove: CrButton? = null // define: 2023/4/17 全部删除永久保存的涂鸦
+    private var btnDelete: CrButton? = null // define: 2023/4/17 删除选择的涂鸦
+    private var switchDraw: Switch? = null  // define: 2023/4/17 开启绘制
+    private var switchSelect: Switch? = null // define: 2023/4/17 开启选择
+
+    // define: 2023/4/17 操作监听
+    private var listener: OnOperationListener? = null
+
+    /**
+     * 创建视图
+     * @param inflater LayoutInflater
+     * @param container ViewGroup?
+     * @param savedInstanceState Bundle?
+     * @return View?
+     */
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        // todo: 2023/4/17 订阅监听
+        CrApplication.getEventBus().register(this)
+        self = this
+        mainView = inflater.inflate(R.layout.frag_doodle, null)
+        // todo: 2023/4/17 设置导航栏
+        setBar(R.id.nv)
+        // todo: 2023/4/17 设置展现方式
+        setAnimationDirection(AnimationDirection.LEFT)
+        // todo: 2023/4/17 关联控件
+        joinControls()
+        return mainView
+    }
+
+    /**
+     * 重写挂载控件
+     */
+    override fun joinControls() {
+        // todo: 2023/4/17 挂载控件
+        switchDraw = mainView?.findViewById(R.id.doodle_on_draw)
+        switchSelect = mainView?.findViewById(R.id.doodle_on_select)
+        btnClear = mainView?.findViewById(R.id.doodle_clear)
+        btnSave = mainView?.findViewById(R.id.doodle_save)
+        btnRemove = mainView?.findViewById(R.id.doodle_remove)
+        btnDelete = mainView?.findViewById(R.id.doodle_delete)
+        // todo: 2023/4/17 设置监听
+        btnClear?.setListener(this)
+        btnSave?.setListener(this)
+        btnRemove?.setListener(this)
+        btnDelete?.setListener(this)
+        switchDraw?.setOnCheckedChangeListener(this)
+        switchSelect?.setOnCheckedChangeListener(this)
+    }
+
+    /**
+     * 关闭页面
+     */
+    override fun dismiss() {
+        CrApplication.getEventBus().post(EventFragmentBarAction(self!!, BarAction.ACTION_DISMISS))
+    }
+
+    /**
+     * 视图点击事件
+     * @param view View
+     */
+    override fun onClick(view: View) {
+        when (view?.id) {
+            R.id.doodle_clear -> {
+                if (listener != null) listener?.onClear()
+            }
+            R.id.doodle_save -> {
+                if (listener != null) listener?.onSave()
+            }
+            R.id.doodle_remove -> {
+                if (listener != null) listener?.onRemove()
+            }
+            R.id.doodle_delete -> {
+                if (listener != null) listener?.onDelete()
+            }
+        }
+    }
+
+    /**
+     * 开关事件
+     * @param view CompoundButton
+     * @param isChecked Boolean
+     */
+    override fun onCheckedChanged(view: CompoundButton?, isChecked: Boolean) {
+        when (view?.id) {
+            R.id.doodle_on_draw -> {
+                if (isChecked) {
+                    if (listener != null) {
+                        listener?.onStartDraw()
+                        listener?.onStopSelect()
+                    }
+                    switchSelect?.isChecked = false
+                }else{
+                    if (listener != null) listener?.onStopDraw()
+                }
+
+            }
+            R.id.doodle_on_select -> {
+                if (isChecked) {
+                    if (listener != null) {
+                        listener?.onSelect()
+                        listener?.onStopDraw()
+                    }
+                    switchDraw?.isChecked = false
+                } else{
+                    if (listener != null) listener?.onStopSelect()
+                }
+            }
+        }
+    }
+
+    /**
+     * 重写页面初始化
+     */
+    override fun initPage() {
+        switchDraw?.isChecked = false
+        switchSelect?.isChecked = false
+    }
+
+    /**
+     * 设置操作监听
+     * @param listener OnOperationListener 操作监听
+     */
+    fun setListener(listener: OnOperationListener) {
+        this.listener = listener
+    }
+
+    /**
+     * 订阅事件执行
+     * @param event EventAction
+     */
+    @Subscribe
+    fun onAction(event:EventAction){
+        when(event.action){
+            EventAction.CLOSE_DRAW->{
+                switchDraw?.isChecked = false
+            }
+            EventAction.CLOSE_SELECT->{
+                switchSelect?.isChecked = false
+            }
+        }
+    }
+
+    // todo: 2023/4/17 生命周期
+    /**
+     * 销毁
+     */
+    override fun onDestroy() {
+        // todo: 2023/4/17 解除订阅监听
+        CrApplication.getEventBus().unregister(this)
+        super.onDestroy()
+    }
+
+    // todo: 2023/4/17 订阅事件类
+    class EventAction@JvmOverloads constructor(
+        action:Int
+    ){
+        // define: 2023/4/17 定义动作常量
+        companion object{
+            val CLOSE_DRAW:Int = 0
+            val CLOSE_SELECT:Int = 1
+        }
+        // define: 2023/4/17 定义动作
+        var action:Int = -1
+
+        /**
+         * 初始化
+         */
+        init {
+            this.action = action
+        }
+    }
+}

+ 250 - 12
app/src/main/java/com/cr/pages/FragmentMap.kt

@@ -9,15 +9,19 @@ import android.view.ViewGroup
 import com.cr.common.CrUnitManager
 import com.cr.common.DataManager
 import com.cr.common.FileManager
+import com.cr.cruav.CrApplication
 import com.cr.cruav.R
 import com.cr.data.CrUtil
+import com.cr.dialog.DialogNormal
 import com.cr.map.*
 import com.esri.arcgisruntime.ArcGISRuntimeEnvironment
 import com.esri.arcgisruntime.arcgisservices.LabelDefinition
 import com.esri.arcgisruntime.data.Feature
 import com.esri.arcgisruntime.data.FeatureTable
 import com.esri.arcgisruntime.data.Geodatabase
+import com.esri.arcgisruntime.data.QueryParameters
 import com.esri.arcgisruntime.data.ServiceFeatureTable
+import com.esri.arcgisruntime.geometry.Geometry
 import com.esri.arcgisruntime.geometry.Point
 import com.esri.arcgisruntime.geometry.PointBuilder
 import com.esri.arcgisruntime.geometry.PolylineBuilder
@@ -25,14 +29,14 @@ import com.esri.arcgisruntime.layers.ArcGISMapImageLayer
 import com.esri.arcgisruntime.layers.ArcGISTiledLayer
 import com.esri.arcgisruntime.layers.FeatureLayer
 import com.esri.arcgisruntime.mapping.ArcGISMap
-import com.esri.arcgisruntime.mapping.view.Graphic
-import com.esri.arcgisruntime.mapping.view.GraphicsOverlay
-import com.esri.arcgisruntime.mapping.view.MapView
-import com.esri.arcgisruntime.mapping.view.SketchEditor
+import com.esri.arcgisruntime.mapping.GeoElement
+import com.esri.arcgisruntime.mapping.view.*
 import com.esri.arcgisruntime.symbology.*
 import com.google.gson.JsonObject
 import com.google.gson.JsonParser
 import com.google.gson.JsonPrimitive
+import com.squareup.otto.Subscribe
+import java.util.concurrent.ExecutionException
 
 /**
  * 操作系统:MAC系统
@@ -107,7 +111,7 @@ class FragmentMap : CrAnimationFragment() {
     private var markChange: EventMarkChange? = null
 
     // todo: 2023/4/13 动作相关
-    private var mapAction: EventMapAction? = null
+    private var mapAction: MapAction? = null
 
     // todo: 2023/4/14 绘制图层
     private var gLayerIco: GraphicsOverlay? = null // define: 2023/4/13 标志图层
@@ -131,6 +135,8 @@ class FragmentMap : CrAnimationFragment() {
     private var graAirplaneLink: Graphic? = null // define: 2023/4/13 飞行器与返航点连接线图形
     private var graAirplaneLocation: Graphic? = null // define: 2023/4/13 飞行器位置图形
     private var graAirplaneHomeLocation: Graphic? = null // define: 2023/4/13 返航点位置图形
+
+    // todo: 2023/4/17 草图编辑
     private var sketchEditor: SketchEditor? = null // define: 2023/4/13 草图编辑器
     private var feaSelectCase: Feature? = null // define: 2023/4/13 选中的案件点
 
@@ -146,6 +152,10 @@ class FragmentMap : CrAnimationFragment() {
     private var fTableNetCasePolygon: ServiceFeatureTable? = null // define: 2023/4/14 网路案件表
     private var fLayerNetCasePolygon: ArcGISMapImageLayer? = null // define: 2023/4/14 网络案件图层
 
+    // todo: 2023/4/18 地图Touch事件
+    private var mapTouch: MapTouch? = null
+
+
     /**
      * 重写创建View方法
      * @param inflater LayoutInflater
@@ -159,6 +169,8 @@ class FragmentMap : CrAnimationFragment() {
         savedInstanceState: Bundle?
     ): View? {
         mainView = inflater.inflate(R.layout.frag_map, container, false)
+        // todo: 2023/4/17 注册订阅
+        CrApplication.getEventBus().register(this)
         return mainView
     }
 
@@ -176,23 +188,48 @@ class FragmentMap : CrAnimationFragment() {
      * 初始化UI
      */
     private fun initUI() {
-        ArcGISRuntimeEnvironment.setLicense("runtimelite,1000,rud4449636536,none,NKMFA0PL4S0DRJE15166");
+        //ArcGISRuntimeEnvironment.setLicense("runtimelite,1000,rud4449636536,none,NKMFA0PL4S0DRJE15166");
         // todo: 2023/3/14 初始化控件
         mapView = mainView?.findViewById(R.id.map_mapView)
-        mapView?.let {
+        mapView?.let { itView ->
             // todo: 2023/4/13 设置底部标识是否显示
-            it.isAttributionTextVisible = false
+            itView.isAttributionTextVisible = false
             mMap = ArcGISMap()
-            it.map = mMap
+            itView.map = mMap
             // todo: 2023/4/13 地图控件初始化
-            it.backgroundGrid.color = Color.argb(255, 216, 216, 216)
-            it.backgroundGrid.gridLineColor = Color.argb(0, 255, 255, 255)
+            itView.backgroundGrid.color = Color.argb(255, 216, 216, 216)
+            itView.backgroundGrid.gridLineColor = Color.argb(0, 255, 255, 255)
+            // todo: 2023/4/17 设置草图编辑
+            sketchEditor = SketchEditor()
+            sketchEditor?.sketchEditConfiguration?.let {
+                it.isAllowPartSelection = false
+            }
+            itView.sketchEditor = sketchEditor
+            // todo: 2023/4/18 Touch事件初始化
+            mapTouch = MapTouch(context!!, itView)
+            mapTouch?.setListener(touchListener)
+            itView.onTouchListener = mapTouch
         }
         // todo: 2023/4/13 地图初始化
         mapInit()
     }
 
     /**
+     * Touch监听
+     */
+    private var touchListener = object : MapTouch.TouchListener {
+        // todo: 2023/4/18 涂鸦选择回调
+        override fun onDoodleSelect(feature: Feature?) {
+            if (feature != null) {
+                // todo: 2023/4/18 高亮显示
+                focusFeature(fLayerDoodle!!, feature)
+            } else {
+                unfocusFeature(fLayerDoodle!!)
+            }
+        }
+    }
+
+    /**
      * 地图初始化
      */
     private fun mapInit() {
@@ -515,11 +552,212 @@ class FragmentMap : CrAnimationFragment() {
     private fun setMapCenter(longitude: Double, latitude: Double, scale: Double) {
         // todo: 2023/4/13 创建中心点
         var centerPoint: Point =
-            Point(longitude, latitude, SketchGraphicsOverlay.wgs84SpatialReference)
+            Point(longitude, latitude, MapTouch.wgs84SpatialReference)
         if (scale > 0) {
             mapView?.setViewpointCenterAsync(centerPoint, scale)
         } else {
             mapView?.setViewpointCenterAsync(centerPoint)
         }
     }
+
+    /**
+     * 高亮显示要素
+     * @param layer FeatureLayer 要素所在图层
+     * @param feature Feature 要素
+     */
+    private fun focusFeature(layer: FeatureLayer, feature: Feature) {
+        layer.selectFeature(feature)
+    }
+
+    /**
+     * 清除高亮显示
+     * @param layer FeatureLayer 图层
+     */
+    private fun unfocusFeature(layer: FeatureLayer) {
+        layer.clearSelection()
+    }
+
+    /**
+     * 清除全部选择
+     */
+    private fun unfocusAllFeature(){
+        for(layer in mMap!!.operationalLayers){
+            if(layer is FeatureLayer){
+                layer.clearSelection()
+            }
+        }
+
+        for(overLayer in mapView!!.graphicsOverlays){
+            overLayer.clearSelection()
+        }
+    }
+
+    /**
+     * 开始绘制涂鸦
+     */
+    private fun doodleStartDraw() {
+        sketchEditor?.start(SketchCreationMode.FREEHAND_LINE)
+    }
+
+    /**
+     * 清除草图
+     */
+    private fun clearSketch() {
+        sketchEditor?.clearGeometry()
+    }
+
+    /**
+     * 保存绘制的涂鸦
+     */
+    private fun doodleSave() {
+        var geometry: Geometry? = sketchEditor?.geometry
+        geometry?.let {
+            var feature: Feature = fTableDoodle!!.createFeature()
+            feature.geometry = it
+            var addAsync = fTableDoodle!!.addFeatureAsync(feature)
+            addAsync.addDoneListener(Runnable {
+                try {
+                    addAsync.get()
+                    if (addAsync.isDone) {
+                        DialogNormal(context!!, "提示", "涂鸦保存成功!").show()
+                        sketchEditor?.stop()
+                        CrApplication.getEventBus()
+                            .post(FragmentDoodle.EventAction(FragmentDoodle.EventAction.CLOSE_DRAW))
+                    }
+                } catch (e: InterruptedException) {
+                    DialogNormal(context!!, "警告", e.message!!).show()
+                } catch (e: ExecutionException) {
+                    DialogNormal(context!!, "警告", e.message!!).show()
+                }
+            })
+        }
+    }
+
+    /**
+     * 删除全部涂鸦
+     */
+    private fun doodleRemove() {
+        var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
+        dialog.setButtonsText("是", "否")
+        dialog.setListener(object : DialogNormal.DialogNormalListener {
+            // todo: 2023/4/17 删除
+            override fun completion() {
+                var params = QueryParameters()
+                params.whereClause = "1=1"
+                var queryAsync = fTableDoodle?.queryFeaturesAsync(params)
+                queryAsync?.addDoneListener(Runnable {
+                    try {
+                        if (queryAsync.isDone) {
+                            var deleteAsync = fTableDoodle?.deleteFeaturesAsync(queryAsync.get())
+                            deleteAsync?.addDoneListener(Runnable {
+                                try {
+                                    if (deleteAsync.isDone) {
+                                        DialogNormal(context!!, "提示", "删除成功!").show()
+                                    }
+                                } catch (e: java.lang.IllegalArgumentException) {
+                                    DialogNormal(context!!, "错误", "删除错误!").show()
+                                }
+                            })
+                        }
+
+                    } catch (e: java.lang.IllegalArgumentException) {
+                        DialogNormal(context!!, "错误", "查询错误!").show()
+                    }
+                })
+            }
+
+            // todo: 2023/4/17 否
+            override fun close() {
+
+            }
+
+        })
+        dialog.show()
+    }
+
+    /**
+     * 删除选择涂鸦
+     */
+    private fun doodleDelete() {
+        var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
+        dialog.setButtonsText("是", "否")
+        dialog.setListener(object : DialogNormal.DialogNormalListener {
+            override fun completion() {
+                var sAsync = fLayerDoodle!!.selectedFeaturesAsync
+                sAsync.addDoneListener(Runnable {
+                    if (sAsync.isDone){
+                        var result = sAsync.get()
+                        var dAsync = fTableDoodle!!.deleteFeaturesAsync(result)
+                        dAsync.addDoneListener(Runnable{
+                            try {
+                                if(dAsync.isDone){
+                                    DialogNormal(context!!, "提示", "删除成功!").show()
+                                }
+                            }catch (e:java.lang.IllegalArgumentException){
+                                DialogNormal(context!!, "错误", "删除错误!").show()
+                            }
+                        })
+                    }
+                })
+            }
+
+            override fun close() {
+            }
+        })
+        dialog.show()
+    }
+
+    /**
+     * 订阅地图事件执行动作
+     * @param event EventMap 事件
+     */
+    @Subscribe
+    fun onAction(event: EventMap) {
+        when (event.action) {
+            // todo: 2023/4/17 绘制涂鸦
+            MapAction.MapTapDrawDoodle -> {
+                CrUtil.showMessage("地图接收绘制命令")
+                doodleStartDraw()
+            }
+            // todo: 2023/4/17 清除涂鸦
+            MapAction.EventDoodleClear -> {
+                clearSketch()
+            }
+            // todo: 2023/4/17 保存涂鸦
+            MapAction.EventDoodleSave -> {
+                doodleSave()
+            }
+            // todo: 2023/4/17 停止草图编辑
+            MapAction.EventStopSketch -> {
+                sketchEditor?.stop()
+            }
+            // todo: 2023/4/17 全部删除保存的涂鸦
+            MapAction.EventDoodleRemove -> {
+                doodleRemove()
+            }
+            // todo: 2023/4/18 删除选择涂鸦
+            MapAction.EventDoodleDelete -> {
+                doodleDelete()
+            }
+            // todo: 2023/4/18 选择涂鸦
+            MapAction.MapTapSelectDoodle -> {
+                CrUtil.showMessage("地图上点击需要选择的涂鸦")
+                mapTouch?.setQueryLayer(fLayerDoodle!!, MapAction.MapTapSelectDoodle)
+            }
+            // todo: 2023/4/18 停止Touch
+            MapAction.EventStopTouch->{
+                mapTouch?.setQueryLayer(null,null)
+                unfocusAllFeature()
+            }
+        }
+    }
+
+    // todo: 2023/4/17 生命周期
+    override fun onDestroy() {
+        // todo: 2023/4/17 移除订阅监听
+        CrApplication.getEventBus().unregister(this)
+        super.onDestroy()
+    }
+
+
 }

+ 113 - 0
app/src/main/java/com/cr/widget/CrButton.kt

@@ -0,0 +1,113 @@
+package com.cr.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.View
+import android.widget.LinearLayout
+import android.widget.TextView
+import com.cr.cruav.R
+import com.cr.data.CrUtil
+import com.cr.data.FontManager
+
+/**
+ * 操作系统:MAC系统
+ * 创建者:王成
+ * 创建日期:2023/4/14 16:13
+ * 描述:通用按钮
+ */
+class CrButton @JvmOverloads constructor(
+    context: Context,
+    attrs: AttributeSet? = null,
+    defStyleAttr: Int = 0
+) : CrLinearLayoutWidget(context, attrs, defStyleAttr) ,View.OnClickListener{
+    /**
+     * 对外接口
+     */
+    interface OnClickListener{
+        fun onClick(view: View)
+    }
+    private var lblIco: TextView? = null
+    private var lblTitle: TextView? = null
+    private var btnPanel:LinearLayout ?= null
+
+    private var listener:OnClickListener?= null
+
+    /**
+     * 初始化
+     */
+    init {
+        // todo: 2023/4/14 初始化视图
+        initView(R.layout.wg_button)
+        // todo: 2023/4/14 挂接组件
+        joinControls()
+        // todo: 2023/4/14 初始化属性
+        initProperty(attrs!!)
+    }
+
+    /**
+     * 重写挂接组件方法
+     */
+    override fun joinControls() {
+        super.joinControls()
+        lblIco = findViewById(R.id.wg_button_ico)
+        btnPanel = findViewById(R.id.wg_button_panel)
+        lblTitle = findViewById(R.id.wg_button_title)
+        // todo: 2023/4/14 设置监听
+        btnPanel?.setOnClickListener(this)
+    }
+
+    /**
+     * 重写属性初始化
+     * @param attrs AttributeSet
+     */
+    override fun initProperty(attrs: AttributeSet) {
+        val attributes = context.obtainStyledAttributes(attrs, R.styleable.ViewButton)
+        if (attributes != null) {
+            // todo: 2023/4/14  设置标题
+            val strTitle = attributes.getString(R.styleable.ViewButton_crTitle)
+            lblTitle!!.text = strTitle
+            // todo: 2023/4/14  设置图标
+            val strICO = attributes.getString(R.styleable.ViewButton_crLeftResource)
+            if(strICO != null){
+                FontManager.setTextView(context, lblIco!!, strICO!!)
+            }
+            // todo: 2023/4/17 设置背景
+            val iBackResource = attributes.getDrawable(R.styleable.ViewButton_crClickGround)
+            if (iBackResource != null){
+                btnPanel?.background  = iBackResource
+            }
+            // todo: 2023/4/14  设置属性生效
+            attributes.recycle()
+        }
+    }
+
+    /**
+     * 覆写视图点击事件
+     * @param p0 View
+     */
+    override fun onClick(p0: View?) {
+        if(listener != null) listener?.onClick(mainView!!)
+    }
+
+    /**
+     * 拦截事件
+     * @param ev MotionEvent
+     * @return Boolean
+     */
+    override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
+        if (ev!!.actionMasked == MotionEvent.ACTION_DOWN) {
+            val p = parent
+            p?.requestDisallowInterceptTouchEvent(true)
+        }
+        return false
+    }
+
+    /**
+     * 设置监听
+     * @param listener OnClickListener 监听
+     */
+    fun setListener(listener: OnClickListener){
+        this.listener = listener
+    }
+}

+ 4 - 2
app/src/main/java/com/cr/widget/CrLinearLayoutWidget.kt

@@ -9,19 +9,21 @@ import android.widget.LinearLayout
  * 操作系统:MAC系统
  * 创建者:王成
  * 创建日期:2023/3/29 13:46
- * 描述:
+ * 描述:线性布局基础类
  */
 open class CrLinearLayoutWidget@JvmOverloads constructor(
     context:Context,
     attrs: AttributeSet?=null,
     defStyleAttr: Int = 0
 ):LinearLayout(context,attrs,defStyleAttr) {
+    // define: 2023/4/14 主视图
+    protected var mainView:View ?= null
     /**
      * 初始化视图
      * @param layoutId Int 视图xml文件Id
      */
     fun initView(layoutId:Int){
-        View.inflate(context,layoutId,this);
+        mainView = View.inflate(context,layoutId,this);
     }
 
     /**

+ 17 - 0
app/src/main/res/drawable/tools_btn_normal.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <!--填充色-->
+    <solid android:color="#000099ff" />
+    <!--描边-->
+    <stroke
+        android:width="0dp"
+        android:color="#df4249" />
+    <!-- 圆角 -->
+    <corners
+        android:radius="@dimen/cr_5_dp"/>
+    <padding
+        android:left="0dp"
+        android:right="0dp"
+        android:top="0dp"
+        android:bottom="0dp"/>
+</shape>

+ 17 - 0
app/src/main/res/drawable/tools_btn_select.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <!--填充色-->
+    <solid android:color="#0099ff" />
+    <!--描边-->
+    <stroke
+        android:width="0dp"
+        android:color="#df4249" />
+    <!-- 圆角 -->
+    <corners
+        android:radius="@dimen/cr_5_dp"/>
+    <padding
+        android:left="0dp"
+        android:right="0dp"
+        android:top="0dp"
+        android:bottom="0dp"/>
+</shape>

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

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/tools_btn_select"/>
+    <item android:state_pressed="false" android:drawable="@drawable/tools_btn_normal"/>
+</selector>

+ 8 - 0
app/src/main/res/layout/av_main.xml

@@ -101,4 +101,12 @@
         android:orientation="vertical"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@id/av_fragment_top"/>
+    <!--左侧弹窗容器-->
+    <FrameLayout
+        android:id="@+id/av_frm_left_panel"
+        android:layout_width="@dimen/cr_200_dp"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/av_fragment_top"/>
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 14 - 9
app/src/main/res/layout/dig_normal.xml

@@ -25,16 +25,21 @@
             android:layout_margin="@dimen/common_margin"
             android:id="@+id/dig_title"
             android:textColor="@color/white"/>
-        <TextView
+        <ScrollView
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/dig_normal_default_message"
-            android:gravity="center"
-            android:textSize="@dimen/sp_12"
-            android:layout_margin="@dimen/common_margin"
-            android:layout_weight="1"
-            android:id="@+id/dig_message"
-            android:textColor="@color/dodgerblue"/>
+            android:layout_height="match_parent"
+            android:layout_weight="1">
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/dig_normal_default_message"
+                android:gravity="center"
+                android:textSize="@dimen/sp_12"
+                android:layout_margin="@dimen/common_margin"
+                android:layout_weight="1"
+                android:id="@+id/dig_message"
+                android:textColor="@color/dodgerblue"/>
+        </ScrollView>
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"

+ 63 - 0
app/src/main/res/layout/frag_doodle.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/shape_back_fragment">
+    <com.cr.widget.CrNavigationBarWidget
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:crTitle="@string/nv_title_ty"
+        app:isGotoBack="false"
+        app:isDismiss="true"
+        android:id="@+id/nv"
+        android:layout_weight="0"/>
+    <LinearLayout
+        style="@style/view_tools_line_row">
+        <TextView
+            style="@style/view_tools_line_row_title"
+            android:text="@string/frag_doodle_title_on_draw"/>
+        <Switch
+            style="@style/item_layer_padding"
+            android:track="@drawable/switch_track"
+            android:thumb="@drawable/switch_thumb"
+            android:id="@+id/doodle_on_draw"/>
+    </LinearLayout>
+    <View style="@style/view_split_h2"/>
+    <com.cr.widget.CrButton
+        style="@style/view_tools_line_row_button"
+        app:crTitle="@string/frag_doodle_title_clear"
+        app:crLeftResource = "@string/ico_clear"
+        android:id="@+id/doodle_clear"/>
+    <View style="@style/view_split_h2"/>
+    <com.cr.widget.CrButton
+        style="@style/view_tools_line_row_button"
+        app:crTitle="@string/frag_doodle_title_save"
+        app:crLeftResource = "@string/ico_save"
+        android:id="@+id/doodle_save"/>
+    <View style="@style/view_split_h2"/>
+    <com.cr.widget.CrButton
+        style="@style/view_tools_line_row_button"
+        app:crTitle="@string/frag_doodle_title_remove"
+        app:crLeftResource = "@string/ico_remove"
+        android:id="@+id/doodle_remove"/>
+    <View style="@style/view_split_h2"/>
+    <LinearLayout
+        style="@style/view_tools_line_row">
+        <TextView
+            style="@style/view_tools_line_row_title"
+            android:text="@string/frag_doodle_title_on_select"/>
+        <Switch
+            style="@style/item_layer_padding"
+            android:track="@drawable/switch_track"
+            android:thumb="@drawable/switch_thumb"
+            android:id="@+id/doodle_on_select"/>
+    </LinearLayout>
+    <View style="@style/view_split_h2"/>
+    <com.cr.widget.CrButton
+        style="@style/view_tools_line_row_button"
+        app:crTitle="@string/frag_doodle_title_on_delete"
+        app:crLeftResource = "@string/ico_delete"
+        android:id="@+id/doodle_delete"/>
+</LinearLayout>

+ 1 - 1
app/src/main/res/layout/tools_top.xml

@@ -19,7 +19,7 @@
     </LinearLayout>
     <LinearLayout
         style="@style/tools_top_panel"
-        android:id="@+id/tools_ty">
+        android:id="@+id/tools_doodle">
         <ImageView
             style="@style/tools_image"
             android:src="@drawable/tools_ty"/>

+ 21 - 0
app/src/main/res/layout/wg_button.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/tools_btn_selector"
+    android:id="@+id/wg_button_panel"
+    android:clickable="true"
+    android:gravity="center_vertical">
+    <LinearLayout
+        style="@style/view_button_panel">
+        <TextView
+            style="@style/view_button_image"
+            android:text="A"
+            android:id="@+id/wg_button_ico"/>
+        <TextView
+            style="@style/view_button_text"
+            android:text="Title"
+            android:id="@+id/wg_button_title"/>
+    </LinearLayout>
+</LinearLayout>

+ 9 - 7
app/src/main/res/values/attr.xml

@@ -3,20 +3,22 @@
     <!--通用属性定义-->
     <declare-styleable name="ViewCommonProperty">
         <!--标题文本-->
-        <attr name="crTitle" format="string"></attr>
+        <attr name="crTitle" format="string"/>
         <!--提示信息-->
         <attr name="crHint" format="string" />
         <!--左侧图片-->
-        <attr name="crLeftImg" format="reference"></attr>
+        <attr name="crLeftImg" format="reference"/>
         <!--左侧资源 一般只使用字体-->
-        <attr name="crLeftResource" format="string"></attr>
+        <attr name="crLeftResource" format="string"/>
         <!--是否是密码框-->
-        <attr name="crIsPassword" format="boolean"></attr>
+        <attr name="crIsPassword" format="boolean"/>
         <!--图标颜色-->
-        <attr name="crIcoColor" format="color"></attr>
+        <attr name="crIcoColor" format="color"/>
         <!--提示文字颜色-->
-        <attr name="crHintColor" format="color"></attr>
+        <attr name="crHintColor" format="color"/>
         <!--文本颜色-->
-        <attr name="crTextColor" format="color"></attr>
+        <attr name="crTextColor" format="color"/>
+        <!--背景-->
+        <attr name="crClickGround" format="reference"/>
     </declare-styleable>
 </resources>

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

@@ -6,6 +6,7 @@
     <color name="teal_200">#FF03DAC5</color>
     <color name="teal_700">#FF018786</color>
     <color name="tools_button_back">#99000000</color>
+    <color name="ico_color">#409eff</color>
     
     <color name="title">#FFd4f12c</color>
 

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

@@ -88,6 +88,14 @@
     <string name="dig_normal_title">操作提示</string>
     <string name="dig_normal_default_message">默认提示信息</string>
 
+    <!--涂鸦页面相关-->
+    <string name="frag_doodle_title_on_draw">开启绘制</string>
+    <string name="frag_doodle_title_clear">清除涂鸦</string>
+    <string name="frag_doodle_title_save">保存涂鸦</string>
+    <string name="frag_doodle_title_remove">全部删除</string>
+    <string name="frag_doodle_title_on_select">选择涂鸦</string>
+    <string name="frag_doodle_title_on_delete">删除涂鸦</string>
+
     <!--字体-->
     <string name="ico_nv_left" translatable="false">&#xe60b;</string>
     <string name="ico_nv_right" translatable="false">&#xe81a;</string>
@@ -96,5 +104,10 @@
     <string name="ico_com" translatable="false">&#xe8b0;</string>
     <string name="ico_server" translatable="false">&#xe821;</string>
 
+    <string name="ico_clear">&#xe69e;</string>
+    <string name="ico_save">&#xe8bb;</string>
+    <string name="ico_remove">&#xec49;</string>
+    <string name="ico_delete">&#xe604;</string>
+
 
 </resources>

+ 70 - 10
app/src/main/res/values/themes.xml

@@ -58,6 +58,12 @@
         <item name="android:background">@drawable/shape_back_view_h</item>
     </style>
 
+    <style name="view_split_h2" parent="view_split_h1">
+        <item name="android:layout_marginTop">0dp</item>
+        <item name="android:layout_marginBottom">0dp</item>
+    </style>
+
+
     <!--大疆视图-顶部信息-组件-样式-->
     <style name="dji_top_component">
         <item name="android:layout_width">@dimen/cr_60_dp</item>
@@ -139,6 +145,7 @@
         <item name="android:textSize">@dimen/sp_8</item>
         <item name="android:textColor">@color/black</item>
     </style>
+
     <style name="switch_text_on" parent="@style/TextAppearance.AppCompat.Widget.Switch">
         <item name="android:textSize">@dimen/sp_8</item>
         <item name="android:textColor">@color/white</item>
@@ -155,6 +162,7 @@
         <item name="android:textColor">@color/white</item>
         <item name="android:letterSpacing">0.5</item>
     </style>
+
     <style name="btn_default" parent="btn_common">
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">@dimen/cr_24_dp</item>
@@ -242,22 +250,74 @@
         <item name="android:gravity">center_vertical</item>
     </style>
 
+    <!--按钮视图背景样式-->
+    <style name="view_button_panel">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">@dimen/cr_24_dp</item>
+        <item name="android:layout_marginTop">@dimen/cr_5_dp</item>
+        <item name="android:layout_marginBottom">@dimen/cr_5_dp</item>
+    </style>
+    <!--按钮视图图标样式-->
+    <style name="view_button_image">
+        <item name="android:layout_width">@dimen/cr_16_dp</item>
+        <item name="android:layout_height">@dimen/cr_16_dp</item>
+        <item name="android:textSize">@dimen/sp_12</item>
+        <item name="android:textColor">@color/ico_color</item>
+        <item name="android:gravity">center</item>
+    </style>
+    <!--按钮视图文字样式-->
+    <style name="view_button_text">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">match_parent</item>
+        <item name="android:textSize">@dimen/sp_11</item>
+        <item name="android:textColor">@color/white</item>
+        <item name="android:gravity">center_vertical</item>
+        <item name="android:textStyle">bold</item>
+    </style>
+    <!--工具操作具体页面行样式-->
+    <style name="view_tools_line_row">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">@dimen/cr_24_dp</item>
+        <item name="android:orientation">horizontal</item>
+        <item name="android:gravity">center</item>
+        <item name="android:paddingLeft">@dimen/cr_8_dp</item>
+    </style>
+    <!--工具操作具体页面按钮行样式-->
+    <style name="view_tools_line_row_button">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">@dimen/cr_24_dp</item>
+        <item name="android:layout_marginLeft">@dimen/cr_5_dp</item>
+        <item name="android:layout_marginRight">@dimen/cr_5_dp</item>
+    </style>
+    <!--工具操作页面行内文字样式-->
+    <style name="view_tools_line_row_title" parent="lbl_title_common">
+        <item name="android:textSize">@dimen/sp_13</item>
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_weight">1</item>
+    </style>
+
     <!--自定义文本框属性-->
     <declare-styleable name="ViewEditTextProperty">
-        <attr name="crHint"></attr>
-        <attr name="crLeftImg"></attr>
-        <attr name="crLeftResource"></attr>
-        <attr name="crIsPassword"></attr>
-        <attr name="crIcoColor"></attr>
-        <attr name="crHintColor"></attr>
-        <attr name="crTextColor"></attr>
+        <attr name="crHint" />
+        <attr name="crLeftImg" />
+        <attr name="crLeftResource" />
+        <attr name="crIsPassword" />
+        <attr name="crIcoColor" />
+        <attr name="crHintColor" />
+        <attr name="crTextColor" />
     </declare-styleable>
 
     <!--自定义导航栏属性-->
     <declare-styleable name="ViewNavigationBar">
-        <attr name="crTitle"></attr>
-        <attr name="isGotoBack" format="boolean"></attr>
-        <attr name="isDismiss" format="boolean"></attr>
+        <attr name="crTitle" />
+        <attr name="isGotoBack" format="boolean" />
+        <attr name="isDismiss" format="boolean" />
     </declare-styleable>
 
+    <!--自定义按钮属性-->
+    <declare-styleable name="ViewButton">
+        <attr name="crTitle" />
+        <attr name="crLeftResource" />
+        <attr name="crClickGround" />
+    </declare-styleable>
 </resources>