模拟导航控制
This commit is contained in:
@@ -37,6 +37,10 @@ object SettingManager : IMogoSettingManager {
|
|||||||
* 高速优先
|
* 高速优先
|
||||||
*/
|
*/
|
||||||
private var highSpeed = false
|
private var highSpeed = false
|
||||||
|
/**
|
||||||
|
* 模拟导航
|
||||||
|
*/
|
||||||
|
private var isMonitor: Boolean = false
|
||||||
|
|
||||||
override fun getPathPrefer(): Int {
|
override fun getPathPrefer(): Int {
|
||||||
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
return settings!!.getInt(KEY_PAHT_PREFER, 0)
|
||||||
@@ -78,6 +82,14 @@ object SettingManager : IMogoSettingManager {
|
|||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setMonitor(type: Boolean) {
|
||||||
|
isMonitor = type
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isMonitor(): Boolean {
|
||||||
|
return isMonitor
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否躲避拥堵
|
* 是否躲避拥堵
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +103,7 @@ object SettingManager : IMogoSettingManager {
|
|||||||
*/
|
*/
|
||||||
fun avoidSpeed(avoidSpeed: Boolean) {
|
fun avoidSpeed(avoidSpeed: Boolean) {
|
||||||
this.avoidSpeed = avoidSpeed
|
this.avoidSpeed = avoidSpeed
|
||||||
if (avoidSpeed){
|
if (avoidSpeed) {
|
||||||
this.highSpeed = false
|
this.highSpeed = false
|
||||||
}
|
}
|
||||||
save()
|
save()
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.mogo.module.navi.BuildConfig
|
|||||||
import com.mogo.module.navi.R
|
import com.mogo.module.navi.R
|
||||||
import com.mogo.module.navi.constants.AMapConstants
|
import com.mogo.module.navi.constants.AMapConstants
|
||||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||||
|
import com.mogo.module.navi.manager.SettingManager
|
||||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||||
import com.mogo.module.navi.ui.base.BaseFragment
|
import com.mogo.module.navi.ui.base.BaseFragment
|
||||||
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
||||||
@@ -216,7 +217,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
|||||||
|
|
||||||
private fun startNavi() {
|
private fun startNavi() {
|
||||||
SearchServiceHolder.getNavi()
|
SearchServiceHolder.getNavi()
|
||||||
.startNavi(false)
|
.startNavi(!SettingManager.isMonitor())
|
||||||
SearchServiceHolder.getMapUIController()
|
SearchServiceHolder.getMapUIController()
|
||||||
.recoverLockMode()
|
.recoverLockMode()
|
||||||
isStartedNavi = true
|
isStartedNavi = true
|
||||||
|
|||||||
@@ -236,11 +236,18 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
|||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
cb_navi.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||||
|
SettingManager.setMonitor(isChecked)
|
||||||
|
}
|
||||||
|
cb_navi.isChecked=SettingManager.isMonitor()
|
||||||
} else {
|
} else {
|
||||||
tv_navi_fps.visibility = View.GONE
|
tv_navi_fps.visibility = View.GONE
|
||||||
ll_navi_fps.visibility = View.GONE
|
ll_navi_fps.visibility = View.GONE
|
||||||
|
cb_navi.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateHome() {
|
private fun updateHome() {
|
||||||
|
|||||||
@@ -480,6 +480,16 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_navi"
|
||||||
|
android:text="模拟导航"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/ll_navi_fps"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
Reference in New Issue
Block a user