导航按钮

This commit is contained in:
wangcongtao
2020-09-23 14:05:13 +08:00
parent eb511fa3c1
commit a5b450f765
23 changed files with 101 additions and 39 deletions

View File

@@ -44,9 +44,8 @@
android:layout_marginTop="@dimen/module_ext_camera_button_marginTop"
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
android:drawableLeft="@drawable/module_ext_destination_online_car_dw"
android:gravity="center"
android:drawablePadding="@dimen/module_ext_destination_online_car_drawablePadding"
android:paddingTop="@dimen/dp_14"
android:gravity="center_vertical"
android:text="@string/module_ext_destination_online_car_text"
android:visibility="gone"
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"

View File

@@ -200,6 +200,9 @@ public class MogoServices implements IMogoMapListener,
invokeAutoRefresh();
}
break;
case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH:
handleCalculationNotHomeCompanyDistanceForPush();
break;
}
}
@@ -855,7 +858,6 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onIntentReceived( String command, Intent intent ) {
if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
onActionDone( MogoAction.Next );
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
@@ -942,6 +944,27 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onStartNavi() {
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" );
scheduleCalculationNotHomeCompanyDistanceForPush();
}
@Override
public void onStopNavi() {
Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" );
mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
}
/**
* 延时一分钟发起计算导航目的地推送策略
*/
private void scheduleCalculationNotHomeCompanyDistanceForPush() {
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
}
/**
* 发起计算导航目的地推送策略
*/
private void handleCalculationNotHomeCompanyDistanceForPush() {
String json = SpStorage.getNavigationTarget();
if ( !TextUtils.isEmpty( json ) ) {
try {
@@ -978,7 +1001,7 @@ public class MogoServices implements IMogoMapListener,
}
} );
} catch ( Exception e ) {
Logger.e( TAG, e, "onStartNavi" );
Logger.e( TAG, e, "handleCalculationNotHomeCompanyDistanceForPush" );
}
}

View File

@@ -208,4 +208,14 @@ public class ServiceConst {
*/
public static final String COMMAND_ONLINE_CAR_PANEL = "com.zhidao.search.riders";
/**
* 导航开始后延时1分钟开启推送策略
*/
public static final int MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 0x301;
/**
* 延时1分钟开启推送策略
*/
public static final long INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 60 * 1_000L;
}

View File

@@ -151,7 +151,7 @@ class LauncherCardRefresher {
private ZhidaoRefreshModel mZhidaoRefreshModel;
private LauncherCardRefreshStrategy mExplorerWayOrOnlineCarDataStrategy = new LauncherCardRefreshStrategy(
20 * ONE_MINUTE,null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
40 * ONE_MINUTE,null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
);
private LauncherCardRefreshStrategy mInduceStrategy = new LauncherCardRefreshStrategy(
3 * ONE_MINUTE,mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE

View File

@@ -792,7 +792,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
Logger.d( TAG, "内部 - 请求开始" );
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, new RefreshCallback() {
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit,false, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
MarkerResponse data = ( MarkerResponse ) o;

View File

@@ -20,6 +20,7 @@ public class RefreshBody {
public boolean onlyFocus; // 是否仅查询已关注的好友
public boolean onlySameCity; // 是否仅查询注册城市相同的同城用户
public boolean viewPush; // 是否走V2X通道 true-401011false -401001
public boolean onlyRealUser;
public static class LatLon {

View File

@@ -124,7 +124,6 @@ public class RefreshModel {
query.put( "data", data );
Logger.d( TAG, data );
mRefreshApiService.refreshDataSync( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -163,12 +162,14 @@ public class RefreshModel {
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
* @param onlyRealUser 是否只查询真实用户
*/
public void queryOnLineCarWithRoute( MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
int radius,
int limit,
boolean onlyRealUser,
final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
@@ -181,6 +182,7 @@ public class RefreshModel {
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
refreshBody.onlyRealUser = onlyRealUser;
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );

View File

@@ -56,6 +56,7 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
false,
mStrategy.getRadius(),
LIMIT,
true,
this
);
} catch ( Exception e ) {

View File

@@ -41,7 +41,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
@@ -51,8 +52,8 @@
<TextView
android:id="@+id/module_services_empty_tip"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/module_services_empty_tip_marginTop"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_services_empty_tip_marginTop"
android:textColor="@color/module_services_empty_tip_textColor"
android:textSize="@dimen/module_services_empty_tip_textSize"
android:textStyle="bold"

View File

@@ -8,6 +8,7 @@ import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
@@ -61,6 +62,7 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
private TextView mEnterApp;
private TextView mConsult;
private View mHandler;
private ImageView mHandlerIcon;
private boolean mLargeStyle = true;
@@ -116,7 +118,8 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
} );
mEnterApp = mWindowManagerView.findViewById( R.id.module_widgets_app_entrance );
mConsult = mWindowManagerView.findViewById( R.id.module_widgets_app_consult );
mHandler = mWindowManagerView.findViewById( R.id.module_widgets_app_handler );
mHandler = mWindowManagerView.findViewById( R.id.module_widgets_app_handler_container );
mHandlerIcon = mWindowManagerView.findViewById( R.id.module_widgets_app_handler );
}
try {
if ( mWindowManagerView.isShowing() ) {
@@ -131,20 +134,31 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
}
private void chooseAction( View root, float xPos, float yPos ) {
if ( isInViewArea( mEnterApp, xPos, yPos ) ) {
if ( isInViewArea( root, mEnterApp, xPos, yPos ) ) {
enterApp( root.getContext() );
} else if ( isInViewArea( mHandler, xPos, yPos ) ) {
} else if ( isInViewArea( root, mHandler, xPos, yPos ) ) {
handleStyle( mHandler.getContext() );
} else if ( isInViewArea( mConsult, xPos, yPos ) ) {
} else if ( isInViewArea( root, mConsult, xPos, yPos ) ) {
consultUser( root.getContext() );
}
}
private boolean isInViewArea( View target, float xPos, float yPos ) {
if ( xPos >= target.getLeft()
&& xPos <= target.getRight()
&& yPos >= target.getTop()
&& yPos <= target.getBottom() ) {
private boolean isInViewArea( View root, View target, float xPos, float yPos ) {
int loc[] = new int[2];
root.getLocationOnScreen( loc );
int rootX = loc[0];
int rootY = loc[1];
target.getLocationOnScreen( loc );
int targetX = loc[0];
int targetY = loc[1];
int targetWidth = target.getMeasuredWidth();
int targetHeight = target.getMeasuredHeight();
if ( xPos + rootX >= targetX
&& xPos + rootX <= targetX + targetWidth
&& yPos + rootY >= targetY
&& yPos + rootY <= targetY + targetHeight ) {
return true;
}
return false;
@@ -156,7 +170,7 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
* @param context
*/
private void consultUser( Context context ) {
Map<String, Object> properties = new HashMap<>();
Map< String, Object > properties = new HashMap<>();
properties.put( "type", 1 );
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "NAVI_Find_Mogoer", properties );
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageOnResume() ) {
@@ -174,10 +188,12 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
mEnterApp.setText( R.string.module_widgets_app_entrance_short );
mConsult.setText( R.string.module_widgets_app_consult_short );
mLargeStyle = false;
mHandlerIcon.setImageResource( R.drawable.module_widgets_app_handler_open );
} else {
mEnterApp.setText( R.string.module_widgets_app_entrance_text );
mConsult.setText( R.string.module_widgets_app_entrance_consult );
mLargeStyle = true;
mHandlerIcon.setImageResource( R.drawable.module_widgets_app_handler_close );
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

View File

@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:bottomLeftRadius="@dimen/module_widgets_app_bkg_corner" android:bottomRightRadius="@dimen/module_widgets_app_bkg_corner" android:topLeftRadius="0px" android:topRightRadius="0px" />
<corners android:radius="@dimen/module_widgets_app_bkg_corner" />
<solid android:color="#3D3F44" />
</shape>
</item>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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:id="@+id/module_widgets_app_entrance_root"
@@ -8,25 +8,24 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/module_widgets_app_handler_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_widgets_app_handler_bkg">
<ImageView
android:id="@+id/module_widgets_app_handler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ic_1" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_widgets_app_body_bkg">
<LinearLayout
android:id="@+id/module_widgets_app_handler_container"
android:layout_width="@dimen/module_widgets_app_handler_width"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:id="@+id/module_widgets_app_handler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_widgets_app_handler_close" />
</LinearLayout>
<TextView
android:id="@+id/module_widgets_app_entrance"
android:layout_width="wrap_content"
@@ -63,4 +62,4 @@
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@@ -9,4 +9,6 @@
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
<dimen name="module_widgets_app_handler_width">56px</dimen>
<dimen name="module_widgets_app_handler_height">40px</dimen>
</resources>

View File

@@ -9,4 +9,6 @@
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
<dimen name="module_widgets_app_handler_width">56px</dimen>
<dimen name="module_widgets_app_handler_height">40px</dimen>
</resources>

View File

@@ -3,10 +3,12 @@
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
<dimen name="module_widgets_app_entrance_y">48px</dimen>
<dimen name="module_widgets_app_entrance_y">836px</dimen>
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
<dimen name="module_widgets_app_handler_width">100px</dimen>
<dimen name="module_widgets_app_handler_height">85px</dimen>
</resources>

View File

@@ -3,10 +3,12 @@
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
<dimen name="module_widgets_app_entrance_y">48px</dimen>
<dimen name="module_widgets_app_entrance_y">836px</dimen>
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
<dimen name="module_widgets_app_handler_width">100px</dimen>
<dimen name="module_widgets_app_handler_height">85px</dimen>
</resources>

View File

@@ -3,10 +3,12 @@
<dimen name="module_widgets_app_entrance_textSize">22px</dimen>
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
<dimen name="module_widgets_app_entrance_y">48px</dimen>
<dimen name="module_widgets_app_entrance_y">505px</dimen>
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">20px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
<dimen name="module_widgets_app_handler_width">56px</dimen>
<dimen name="module_widgets_app_handler_height">40px</dimen>
</resources>