add apis
This commit is contained in:
@@ -2,11 +2,15 @@ package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -45,7 +49,10 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -64,7 +71,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoAcquireAuthorizeListener {
|
||||
IMogoAcquireAuthorizeListener,
|
||||
IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -74,7 +82,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
private View mHome;
|
||||
private View mCompany;
|
||||
|
||||
private View mUploadRoadCondition;
|
||||
private TextView mUploadRoadCondition;
|
||||
|
||||
private View mVRMode;
|
||||
private View mMove2CurrentLocation;
|
||||
@@ -109,6 +117,24 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
public static boolean isClickShare;
|
||||
|
||||
@DrawableRes
|
||||
private int[] mUploadingFrameRes = {
|
||||
R.drawable.amap_route_color_texture_0_arrow,
|
||||
R.drawable.amap_route_color_texture_1_arrow,
|
||||
R.drawable.amap_route_color_texture_2_arrow,
|
||||
R.drawable.amap_route_color_texture_3_arrow,
|
||||
R.drawable.amap_route_color_texture_4_arrow,
|
||||
R.drawable.amap_route_color_texture_5_arrow,
|
||||
R.drawable.amap_route_color_texture_6_arrow,
|
||||
R.drawable.amap_route_color_texture_7_arrow,
|
||||
R.drawable.amap_route_color_texture_8_arrow,
|
||||
R.drawable.amap_route_color_texture_9_arrow,
|
||||
};
|
||||
private int mCurrentUploadFrame = 0;
|
||||
private Handler mUploadFrameAnimHandler;
|
||||
public static final int MSG_FRAME_ANIM = 307;
|
||||
public static final long TIME_FRAME_INTERVAL_TIME = 200;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
@@ -251,6 +277,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener( TAG, this );
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -436,4 +464,47 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( mUploadRoadCondition == null ) {
|
||||
return;
|
||||
}
|
||||
if ( descriptor == StatusDescriptor.UPLOADING ) {
|
||||
if ( isTrue ) {
|
||||
doFrameAnimOnUploadButton();
|
||||
} else {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
mUploadRoadCondition.setText( R.string.module_map_str_upload_road_condition );
|
||||
mUploadRoadCondition.setBackgroundResource( R.drawable.module_ext_dw_upload_road_condition_bkg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doFrameAnimOnUploadButton() {
|
||||
if ( mUploadFrameAnimHandler == null ) {
|
||||
mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_FRAME_ANIM ) {
|
||||
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( !mMogoStatusManager.isUploading() ) {
|
||||
mCurrentUploadFrame = 0;
|
||||
if ( mUploadRoadCondition != null ) {
|
||||
mUploadRoadCondition.setText( R.string.module_map_str_upload_road_condition );
|
||||
mUploadRoadCondition.setBackgroundResource( R.drawable.module_ext_dw_upload_road_condition_bkg );
|
||||
}
|
||||
return;
|
||||
}
|
||||
mUploadRoadCondition.setBackgroundResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM, TIME_FRAME_INTERVAL_TIME );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user