修复UI-175

This commit is contained in:
zhangyuanzhen
2020-02-12 21:06:17 +08:00
parent 80a4b22809
commit 13463aa79b
5 changed files with 53 additions and 5 deletions

View File

@@ -45,6 +45,9 @@ dependencies {
implementation project(":foudations:mogo-utils") implementation project(":foudations:mogo-utils")
compileOnly project(":libraries:mogo-map-api") compileOnly project(":libraries:mogo-map-api")
} }
api 'org.greenrobot:eventbus:3.1.1'
} }
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -40,7 +40,7 @@ public class VoiceConstants {
*/ */
public static final String CMD_MAP_HISTORY = "com.ileja.navi.map.history"; public static final String CMD_MAP_HISTORY = "com.ileja.navi.map.history";
public static final String CMD_MAP_HISTORY_UN_WAKEUP = "CMD_MAP_HISTORY_UN_WAKEUP"; public static final String CMD_MAP_HISTORY_UN_WAKEUP = "CMD_MAP_HISTORY_UN_WAKEUP";
public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"查询导航历史记录"}; public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"导航历史"};
/** /**

View File

@@ -17,6 +17,7 @@ import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe import io.reactivex.ObservableOnSubscribe
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
/** /**
* @author zyz * @author zyz
@@ -104,6 +105,8 @@ object AddressManager {
} }
fun insert(searchPoi: SearchPoi) { fun insert(searchPoi: SearchPoi) {
EventBus.getDefault().post(searchPoi)
if (searchPoi.type == DataConstants.TYPE_COMPANY_ADDRESS) { if (searchPoi.type == DataConstants.TYPE_COMPANY_ADDRESS) {
companyAddress = searchPoi companyAddress = searchPoi
} else { } else {

View File

@@ -14,6 +14,8 @@ import com.mogo.map.constants.BroadcastMode
import com.mogo.map.uicontroller.EnumMapUI import com.mogo.map.uicontroller.EnumMapUI
import com.mogo.module.common.MogoModulePaths import com.mogo.module.common.MogoModulePaths
import com.mogo.module.navi.R import com.mogo.module.navi.R
import com.mogo.module.navi.bean.SearchPoi
import com.mogo.module.navi.constants.DataConstants
import com.mogo.module.navi.constants.SearchServiceHolder import com.mogo.module.navi.constants.SearchServiceHolder
import com.mogo.module.navi.manager.AddressManager import com.mogo.module.navi.manager.AddressManager
import com.mogo.module.navi.manager.SettingManager import com.mogo.module.navi.manager.SettingManager
@@ -41,6 +43,9 @@ import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_clear_compan
import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_clear_home_address import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_clear_home_address
import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_company_address import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_company_address
import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_home_address import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_home_address
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.HashMap import java.util.HashMap
/** /**
@@ -103,6 +108,9 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
} }
initViews() initViews()
initEvent() initEvent()
EventBus.getDefault()
.register(this)
} }
private fun initViews() { private fun initViews() {
@@ -202,13 +210,12 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
tv_navi_clear_home_address.setOnClickListener { tv_navi_clear_home_address.setOnClickListener {
AddressManager.deleteHome() AddressManager.deleteHome()
updateHome() clearHome()
} }
tv_navi_clear_company_address.setOnClickListener { tv_navi_clear_company_address.setOnClickListener {
AddressManager.deleteCompany() AddressManager.deleteCompany()
updateCompany() clearCompany()
} }
tv_navi_company_address.setOnClickListener { tv_navi_company_address.setOnClickListener {
@@ -234,6 +241,18 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
} }
} }
private fun clearHome(){
tv_navi_clear_home_address.visibility = View.GONE
tv_navi_home_address.text=getString(R.string.navi_set_home)
}
private fun clearCompany(){
tv_navi_clear_company_address.visibility = View.GONE
tv_navi_company_address.text=getString(R.string.navi_set_company)
}
private fun updateCompany() { private fun updateCompany() {
if (AddressManager.hasCompany()) { if (AddressManager.hasCompany()) {
tv_navi_company_address.text = AddressManager.companyAddress?.address tv_navi_company_address.text = AddressManager.companyAddress?.address
@@ -242,4 +261,28 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
tv_navi_clear_company_address.visibility = View.GONE tv_navi_clear_company_address.visibility = View.GONE
} }
} }
/**
* 分享弹框
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventBus(searchPoi: SearchPoi?) {
if (searchPoi == null) {
return
}
if (searchPoi?.type == DataConstants.TYPE_COMPANY_ADDRESS) {
tv_navi_company_address.text=searchPoi.address
tv_navi_clear_company_address.visibility=View.VISIBLE
} else {
tv_navi_home_address.text=searchPoi.address
tv_navi_clear_home_address.visibility=View.VISIBLE
}
}
override fun onDestroyView() {
super.onDestroyView()
EventBus.getDefault().unregister(this)
}
} }

View File

@@ -67,7 +67,6 @@ dependencies {
implementation 'com.shuyu:gsyVideoPlayer-armv7a:7.1.1' implementation 'com.shuyu:gsyVideoPlayer-armv7a:7.1.1'
implementation 'com.shuyu:gsyVideoPlayer-arm64:7.1.1' implementation 'com.shuyu:gsyVideoPlayer-arm64:7.1.1'
implementation 'com.shuyu:gsyVideoPlayer-java:7.1.1' implementation 'com.shuyu:gsyVideoPlayer-java:7.1.1'
implementation 'org.greenrobot:eventbus:3.1.1'
} }
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()