opt
This commit is contained in:
@@ -13,10 +13,12 @@ import com.mogo.utils.WindowUtils;
|
||||
* 采用windowManager实现接口
|
||||
*/
|
||||
class WindowManagerImpl implements IWindowManagerView {
|
||||
|
||||
private WindowManager mWindowManager;
|
||||
private WindowManager.LayoutParams mLayoutParams;
|
||||
private WindowManagerView.WMViewParams mParams;
|
||||
private boolean isShowing;
|
||||
|
||||
@Override
|
||||
public void init(WindowManagerView.WMViewParams params) {
|
||||
mParams = params;
|
||||
@@ -31,16 +33,11 @@ class WindowManagerImpl implements IWindowManagerView {
|
||||
mLayoutParams.gravity = Gravity.CENTER;
|
||||
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
mLayoutParams.width = 1920;
|
||||
mLayoutParams.height = 1080;
|
||||
} else {
|
||||
mLayoutParams.width = WindowUtils.getScreenWidth( mParams.mContext );
|
||||
mLayoutParams.height = WindowUtils.getScreenHeight( mParams.mContext );
|
||||
}
|
||||
mLayoutParams.width = mParams.mWidth;
|
||||
mLayoutParams.height = mParams.mHeight;
|
||||
mLayoutParams.x = mParams.mX;
|
||||
mLayoutParams.y = mParams.mY;
|
||||
mLayoutParams.dimAmount = 0.5f;
|
||||
mLayoutParams.x = 0;
|
||||
mLayoutParams.y = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-21
|
||||
@@ -25,56 +17,82 @@ public class WindowManagerView {
|
||||
|
||||
private WMViewParams mParams;
|
||||
|
||||
private IWindowManagerView managerView;
|
||||
private IWindowManagerView mManagerView;
|
||||
|
||||
private WindowManagerView(WMViewParams params) {
|
||||
private WindowManagerView( WMViewParams params, IWindowManagerView view ) {
|
||||
this.mParams = params;
|
||||
managerView = new DialogImpl();
|
||||
managerView.init(params);
|
||||
// init();
|
||||
mManagerView = view;
|
||||
view.init( params );
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return managerView.isShowing();
|
||||
return mManagerView.isShowing();
|
||||
}
|
||||
|
||||
public <T extends View> T findViewById(@IdRes int id) {
|
||||
return mParams.mContentView.findViewById(id);
|
||||
public < T extends View > T findViewById( @IdRes int id ) {
|
||||
return mParams.mContentView.findViewById( id );
|
||||
}
|
||||
|
||||
public void show() {
|
||||
managerView.show();
|
||||
mManagerView.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
managerView.hide();
|
||||
mManagerView.hide();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private WMViewParams mParams = null;
|
||||
|
||||
public Builder(Context context) {
|
||||
public Builder( Context context ) {
|
||||
mParams = new WMViewParams();
|
||||
mParams.mContext = context;
|
||||
}
|
||||
|
||||
public Builder contentView(View contentView) {
|
||||
public Builder contentView( View contentView ) {
|
||||
mParams.mContentView = contentView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder contentView(@LayoutRes int contentViewId) {
|
||||
mParams.mContentView = LayoutInflater.from(mParams.mContext).inflate(contentViewId,
|
||||
null);
|
||||
public Builder contentView( @LayoutRes int contentViewId ) {
|
||||
mParams.mContentView = LayoutInflater.from( mParams.mContext ).inflate( contentViewId, null );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder size( int width, int height ) {
|
||||
mParams.mWidth = width;
|
||||
mParams.mHeight = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder position( int x, int y ) {
|
||||
mParams.mX = x;
|
||||
mParams.mY = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认dialog实现
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public WindowManagerView build() {
|
||||
if (mParams.mContentView == null) {
|
||||
throw new NullPointerException("WMViewParams#mContentView must not be null.");
|
||||
return showInDialog();
|
||||
}
|
||||
|
||||
public WindowManagerView showInDialog() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView(mParams);
|
||||
return new WindowManagerView( mParams, new DialogImpl() );
|
||||
}
|
||||
|
||||
public WindowManagerView showInWindowManager() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView( mParams, new WindowManagerImpl() );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,5 +101,9 @@ public class WindowManagerView {
|
||||
|
||||
public View mContentView;
|
||||
public Context mContext;
|
||||
public int mWidth;
|
||||
public int mHeight;
|
||||
public int mX;
|
||||
public int mY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Automatically generated file. DO NOT MODIFY
|
||||
*/
|
||||
package com.zhidao.mogo.module.event.panel;
|
||||
|
||||
public final class BuildConfig {
|
||||
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
||||
public static final String LIBRARY_PACKAGE_NAME = "com.zhidao.mogo.module.event.panel";
|
||||
/**
|
||||
* @deprecated APPLICATION_ID is misleading in libraries. For the library package name use LIBRARY_PACKAGE_NAME
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String APPLICATION_ID = "com.zhidao.mogo.module.event.panel";
|
||||
public static final String BUILD_TYPE = "debug";
|
||||
public static final String FLAVOR = "";
|
||||
public static final int VERSION_CODE = 1;
|
||||
public static final String VERSION_NAME = "1.0.0-SNAPSHOT";
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0.0-SNAPSHOT" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="19"
|
||||
android:targetSdkVersion="22" />
|
||||
/
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.0-SNAPSHOT","enabled":true,"outputFile":"mogo-module-event-panel-noop-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.zhidao.mogo.module.event.panel","split":""}}]
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
#Fri Aug 07 09:54:20 CST 2020
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/res"/><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/build/generated/res/rs/debug"/><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/res"/><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/build/generated/res/rs/debug"/><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/debug/res"/></dataSet><mergedItems/></merger>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0.0-SNAPSHOT" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="19"
|
||||
android:targetSdkVersion="22" />
|
||||
/
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,2 @@
|
||||
R_DEF: Internal format may change without notice
|
||||
local
|
||||
@@ -0,0 +1,14 @@
|
||||
1<?xml version="1.0" encoding="utf-8"?>
|
||||
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
3 package="com.zhidao.mogo.module.event.panel"
|
||||
4 android:versionCode="1"
|
||||
5 android:versionName="1.0.0-SNAPSHOT" >
|
||||
6
|
||||
7 <uses-sdk
|
||||
8 android:minSdkVersion="19"
|
||||
8-->/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
9 android:targetSdkVersion="22" />
|
||||
9-->/Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
10 /
|
||||
11
|
||||
12</manifest>
|
||||
@@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.0-SNAPSHOT","enabled":true,"outputFile":"mogo-module-event-panel-noop-debug.aar","fullName":"debug","baseName":"debug"},"path":"../../library_manifest/debug/AndroidManifest.xml","properties":{"packageId":"com.zhidao.mogo.module.event.panel","split":""}}]
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
-- Merging decision tree log ---
|
||||
manifest
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
package
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:2:5-49
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
android:versionName
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
android:versionCode
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:1-5:12
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
xmlns:android
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml:1:11-69
|
||||
uses-sdk
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
android:targetSdkVersion
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
android:minSdkVersion
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/congtaowang/Public/AndroidStudioProjects/zhidao/yycp/MogoLauncher/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
|
||||
Reference in New Issue
Block a user