From 89645ecde628c8ce85dcdee899df7667bfd82219 Mon Sep 17 00:00:00 2001 From: zhangyuanzhen Date: Wed, 15 Jan 2020 17:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE=E5=AE=B6?= =?UTF-8?q?=E5=92=8C=E5=85=AC=E5=8F=B8=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.name | 1 - .idea/codeStyles/Project.xml | 116 ----------- .idea/gradle.xml | 40 ---- .idea/runConfigurations.xml | 12 -- .idea/vcs.xml | 6 - gradle.properties | 2 +- .../com/mogo/module/map/VoiceConstants.java | 8 +- .../module/navi/manager/AddressManager.kt | 61 ++++-- .../navi/ui/setting/NaviSettingFragment.kt | 57 ++++++ .../res/drawable/shape_round_gray_margin.xml | 7 + .../main/res/layout/fragment_navi_setting.xml | 180 ++++++++++++++---- .../res/layout/fragment_search_category.xml | 2 +- .../main/res/layout/include_search_bar.xml | 3 +- .../res/mipmap-xhdpi/icon_navi_go_company.png | Bin 0 -> 980 bytes .../res/mipmap-xhdpi/icon_navi_go_home.png | Bin 0 -> 1055 bytes .../src/main/res/values/strings.xml | 4 + 16 files changed, 274 insertions(+), 225 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml create mode 100644 modules/mogo-module-search/src/main/res/drawable/shape_round_gray_margin.xml create mode 100755 modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_navi_go_company.png create mode 100755 modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_navi_go_home.png 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" > VD9sDaSW+o zd^_uIw{M_C`*}kZPG37E71c};Cr`a2vWseBe3tA`3NL=GU+~gxmUP~77sH<(zJ>wsfw;vxdN1y5+Eyykk=D(6Ww(Xx>c4aTS#DWz z^T*Qp>~n51xY-=fjB(!W&3|OOgL{LZM{!N_uM0ueSFD}JY*l_G4xv*7QF zC@%{=*T6lzA4Hx{TfqH7wP@pZi&&S{F-6l(wJ#E8c+6_FkNNB3^(!X&J}Quwb(&ik z8uVffgYt|Yx-RJ#g`XrbU%V3}ulSI~fUnWg_Jxs@tMN?{=BN9)G%rafuuR_hIZ$89 ziET!1vC{oZaw~UaHWX?cvCO!KnuP(9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