diff --git a/.idea/misc.xml b/.idea/misc.xml
index 21e99e2dc0..cd77a1f062 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt
index b22ee55ad4..e52d73c420 100644
--- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt
+++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt
@@ -6,4 +6,4 @@ import com.mogo.module.share.R
* 可配置按钮封装
* @author tongchenfei
*/
-data class FixableButton(val id:Int = 0,val iconUrl:String = "", val iconRes:Int = R.drawable.share_block_up, val content:String="拥堵")
\ No newline at end of file
+data class FixableButton(val id:Int = 0,val poiType:String = "10007",val iconUrl:String = "", val iconRes:Int = R.drawable.share_block_up, val content:String="拥堵")
\ No newline at end of file
diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt
index 5fc8567b5d..f2b146fded 100644
--- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt
+++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt
@@ -1,6 +1,7 @@
package com.mogo.module.share.dialog
import android.content.Context
+import android.widget.FrameLayout
import android.widget.GridLayout
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -65,7 +66,9 @@ class GridFixableShareDialog(context:Context):BaseFloatDialog(context) {
Logger.d(TAG, "share btn click: $it")
randomGenerateBtn()
}
- randomGenerateBtn()
+ findViewById(R.id.flShareDialogContainer).setOnClickListener { dismiss() }
+
+ gridBtnManager.showDefaultBtns()
}
private fun randomGenerateBtn(){
diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt
index cbebfd609d..65dd00d2da 100644
--- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt
+++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt
@@ -9,23 +9,29 @@ import android.widget.ImageView
import android.widget.TextView
import com.mogo.module.share.R
import com.mogo.module.share.bean.FixableButton
+import com.mogo.service.tanlu.IMogoTanluProvider
import com.mogo.utils.glide.GlideApp
/**
* 用来管理生成对应的分享按钮
*/
-class GridBtnManager(val context:Context,val container:GridLayout) {
+class GridBtnManager(val context: Context, val container: GridLayout) {
private val inflater = LayoutInflater.from(context)
- fun resetContainer(){
+ fun resetContainer() {
container.removeAllViews()
}
fun generateShareButton(button: FixableButton): View {
- val view = inflater.inflate(R.layout.item_share_btn, container,false )
+ val view = inflater.inflate(R.layout.item_share_btn, container, false)
val img = view.findViewById(R.id.ivShareIcon)
val content = view.findViewById(R.id.tvShareContent)
- GlideApp.with(context).load(button.iconRes).into(img)
+ // 优先加载url图片,然后加载资源图片
+ if (button.iconUrl.isNotEmpty()) {
+ GlideApp.with(context).load(button.iconUrl).centerInside().into(img)
+ } else {
+ GlideApp.with(context).load(button.iconRes).centerInside().into(img)
+ }
content.text = button.content
view.setOnClickListener {
btnClickListener?.invoke(button)
@@ -34,7 +40,21 @@ class GridBtnManager(val context:Context,val container:GridLayout) {
return view
}
- private var btnClickListener:((fixableButton:FixableButton)->Unit)? =null
+ fun showDefaultBtns() {
+ resetContainer()
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_BLOCK, iconRes = R.drawable.share_block_up, content = "拥堵"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_TRAFFIC_CHECK, iconRes = R.drawable.share_traffic_check, content = "交通检查"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_CLOSURE, iconRes = R.drawable.share_road_closure, content = "封路"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ACCIDENT, iconRes = R.drawable.share_accident, content = "事故"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ROAD_CONSTRUCTION, iconRes = R.drawable.share_road_construction, content = "道路施工"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_REAL_TIME_TRAFFIC, iconRes = R.drawable.share_real_time_traffic, content = "实时路况"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_SEEK_HELP, iconRes = R.drawable.share_seek_help, content = "故障求助"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_STAGNANT_WATER, iconRes = R.drawable.share_stagnant_water, content = "道路积水"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ROAD_ICY, iconRes = R.drawable.share_road_icy, content = "道路结冰"))
+ generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_DENSE_FOG, iconRes = R.drawable.share_dense_fog, content = "浓雾"))
+ }
+
+ private var btnClickListener: ((fixableButton: FixableButton) -> Unit)? = null
fun setShareClickListener(listener: ((fixableButton: FixableButton) -> Unit)) {
btnClickListener = listener
}
diff --git a/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml b/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml
index 061b149f08..b428cc73eb 100644
--- a/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml
+++ b/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml
@@ -1,18 +1,18 @@
+ android:orientation="vertical">
+ android:paddingLeft="@dimen/module_share_container_padding_left"
+ android:paddingRight="@dimen/module_share_container_padding_right" />
+
\ No newline at end of file
diff --git a/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml b/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml
index d17fe7fc18..8ae0f36968 100644
--- a/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml
+++ b/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml
@@ -3,22 +3,31 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:paddingLeft="@dimen/module_share_btn_margin_left"
+ android:paddingTop="@dimen/module_share_btn_margin_top">
+
+
+
+
+
-
28px
32px
+ 114px
+ 83px
+ 6px
+ 123px
+ 110px
+
+ 75px
+ 165px
+ 967px
+
diff --git a/modules/mogo-module-share/src/main/res/values/dimens.xml b/modules/mogo-module-share/src/main/res/values/dimens.xml
index de5262bd89..044d40bc47 100644
--- a/modules/mogo-module-share/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-share/src/main/res/values/dimens.xml
@@ -22,4 +22,14 @@
15px
17.5px
+ 60px
+ 44px
+ 5px
+ 65px
+ 58px
+
+ 40px
+ 89px
+ 514px
+
\ No newline at end of file
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/tanlu/IMogoTanluProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/tanlu/IMogoTanluProvider.java
index 2ea236564c..20c64855e3 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/tanlu/IMogoTanluProvider.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/tanlu/IMogoTanluProvider.java
@@ -45,6 +45,11 @@ public interface IMogoTanluProvider extends IProvider {
*/
String TYPE_ROAD_CONSTRUCTION = "10006";
+ /**
+ * 故障求助
+ */
+ String TYPE_SEEK_HELP = "99999";
+
/**
* 用户手点上报
*/