opt
This commit is contained in:
@@ -132,7 +132,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_APPS, MogoModulePaths.PATH_MODULE_APPS ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ).setVoiceAction( VoiceConstants.ACTION_GAODE_SDK_NAVI_RECV ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_EXTENSION, ExtensionsModuleConst.TYPE ) );
|
||||
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_ENTRANCE, ExtensionsModuleConst.TYPE_ENTRANCE ) );
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -21,6 +22,11 @@ public class MogoWindowManager implements IMogoWindowManager {
|
||||
WindowViewHandler.addView( view, priority, x, y, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable ) {
|
||||
WindowViewHandler.addView( view, priority, params, movable );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView( View view ) {
|
||||
WindowViewHandler.removeView( view );
|
||||
|
||||
@@ -28,6 +28,7 @@ public class WindowViewHandler {
|
||||
private static View sView = null;
|
||||
|
||||
private static int sX, sY;
|
||||
private static FrameLayout.LayoutParams sParams;
|
||||
|
||||
/**
|
||||
* 是否可手指拖动
|
||||
@@ -55,26 +56,48 @@ public class WindowViewHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == null ) {
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
sPriority = priority;
|
||||
sX = x;
|
||||
sY = y;
|
||||
addView();
|
||||
} else {
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
sView = view;
|
||||
sX = x;
|
||||
sY = y;
|
||||
sPriority = priority;
|
||||
sMovable = movable;
|
||||
addView();
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
sPriority = priority;
|
||||
sX = x;
|
||||
sY = y;
|
||||
addView();
|
||||
}
|
||||
|
||||
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. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
Logger.w( TAG, "改布局已添加且没有移除,不操作" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView != null ) {
|
||||
if ( priority < sPriority ) {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sFloatingLayout.removeView( sView );
|
||||
}
|
||||
sView = view;
|
||||
sMovable = movable;
|
||||
sPriority = priority;
|
||||
sParams = params;
|
||||
addView();
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
@@ -92,6 +115,7 @@ public class WindowViewHandler {
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
sParams = null;
|
||||
DispatchTouchEventWrapper.getInstance().release();
|
||||
}
|
||||
|
||||
@@ -100,9 +124,12 @@ public class WindowViewHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
FrameLayout.LayoutParams params = sParams;
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user