Merge branch 'dev' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev
This commit is contained in:
@@ -23,12 +23,6 @@ public class MainIndependentActivity extends MainActivity {
|
||||
super.onCreate( savedInstanceState );
|
||||
// 独立app需要在onCreate里面增加处理scheme的情况
|
||||
mPresenter.handleSchemeIntent( getIntent() );
|
||||
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
IMogoServiceApis apis =
|
||||
(IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(this);
|
||||
apis.getShareManager().resetContext(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BaseFloatDialog extends Dialog {
|
||||
|
||||
public BaseFloatDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
// addFlag();
|
||||
addFlag();
|
||||
}
|
||||
|
||||
private void addFlag() {
|
||||
|
||||
@@ -3,20 +3,13 @@ package com.mogo.module.extensions.entrance;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
@@ -56,7 +49,6 @@ 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.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
@@ -64,11 +56,8 @@ import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.roadcondition.service.DelayService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
/**
|
||||
@@ -110,7 +99,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
private IMogoRegisterCenter mMogoRegisterCenter;
|
||||
private IMogoAnalytics mAnalytics;
|
||||
private IMogoStatusManager mMogoStatusManager;
|
||||
private EntrancePresenter mEntrancePresenter;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
|
||||
@@ -125,7 +113,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
private ImageView mUserHeadImg;
|
||||
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
*/
|
||||
@@ -134,56 +121,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
public static boolean isClickShare;
|
||||
|
||||
@DrawableRes
|
||||
private int[] mUploadingFrameRes = {
|
||||
R.drawable.module_ext_ic_uploading_00000,
|
||||
R.drawable.module_ext_ic_uploading_00001,
|
||||
R.drawable.module_ext_ic_uploading_00002,
|
||||
R.drawable.module_ext_ic_uploading_00003,
|
||||
R.drawable.module_ext_ic_uploading_00004,
|
||||
R.drawable.module_ext_ic_uploading_00005,
|
||||
R.drawable.module_ext_ic_uploading_00006,
|
||||
R.drawable.module_ext_ic_uploading_00007,
|
||||
R.drawable.module_ext_ic_uploading_00008,
|
||||
R.drawable.module_ext_ic_uploading_00009,
|
||||
R.drawable.module_ext_ic_uploading_00010,
|
||||
R.drawable.module_ext_ic_uploading_00011,
|
||||
R.drawable.module_ext_ic_uploading_00012,
|
||||
R.drawable.module_ext_ic_uploading_00013,
|
||||
R.drawable.module_ext_ic_uploading_00014,
|
||||
R.drawable.module_ext_ic_uploading_00015,
|
||||
R.drawable.module_ext_ic_uploading_00016,
|
||||
R.drawable.module_ext_ic_uploading_00017,
|
||||
R.drawable.module_ext_ic_uploading_00018,
|
||||
R.drawable.module_ext_ic_uploading_00019,
|
||||
R.drawable.module_ext_ic_uploading_00020,
|
||||
R.drawable.module_ext_ic_uploading_00021,
|
||||
R.drawable.module_ext_ic_uploading_00022,
|
||||
R.drawable.module_ext_ic_uploading_00023,
|
||||
R.drawable.module_ext_ic_uploading_00024,
|
||||
R.drawable.module_ext_ic_uploading_00025,
|
||||
R.drawable.module_ext_ic_uploading_00026,
|
||||
R.drawable.module_ext_ic_uploading_00027,
|
||||
R.drawable.module_ext_ic_uploading_00028,
|
||||
R.drawable.module_ext_ic_uploading_00029,
|
||||
R.drawable.module_ext_ic_uploading_00030,
|
||||
R.drawable.module_ext_ic_uploading_00031,
|
||||
R.drawable.module_ext_ic_uploading_00032,
|
||||
R.drawable.module_ext_ic_uploading_00033,
|
||||
R.drawable.module_ext_ic_uploading_00034,
|
||||
R.drawable.module_ext_ic_uploading_00035,
|
||||
R.drawable.module_ext_ic_uploading_00036,
|
||||
R.drawable.module_ext_ic_uploading_00037,
|
||||
R.drawable.module_ext_ic_uploading_00038,
|
||||
R.drawable.module_ext_ic_uploading_00039,
|
||||
R.drawable.module_ext_ic_uploading_00040
|
||||
};
|
||||
private int mCurrentUploadFrame = 0;
|
||||
private Handler mUploadFrameAnimHandler;
|
||||
public static final int MSG_FRAME_ANIM = 307;
|
||||
public static final int MSG_STOP_ANIM = 308;
|
||||
public static final long TIME_FRAME_INTERVAL_TIME = 80;
|
||||
|
||||
private Rect mDisplayOverviewBounds;
|
||||
|
||||
private boolean toggle = false;
|
||||
@@ -199,16 +136,13 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
};
|
||||
|
||||
private UploadButtonAnimatorController mUploadButtonAnimatorController;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
}
|
||||
|
||||
private List< View > demoCache = new ArrayList<>();
|
||||
|
||||
private int[] heights = new int[]{100,200,300};
|
||||
private int currentHeight;
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
@@ -222,36 +156,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mUpload = findViewById( R.id.module_entrance_id_upload );
|
||||
mUploading = findViewById( R.id.module_entrance_id_uploading );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
// // todo 测试动画
|
||||
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
||||
// TextView tv = v.findViewById(R.id.tvIndex);
|
||||
// Random random = new Random();
|
||||
// currentHeight = heights[random.nextInt(3)];
|
||||
// tv.setText(demoCache.size()+" height: "+currentHeight + ": " + v);
|
||||
// demoCache.add(v);
|
||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight);
|
||||
// mApis.getTopViewManager().addView(v, params,new IMogoTopViewStatusListener() {
|
||||
// @Override
|
||||
// public void onViewAdded(View view) {
|
||||
// Logger.d(TAG, "onViewAdded: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onViewRemoved(View view) {
|
||||
// Logger.d(TAG, "onViewRemoved: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewAddAnim(View view) {
|
||||
// Logger.d(TAG, "beforeViewAddAnim: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewRemoveAnim(View view) {
|
||||
// Logger.d(TAG, "beforeViewRemoveAnim: " + view);
|
||||
// }
|
||||
// });
|
||||
// 原始逻辑
|
||||
showShareDialog();
|
||||
} );
|
||||
|
||||
@@ -272,57 +176,18 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
|
||||
mMove2CurrentLocation.setOnClickListener( view -> {
|
||||
// // todo 测试动画
|
||||
// if(!toggle) {
|
||||
// TopViewAnimHelper.getInstance().showNaviView();
|
||||
// }else{
|
||||
// TopViewAnimHelper.getInstance().hideNaviView();
|
||||
// }
|
||||
// toggle = !toggle;
|
||||
// if(demoCache.size()>0) {
|
||||
// View v = demoCache.remove(demoCache.size() - 1);
|
||||
// boolean isViewAdded = mApis.getTopViewManager().isViewAdded(v);
|
||||
// Logger.d(TAG, "isViewAdded===" + isViewAdded);
|
||||
// mApis.getTopViewManager().removeView(v);
|
||||
// }
|
||||
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
||||
// TextView tv = v.findViewById(R.id.tvIndex);
|
||||
// tv.setText("sub view "+demoCache.size()+" height: "+currentHeight + ": " + v);
|
||||
// demoCache.add(v);
|
||||
// mApis.getTopViewManager().addSubView(v,new IMogoTopViewStatusListener() {
|
||||
// @Override
|
||||
// public void onViewAdded(View view) {
|
||||
// Logger.d(TAG, "onSubViewAdded: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onViewRemoved(View view) {
|
||||
// Logger.d(TAG, "onSubViewRemoved: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewAddAnim(View view) {
|
||||
// Logger.d(TAG, "beforeSubViewAddAnim: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewRemoveAnim(View view) {
|
||||
// Logger.d(TAG, "beforeSubViewRemoveAnim: " + view);
|
||||
// }
|
||||
// });
|
||||
// 原始逻辑
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if ( location != null ) {
|
||||
if ( !mMogoStatusManager.isV2XShow() ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
if ( !mStatusManager.isV2XShow() ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.setLockZoom( 16 );
|
||||
mMApUIController.changeZoom( 16.0f );
|
||||
}
|
||||
if ( mStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
}
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
} );
|
||||
@@ -334,7 +199,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
} );
|
||||
}
|
||||
|
||||
// mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel );
|
||||
ConstraintLayout rootView = findViewById( R.id.module_entrance_id_top_motion_layout );
|
||||
if ( rootView != null ) {
|
||||
TopViewAnimHelper.getInstance().init( rootView );
|
||||
@@ -394,10 +258,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
}
|
||||
} );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1,
|
||||
findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2,
|
||||
findViewById( R.id.module_entrance_id_button2 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) );
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
@@ -425,7 +287,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mWeatherIcon = findViewById( R.id.module_ext_id_weather_icon );
|
||||
mWeatherTemp = findViewById( R.id.module_ext_id_weather_temp );
|
||||
|
||||
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
|
||||
mUserHeadImg = findViewById( R.id.ivUserHeadImg );
|
||||
|
||||
mMsgContainer = findViewById( R.id.module_ext_id_msg );
|
||||
|
||||
@@ -433,22 +295,24 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
|
||||
} );
|
||||
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
|
||||
mUserHeadImg.setOnClickListener(view ->{
|
||||
mUserHeadImg.setOnClickListener( view -> {
|
||||
// todo 测试代码
|
||||
// mApis.getEventPanelManager().showPanel();
|
||||
// 原始逻辑
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
LaunchUtils.launchByPkg( getContext(), "com.zhidao.auto.personal" );
|
||||
// 埋点
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", 3);
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", 3 );
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track( "Launcher_APP_Icon", properties );
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "打开个人中心Exception" );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mUserHeadImg.setVisibility(DebugConfig.isLauncher()?View.VISIBLE:View.GONE);
|
||||
mUserHeadImg.setVisibility( DebugConfig.isLauncher() ? View.VISIBLE : View.GONE );
|
||||
|
||||
mUploadButtonAnimatorController = new UploadButtonAnimatorController( mUploading, mUpload, mStatusManager );
|
||||
}
|
||||
|
||||
public void showShareDialog() {
|
||||
@@ -475,7 +339,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMogoLocationClient = mService.getSingletonLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
@@ -483,9 +346,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.DISPLAY_OVERVIEW,
|
||||
this );
|
||||
mStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
mStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.DISPLAY_OVERVIEW, this );
|
||||
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController( mMApUIController );
|
||||
}
|
||||
@@ -553,8 +415,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mIsLock = isLock;
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
if ( mMogoStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
if ( mStatusManager.isDisplayOverview() ) {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
}
|
||||
} else {
|
||||
mExitNavi.setText( R.string.module_ext_str_continue_navi );
|
||||
@@ -577,16 +439,9 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
if ( isTrue ) {
|
||||
mUploading.setVisibility( View.VISIBLE );
|
||||
mUpload.setVisibility( View.GONE );
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
}
|
||||
doFrameAnimOnUploadButton();
|
||||
mUploadButtonAnimatorController.doFrameAnimOnUploadButton();
|
||||
} else {
|
||||
mCurrentUploadFrame = 0;
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
}
|
||||
mUploadButtonAnimatorController.stopAnimation();
|
||||
mUploading.setVisibility( View.GONE );
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
}
|
||||
@@ -609,52 +464,14 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
}
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.ACC_STATUS) {
|
||||
Log.d(TAG, " onStatusChanged isTrue = " + isTrue);
|
||||
} else if ( descriptor == StatusDescriptor.ACC_STATUS ) {
|
||||
Log.d( TAG, " onStatusChanged isTrue = " + isTrue );
|
||||
if ( isTrue ) {
|
||||
DelayService.Companion.launchService(getContext());
|
||||
DelayService.Companion.launchService( getContext() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 ) {
|
||||
if ( mUploading != null ) {
|
||||
mUploading.setVisibility( View.GONE );
|
||||
}
|
||||
if ( mUpload != null ) {
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( !mMogoStatusManager.isUploading() ) {
|
||||
mCurrentUploadFrame = 0;
|
||||
return;
|
||||
}
|
||||
if ( mUploading != null ) {
|
||||
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
|
||||
mCurrentUploadFrame = 12;
|
||||
}
|
||||
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME );
|
||||
} else if ( msg.what == MSG_STOP_ANIM ) {
|
||||
mStatusManager.setUploadingStatus( TAG, false );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
// 30s 后无论成功与否,停止动画
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderWeatherInfo( String temp, String desc, int iconId ) {
|
||||
@@ -679,10 +496,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderUserInfo(UserInfo userInfo) {
|
||||
if(userInfo != null){
|
||||
Logger.d(TAG, "renderUserInfo: " + userInfo);
|
||||
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).placeholder(R.drawable.model_ext_default_user_head).circleCrop().into(mUserHeadImg);
|
||||
public void renderUserInfo( UserInfo userInfo ) {
|
||||
if ( userInfo != null ) {
|
||||
Logger.d( TAG, "renderUserInfo: " + userInfo );
|
||||
GlideApp.with( getContext() ).load( userInfo.getHeadImgurl() ).placeholder( R.drawable.model_ext_default_user_head ).circleCrop().into( mUserHeadImg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 上传按钮动画
|
||||
*/
|
||||
class UploadButtonAnimatorController {
|
||||
|
||||
private static final String TAG = "UploadButtonAnimator";
|
||||
|
||||
private ImageView mUploading;
|
||||
private TextView mUpload;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
|
||||
private int mCurrentUploadFrame = 0;
|
||||
public static final int MSG_FRAME_ANIM = 307;
|
||||
public static final int MSG_STOP_ANIM = 308;
|
||||
public static final long TIME_FRAME_INTERVAL_TIME = 80;
|
||||
|
||||
private Handler 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 ) {
|
||||
if ( mUploading != null ) {
|
||||
mUploading.setVisibility( View.GONE );
|
||||
}
|
||||
if ( mUpload != null ) {
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( !mStatusManager.isUploading() ) {
|
||||
mCurrentUploadFrame = 0;
|
||||
return;
|
||||
}
|
||||
if ( mUploading != null ) {
|
||||
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
|
||||
mCurrentUploadFrame = 12;
|
||||
}
|
||||
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME );
|
||||
} else if ( msg.what == MSG_STOP_ANIM ) {
|
||||
mStatusManager.setUploadingStatus( TAG, false );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@DrawableRes
|
||||
private int[] mUploadingFrameRes = {
|
||||
R.drawable.module_ext_ic_uploading_00000,
|
||||
R.drawable.module_ext_ic_uploading_00001,
|
||||
R.drawable.module_ext_ic_uploading_00002,
|
||||
R.drawable.module_ext_ic_uploading_00003,
|
||||
R.drawable.module_ext_ic_uploading_00004,
|
||||
R.drawable.module_ext_ic_uploading_00005,
|
||||
R.drawable.module_ext_ic_uploading_00006,
|
||||
R.drawable.module_ext_ic_uploading_00007,
|
||||
R.drawable.module_ext_ic_uploading_00008,
|
||||
R.drawable.module_ext_ic_uploading_00009,
|
||||
R.drawable.module_ext_ic_uploading_00010,
|
||||
R.drawable.module_ext_ic_uploading_00011,
|
||||
R.drawable.module_ext_ic_uploading_00012,
|
||||
R.drawable.module_ext_ic_uploading_00013,
|
||||
R.drawable.module_ext_ic_uploading_00014,
|
||||
R.drawable.module_ext_ic_uploading_00015,
|
||||
R.drawable.module_ext_ic_uploading_00016,
|
||||
R.drawable.module_ext_ic_uploading_00017,
|
||||
R.drawable.module_ext_ic_uploading_00018,
|
||||
R.drawable.module_ext_ic_uploading_00019,
|
||||
R.drawable.module_ext_ic_uploading_00020,
|
||||
R.drawable.module_ext_ic_uploading_00021,
|
||||
R.drawable.module_ext_ic_uploading_00022,
|
||||
R.drawable.module_ext_ic_uploading_00023,
|
||||
R.drawable.module_ext_ic_uploading_00024,
|
||||
R.drawable.module_ext_ic_uploading_00025,
|
||||
R.drawable.module_ext_ic_uploading_00026,
|
||||
R.drawable.module_ext_ic_uploading_00027,
|
||||
R.drawable.module_ext_ic_uploading_00028,
|
||||
R.drawable.module_ext_ic_uploading_00029,
|
||||
R.drawable.module_ext_ic_uploading_00030,
|
||||
R.drawable.module_ext_ic_uploading_00031,
|
||||
R.drawable.module_ext_ic_uploading_00032,
|
||||
R.drawable.module_ext_ic_uploading_00033,
|
||||
R.drawable.module_ext_ic_uploading_00034,
|
||||
R.drawable.module_ext_ic_uploading_00035,
|
||||
R.drawable.module_ext_ic_uploading_00036,
|
||||
R.drawable.module_ext_ic_uploading_00037,
|
||||
R.drawable.module_ext_ic_uploading_00038,
|
||||
R.drawable.module_ext_ic_uploading_00039,
|
||||
R.drawable.module_ext_ic_uploading_00040
|
||||
};
|
||||
|
||||
public UploadButtonAnimatorController( ImageView mUploading, TextView mUpload, IMogoStatusManager mStatusManager ) {
|
||||
this.mUploading = mUploading;
|
||||
this.mUpload = mUpload;
|
||||
this.mStatusManager = mStatusManager;
|
||||
}
|
||||
|
||||
public void doFrameAnimOnUploadButton() {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
// 30s 后无论成功与否,停止动画
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
|
||||
}
|
||||
|
||||
public void stopAnimation() {
|
||||
mCurrentUploadFrame = 0;
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( mServiceApis == null ) {
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
}
|
||||
mServiceApis.getShareManager().resetContext(this);
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
mMogoStatusManager.setMainPageLaunchedStatus( TAG, true );
|
||||
AutopilotServiceManage.getInstance().init( getContext() );
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -286,6 +287,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ADAS_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, this );
|
||||
mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() );
|
||||
|
||||
registerMogoReceiver( context );
|
||||
@@ -723,6 +725,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
refreshStrategy();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -293,6 +293,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
MogoLatLng centerPoint ) {
|
||||
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
|
||||
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -324,9 +325,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
String sn = getPrimaryKeyFromEntity( markerOnlineCar );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_LOW );
|
||||
}
|
||||
if ( mogoMarker != null ) {
|
||||
mogoMarker.setVisible( true );
|
||||
}
|
||||
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
|
||||
}
|
||||
|
||||
@@ -362,9 +366,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
String sn = getPrimaryKeyFromEntity( markerExploreWay );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
Logger.d( TAG, "draw road condition, sn = %s", sn );
|
||||
drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
|
||||
mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
|
||||
}
|
||||
if ( mogoMarker != null ) {
|
||||
mogoMarker.setVisible( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user