diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 2e92d39135..0000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -MogoLauncher \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 681f41ae2a..0000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
-
-
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 26618df6e9..0000000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460d8b..0000000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfbb..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ae283a0d23..0fc019f84b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 # 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 -RELEASE=true +RELEASE=false # 模块版本 DEMO_MODULE_MAP_VERSION=1.0.0-SNAPSHOT DEMO_MODULE_MAP2_VERSION=1.0.0-SNAPSHOT diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/VoiceConstants.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/VoiceConstants.java index 77676a94c8..df5fb4dde7 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/VoiceConstants.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/VoiceConstants.java @@ -119,7 +119,12 @@ public class VoiceConstants { public static final String CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP = "CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP"; public static final String[] CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS = {"停止导航/结束导航/取消导航/放弃导航/退出导航/关闭导航"}; - + /** + * 附近类命令 + */ + public static final String CMD_MAP_GEO_NEARBY = "com.ileja.navi.geo.nearby"; + public static final String CMD_MAP_GEO_NEARBY_WAKEUP = "CMD_MAP_GEO_NEARBY_WAKEUP"; + public static final String[] CMD_MAP_GEO_NEARBY_TRIGGER_WORDS = {"查找附近的","查找附近的"}; /** * 车头朝上 @@ -155,5 +160,6 @@ public class VoiceConstants { sVoiceCmds.put( VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_GO_COMPANY ); sVoiceCmds.put( VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP, VoiceConstants.CMD_MAP_HISTORY_TRIGGER_WORDS ); sVoiceCmds.put( VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS ); + sVoiceCmds.put( VoiceConstants.CMD_MAP_GEO_NEARBY_WAKEUP, VoiceConstants.CMD_MAP_GEO_NEARBY_TRIGGER_WORDS ); } } diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/manager/AddressManager.kt b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/manager/AddressManager.kt index 47b2949c17..a2e9b53e62 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/manager/AddressManager.kt +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/manager/AddressManager.kt @@ -7,10 +7,14 @@ import com.mogo.module.navi.bean.EntityConvertUtils 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.dao.SearchPoiDao import com.mogo.module.navi.database.AppDataBase import com.mogo.module.navi.ui.search.ChoosePathFragment import com.mogo.module.navi.ui.setting.SettingAddressFragment import com.mogo.service.fragmentmanager.FragmentDescriptor +import io.reactivex.Observable +import io.reactivex.ObservableEmitter +import io.reactivex.ObservableOnSubscribe import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers @@ -19,17 +23,20 @@ import io.reactivex.schedulers.Schedulers * 2020-01-12. */ object AddressManager { - private var homeAddress: SearchPoi? = null - private var companyAddress: SearchPoi? = null + var homeAddress: SearchPoi? = null + var companyAddress: SearchPoi? = null + private lateinit var poiDao:SearchPoiDao fun goHome() { if (homeAddress == null) { pushSettingAddress( DataConstants.TYPE_HOME_ADDRESS ) } else { - var newInstance = ChoosePathFragment.newInstance(EntityConvertUtils.poi2MogoTip( - homeAddress - ).point) + var newInstance = ChoosePathFragment.newInstance( + EntityConvertUtils.poi2MogoTip( + homeAddress + ).point + ) SearchServiceHolder.push( newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT ) @@ -43,15 +50,25 @@ object AddressManager { ) } else { var newInstance = - ChoosePathFragment.newInstance(EntityConvertUtils.poi2MogoTip( - companyAddress - ).point) + ChoosePathFragment.newInstance( + EntityConvertUtils.poi2MogoTip( + companyAddress + ).point + ) SearchServiceHolder.push( newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT ) } } + fun hasHome(): Boolean { + return homeAddress == null + } + + fun hasCompany(): Boolean { + return companyAddress == null + } + private fun pushSettingAddress(type: Int) { val builder = FragmentDescriptor.Builder() @@ -62,8 +79,10 @@ object AddressManager { } @SuppressLint("CheckResult") fun init(context: Context) { - AppDataBase.getDatabase(context) + + poiDao = AppDataBase.getDatabase(context) .poiDao() + poiDao .companyAddress .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -72,8 +91,8 @@ object AddressManager { companyAddress = t1[0] } } - AppDataBase.getDatabase(context) - .poiDao() + + poiDao .homeAddress .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -91,4 +110,24 @@ object AddressManager { homeAddress = searchPoi } } + + fun deleteHome(){ + homeAddress=null + Observable.create( + ObservableOnSubscribe { + poiDao.delete(homeAddress) + }) + .subscribeOn(Schedulers.io()) + .subscribe() + } + + fun deleteCompany(){ + companyAddress=null + Observable.create( + ObservableOnSubscribe { + poiDao.delete(companyAddress) + }) + .subscribeOn(Schedulers.io()) + .subscribe() + } } diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/NaviSettingFragment.kt b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/NaviSettingFragment.kt index f742cec150..32293f1f44 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/NaviSettingFragment.kt +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/NaviSettingFragment.kt @@ -16,6 +16,7 @@ import com.mogo.map.uicontroller.EnumMapUI import com.mogo.module.common.MogoModulePaths import com.mogo.module.navi.R import com.mogo.module.navi.constants.SearchServiceHolder +import com.mogo.module.navi.manager.AddressManager import com.mogo.module.navi.manager.SettingManager import com.mogo.module.navi.ui.base.BaseFragment import com.mogo.service.MogoServicePaths @@ -37,6 +38,10 @@ import kotlinx.android.synthetic.main.fragment_navi_setting.rb_navi_no_high_way import kotlinx.android.synthetic.main.fragment_navi_setting.rg_navi_day_night import kotlinx.android.synthetic.main.fragment_navi_setting.rg_navi_sound_type import kotlinx.android.synthetic.main.fragment_navi_setting.sb_navi_volume_progress +import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_clear_company_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_home_address import java.util.HashMap /** @@ -97,7 +102,11 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener { iv_back.setOnClickListener { SearchServiceHolder.fragmentManager.pop() } + initViews() + initEvent() + } + private fun initViews() { rb_navi_high_way.isChecked = SettingManager.isHighSpeed() rb_navi_jam.isChecked = SettingManager.isCongestion() @@ -113,6 +122,12 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener { rb_navi_draft.isChecked = SettingManager.voiceStyle == R.id.rb_navi_draft + updateHome() + updateCompany() + + } + + private fun initEvent() { iv_sound_plus.setOnClickListener { sb_navi_volume_progress.progress = ++sb_navi_volume_progress.progress SettingManager.volume = sb_navi_volume_progress.progress @@ -185,5 +200,47 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener { } } + + tv_navi_clear_home_address.setOnClickListener { + AddressManager.deleteHome() + updateHome() + + } + + tv_navi_clear_company_address.setOnClickListener { + AddressManager.deleteCompany() + updateCompany() + } + + tv_navi_company_address.setOnClickListener { + if (!AddressManager.hasCompany()) { + AddressManager.goHome() + } + } + + tv_navi_home_address.setOnClickListener { + if (!AddressManager.hasHome()) { + AddressManager.goCompany() + } + } + } + + private fun updateHome() { + + if (AddressManager.hasHome()) { + tv_navi_home_address.text = AddressManager.homeAddress?.name + tv_navi_clear_home_address.visibility = View.VISIBLE + } else { + tv_navi_clear_home_address.visibility = View.GONE + } + } + + private fun updateCompany() { + if (AddressManager.hasCompany()) { + tv_navi_company_address.text = AddressManager.companyAddress?.name + tv_navi_clear_company_address.visibility = View.VISIBLE + } else { + tv_navi_clear_company_address.visibility = View.GONE + } } } diff --git a/modules/mogo-module-search/src/main/res/drawable/shape_round_gray_margin.xml b/modules/mogo-module-search/src/main/res/drawable/shape_round_gray_margin.xml new file mode 100644 index 0000000000..0a9de5c53e --- /dev/null +++ b/modules/mogo-module-search/src/main/res/drawable/shape_round_gray_margin.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml b/modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml index 6779ad4b43..4b19887ee5 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml @@ -6,10 +6,52 @@ android:clickable="true" android:background="#2D2E3D" android:orientation="vertical" - android:paddingLeft="@dimen/fragment_left_margin" + android:paddingRight="@dimen/dp_160" + android:paddingLeft="@dimen/dp_160" > + + + + + + + + + + + + - - - - - - - - - @@ -296,8 +306,108 @@ style="@style/rb_setting" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml b/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml index 2530d46b8d..6351a0de9e 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml @@ -18,7 +18,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toBottomOf="@+id/ll_navi_search" app:cardBackgroundColor="#3F4057" - app:cardCornerRadius="@dimen/dp_16" + app:cardCornerRadius="@dimen/dp_8" > 开始导航 路线选择 拖动地图选点 + 常用地址设置 + 去设置家 + 清除 + 去设置公司