opt
This commit is contained in:
@@ -10,6 +10,8 @@ import com.mogo.map.navi.IMogoNavi
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.gps.simulator.GpsSimulatorConstants
|
||||
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager
|
||||
import com.mogo.module.guideshow.provider.GuideShowProviderConstant
|
||||
import com.mogo.module.guideshow.provider.IGuideShowProvider
|
||||
import com.mogo.service.MogoServicePaths
|
||||
@@ -26,55 +28,53 @@ import com.mogo.service.statusmanager.IMogoStatusManager
|
||||
* 2020-01-08.
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object SearchServiceHolder{
|
||||
// 单例对象,要使用Application Context
|
||||
private lateinit var context: Context
|
||||
object SearchServiceHolder {
|
||||
// 单例对象,要使用Application Context
|
||||
private lateinit var context: Context
|
||||
|
||||
val fragmentManager: IMogoFragmentManager = ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation() as IMogoFragmentManager
|
||||
val mapService: IMogoMapService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation() as IMogoMapService
|
||||
val listenerCenter: IMogoRegisterCenter = ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation() as IMogoRegisterCenter
|
||||
val statusManager: IMogoStatusManager = ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation() as IMogoStatusManager
|
||||
val analyticsManager: IMogoAnalytics = ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation() as IMogoAnalytics
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation() as IGuideShowProvider
|
||||
val mogoLauncher: IMogoLauncher = ARouter.getInstance().build(MogoServicePaths.PATH_LAUNCHER_API).navigation() as IMogoLauncher
|
||||
val fragmentManager: IMogoFragmentManager = ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation() as IMogoFragmentManager
|
||||
val mapService: IMogoMapService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation() as IMogoMapService
|
||||
val listenerCenter: IMogoRegisterCenter = ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation() as IMogoRegisterCenter
|
||||
val statusManager: IMogoStatusManager = ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation() as IMogoStatusManager
|
||||
val analyticsManager: IMogoAnalytics = ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation() as IMogoAnalytics
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation() as IGuideShowProvider
|
||||
val mogoLauncher: IMogoLauncher = ARouter.getInstance().build(MogoServicePaths.PATH_LAUNCHER_API).navigation() as IMogoLauncher
|
||||
val gpsSimulator = ARouter.getInstance().build(GpsSimulatorConstants.API_PATH).navigation() as IMogoGpsSimulatorManager
|
||||
|
||||
var geoSearch: IMogoGeoSearch? = null
|
||||
fun init(context: Context) {
|
||||
this.context = context
|
||||
}
|
||||
var geoSearch: IMogoGeoSearch? = null
|
||||
fun init(context: Context) {
|
||||
this.context = context
|
||||
|
||||
fun push(
|
||||
fragment: Fragment,
|
||||
tag: String
|
||||
) {
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(fragment)
|
||||
val build = builder.tag(tag)
|
||||
.build()
|
||||
fragmentManager.push(build)
|
||||
}
|
||||
|
||||
fun getNavi(): IMogoNavi {
|
||||
return mapService.getNavi(context)
|
||||
}
|
||||
|
||||
fun getLocationClient(): IMogoLocationClient {
|
||||
return mapService.getLocationClient(context)
|
||||
}
|
||||
|
||||
fun getMapUIController(): IMogoMapUIController {
|
||||
return mapService.mapUIController
|
||||
}
|
||||
|
||||
fun getMarkerManger(): IMogoMarkerManager {
|
||||
return mapService.getMarkerManager(context)
|
||||
}
|
||||
|
||||
fun getGeoSearcher(): IMogoGeoSearch {
|
||||
if (geoSearch == null) {
|
||||
geoSearch = mapService.getGeoSearch(context)
|
||||
}
|
||||
return geoSearch!!
|
||||
}
|
||||
|
||||
fun push(fragment: Fragment, tag: String) {
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(fragment)
|
||||
val build = builder.tag(tag).build()
|
||||
fragmentManager.push(build)
|
||||
}
|
||||
|
||||
fun getNavi(): IMogoNavi {
|
||||
return mapService.getNavi(context)
|
||||
}
|
||||
|
||||
fun getLocationClient(): IMogoLocationClient {
|
||||
return mapService.getLocationClient(context)
|
||||
}
|
||||
|
||||
fun getMapUIController(): IMogoMapUIController {
|
||||
return mapService.mapUIController
|
||||
}
|
||||
|
||||
fun getMarkerManger(): IMogoMarkerManager {
|
||||
return mapService.getMarkerManager(context)
|
||||
}
|
||||
|
||||
fun getGeoSearcher(): IMogoGeoSearch {
|
||||
if (geoSearch == null) {
|
||||
geoSearch = mapService.getGeoSearch(context)
|
||||
}
|
||||
return geoSearch!!
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,11 @@ object SettingManager : IMogoSettingManager {
|
||||
*/
|
||||
private var isMonitor: Boolean = false
|
||||
|
||||
/**
|
||||
* GPS 模拟
|
||||
*/
|
||||
private var isGpsSimulator: Boolean = false
|
||||
|
||||
override fun getPathPrefer(): Int {
|
||||
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
||||
}
|
||||
@@ -90,6 +95,14 @@ object SettingManager : IMogoSettingManager {
|
||||
return isMonitor
|
||||
}
|
||||
|
||||
fun setGpsSimulator(type:Boolean){
|
||||
isGpsSimulator = type
|
||||
}
|
||||
|
||||
fun isGpsSimulator(): Boolean {
|
||||
return isGpsSimulator
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否躲避拥堵
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener
|
||||
import android.widget.CompoundButton.VISIBLE
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
@@ -32,279 +33,259 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
*/
|
||||
class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
private var type: Int = 0
|
||||
private var type: Int = 0
|
||||
|
||||
override fun onCheckedChanged(
|
||||
buttonView: CompoundButton?,
|
||||
isChecked: Boolean
|
||||
) {
|
||||
if (buttonView?.id == R.id.rb_navi_fee) {
|
||||
SettingManager.cost(isChecked)
|
||||
if (isChecked) {
|
||||
type = 2
|
||||
rb_navi_high_way.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_high_way) {
|
||||
SettingManager.highSpeed(isChecked)
|
||||
type = 4
|
||||
override fun onCheckedChanged(
|
||||
buttonView: CompoundButton?,
|
||||
isChecked: Boolean) {
|
||||
if (buttonView?.id == R.id.rb_navi_fee) {
|
||||
SettingManager.cost(isChecked)
|
||||
if (isChecked) {
|
||||
type = 2
|
||||
rb_navi_high_way.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_high_way) {
|
||||
SettingManager.highSpeed(isChecked)
|
||||
type = 4
|
||||
|
||||
if (isChecked) {
|
||||
rb_navi_no_high_way.isChecked = false
|
||||
rb_navi_fee.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_no_high_way) {
|
||||
SettingManager.avoidSpeed(isChecked)
|
||||
type = 3
|
||||
if (isChecked) {
|
||||
rb_navi_no_high_way.isChecked = false
|
||||
rb_navi_fee.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_no_high_way) {
|
||||
SettingManager.avoidSpeed(isChecked)
|
||||
type = 3
|
||||
|
||||
if (isChecked) {
|
||||
rb_navi_high_way.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_jam) {
|
||||
SettingManager.congestion(isChecked)
|
||||
type = 1
|
||||
if (isChecked) {
|
||||
rb_navi_high_way.isChecked = false
|
||||
}
|
||||
} else if (buttonView?.id == R.id.rb_navi_jam) {
|
||||
SettingManager.congestion(isChecked)
|
||||
type = 1
|
||||
|
||||
}
|
||||
if (isChecked) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_preference", mapOf("type" to type))
|
||||
}
|
||||
|
||||
}
|
||||
if (isChecked) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_preference", mapOf("type" to type))
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_navi_setting
|
||||
}
|
||||
|
||||
}
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_navi_setting
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
iv_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
initViews()
|
||||
initEvent()
|
||||
EventBus.getDefault()
|
||||
.register(this)
|
||||
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
|
||||
rb_navi_high_way.isChecked = SettingManager.isHighSpeed()
|
||||
rb_navi_jam.isChecked = SettingManager.isCongestion()
|
||||
rb_navi_no_high_way.isChecked = SettingManager.isAvoidSpeed()
|
||||
rb_navi_fee.isChecked = SettingManager.isCost()
|
||||
|
||||
sb_navi_volume_progress.progress = SettingManager.volume
|
||||
|
||||
rb_navi_day.isChecked = SettingManager.mapType == R.id.rb_navi_day
|
||||
rb_navi_night.isChecked = SettingManager.mapType == R.id.rb_navi_night
|
||||
rb_navi_auto.isChecked = SettingManager.mapType == R.id.rb_navi_auto
|
||||
rb_navi_detail.isChecked = SettingManager.voiceStyle == R.id.rb_navi_detail
|
||||
rb_navi_draft.isChecked = SettingManager.voiceStyle == R.id.rb_navi_draft
|
||||
|
||||
|
||||
updateHome()
|
||||
updateCompany()
|
||||
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
iv_sound_plus.setOnClickListener {
|
||||
VolumeManager.getInstance(context)
|
||||
.incVolume()
|
||||
sb_navi_volume_progress.progress = sb_navi_volume_progress.progress.plus(10)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
}
|
||||
iv_sound_minus.setOnClickListener {
|
||||
VolumeManager.getInstance(context)
|
||||
.decVolume()
|
||||
sb_navi_volume_progress.progress = sb_navi_volume_progress.progress.minus(10)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
iv_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
initViews()
|
||||
initEvent()
|
||||
EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
rb_navi_jam.setOnCheckedChangeListener(this)
|
||||
rb_navi_high_way.setOnCheckedChangeListener(this)
|
||||
rb_navi_no_high_way.setOnCheckedChangeListener(this)
|
||||
rb_navi_fee.setOnCheckedChangeListener(this)
|
||||
private fun initViews() {
|
||||
|
||||
sb_navi_volume_progress.max = VolumeManager.getInstance(context)
|
||||
.getMaxVol()
|
||||
sb_navi_volume_progress.progress = VolumeManager.getInstance(context)
|
||||
.sysVolume
|
||||
rb_navi_high_way.isChecked = SettingManager.isHighSpeed()
|
||||
rb_navi_jam.isChecked = SettingManager.isCongestion()
|
||||
rb_navi_no_high_way.isChecked = SettingManager.isAvoidSpeed()
|
||||
rb_navi_fee.isChecked = SettingManager.isCost()
|
||||
|
||||
sb_navi_volume_progress.progress = SettingManager.volume
|
||||
|
||||
rb_navi_day.isChecked = SettingManager.mapType == R.id.rb_navi_day
|
||||
rb_navi_night.isChecked = SettingManager.mapType == R.id.rb_navi_night
|
||||
rb_navi_auto.isChecked = SettingManager.mapType == R.id.rb_navi_auto
|
||||
rb_navi_detail.isChecked = SettingManager.voiceStyle == R.id.rb_navi_detail
|
||||
rb_navi_draft.isChecked = SettingManager.voiceStyle == R.id.rb_navi_draft
|
||||
|
||||
|
||||
sb_navi_volume_progress.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar?,
|
||||
progress: Int,
|
||||
fromUser: Boolean
|
||||
) {
|
||||
if (fromUser) {
|
||||
VolumeManager.getInstance(context)
|
||||
.setSysVolume(progress)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
updateHome()
|
||||
updateCompany()
|
||||
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
iv_sound_plus.setOnClickListener {
|
||||
VolumeManager.getInstance(context).incVolume()
|
||||
sb_navi_volume_progress.progress = sb_navi_volume_progress.progress.plus(10)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
}
|
||||
iv_sound_minus.setOnClickListener {
|
||||
VolumeManager.getInstance(context).decVolume()
|
||||
sb_navi_volume_progress.progress = sb_navi_volume_progress.progress.minus(10)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
}
|
||||
|
||||
rb_navi_jam.setOnCheckedChangeListener(this)
|
||||
rb_navi_high_way.setOnCheckedChangeListener(this)
|
||||
rb_navi_no_high_way.setOnCheckedChangeListener(this)
|
||||
rb_navi_fee.setOnCheckedChangeListener(this)
|
||||
|
||||
sb_navi_volume_progress.max = VolumeManager.getInstance(context).getMaxVol()
|
||||
sb_navi_volume_progress.progress = VolumeManager.getInstance(context).sysVolume
|
||||
|
||||
|
||||
sb_navi_volume_progress.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
VolumeManager.getInstance(context)
|
||||
.setSysVolume(progress)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
|
||||
}
|
||||
|
||||
// audioManager.setStreamVolume( AudioManager.STREAM_MUSIC, progress, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE )
|
||||
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
rg_navi_day_night.setOnCheckedChangeListener { group, checkedId ->
|
||||
SettingManager.mapType = checkedId
|
||||
when (checkedId) {
|
||||
R.id.rb_navi_day -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_Light)
|
||||
}
|
||||
R.id.rb_navi_night -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_Night)
|
||||
}
|
||||
R.id.rb_navi_auto -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night)
|
||||
}
|
||||
}
|
||||
}
|
||||
rg_navi_sound_type.setOnCheckedChangeListener { group, checkedId ->
|
||||
SettingManager.voiceStyle = checkedId
|
||||
SearchServiceHolder.getNavi().setBroadcastMode(
|
||||
if (checkedId == R.id.rb_navi_detail) BroadcastMode.DETAIL else BroadcastMode.CONCISE
|
||||
)
|
||||
|
||||
if (checkedId == R.id.rb_navi_detail) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 1))
|
||||
} else {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 2))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tv_navi_clear_home_address.setOnClickListener {
|
||||
AddressManager.deleteHome(context!!)
|
||||
clearHome()
|
||||
}
|
||||
|
||||
tv_navi_clear_company_address.setOnClickListener {
|
||||
AddressManager.deleteCompany(context!!)
|
||||
clearCompany()
|
||||
}
|
||||
|
||||
tv_navi_company_address.setOnClickListener {
|
||||
if (!AddressManager.hasCompany()) {
|
||||
AddressManager.goCompany()
|
||||
}
|
||||
}
|
||||
|
||||
tv_navi_home_address.setOnClickListener {
|
||||
if (!AddressManager.hasHome()) {
|
||||
AddressManager.goHome()
|
||||
}
|
||||
}
|
||||
|
||||
if (DebugConfig.isDebug()) {
|
||||
tb_navi.setOnCheckedChangeListener { _, isChecked ->
|
||||
SettingManager.setMonitor(isChecked)
|
||||
}
|
||||
tb_navi.isChecked = SettingManager.isMonitor()
|
||||
tb_gps.isChecked = SettingManager.isGpsSimulator()
|
||||
|
||||
tb_gps.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
||||
if (SettingManager.isGpsSimulator() == isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
|
||||
SettingManager.setGpsSimulator(isChecked)
|
||||
SearchServiceHolder.getNavi().setUseExtraGPSData(isChecked)
|
||||
|
||||
if (isChecked) {
|
||||
SearchServiceHolder.gpsSimulator.open()
|
||||
} else {
|
||||
SearchServiceHolder.gpsSimulator.close()
|
||||
}
|
||||
}
|
||||
|
||||
ll_navi_simulator.visibility = View.VISIBLE
|
||||
tv_navi_simulator.visibility = View.VISIBLE
|
||||
} else {
|
||||
ll_navi_simulator.visibility = View.GONE
|
||||
tv_navi_simulator.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun updateHome() {
|
||||
|
||||
if (AddressManager.hasHome()) {
|
||||
tv_navi_home_address.text = AddressManager.homeAddress?.address
|
||||
tv_navi_clear_home_address.visibility = View.VISIBLE
|
||||
} else {
|
||||
tv_navi_clear_home_address.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
if (AddressManager.hasCompany()) {
|
||||
tv_navi_company_address.text = AddressManager.companyAddress?.address
|
||||
tv_navi_clear_company_address.visibility = View.VISIBLE
|
||||
} else {
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
// audioManager.setStreamVolume(
|
||||
// AudioManager.STREAM_MUSIC, progress, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE
|
||||
// )
|
||||
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
rg_navi_day_night.setOnCheckedChangeListener { group, checkedId ->
|
||||
SettingManager.mapType = checkedId
|
||||
|
||||
when (checkedId) {
|
||||
R.id.rb_navi_day -> {
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.changeMapMode(EnumMapUI.Type_Light)
|
||||
}
|
||||
R.id.rb_navi_night -> {
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.changeMapMode(EnumMapUI.Type_Night)
|
||||
}
|
||||
R.id.rb_navi_auto -> {
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night)
|
||||
}
|
||||
}
|
||||
}
|
||||
rg_navi_sound_type.setOnCheckedChangeListener { group, checkedId ->
|
||||
SettingManager.voiceStyle = checkedId
|
||||
SearchServiceHolder.getNavi()
|
||||
.setBroadcastMode(
|
||||
if (checkedId == R.id.rb_navi_detail) BroadcastMode.DETAIL else BroadcastMode.CONCISE
|
||||
)
|
||||
|
||||
if (checkedId == R.id.rb_navi_detail) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 1))
|
||||
} else {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 2))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tv_navi_clear_home_address.setOnClickListener {
|
||||
AddressManager.deleteHome(context!!)
|
||||
clearHome()
|
||||
}
|
||||
|
||||
tv_navi_clear_company_address.setOnClickListener {
|
||||
AddressManager.deleteCompany(context!!)
|
||||
clearCompany()
|
||||
}
|
||||
|
||||
tv_navi_company_address.setOnClickListener {
|
||||
if (!AddressManager.hasCompany()) {
|
||||
AddressManager.goCompany()
|
||||
}
|
||||
}
|
||||
|
||||
tv_navi_home_address.setOnClickListener {
|
||||
if (!AddressManager.hasHome()) {
|
||||
AddressManager.goHome()
|
||||
}
|
||||
}
|
||||
|
||||
if (DebugConfig.isDebug()) {
|
||||
sb_navi_fps_progress.setOnSeekBarChangeListener(object : OnSeekBarChangeListener{
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if (progress == 0) {
|
||||
tv_fps_value.text = "-1"
|
||||
SearchServiceHolder.getMapUIController().setRenderFps(-1)
|
||||
} else {
|
||||
tv_fps_value.text = "${progress}"
|
||||
SearchServiceHolder.getMapUIController().setRenderFps(progress)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
}
|
||||
})
|
||||
|
||||
cb_navi.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
SettingManager.setMonitor(isChecked)
|
||||
}
|
||||
cb_navi.isChecked=SettingManager.isMonitor()
|
||||
} else {
|
||||
tv_navi_fps.visibility = View.GONE
|
||||
ll_navi_fps.visibility = View.GONE
|
||||
cb_navi.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun updateHome() {
|
||||
|
||||
if (AddressManager.hasHome()) {
|
||||
tv_navi_home_address.text = AddressManager.homeAddress?.address
|
||||
tv_navi_clear_home_address.visibility = View.VISIBLE
|
||||
} else {
|
||||
tv_navi_clear_home_address.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
if (AddressManager.hasCompany()) {
|
||||
tv_navi_company_address.text = AddressManager.companyAddress?.address
|
||||
tv_navi_clear_company_address.visibility = View.VISIBLE
|
||||
} else {
|
||||
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)
|
||||
}
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user