opt
This commit is contained in:
@@ -42,6 +42,8 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
private NaviClient( Context context ) {
|
||||
mAMapNavi = AMapNavi.getInstance( context );
|
||||
mAMapNavi.setEmulatorNaviSpeed( 120 );
|
||||
mAMapNavi.setUseInnerVoice( true );
|
||||
mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this );
|
||||
mAMapNavi.addAMapNaviListener( mAMapNaviListener );
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.extensions.anim;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.BlendMode;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
@@ -91,7 +92,7 @@ public class JSurfaceView extends SurfaceView implements Runnable, SurfaceHolder
|
||||
return;
|
||||
}
|
||||
//绘制透明色
|
||||
mCanvas.drawColor( Color.parseColor( "#0C0C0C" ) );
|
||||
mCanvas.drawColor( Color.parseColor( "#EE0C0C0C" ) );
|
||||
Bitmap mBitmap = BitmapFactory.decodeResource( getResources(), mFrames[mCurrentPos % mFrames.length] );
|
||||
|
||||
Paint paint = new Paint();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:background="#0C0C0C "
|
||||
android:background="#EE0C0C0C"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/dp_70"
|
||||
android:paddingRight="@dimen/dp_70">
|
||||
|
||||
@@ -26,6 +26,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
android:resumeWhilePausing="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/Main"
|
||||
android:taskAffinity=""
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.main;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -25,6 +26,7 @@ import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStack;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.map.VoiceConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -58,6 +60,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
private View mCards;
|
||||
private View mApps;
|
||||
private View mEntrance;
|
||||
private FrameLayout mFloatingLayout;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
@@ -103,6 +106,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCards = findViewById( R.id.module_main_id_cards_container );
|
||||
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
||||
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
@@ -110,6 +116,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCards.setVisibility( View.GONE );
|
||||
mApps.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
mFloatingLayout.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
private void show() {
|
||||
@@ -117,6 +124,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCards.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,8 +195,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
switch2( marker.getOwner() );
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onMarkerReceive(marker);
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerReceive( marker );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.impl.windowview;
|
||||
package com.mogo.module.main.windowview;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.impl.windowview;
|
||||
package com.mogo.module.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.impl.windowview;
|
||||
package com.mogo.module.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.mogo.service.impl.windowview;
|
||||
package com.mogo.module.main.windowview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -29,8 +27,6 @@ public class WindowViewHandler {
|
||||
*/
|
||||
private static View sView = null;
|
||||
|
||||
private static WindowManager sWindowManager;
|
||||
|
||||
private static int sX, sY;
|
||||
|
||||
/**
|
||||
@@ -38,18 +34,20 @@ public class WindowViewHandler {
|
||||
*/
|
||||
private static boolean sMovable = false;
|
||||
|
||||
public static FrameLayout sFloatingLayout = null;
|
||||
|
||||
public static void init( FrameLayout frameLayout ) {
|
||||
sFloatingLayout = frameLayout;
|
||||
}
|
||||
|
||||
public static void addView( View view, int priority, int x, int y, boolean movable ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sWindowManager == null ) {
|
||||
try {
|
||||
sWindowManager = ( WindowManager ) view.getContext().getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error. " );
|
||||
return;
|
||||
}
|
||||
if ( sFloatingLayout == null ) {
|
||||
Logger.e( TAG, "no floating frame. " );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sView == view ) {
|
||||
@@ -69,7 +67,7 @@ public class WindowViewHandler {
|
||||
Logger.w( TAG, "过滤低优先级布局" );
|
||||
return;
|
||||
}
|
||||
sWindowManager.removeViewImmediate( sView );
|
||||
sFloatingLayout.removeView( sView );
|
||||
sView = view;
|
||||
sX = x;
|
||||
sY = y;
|
||||
@@ -80,6 +78,9 @@ public class WindowViewHandler {
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( sFloatingLayout == null ) {
|
||||
return;
|
||||
}
|
||||
if ( sView != view ) {
|
||||
Logger.w( TAG, "view do not added." );
|
||||
return;
|
||||
@@ -87,7 +88,7 @@ public class WindowViewHandler {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
sWindowManager.removeViewImmediate( view );
|
||||
sFloatingLayout.removeView( view );
|
||||
sView = null;
|
||||
sPriority = Integer.MIN_VALUE;
|
||||
sMovable = false;
|
||||
@@ -99,35 +100,10 @@ public class WindowViewHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.type = getFitWindowParamsType();
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.gravity = Gravity.LEFT | Gravity.TOP;
|
||||
params.x = sX;
|
||||
params.y = sY;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
sWindowManager.addView( sView, params );
|
||||
|
||||
if ( false ) {
|
||||
attachMovementEvent( sView, params );
|
||||
}
|
||||
}
|
||||
|
||||
private static int getFitWindowParamsType() {
|
||||
int type;
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 ) {
|
||||
// Need request permission.
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
} else if ( Build.MODEL.equalsIgnoreCase( "MI 5" ) ) {
|
||||
// MI 5 phone not display crawler dot in android 7.0
|
||||
type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
} else {
|
||||
// It's will be dismissed automatically 3s after showing in Android 25.
|
||||
type = WindowManager.LayoutParams.TYPE_TOAST;
|
||||
}
|
||||
return type;
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.leftMargin = sX;
|
||||
params.topMargin = sY;
|
||||
sFloatingLayout.addView( sView, params );
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
@@ -40,9 +40,9 @@
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
android:layout_marginBottom="@dimen/dp_211"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="@dimen/dp_20" />
|
||||
<!-- 应用入口-->
|
||||
<FrameLayout
|
||||
@@ -64,6 +64,12 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 浮层-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_floating_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_search_fragment"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
29
modules/mogo-module-main/src/main/res/values/styles.xml
Normal file
29
modules/mogo-module-main/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Main" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:statusBarColor" tools:ignore="NewApi">@null</item>
|
||||
<item name="android:windowEnterAnimation">@null</item>
|
||||
<item name="android:windowExitAnimation">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">#EE0C0C0C</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
|
||||
</style>
|
||||
|
||||
<style name="MainAnimation">
|
||||
<item name="android:activityOpenEnterAnimation">@null</item>
|
||||
<item name="android:activityOpenExitAnimation">@null</item>
|
||||
<item name="android:activityCloseEnterAnimation">@null</item>
|
||||
<item name="android:activityCloseExitAnimation">@null</item>
|
||||
<item name="android:taskOpenEnterAnimation">@null</item>
|
||||
<item name="android:taskOpenExitAnimation">@null</item>
|
||||
<item name="android:taskCloseEnterAnimation">@null</item>
|
||||
<item name="android:taskCloseExitAnimation">@null</item>
|
||||
<item name="android:taskToFrontEnterAnimation">@null</item>
|
||||
<item name="android:taskToFrontExitAnimation">@null</item>
|
||||
<item name="android:taskToBackEnterAnimation">@null</item>
|
||||
<item name="android:taskToBackExitAnimation">@null</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user