Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0

This commit is contained in:
董宏宇
2020-02-14 12:03:57 +08:00
6 changed files with 92 additions and 66 deletions

View File

@@ -1,6 +1,5 @@
package com.mogo.module.extensions.entrance;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
@@ -11,15 +10,12 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.storage.SpStorage;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
@@ -33,7 +29,6 @@ import com.mogo.module.extensions.R;
import com.mogo.module.extensions.dialog.NaviNoticeDialog;
import com.mogo.module.extensions.navi.NaviInfoView;
import com.mogo.module.share.ShareControl;
import com.mogo.module.share.dialog.LaucherShareDialog;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.fragmentmanager.FragmentDescriptor;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
@@ -41,10 +36,6 @@ import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoAddressManager;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.windowview.IMogoWindowManager;
import com.mogo.utils.TipToast;
import java.util.HashMap;
/**
* @author congtaowang
@@ -101,6 +92,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
protected void initViews() {
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation();
mMogoAddressManager = ( IMogoAddressManager ) ARouter.getInstance().build( MogoServicePaths.PATH_ADDRESS_MANAGER ).navigation();
mCommonAddress = findViewById( R.id.module_entrance_id_common_address );
mSearch = findViewById( R.id.module_entrance_id_search );
@@ -154,7 +146,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mSpeedLimit = findViewById( R.id.module_entrance_id_speed_limit_container );
mSpeedLimitValue = findViewById( R.id.module_entrance_id_speed_limit_value );
mSpeedLimitUnit = findViewById( R.id.module_entrance_id_speed_limit_unit );
}
@NonNull

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -14,31 +14,36 @@ import com.mogo.service.windowview.IMogoWindowManager;
* <p>
* 根据优先级控制显示 window view.
*/
@Route( path = MogoServicePaths.PATH_WINDOW_MANAGER )
@Route(path = MogoServicePaths.PATH_WINDOW_MANAGER)
public class MogoWindowManager implements IMogoWindowManager {
@Override
public void addView( View view, int x, int y, boolean movable ) {
WindowViewHandler.addView( view, x, y, movable );
public void addView(View view, int x, int y, boolean movable) {
WindowViewHandler.addView(view, x, y, movable);
}
@Override
public void addView( int priority, View view, int x, int y, boolean movable ) {
WindowViewHandler.addView( view, priority, x, y, movable );
public void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
WindowViewHandler.addView(view, params, movable);
}
@Override
public void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable ) {
WindowViewHandler.addView( view, priority, params, movable );
public void addView(int priority, View view, int x, int y, boolean movable) {
WindowViewHandler.addView(view, priority, x, y, movable);
}
@Override
public void removeView( View view ) {
WindowViewHandler.removeView( view );
public void addView(int priority, View view, FrameLayout.LayoutParams params, boolean movable) {
WindowViewHandler.addView(view, priority, params, movable);
}
@Override
public void init( Context context ) {
public void removeView(View view) {
WindowViewHandler.removeView(view);
}
@Override
public void init(Context context) {
}
}

View File

@@ -37,7 +37,7 @@ public class WindowViewHandler {
public static FrameLayout sFloatingLayout = null;
public static void init( FrameLayout frameLayout ) {
public static void init(FrameLayout frameLayout) {
sFloatingLayout = frameLayout;
}
@@ -49,20 +49,39 @@ public class WindowViewHandler {
* @param y
* @param movable
*/
public static void addView( View view, int x, int y, boolean movable ) {
if ( view == null ) {
public static void addView(View view, int x, int y, boolean movable) {
if (view == null) {
return;
}
if ( sFloatingLayout == null ) {
Logger.e( TAG, "no floating frame. " );
if (sFloatingLayout == null) {
Logger.e(TAG, "no floating frame. ");
return;
}
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = x;
params.topMargin = y;
sFloatingLayout.addView( view, params );
sFloatingLayout.addView(view, params);
}
/**
* 添加view到布局优先级大的展示
*
* @param view
* @param params
* @param movable
*/
public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
if (view == null) {
return;
}
if (sFloatingLayout == null) {
Logger.e(TAG, "no floating frame. ");
return;
}
sFloatingLayout.addView(view, params);
}
/**
@@ -74,27 +93,27 @@ public class WindowViewHandler {
* @param y
* @param movable
*/
public static void addView( View view, int priority, int x, int y, boolean movable ) {
if ( view == null ) {
public static void addView(View view, int priority, int x, int y, boolean movable) {
if (view == null) {
return;
}
if ( sFloatingLayout == null ) {
Logger.e( TAG, "no floating frame. " );
if (sFloatingLayout == null) {
Logger.e(TAG, "no floating frame. ");
return;
}
if ( sView == view ) {
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
if (sView == view) {
Logger.w(TAG, "改布局已添加且没有移除,不操作");
return;
}
if ( sView != null ) {
if ( priority < sPriority ) {
Logger.w( TAG, "过滤低优先级布局" );
if (sView != null) {
if (priority < sPriority) {
Logger.w(TAG, "过滤低优先级布局");
return;
}
sFloatingLayout.removeView( sView );
sFloatingLayout.removeView(sView);
}
sView = view;
sMovable = movable;
@@ -112,27 +131,27 @@ public class WindowViewHandler {
* @param params
* @param movable
*/
public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) {
if ( view == null ) {
public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) {
if (view == null) {
return;
}
if ( sFloatingLayout == null ) {
Logger.e( TAG, "no floating frame. " );
if (sFloatingLayout == null) {
Logger.e(TAG, "no floating frame. ");
return;
}
if ( sView == view ) {
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
if (sView == view) {
Logger.w(TAG, "改布局已添加且没有移除,不操作");
return;
}
if ( sView != null ) {
if ( priority < sPriority ) {
Logger.w( TAG, "过滤低优先级布局" );
if (sView != null) {
if (priority < sPriority) {
Logger.w(TAG, "过滤低优先级布局");
return;
}
sFloatingLayout.removeView( sView );
sFloatingLayout.removeView(sView);
}
sView = view;
sMovable = movable;
@@ -141,15 +160,15 @@ public class WindowViewHandler {
addView();
}
public static void removeView( View view ) {
if ( sFloatingLayout == null ) {
public static void removeView(View view) {
if (sFloatingLayout == null) {
return;
}
if ( view == null ) {
if (view == null) {
return;
}
sFloatingLayout.removeView( view );
if ( sView == view ) {
sFloatingLayout.removeView(view);
if (sView == view) {
sView = null;
sPriority = Integer.MIN_VALUE;
sMovable = false;
@@ -158,28 +177,29 @@ public class WindowViewHandler {
}
private static void addView() {
if ( sView == null ) {
if (sView == null) {
return;
}
FrameLayout.LayoutParams params = sParams;
if ( params == null ) {
params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
if (params == null) {
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = sX;
params.topMargin = sY;
}
sFloatingLayout.addView( sView, params );
sFloatingLayout.addView(sView, params);
}
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
if ( view == null ) {
public static void attachMovementEvent(View view, WindowManager.LayoutParams params) {
if (view == null) {
return;
}
view.setOnTouchListener( ( v, event ) -> {
view.setOnTouchListener((v, event) -> {
DispatchTouchEventWrapper.getInstance()
.attach( view, params )
.handle( event );
.attach(view, params)
.handle(event);
return false;
} );
});
}
}

View File

@@ -22,7 +22,17 @@ public interface IMogoWindowManager extends IProvider {
* @param y 左上角y坐标
* @param movable 是否可移动(无效)
*/
void addView( View view, int x, int y, boolean movable );
void addView(View view, int x, int y, boolean movable);
/**
* 向window中添加指定的布局不考虑优先级
*
* @param view 添加的实例
* @param params 布局参数
* @param movable 是否可移动(无效)
*/
void addView(View view, FrameLayout.LayoutParams params, boolean movable);
/**
* 向window中添加指定的布局优先级大的展示
@@ -33,7 +43,7 @@ public interface IMogoWindowManager extends IProvider {
* @param y 左上角y坐标
* @param movable 是否可移动(无效)
*/
void addView( int priority, View view, int x, int y, boolean movable );
void addView(int priority, View view, int x, int y, boolean movable);
/**
* 向window中添加指定的布局优先级大的展示
@@ -43,12 +53,12 @@ public interface IMogoWindowManager extends IProvider {
* @param params 布局参数
* @param movable 是否可移动(无效)
*/
void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable );
void addView(int priority, View view, FrameLayout.LayoutParams params, boolean movable);
/**
* 移除对应的 view
*
* @param view
*/
void removeView( View view );
void removeView(View view);
}