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 0000000000..a89d92e306
Binary files /dev/null and b/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_checked.png differ
diff --git a/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_unchecked.png b/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_unchecked.png
new file mode 100755
index 0000000000..392d5c34cb
Binary files /dev/null and b/modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_search_category_unchecked.png differ
diff --git a/modules/mogo-module-search/src/main/res/values/colors.xml b/modules/mogo-module-search/src/main/res/values/colors.xml
index 0944d5ad10..6fb34a3513 100644
--- a/modules/mogo-module-search/src/main/res/values/colors.xml
+++ b/modules/mogo-module-search/src/main/res/values/colors.xml
@@ -5,6 +5,7 @@
#D81B60
#ff080625
#FFFFFF
+ #00000000
#1AFFFFFF
#99FFFFFF
#CCFFFFFF
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
+
+