opt
1
.idea/.name
generated
@@ -1 +0,0 @@
|
||||
MogoLauncher
|
||||
2
.idea/vcs.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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",
|
||||
|
||||
@@ -14,11 +14,11 @@ import com.mogo.commons.network.ParamsUtil;
|
||||
import com.mogo.commons.network.X509TrustManagerImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
import com.zhidao.account.sdk.AccountClientManager;
|
||||
import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
||||
import com.zhidao.account.sdk.network.NetEnvironManager;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.security.SecureRandom;
|
||||
@@ -103,7 +103,7 @@ public class AbsMogoApplication extends Application {
|
||||
}
|
||||
|
||||
private static void initAccountSdk() {
|
||||
AccountClientManager.init( sApp, 1, "os2.0-launcher" );
|
||||
AccountClientManager.init( sApp, NetEnvironManager.QA, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
import com.amap.api.navi.model.AMapNaviPath;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.mogo.map.impl.amap.AMapWrapper;
|
||||
import com.mogo.map.impl.amap.R;
|
||||
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
@@ -81,6 +82,7 @@ public class NaviOverlayHelper implements MogoCalculatePath.OnItemClickInteracti
|
||||
* @return 排序好的路径规划列表
|
||||
*/
|
||||
private List< CalculatePathItem > getSortedPaths() {
|
||||
checkAMapInstance();
|
||||
final Map< Integer, AMapNaviPath > pathMap = mAMapNavi.getNaviPaths();
|
||||
if ( pathMap == null || pathMap.isEmpty() ) {
|
||||
return null;
|
||||
@@ -126,9 +128,16 @@ public class NaviOverlayHelper implements MogoCalculatePath.OnItemClickInteracti
|
||||
* @param bounds
|
||||
*/
|
||||
private void showPathsBound( LatLngBounds bounds ) {
|
||||
checkAMapInstance();
|
||||
mAMap.animateCamera( CameraUpdateFactory.newLatLngBoundsRect( bounds, mBoundRect.left, mBoundRect.right, mBoundRect.top, mBoundRect.bottom ) );
|
||||
}
|
||||
|
||||
private void checkAMapInstance(){
|
||||
if ( mAMap == null ) {
|
||||
mAMap = AMapWrapper.getAMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderPathOverlay( List< CalculatePathItem > paths ) {
|
||||
if ( paths == null || paths.size() == 0 ) {
|
||||
return;
|
||||
|
||||
@@ -79,6 +79,24 @@ public class MogoCalculatePath {
|
||||
this.mTrafficLights = mTrafficLights;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private StringBuilder mDescBuilder = null;
|
||||
|
||||
public String getDesc() {
|
||||
if ( mDescBuilder == null ) {
|
||||
mDescBuilder = new StringBuilder();
|
||||
int lightsSize = getTrafficLights();
|
||||
if ( lightsSize > 0 ) {
|
||||
mDescBuilder.append( "红绿灯" ).append( lightsSize ).append( "个" );
|
||||
}
|
||||
//mDescBuilder.append( " " );
|
||||
//mDescBuilder.append( "收费" ).append( mPath.getTollCost() ).append( "元" );
|
||||
}
|
||||
|
||||
return mDescBuilder.toString();
|
||||
}
|
||||
|
||||
public String getTagId() {
|
||||
return mTagId;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class MogoModulePaths {
|
||||
* 搜索页面模块实例化路径
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_MODULE_SEARCH= "navi/search/ui";
|
||||
public static final String PATH_MODULE_SEARCH= "/navi/search/ui";
|
||||
|
||||
/**
|
||||
* 搜索页面Activity实例化路径
|
||||
@@ -52,13 +52,43 @@ public class MogoModulePaths {
|
||||
|
||||
|
||||
/**
|
||||
* 管理 fragment
|
||||
* 搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SEARCH = "/navi/search";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_CHOOSE_PAHT = "/navi/search";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 按类别搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SEARCH_CATEGORY = "/navi/search/category";
|
||||
|
||||
|
||||
/**
|
||||
* 设置 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SETTING = "/navi/setting";
|
||||
|
||||
|
||||
/**
|
||||
* 设置家和公司 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SETTING_HOME = "/navi/setting/home";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
|
||||
@@ -81,6 +81,7 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mVoiceIcon.startAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,12 +81,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mHome = findViewById( R.id.module_entrance_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
TextView textView = new TextView(getActivity());
|
||||
textView.setText("我是window");
|
||||
textView.setOnClickListener(c -> {
|
||||
TipToast.shortTip("我是window");
|
||||
});
|
||||
( ( IMogoWindowManager ) ARouter.getInstance().build( MogoServicePaths.PATH_WINDOW_MANAGER ).navigation( getContext() ) ).addView(100,textView,200,200,false);
|
||||
} );
|
||||
|
||||
mCompany = findViewById( R.id.module_entrance_id_company );
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -40,7 +34,6 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,6 +14,17 @@ public class AMapConstants {
|
||||
*/
|
||||
public static final float AMAP_ZOOM_COMMON_LEVEL = 15.0f;
|
||||
|
||||
|
||||
/**
|
||||
* 设置家和公司的Key
|
||||
*/
|
||||
public static final String KEY_SET_HOME_COMPONY = "key_home";
|
||||
|
||||
/**
|
||||
* 序列号实体的Key
|
||||
*/
|
||||
public static final String KEY_PARCELABLE = "key_Parcelable";
|
||||
|
||||
/**
|
||||
* 点击当前位置按钮的地图缩放级别
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.module.navi.constants
|
||||
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.map.navi.IMogoNavi
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager
|
||||
import com.mogo.service.map.IMogoMapService
|
||||
import com.mogo.service.module.IMogoRegisterCenter
|
||||
|
||||
/**
|
||||
*@author zyz
|
||||
* 2020-01-08.
|
||||
*/
|
||||
object SearchServiceHolder {
|
||||
|
||||
val fragmentManager:IMogoFragmentManager = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_FRAGMENT_MANAGER
|
||||
).navigation() as IMogoFragmentManager
|
||||
val mapService:IMogoMapService = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_SERVICES_MAP
|
||||
).navigation() as IMogoMapService
|
||||
val listenerCenter:IMogoRegisterCenter = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_REGISTER_CENTER
|
||||
).navigation() as IMogoRegisterCenter
|
||||
|
||||
|
||||
fun push(
|
||||
fragment: Fragment,
|
||||
tag: String
|
||||
) {
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(fragment)
|
||||
val build = builder.tag(tag)
|
||||
.build()
|
||||
fragmentManager.push(build)
|
||||
}
|
||||
|
||||
|
||||
fun getNavi(context: Context):IMogoNavi{
|
||||
return mapService.getNavi(context)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.mogo.module.navi.ui.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
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 CalculatePathAdapter extends RecycleBaseAdapter<MogoCalculatePath> {
|
||||
|
||||
private int current = 0;
|
||||
private int lastPosition = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CalculatePathAdapter(Context context, List<MogoCalculatePath> list) {
|
||||
super(context, list, R.layout.item_calculate_path_map);
|
||||
}
|
||||
|
||||
private View.OnClickListener onClickListener;
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecycleViewHolder holder, MogoCalculatePath item) {
|
||||
|
||||
//holder.setText(R.id.tv_position, tip.getName());
|
||||
//holder.setText(R.id.tv_position_des, tip.getAddress());
|
||||
|
||||
holder.itemView.setTag(R.id.tag_position, holder.getLayoutPosition());
|
||||
holder.itemView.setOnClickListener(onClickListener);
|
||||
holder.itemView.setSelected(current == holder.getLayoutPosition());
|
||||
|
||||
View mName = holder.getView(R.id.amap_calculate_item_strategy_name);
|
||||
holder.setText(R.id.amap_calculate_item_strategy_name, item.getStrategyName());
|
||||
mName.setBackgroundResource(getStrategyNameBkgResId(holder.getLayoutPosition()));
|
||||
holder.setText(R.id.amap_calculate_item_strategy_time, item.getTime());
|
||||
holder.setText(R.id.amap_calculate_item_strategy_distance, item.getDistance());
|
||||
holder.setText(R.id.amap_calculate_item_strategy_desc, item.getDesc());
|
||||
}
|
||||
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
this.onClickListener = onClickListener;
|
||||
}
|
||||
|
||||
public void setCurrent(int current) {
|
||||
this.current = current;
|
||||
notifyItemChanged(lastPosition);
|
||||
notifyItemChanged(current);
|
||||
lastPosition = current;
|
||||
}
|
||||
|
||||
public MogoCalculatePath getCurrentItem() {
|
||||
return list.get(current);
|
||||
}
|
||||
|
||||
private int getStrategyNameBkgResId(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return R.drawable.amap_calculate_navi_strategy1_bkg;
|
||||
case 1:
|
||||
return R.drawable.amap_calculate_navi_strategy2_bkg;
|
||||
default:
|
||||
return R.drawable.amap_calculate_navi_strategy3_bkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class HistoryPoiAdapter extends RecycleBaseAdapter<SearchPoi> {
|
||||
holder.setText(R.id.tv_position, tip.getName());
|
||||
holder.setText(R.id.tv_position_des, tip.getAddress());
|
||||
|
||||
holder.itemView.setTag(R.id.tag_position, tip);
|
||||
holder.itemView.setTag(R.id.tag_item, tip);
|
||||
holder.itemView.setOnClickListener(onClickListener);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
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.bean.SearchPoi;
|
||||
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<MogoTip> {
|
||||
|
||||
private int current = 0;
|
||||
private int lastPosition = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SearchCategoryAdapter(Context context, List<MogoTip> 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<MogoTip> 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;
|
||||
}
|
||||
|
||||
|
||||
public MogoTip getCurrentItem(){
|
||||
return list.get(current);
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,12 @@ public abstract class RecycleBaseAdapter<T> extends
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void clear(){
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
public void messageShow(String mes)
|
||||
{
|
||||
if (toast==null){
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
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.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.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搜索页面
|
||||
* <p>
|
||||
* 普通搜索:从首页点击搜索按钮进入:包含:仅输入搜索(列表不包含设置按钮)
|
||||
* {@link SearchConstants#SEARCH_TYPE_COMMON}
|
||||
* <p>
|
||||
* 地址设置搜索:设置家、公司、其他的地址:包含当前位置、选点、搜索列表(列表包含设置按钮)、普通页面
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_COMPANY}
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_HOME}
|
||||
*/
|
||||
public abstract class BaseSearchFragment extends BaseFragment implements SearchView {
|
||||
|
||||
|
||||
public int mSearchType;
|
||||
|
||||
protected SearchPresenter mSearchPresenter;
|
||||
|
||||
private View mClose;
|
||||
private EditText mSearchBox;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置常用地址(我的位置、选点)时的设置按钮
|
||||
*/
|
||||
private TextView mActionButton;
|
||||
|
||||
/**
|
||||
* 地址设置是否完成
|
||||
*/
|
||||
private boolean mActionSuccess = false;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof UiController) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_search;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getLifecycle().addObserver(mSearchPresenter = new SearchPresenter(this));
|
||||
}
|
||||
|
||||
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mSearchBox = view.findViewById(R.id.et_navi_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchMyLocationUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_MY_LOCATION;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// //removeChoicePointMarker();
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchChoicePointUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_CHOICE_POINT;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
private void saveCurrentLocationAsCommonAddress() {
|
||||
//if ( mLastAMapLocation == null ) {
|
||||
// shortToast( "定位失败,请重试" );
|
||||
// return;
|
||||
//}
|
||||
//final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( mLastAMapLocation ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
//}, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
//} );
|
||||
//mSearchPresenter.addDisposable( disposable );
|
||||
}
|
||||
|
||||
private void saveRegeoAddressAsCommonAddress() {
|
||||
//if ( mSearchBox.getTag() instanceof RegeocodeAddress ) {
|
||||
// final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( ( ( RegeocodeAddress ) mSearchBox.getTag() ) ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
// }, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
// } );
|
||||
// mSearchPresenter.addDisposable( disposable );
|
||||
//} else {
|
||||
// Toast.makeText( mContext, "请选择位置", Toast.LENGTH_SHORT ).show();
|
||||
//}
|
||||
}
|
||||
|
||||
// view interface
|
||||
|
||||
@Override
|
||||
public EditText getSearchBox() {
|
||||
return mSearchBox;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSearchType() {
|
||||
return mSearchType;
|
||||
}
|
||||
|
||||
@Override public void startJumpAnimation() {
|
||||
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void renderChoicePointResult( RegeocodeAddress address ) {
|
||||
// if ( address == null ) {
|
||||
// mSearchBox.setTag( null );
|
||||
// mSearchBox.setText( "" );
|
||||
// return;
|
||||
// }
|
||||
// mSearchBox.setTag( address );
|
||||
// mSearchBox.setText( address.getFormatAddress() );
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderErrorView() {
|
||||
//
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderContentView() {
|
||||
//
|
||||
//}
|
||||
|
||||
// view interface end
|
||||
|
||||
///**
|
||||
// * 屏幕中心marker 跳动
|
||||
// */
|
||||
//@Override
|
||||
//public void startJumpAnimation() {
|
||||
//
|
||||
// final AMap aMap = mUiController.getAMapServiceVisitor().getMap();
|
||||
//
|
||||
// if ( mChoicePointMaker != null ) {
|
||||
// //根据屏幕距离计算需要移动的目标点
|
||||
// final LatLng latLng = mChoicePointMaker.getPosition();
|
||||
// Point point = aMap.getProjection().toScreenLocation( latLng );
|
||||
// point.y -= WindowUtils.dip2px( mContext, 125 );
|
||||
// LatLng target = aMap.getProjection()
|
||||
// .fromScreenLocation( point );
|
||||
// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
// Animation animation = new TranslateAnimation( target );
|
||||
// animation.setInterpolator( new Interpolator() {
|
||||
// @Override
|
||||
// public float getInterpolation( float input ) {
|
||||
// // 模拟重加速度的interpolator
|
||||
// if ( input <= 0.5 ) {
|
||||
// return ( float ) ( 0.5f - 2 * ( 0.5 - input ) * ( 0.5 - input ) );
|
||||
// } else {
|
||||
// return ( float ) ( 0.5f - Math.sqrt( ( input - 0.5f ) * ( 1.5f - input ) ) );
|
||||
// }
|
||||
// }
|
||||
// } );
|
||||
// //整个移动所需要的时间
|
||||
// animation.setDuration( 600 );
|
||||
// //设置动画
|
||||
// mChoicePointMaker.setAnimation( animation );
|
||||
// //开始动画
|
||||
// mChoicePointMaker.startAnimation();
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
private void navi2Location(SearchPoi searchPoi) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出搜索,进行清理
|
||||
*/
|
||||
private void exitSearch() {
|
||||
|
||||
switch (mSearchType) {
|
||||
case SearchConstants.SEARCH_TYPE_COMMON:
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_HOME:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mSearchPresenter != null) {
|
||||
mSearchPresenter.onDestroy(getViewLifecycleOwner());
|
||||
getLifecycle().removeObserver(mSearchPresenter);
|
||||
mSearchPresenter = null;
|
||||
}
|
||||
mSearchBox.setTag(null);
|
||||
//removeChoicePointMarker();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
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.common.MogoModulePaths
|
||||
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 {
|
||||
|
||||
var newInstance = ChoosePathFragment.newInstance(mAdapter.currentItem)
|
||||
|
||||
SearchServiceHolder.push(newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT)
|
||||
}
|
||||
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<MogoTip>,
|
||||
showDelete: Boolean
|
||||
) {
|
||||
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility=View.VISIBLE
|
||||
|
||||
}
|
||||
|
||||
override fun showHistory(datums: List<SearchPoi>) {
|
||||
|
||||
}
|
||||
|
||||
companion object{
|
||||
fun newInstance( category:String):Fragment{
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category",category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
categorySerachFragment.arguments=bundle
|
||||
return categorySerachFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
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.navi.IMogoNaviListener
|
||||
import com.mogo.map.navi.MogoCalculatePath
|
||||
import com.mogo.map.navi.MogoNaviInfo
|
||||
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.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.rv_search_result
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||
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 ChoosePathFragment : BaseFragment(), IMogoNaviListener {
|
||||
override fun onInitNaviFailure() {
|
||||
}
|
||||
|
||||
override fun onInitNaviSuccess() {
|
||||
}
|
||||
|
||||
override fun onNaviInfoUpdate(naviinfo: MogoNaviInfo?) {
|
||||
}
|
||||
|
||||
override fun onStartNavi() {
|
||||
}
|
||||
|
||||
override fun onStopNavi() {
|
||||
}
|
||||
|
||||
override fun onCalculateSuccess() {
|
||||
mAdapter.setDatas(SearchServiceHolder.getNavi(activity!!).calculatedStrategies)
|
||||
}
|
||||
|
||||
override fun onoCalculateFailed() {
|
||||
}
|
||||
|
||||
private lateinit var mAdapter:CalculatePathAdapter
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
var mogoTip: MogoTip?=null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mogoTip = arguments?.getParcelable<MogoTip>(AMapConstants.KEY_PARCELABLE)
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
tv_navi_navi.text=getString(R.string.start_navi)
|
||||
|
||||
et_navi_search.setText(getString(R.string.choose_path))
|
||||
et_navi_search.isEnabled=false
|
||||
SearchServiceHolder.getNavi(context!!).naviTo(mogoTip?.point)
|
||||
|
||||
SearchServiceHolder.listenerCenter.registerMogoNaviListener(MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT,this)
|
||||
|
||||
var arrayList = ArrayList<MogoCalculatePath>()
|
||||
mAdapter= CalculatePathAdapter(activity,arrayList)
|
||||
rv_search_result.layoutManager=LinearLayoutManager(activity,LinearLayoutManager.VERTICAL,false)
|
||||
|
||||
rv_search_result.adapter=mAdapter
|
||||
tv_navi_navi.setOnClickListener {
|
||||
SearchServiceHolder.getNavi(activity!!).startNavi(false)
|
||||
}
|
||||
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.setCurrent(position)
|
||||
mAdapter.currentItem.onItemClickInteraction.onItemClicked(mAdapter.currentItem.mTagId)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object{
|
||||
fun newInstance(searchPoi: MogoTip):Fragment{
|
||||
var bundle = Bundle()
|
||||
bundle.putParcelable(AMapConstants.KEY_PARCELABLE, searchPoi)
|
||||
var choosePathFragment = ChoosePathFragment()
|
||||
choosePathFragment.arguments=bundle
|
||||
return choosePathFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,28 @@
|
||||
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.AMapConstants;
|
||||
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.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import com.mogo.module.navi.ui.setting.NaviSettingFragment;
|
||||
import com.mogo.module.navi.ui.setting.SettingAddressFragment;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,23 +37,19 @@ import java.util.List;
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_HOME}
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
public class SearchFragment extends BaseFragment implements SearchView {
|
||||
public class SearchFragment extends BaseSearchFragment implements SearchView, View.OnClickListener {
|
||||
|
||||
public static final String TAG = "search";
|
||||
|
||||
public int mSearchType;
|
||||
|
||||
private SearchPresenter mSearchPresenter;
|
||||
|
||||
private View mClose;
|
||||
private EditText mSearchBox;
|
||||
|
||||
private RecyclerView mSearchResult;
|
||||
private RecyclerView rvHistory;
|
||||
private SearchPoiAdapter mPoiAdapter;
|
||||
private HistoryPoiAdapter mHistoryAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* 设置常用地址(我的位置、选点)时的设置按钮
|
||||
*/
|
||||
@@ -73,7 +61,6 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
private boolean mActionSuccess = false;
|
||||
private View rlHistory;
|
||||
private TextView tvEmpty;
|
||||
IMogoFragmentManager fragmentManager;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -84,8 +71,6 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
|
||||
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
fragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,12 +81,10 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getLifecycle().addObserver(mSearchPresenter = new SearchPresenter(this));
|
||||
}
|
||||
|
||||
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mSearchBox = view.findViewById(R.id.et_navi_search);
|
||||
mSearchResult = view.findViewById(R.id.rv_navi_search);
|
||||
rvHistory = view.findViewById(R.id.rv_navi_history);
|
||||
rlHistory = view.findViewById(R.id.rl_navi_history);
|
||||
@@ -113,23 +96,26 @@ public class SearchFragment extends BaseFragment 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();
|
||||
}
|
||||
});
|
||||
|
||||
mHistoryAdapter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
|
||||
SearchPoi item = (SearchPoi) v.getTag(R.id.tag_item);
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
SearchServiceHolder.INSTANCE.push(ChoosePathFragment.Companion.newInstance(mogoTip),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,16 +124,57 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
MogoTip tag = (MogoTip) v.getTag(R.id.tag_position);
|
||||
SearchPoi searchPoi = EntityConvertUtils.tipToPoi(tag);
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
SearchServiceHolder.INSTANCE.push(ChoosePathFragment.Companion.newInstance(tag),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
findViewById(R.id.tv_navi_history_clear).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
mSearchPresenter.deleteAllCachedPoi();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.tv_navi_setting).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,16 +255,9 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
//}
|
||||
}
|
||||
|
||||
// view interface
|
||||
|
||||
@Override
|
||||
public EditText getSearchBox() {
|
||||
return mSearchBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSearchPoiResult(List<MogoTip> datums, boolean showDelete) {
|
||||
if (datums==null||datums.isEmpty()) {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
showEmpty(getString(R.string.search_empty));
|
||||
return;
|
||||
}
|
||||
@@ -247,7 +267,7 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
|
||||
@Override public void showHistory(List<SearchPoi> datums) {
|
||||
|
||||
if (datums==null||datums.isEmpty()) {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
showEmpty(getString(R.string.history_empty));
|
||||
return;
|
||||
}
|
||||
@@ -325,10 +345,8 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
private void navi2Location(SearchPoi searchPoi) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,20 +366,6 @@ public class SearchFragment extends BaseFragment implements SearchView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mSearchPresenter != null) {
|
||||
mSearchPresenter.onDestroy(getViewLifecycleOwner());
|
||||
getLifecycle().removeObserver(mSearchPresenter);
|
||||
mSearchPresenter = null;
|
||||
}
|
||||
mSearchBox.setTag(null);
|
||||
|
||||
mPoiAdapter = null;
|
||||
//removeChoicePointMarker();
|
||||
}
|
||||
|
||||
private void showResult() {
|
||||
rlHistory.setVisibility(View.GONE);
|
||||
mSearchResult.setVisibility(View.VISIBLE);
|
||||
@@ -374,10 +378,20 @@ public class SearchFragment extends BaseFragment 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -1,14 +1,33 @@
|
||||
package com.mogo.module.navi.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import kotlinx.android.synthetic.main.fragment_navi_setting.iv_back
|
||||
import kotlinx.android.synthetic.main.fragment_navi_setting.tv_navi_sound_type
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-01-07.
|
||||
*/
|
||||
@Route(path= MogoModulePaths.PATH_FRAGMENT_SETTING)
|
||||
class NaviSettingFragment : BaseFragment() {
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_navi_setting
|
||||
}
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
iv_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
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.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_HOME)
|
||||
class SettingAddressFragment : BaseSearchFragment() {
|
||||
override fun renderSearchPoiResult(
|
||||
datums: MutableList<MogoTip>?,
|
||||
showDelete: Boolean
|
||||
) {
|
||||
mAdapter.setDatas(datums)
|
||||
group_set_address.visibility = View.GONE
|
||||
rv_search_result.visibility = View.VISIBLE
|
||||
|
||||
}
|
||||
|
||||
override fun showHistory(datums: MutableList<SearchPoi>?) {
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#5B6CFF" />
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item >
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#43CEDF" />
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item >
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#B6B6B6" />
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#5B6CFF" />
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:startColor="#1A3E7FFC"
|
||||
android:endColor="#3E7FFC" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:drawable="@color/translate"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@mipmap/icon_search_category_checked" android:state_selected="true"/>
|
||||
<item android:drawable="@mipmap/icon_search_category_checked" android:state_checked="true"/>
|
||||
<item android:drawable="@mipmap/icon_search_category_unchecked"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/shape_round_blue_margin" android:state_activated="true"/>
|
||||
<item android:drawable="@drawable/shape_round_blue_margin" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/shape_round_gray"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
|
||||
|
||||
<corners android:radius="@dimen/dp_16"/>
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#3E7FFC"
|
||||
android:startColor="#5CC1FF" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<solid android:color="#4D3E7FFC"/>
|
||||
<corners android:radius="@dimen/dp_8"/>
|
||||
<stroke android:color="#3E7FFC" android:width="@dimen/dp_2"/>
|
||||
</shape>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<solid android:color="#3F4057"/>
|
||||
<corners android:radius="@dimen/dp_8"/>
|
||||
<corners android:radius="@dimen/dp_16"/>
|
||||
</shape>
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#3F4057" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<!-- <scale-->
|
||||
<!-- android:drawable="@drawable/ic_seek_bar_progress"-->
|
||||
<!-- android:scaleWidth="100%" />-->
|
||||
|
||||
<clip>
|
||||
<shape android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#256BFF"
|
||||
android:startColor="#5CC1FF" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,21 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/fragment_left_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:background="#2D2E3D"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/fragment_left_margin"
|
||||
>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/rl_navi_setting_title"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
<LinearLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/ll_navi_sound"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_navi_sound"
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/iv_sound_minus"
|
||||
android:src="@mipmap/icon_navi_sound_low"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="center"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="@dimen/dp_3"
|
||||
android:layout_height="@dimen/dp_71"
|
||||
android:background="@color/white_10"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
android:scaleType="center"
|
||||
|
||||
android:id="@+id/iv_sound_plus"
|
||||
android:src="@mipmap/icon_navi_sound_plus"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_navi_sound"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ll_navi_sound"
|
||||
app:layout_constraintLeft_toRightOf="@id/ll_navi_sound"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:src="@mipmap/icon_sound_low"
|
||||
android:id="@+id/iv_navi_sound_low"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:src="@mipmap/icon_sound_high"
|
||||
android:id="@+id/iv_navi_sound_high"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_navi_sound"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ll_navi_sound"
|
||||
app:layout_constraintRight_toRightOf="@id/rg_navi_path"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/player_progress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:splitTrack="false"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:layout_marginRight="@dimen/dp_40"
|
||||
android:maxHeight="@dimen/dp_11"
|
||||
android:progressDrawable="@drawable/shape_seek_bar"
|
||||
android:thumb="@mipmap/icon_pb_thumb"
|
||||
android:progress="30"
|
||||
app:layout_constraintLeft_toRightOf="@id/iv_navi_sound_low"
|
||||
app:layout_constraintRight_toLeftOf="@id/iv_navi_sound_high"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_navi_sound_low"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_navi_sound_low"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_navi_path"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_navi_prefer"
|
||||
>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_jam"
|
||||
android:layout_marginRight="20dp"
|
||||
android:checked="true"
|
||||
android:text="@string/navi_prefer_jam"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_fee"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/navi_prefer_fee"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_time_no_high_way"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="@string/navi_prefer_no_high_way"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_high_way"
|
||||
android:text="@string/navi_prefer_high_way"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_navi_setting_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_gravity="center_horizontal">
|
||||
>
|
||||
|
||||
|
||||
<ImageView
|
||||
@@ -23,7 +155,8 @@
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/icon_back" />
|
||||
android:src="@mipmap/icon_back"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -33,51 +166,138 @@
|
||||
android:layout_toRightOf="@id/iv_back"
|
||||
android:text="@string/navi_setting"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/txt_title" />
|
||||
android:textSize="@dimen/txt_title"
|
||||
/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_navi_setting_title"
|
||||
android:id="@+id/tv_navi_sound"
|
||||
android:layout_width="400px"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_height="45px"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:text="@string/navi_setting_sound"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rg_navi_path"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_navi_prefer"
|
||||
android:layout_width="400px"
|
||||
android:layout_height="45px"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:text="@string/preference_navi"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_navi_setting_title"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<RadioGroup android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/tv_navi_sound_type"
|
||||
android:layout_width="400px"
|
||||
android:layout_height="45px"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:text="@string/preference_navi_sound_type"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_navi_sound"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_navi_sound_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_navi_prefer"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:id="@+id/rg_time_mode"
|
||||
android:layout_height="wrap_content">
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_navi_sound_type"
|
||||
>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_time_24"
|
||||
android:text="@string/navi_prefer_jam"
|
||||
android:checked="true"
|
||||
android:id="@+id/rb_navi_detail"
|
||||
android:layout_marginRight="20dp"
|
||||
style="@style/rb_setting"/>
|
||||
android:checked="true"
|
||||
android:text="@string/navi_prefer_detail"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<!-- <RadioButton-->
|
||||
<!-- android:id="@+id/rb_time_12"-->
|
||||
<!-- android:text="@string/time_mode_12"-->
|
||||
<!-- android:layout_marginRight="20dp"-->
|
||||
<!-- style="@style/rb_energy"/>-->
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_draft"
|
||||
android:text="@string/navi_prefer_draft"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_navi_day_night"
|
||||
android:layout_width="400px"
|
||||
android:layout_height="45px"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:text="@string/preference_navi_sound_type"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rg_navi_sound_type"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_navi_day_night"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="26dp"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_navi_day_night"
|
||||
>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_day"
|
||||
android:layout_marginRight="20dp"
|
||||
android:checked="true"
|
||||
android:text="@string/navi_prefer_day"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_night"
|
||||
android:layout_marginRight="20dp"
|
||||
|
||||
android:text="@string/navi_prefer_night"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_navi_auto"
|
||||
android:text="@string/navi_prefer_auto"
|
||||
style="@style/rb_setting"
|
||||
/>
|
||||
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,43 +8,12 @@
|
||||
android:paddingLeft="@dimen/dp_60"
|
||||
android:paddingRight="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_40"
|
||||
android:clickable="true"
|
||||
tools:context=".ui.search.SearchFragment"
|
||||
style="@style/amap_fragment_container_padding_style"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_navi_search"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:id="@+id/iv_navi_back"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:src="@mipmap/icon_back"
|
||||
/>
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/et_navi_search"
|
||||
android:background="@null"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:imeOptions="actionDone"
|
||||
android:hint="@string/hint_map_search"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white_60"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/include_search_bar" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
@@ -65,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"
|
||||
@@ -82,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"
|
||||
@@ -136,6 +106,7 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:padding="@dimen/dp_37"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_navi_wash"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/dp_60"
|
||||
android:paddingLeft="@dimen/dp_60"
|
||||
android:paddingRight="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_40"
|
||||
>
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cv_search_result"
|
||||
android:layout_width="@dimen/dp_838"
|
||||
android:layout_height="@dimen/dp_778"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_navi_search"
|
||||
app:cardBackgroundColor="#3F4057"
|
||||
app:cardCornerRadius="@dimen/dp_16"
|
||||
>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_search_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_navi_navi"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="@dimen/dp_40"
|
||||
android:text="@string/navi_to_there"
|
||||
android:layout_height="@dimen/dp_104"
|
||||
style="@style/txt_btn"
|
||||
/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<include layout="@layout/include_search_bar" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:paddingBottom="@dimen/dp_60"
|
||||
android:paddingLeft="@dimen/dp_60"
|
||||
android:paddingRight="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_40"
|
||||
>
|
||||
|
||||
<include layout="@layout/include_search_bar" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="180dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:textSize="@dimen/sp_40"
|
||||
android:textColor="@color/white"
|
||||
android:paddingLeft="@dimen/dp_56"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:text="@string/my_location_search"
|
||||
android:drawablePadding="@dimen/dp_8"
|
||||
android:id="@+id/tv_navi_my_location"
|
||||
android:drawableLeft="@mipmap/icon_navi_location"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_navi_search"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="180dp"
|
||||
android:id="@+id/tv_navi_choose_point"
|
||||
android:textSize="@dimen/sp_40"
|
||||
app:layout_constraintLeft_toRightOf="@id/tv_navi_my_location"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_navi_my_location"
|
||||
android:textColor="@color/white"
|
||||
android:paddingLeft="@dimen/dp_56"
|
||||
android:drawablePadding="@dimen/dp_8"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:text="@string/choose_location_search"
|
||||
android:drawableLeft="@mipmap/icon_navi_location"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_set_address"
|
||||
app:constraint_referenced_ids="tv_navi_choose_point,tv_navi_my_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_266"
|
||||
android:text="@string/set_as_home_navi"
|
||||
android:layout_marginRight="@dimen/dp_8"
|
||||
android:gravity="center"
|
||||
android:id="@+id/tv_set_as_home"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone"
|
||||
android:textSize="@dimen/sp_40"
|
||||
android:background="@drawable/shape_round_blue_grident"
|
||||
app:layout_constraintRight_toRightOf="@+id/ll_navi_search"
|
||||
app:layout_constraintTop_toTopOf="@+id/ll_navi_search"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ll_navi_search"
|
||||
android:layout_height="@dimen/dp_104"/>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="@dimen/dp_838"
|
||||
android:id="@+id/rv_search_result"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="@dimen/dp_37"
|
||||
android:paddingRight="@dimen/dp_37"
|
||||
android:layout_marginTop="@dimen/dp_32"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_navi_search"
|
||||
android:layout_height="@dimen/dp_778"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll_navi_search"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:showIn="@layout/fragment_search"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:id="@+id/iv_navi_back"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:src="@mipmap/icon_back"
|
||||
/>
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/et_navi_search"
|
||||
android:background="@null"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:imeOptions="actionDone"
|
||||
android:hint="@string/hint_map_search"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white_60"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/selector_item_category_background"
|
||||
android:layout_height="@dimen/dp_226">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amap_calculate_item_strategy_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:layout_marginTop="@dimen/dp_26"
|
||||
android:background="@drawable/amap_calculate_navi_strategy_name_bkg"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="8.5dp"
|
||||
android:paddingRight="8.5dp"
|
||||
android:textColor="#ccffffff"
|
||||
android:textSize="@dimen/sp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="距离最短" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amap_calculate_item_strategy_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginTop="4.5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_50"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/amap_calculate_item_strategy_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/amap_calculate_item_strategy_name"
|
||||
tools:text="40小时55分" />
|
||||
|
||||
<View
|
||||
android:id="@+id/amap_calculate_item_strategy_divider"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:background="@color/white_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/amap_calculate_item_strategy_time"
|
||||
app:layout_constraintLeft_toRightOf="@+id/amap_calculate_item_strategy_time"
|
||||
app:layout_constraintTop_toTopOf="@+id/amap_calculate_item_strategy_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amap_calculate_item_strategy_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:autoSizeMaxTextSize="25dp"
|
||||
android:autoSizeMinTextSize="18dp"
|
||||
android:autoSizeStepGranularity="1dp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_50"
|
||||
app:layout_constraintLeft_toRightOf="@+id/amap_calculate_item_strategy_divider"
|
||||
app:layout_constraintTop_toTopOf="@+id/amap_calculate_item_strategy_time"
|
||||
tools:text="2000.5公里" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amap_calculate_item_strategy_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginTop="2dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white_80"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/amap_calculate_item_strategy_time"
|
||||
app:layout_constraintTop_toBottomOf="@+id/amap_calculate_item_strategy_time"
|
||||
tools:text="红绿灯4个 收费5元" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="#1a000000" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/selector_item_category_background"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_position"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
android:textColor="@color/white"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:textSize="@dimen/txt_normal"
|
||||
android:background="@drawable/selector_item_category_result"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_position"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintLeft_toRightOf="@id/iv_position"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_position_des"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_42"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white_60"
|
||||
android:textSize="@dimen/sp_30"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tv_position"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_position"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_2"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginLeft="@dimen/dp_110"
|
||||
android:background="@color/white_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_navi_sound_low.png
Executable file
|
After Width: | Height: | Size: 296 B |
BIN
modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_navi_sound_plus.png
Executable file
|
After Width: | Height: | Size: 506 B |
BIN
modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_pb_thumb.png
Executable file
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
BIN
modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_sound_high.png
Executable file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
modules/mogo-module-search/src/main/res/mipmap-xhdpi/icon_sound_low.png
Executable file
|
After Width: | Height: | Size: 1.2 KiB |
@@ -5,6 +5,7 @@
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
<color name="bg_gray_common_page">#ff080625</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="translate">#00000000</color>
|
||||
<color name="white_10">#1AFFFFFF</color>
|
||||
<color name="white_60">#99FFFFFF</color>
|
||||
<color name="white_80">#CCFFFFFF</color>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="tag_position" type="id"/>
|
||||
<item name="tag_item" type="id"/>
|
||||
</resources>
|
||||
@@ -16,4 +16,21 @@
|
||||
<string name="search_empty">暂无搜索结果</string>
|
||||
<string name="preference_navi">路线偏好</string>
|
||||
<string name="navi_prefer_jam">躲避拥堵</string>
|
||||
<string name="navi_prefer_fee">躲避收费</string>
|
||||
<string name="navi_prefer_high_way">高速优先</string>
|
||||
<string name="navi_prefer_no_high_way">不走高速</string>
|
||||
<string name="navi_setting_sound">播报音量</string>
|
||||
<string name="preference_navi_sound_type">播报偏好</string>
|
||||
<string name="navi_prefer_detail">详细播报</string>
|
||||
<string name="navi_prefer_draft">简洁播报</string>
|
||||
<string name="navi_prefer_day">白天</string>
|
||||
<string name="navi_prefer_night">夜间</string>
|
||||
<string name="navi_prefer_auto">自动</string>
|
||||
<string name="my_location_search">我的位置</string>
|
||||
<string name="choose_location_search">地图选点</string>
|
||||
<string name="set_as_home_navi">设为家</string>
|
||||
<string name="set_as_compony_navi">设为公司</string>
|
||||
<string name="navi_to_there">导航去这里</string>
|
||||
<string name="start_navi">开始导航</string>
|
||||
<string name="choose_path">路线选择</string>
|
||||
</resources>
|
||||
|
||||
@@ -34,6 +34,14 @@
|
||||
<item name="android:textSize">@dimen/sp_40</item>
|
||||
<item name="android:textColor">@color/selector_white_gray</item>
|
||||
<item name="android:layout_height">@dimen/dp_120</item>
|
||||
<item name="android:background">@drawable/selector_setting_bg</item>
|
||||
</style>
|
||||
|
||||
<style name="txt_btn">
|
||||
<item name="android:textColor">@color/white</item>
|
||||
<item name="android:textSize">@dimen/txt_title</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:background">@drawable/shape_round_blue_grident</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -356,7 +356,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mLastZoomLevel != zoom ) {
|
||||
if ( mLastZoomLevel != zoom || mCameraNorthEastPosition == null ) {
|
||||
refreshCameraPosition();
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
return distance > factor;
|
||||
} catch ( Exception e ) {
|
||||
Logger.w( TAG, "warming. ", e );
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@ dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomap
|
||||
@@ -55,10 +61,6 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
}
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation 'com.shuyu:gsyVideoPlayer-armv7a:7.1.1'
|
||||
implementation 'com.shuyu:gsyVideoPlayer-arm64:7.1.1'
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途搜索
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface AlongTheWayCallback {
|
||||
void onSuccess(InformationAndLiveCarResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通勤族回调
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface RoadLineCallback {
|
||||
void onSuccess(PathLineResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 声音控制搜索回调
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface VoiceSearchCallback {
|
||||
void onSuccess(VoiceSearchResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class HttpConst {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
|
||||
}
|
||||
@@ -9,5 +9,5 @@ package com.mogo.module.tanlu.constant;
|
||||
public class TanluConstants {
|
||||
|
||||
public static final String TAG = "/tanlu/ui";
|
||||
|
||||
public static final String NAVI_INFO = "navi_info";
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -13,11 +14,24 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.BusRouteResult;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
import com.amap.api.services.route.DriveRouteResult;
|
||||
import com.amap.api.services.route.RideRouteResult;
|
||||
import com.amap.api.services.route.RouteSearch;
|
||||
import com.amap.api.services.route.WalkRouteResult;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.overlay.DrivingRouteOverlay;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -30,19 +44,40 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.service.entity.MarkerExploreWay;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.RefreshApiService;
|
||||
import com.mogo.module.service.network.RefreshBody;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
import com.mogo.module.tanlu.constant.HttpConst;
|
||||
import com.mogo.module.tanlu.model.Information;
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
import com.mogo.module.tanlu.net.TanluApiService;
|
||||
import com.mogo.module.tanlu.util.ActivityStatusUtil;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.module.tanlu.voice.VoiceController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.module.tanlu.model.event.MarkerInfo;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.module.tanlu.video.FullMediaActivity;
|
||||
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||
import com.mogo.module.tanlu.view.AutoZoomInImageView;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -50,8 +85,14 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.network.Utils.getSn;
|
||||
import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
|
||||
import static com.mogo.module.tanlu.util.Utils.handleDistance;
|
||||
import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
@@ -77,6 +118,14 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private IMogoMarker mPoiMarker;
|
||||
private IMogoMarkerManager mMarkerManager;
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoSocketManager mMogoSocketManager;
|
||||
private IMogoLocationClient mLocationClient;
|
||||
|
||||
//声音控制文字
|
||||
private String voiceGetInfoMationTts;
|
||||
private String[] searchingVoiceStrings;
|
||||
private String[] searchfaileVoiceStrings;
|
||||
|
||||
//media
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private String mVideoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8";
|
||||
@@ -94,6 +143,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private List<MarkerExploreWay> markerExploreWayList = new ArrayList<>();
|
||||
private int currentPosition = 0; //卡片媒体当前位置
|
||||
private Bitmap mMarkerIcon;
|
||||
private TanluModelData mTanluModelData;
|
||||
private List<MogoLatLng> passedByPoints;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -145,6 +196,27 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
EventBus.getDefault().register(this);
|
||||
mTanluModelData = new TanluModelData(getContext());
|
||||
handleRoadLineMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理路线数据信息 TODO
|
||||
*/
|
||||
private void handleRoadLineMessage() {
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoSocketManager.registerOnMessageListener(401001, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
@Override
|
||||
public Class<MarkerResponse> target() {
|
||||
return MarkerResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e(TAG, "onMsgReceived obj= " + obj);
|
||||
getRoadLineData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,7 +494,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收到对应数据打点
|
||||
* 接收到分享对应数据打点
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@@ -456,6 +528,159 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航路线数据事件
|
||||
*/
|
||||
public void getNavigationLineData() {
|
||||
Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
mTanluModelData.getNavigationLineData(lon, lat, new AlongTheWayCallback() {
|
||||
@Override
|
||||
public void onSuccess(InformationAndLiveCarResult data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通勤族 事件,监听消息自己请求路线数据
|
||||
*/
|
||||
public void getRoadLineData() {
|
||||
mTanluModelData.getRoadLineData(new RoadLineCallback() {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
//绘制线路线
|
||||
if (o != null && o.getPointList() != null && o.getPointList().size() > 0) {
|
||||
int intervalNum = Utils.getIntervalValue(o.getPointList().size());
|
||||
Logger.d(TAG, "intervalNum = $intervalNum -- pointList.size = ${pointList.size}");
|
||||
int listSize = o.getPointList().size();
|
||||
|
||||
//沿途最多15个点
|
||||
for (int i = 0; i < listSize; i += intervalNum) {
|
||||
passedByPoints.add(new MogoLatLng(o.getPointList().get(i).getLat(), (o.getPointList().get(i).getLon())));
|
||||
}
|
||||
|
||||
Logger.d(TAG, "passedByPoints.size() ----> " + passedByPoints.size());
|
||||
MogoLatLng startLatLng = new MogoLatLng(o.getPointList().get(0).getLat(), o.getPointList().get(0).getLon());
|
||||
MogoLatLng endLatLng = new MogoLatLng(o.getPointList().get(listSize - 1).getLat(), o.getPointList().get(listSize - 1).getLon());
|
||||
|
||||
mMarkerManager.addRouteWay(getContext(), startLatLng, endLatLng, passedByPoints);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 声音控制道理数据
|
||||
*/
|
||||
public void getVoiceControlRoadData(String keywords) {
|
||||
Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
String cityCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getCityCode();
|
||||
String adCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getAdCode();
|
||||
mTanluModelData.getVoiceControlRoadData(keywords, cityCode, lon, lat, adCode, new VoiceSearchCallback() {
|
||||
@Override
|
||||
public void onSuccess(VoiceSearchResult o) {
|
||||
String discription = o.getDescription();
|
||||
Logger.d(TAG, "discription = " + discription);
|
||||
if (o.getInformations() != null && o.getInformations().size() > 0) {
|
||||
speakSuccessVoice(o.getInformations(), discription == null ? "" : discription);
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(discription)) {
|
||||
// VoiceController.speakVoice(discription);
|
||||
} else {
|
||||
// VoiceController.speakVoice("未找到其他车主分享的路况信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void speakSuccessVoice(List<Information> informations, String trafficStatus) {
|
||||
// switch (informations.size()) {
|
||||
// case 0:
|
||||
// speakFailVoice();
|
||||
// break;
|
||||
//
|
||||
// case 1:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "1"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
// case 2:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "2"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
//
|
||||
// case 3:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "3"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
// default:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "多"
|
||||
// ) + trafficStatus);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
private void initStrings() {
|
||||
voiceGetInfoMationTts =
|
||||
getContext().getResources().getString(R.string.voice_get_informations_tts);
|
||||
searchingVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.searching_voice_string_array);
|
||||
searchfaileVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.search_fail_voice_array);
|
||||
}
|
||||
|
||||
private void speakFailVoice(String string) {
|
||||
// VoiceController.speakVoice(string);
|
||||
trackVoiceSearch(2);
|
||||
}
|
||||
|
||||
//上报语音搜索
|
||||
private void trackVoiceSearch(int type) {
|
||||
// trackNormalEvent(
|
||||
// CarNet_Voice_Search, mutableMapOf("type" to type, "searchtext" to keywords, "inputlon" to inputLon,
|
||||
// "inputlat" to inputLat, "datalon" to dataLon, "datalat" to dataLat),
|
||||
// BaseApplication.getAppContext()
|
||||
// )
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class TanluCardViewProvider implements IMogoModuleProvider {
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
TanluServiceHandler.init( context );
|
||||
Logger.d(TAG, "init ----------> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.BusPath;
|
||||
import com.amap.api.services.route.BusStep;
|
||||
import com.amap.api.services.route.RouteBusLineItem;
|
||||
import com.amap.api.services.route.RouteRailwayItem;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class AMapUtil {
|
||||
/**
|
||||
* 判断edittext是否null
|
||||
*/
|
||||
public static String checkEditText(EditText editText) {
|
||||
if (editText != null && editText.getText() != null
|
||||
&& !(editText.getText().toString().trim().equals(""))) {
|
||||
return editText.getText().toString().trim();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Spanned stringToSpan(String src) {
|
||||
return src == null ? null : Html.fromHtml(src.replace("\n", "<br />"));
|
||||
}
|
||||
|
||||
public static String colorFont(String src, String color) {
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
|
||||
strBuf.append("<font color=").append(color).append(">").append(src)
|
||||
.append("</font>");
|
||||
return strBuf.toString();
|
||||
}
|
||||
|
||||
public static String makeHtmlNewLine() {
|
||||
return "<br />";
|
||||
}
|
||||
|
||||
public static String makeHtmlSpace(int number) {
|
||||
final String space = " ";
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < number; i++) {
|
||||
result.append(space);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String getFriendlyLength(int lenMeter) {
|
||||
if (lenMeter > 10000) // 10 km
|
||||
{
|
||||
int dis = lenMeter / 1000;
|
||||
return dis + ChString.Kilometer;
|
||||
}
|
||||
|
||||
if (lenMeter > 1000) {
|
||||
float dis = (float) lenMeter / 1000;
|
||||
DecimalFormat fnum = new DecimalFormat("##0.0");
|
||||
String dstr = fnum.format(dis);
|
||||
return dstr + ChString.Kilometer;
|
||||
}
|
||||
|
||||
if (lenMeter > 100) {
|
||||
int dis = lenMeter / 50 * 50;
|
||||
return dis + ChString.Meter;
|
||||
}
|
||||
|
||||
int dis = lenMeter / 10 * 10;
|
||||
if (dis == 0) {
|
||||
dis = 10;
|
||||
}
|
||||
|
||||
return dis + ChString.Meter;
|
||||
}
|
||||
|
||||
public static boolean IsEmptyOrNullString(String s) {
|
||||
return (s == null) || (s.trim().length() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把LatLng对象转化为LatLonPoint对象
|
||||
*/
|
||||
public static LatLonPoint convertToLatLonPoint(LatLng latlon) {
|
||||
return new LatLonPoint(latlon.latitude, latlon.longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把LatLonPoint对象转化为LatLon对象
|
||||
*/
|
||||
public static LatLng convertToLatLng(LatLonPoint latLonPoint) {
|
||||
return new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude());
|
||||
}
|
||||
|
||||
/**
|
||||
* 把集合体的LatLonPoint转化为集合体的LatLng
|
||||
*/
|
||||
public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) {
|
||||
ArrayList<LatLng> lineShapes = new ArrayList<LatLng>();
|
||||
for (LatLonPoint point : shapes) {
|
||||
LatLng latLngTemp = AMapUtil.convertToLatLng(point);
|
||||
lineShapes.add(latLngTemp);
|
||||
}
|
||||
return lineShapes;
|
||||
}
|
||||
|
||||
/**
|
||||
* long类型时间格式化
|
||||
*/
|
||||
public static String convertToTime(long time) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date(time);
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
public static final String HtmlBlack = "#000000";
|
||||
public static final String HtmlGray = "#808080";
|
||||
|
||||
public static String getFriendlyTime(int second) {
|
||||
if (second > 3600) {
|
||||
int hour = second / 3600;
|
||||
int miniate = (second % 3600) / 60;
|
||||
return hour + "小时" + miniate + "分钟";
|
||||
}
|
||||
if (second >= 60) {
|
||||
int miniate = second / 60;
|
||||
return miniate + "分钟";
|
||||
}
|
||||
return second + "秒";
|
||||
}
|
||||
|
||||
//路径规划方向指示和图片对应
|
||||
public static int getDriveActionID(String actionName) {
|
||||
if (actionName == null || actionName.equals("")) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("左转".equals(actionName)) {
|
||||
return R.drawable.dir2;
|
||||
}
|
||||
if ("右转".equals(actionName)) {
|
||||
return R.drawable.dir1;
|
||||
}
|
||||
if ("向左前方行驶".equals(actionName) || "靠左".equals(actionName)) {
|
||||
return R.drawable.dir6;
|
||||
}
|
||||
if ("向右前方行驶".equals(actionName) || "靠右".equals(actionName)) {
|
||||
return R.drawable.dir5;
|
||||
}
|
||||
if ("向左后方行驶".equals(actionName) || "左转调头".equals(actionName)) {
|
||||
return R.drawable.dir7;
|
||||
}
|
||||
if ("向右后方行驶".equals(actionName)) {
|
||||
return R.drawable.dir8;
|
||||
}
|
||||
if ("直行".equals(actionName)) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("减速行驶".equals(actionName)) {
|
||||
return R.drawable.dir4;
|
||||
}
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
|
||||
public static int getWalkActionID(String actionName) {
|
||||
if (actionName == null || actionName.equals("")) {
|
||||
return R.drawable.dir13;
|
||||
}
|
||||
if ("左转".equals(actionName)) {
|
||||
return R.drawable.dir2;
|
||||
}
|
||||
if ("右转".equals(actionName)) {
|
||||
return R.drawable.dir1;
|
||||
}
|
||||
if ("向左前方".equals(actionName) || "靠左".equals(actionName) || actionName.contains("向左前方")) {
|
||||
return R.drawable.dir6;
|
||||
}
|
||||
if ("向右前方".equals(actionName) || "靠右".equals(actionName) || actionName.contains("向右前方")) {
|
||||
return R.drawable.dir5;
|
||||
}
|
||||
if ("向左后方".equals(actionName) || actionName.contains("向左后方")) {
|
||||
return R.drawable.dir7;
|
||||
}
|
||||
if ("向右后方".equals(actionName) || actionName.contains("向右后方")) {
|
||||
return R.drawable.dir8;
|
||||
}
|
||||
if ("直行".equals(actionName)) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("通过人行横道".equals(actionName)) {
|
||||
return R.drawable.dir9;
|
||||
}
|
||||
if ("通过过街天桥".equals(actionName)) {
|
||||
return R.drawable.dir11;
|
||||
}
|
||||
if ("通过地下通道".equals(actionName)) {
|
||||
return R.drawable.dir10;
|
||||
}
|
||||
|
||||
return R.drawable.dir13;
|
||||
}
|
||||
|
||||
public static String getBusPathTitle(BusPath busPath) {
|
||||
if (busPath == null) {
|
||||
return String.valueOf("");
|
||||
}
|
||||
List<BusStep> busSetps = busPath.getSteps();
|
||||
if (busSetps == null) {
|
||||
return String.valueOf("");
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (BusStep busStep : busSetps) {
|
||||
StringBuffer title = new StringBuffer();
|
||||
if (busStep.getBusLines().size() > 0) {
|
||||
for (RouteBusLineItem busline : busStep.getBusLines()) {
|
||||
if (busline == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String buslineName = getSimpleBusLineName(busline.getBusLineName());
|
||||
title.append(buslineName);
|
||||
title.append(" / ");
|
||||
}
|
||||
// RouteBusLineItem busline = busStep.getBusLines().get(0);
|
||||
|
||||
sb.append(title.substring(0, title.length() - 3));
|
||||
sb.append(" > ");
|
||||
}
|
||||
if (busStep.getRailway() != null) {
|
||||
RouteRailwayItem railway = busStep.getRailway();
|
||||
sb.append(railway.getTrip() + "(" + railway.getDeparturestop().getName()
|
||||
+ " - " + railway.getArrivalstop().getName() + ")");
|
||||
sb.append(" > ");
|
||||
}
|
||||
}
|
||||
return sb.substring(0, sb.length() - 3);
|
||||
}
|
||||
|
||||
public static String getBusPathDes(BusPath busPath) {
|
||||
if (busPath == null) {
|
||||
return String.valueOf("");
|
||||
}
|
||||
long second = busPath.getDuration();
|
||||
String time = getFriendlyTime((int) second);
|
||||
float subDistance = busPath.getDistance();
|
||||
String subDis = getFriendlyLength((int) subDistance);
|
||||
float walkDistance = busPath.getWalkDistance();
|
||||
String walkDis = getFriendlyLength((int) walkDistance);
|
||||
return String.valueOf(time + " | " + subDis + " | 步行" + walkDis);
|
||||
}
|
||||
|
||||
public static String getSimpleBusLineName(String busLineName) {
|
||||
if (busLineName == null) {
|
||||
return String.valueOf("");
|
||||
}
|
||||
return busLineName.replaceAll("\\(.*?\\)", "");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
public class ChString {
|
||||
public static final String Kilometer = "\u516c\u91cc";// "公里";
|
||||
public static final String Meter = "\u7c73";// "米";
|
||||
public static final String ByFoot = "\u6b65\u884c";// "步行";
|
||||
public static final String To = "\u53bb\u5f80";// "去往";
|
||||
public static final String Station = "\u8f66\u7ad9";// "车站";
|
||||
public static final String TargetPlace = "\u76ee\u7684\u5730";// "目的地";
|
||||
public static final String StartPlace = "\u51fa\u53d1\u5730";// "出发地";
|
||||
public static final String About = "\u5927\u7ea6";// "大约";
|
||||
public static final String Direction = "\u65b9\u5411";// "方向";
|
||||
|
||||
public static final String GetOn = "\u4e0a\u8f66";// "上车";
|
||||
public static final String GetOff = "\u4e0b\u8f66";// "下车";
|
||||
public static final String Zhan = "\u7ad9";// "站";
|
||||
|
||||
public static final String cross = "\u4ea4\u53c9\u8def\u53e3"; // 交叉路口
|
||||
public static final String type = "\u7c7b\u522b"; // 类别
|
||||
public static final String address = "\u5730\u5740"; // 地址
|
||||
public static final String PrevStep = "\u4e0a\u4e00\u6b65";
|
||||
public static final String NextStep = "\u4e0b\u4e00\u6b65";
|
||||
public static final String Gong = "\u516c\u4ea4";
|
||||
public static final String ByBus = "\u4e58\u8f66";
|
||||
public static final String Arrive = "\u5230\u8FBE";// 到达
|
||||
}
|
||||
@@ -1,384 +0,0 @@
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.model.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
import com.amap.api.services.route.DriveStep;
|
||||
import com.amap.api.services.route.TMC;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 导航路线图层类
|
||||
*/
|
||||
public class DrivingRouteOverlay extends RouteOverlay {
|
||||
private DrivePath drivePath;
|
||||
private List<LatLonPoint> throughPointList;
|
||||
private List<Marker> throughPointMarkerList = new ArrayList<Marker>();
|
||||
private boolean throughPointMarkerVisible = true;
|
||||
private List<TMC> tmcs;
|
||||
private PolylineOptions mPolylineOptions;
|
||||
private PolylineOptions mPolylineOptionscolor;
|
||||
private Context mContext;
|
||||
private boolean isColorfulline = true;
|
||||
private float mWidth = 4;
|
||||
private List<LatLng> mLatLngsOfPath;
|
||||
|
||||
public void setIsColorfulline(boolean iscolorfulline) {
|
||||
this.isColorfulline = iscolorfulline;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据给定的参数,构造一个导航路线图层类对象。
|
||||
*
|
||||
* @param amap 地图对象。
|
||||
* @param path 导航路线规划方案。
|
||||
* @param context 当前的activity对象。
|
||||
*/
|
||||
public DrivingRouteOverlay(Context context, AMap amap, DrivePath path,
|
||||
LatLonPoint start, LatLonPoint end, List<LatLonPoint> throughPointList) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mAMap = amap;
|
||||
this.drivePath = path;
|
||||
startPoint = AMapUtil.convertToLatLng(start);
|
||||
endPoint = AMapUtil.convertToLatLng(end);
|
||||
this.throughPointList = throughPointList;
|
||||
|
||||
initBitmapDescriptor();
|
||||
}
|
||||
|
||||
public float getRouteWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置路线宽度
|
||||
*
|
||||
* @param mWidth 路线宽度,取值范围:大于0
|
||||
*/
|
||||
public void setRouteWidth(float mWidth) {
|
||||
this.mWidth = mWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加驾车路线添加到地图上显示。
|
||||
*/
|
||||
public void addToMap() {
|
||||
initPolylineOptions();
|
||||
try {
|
||||
if (mAMap == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mWidth == 0 || drivePath == null) {
|
||||
return;
|
||||
}
|
||||
mLatLngsOfPath = new ArrayList<LatLng>();
|
||||
tmcs = new ArrayList<TMC>();
|
||||
List<DriveStep> drivePaths = drivePath.getSteps();
|
||||
mPolylineOptions.add(startPoint);
|
||||
for (int i = 0; i < drivePaths.size(); i++) {
|
||||
DriveStep step = drivePaths.get(i);
|
||||
List<LatLonPoint> latlonPoints = step.getPolyline();
|
||||
List<TMC> tmclist = step.getTMCs();
|
||||
tmcs.addAll(tmclist);
|
||||
addDrivingStationMarkers(step, convertToLatLng(latlonPoints.get(0)));
|
||||
for (LatLonPoint latlonpoint : latlonPoints) {
|
||||
mPolylineOptions.add(convertToLatLng(latlonpoint));
|
||||
mLatLngsOfPath.add(convertToLatLng(latlonpoint));
|
||||
}
|
||||
}
|
||||
mPolylineOptions.add(endPoint);
|
||||
if (startMarker != null) {
|
||||
startMarker.remove();
|
||||
startMarker = null;
|
||||
}
|
||||
|
||||
if (endMarker != null) {
|
||||
endMarker.remove();
|
||||
endMarker = null;
|
||||
}
|
||||
// addStartAndEndMarker();
|
||||
// addThroughPointMarker();
|
||||
if (isColorfulline && tmcs.size() > 0) {
|
||||
colorWayUpdate(tmcs);
|
||||
showcolorPolyline();
|
||||
} else {
|
||||
showPolyline();
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化线段属性
|
||||
*/
|
||||
private void initPolylineOptions() {
|
||||
mPolylineOptions = null;
|
||||
mPolylineOptions = new PolylineOptions();
|
||||
mPolylineOptions.color(getDriveColor()).width(getRouteWidth());
|
||||
}
|
||||
|
||||
private void showPolyline() {
|
||||
addPolyLine(mPolylineOptions);
|
||||
}
|
||||
|
||||
private void showcolorPolyline() {
|
||||
addPolyLine(mPolylineOptionscolor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据不同的路段拥堵情况展示不同的颜色
|
||||
*
|
||||
* @param tmcSection
|
||||
*/
|
||||
private void colorWayUpdate(List<TMC> tmcSection) {
|
||||
if (mAMap == null) {
|
||||
return;
|
||||
}
|
||||
if (tmcSection == null || tmcSection.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
TMC segmentTrafficStatus;
|
||||
mPolylineOptionscolor = null;
|
||||
mPolylineOptionscolor = new PolylineOptions();
|
||||
mPolylineOptionscolor.width(getRouteWidth());
|
||||
List<Integer> colorList = new ArrayList<Integer>();
|
||||
List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();
|
||||
List<LatLng> points = new ArrayList<>();
|
||||
List<Integer> texIndexList = new ArrayList<Integer>();
|
||||
// mPolylineOptionscolor.add(startPoint);
|
||||
// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
|
||||
|
||||
points.add(startPoint);
|
||||
points.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
|
||||
colorList.add(getDriveColor());
|
||||
bitmapDescriptors.add(defaultRoute);
|
||||
|
||||
BitmapDescriptor bitmapDescriptor = null;
|
||||
int textIndex = 0;
|
||||
texIndexList.add(textIndex);
|
||||
texIndexList.add(++textIndex);
|
||||
for (int i = 0; i < tmcSection.size(); i++) {
|
||||
segmentTrafficStatus = tmcSection.get(i);
|
||||
int color = getcolor(segmentTrafficStatus.getStatus());
|
||||
bitmapDescriptor = getTrafficBitmapDescriptor(segmentTrafficStatus.getStatus());
|
||||
List<LatLonPoint> mployline = segmentTrafficStatus.getPolyline();
|
||||
for (int j = 0; j < mployline.size(); j++) {
|
||||
// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(mployline.get(j)));
|
||||
points.add(AMapUtil.convertToLatLng(mployline.get(j)));
|
||||
colorList.add(color);
|
||||
|
||||
texIndexList.add(++textIndex);
|
||||
bitmapDescriptors.add(bitmapDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
points.add(endPoint);
|
||||
colorList.add(getDriveColor());
|
||||
bitmapDescriptors.add(defaultRoute);
|
||||
texIndexList.add(++textIndex);
|
||||
mPolylineOptionscolor.addAll(points);
|
||||
mPolylineOptionscolor.colorValues(colorList);
|
||||
|
||||
// mPolylineOptionscolor.setCustomTextureIndex(texIndexList);
|
||||
// mPolylineOptionscolor.setCustomTextureList(bitmapDescriptors);
|
||||
}
|
||||
|
||||
private BitmapDescriptor defaultRoute = null;
|
||||
private BitmapDescriptor unknownTraffic = null;
|
||||
private BitmapDescriptor smoothTraffic = null;
|
||||
private BitmapDescriptor slowTraffic = null;
|
||||
private BitmapDescriptor jamTraffic = null;
|
||||
private BitmapDescriptor veryJamTraffic = null;
|
||||
|
||||
private void initBitmapDescriptor() {
|
||||
defaultRoute = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_6_arrow);
|
||||
smoothTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_4_arrow);
|
||||
unknownTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_0_arrow);
|
||||
slowTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_3_arrow);
|
||||
jamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_2_arrow);
|
||||
veryJamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_9_arrow);
|
||||
}
|
||||
|
||||
private BitmapDescriptor getTrafficBitmapDescriptor(String status) {
|
||||
if (status.equals("畅通")) {
|
||||
return smoothTraffic;
|
||||
} else if (status.equals("缓行")) {
|
||||
return slowTraffic;
|
||||
} else if (status.equals("拥堵")) {
|
||||
return jamTraffic;
|
||||
} else if (status.equals("严重拥堵")) {
|
||||
return veryJamTraffic;
|
||||
} else {
|
||||
return defaultRoute;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int getcolor(String status) {
|
||||
if (status.equals("畅通")) {
|
||||
return Color.GREEN;
|
||||
} else if (status.equals("缓行")) {
|
||||
return Color.YELLOW;
|
||||
} else if (status.equals("拥堵")) {
|
||||
return Color.RED;
|
||||
} else if (status.equals("严重拥堵")) {
|
||||
return Color.parseColor("#990033");
|
||||
} else {
|
||||
return Color.GREEN;
|
||||
}
|
||||
}
|
||||
|
||||
public LatLng convertToLatLng(LatLonPoint point) {
|
||||
return new LatLng(point.getLatitude(), point.getLongitude());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param driveStep
|
||||
* @param latLng
|
||||
*/
|
||||
private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
|
||||
addStationMarker(new MarkerOptions()
|
||||
.position(latLng)
|
||||
.title("\u65B9\u5411:" + driveStep.getAction()
|
||||
+ "\n\u9053\u8DEF:" + driveStep.getRoad())
|
||||
.snippet(driveStep.getInstruction()).visible(nodeIconVisible)
|
||||
.anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LatLngBounds getLatLngBounds() {
|
||||
LatLngBounds.Builder b = LatLngBounds.builder();
|
||||
b.include(new LatLng(startPoint.latitude, startPoint.longitude));
|
||||
b.include(new LatLng(endPoint.latitude, endPoint.longitude));
|
||||
if (this.throughPointList != null && this.throughPointList.size() > 0) {
|
||||
for (int i = 0; i < this.throughPointList.size(); i++) {
|
||||
b.include(new LatLng(
|
||||
this.throughPointList.get(i).getLatitude(),
|
||||
this.throughPointList.get(i).getLongitude()));
|
||||
}
|
||||
}
|
||||
return b.build();
|
||||
}
|
||||
|
||||
public void setThroughPointIconVisibility(boolean visible) {
|
||||
try {
|
||||
throughPointMarkerVisible = visible;
|
||||
if (this.throughPointMarkerList != null
|
||||
&& this.throughPointMarkerList.size() > 0) {
|
||||
for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
|
||||
this.throughPointMarkerList.get(i).setVisible(visible);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void addThroughPointMarker() {
|
||||
if (this.throughPointList != null && this.throughPointList.size() > 0) {
|
||||
LatLonPoint latLonPoint = null;
|
||||
for (int i = 0; i < this.throughPointList.size(); i++) {
|
||||
latLonPoint = this.throughPointList.get(i);
|
||||
if (latLonPoint != null) {
|
||||
throughPointMarkerList.add(mAMap
|
||||
.addMarker((new MarkerOptions())
|
||||
.position(
|
||||
new LatLng(latLonPoint
|
||||
.getLatitude(), latLonPoint
|
||||
.getLongitude()))
|
||||
.visible(throughPointMarkerVisible)
|
||||
.icon(getThroughPointBitDes())
|
||||
.title("\u9014\u7ECF\u70B9")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BitmapDescriptor getThroughPointBitDes() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_through);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取两点间距离
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
public static int calculateDistance(LatLng start, LatLng end) {
|
||||
double x1 = start.longitude;
|
||||
double y1 = start.latitude;
|
||||
double x2 = end.longitude;
|
||||
double y2 = end.latitude;
|
||||
return calculateDistance(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public static int calculateDistance(double x1, double y1, double x2, double y2) {
|
||||
final double NF_pi = 0.01745329251994329; // 弧度 PI/180
|
||||
x1 *= NF_pi;
|
||||
y1 *= NF_pi;
|
||||
x2 *= NF_pi;
|
||||
y2 *= NF_pi;
|
||||
double sinx1 = Math.sin(x1);
|
||||
double siny1 = Math.sin(y1);
|
||||
double cosx1 = Math.cos(x1);
|
||||
double cosy1 = Math.cos(y1);
|
||||
double sinx2 = Math.sin(x2);
|
||||
double siny2 = Math.sin(y2);
|
||||
double cosx2 = Math.cos(x2);
|
||||
double cosy2 = Math.cos(y2);
|
||||
double[] v1 = new double[3];
|
||||
v1[0] = cosy1 * cosx1 - cosy2 * cosx2;
|
||||
v1[1] = cosy1 * sinx1 - cosy2 * sinx2;
|
||||
v1[2] = siny1 - siny2;
|
||||
double dist = Math.sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]);
|
||||
|
||||
return (int) (Math.asin(dist / 2) * 12742001.5798544);
|
||||
}
|
||||
|
||||
|
||||
//获取指定两点之间固定距离点
|
||||
public static LatLng getPointForDis(LatLng sPt, LatLng ePt, double dis) {
|
||||
double lSegLength = calculateDistance(sPt, ePt);
|
||||
double preResult = dis / lSegLength;
|
||||
return new LatLng((ePt.latitude - sPt.latitude) * preResult + sPt.latitude, (ePt.longitude - sPt.longitude) * preResult + sPt.longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉DriveLineOverlay上的线段和标记。
|
||||
*/
|
||||
@Override
|
||||
public void removeFromMap() {
|
||||
try {
|
||||
super.removeFromMap();
|
||||
if (this.throughPointMarkerList != null
|
||||
&& this.throughPointMarkerList.size() > 0) {
|
||||
for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
|
||||
this.throughPointMarkerList.get(i).remove();
|
||||
}
|
||||
this.throughPointMarkerList.clear();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
package com.mogo.module.tanlu.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.model.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.module.tanlu.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RouteOverlay {
|
||||
protected List<Marker> stationMarkers = new ArrayList<Marker>();
|
||||
protected List<Polyline> allPolyLines = new ArrayList<Polyline>();
|
||||
protected Marker startMarker;
|
||||
protected Marker endMarker;
|
||||
protected LatLng startPoint;
|
||||
protected LatLng endPoint;
|
||||
protected AMap mAMap;
|
||||
private Context mContext;
|
||||
private Bitmap startBit, endBit, busBit, walkBit, driveBit;
|
||||
protected boolean nodeIconVisible = true;
|
||||
|
||||
public RouteOverlay(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉BusRouteOverlay上所有的Marker。
|
||||
*
|
||||
* @since V2.1.0
|
||||
*/
|
||||
public void removeFromMap() {
|
||||
if (startMarker != null) {
|
||||
startMarker.remove();
|
||||
|
||||
}
|
||||
if (endMarker != null) {
|
||||
endMarker.remove();
|
||||
}
|
||||
for (Marker marker : stationMarkers) {
|
||||
marker.remove();
|
||||
}
|
||||
for (Polyline line : allPolyLines) {
|
||||
line.remove();
|
||||
}
|
||||
destroyBit();
|
||||
}
|
||||
|
||||
private void destroyBit() {
|
||||
if (startBit != null) {
|
||||
startBit.recycle();
|
||||
startBit = null;
|
||||
}
|
||||
if (endBit != null) {
|
||||
endBit.recycle();
|
||||
endBit = null;
|
||||
}
|
||||
if (busBit != null) {
|
||||
busBit.recycle();
|
||||
busBit = null;
|
||||
}
|
||||
if (walkBit != null) {
|
||||
walkBit.recycle();
|
||||
walkBit = null;
|
||||
}
|
||||
if (driveBit != null) {
|
||||
driveBit.recycle();
|
||||
driveBit = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 给起点Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
*
|
||||
* @return 更换的Marker图片。
|
||||
* @since V2.1.0
|
||||
*/
|
||||
protected BitmapDescriptor getStartBitmapDescriptor() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_start);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给终点Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
*
|
||||
* @return 更换的Marker图片。
|
||||
* @since V2.1.0
|
||||
*/
|
||||
protected BitmapDescriptor getEndBitmapDescriptor() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_end);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给公交Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
*
|
||||
* @return 更换的Marker图片。
|
||||
* @since V2.1.0
|
||||
*/
|
||||
protected BitmapDescriptor getBusBitmapDescriptor() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_bus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给步行Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
*
|
||||
* @return 更换的Marker图片。
|
||||
* @since V2.1.0
|
||||
*/
|
||||
protected BitmapDescriptor getWalkBitmapDescriptor() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_man);
|
||||
}
|
||||
|
||||
protected BitmapDescriptor getDriveBitmapDescriptor() {
|
||||
return BitmapDescriptorFactory.fromResource(R.drawable.amap_car);
|
||||
}
|
||||
|
||||
protected void addStartAndEndMarker() {
|
||||
startMarker = mAMap.addMarker((new MarkerOptions())
|
||||
.position(startPoint).icon(getStartBitmapDescriptor())
|
||||
.title("\u8D77\u70B9"));
|
||||
// startMarker.showInfoWindow();
|
||||
|
||||
endMarker = mAMap.addMarker((new MarkerOptions()).position(endPoint)
|
||||
.icon(getEndBitmapDescriptor()).title("\u7EC8\u70B9"));
|
||||
// mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint,
|
||||
// getShowRouteZoom()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动镜头到当前的视角。
|
||||
*
|
||||
* @since V2.1.0
|
||||
*/
|
||||
public void zoomToSpan() {
|
||||
if (startPoint != null) {
|
||||
if (mAMap == null)
|
||||
return;
|
||||
try {
|
||||
LatLngBounds bounds = getLatLngBounds();
|
||||
mAMap.animateCamera(CameraUpdateFactory
|
||||
.newLatLngBounds(bounds, 50));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected LatLngBounds getLatLngBounds() {
|
||||
LatLngBounds.Builder b = LatLngBounds.builder();
|
||||
b.include(new LatLng(startPoint.latitude, startPoint.longitude));
|
||||
b.include(new LatLng(endPoint.latitude, endPoint.longitude));
|
||||
for (Polyline polyline : allPolyLines) {
|
||||
for (LatLng point : polyline.getPoints()) {
|
||||
b.include(point);
|
||||
}
|
||||
}
|
||||
return b.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 路段节点图标控制显示接口。
|
||||
*
|
||||
* @param visible true为显示节点图标,false为不显示。
|
||||
* @since V2.3.1
|
||||
*/
|
||||
public void setNodeIconVisibility(boolean visible) {
|
||||
try {
|
||||
nodeIconVisible = visible;
|
||||
if (this.stationMarkers != null && this.stationMarkers.size() > 0) {
|
||||
for (int i = 0; i < this.stationMarkers.size(); i++) {
|
||||
this.stationMarkers.get(i).setVisible(visible);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void addStationMarker(MarkerOptions options) {
|
||||
if (options == null) {
|
||||
return;
|
||||
}
|
||||
Marker marker = mAMap.addMarker(options);
|
||||
if (marker != null) {
|
||||
stationMarkers.add(marker);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void addPolyLine(PolylineOptions options) {
|
||||
if (options == null) {
|
||||
return;
|
||||
}
|
||||
Polyline polyline = mAMap.addPolyline(options);
|
||||
if (polyline != null) {
|
||||
allPolyLines.add(polyline);
|
||||
}
|
||||
}
|
||||
|
||||
protected float getRouteWidth() {
|
||||
return 18f;
|
||||
}
|
||||
|
||||
protected int getWalkColor() {
|
||||
return Color.parseColor("#6db74d");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义路线颜色。
|
||||
* return 自定义路线颜色。
|
||||
*
|
||||
* @since V2.2.1
|
||||
*/
|
||||
protected int getBusColor() {
|
||||
return Color.parseColor("#537edc");
|
||||
}
|
||||
|
||||
protected int getDriveColor() {
|
||||
return Color.parseColor("#537edc");
|
||||
}
|
||||
|
||||
// protected int getShowRouteZoom() {
|
||||
// return 15;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class End {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
|
||||
public End(Double lat, Double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class InformationAndLiveCarResult extends BaseData {
|
||||
private Result onTheWayData;
|
||||
private Result infoMationResult;
|
||||
private Sns snResult;
|
||||
|
||||
public Result getOnTheWayData() {
|
||||
return onTheWayData;
|
||||
}
|
||||
|
||||
public void setOnTheWayData(Result onTheWayData) {
|
||||
this.onTheWayData = onTheWayData;
|
||||
}
|
||||
|
||||
public Result getInfoMationResult() {
|
||||
return infoMationResult;
|
||||
}
|
||||
|
||||
public void setInfoMationResult(Result infoMationResult) {
|
||||
this.infoMationResult = infoMationResult;
|
||||
}
|
||||
|
||||
public Sns getSnResult() {
|
||||
return snResult;
|
||||
}
|
||||
|
||||
public void setSnResult(Sns snResult) {
|
||||
this.snResult = snResult;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-11-20
|
||||
*
|
||||
* 根据范围请求情报+在线车机结果
|
||||
*/
|
||||
data class InformationAndLiveCarResult(
|
||||
var onTheWayData: Result,
|
||||
var infoMationResult: Result,
|
||||
var snResult: Sns
|
||||
) {
|
||||
fun getInformation(): Result = if (onTheWayData == null
|
||||
|| onTheWayData.informations == null
|
||||
|| onTheWayData.informations.isEmpty()
|
||||
) infoMationResult else onTheWayData
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
class LocationCarsWithRadius {
|
||||
var coordinates: List<Double>
|
||||
var radius: Int
|
||||
var type: String
|
||||
var keyWord: String? = null
|
||||
|
||||
constructor(coordinates: List<Double>, radius: Int, type: String, keyWord: String) {
|
||||
this.coordinates = coordinates
|
||||
this.radius = radius
|
||||
this.type = type
|
||||
this.keyWord = keyWord
|
||||
}
|
||||
|
||||
constructor(coordinates: List<Double>, radius: Int, type: String) {
|
||||
this.coordinates = coordinates
|
||||
this.radius = radius
|
||||
this.type = type
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class NaviLatLng {
|
||||
public Start start;
|
||||
public End end;
|
||||
|
||||
NaviLatLng(Start start, End end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class NaviLatLngInfo implements Serializable {
|
||||
public String FromPoiLatitude = "";
|
||||
public String FromPoiLongitude = "";
|
||||
public String ToPoiLatitude = "";
|
||||
public String ToPoiLongitude= "";
|
||||
|
||||
// public Start fromStart() {
|
||||
// return Start(Double.parseDouble(FromPoiLatitude), Double.parseDouble(FromPoiLongitude));
|
||||
// }
|
||||
//
|
||||
// public End toEnd() {
|
||||
// return End(ToPoiLatitude.toDouble(), ToPoiLongitude.toDouble());
|
||||
// }
|
||||
|
||||
public String getFromPoiLatitude() {
|
||||
return FromPoiLatitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLatitude(String fromPoiLatitude) {
|
||||
FromPoiLatitude = fromPoiLatitude;
|
||||
}
|
||||
|
||||
public String getFromPoiLongitude() {
|
||||
return FromPoiLongitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLongitude(String fromPoiLongitude) {
|
||||
FromPoiLongitude = fromPoiLongitude;
|
||||
}
|
||||
|
||||
public String getToPoiLatitude() {
|
||||
return ToPoiLatitude;
|
||||
}
|
||||
|
||||
public void setToPoiLatitude(String toPoiLatitude) {
|
||||
ToPoiLatitude = toPoiLatitude;
|
||||
}
|
||||
|
||||
public String getToPoiLongitude() {
|
||||
return ToPoiLongitude;
|
||||
}
|
||||
|
||||
public void setToPoiLongitude(String toPoiLongitude) {
|
||||
ToPoiLongitude = toPoiLongitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
fun NaviLatLngInfo.fromStart(): Start {
|
||||
return Start(FromPoiLatitude.toDouble(), FromPoiLongitude.toDouble())
|
||||
}
|
||||
|
||||
fun NaviLatLngInfo.toEnd(): End {
|
||||
return End(ToPoiLatitude.toDouble(), ToPoiLongitude.toDouble())
|
||||
}
|
||||
|
||||
class NaviLatLngInfo1 : Serializable {
|
||||
var FromPoiLatitude: String = ""
|
||||
var FromPoiLongitude: String = ""
|
||||
var ToPoiLatitude: String = ""
|
||||
var ToPoiLongitude: String = ""
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.module.tanlu.model
|
||||
|
||||
data class SearchOnlineInfo(
|
||||
val address: String,
|
||||
val cityId: String,
|
||||
val size: Int,
|
||||
// val radius: Int,
|
||||
val center: Center,
|
||||
val adcode: String
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class Start {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
|
||||
public Start(Double lat, Double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
import com.mogo.module.tanlu.constant.HttpConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.net.TanluApiService;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.network.Utils.getSn;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 探路接口数据处理
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public class TanluModelData {
|
||||
|
||||
private final Context mContext;
|
||||
private TanluApiService mTanluApiService;
|
||||
private static final String TAG = "TanluModelData";
|
||||
|
||||
public TanluModelData(Context context) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
mTanluApiService = network.create(TanluApiService.class, DebugConfig.getNetMode() == 3 ? HttpConst.HOST_PRODUCT : HttpConst.HOST_TEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 声音控制道理数据
|
||||
*/
|
||||
public void getVoiceControlRoadData(String keywords, String cityId, Double lon, Double lat,
|
||||
String adCode, final VoiceSearchCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
SearchOnlineInfo searchOnlineInfo = new SearchOnlineInfo(keywords, cityId, 50, new Center(lat, lon), adCode);
|
||||
String searchInformationStr = gson.toJson(searchOnlineInfo);
|
||||
|
||||
List<Double> list = new ArrayList<>();
|
||||
list.add(lon);
|
||||
list.add(lat);
|
||||
LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", getSn())
|
||||
.append("data", searchInformationStr)
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
mTanluApiService.searchOnLineInformation(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<VoiceSearchResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(VoiceSearchResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getVoiceControlRoadData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getVoiceControlRoadData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通勤族 事件,监听消息自己请求路线数据
|
||||
*/
|
||||
public void getRoadLineData(final RoadLineCallback callback) {
|
||||
if (mTanluApiService != null) {
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", getSn())
|
||||
.build();
|
||||
mTanluApiService.getRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getRoadLineData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getRoadLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导航路线数据事件
|
||||
*/
|
||||
public void getNavigationLineData(Double lon, Double lat, final AlongTheWayCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
// NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
|
||||
|
||||
List<Double> list = new ArrayList<>();
|
||||
list.add(lon);
|
||||
list.add(lat);
|
||||
LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
// .append("onTheWayData", gson.toJson(coordinates))
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
|
||||
mTanluApiService.requestInformationAlongTheWay(getSn(), params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<InformationAndLiveCarResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(InformationAndLiveCarResult data) {
|
||||
super.onSuccess(data);
|
||||
callback.onSuccess(data);
|
||||
Logger.d(TAG, "getNavigationLineData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNavigationLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//获取Location,如果没有location数据为空,则使用首次或者上次定位点,并且更新SP,需要抽取公共方法
|
||||
public NaviLatLngInfo getNaviInfo(Double lon, Double lat) {
|
||||
String naviInfo = SharedPrefsMgr.getInstance(mContext).getString(TanluConstants.NAVI_INFO);
|
||||
Log.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
|
||||
NaviLatLngInfo naviLatLngInfo = new Gson().fromJson(naviInfo, NaviLatLngInfo.class);
|
||||
Log.d(TAG, "getLocNaviInfo lat = $lat -----> lon = $lon");
|
||||
if (lon == 0.0 || lat == 0.0) {
|
||||
return naviLatLngInfo;
|
||||
} else {
|
||||
naviLatLngInfo.setFromPoiLatitude(lat + "");
|
||||
naviLatLngInfo.setFromPoiLongitude(lon + "");
|
||||
SharedPrefsMgr.getInstance(mContext).putString(TanluConstants.NAVI_INFO, new Gson().toJson(naviLatLngInfo));
|
||||
return naviLatLngInfo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,26 +22,24 @@ public interface TanluApiService {
|
||||
/**
|
||||
* 探路沿途数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
|
||||
Observable<InformationAndLiveCarResult> requestInformationAlongTheWay(@Query("sn") String sn, @FieldMap Map<String, String> parameters);
|
||||
Observable<InformationAndLiveCarResult> requestInformationAlongTheWay(@Query("sn") String sn, @FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 获取上班族路线的坐标集
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-travel-condition/travelDetail/info/no/commuter/v1")
|
||||
Observable<PathLineResult> getRoadLineInfo(@FieldMap Map<String, String> infoBody);
|
||||
|
||||
Observable<PathLineResult> getRoadLineInfo(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 基于地理信息词缀的空间情报检索
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/search/no/searchInforationByAddress/v1")
|
||||
Observable<VoiceSearchResult> searchOnLineInformation(@FieldMap Map<String, String> infoBody);
|
||||
Observable<VoiceSearchResult> searchOnLineInformation(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.module.tanlu.util;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.ACTIVITY_SERVICE;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2019-09-26
|
||||
*/
|
||||
public class ActivityStatusUtil {
|
||||
/**
|
||||
* 判断某个activity是否在前台显示
|
||||
*/
|
||||
public static boolean isForeground(Context activity) {
|
||||
return isForeground(activity, "com.zhidao.roadcondition.main_module.MainActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某个界面是否在前台,返回true,为显示,否则不是
|
||||
*/
|
||||
public static boolean isForeground(Context context, String className) {
|
||||
if (context == null || TextUtils.isEmpty(className)) {
|
||||
return false;
|
||||
}
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1);
|
||||
if (list != null && list.size() > 0) {
|
||||
ComponentName cpn = list.get(0).topActivity;
|
||||
if (className.equals(cpn.getClassName())) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.tanlu.util
|
||||
|
||||
import android.text.format.DateFormat
|
||||
import com.google.gson.Gson
|
||||
import java.text.DecimalFormat
|
||||
|
||||
const val format = "yy/MM/dd kk:mm:ss"
|
||||
@@ -29,3 +30,7 @@ fun handleDistances(distance: Int): String {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,4 +20,12 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
//保留整数,四舍五入
|
||||
public static int getIntervalValue(int listSize){
|
||||
// var floatSize = listSize.toFloat();
|
||||
int transformSize = listSize / 15;
|
||||
DecimalFormat df = new DecimalFormat("0");
|
||||
return Integer.parseInt((df.format(transformSize)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.tanlu.voice
|
||||
|
||||
import com.zhidao.auto.platform.voice.VoiceClient
|
||||
|
||||
/**
|
||||
* @description 声音控制类
|
||||
*
|
||||
* @author lixiaopeng
|
||||
* @since 2019-11-01
|
||||
*/
|
||||
object VoiceController {
|
||||
private lateinit var voiceClient: VoiceClient
|
||||
|
||||
// fun initVoice() {
|
||||
// voiceClient = VoiceClient.getInstance(BaseApplication.getAppContext())
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置语音命令回调接口
|
||||
* @param callBack
|
||||
*/
|
||||
fun setCallBack(callBack: VoiceClient.VoiceCmdCallBack) {
|
||||
voiceClient.setCallBack(callBack)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param speakText 语音播报内容
|
||||
*/
|
||||
fun speakVoice(speakText: String) {
|
||||
voiceClient.speakDefault(speakText)
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令
|
||||
* @param customType 命令
|
||||
* @param customWakeupCmd 命令对应的唤醒词集合
|
||||
*/
|
||||
fun registerCustomWakeupCmd(customType: String, customWakeupCmd: Array<String>) {
|
||||
voiceClient.registerCustomWakeupCmd(customType, customWakeupCmd)
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消免唤醒命令
|
||||
* @param customType 命令
|
||||
*/
|
||||
fun unRegisterCustomWakeupCmd(customType: String) {
|
||||
voiceClient.unRegisterCustomWakeupCmd(customType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放资源(界面销毁的时候调用)
|
||||
*/
|
||||
fun release() {
|
||||
voiceClient.release()
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 943 B |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -86,6 +86,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/media_layout"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<TextView
|
||||
@@ -93,10 +95,11 @@
|
||||
android:layout_width="142dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:background="@drawable/shape_bg_222533"
|
||||
android:drawableLeft="@drawable/default_image"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:drawableLeft="@drawable/media_previous"
|
||||
android:gravity="center_vertical"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="@string/tanlu_previous"
|
||||
android:textColor="@color/color_545362"
|
||||
android:textSize="13dp" />
|
||||
@@ -107,11 +110,12 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:paddingRight="40dp"
|
||||
android:paddingLeft="35dp"
|
||||
android:background="@drawable/shape_bg_222533"
|
||||
android:drawableRight="@drawable/default_image"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingRight="10dp"
|
||||
android:drawableRight="@drawable/media_next"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/tanlu_next"
|
||||
android:textColor="@color/color_545362"
|
||||
android:textSize="13dp" />
|
||||
|
||||