From 8bb0865b629e009b6396eca7d5dadb015db631c0 Mon Sep 17 00:00:00 2001 From: zhangyuanzhen Date: Thu, 9 Jan 2020 15:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=B1=BB=E5=88=AB=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= 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 | 39 ------ .idea/misc.xml | 14 --- .idea/runConfigurations.xml | 12 -- .idea/vcs.xml | 6 - config.gradle | 1 + .../mogo/module/common/MogoModulePaths.java | 6 + modules/mogo-module-search/build.gradle | 1 + .../module/navi/constants/AMapConstants.java | 7 ++ .../ui/adapter/SearchCategoryAdapter.java | 64 ++++++++++ .../ui/adapter/base/RecycleBaseAdapter.java | 6 + .../navi/ui/search/CategorySearchFragment.kt | 91 ++++++++++++++ .../module/navi/ui/search/SearchFragment.java | 90 ++++++++------ .../navi/ui/search/SearchPresenter.java | 2 +- .../navi/ui/setting/SettingAddressFragment.kt | 105 +++++++++++++++- .../selector_item_category_background.xml | 12 ++ .../selector_item_category_result.xml | 6 + .../res/drawable/shape_round_blue_grident.xml | 11 ++ .../main/res/drawable/shape_round_gray.xml | 2 +- .../src/main/res/layout/fragment_search.xml | 3 +- .../res/layout/fragment_search_category.xml | 43 +++++++ .../res/layout/fragment_setting_address.xml | 86 ++++++++++++- .../main/res/layout/item_search_category.xml | 66 ++++++++++ .../icon_search_category_checked.png | Bin 0 -> 3751 bytes .../icon_search_category_unchecked.png | Bin 0 -> 2264 bytes .../src/main/res/values/colors.xml | 1 + .../src/main/res/values/strings.xml | 5 + .../src/main/res/values/styles.xml | 7 ++ 29 files changed, 568 insertions(+), 235 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml create mode 100644 modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/SearchCategoryAdapter.java create mode 100644 modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt create mode 100644 modules/mogo-module-search/src/main/res/drawable/selector_item_category_background.xml create mode 100644 modules/mogo-module-search/src/main/res/drawable/selector_item_category_result.xml create mode 100644 modules/mogo-module-search/src/main/res/drawable/shape_round_blue_grident.xml create mode 100644 modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml create mode 100644 modules/mogo-module-search/src/main/res/layout/item_search_category.xml create mode 100755 modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_checked.png create mode 100755 modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_unchecked.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 1a786d501e..0000000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 8a8f75bfe2..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,14 +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 94a25f7f4c..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/config.gradle b/config.gradle index 909fd6986b..d9fd8f8953 100644 --- a/config.gradle +++ b/config.gradle @@ -16,6 +16,7 @@ ext { androidxmultidex : "androidx.multidex:multidex:2.0.1", androidxviewpager2 : "androidx.viewpager2:viewpager2:1.0.0", androidxrecyclerview : "androidx.recyclerview:recyclerview:1.1.0", + androidxcardview : "androidx.cardview:cardview:1.0.0", // 测试 junit : "junit:junit:4.12", androidxjunit : "androidx.test.ext:junit:1.1.0", diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoModulePaths.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoModulePaths.java index 65e430a6b3..adfffc5401 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoModulePaths.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoModulePaths.java @@ -58,6 +58,12 @@ public class MogoModulePaths { public static final String PATH_FRAGMENT_SEARCH = "/navi/search"; + /** + * 按类别搜索 fragment + */ + @Keep + public static final String PATH_FRAGMENT_SEARCH_CATEGORY = "/navi/search/category"; + /** * 设置 fragment diff --git a/modules/mogo-module-search/build.gradle b/modules/mogo-module-search/build.gradle index a3ebb14896..42f83bdf90 100644 --- a/modules/mogo-module-search/build.gradle +++ b/modules/mogo-module-search/build.gradle @@ -50,6 +50,7 @@ dependencies { kapt rootProject.ext.dependencies.roomAnnotationProcessor implementation rootProject.ext.dependencies.roomRxjava implementation rootProject.ext.dependencies.androidxrecyclerview + implementation rootProject.ext.dependencies.androidxcardview kapt rootProject.ext.dependencies.aroutercompiler // implementation rootProject.ext.dependencies.jetbrainsannotationsjava5 implementation rootProject.ext.dependencies.rxandroid diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/AMapConstants.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/AMapConstants.java index 6500e2c255..5429dfb3b5 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/AMapConstants.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/AMapConstants.java @@ -14,6 +14,13 @@ public class AMapConstants { */ public static final float AMAP_ZOOM_COMMON_LEVEL = 15.0f; + + /** + * 设置家和公司的Key + */ + public static final String KEY_SET_HOME_COMPONY = "key_home"; + + /** * 点击当前位置按钮的地图缩放级别 */ diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/SearchCategoryAdapter.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/SearchCategoryAdapter.java new file mode 100644 index 0000000000..711a84c13d --- /dev/null +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/SearchCategoryAdapter.java @@ -0,0 +1,64 @@ +package com.mogo.module.navi.ui.adapter; + +import android.content.Context; +import android.view.View; +import com.mogo.map.search.inputtips.MogoTip; +import com.mogo.module.navi.R; +import com.mogo.module.navi.ui.adapter.base.RecycleBaseAdapter; +import com.mogo.module.navi.ui.adapter.base.RecycleViewHolder; +import java.util.List; + +/** + * @author zyz + * 2019-08-13. + */ +public class SearchCategoryAdapter extends RecycleBaseAdapter { + + private int current = 0; + private int lastPosition = 0; + + /** + * + */ + public SearchCategoryAdapter(Context context, List list) { + super(context, list, R.layout.item_search_category); + } + + private boolean mShowDelete = false; + + private View.OnClickListener onClickListener; + + @Override + public void onBindViewHolder(RecycleViewHolder holder, MogoTip tip) { + + holder.setText(R.id.tv_position, tip.getName()); + holder.setText(R.id.tv_position_des, tip.getAddress()); + + holder.setText(R.id.iv_position,String.valueOf(holder.getLayoutPosition()+1)); + holder.itemView.setTag(R.id.tag_position, holder.getLayoutPosition()); + holder.itemView.setOnClickListener(onClickListener); + holder.itemView.setSelected(current == holder.getLayoutPosition()); + } + + public void setOnClickListener(View.OnClickListener onClickListener) { + this.onClickListener = onClickListener; + } + + public void setShowDelete(boolean showDelete) { + this.mShowDelete = showDelete; + } + + public void refresh(List datums, boolean showDelete) { + //this.da = datums; + setShowDelete(showDelete); + setDatas(datums); + //notifyDataSetChanged(); + } + + public void setCurrent(int current) { + this.current = current; + notifyItemChanged(lastPosition); + notifyItemChanged(current); + lastPosition = current; + } +} diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/base/RecycleBaseAdapter.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/base/RecycleBaseAdapter.java index 5817c1457d..7b495a2e06 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/base/RecycleBaseAdapter.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/adapter/base/RecycleBaseAdapter.java @@ -92,6 +92,12 @@ public abstract class RecycleBaseAdapter extends } notifyDataSetChanged(); } + public void clear(){ + if (list != null) { + list.clear(); + notifyDataSetChanged(); + } + } public void messageShow(String mes) { if (toast==null){ diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt new file mode 100644 index 0000000000..ca8db07eb7 --- /dev/null +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt @@ -0,0 +1,91 @@ +package com.mogo.module.navi.ui.search + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.map.search.inputtips.MogoTip +import com.mogo.module.navi.R +import com.mogo.module.navi.bean.SearchPoi +import com.mogo.module.navi.constants.SearchServiceHolder +import com.mogo.module.navi.ui.adapter.SearchCategoryAdapter +import kotlinx.android.synthetic.main.fragment_search_category.cv_search_result +import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi +import kotlinx.android.synthetic.main.fragment_setting_address.rv_search_result +import kotlinx.android.synthetic.main.include_search_bar.et_navi_search +import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back + +/** + * @author zyz + * 2020-01-09. + */ +class CategorySearchFragment : BaseSearchFragment() { + + private lateinit var mAdapter: SearchCategoryAdapter + + private var category:String?=null + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + category=arguments?.getString("category") + } + override fun getLayoutId(): Int { + return R.layout.fragment_search_category + } + + override fun onViewCreated( + view: View, + savedInstanceState: Bundle? + ) { + super.onViewCreated(view, savedInstanceState) + mAdapter = SearchCategoryAdapter(activity, ArrayList()) + + rv_search_result.layoutManager = + LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false) + + rv_search_result.adapter = mAdapter + + et_navi_search.setText(category) + + + iv_navi_back.setOnClickListener { + SearchServiceHolder.fragmentManager.pop() + } + + tv_navi_navi.setOnClickListener { + + } + mAdapter.setOnClickListener { + var position = it.getTag(R.id.tag_position) as Int + mAdapter.setCurrent(position) + } + } + + override fun onActivityCreated(savedInstanceState: Bundle?) { + super.onActivityCreated(savedInstanceState) + mSearchPresenter.startSearchPoiByInput(category) + + } + override fun renderSearchPoiResult( + datums: List, + showDelete: Boolean + ) { + + mAdapter.setDatas(datums) + cv_search_result.visibility=View.VISIBLE + + } + + override fun showHistory(datums: List) { + + } + + companion object{ + fun newInstance( category:String):Fragment{ + var bundle = Bundle() + bundle.putString("category",category) + var categorySerachFragment = CategorySearchFragment() + categorySerachFragment.arguments=bundle + return categorySerachFragment + } + } +} diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragment.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragment.java index c1cdbcc1d6..8d716d88ae 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragment.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragment.java @@ -1,38 +1,27 @@ package com.mogo.module.navi.ui.search; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; -import android.widget.EditText; -import android.widget.RelativeLayout; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.android.arouter.facade.annotation.Route; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.map.search.inputtips.MogoTip; import com.mogo.module.common.MogoModulePaths; import com.mogo.module.navi.R; import com.mogo.module.navi.bean.EntityConvertUtils; import com.mogo.module.navi.bean.SearchPoi; -import com.mogo.module.navi.database.AppDataBase; +import com.mogo.module.navi.constants.SearchServiceHolder; import com.mogo.module.navi.ui.adapter.HistoryPoiAdapter; import com.mogo.module.navi.ui.adapter.SearchPoiAdapter; -import com.mogo.module.navi.ui.base.BaseFragment; import com.mogo.module.navi.ui.base.UiController; import com.mogo.module.navi.ui.setting.NaviSettingFragment; -import com.mogo.service.MogoServicePaths; +import com.mogo.module.navi.ui.setting.SettingAddressFragment; import com.mogo.service.fragmentmanager.FragmentDescriptor; -import com.mogo.service.fragmentmanager.IMogoFragmentManager; -import com.mogo.utils.WindowUtils; -import io.reactivex.disposables.Disposable; import java.util.ArrayList; import java.util.List; @@ -47,13 +36,12 @@ import java.util.List; * {@link SearchConstants#SEARCH_TYPE_MULTI_HOME} */ @Route(path = MogoModulePaths.PATH_FRAGMENT_SEARCH) -public class SearchFragment extends BaseSearchFragment implements SearchView { +public class SearchFragment extends BaseSearchFragment implements SearchView, View.OnClickListener { public static final String TAG = "search"; public int mSearchType; - private View mClose; private RecyclerView mSearchResult; @@ -61,7 +49,6 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { private SearchPoiAdapter mPoiAdapter; private HistoryPoiAdapter mHistoryAdapter; - /** * 设置常用地址(我的位置、选点)时的设置按钮 */ @@ -73,7 +60,6 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { private boolean mActionSuccess = false; private View rlHistory; private TextView tvEmpty; - IMogoFragmentManager fragmentManager; @Override public void onAttach(Context context) { @@ -84,7 +70,6 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - fragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation(); } @@ -111,17 +96,17 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); mSearchResult.setLayoutManager(linearLayoutManager); - mPoiAdapter= new SearchPoiAdapter(getActivity(),new ArrayList<>()); + mPoiAdapter = new SearchPoiAdapter(getActivity(), new ArrayList<>()); mSearchResult.setAdapter(mPoiAdapter); - mHistoryAdapter= new HistoryPoiAdapter(getActivity(),new ArrayList<>()); + mHistoryAdapter = new HistoryPoiAdapter(getActivity(), new ArrayList<>()); rvHistory.setAdapter(mHistoryAdapter); tvEmpty = findViewById(R.id.tv_navi_list_empty); findViewById(R.id.iv_navi_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - fragmentManager.pop(); + SearchServiceHolder.INSTANCE.getFragmentManager().pop(); } }); @@ -139,7 +124,6 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { } }); - findViewById(R.id.tv_navi_history_clear).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSearchPresenter.deleteAllCachedPoi(); @@ -148,14 +132,44 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { findViewById(R.id.tv_navi_setting).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - FragmentDescriptor.Builder builder = new FragmentDescriptor.Builder(); - builder.fragment(new NaviSettingFragment()); - FragmentDescriptor build = - builder.tag(MogoModulePaths.PATH_FRAGMENT_SETTING).build(); - fragmentManager.push(build); + push(new NaviSettingFragment(),MogoModulePaths.PATH_FRAGMENT_SETTING); } }); + findViewById(R.id.tv_navi_company).setOnClickListener(new View.OnClickListener() { + @Override public void onClick(View v) { + pupSettingAddress(1); + } + }); + + findViewById(R.id.tv_navi_home).setOnClickListener(new View.OnClickListener() { + @Override public void onClick(View v) { + pupSettingAddress(0); + } + }); + + findViewById(R.id.tv_navi_wash).setOnClickListener(this); + findViewById(R.id.tv_navi_toilet).setOnClickListener(this); + findViewById(R.id.tv_navi_gas).setOnClickListener(this); + findViewById(R.id.tv_navi_restaurant).setOnClickListener(this); + findViewById(R.id.tv_navi_park).setOnClickListener(this); + } + + private void push(Fragment fragment,String tag) { + FragmentDescriptor.Builder builder = new FragmentDescriptor.Builder(); + builder.fragment(fragment); + FragmentDescriptor build = + builder.tag(tag).build(); + SearchServiceHolder.INSTANCE.getFragmentManager().push(build); + } + + private void pupSettingAddress(int type) { + + FragmentDescriptor.Builder builder = new FragmentDescriptor.Builder(); + builder.fragment(SettingAddressFragment.Companion.newInstance(type)); + FragmentDescriptor build = + builder.tag(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME).build(); + SearchServiceHolder.INSTANCE.getFragmentManager().push(build); } /** @@ -236,10 +250,9 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { //} } - @Override public void renderSearchPoiResult(List datums, boolean showDelete) { - if (datums==null||datums.isEmpty()) { + if (datums == null || datums.isEmpty()) { showEmpty(getString(R.string.search_empty)); return; } @@ -249,7 +262,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { @Override public void showHistory(List datums) { - if (datums==null||datums.isEmpty()) { + if (datums == null || datums.isEmpty()) { showEmpty(getString(R.string.history_empty)); return; } @@ -327,10 +340,8 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { // } //} - private void navi2Location(SearchPoi searchPoi) { - } /** @@ -350,7 +361,6 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { } } - private void showResult() { rlHistory.setVisibility(View.GONE); mSearchResult.setVisibility(View.VISIBLE); @@ -363,10 +373,20 @@ public class SearchFragment extends BaseSearchFragment implements SearchView { tvEmpty.setVisibility(View.GONE); } - private void showEmpty(String str){ + private void showEmpty(String str) { rlHistory.setVisibility(View.GONE); tvEmpty.setText(str); mSearchResult.setVisibility(View.GONE); tvEmpty.setVisibility(View.VISIBLE); } + + /** + * 类别 + */ + @Override public void onClick(View v) { + TextView category = (TextView) v; + String text = category.getText().toString(); + push(CategorySearchFragment.Companion.newInstance(text),MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY); + + } } diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java index cddd739670..d5dabb31c8 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java @@ -91,7 +91,7 @@ public class SearchPresenter extends Presenter< SearchView > } }; - private void startSearchPoiByInput( String keyword ) { + public void startSearchPoiByInput( String keyword ) { MogoInputtipsQuery mogoInputtipsQuery = new MogoInputtipsQuery(); mogoInputtipsQuery.setKeyword(keyword); IMogoInputtipsSearch inputtipsSearch = diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/SettingAddressFragment.kt b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/SettingAddressFragment.kt index 0883b064b4..e406299042 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/SettingAddressFragment.kt +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/setting/SettingAddressFragment.kt @@ -2,32 +2,127 @@ package com.mogo.module.navi.ui.setting import android.os.Bundle import android.view.View +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.LinearLayoutManager import com.alibaba.android.arouter.facade.annotation.Route +import com.mogo.map.search.inputtips.MogoTip import com.mogo.module.common.MogoModulePaths import com.mogo.module.navi.R +import com.mogo.module.navi.bean.SearchPoi +import com.mogo.module.navi.constants.AMapConstants import com.mogo.module.navi.constants.SearchServiceHolder +import com.mogo.module.navi.ui.adapter.SearchPoiAdapter import com.mogo.module.navi.ui.base.BaseFragment +import com.mogo.module.navi.ui.search.BaseSearchFragment import kotlinx.android.synthetic.main.fragment_navi_setting.iv_back -import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_sound_type +import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back +import kotlinx.android.synthetic.main.fragment_setting_address.group_set_address +import kotlinx.android.synthetic.main.fragment_setting_address.rv_search_result +import kotlinx.android.synthetic.main.fragment_setting_address.tv_navi_choose_point +import kotlinx.android.synthetic.main.fragment_setting_address.tv_navi_my_location +import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home +import kotlinx.android.synthetic.main.include_search_bar.et_navi_search /** * @author zyz * 2020-01-07. */ -@Route(path= MogoModulePaths.PATH_FRAGMENT_SETTING) -class SettingAddressFragment : BaseFragment() { +@Route(path = MogoModulePaths.PATH_FRAGMENT_SETTING_HOME) +class SettingAddressFragment : BaseSearchFragment() { + override fun renderSearchPoiResult( + datums: MutableList?, + showDelete: Boolean + ) { + mAdapter.setDatas(datums) + group_set_address.visibility = View.GONE + rv_search_result.visibility = View.VISIBLE + + } + + override fun showHistory(datums: MutableList?) { + } + + private var style: Int = 0 + private lateinit var mAdapter: SearchPoiAdapter + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY) ?: 0 + } + override fun getLayoutId(): Int { return R.layout.fragment_setting_address } + fun isHome(): Boolean { + return style == 0 + } + + fun isCompony(): Boolean { + return style == 1 + } + + fun isSearch(): Boolean { + return group_set_address.visibility == View.GONE + } + override fun onViewCreated( view: View, savedInstanceState: Bundle? ) { super.onViewCreated(view, savedInstanceState) - iv_back.setOnClickListener { - SearchServiceHolder.fragmentManager.pop() + + if (isHome()) { + tv_set_as_home.text = resources.getString(R.string.set_as_home_navi) + } else { + tv_set_as_home.text = resources.getString(R.string.set_as_compony_navi) + } + + mAdapter = SearchPoiAdapter(activity, ArrayList()) + + rv_search_result.layoutManager = + LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false) + + rv_search_result.adapter = mAdapter + + + iv_navi_back.setOnClickListener { + if (group_set_address.visibility == View.VISIBLE) { + SearchServiceHolder.fragmentManager.pop() + } else { + reset() + } + } + + + tv_navi_choose_point.setOnClickListener { + group_set_address.visibility = View.GONE + tv_set_as_home.visibility = View.VISIBLE + } + + tv_navi_my_location.setOnClickListener { + group_set_address.visibility = View.GONE + tv_set_as_home.visibility = View.VISIBLE + } + + } + + private fun reset() { + group_set_address.visibility = View.VISIBLE + rv_search_result.visibility = View.GONE + mAdapter.clear() + et_navi_search.setText("") + tv_set_as_home.visibility = View.GONE + } + + companion object { + fun newInstance(type: Int = 0): Fragment { + + var settingAddressFragment = SettingAddressFragment() + val bundle = Bundle() + bundle.putInt(AMapConstants.KEY_SET_HOME_COMPONY, type) + settingAddressFragment.setArguments(bundle) + return settingAddressFragment } } } diff --git a/modules/mogo-module-search/src/main/res/drawable/selector_item_category_background.xml b/modules/mogo-module-search/src/main/res/drawable/selector_item_category_background.xml new file mode 100644 index 0000000000..cff42dd83b --- /dev/null +++ b/modules/mogo-module-search/src/main/res/drawable/selector_item_category_background.xml @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/drawable/selector_item_category_result.xml b/modules/mogo-module-search/src/main/res/drawable/selector_item_category_result.xml new file mode 100644 index 0000000000..e131861fdf --- /dev/null +++ b/modules/mogo-module-search/src/main/res/drawable/selector_item_category_result.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/drawable/shape_round_blue_grident.xml b/modules/mogo-module-search/src/main/res/drawable/shape_round_blue_grident.xml new file mode 100644 index 0000000000..cc53c2d4d8 --- /dev/null +++ b/modules/mogo-module-search/src/main/res/drawable/shape_round_blue_grident.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/modules/mogo-module-search/src/main/res/drawable/shape_round_gray.xml b/modules/mogo-module-search/src/main/res/drawable/shape_round_gray.xml index 4e5fb46c4f..8d4cf110f3 100644 --- a/modules/mogo-module-search/src/main/res/drawable/shape_round_gray.xml +++ b/modules/mogo-module-search/src/main/res/drawable/shape_round_gray.xml @@ -1,6 +1,6 @@ - + diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_search.xml b/modules/mogo-module-search/src/main/res/layout/fragment_search.xml index 0b0cf11af2..75cdaf87f6 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_search.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_search.xml @@ -34,6 +34,7 @@ android:layout_weight="1" android:textSize="@dimen/txt_normal" android:paddingLeft="@dimen/dp_75" + android:id="@+id/tv_navi_home" android:gravity="center_vertical" android:drawableLeft="@mipmap/icon_navi_home" android:text="@string/navi_home" @@ -51,7 +52,7 @@ android:textSize="@dimen/txt_normal" android:text="@string/navi_company" android:paddingLeft="@dimen/dp_75" - + android:id="@+id/tv_navi_company" android:gravity="center_vertical" android:drawableLeft="@mipmap/icon_navi_company" android:layout_height="match_parent" 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 new file mode 100644 index 0000000000..6048efb724 --- /dev/null +++ b/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_setting_address.xml b/modules/mogo-module-search/src/main/res/layout/fragment_setting_address.xml index 642582667e..cf04d068c7 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_setting_address.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_setting_address.xml @@ -1,10 +1,88 @@ - + - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/layout/item_search_category.xml b/modules/mogo-module-search/src/main/res/layout/item_search_category.xml new file mode 100644 index 0000000000..b804455410 --- /dev/null +++ b/modules/mogo-module-search/src/main/res/layout/item_search_category.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_checked.png b/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_checked.png new file mode 100755 index 0000000000000000000000000000000000000000..a89d92e306dfae4ff20724d87842686385be967a GIT binary patch literal 3751 zcmV;Y4p{MtP)Px@VM#<|DWHkZ0h}fSv(84SF0p$HD(8yZY)QosAnmA7>3?0Wg2=xg`K%Er5Ci z#eWkJb*n&Nf|$>gsCZ9%0P@c`4&m6}dHU%SRenY#S6-v?U--=r9GJ-7fB*Y=ulFMe zzn!zQFgl$Mu*{8`AUcJBMN@Ve0t{b&fTN#fx8MG1XZ7k!Dg9x~Mh;-UZ5zAmhX82{ zj$4LaK(qi{jBdC4A>!=7@ypJ(ZM|W~4E>E1!2H=~@9kZ@_zMJF#=KU)X{+5yWPpjCp*tP^NwW0rXv9mUH6qyj#(Aub_lw%q=ds4v@O}xZXN_&39clt^tT2 z#6AYO9x8zO)~)yB&i!kEcg-M4O=Vl^U?@wLveO(Xj!$tzUeVdU{YXl8Ix_kl%DA|7 z>q_xgrgD6DCfuU4~kIl9*~FQVorirF3D-7JkC`JxVIsbK_7*ni`suA&Xa6 znSQk8O8QWetdai)`cTOyCMWNkvtvi=Pb{hM-I-Jvvrvmc%28UN ziu|B`Z0`K|cenlQ+~N?SFw!3f-e2!z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FFFFFF diff --git a/modules/mogo-module-search/src/main/res/values/strings.xml b/modules/mogo-module-search/src/main/res/values/strings.xml index 2810111d64..6527ed6402 100644 --- a/modules/mogo-module-search/src/main/res/values/strings.xml +++ b/modules/mogo-module-search/src/main/res/values/strings.xml @@ -26,4 +26,9 @@ 白天 夜间 自动 + 我的位置 + 地图选点 + 设为家 + 设为公司 + 导航去这里 diff --git a/modules/mogo-module-search/src/main/res/values/styles.xml b/modules/mogo-module-search/src/main/res/values/styles.xml index 41aa1c444c..54581e1f8b 100644 --- a/modules/mogo-module-search/src/main/res/values/styles.xml +++ b/modules/mogo-module-search/src/main/res/values/styles.xml @@ -37,4 +37,11 @@ @drawable/selector_setting_bg + +